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

Safe HaskellNone
LanguageHaskell2010

QIO.QIORandom

Description

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

Synopsis

Documentation

rX :: RR -> Rotation Source #

The exponentiated Pauli-X rotation

rY :: RR -> Rotation Source #

The exponentiated Pauli-Y rotation

hadamards :: [Qbit] -> U Source #

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

pow2 :: Int -> Int Source #

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

weightedU :: RR -> Qbit -> U Source #

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 Bool Source #

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 -> Int Source #

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] -> U Source #

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 QInt Source #

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 Int Source #

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 Int Source #

A quantum computation that measures the outcome of "randomQInt"

random :: Int -> QIO Int Source #

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

dice :: IO Int Source #

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.