| Stability | experimental |
|---|---|
| Safe Haskell | None |
| Language | Haskell2010 |
Lib.Internal.Core
Description
Internal matrix and measurment operations
Synopsis
- appendState :: QState -> QState -> QState
- tensorVector :: Vector C -> Vector C -> Vector C
- newVector :: Bit -> QState
- type Prob = Rational
- findQbitProb1 :: QBit -> QState -> Prob
- type Amplitude = Complex Double
- findMarginAmps1 :: QBit -> QState -> [Amplitude]
- maskMatch :: Int -> Int -> Bool
- qbitMask :: QBit -> QState -> Int
- ampToProb :: Amplitude -> Prob
- remImpossibleStates :: QState -> QBit -> Bit -> QState
- qstateAmps :: QState -> [(Ix, Amplitude)]
- rngQbit :: Prob -> IO Bit
Documentation
tensorVector :: Vector C -> Vector C -> Vector C Source #
newVector :: Bit -> QState Source #
Vector state representations of qubits with 100% probaility to collapse to their bit counterparts
findQbitProb1 :: QBit -> QState -> Prob Source #
Finds the probability of the qubit measing to a 1. Find all the amplitudes where that qubit is one and converts it to probabilities.
findMarginAmps1 :: QBit -> QState -> [Amplitude] Source #
Finds the amplitudes from all the positions where that qubit is one.
qbitMask :: QBit -> QState -> Int Source #
Given a qbit, finds its mask in the qstate. E.g. an amplitude in a 3 qbits state could be |100>. A mask of 100=8 is wanted if the zero'th qbit is in interest, same mask would work for |101>. If qbit is 1 we want it to be 010=4...
remImpossibleStates :: QState -> QBit -> Bit -> QState Source #
Removes the states that contradict the measurment from the qbit to bit, also normalizes the state to a length of one.