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

Safe HaskellSafe-Infered

QIO.QIORandom

Description

This module implements various functions that return a probabilistic result, defined as unitary operators, and quantum computations.

Synopsis

Documentation

rX :: RR -> RotationSource

The exponentiated Pauli-X rotation

rY :: RR -> RotationSource

The exponentiated Pauli-Y rotation

hadamards :: [Qbit] -> USource

Applies a Hadamard rotation to each qubit in the given list of qubits

pow2 :: Int -> IntSource

returns the highest integer power of 2 that is less than or equal to x\

weightedU :: RR -> Qbit -> USource

A rotation that, given a qubit in state 0, leaves it in a super-position of 0 and 1, such that the probability of measuring as state 0 is ps.

weightedBool :: RR -> QIO BoolSource

A QIO computation that uses the weightedU unitary, to return a Bool that has a probablity of pf of being False.

rlf :: [Bool] -> [Bool]Source

removes any leading Falses from a list of booleans

rlf_l :: Int -> [Bool]Source

removes any leading Falses from the (big-endian) bit-wise representation of the given Int.

rlf_n :: Int -> IntSource

returns the number of bits left after calling the flf_l function

trim :: Int -> [Qbit] -> [Qbit]Source

Given an Int max that is the largest number required to be represented in a quantum register, this function trims the front off the given register, to leave the number of qubits required to represent max.

randomU :: Int -> [Qbit] -> USource

Given an Int max, and a quantum register in the state max, this function defines a unitary operation that will leave the quantum register in state that has equal probability of being measured in any of the states 0 to max.

randomQInt :: Int -> QIO QIntSource

A quantum computation that will return a quantum integer in a state that has equal probabilities of being measured in any of the state 0 to max.

randomQIO :: (Int, Int) -> QIO IntSource

A quantum computation that will return a quantum integer in a state that has equal probabilities of being measured in any of the state min to max.

randomInt :: Int -> QIO IntSource

A quantum computation that measures the outcome of randomQInt

random :: Int -> QIO IntSource

A quantum computation that returns an integer that is equally likely to be any number in the range 0 to x-1

dice :: IO IntSource

This function uses a Quantum computation to simulate the roll of a dice

dice_rolls :: Int -> IO [Int]Source

This function simulates the given number of repitions of dice rolls

occs :: [Int] -> (Int, Int, Int, Int, Int, Int)Source

Returns the number of occurences of 1 through 6 in the given list of Ints

probs' :: Int -> IO (Int, Int, Int, Int, Int, Int)Source

Returns the number of occurences of 1 through 6 in the given number of rolls of the dice.

probs :: Int -> IO (RR, RR, RR, RR, RR, RR)Source

Returns the percentage of occurences of 1 through 6, after the given number of rolls of the dice.