guppyalgos.algorithms.state_preparation

Algorithmic state-preparation routines.

Functions

multiplexor_prep(state)

Create a Guppy function that prepares an arbitrary normalized state.

guppyalgos.algorithms.state_preparation.multiplexor_prep(state)

Create a Guppy function that prepares an arbitrary normalized state.

The input amplitudes must satisfy \(\sum_i |\alpha_i|^2 = 1\). They use little-endian basis indexing, so qubit q[0] is the least-significant bit of the amplitude index. The amplitudes are preserved exactly and padded with zeros to the next power-of-two length.

The implementation recursively partitions the amplitudes and applies multiplexed Ry rotations to set their magnitudes and multiplexed Rz rotations to set their phases. Each multiplexor is emitted directly as Guppy Ry/Rz and CX operations using a Gray-code decomposition. The resulting function prepares

\[\sum_i \alpha_i |i\rangle\]

on an input qubit array initialized to \(|0\rangle\).

See Appendix B.2 of Hamiltonian dynamics simulation using linear combination of unitaries on an ion trap quantum computer for the recursive multiplexed-rotation decomposition.

Parameters:

state (Sequence[complex] | ndarray) – One-dimensional normalized statevector. Its length need not be a power of two.

Return type:

GuppyFunctionDefinition[(array[qubit, TypeVar(n, bound= nat)], ), None]

Returns:

A Guppy function that prepares the zero-padded state on its input qubits.

Raises:

ValueError – If state is not one-dimensional, is empty, or is not normalized.