seemps.operators.MPO#
- class seemps.operators.MPO#
Bases:
TensorArrayMatrix 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.
- 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:
- state
MPS|MPSSum Transformed state.
- strategy
Strategy,optional Truncation strategy, defaults to DEFAULT_STRATEGY
- simplifybool,
optional Whether to simplify the state after the contraction. Defaults to strategy.get_simplify_flag()
- state
- Returns:
CanonicalMPSThe result of the contraction.
- 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\).
- 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:
- L
int The new size of the MPS. Must be strictly larger than self.size.
- sites
Iterable[int],optional Sequence of integers describing the sites that occupied by the tensors in this state.
- dimensions
int|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.
- L
- Returns:
MPOExtended 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.
- 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().
- 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()).