Documentation for ITensorsOpenSystems.Vectorization
ITensorsOpenSystems.Vectorization.VectorizedDensityMatrix — TypeVectorizedDensityMatrix(o::ITensors.MPO, inds::Vector{<:ITensors.Index})::VectorizedDensityMatrix
Description: Construct a VectorizedDensityMatrix by vectorizing the given MPO using the provided indices.
Arguments
- o::ITensors.MPO: The MPO representing a density matrix.
- inds::Vector{<:ITensors.Index}: The vectorized indices to be used.Returns
- A VectorizedDensityMatrix obtained from o.ITensorsOpenSystems.Vectorization.add_jordan_wigner_strings — Functionadd_jordan_wigner_strings(
ops::T,
inds::Vector{<:ITensors.Index};
kwargs...,
)::T where {T<:Union{ITensors.Sum,ITensors.Scaled,ITensors.Prod{ITensors.Op}}}Add Jordan–Wigner string operators to a product of ITensors operators.
This function modifies the given operator product ops in-place by inserting appropriate string operators between the factors. The insertion is based on the fermionic nature of the indices identified by the tag sitetag (default "FermionVec"), and the symbols used for creation (creationop) and annihilation (annihilationop) operators. A generic string operator (default "F") is used to build the overall Jordan–Wigner transformation. Internally, the function tracks fermionic sites and accumulates sets of string factors, then simplifies them by canceling adjacent terms where possible. Finally, the corresponding string operators are constructed and inserted into the original product.
Arguments
ops: AnITensors.Prod{ITensors.Op}representing the product of operator factors.inds: A vector of indices (subtypes ofITensors.Index) on which the operators act.
Keyword Arguments
sitetag: Tag used to identify fermionic sites within the indices (default"FermionVec").creationop: String denoting the creation operator symbol (default"Cdag").annihilationop: String denoting the annihilation operator symbol (default"C").stringop: String representing the Jordan–Wigner string operator (default"F").
Returns
The modified operator product ops with the Jordan–Wigner strings inserted.
ITensorsOpenSystems.Vectorization.add_jordan_wigner_strings! — Functionadd_jordan_wigner_strings!(ops::ITensors.Prod{ITensors.Op}, inds::Vector{<:ITensors.Index};
sitetag::String = "FermionVec",
creationop::String = "Cdag",
annihilationop::String = "C",
stringop::String = "F",
)::ITensors.Prod{ITensors.Op}
add_jordan_wigner_strings!(
ops::ITensors.Scaled,
inds::Vector{<:ITensors.Index};
kwargs...,
)::ITensors.Scaled
add_jordan_wigner_strings!(
ops::ITensors.Sum,
inds::Vector{<:ITensors.Index};
kwargs...,
)::ITensors.Sum
add_jordan_wigner_strings(
ops::T,
inds::Vector{<:ITensors.Index};
kwargs...,
)::T where {T<:Union{ITensors.Sum,ITensors.Scaled,ITensors.Prod{ITensors.Op}}}Add Jordan–Wigner string operators to a product of ITensors operators.
This function modifies the given operator product ops in-place by inserting appropriate string operators between the factors. The insertion is based on the fermionic nature of the indices identified by the tag sitetag (default "FermionVec"), and the symbols used for creation (creationop) and annihilation (annihilationop) operators. A generic string operator (default "F") is used to build the overall Jordan–Wigner transformation. Internally, the function tracks fermionic sites and accumulates sets of string factors, then simplifies them by canceling adjacent terms where possible. Finally, the corresponding string operators are constructed and inserted into the original product.
Arguments
ops: AnITensors.Prod{ITensors.Op}representing the product of operator factors.inds: A vector of indices (subtypes ofITensors.Index) on which the operators act.
Keyword Arguments
sitetag: Tag used to identify fermionic sites within the indices (default"FermionVec").creationop: String denoting the creation operator symbol (default"Cdag").annihilationop: String denoting the annihilation operator symbol (default"C").stringop: String representing the Jordan–Wigner string operator (default"F").
Returns
The modified operator product ops with the Jordan–Wigner strings inserted.
ITensorsOpenSystems.Vectorization.anticommutator — Functionfunction anticommutator(opsum,fatsys,args...;kwargs...)
Constructs an anticommutator operator and applies it to a state.
This function first computes the vectorized operator representation of the anticommutator {q, ⋅} by calling anticommutatorapply(opsum), which returns an autoMPO object. It then uses this representation to construct an ITensors.MPO object for the given system fatsys, passing along any additional positional (args...) and keyword (kwargs...) arguments.
Arguments
opsum: The operator sum for which the anticommutator {q, ⋅} is constructed.fatsys: The system used in the MPO construction.args...: Additional positional arguments forwarded toITensors.MPO.kwargs...: Additional keyword arguments forwarded toITensors.MPO.
Returns
An ITensors.MPO representing the vectorized anticommutator operator {q, ⋅}.
See Also
commutator
ITensorsOpenSystems.Vectorization.commutator — Functionfunction commutator(opsum, fatsys,args...;kwargs...)
Constructs a commutator operator and applies it to a state.
This function first computes the vectorized operator representation of the commutator [q, ⋅] by calling commutatorapply(opsum), which returns an autoMPO object. It then uses this representation to construct an ITensors.MPO object for the given system fatsys, passing along any additional arguments
Arguments
opsum: The operator sum for which the commutator [q, ⋅] is constructed.fatsys: The system used in the MPO construction.args...: Additional positional arguments forwarded toITensors.MPO.kwargs...: Additional keyword arguments forwarded toITensors.MPO.
Returns
An ITensors.MPO representing the vectorized commutator operator [q, ⋅].
See Also
anticommutator
ITensorsOpenSystems.Vectorization.dissipator — Functiondissipator(opsum::Vector, fatsys)This function computes the Lindblad dissipator for the array of op sums by applying the lindbladdissipator function element-wise. The resulting individual dissipators are then summed to obtain the total dissipator operator. Finally, an ITensors.MPO is constructed from this operator for the given system fatsys, with any additional positional (args...) and keyword (kwargs...) arguments forwarded to ITensors.MPO.
Arguments
opsum::Vector: Vector of OpSumsfatsys: Vectorized system
Returns
- ITensors.MPO
...
ITensorsOpenSystems.Vectorization.fatsiteinds — Functionfatsiteinds(tag::String, N::Integer; kwargs...)Arguments
tag::String: the name of the base space to vectorizeN::Integer: the number of site indices to createoperators::Vector{String}: (Optional) A vector of operators
Examples
julia> fatsys = fatsiteinds("S=1/2", 3)
3-element Vector{ITensors.Index{Int64}}:
(dim=4|id=770|"S=1/2Vec,Site,n=1")
(dim=4|id=704|"S=1/2Vec,Site,n=2")
(dim=4|id=428|"S=1/2Vec,Site,n=3")
julia> operators = ["Z", "X", "Y", ("Sp", "Sm")]
4-element Vector{Any}:
"Z"
"X"
"Y"
("Sp", "Sm")
julia> fatsys = fatsiteinds("S=1/2", 3, operators)
3-element Vector{ITensors.Index{Int64}}:
(dim=4|id=625|"S=1/2Vec,Site,n=1")
(dim=4|id=31|"S=1/2Vec,Site,n=2")
(dim=4|id=697|"S=1/2Vec,Site,n=3")Create an array of N physical site indices of type tag within an vectorized space. Keyword arguments can be used to specify quantum number conservation, see the space function corresponding to the site type tag for supported keyword arguments. These keyword arguments are passed through to the ITensors.siteinds function.
ITensorsOpenSystems.Vectorization.full_anticommutator — Functionfull_anticommutator(matrixType::Type, H, indices) -> matrixType
full_anticommutator(H, indices)Constructs the full matrix representation for the anticommutator operation induced by operator H.
This function calls MatrixConstruction.buildmatrix on anticommutatorapply(H) to generate a matrix that represents the anticommutator action ({H, ·} = H· + ·H) in the vectorized space defined by indices.
Arguments
matrixType::Type: (optional) The desired output matrix type.H: The operator for which the anticommutator is computed.indices: A vector of indices defining the Hilbert space basis.
When matrixType is provided the resulting matrix will be of that type; otherwise, the default matrix type is used.
ITensorsOpenSystems.Vectorization.full_commutator — Functionfull_commutator(matrixType::Type, H, indices) -> matrixType
full_commutator(H, indices)Constructs the full matrix representation for the commutator operation induced by operator H.
This function calls MatrixConstruction.buildmatrix on commutatorapply(H) to generate a matrix that represents the commutator action ([H, ·] = H· - ·H) in the vectorized space defined by indices.
Arguments
matrixType::Type: (optional) The desired output matrix type.H: The operator for which the commutator is computed.indices: A vector of indices defining the Hilbert space basis.
When matrixType is provided the resulting matrix will be of that type; otherwise, the default matrix type is used.
ITensorsOpenSystems.Vectorization.full_dissipator — Functionfull_dissipator(matrixType::Type, A, indices) -> matrixType
full_dissipator(A, indices)
full_dissipator(A::Vector, indices)Constructs the full matrix representation of the Lindblad dissipator for operator(s) A.
The function calls MatrixConstruction.buildmatrix on lindbladdissipator(A) to generate a matrix representing the dissipative dynamics in the vectorized space defined by indices. When A is a vector of operators, their individual dissipators are summed (using an operator sum initializer).
Arguments
matrixType::Type: (optional) The desired output matrix type.A: The operator or vector of operators for which the dissipator is defined.indices: A vector of indices defining the Hilbert space basis.
When matrixType is provided the resulting matrix will be of that type; otherwise, the default matrix type is used.
ITensorsOpenSystems.Vectorization.full_leftmultiply — Functionfull_leftmultiply(matrixType::Type, H, indices) -> matrixType
full_leftmultiply(H, indices)Constructs the full matrix representation for left multiplication by operator H.
This function calls MatrixConstruction.buildmatrix on leftapply(H) to generate a matrix representing the left-multiplication action in the vectorized space defined by indices.
Arguments
matrixType::Type: (optional) The desired output matrix type.H: The operator whose left multiplication is to be represented.indices: A vector of indices defining the Hilbert space basis.
When matrixType is provided the resulting matrix will be of that type; otherwise, the default matrix type is used.
ITensorsOpenSystems.Vectorization.full_rightmultiply — Functionfull_rightmultiply(matrixType::Type, H, indices) -> matrixType
full_rightmultiply(H, indices)Constructs the full matrix representation for right multiplication by operator H.
This function calls MatrixConstruction.buildmatrix on rightapply(H) to generate a matrix representing the right-multiplication action in the vectorized space defined by indices.
Arguments
matrixType::Type: (optional) The desired output matrix type.H: The operator whose right multiplication is to be represented.indices: A vector of indices defining the Hilbert space basis.
When matrixType is provided the resulting matrix will be of that type; otherwise, the default matrix type is used.
ITensorsOpenSystems.Vectorization.full_unvectorize_densitymatrix — Functionfull_unvectorize_densitymatrix(ρ::Vector{T}, indices::Vector{<:ITensors.Index}) -> Matrix{T} where {T}Convert a vectorized density matrix ρ into its standard square matrix representation.
This function reconstructs a density matrix from its vectorized form. The dimensions of the Hilbert space are determined by processing each index in indices via basespace, ITensors.SiteType, and ITensors.space. For indices where the space is represented as a vector, the total dimension is obtained by summing over the second element of each subspace tuple. The product of these dimensions yields N, so that the density matrix should have N^2 elements. If the length of ρ does not equal N^2, an ArgumentError is thrown.
Arguments
ρ::Vector{T}: A vector containing the density matrix elements in a vectorized (flattened) form.indices::Vector{<:ITensors.Index}: A vector of indices defining the Hilbert space.
Returns
A Matrix{T} of size N × N, where N is the product of the Hilbert space dimensions.
Throws
ArgumentErroriflength(ρ) != N^2.
ITensorsOpenSystems.Vectorization.operatorconj — Functionoperatorconj(rho::VectorizedDensityMatrix)::VectorizedDensityMatrixPerforms the hermitian conjugate on a vectorized density matrix
ITensorsOpenSystems.Vectorization.trace — Functiontrace(o::Union{ITensors.MPS,VectorizedDensityMatrix})
Calculates the trace of a vectorized density matrix by evaluating Tr(Id ρ).
Arguments
- o::Union{ITensors.MPS,VectorizedDensityMatrix}: The vectorized density matrix as an MPS.Returns
- The trace of ρ.ITensorsOpenSystems.Vectorization.unvectorize_density_matrix! — Functionunvectorize_density_matrix!(
m::VectorizedDensityMatrix,
unvectorized_inds::Vector{<:ITensors.Index},
)::ITensors.MPODescription: Undoes the vectorization of a VectorizedDensityMatrix, in place, resulting in an MPO. The indices of the resulting MPO are given by unvectorized_inds
Arguments
- m::VectorizedDensityMatrix: The vectorized density matrix.
- unvectorized_inds::Vector{<:ITensors.Index}: The target unvectorized indices.Returns
- An ITensors.MPO representing the unvectorized density matrix.ITensorsOpenSystems.Vectorization.vectorize_density_matrix! — Functionvectorize_density_matrix!(o::ITensors.MPO,vectorizedinds::Vector{<:ITensors.Index})::VectorizedDensityMatrixTreating the MPO as a density matrix, performs fat vectorization in place, resulting in a VectorizedDensityMatrix with indices given by vectorizedinds
see also: VectorizedDensityMatrix