workbench_algorithms.subroutines.multiplexing.binary_tree
Qubrick for binary search multiplexing.
BinaryTreeMultiplexor
Bases: Qubrick
Optimized multiplexing based on Fig. 7 in arXiv:1805.03662.
compute
compute(
index_reg: Qubits,
multiplex_function: Callable,
used_indices: list[int] | None = None,
ctrl: Qubits | int = 0,
)
Compute the binary tree multiplexing circuit.
We account for various cases:
- There is no data to load (exit the routine).
- Loading a single item does not require this hefty machinery.
- Loading two items without a control is similarly cheap to the single-item-case.
- Loading n > 2 items without a control.
- Loading n > 1 items with a control.
The bottom two cases are handled by calling workhorse methods in this class.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
index_reg
|
Qubits
|
Qubit register storing the values over which the multiplexing is performed. |
required |
multiplex_function
|
Callable
|
A function which takes an index and then index register and performs the operation associated with that index. |
required |
used_indices
|
list
|
List of indices corresponding to terms where the operators are actually being applied. |
None
|
ctrl
|
(int, Qubits)
|
Control for \(\text{SELECT}\). Defaults to 0. |
0
|