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

# Variational

Functions:

| Name | Description |
| - | - |
| `encode_in_angle` | \[Qmod Classiq-library function]. |
| `encode_on_bloch` | \[Qmod Classiq-library function]. |
| `inplace_encode_on_bloch` | \[Qmod Classiq-library function]. |

### encode\_in\_angle

<pre>`encode_in_angle(
data: CArray[CReal],
qba: Output[QArray[QBit]]
) -> None`</pre>

\[Qmod Classiq-library function]

Creates an angle encoding of n data points on n qubits.

Applies RY($\pi$data\[i]) on qba\[i].

**Parameters:**

| Name | Type | Description | Default |
| - | - | - | - |
| `data` | `CArray[CReal]` | A classical array representing the data to encode. | *required* |
| `qba` | `Output[QArray[QBit]]` | The array of qubits on which the data is encoded. | *required* |

### encode\_on\_bloch

<pre>`encode_on_bloch(
data: CArray[CReal],
qba: Output[QArray]
) -> None`</pre>

\[Qmod Classiq-library function]

Creates a dense angle encoding of n data points on n//2 qubits.

Encodes pairs of data points on a Bloch sphere, via RX($\pi$data\[2*i])RZ($\pi$data\[2*i+1]) on qba\[i].
If the length of the data is odd then RX($\pi$data\[i]) is applied on the last qubit.

**Parameters:**

| Name | Type | Description | Default |
| - | - | - | - |
| `data` | `CArray[CReal]` | A classical array representing the data to encode. | *required* |
| `qba` | `Output[QArray]` | The QArray of QBits on which the data is encoded. | *required* |

### inplace\_encode\_on\_bloch

<pre>`inplace_encode_on_bloch(
data: CArray[CReal],
qba: QArray
) -> None`</pre>

\[Qmod Classiq-library function]

Creates a dense angle encoding of n data points on n//2 qubits.

Encodes pairs of data points, normalized in the range \[-1, 1], on a Bloch sphere,
via RX(pi*data\[2*i])RZ(pi*data\[2*i+1]) on qba\[i],
such that the i'th qubit transforms as
`\|0>` -> cos(pi*data\[2*i]/2)`\|0>` +i\*$e^\{i * pi * data[2*i+1]\}$*sin(pi*data\[2\*i+1]/2).
If the length of the data is odd then RX(data\[i]) is applied on the last qubit.

**Parameters:**

| Name | Type | Description | Default |
| - | - | - | - |
| `data` | `CArray[CReal]` | A classical array representing the data to encode. | *required* |
| `qba` | `QArray` | The QArray of QBits on which the data is encoded. | *required* |


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