jonathanfishbein1/elm-quantum/5.1.1

NOTE: the latest version is 6.1.1

Quantum

Quantum Computing Simulator in Elm

Types

type Ket a
= Ket (ColumnVector a)

Ket Type

type Bra a
= Bra (Matrix a)

Bra Type

Values

ket0 : Ket (Real Float)

Ket representing zero state

ket1 : Ket (Real Float)

Ket representing one state

ketPlus : Ket (Real Float)

Ket representing + state

ketMinus : Ket (Real Float)

Ket representing + state

ketComplex0 : Ket (ComplexNumber Float)

Ket representing zero state with complex numbers

ketComplex1 : Ket (ComplexNumber Float)

Ket representing one state with complex numbers

ketComplexPlus : Ket (ComplexNumber Float)

Ket representing + state with complex numbers

ketComplexMinus : Ket (ComplexNumber Float)

Ket representing + state with complex numbers

Empty ket

Unitary Operations

scalarMultiplication : Field a -> a -> Ket a -> Ket a

Multiply a Ket by a Scalar

dimension : Ket a -> Int

Count of number of elements in a Ket

sum : Monoid a -> Ket a -> a

Calculate the sum of a Ket

foldl : (a -> b -> b) -> b -> Ket a -> b

Left fold over a Ket

Ket (ComplexNumber Float)
-> HermitianMatrix Float
-> Result String (Real Float)

variance

map : (a -> b) -> Ket a -> Ket b

Map over a vector

Binary Operations

add : Field a -> Ket a -> Ket a -> Ket a

Add two Kets

InnerProductSpace a
-> InvertableMatrix a
-> Ket a
-> Result String (Ket a)

Multiply a Vector by a Matrix

Quantum Operators

h : InvertableMatrix (Real Float)

Hadamard Operation

hComplex : UnitaryMatrix Float

Hadamard Operation

x : InvertableMatrix (Real Float)

NOT Operation

squareRootNot : InvertableMatrix (Real Float)

square root of NOT Operation

sigmaXReal : InvertableMatrix (Real Float)

SigmaX Operation

sigmaX : UnitaryMatrix Float

SigmaX Operation

sigmaY : UnitaryMatrix Float

SigmaX Operation

sigmaZ : UnitaryMatrix Float

SigmaX Operation

z : InvertableMatrix (Real Float)

z Operation

toffoli : InvertableMatrix (Real Float)

Toffoli Operation

fredkin : InvertableMatrix Float

Fredkin Operation

t : UnitaryMatrix Float

t Operation

s : UnitaryMatrix Float

s Operation

cNOT : InvertableMatrix (Real Float)

controlled-NOT Operation

and : InvertableMatrix (Real Float)

and Operation

probabilityOfState : InnerProductSpace a -> Ket a -> Bra a -> Result String a

Calculate the probability of end state, the Bra, with given start state, the Ket

HermitianMatrix Float
-> Ket (ComplexNumber Float)
-> Result String (Ket (ComplexNumber Float))

Multiply a Vector by a Matrix

Ket (ComplexNumber Float)
-> HermitianMatrix Float
-> Result String (Real Float)

Calculate the expected value when a Ket is multiplied by a Hermitian Matrix

Ket (ComplexNumber Float)
-> HermitianMatrix Float
-> Result String (HermitianMatrix Float)

varianceHermitianOperator

Equality

equal : (a -> a -> Bool) -> Ket a -> Ket a -> Bool

Compare two vectors for equality using a comparator

Manipulation

getAt : Int -> Ket a -> Maybe a

Get the value in a Ket at the specified index

setAt : Int -> a -> Ket a -> Ket a

Set the value in a Ket at the specified index