Pattern Atlas

Extended Quantum Computing Patterns

Intent

Initialize the input of a quantum register, taking into account the prerequisites of the subsequent steps of the algorithm.

Context

Usually, the underlying problem to be solved by a quantum algorithm is represented by specific parameters. These parameters must be given as input data to the algorithm in order to solve the problem. In most algorithms, the process of loading the input data is part of the quantum algorithm itself, which is defined as a unitary transformation \(U\) and measurements.
In this case, the overall algorithm \(U = U_n \circ \ldots \circ U_{i} \circ U_{i-1} \circ \ldots \circ U_1,\) can be split up into two parts. The operators of the first part \(U_1, \ldots , U_{i-1}\) encode the input data into the quantum register according to a defined encoding, whereas the operators of the second part \(U_i, \ldots , U_n\) are used to solve the problem.
Since \(U_{i-1} \circ \ldots \circ U_1\) set the register to an initial state, this step is referred to as state preparation.

Solution

Frequently, the unit vector \(\left| 0 \ldots 0\right>\) is used as initialization of a quantum register.
Some qubits of the register can be used as so-called ancilla bits (working qubits) which may be used for the storage of intermediate results or quantum error correction. For example, to compute the function table of a Boolean function \(f:\{0, 1\}^n \rightarrow \{0, 1\}^m\), the overall register is initialized as \(\left| 0 \right>^{\otimes n}\left| 0 \right>^{\otimes m}\) (including \(m\) ancilla bits in the second part of the register).
To expose membership in an indicator function-based set (e.g., in decision problems) often an initialization with \(\left| 0 \right>^{\otimes n}\left| 1 \right>\) is chosen.
The membership to the set is then indicated by changing the sign of the qubits representing members of this set.

Result

More advanced states may be prepared which build on the previously described initialization techniques. For example, in (Cortese and Braje 2018) various algorithms for loading classical bits into a quantum register are presented.
Complex vectors can be loaded as described in (Nielsen and Chuang 2002). (Derovic et al. 2018) describes how a real-valued vector can be loaded; therefore, it is also possible to load a matrix that is represented as a set of vectors (Kerenidis and Prakash 2016).

Related Patterns

Patterns like Basis Encoding or Quantum Associative Memory (QuAM) further refine Initialization.
Uniform Superposition is often used as an initial state.
An initialized register may be used to compute a Function Table.

Known Uses

Initialization is the first step in every quantum algorithm.

Grover's Algorithm (PlanQK) Shor's Algorithm (PlanQK) HHL Algorithm (PlanQK)