The Quipper System

Safe HaskellNone

Quipper.Libraries.Qram

Description

A custom qRAM algorithm for fetching and storing quantum data from a quantum array, addressed by a quantum integer.

Synopsis

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 #

indexed_fetch_at a i q: Perform q ⊕= a[i].

indexed_store_at :: QData qa => [qa] -> QDInt -> qa -> Circ () Source #

indexed_store_at a i q: Perform a[i] ⊕= q.

indexed_swap_at :: QData qa => [qa] -> QDInt -> qa -> Circ () Source #

indexed_swap_at a i q: Swap a[i] and q.