workbench_algorithms.subroutines.alias_sampling
Functions for the alias sampling state preparation method.
AliasSampling
Bases: Qubrick
Qubrick for implementing alias sampling.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
qrom
|
Qubrick
|
Data lookup instance. |
required |
usp
|
Qubrick
|
Uniform state preparation instance. |
required |
**kwargs
|
dict[str, Any]
|
Other arguments to pass to the init. |
{}
|
compute_num_states
staticmethod
Helper to compute number of states to prepare in alias sampling (works for symbolics & numerics).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
input_list
|
list or SymbolicArray
|
List of coefficients to prepare. |
required |
Returns:
| Type | Description |
|---|---|
tuple
|
Number of states to prepare, and value to pad combined list by. |
Raises:
| Type | Description |
|---|---|
ValueError
|
If the inputs are not the correct type for either numerics or symbolics. |
compute
State preparation by alias sampling.
Note
Uses the circuit in Fig. 11 of arXiv:1805.03662 .
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
prep_reg
|
Qubits or SymbolicQubits
|
Register to prepare coefficients onto. |
required |
input_list
|
list or SymbolicArray
|
List of coefficients to prepare. |
required |
bit_precision
|
int or Parameter
|
Number of bits to represent each coefficient. |
required |
lambda_val
|
int or Parameter
|
Power-of-two knob to trade off between gates
and qubits. If |
None
|
ctrl
|
Qubits, SymbolicQubits, or int
|
Control register. Defaults to no control, i.e. |
0
|
**kwargs
|
dict[str, Any]
|
Other arguments to pass to the compute. |
{}
|