| Safe Haskell | None |
|---|---|
| Language | Haskell2010 |
QIO.QioSyn
Contents
Description
This module defines the Syntax of the Quantum IO Monad, which is an embedded language for writing quantum computations.
- type RR = Double
- type CC = Complex RR
- amp :: CC -> RR
- newtype Qbit = Qbit Int
- type Rotation = (Bool, Bool) -> CC
- data U
- data QIO a
- rot :: Qbit -> Rotation -> U
- swap :: Qbit -> Qbit -> U
- cond :: Qbit -> (Bool -> U) -> U
- ulet :: Bool -> (Qbit -> U) -> U
- urev :: U -> U
- unot :: Qbit -> U
- uhad :: Qbit -> U
- uphase :: Qbit -> RR -> U
- mkQbit :: Bool -> QIO Qbit
- applyU :: U -> QIO ()
- measQbit :: Qbit -> QIO Bool
- rid :: Rotation
- rnot :: Rotation
- rhad :: Rotation
- rphase :: RR -> Rotation
- rrev :: Rotation -> Rotation
- show' :: U -> Int -> Int -> String
- spaces :: Int -> String
Documentation
For Complex numbers, we use the built in Complex numbers, over our Real number type (i.e. Double)
The type of Qubits in QIO are simply integer references.
Instances
| Enum Qbit Source # | |
| Eq Qbit Source # | |
| Num Qbit Source # | |
| Ord Qbit Source # | |
| Show Qbit Source # | We can display a qubit reference |
| Heap HeapMap Source # | A HeapMap is an instance of the Heap type class, where the Heap functions can make use of the underlying Map functions. |
| Qdata Bool Qbit Source # | The lowest-level instance of Qdata is the relation between Booleans and Qubits. |
type Rotation = (Bool, Bool) -> CC Source #
A rotation is in essence a two-by-two complex valued matrix
The underlying data type of a U unitary operation
The underlying data type of a QIO Computation
cond :: Qbit -> (Bool -> U) -> U Source #
Apply the conditional unitary, depending on the value of the given qubit
ulet :: Bool -> (Qbit -> U) -> U Source #
Introduce an Ancilla qubit in the given state, for use in the sub-unitary
mkQbit :: Bool -> QIO Qbit Source #
Initialise a qubit in the given state (adding it to the overall quantum state)
measQbit :: Qbit -> QIO Bool Source #
Measure the given qubit, and return the measurement outcome (note that this operation may affect the overall quantum state, as a measurement is destructive)