Safe Haskell | None |
---|---|
Language | Haskell2010 |
- Module : Qubits
- Description : Definitions of |0>, |1>, |+> and |->
- Copyright : (c) Mihai Sebastian Ardelean, 2017
- License : BSD3
- Maintainer : ardeleanasm@gmail.com
- Portability : POSIX
Documentation
- qOne function is used to represent a 1 qubit |1>
>>>
qOne
(2><1) [ 0.0 :+ 0.0 , 1.0 :+ 0.0 ]
- qZero function is used to represent a 0 qubit |0>
>>>
qZero
(2><1) [ 1.0 :+ 0.0 , 0.0 :+ 0.0 ]
- qPlus function is used to represent a + qubit |+>
- |+> can be also obtained by applying Hadamard Gate on |0>. See
apply
for more information
>>>
qPlus
(2><1) [ 0.7071067811865475 :+ 0.0 , 0.7071067811865475 :+ 0.0 ]
- qMinus function is used to represent a - qubit |->
- Same as |+>, qubit |-> can be obtained by applying Hadamard Gate on |1>. See
apply
for more information
>>>
qMinus
(2><1) [ 0.7071067811865475 :+ 0.0 , (-0.7071067811865475) :+ (-0.0) ]
- entangle function is used to perform the Kronecker product between two qubits.
>>>
entangle qZero qOne
(4><1) [ 0.0 :+ 0.0 , 1.0 :+ 0.0 , 0.0 :+ 0.0 , 0.0 :+ 0.0 ]
- apply function is used to apply a gate on a qubit
>>>
apply hGate qZero
(2><1) [ 0.7071067811865475 :+ 0.0 , 0.7071067811865475 :+ 0.0 ]
- |> function have the same effect like
apply
.
>>>
qZero |> hGate
(2><1) [ 0.7071067811865475 :+ 0.0 , 0.7071067811865475 :+ 0.0 ]
- |><| function represents the outer product.
>>>
qZero |><| qZero
(2><2) [ 1.0 :+ 0.0, 0.0 :+ 0.0 , 0.0 :+ 0.0, 0.0 :+ 0.0 ]}