workbench_algorithms.experimental.subroutines.state_preparation.programmable_gate_array
Qubricks for some standard, oft-used rotations.
MultiplexedRotationData
dataclass
MultiplexedRotationData(
opcode: str,
angles: Iterable[float],
epsilon: float,
bits_of_precision: int | None = None,
)
Data class for handling data for multiplexed rotations.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
opcode
|
str
|
Encodes the type of rotation op to be applied, one of |
required |
angles
|
Iterable[float]
|
The list of rotation angles to be applied. |
required |
epsilon
|
float
|
The accuracy that the multiplexed rotations are to be applied to. |
required |
bits_of_precision
|
int | None
|
For QROM-based multiplexors, the number of bits of precision to be used in the rotations. |
None
|
ProgrammableRotArrayData
dataclass
ProgrammableRotArrayData(
opcode: str,
coefficients: Iterable[float],
epsilon: float,
_bits_of_precision: int | None = None,
)
Data class for handling data for multiplexed rotations.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
opcode
|
str
|
Encodes the type of rotation op to be applied, one of |
required |
coefficients
|
Iterable[float]
|
The coefficients of the state to be loaded. |
required |
epsilon
|
float
|
The accuracy that the multiplexed rotations are to be applied to. |
required |
_bits_of_precision
|
int | None
|
Override the default bits of precision argument with a custom value. NOTE: this may result in loss of fidelity if the value is not chosen carefully - users are recommended to leave this unset unless they know what they are doing. |
None
|
ProgrammableRotArray
Bases: Qubrick
Implements a state sub-preparation using a cascade of uniformly controlled rotations.
Essentially, it is a data storage "terminology" coined by this microsoft paper (see appendix VII, section B, subsection 1) where we need a 2D array of angles (each row of size 1, 2, 4, 8, ...), similar to the multiplexed Givens rotation.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
op
|
SupportedOps
|
Encodes the type of rotation op to be applied, one of |
required |
mplxr
|
MultiplexedRotations
|
The Qubrick that will implement the individual multiplexed rotations |
required |
fix_global_phase
|
bool
|
Whether to fix up the global phase (for statevector validation) or prepare the state up to global phase. This correction is always applied when the Qubrick is controlled. |
False
|
kwargs
|
dict[str, Any]
|
Other key word arguments to pass to the constructor. |
{}
|
FlattenedRotArray
Bases: Qubrick
Implements a state sub-preparation using a single set of multiplexed rotations.
Note
- This only works with PHASE ops, so can only be used for a phase fixup, and can't be used with the Gray code multiplexor, which relies on the structure of RZ gates to work.
- There is no global phase correction to do with this Qubrick.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
mplxr
|
MultiplexedRotations
|
The Qubrick that will implement the individual multiplexed rotations |
required |
kwargs
|
dict[str, Any]
|
Other key word arguments to pass to the constructor. |
{}
|
compute
Compute the multiplexor.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
psi
|
Qubits
|
The qubits to apply the rotations onto. |
required |
data
|
StatePrepDataInterface
|
A dataclass encoding the rotation data |
required |
ctrl
|
Qubits | int
|
Qubits to control the operation on. |
0
|