state_prep_utils
state_prep_utils ¶
get_all_grays ¶
Apply get_gray_angles to a list of lists of angles.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
angles
|
list
|
List of list of angles |
required |
Returns:
| Type | Description |
|---|---|
list
|
List of list of single qubit gray angles |
get_angles ¶
Equations 5 and 8 in "Transformation of quantum states using uniformly controlled rotations" (arXiv:quant-ph/0407010 ⧉).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
amps
|
list
|
List of amplitudes. |
required |
num_qubits
|
(Optional, int)
|
Number of qubits the amplitudes will be loaded to. Defaults to None. |
None
|
Returns:
| Type | Description |
|---|---|
(list, list)
|
List of list of angles for \(Z\) rotations and list of list of angles for \(Y\) rotations. |
get_gray_angles ¶
Given list of angles for uniform rotations, return angles for single qubit rotations.
Follows equation 3 in "Transformation of quantum states using uniformly controlled rotations" (arXiv:quant-ph/0407010 ⧉).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
angles
|
list
|
List of angles. |
required |
Returns:
| Type | Description |
|---|---|
list
|
List of single qubit rotation angles. |
Note
The "dot" in the equation is a bitwise dot product.
get_usp_angle ¶
Calculates the rotation angle needed for USP.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
d
|
int
|
The number of elements in the uniform superposition. |
required |
Returns:
| Type | Description |
|---|---|
float
|
The rotation angle for USP, in degrees. |