Safe Haskell | None |
---|
A custom qRAM algorithm for fetching and storing quantum data from a quantum array, addressed by a quantum integer.
Synopsis
- indexed_access :: QData qa => [qa] -> QDInt -> Circ qa
- indexed_fetch_at :: QData qa => [qa] -> QDInt -> qa -> Circ ()
- indexed_store_at :: QData qa => [qa] -> QDInt -> qa -> Circ ()
- indexed_swap_at :: QData qa => [qa] -> QDInt -> qa -> Circ ()
Documentation
indexed_access :: QData qa => [qa] -> QDInt -> Circ qa Source #
Inputs a list a of quantum data and a quantum integer i, and
returns the ith element of a. This is done with controlled swap
operations, but without ancillas, i.e., the output is the only copy
of that quantum data. Note that the remaining elements of the array
may be swapped around, so they are not useable until
indexed_access
has been reversed.
Suggested usage:
with_computed (indexed_access i a) $ \x -> do <<<operate on x>>>
If the index is out of bound, return an unpredictable element of a. If a is of length 0, raise an error.
indexed_fetch_at :: QData qa => [qa] -> QDInt -> qa -> Circ () Source #
:
Perform q ⊕= a[i].indexed_fetch_at
a i q
indexed_store_at :: QData qa => [qa] -> QDInt -> qa -> Circ () Source #
:
Perform a[i] ⊕= q.indexed_store_at
a i q
indexed_swap_at :: QData qa => [qa] -> QDInt -> qa -> Circ () Source #
:
Swap a[i] and q.indexed_swap_at
a i q