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

# Backends

`qiskit_addon_mpf.backends`

Optional backends for the [`DynamicMPF`](/docs/api/qiskit-addon-mpf/dynamic#dynamicmpf "qiskit_addon_mpf.dynamic.DynamicMPF") algorithm.

## Availability

Whether a certain backend can be used depends on the availability of the underlying tensor network library. This can easily be asserted at runtime using the following indicators:

### HAS\_QUIMB

Indicates whether the optional [`quimb`](https://quimb.readthedocs.io/en/latest/autoapi/quimb/index.html#module-quimb) dependency is installed.

### HAS\_TENPY

Indicates whether the optional [`tenpy`](https://tenpy.readthedocs.io/en/latest/main.html#module-tenpy "(in TeNPy v1.0.5)") dependency is installed.

## Backends

Depending on the availability (see above), the following backends are available:

|                                                                                                                                                               |                                                                                                                                         |
| ------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------- |
| [`quimb_tebd`](/docs/api/qiskit-addon-mpf/backends-quimb-tebd#module-qiskit_addon_mpf.backends.quimb_tebd "qiskit_addon_mpf.backends.quimb_tebd")             | A [`quimb`](https://quimb.readthedocs.io/en/latest/autoapi/quimb/index.html#module-quimb)-based TEBD backend.                           |
| [`quimb_layers`](/docs/api/qiskit-addon-mpf/backends-quimb-layers#module-qiskit_addon_mpf.backends.quimb_layers "qiskit_addon_mpf.backends.quimb_layers")     | A layer-wise time-evolution backend using [`quimb`](https://quimb.readthedocs.io/en/latest/autoapi/quimb/index.html#module-quimb).      |
| [`quimb_circuit`](/docs/api/qiskit-addon-mpf/backends-quimb-circuit#module-qiskit_addon_mpf.backends.quimb_circuit "qiskit_addon_mpf.backends.quimb_circuit") | A circuit-based time-evolution backend using [`quimb`](https://quimb.readthedocs.io/en/latest/autoapi/quimb/index.html#module-quimb).   |
| [`tenpy_tebd`](/docs/api/qiskit-addon-mpf/backends-tenpy-tebd#module-qiskit_addon_mpf.backends.tenpy_tebd "qiskit_addon_mpf.backends.tenpy_tebd")             | A [`tenpy`](https://tenpy.readthedocs.io/en/latest/main.html#module-tenpy "(in TeNPy v1.0.5)")-based TEBD backend.                      |
| [`tenpy_layers`](/docs/api/qiskit-addon-mpf/backends-tenpy-layers#module-qiskit_addon_mpf.backends.tenpy_layers "qiskit_addon_mpf.backends.tenpy_layers")     | A layer-wise time-evolution backend using [`tenpy`](https://tenpy.readthedocs.io/en/latest/main.html#module-tenpy "(in TeNPy v1.0.5)"). |

## Interface

The interface implemented by any one of these optional backends is made up of the following classes:

### Evolver

*class* `Evolver`

[GitHub](https://github.com/Qiskit/qiskit-addon-mpf/tree/stable/0.3/qiskit_addon_mpf/backends/interface.py#L21-L52)

Bases: [`ABC`](https://docs.python.org/3/library/abc.html#abc.ABC)

The interface for the time-evolution algorithms used within [`DynamicMPF`](/docs/api/qiskit-addon-mpf/dynamic#dynamicmpf "qiskit_addon_mpf.dynamic.DynamicMPF").

This time-evolution interface is used by the [`DynamicMPF.lhs`](/docs/api/qiskit-addon-mpf/dynamic#lhs "qiskit_addon_mpf.dynamic.DynamicMPF.lhs") and [`DynamicMPF.rhs`](/docs/api/qiskit-addon-mpf/dynamic#rhs "qiskit_addon_mpf.dynamic.DynamicMPF.rhs") and should time-evolve a [`State`](#qiskit_addon_mpf.backends.State "qiskit_addon_mpf.backends.State") object under its hood. The exact mechanism of the algorithm is described in more detail in [`DynamicMPF`](/docs/api/qiskit-addon-mpf/dynamic#dynamicmpf "qiskit_addon_mpf.dynamic.DynamicMPF"), [`State`](#qiskit_addon_mpf.backends.State "qiskit_addon_mpf.backends.State"), and [`setup_dynamic_lse()`](/docs/api/qiskit-addon-mpf/dynamic#setup_dynamic_lse "qiskit_addon_mpf.dynamic.setup_dynamic_lse").

#### conjugate

*abstract property*

Type: `bool`

Returns whether this time-evolver instance acts on the right-hand side.

#### evolved\_time

*abstract property*

Type: `float`

Returns the current evolution time.

#### step

*abstract* `step()`

[GitHub](https://github.com/Qiskit/qiskit-addon-mpf/tree/stable/0.3/qiskit_addon_mpf/backends/interface.py#L30-L38)

Perform a single time step of this time-evolution algorithm.

This should act on the internally referenced [`State`](#qiskit_addon_mpf.backends.State "qiskit_addon_mpf.backends.State") object (for which no name is prescribed by this interface). Whether this time-evolution algorithm instance should evolve the [`State`](#qiskit_addon_mpf.backends.State "qiskit_addon_mpf.backends.State") from the left- or right-hand side, depends on the value of [`conjugate`](#qiskit_addon_mpf.backends.Evolver.conjugate "qiskit_addon_mpf.backends.Evolver.conjugate").

**Return type**

None

### State

*class* `State`

[GitHub](https://github.com/Qiskit/qiskit-addon-mpf/tree/stable/0.3/qiskit_addon_mpf/backends/interface.py#L55-L117)

Bases: [`ABC`](https://docs.python.org/3/library/abc.html#abc.ABC)

The interface for the [`DynamicMPF.evolution_state`](/docs/api/qiskit-addon-mpf/dynamic#evolution_state "qiskit_addon_mpf.dynamic.DynamicMPF.evolution_state").

This time-evolution state is shared between the LHS and RHS [`Evolver`](#qiskit_addon_mpf.backends.Evolver "qiskit_addon_mpf.backends.Evolver") instances of the [`DynamicMPF`](/docs/api/qiskit-addon-mpf/dynamic#dynamicmpf "qiskit_addon_mpf.dynamic.DynamicMPF") instance. In most cases where a concrete backend implementing this interface is based on tensor networks, this state will be a matrix product operator (MPO). This is because most time-evolution algorithms would normally evolve a matrix product state (MPS) as shown pictorially below, where time evolution blocks (`U#`) are successively applied to a 1-dimensional MPS (`S#`). Here, the tensor network grows towards the right as time goes on.

```python
MPS Evolution

S0┄┄┲━━━━┱┄┄┄┄┄┄┄┄┲━━━━┱┄
│   ┃ U1 ┃        ┃ U5 ┃
S1┄┄┺━━━━┹┄┲━━━━┱┄┺━━━━┹┄
│          ┃ U3 ┃
S2┄┄┲━━━━┱┄┺━━━━┹┄┲━━━━┱┄ ...
│   ┃ U2 ┃        ┃ U6 ┃
S3┄┄┺━━━━┹┄┲━━━━┱┄┺━━━━┹┄
│          ┃ U4 ┃
S4┄┄┄┄┄┄┄┄┄┺━━━━┹┄┄┄┄┄┄┄┄
```

However, in our case, we want two time-evolution engines to share a single state. In order to achieve that, we can have one of them evolve the state from the right (just as before, `U#`), but have the second one evolve the state from the left (`V#`). This requires the state to also have bonds going of in that direction, rendering it a 2-dimensional MPO (`M#`) rather than the 1-dimensional MPS from before.

```python
MPO Evolution

    ┄┲━━━━┱┄┄┄┄┄┄┄┄┲━━━━┱┄┄M0┄┄┲━━━━┱┄┄┄┄┄┄┄┄┲━━━━┱┄
     ┃ V5 ┃        ┃ V1 ┃  │   ┃ U1 ┃        ┃ U5 ┃
    ┄┺━━━━┹┄┲━━━━┱┄┺━━━━┹┄┄M1┄┄┺━━━━┹┄┲━━━━┱┄┺━━━━┹┄
            ┃ V3 ┃         │          ┃ U3 ┃
... ┄┲━━━━┱┄┺━━━━┹┄┲━━━━┱┄┄M2┄┄┲━━━━┱┄┺━━━━┹┄┲━━━━┱┄ ...
     ┃ V6 ┃        ┃ V2 ┃  │   ┃ U2 ┃        ┃ U6 ┃
    ┄┺━━━━┹┄┲━━━━┱┄┺━━━━┹┄┄M3┄┄┺━━━━┹┄┲━━━━┱┄┺━━━━┹┄
            ┃ V4 ┃         │          ┃ U4 ┃
    ┄┄┄┄┄┄┄┄┺━━━━┹┄┄┄┄┄┄┄┄┄M4┄┄┄┄┄┄┄┄┄┺━━━━┹┄┄┄┄┄┄┄┄
```

#### overlap

*abstract* `overlap(initial_state)`

[GitHub](https://github.com/Qiskit/qiskit-addon-mpf/tree/stable/0.3/qiskit_addon_mpf/backends/interface.py#L101-L117)

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

> **Warning**
>
> A concrete implementation of this method should raise a [`TypeError`](https://docs.python.org/3/library/exceptions.html#TypeError) if the provided `initial_state` object is not supported by the implementing backend.

**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)
