QIO-1.3: The Quantum IO Monad is a library for defining quantum computations in Haskell

Safe HaskellNone



This module defines the functions that can be used run the classical subset of QIO. That is, QIO computations that only use classical unitary operations.



newtype UnitaryC Source #

A classical unitary operation is defined as a function that will update the current classical state.





Monoid UnitaryC Source #

The classical unitary type forms a Monoid

uRotC :: Qbit -> Rotation -> UnitaryC Source #

A single qubit rotation can be converted into the classical unitary type, if it is indeed classical (otherwise an error is thrown).

uSwapC :: Qbit -> Qbit -> UnitaryC Source #

A swap operation can be defined in the classical unitary type.

uCondC :: Qbit -> (Bool -> UnitaryC) -> UnitaryC Source #

A conditional operation can be defined in the classical unitary type.

uLetC :: Bool -> (Qbit -> UnitaryC) -> UnitaryC Source #

A let operation can be defined in the classical unitary type.

runUC :: U -> UnitaryC Source #

A unitary can be run by converting it into the classical unitary type.

data StateC Source #

A classical state consists of the next free qubit reference, along with a Heap that represents the overall state of the current qubits in scope.




initialStateC :: StateC Source #

An initial state is defined as an empty heap, with 0 set as the next free qubit referece

runQStateC :: QIO a -> State StateC a Source #

A QIO computation can be converted into a stateful computation, over a state of type StateC.

runC :: QIO a -> a Source #

We can run a classical QIO computation by converting it into a stateful computation, and evaluating that using the initial state.