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

Safe HaskellSafe-Infered



This module defines a Vector as a list of pairs. In the context of QIO, a Vector is the type used to represent a probability distribution.



newtype Vec x a Source

A Vector over types x and a is a wrapper around list of pairs of a and x.




unVec :: [(a, x)]


Num n => Monad (Vec n)

Vectors, over Numeric types, can be defined as a Monad.

(Show x, Show a) => Show (Vec x a) 

empty :: Vec x aSource

An empty Vector is defined as the empty list

(<@@>) :: (Num x, Eq a) => Vec x a -> a -> xSource

The "probability" of an object in a Vector, is the sum of all the probabilities associated with that object.

(<**>) :: Num x => x -> Vec x a -> Vec x aSource

A Vector can be multiplied by a scalar, by mapping the multiplcation over each probability in the vector.

(<++>) :: Vec x a -> Vec x a -> Vec x aSource

Two Vectors can be added, using list concatenation.