Documentation for ITensorsOpenSystems.MatrixConstruction

ITensorsOpenSystems.MatrixConstruction.buildmatrixFunction
buildmatrix(
    matrixType::Type{M},
    operator::OpSum,
    indices,
    )::M where {M<:Union{<:AbstractMatrix,<:AbstractSparseMatrix}}

Constructs a matrix representation of an operator defined as an OpSum.

This function builds a dense or sparse matrix (of type M) representation for a quantum operator given by operator using a specified set of indices. The indices determine the dimensions and ordering of the matrix representation. Internally, each term of the operator is converted to a tensor (using _tensor_from_autoMPO), and the tensor indices are mapped to linear matrix indices based on the ordering provided by indices.

Arguments

  • matrixType::Type{M}: The matrix type to construct, where M must be a subtype of AbstractMatrix or AbstractSparseMatrix.
  • operator::OpSum: The operator (expressed as a sum of terms) for which the matrix representation is built.
  • indices: A collection of indices defining the matrix's basis. Each index must have a prime level (plev) of 0, and duplicate indices are not allowed.

Returns

A matrix of type M with dimensions equal to the product of the dimensions of the provided indices. This matrix represents the operator in the basis specified by indices.

source