qfunc-0.1.0.0
Stabilityexperimental
Safe HaskellNone
LanguageHaskell2010

Lib.Internal.Core

Description

Internal matrix and measurment operations

Synopsis

Documentation

appendState :: QState -> QState -> QState Source #

Appends state with tensor

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.

maskMatch :: Int -> Int -> Bool Source #

If all the bits in b are in a it is a match.

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...

ampToProb :: Amplitude -> Prob Source #

Given a complex amplitude, will return its probability.

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.

qstateAmps :: QState -> [(Ix, Amplitude)] Source #

From a qstate, returns the amplitudes with its indexes.