> ## Documentation Index
> Fetch the complete documentation index at: https://docs.haiqu.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Circuit Synthesis Options

> Choosing how a data loading circuit is synthesized from the target state.

Every data loading method accepts a `synthesis_options` argument that selects the compilation
method and its parameters. Pass one of the classes below, or an equivalent `dict` whose
`"method"` key names one of them.

### *class* haiqu.sdk.AnalyticalSynthesisOptions(\*, fine\_tuning\_iterations=0, method='analytical', num\_layers=2, layer\_type='V', bond\_dim\_layer=2, entanglement\_cutoff=1e-06)

Synthesis options for the analytical compilation method.

Builds a full disentangling layer at once in closed form, with gates as wide as the bond
dimension requires. The cheapest of the three methods and the best fit for smooth,
weakly entangled targets.

* **Parameters:**
  * **num\_layers** (*int*) -- Number of disentangling layers. More layers raise the fidelity at the cost
    of a deeper circuit. Defaults to 2.
  * **layer\_type** (*Literal* *\[* *'linear'* *,*  *'reverse\_linear'* *,*  *'V'* *]*) -- Geometry of the disentangler staircase, one of `"V"`, `"linear"` and
    `"reverse_linear"`. Defaults to `"V"`.
  * **bond\_dim\_layer** (*int* *|* *None*) -- Bond dimension each layer is truncated to, which sets the width of that
    layer's gates. `None` sets it to the embedding's feature `density`, and to 2 for a
    `density` below that, so that a layer is always wide enough to absorb one feature.
    It applies to the `density` in use, whether it was requested directly or derived from
    `num_qubits`, and only `entangled_manifold_embedding()` accepts
    it. Defaults to 2.
  * **entanglement\_cutoff** (*float*) -- Bonds carrying less entanglement than this threshold are left
    without a gate. Applied from the second layer onward. Defaults to `1e-6`.
  * **fine\_tuning\_iterations** (*int*)
  * **method** (*Literal* *\[* *'analytical'* *]*)

### Example

```python theme={null}
>>> from haiqu.sdk import AnalyticalSynthesisOptions
>>> AnalyticalSynthesisOptions(num_layers=3, entanglement_cutoff=1e-8)
>>> # the equivalent dict, which every data loading method also accepts
>>> {"method": "analytical", "num_layers": 3, "entanglement_cutoff": 1e-8}
```

### *class* haiqu.sdk.BlockwiseSynthesisOptions(\*, fine\_tuning\_iterations=0, method='blockwise', num\_layers=2, layer\_type='V', bond\_dim\_layer=2)

Synthesis options for the blockwise compilation method.

Builds each layer block by block.
Uses optimal analytical synthesis for 2-qubit gates, optimal numerical
synthesis for 3-qubit gates and variational synthesis for larger gates.
Costs more classical time than the analytical method but tends to spend
fewer CX gates for the same fidelity.

* **Parameters:**
  * **num\_layers** (*int*) -- Number of disentangling layers. More layers raise the fidelity at the cost
    of a deeper circuit. Defaults to 2.
  * **layer\_type** (*Literal* *\[* *'linear'* *,*  *'reverse\_linear'* *,*  *'V'* *]*) -- Geometry of the disentangler staircase, one of `"V"`, `"linear"` and
    `"reverse_linear"`. Defaults to `"V"`.
  * **bond\_dim\_layer** (*int* *|* *None*) -- Bond dimension each layer is truncated to, which sets the width of that
    layer's gates. `None` sets it to the embedding's feature `density`, and to 2 for a
    `density` below that, so that a layer is always wide enough to absorb one feature.
    It applies to the `density` in use, whether it was requested directly or derived from
    `num_qubits`, and only `entangled_manifold_embedding()` accepts
    it. Defaults to 2.
  * **fine\_tuning\_iterations** (*int*)
  * **method** (*Literal* *\[* *'blockwise'* *]*)

### Example

```python theme={null}
>>> from haiqu.sdk import BlockwiseSynthesisOptions
>>> BlockwiseSynthesisOptions(num_layers=2, bond_dim_layer=4)
>>> # the equivalent dict, which every data loading method also accepts
>>> {"method": "blockwise", "num_layers": 2, "bond_dim_layer": 4}
```

### *class* haiqu.sdk.VariationalSynthesisOptions(\*, fine\_tuning\_iterations=0, method='variational', num\_layers=2, layer\_type='brickwork', gate\_cnots=2, force\_complex=False, entanglement\_cutoff=1e-06)

Synthesis options for the variational compilation method.

Performs variational synthesis of the quantum circuit which approximately matches
the desired quantum state. Supports usage of a brickwork layer, which produces
the shallowest circuits.

* **Parameters:**
  * **num\_layers** (*int*) -- Number of disentangling layers. More layers raise the fidelity at the cost
    of a deeper circuit. Defaults to 2.
  * **layer\_type** (*Literal* *\[* *'linear'* *,*  *'reverse\_linear'* *,*  *'V'* *,*  *'brickwork'* *]*) -- Geometry of the gate layers, one of `"brickwork"`, `"V"`, `"linear"` and
    `"reverse_linear"`. Defaults to `"brickwork"`.
  * **gate\_cnots** (*Literal* \*\[\**1* *,* *2* *,* *3* *]*) -- Number of CX gates in each two-qubit gate. More CX gates make a gate able
    to represent more entanglement. One of 1, 2 or 3. Defaults to 2.
  * **force\_complex** (*bool*) -- Use complex rotations even when the target state is real. A real target
    is preparable with real rotations alone, which halves the parameter count if not forced.
    Defaults to `False`.
  * **entanglement\_cutoff** (*float*) -- Bonds carrying less entanglement than this threshold are left
    without a gate. Defaults to `1e-6`.
  * **fine\_tuning\_iterations** (*int*)
  * **method** (*Literal* *\[* *'variational'* *]*)

### Example

```python theme={null}
>>> from haiqu.sdk import VariationalSynthesisOptions
>>> VariationalSynthesisOptions(num_layers=4, gate_cnots=3)
>>> # the equivalent dict, which every data loading method also accepts
>>> {"method": "variational", "num_layers": 4, "gate_cnots": 3}
```

### *class* haiqu.sdk.DataLoadingSynthesisOptions(\*, fine\_tuning\_iterations=0)

Circuit synthesis parameters shared by every compilation method.

Do not instantiate directly; use [`AnalyticalSynthesisOptions`](#haiqu.sdk.AnalyticalSynthesisOptions),
[`BlockwiseSynthesisOptions`](#haiqu.sdk.BlockwiseSynthesisOptions) or [`VariationalSynthesisOptions`](#haiqu.sdk.VariationalSynthesisOptions).

Each method accepts a different set of parameters, so passing one method's parameter to
another is rejected rather than silently ignored.

* **Parameters:**
  **fine\_tuning\_iterations** (*int*) -- Maximum refinement iterations that are run after the circuit is
  built to improve the produced state. `0` skips the refinement. Defaults to 0.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.