seemps.operators.MPO#

class seemps.operators.MPO#

Bases: TensorArray

Matrix Product Operator class.

This implements a bare-bones Matrix Product Operator object with open boundary conditions. The tensors have four indices, A[α,i,j,β], where ‘α,β’ are the internal labels and ‘i,j’ the physical indices ar the given site.

Parameters:
data: Sequence[Tensor4]

Sequence of four-legged tensors forming the structure.

strategy: Strategy, default = DEFAULT_STRATEGY

Truncation strategy for algorithms.

property T: MPO#

Return the transpose of this operator.

apply(state: MPS, strategy: Strategy | None = None, simplify: bool | None = None) MPS[source]#
apply(state: MPSSum, strategy: Strategy | None = None, simplify: bool | None = None) MPS

Implement multiplication A @ state between a matrix-product operator A and a matrix-product state state.

Parameters:
stateMPS | MPSSum

Transformed state.

strategyStrategy, optional

Truncation strategy, defaults to DEFAULT_STRATEGY

simplifybool, optional

Whether to simplify the state after the contraction. Defaults to strategy.get_simplify_flag()

Returns:
CanonicalMPS

The result of the contraction.

bond_dimensions() list[int][source]#

Return the bond dimensions of the MPO.

conj() MPO[source]#

Return the complex conjugate of this operator.

copy() MPO[source]#

Return a shallow copy of the MPO, without duplicating the tensors.

dimensions() list[int][source]#

Return the physical dimensions (Deprecated, see dimensions()).

expectation(bra: MPS, ket: TypeAliasForwardRef('~seemps.state.MPS') | None = None) Weight[source]#

Expectation value of MPO on one or two MPS states.

If one state is given, this state is interpreted as \(\psi\) and this function computes \(\langle{\psi|O\psi}\rangle\) If two states are given, the first one is the bra \(\psi\), the second one is the ket \(\phi\), and this computes \(\langle\psi|O|\phi\rangle\).

Parameters:
braMPS

The state \(\psi\) on which the expectation value is computed.

ketMPS | None

The ket component of the expectation value. Defaults to bra.

Returns:
float | complex

\(\langle\psi\vert{O}\vert\phi\rangle\) where O is the matrix-product operator.

extend(L: int, sites: Sequence[int] | None = None, dimensions: int | list[int] = 2) MPO[source]#

Enlarge an MPO so that it acts on a larger Hilbert space with ‘L’ sites.

Parameters:
Lint

The new size of the MPS. Must be strictly larger than self.size.

sitesIterable[int], optional

Sequence of integers describing the sites that occupied by the tensors in this state.

dimensionsint | list[int], default = 2

Dimension of the added sites. It can be the same integer or a list of integers with the same length as sites.

Returns:
MPO

Extended MPO.

classmethod from_local_operators(operators: list[TypeAliasForwardRef('~seemps.typing.Operator')], strategy: Strategy = DEFAULT_STRATEGY) MPO[source]#

Product of local operators acting on each subsystem.

max_bond_dimension() int[source]#

Return the largest bond dimension.

physical_dimensions() list[int][source]#

Return the physical dimensions of the MPO.

reverse() MPO[source]#

Reverse the sites and tensors.

Creates a new matrix product operator where tensors 0, 1, …, N-1 are mapped to N-1, N-2, …, 0. For the MPO to be consistent, this also implies reversing the order of the intermediate indices. Thus, if we label as A and B the tensors of the original and of the reversed MPOs, we have

\[B_{a_{n-1},i_n,j_n,a_n} = A_{a_{N-n-1},i_{N-n-1},j_{N-n-1},a_{N-n-2}}\]

See also see reverse().

set_strategy(strategy: Strategy) MPO[source]#

Return MPO with the given strategy.

to_matrix() DenseOperator[source]#

Convert this MPO to a dense or sparse matrix.

tomatrix() DenseOperator[source]#

Convert this MPO to a dense or sparse matrix (Deprecated, see to_matrix()).