Skip to content

Commit

Permalink
Regenerate addons with images with alt text (#2527)
Browse files Browse the repository at this point in the history
This PR regenerates `qiskit-addon-mpf`, `qiskit-addon-utils`, and
`qiskit-addon-obp` after adding the alt text in all their images.

Commands ran:
```bash
 npm run regen-apis -- -p qiskit-addon-obp
 npm run regen-apis -- -p qiskit-addon-utils
 npm run regen-apis -- -p qiskit-addon-mpf
```
  • Loading branch information
arnaucasau authored Dec 23, 2024
1 parent a568f22 commit a149464
Show file tree
Hide file tree
Showing 39 changed files with 141 additions and 144 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ python_api_name: qiskit_addon_mpf.backends.quimb_circuit.CircuitEvolver
**Parameters**

* **evolution\_state** ([*CircuitState*](backends-quimb-circuit-circuit-state "qiskit_addon_mpf.backends.quimb_circuit.CircuitState")) – a reference to the time-evolution state.
* **circuit** (*QuantumCircuit*) – the template circuit encoding the time-evolution of a single Trotter step. This circuit **must** be parameterized (see [`Parameter`](/api/qiskit/qiskit.circuit.Parameter "(in Qiskit v1.2)") in place of the Trotter methods time step. This parameter must be named `dt`.
* **dt** ([*float*](https://docs.python.org/3/library/functions.html#float "(in Python v3.13)")) – the time step that will be used and later bound to the [`Parameter`](/api/qiskit/qiskit.circuit.Parameter "(in Qiskit v1.2)") of the `circuit` object.
* **circuit** (*QuantumCircuit*) – the template circuit encoding the time-evolution of a single Trotter step. This circuit **must** be parameterized (see [`Parameter`](/api/qiskit/qiskit.circuit.Parameter "(in Qiskit v1.3)") in place of the Trotter methods time step. This parameter must be named `dt`.
* **dt** ([*float*](https://docs.python.org/3/library/functions.html#float "(in Python v3.13)")) – the time step that will be used and later bound to the [`Parameter`](/api/qiskit/qiskit.circuit.Parameter "(in Qiskit v1.3)") of the `circuit` object.

## Attributes

Expand All @@ -46,7 +46,7 @@ python_api_name: qiskit_addon_mpf.backends.quimb_circuit.CircuitEvolver
### circuit

<Attribute id="qiskit_addon_mpf.backends.quimb_circuit.CircuitEvolver.circuit">
The parameterized [`QuantumCircuit`](/api/qiskit/qiskit.circuit.QuantumCircuit "(in Qiskit v1.2)") describing the Trotter step.
The parameterized [`QuantumCircuit`](/api/qiskit/qiskit.circuit.QuantumCircuit "(in Qiskit v1.3)") describing the Trotter step.
</Attribute>

## Methods
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ python_api_name: qiskit_addon_mpf.backends.quimb_circuit.CircuitState
Compute the overlap of this state with the provided initial state.

<Admonition title="Warning" type="caution">
This implementation only supports instances of [`qiskit.circuit.QuantumCircuit`](/api/qiskit/qiskit.circuit.QuantumCircuit "(in Qiskit v1.2)") for `initial_state`.
This implementation only supports instances of [`qiskit.circuit.QuantumCircuit`](/api/qiskit/qiskit.circuit.QuantumCircuit "(in Qiskit v1.3)") for `initial_state`.
</Admonition>

**Parameters**
Expand Down
10 changes: 5 additions & 5 deletions docs/api/qiskit-addon-mpf/backends-quimb-circuit.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ python_api_name: 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 "(in quimb v1.9)").
A circuit-based time-evolution backend using [`quimb`](https://quimb.readthedocs.io/en/latest/autoapi/quimb/index.html#module-quimb "(in quimb v1.10)").

<Admonition title="Warning" type="caution">
This backend is only available if the optional dependencies have been installed:
Expand All @@ -31,7 +31,7 @@ A circuit-based time-evolution backend using [`quimb`](https://quimb.readthedocs

## Underlying method

Quimb boasts direct support for the simulation of quantum circuits in the form of its tensor-network based [`quimb.tensor.Circuit`](https://quimb.readthedocs.io/en/latest/autoapi/quimb/tensor/index.html#quimb.tensor.Circuit "(in quimb v1.9)") representation. We can leverage this, to bypass any explicit time-evolution algorithm and instead directly encode the time-evolution in a [`QuantumCircuit`](/api/qiskit/qiskit.circuit.QuantumCircuit "(in Qiskit v1.2)") and use [`quimb`](https://quimb.readthedocs.io/en/latest/autoapi/quimb/index.html#module-quimb "(in quimb v1.9)") to compute the overlap between two such circuits. For more information, check out their guide on [Quantum Circuits](https://quimb.readthedocs.io/en/latest/tensor-circuit.html "(in quimb v1.9)").
Quimb boasts direct support for the simulation of quantum circuits in the form of its tensor-network based [`quimb.tensor.Circuit`](https://quimb.readthedocs.io/en/latest/autoapi/quimb/tensor/index.html#quimb.tensor.Circuit "(in quimb v1.10)") representation. We can leverage this, to bypass any explicit time-evolution algorithm and instead directly encode the time-evolution in a [`QuantumCircuit`](/api/qiskit/qiskit.circuit.QuantumCircuit "(in Qiskit v1.3)") and use [`quimb`](https://quimb.readthedocs.io/en/latest/autoapi/quimb/index.html#module-quimb "(in quimb v1.10)") to compute the overlap between two such circuits. For more information, check out their guide on [Quantum Circuits](https://quimb.readthedocs.io/en/latest/tensor-circuit.html "(in quimb v1.10)").

## Code example

Expand All @@ -44,7 +44,7 @@ The [`IdentityStateFactory`](dynamic#identitystatefactory "qiskit_addon_mpf.dyna
>>> identity_factory = CircuitState
```

The setup of the [`CircuitEvolver`](backends-quimb-circuit-circuit-evolver "qiskit_addon_mpf.backends.quimb_circuit.CircuitEvolver") is slightly more involved. It requires a **parameterized** [`QuantumCircuit`](/api/qiskit/qiskit.circuit.QuantumCircuit "(in Qiskit v1.2)") object as its input where the [`Parameter`](/api/qiskit/qiskit.circuit.Parameter "(in Qiskit v1.2)") should take the place of the Trotter methods time step (`dt`).
The setup of the [`CircuitEvolver`](backends-quimb-circuit-circuit-evolver "qiskit_addon_mpf.backends.quimb_circuit.CircuitEvolver") is slightly more involved. It requires a **parameterized** [`QuantumCircuit`](/api/qiskit/qiskit.circuit.QuantumCircuit "(in Qiskit v1.3)") object as its input where the [`Parameter`](/api/qiskit/qiskit.circuit.Parameter "(in Qiskit v1.3)") should take the place of the Trotter methods time step (`dt`).

To show how such a parameterized Trotter circuit template is constructed, we reuse the same Hamiltonian and second-order Suzuki-Trotter formula as in [`quimb_layers`](backends-quimb-layers#module-qiskit_addon_mpf.backends.quimb_layers "qiskit_addon_mpf.backends.quimb_layers").

Expand All @@ -59,7 +59,7 @@ To show how such a parameterized Trotter circuit template is constructed, we reu
... )
```

But this time, we specify a [`Parameter`](/api/qiskit/qiskit.circuit.Parameter "(in Qiskit v1.2)") as the `time` argument when constructing the actual circuits.
But this time, we specify a [`Parameter`](/api/qiskit/qiskit.circuit.Parameter "(in Qiskit v1.3)") as the `time` argument when constructing the actual circuits.

```python
>>> from functools import partial
Expand All @@ -73,7 +73,7 @@ But this time, we specify a [`Parameter`](/api/qiskit/qiskit.circuit.Parameter "
```

<Admonition title="Caution" type="note">
It is **necessary** that the name of the [`Parameter`](/api/qiskit/qiskit.circuit.Parameter "(in Qiskit v1.2)") is `dt`!
It is **necessary** that the name of the [`Parameter`](/api/qiskit/qiskit.circuit.Parameter "(in Qiskit v1.3)") is `dt`!
</Admonition>

We can choose a higher order Trotter formula for the `exact_evolver_factory`. But note, that we must once again use a parameterized circuit, even if we immediately bind its parameter when constructing the `partial` function.
Expand Down
12 changes: 6 additions & 6 deletions docs/api/qiskit-addon-mpf/backends-quimb-layers-layer-model.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,15 @@ python_api_name: qiskit_addon_mpf.backends.quimb_layers.LayerModel
# LayerModel

<Class id="qiskit_addon_mpf.backends.quimb_layers.LayerModel" isDedicatedPage={true} github="https://github.com/Qiskit/qiskit-addon-mpf/tree/stable/0.2/qiskit_addon_mpf/backends/quimb_layers/model.py#L25-L150" signature="LayerModel(L, H2, H1=None, cyclic=False, keep_only_odd=None)" modifiers="class">
Bases: [`LocalHam1D`](https://quimb.readthedocs.io/en/latest/autoapi/quimb/tensor/tensor_1d_tebd/index.html#quimb.tensor.tensor_1d_tebd.LocalHam1D "(in quimb v1.9)")
Bases: [`LocalHam1D`](https://quimb.readthedocs.io/en/latest/autoapi/quimb/tensor/tensor_1d_tebd/index.html#quimb.tensor.tensor_1d_tebd.LocalHam1D "(in quimb v1.10)")

A model for representing a layer of time-evolution interactions.

Essentially, this class is a simple wrapper of [`quimb.tensor.LocalHam1D`](https://quimb.readthedocs.io/en/latest/autoapi/quimb/tensor/index.html#quimb.tensor.LocalHam1D "(in quimb v1.9)"). Its main purpose is to provide a simple interface for constructing a Quimb-compatible Hamiltonian from Qiskit objects.
Essentially, this class is a simple wrapper of [`quimb.tensor.LocalHam1D`](https://quimb.readthedocs.io/en/latest/autoapi/quimb/tensor/index.html#quimb.tensor.LocalHam1D "(in quimb v1.10)"). Its main purpose is to provide a simple interface for constructing a Quimb-compatible Hamiltonian from Qiskit objects.

Initialize a [`LayerModel`](#qiskit_addon_mpf.backends.quimb_layers.LayerModel "qiskit_addon_mpf.backends.quimb_layers.LayerModel") instance.

Most of the arguments below are simply forwarded to [`quimb.tensor.LocalHam1D`](https://quimb.readthedocs.io/en/latest/autoapi/quimb/tensor/index.html#quimb.tensor.LocalHam1D "(in quimb v1.9)") so check out its documentation for more details.
Most of the arguments below are simply forwarded to [`quimb.tensor.LocalHam1D`](https://quimb.readthedocs.io/en/latest/autoapi/quimb/tensor/index.html#quimb.tensor.LocalHam1D "(in quimb v1.10)") so check out its documentation for more details.

**Parameters**

Expand All @@ -40,13 +40,13 @@ python_api_name: qiskit_addon_mpf.backends.quimb_layers.LayerModel
### from\_quantum\_circuit

<Function id="qiskit_addon_mpf.backends.quimb_layers.LayerModel.from_quantum_circuit" github="https://github.com/Qiskit/qiskit-addon-mpf/tree/stable/0.2/qiskit_addon_mpf/backends/quimb_layers/model.py#L73-L150" signature="from_quantum_circuit(circuit, *, scaling_factor=1.0, keep_only_odd=None, **kwargs)" modifiers="classmethod">
Construct a [`LayerModel`](#qiskit_addon_mpf.backends.quimb_layers.LayerModel "qiskit_addon_mpf.backends.quimb_layers.LayerModel") from a [`QuantumCircuit`](/api/qiskit/qiskit.circuit.QuantumCircuit "(in Qiskit v1.2)").
Construct a [`LayerModel`](#qiskit_addon_mpf.backends.quimb_layers.LayerModel "qiskit_addon_mpf.backends.quimb_layers.LayerModel") from a [`QuantumCircuit`](/api/qiskit/qiskit.circuit.QuantumCircuit "(in Qiskit v1.3)").

You can see an example of this function in action in the docs of `quimb_layers`.

**Parameters**

* **circuit** ([*QuantumCircuit*](/api/qiskit/qiskit.circuit.QuantumCircuit "(in Qiskit v1.2)")) – the quantum circuit to parse.
* **circuit** ([*QuantumCircuit*](/api/qiskit/qiskit.circuit.QuantumCircuit "(in Qiskit v1.3)")) – the quantum circuit to parse.
* **scaling\_factor** ([*float*](https://docs.python.org/3/library/functions.html#float "(in Python v3.13)")) – a factor with which to scale the term strengths. This can be used to apply (for example) a time step scaling factor. It may also be used (e.g.) to split onsite terms into two layers (even and odd) with \$0.5\$ of the strength, each.
* **keep\_only\_odd** ([*bool*](https://docs.python.org/3/library/functions.html#bool "(in Python v3.13)") *| None*) – the value to use for [`keep_only_odd`](#qiskit_addon_mpf.backends.quimb_layers.LayerModel.keep_only_odd "qiskit_addon_mpf.backends.quimb_layers.LayerModel.keep_only_odd").
* **kwargs** – any additional keyword arguments to pass to the [`LayerModel`](#qiskit_addon_mpf.backends.quimb_layers.LayerModel "qiskit_addon_mpf.backends.quimb_layers.LayerModel") constructor.
Expand Down Expand Up @@ -82,7 +82,7 @@ python_api_name: qiskit_addon_mpf.backends.quimb_layers.LayerModel

**Return type**

[*ndarray*](https://numpy.org/doc/stable/reference/generated/numpy.ndarray.html#numpy.ndarray "(in NumPy v2.1)") | None
[*ndarray*](https://numpy.org/doc/stable/reference/generated/numpy.ndarray.html#numpy.ndarray "(in NumPy v2.2)") | None
</Function>
</Class>

Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ python_api_name: qiskit_addon_mpf.backends.quimb_layers.LayerwiseEvolver

A special case of the [`TEBDEvolver`](backends-quimb-tebd-tebd-evolver "qiskit_addon_mpf.backends.quimb_tebd.TEBDEvolver") based on layer-wise evolution models.

As also explained in [`quimb_layers`](backends-quimb-layers#module-qiskit_addon_mpf.backends.quimb_layers "qiskit_addon_mpf.backends.quimb_layers"), this implementation extracts the alternating even/odd bond updates implemented inside of the original [`quimb.tensor.TEBD`](https://quimb.readthedocs.io/en/latest/autoapi/quimb/tensor/index.html#quimb.tensor.TEBD "(in quimb v1.9)") to become the end users responsibility. It does so, by replacing the single Hamiltonian provided to the [`TEBDEvolver`](backends-quimb-tebd-tebd-evolver "qiskit_addon_mpf.backends.quimb_tebd.TEBDEvolver") instance with a sequence of [`LayerModel`](backends-quimb-layers-layer-model "qiskit_addon_mpf.backends.quimb_layers.LayerModel") instances. Every single instance of these encodes a single **layer** of interactions. These should enforce the alternating updates of even and odd bonds of the underlying tensor network.
As also explained in [`quimb_layers`](backends-quimb-layers#module-qiskit_addon_mpf.backends.quimb_layers "qiskit_addon_mpf.backends.quimb_layers"), this implementation extracts the alternating even/odd bond updates implemented inside of the original [`quimb.tensor.TEBD`](https://quimb.readthedocs.io/en/latest/autoapi/quimb/tensor/index.html#quimb.tensor.TEBD "(in quimb v1.10)") to become the end users responsibility. It does so, by replacing the single Hamiltonian provided to the [`TEBDEvolver`](backends-quimb-tebd-tebd-evolver "qiskit_addon_mpf.backends.quimb_tebd.TEBDEvolver") instance with a sequence of [`LayerModel`](backends-quimb-layers-layer-model "qiskit_addon_mpf.backends.quimb_layers.LayerModel") instances. Every single instance of these encodes a single **layer** of interactions. These should enforce the alternating updates of even and odd bonds of the underlying tensor network.

The motivation for this more complicated interface is that is provides a lot more flexbility and enables users to define custom Trotter product formulas rather than being limited to the ones implemented by `quimb` directly.

Expand Down
10 changes: 5 additions & 5 deletions docs/api/qiskit-addon-mpf/backends-quimb-layers.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ python_api_name: 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 "(in quimb v1.9)").
A layer-wise time-evolution backend using [`quimb`](https://quimb.readthedocs.io/en/latest/autoapi/quimb/index.html#module-quimb "(in quimb v1.10)").

<Admonition title="Warning" type="caution">
This backend is only available if the optional dependencies have been installed:
Expand All @@ -31,7 +31,7 @@ A layer-wise time-evolution backend using [`quimb`](https://quimb.readthedocs.io

## Underlying method

This module provides a time-evolution backend similar to the TEBD-based one provided by the [`quimb_tebd`](backends-quimb-tebd#module-qiskit_addon_mpf.backends.quimb_tebd "qiskit_addon_mpf.backends.quimb_tebd") module. The main difference is that this module gives the user full flexibility for defining their product formulas, thereby not limiting them to the options built into the [`quimb`](https://quimb.readthedocs.io/en/latest/autoapi/quimb/index.html#module-quimb "(in quimb v1.9)") library.
This module provides a time-evolution backend similar to the TEBD-based one provided by the [`quimb_tebd`](backends-quimb-tebd#module-qiskit_addon_mpf.backends.quimb_tebd "qiskit_addon_mpf.backends.quimb_tebd") module. The main difference is that this module gives the user full flexibility for defining their product formulas, thereby not limiting them to the options built into the [`quimb`](https://quimb.readthedocs.io/en/latest/autoapi/quimb/index.html#module-quimb "(in quimb v1.10)") library.

At its core, the algorithm provided by this module is still a TEBD \[1] algorithm. However, rather than enforcing the alternating updates to the even and odd bonds of the time-evolution state (see also [`quimb_tebd.TEBDEvolver.sweep()`](backends-quimb-tebd-tebd-evolver#sweep "qiskit_addon_mpf.backends.quimb_tebd.TEBDEvolver.sweep")) this implementation outsources the responsibility of updating bonds in alternating fashion to the definition of multiple time-evolution **layers**.

Expand Down Expand Up @@ -61,7 +61,7 @@ Let us now inspect the time-evolution circuit of this Hamiltonian using a second
<Figure size 956...x869... with 1 Axes>
```

![../\_images/qiskit\_addon\_mpf-backends-quimb\_layers-2.png](/images/api/qiskit-addon-mpf/qiskit_addon_mpf-backends-quimb_layers-2.png)
![Output from the previous code.](/images/api/qiskit-addon-mpf/qiskit_addon_mpf-backends-quimb_layers-2.png)

In the circuit above, we can clearly identify its layer-wise structure. We can emphasize this further, by splitting the circuit into multiple layers as shown below (we recombine the `layers` into a single circuit with barriers between them to ease the visualization).

Expand All @@ -72,10 +72,10 @@ In the circuit above, we can clearly identify its layer-wise structure. We can e
<Figure size 1374...x869... with 1 Axes>
```

![../\_images/qiskit\_addon\_mpf-backends-quimb\_layers-3.png](/images/api/qiskit-addon-mpf/qiskit_addon_mpf-backends-quimb_layers-3.png)
![Output from the previous code.](/images/api/qiskit-addon-mpf/qiskit_addon_mpf-backends-quimb_layers-3.png)

<Admonition title="Hint" type="note">
The asymmetry of the central layers is a result of the implementation of Qiskit’s [`SuzukiTrotter`](/api/qiskit/qiskit.synthesis.SuzukiTrotter "(in Qiskit v1.2)") formula. In its second-order form, it combines the two half-time evolutions of the final term in the Hamiltonian into a single one of twice the length. We could transpile this circuit to collapse all such subequent gates in the central two layers (just like the last one), but for the sake of simplicity of this example, we will not do that here.
The asymmetry of the central layers is a result of the implementation of Qiskit’s [`SuzukiTrotter`](/api/qiskit/qiskit.synthesis.SuzukiTrotter "(in Qiskit v1.3)") formula. In its second-order form, it combines the two half-time evolutions of the final term in the Hamiltonian into a single one of twice the length. We could transpile this circuit to collapse all such subequent gates in the central two layers (just like the last one), but for the sake of simplicity of this example, we will not do that here.
</Admonition>

It is not possible to instruct Quimb’s TEBD algorithm to simulate the exact structure of the circuit shown above. The reason for that is a limitation in its interface, as it only accepts the full Hamiltonian to be provided which is then time-evolved using pre-defined Trotter formulas. However, in doing so it does not treat the order of the Pauli terms in a Hamiltonian with any significance (like we do here).
Expand Down
Loading

0 comments on commit a149464

Please sign in to comment.