| Safe Haskell | Safe-Inferred |
|---|---|
| Language | Haskell2010 |
Quantum.Gates
Description
Documentation
- iGate function represent an Identity Matrix
>>>iGate(2><2) [ 1.0 :+ 0.0, 0.0 :+ 0.0 , 0.0 :+ 0.0, 1.0 :+ 0.0 ]
- swapGate function represent a Swap Gate
>>>swapGate(4><4) [ 1.0 :+ 0.0, 0.0 :+ 0.0, 0.0 :+ 0.0, 0.0 :+ 0.0 , 0.0 :+ 0.0, 0.0 :+ 0.0, 1.0 :+ 0.0, 0.0 :+ 0.0 , 0.0 :+ 0.0, 1.0 :+ 0.0, 0.0 :+ 0.0, 0.0 :+ 0.0 , 0.0 :+ 0.0, 0.0 :+ 0.0, 0.0 :+ 0.0, 1.0 :+ 0.0 ]
- hGate function represent a Hadamard Gate
>>>hGate(2><2) [ 0.7071067811865475 :+ 0.0, 0.7071067811865475 :+ 0.0 , 0.7071067811865475 :+ 0.0, (-0.7071067811865475) :+ 0.0 ]
- xGate function represent a Pauli X-Gate
>>>xGate(2><2) [ 0.0 :+ 0.0, 1.0 :+ 0.0 , 1.0 :+ 0.0, 0.0 :+ 0.0 ]
- yGate function represent a Pauli Y-Gate
>>>yGate(2><2) [ 0.0 :+ 0.0, 0.0 :+ (-1.0) , 0.0 :+ 1.0, 0.0 :+ 0.0 ]
- zGate function represent a Pauli Z-Gate
>>>zGate(2><2) [ 1.0 :+ 0.0, 0.0 :+ 0.0 , 0.0 :+ 0.0, (-1.0) :+ (-0.0) ]
- cNotGate function represent a Controlled-Not Gate
>>>cNotGate(4><4) [ 1.0 :+ 0.0, 0.0 :+ 0.0, 0.0 :+ 0.0, 0.0 :+ 0.0 , 0.0 :+ 0.0, 1.0 :+ 0.0, 0.0 :+ 0.0, 0.0 :+ 0.0 , 0.0 :+ 0.0, 0.0 :+ 0.0, 0.0 :+ 0.0, 1.0 :+ 0.0 , 0.0 :+ 0.0, 0.0 :+ 0.0, 1.0 :+ 0.0, 0.0 :+ 0.0 ]
type Gate = Matrix (Complex Double) Source #
The Gate type is an alias for a matrix of complex numbers.
In quantum computing, a Gate is a unitary matrix that represents a quantum operation
applied to qubits. The matrix elements are complex numbers.
The Gate type is used to describe quantum gates in algorithms. For example:
-- Represents a 2x2 Hadamard Gate hGate :: Gate hGate = (2LA.><2) [1sqrt 2,1sqrt 2,1sqrt 2,(-1)sqrt 2] :: Gate