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

# Quimb TEBD backend

`qiskit_addon_mpf.backends.quimb_tebd`

A [`quimb`](https://quimb.readthedocs.io/en/latest/autoapi/quimb/index.html#module-quimb)-based TEBD backend.

> **Warning**
>
> This backend is only available if the optional dependencies have been installed:
>
> ```python
> pip install "qiskit-addon-mpf[quimb]"
> ```

|                                                                                                                                 |                                                |
| ------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------- |
| [`TEBDEvolver`](/docs/api/qiskit-addon-mpf/backends-quimb-tebd-tebd-evolver "qiskit_addon_mpf.backends.quimb_tebd.TEBDEvolver") | A TEBD algorithm for evolving an internal MPO. |
| [`MPOState`](/docs/api/qiskit-addon-mpf/backends-quimb-tebd-mpo-state "qiskit_addon_mpf.backends.quimb_tebd.MPOState")          | An MPO enforcing the Vidal gauge.              |

## Underlying method

This module provides a time-evolution backend for computing dynamic MPF coefficients based on the time-evolving block decimation (TEBD) algorithm \[1] implemented in the [`quimb`](https://quimb.readthedocs.io/en/latest/autoapi/quimb/index.html#module-quimb) tensor network library.

The classes provided by this module serve two purposes:

1. Connecting [`quimb`](https://quimb.readthedocs.io/en/latest/autoapi/quimb/index.html#module-quimb)’s implementation to the interface set out by [`qiskit_addon_mpf.backends`](/docs/api/qiskit-addon-mpf/backends#module-qiskit_addon_mpf.backends "qiskit_addon_mpf.backends").
2. Extending [`quimb`](https://quimb.readthedocs.io/en/latest/autoapi/quimb/index.html#module-quimb)’s TEBD implementation to handle an internal MPO (rather than MPS) state (see also [`State`](/docs/api/qiskit-addon-mpf/backends#state "qiskit_addon_mpf.backends.State") for more details).

In the simplest sense, this module provides a straight-forward extension of the TEBD algorithm to evolve an internal MPO state. As such, if you wish to use this backend for your dynamic MPF algorithm, you must encode the Hamiltonian that you wish to time-evolve, in a [`quimb`](https://quimb.readthedocs.io/en/latest/autoapi/quimb/index.html#module-quimb)-native form. To be more concrete, the [`TEBDEvolver`](/docs/api/qiskit-addon-mpf/backends-quimb-tebd-tebd-evolver "qiskit_addon_mpf.backends.quimb_tebd.TEBDEvolver") class (which is a subclass of [`quimb.tensor.TEBD`](https://quimb.readthedocs.io/en/latest/autoapi/quimb/tensor/index.html#quimb.tensor.TEBD)) works with a Hamiltonian in the form of a [`quimb.tensor.LocalHam1D`](https://quimb.readthedocs.io/en/latest/autoapi/quimb/tensor/index.html#quimb.tensor.LocalHam1D). Quimb provides a number of convenience methods for constructing such Hamiltonians in its [`quimb.tensor.tensor_builder`](https://quimb.readthedocs.io/en/latest/autoapi/quimb/tensor/tensor_builder/index.html#module-quimb.tensor.tensor_builder) module. If none of those fulfill your needs, you can consider using the [`LayerModel`](/docs/api/qiskit-addon-mpf/backends-quimb-layers-layer-model "qiskit_addon_mpf.backends.quimb_layers.LayerModel") class which implements some conversion methods from Qiskit-native objects.

## Code example

This section shows a simple example to get you started with using this backend. The example shows how to create the three factory functions required for the [`setup_dynamic_lse()`](/docs/api/qiskit-addon-mpf/dynamic#setup_dynamic_lse "qiskit_addon_mpf.dynamic.setup_dynamic_lse").

First, we create the `identity_factory` which has to match the [`IdentityStateFactory`](/docs/api/qiskit-addon-mpf/dynamic#identitystatefactory "qiskit_addon_mpf.dynamic.IdentityStateFactory") protocol. We do so simply by using the [`quimb.tensor.MPO_identity()`](https://quimb.readthedocs.io/en/latest/autoapi/quimb/tensor/index.html#quimb.tensor.MPO_identity) function and wrapping the resulting [`quimb.tensor.MatrixProductOperator`](https://quimb.readthedocs.io/en/latest/autoapi/quimb/tensor/index.html#quimb.tensor.MatrixProductOperator) with our custom [`MPOState`](/docs/api/qiskit-addon-mpf/backends-quimb-tebd-mpo-state "qiskit_addon_mpf.backends.quimb_tebd.MPOState") interface.

```python
>>> from qiskit_addon_mpf.backends.quimb_tebd import MPOState
>>> from quimb.tensor import MPO_identity
>>> num_qubits = 10
>>> identity_factory = lambda: MPOState(MPO_identity(num_qubits))
```

Next, before being able to define the [`ExactEvolverFactory`](/docs/api/qiskit-addon-mpf/dynamic#exactevolverfactory "qiskit_addon_mpf.dynamic.ExactEvolverFactory") and [`ApproxEvolverFactory`](/docs/api/qiskit-addon-mpf/dynamic#approxevolverfactory "qiskit_addon_mpf.dynamic.ApproxEvolverFactory") protocols, we must define the Hamiltonian which we would like to time-evolve. Here, we simply choose one of [`quimb`](https://quimb.readthedocs.io/en/latest/autoapi/quimb/index.html#module-quimb)’s convenience methods.

```python
>>> from quimb.tensor import ham_1d_heis
>>> hamil = ham_1d_heis(num_qubits, 0.8, 0.3, cyclic=False)
```

We can now construct the exact and approximate time-evolution instance factories. To do so, we can simply use [`functools.partial()`](https://docs.python.org/3/library/functools.html#functools.partial) to bind the pre-defined values of the [`TEBDEvolver`](/docs/api/qiskit-addon-mpf/backends-quimb-tebd-tebd-evolver "qiskit_addon_mpf.backends.quimb_tebd.TEBDEvolver") initializer, reducing it to the correct interface as expected by the [`ExactEvolverFactory`](/docs/api/qiskit-addon-mpf/dynamic#exactevolverfactory "qiskit_addon_mpf.dynamic.ExactEvolverFactory") and [`ApproxEvolverFactory`](/docs/api/qiskit-addon-mpf/dynamic#approxevolverfactory "qiskit_addon_mpf.dynamic.ApproxEvolverFactory") protocols, respectively.

```python
>>> from functools import partial
>>> from qiskit_addon_mpf.backends.quimb_tebd import TEBDEvolver
>>> exact_evolver_factory = partial(
...     TEBDEvolver,
...     H=hamil,
...     dt=0.05,
...     order=4,
... )
```

Notice, how we have fixed the `dt` value to a small time step and have used a higher-order Suzuki-Trotter decomposition to mimic the exact time evolution above.

Below, we do not fix the `dt` value and use only a second-order Suzuki-Trotter formula for the approximate time evolution. Additionally, we also specify some truncation settings.

```python
>>> approx_evolver_factory = partial(
...     TEBDEvolver,
...     H=hamil,
...     order=2,
...     split_opts={"max_bond": 10, "cutoff": 1e-5},
... )
```

Of course, you are not limited to the examples shown here, and we encourage you to play around with the other settings provided by the [`quimb.tensor.TEBD`](https://quimb.readthedocs.io/en/latest/autoapi/quimb/tensor/index.html#quimb.tensor.TEBD) implementation.

## Limitations

Finally, we point out a few known limitations on what kind of Hamiltonians can be treated by this backend:

- all interactions must be 1-dimensional
- the interactions must be acylic

## Resources

\[1]: [https://en.wikipedia.org/wiki/Time-evolving\_block\_decimation](https://en.wikipedia.org/wiki/Time-evolving_block_decimation)
