Loading the data vector
Here we introduce another loading procedure available in Haiqu SDK:Vector Loading is the process of embedding a classical data vector directly into the amplitudes of a quantum state, resulting in compact, linear-in-depth circuits.
The Haiqu SDK allows you to prepare custom quantum states from classical vectors by calling haiqu.vector_loading(...).
The data vector is a real- or complex-valued one-dimensional vector, which contains the values to be encoded in the amplitudes. The function automatically adjusts to the closest minimal necessary number of qubits. The current supported maximum size of the vector is .
Loading of utility-scale data vectors
Vector encoding of a dataset of size N requires qubits and often leads to deep circuits to achieve high fidelity of data state preparation. When the data vector is split into smaller blocks, each block contains less data, making it easier to encode. This approach introduces a practical trade-off between qubit count and fidelity:More blocks → more qubits → shallower circuits → higher fidelity.
haiqu.block_vector_loading(...). For example:
gate circuit with fidelity close to .
Loading multivariate distributions
In many applications, input data is naturally represented as a multidimensional array, such as a 2D or 3D distribution. Sincehaiqu.vector_loading(...) and haiqu.block_vector_loading(...) expect a one-dimensional input vector, the array should first be flattened.
A convenient way to do this is with NumPy’s ravel, which converts a multidimensional array into a 1D vector while preserving element order. Below is an example of preparing a 2D Gaussian distribution and loading it into a quantum circuit:
Vector Loading specifications
| Parameter | Details |
|---|---|
| Number of qubits | Up to 20 qubits |
| Input data | 1D vector |
| Data type | Real and complex values |
| Data size | Up to ~1M features in the vector |
| Runtime | 0.5–2 minutes |
| Runtime scaling | Linear scaling with number of qubits |
| Circuit size (gates count) | O(n), n = number of qubits |
| Circuit depth | O(n/2), n = number of qubits |
| Circuit connectivity | Linear |
| Other circuit properties | - No mid-circuit measurements - Only CNOT and single-qubit rotation gates - No ancilla qubits - No post-selection required in state preparation |
| Returned metrics | Quantum state fidelity is returned for the ideal state prepared by the circuit |
Block Vector Loading specifications
| Parameter | Details |
|---|---|
| Number of qubits | 1000+ qubits; no more than 20 qubits for a single block |
| Input data | 1D vector 2D matrix |
| Data type | Real and complex values |
| Data size | Any, with no more than ~1M features for a single block |
| Runtime | 0.5–2 minutes per block |
| Runtime scaling | Linear scaling with number of qubits |
| Circuit size (gates count) | O(n), n = number of qubits |
| Circuit depth | O(m/2), m = number of qubits in each block |
| Circuit connectivity | Linear within each block |
| Other circuit properties | - No mid-circuit measurements - Only CNOT and single-qubit rotation gates - No ancilla qubits - No post-selection required in state preparation |
| Returned metrics | Quantum state fidelity is returned for the ideal state prepared by the circuit |