Safe Haskell | None |
---|---|
Language | Haskell2010 |
This module implements various functions that return a probabilistic result, defined as unitary operators, and quantum computations.
- rX :: RR -> Rotation
- rY :: RR -> Rotation
- hadamards :: [Qbit] -> U
- pow2 :: Int -> Int
- weightedU :: RR -> Qbit -> U
- weightedBool :: RR -> QIO Bool
- rlf :: [Bool] -> [Bool]
- rlf_l :: Int -> [Bool]
- rlf_n :: Int -> Int
- trim :: Int -> [Qbit] -> [Qbit]
- randomU :: Int -> [Qbit] -> U
- randomQInt :: Int -> QIO QInt
- randomQIO :: (Int, Int) -> QIO Int
- randomInt :: Int -> QIO Int
- random :: Int -> QIO Int
- dice :: IO Int
- dice_rolls :: Int -> IO [Int]
- occs :: [Int] -> (Int, Int, Int, Int, Int, Int)
- probs' :: Int -> IO (Int, Int, Int, Int, Int, Int)
- probs :: Int -> IO (RR, RR, RR, RR, RR, RR)
Documentation
hadamards :: [Qbit] -> U Source #
Applies a Hadamard rotation to each qubit in the given list of qubits
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_l :: Int -> [Bool] Source #
removes any leading Falses from the (big-endian) bit-wise representation of the given Int.
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.
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_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