---
title: MPOState (latest version)
description: API reference for qiskit_addon_mpf.backends.tenpy_tebd.MPOState in the latest version of qiskit-addon-mpf
source: https://eu-de.quantum.cloud.ibm.com/docs/en/api/qiskit-addon-mpf/backends-tenpy-tebd-mpo-state
---

# MPOState

*class* `MPOState(sites, Ws, bc='finite', IdL=None, IdR=None, max_range=None, explicit_plus_hc=False)`

[GitHub](https://github.com/Qiskit/qiskit-addon-mpf/tree/stable/0.3/qiskit_addon_mpf/backends/tenpy_tebd/state.py#L27-L122)

Bases: [`MPO`](https://tenpy.readthedocs.io/en/latest/reference/tenpy.networks.mpo.MPO.html#tenpy.networks.mpo.MPO "(in TeNPy v1.0.5)"), [`State`](/docs/api/qiskit-addon-mpf/backends#state "qiskit_addon_mpf.backends.interface.State")

A mediator class to make TeNPy’s MPO match the [`State`](/docs/api/qiskit-addon-mpf/backends#state "qiskit_addon_mpf.backends.State") interface.

This class simply ensures that a [`tenpy.networks.mpo.MPO`](https://tenpy.readthedocs.io/en/latest/reference/tenpy.networks.mpo.MPO.html#tenpy.networks.mpo.MPO "(in TeNPy v1.0.5)") object can work as a [`State`](/docs/api/qiskit-addon-mpf/backends#state "qiskit_addon_mpf.backends.State") instance.

## Methods

### initialize\_from\_lattice

*classmethod* `initialize_from_lattice(lat, *, conserve=True)`

[GitHub](https://github.com/Qiskit/qiskit-addon-mpf/tree/stable/0.3/qiskit_addon_mpf/backends/tenpy_tebd/state.py#L34-L89)

Construct an identity [`MPOState`](#qiskit_addon_mpf.backends.tenpy_tebd.MPOState "qiskit_addon_mpf.backends.tenpy_tebd.MPOState") instance matching the provided lattice shape.

Given a lattice, this method constructs a new MPO identity matching the shape of the lattice.

**Parameters**

- **lat** ([*Lattice*](https://tenpy.readthedocs.io/en/latest/reference/tenpy.models.lattice.Lattice.html#tenpy.models.lattice.Lattice "(in TeNPy v1.0.5)")) – the lattice describing the MPO sites.
- **conserve** ([*bool*](https://docs.python.org/3/library/functions.html#bool)) – whether to conserve `Sz`. This is a simplified version of the more elaborate `conserve` property of [`SpinHalfSite`](https://tenpy.readthedocs.io/en/latest/reference/tenpy.networks.site.SpinHalfSite.html#tenpy.networks.site.SpinHalfSite "(in TeNPy v1.0.5)"). The boolean value simply indicates `Sz` (`True`) or `None` conservation (`False`)

**Returns**

An identity MPO.

**Return type**

[*MPOState*](#qiskit_addon_mpf.backends.tenpy_tebd.MPOState "qiskit_addon_mpf.backends.tenpy_tebd.state.MPOState")

### overlap

`overlap(initial_state)`

[GitHub](https://github.com/Qiskit/qiskit-addon-mpf/tree/stable/0.3/qiskit_addon_mpf/backends/tenpy_tebd/state.py#L91-L122)

Compute the overlap of this state with the provided initial state.

> **Warning**
>
> This implementation only supports instances of [`tenpy.networks.mps.MPS`](https://tenpy.readthedocs.io/en/latest/reference/tenpy.networks.mps.MPS.html#tenpy.networks.mps.MPS "(in TeNPy v1.0.5)") for `initial_state`.

**Parameters**

**initial\_state** ([*Any*](https://docs.python.org/3/library/typing.html#typing.Any)) – the initial state with which to compute the overlap.

**Raises**

[**TypeError**](https://docs.python.org/3/library/exceptions.html#TypeError) – if the provided initial state has an incompatible type.

**Returns**

The overlap of this state with the provided one.

**Return type**

[complex](https://docs.python.org/3/library/functions.html#complex)
