qchas-1.0.1.0: A library for implementing Quantum Algorithms

Safe HaskellNone
LanguageHaskell2010

Gates

Description

  • Module : Gates
  • Description : Basic Quantum Gates
  • Copyright : (c) Mihai Sebastian Ardelean, 2017
  • License : BSD3
  • Maintainer : ardeleanasm@gmail.com
  • Portability : POSIX

Synopsis

Documentation

xGate :: Gate Source #

  • 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 :: Gate Source #

  • 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 :: Gate Source #

  • 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) ]

hGate :: Gate Source #

  • 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 ]

iGate :: Gate Source #

  • 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 ]

cPhaseShifGate :: Gate Source #

  • cPhaseShifGate function represent a Controlled Phase-Shift Gate
>>> cPhaseShifGate
(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, 1.0 :+ 0.0,       0.0 :+ 0.0
, 0.0 :+ 0.0, 0.0 :+ 0.0, 0.0 :+ 0.0, (-1.0) :+ (-0.0) ]

cNotGate :: Gate Source #

  • 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 ]

swapGate :: Gate Source #

  • 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 ]

(<+>) Source #

Arguments

:: Gate

Gate argument

-> Gate

Gate argument

-> Gate

return value: Gate

  • Kronecker product operator is used to create gates that can be used on multiple qubits

addGate Source #

Arguments

:: Gate

Gate argument

-> Gate

Gate argument

-> Gate

return value: Gate

  • Gate addition, a wrapper function over matrix addition

subGate Source #

Arguments

:: Gate

Gate argument

-> Gate

Gate argument

-> Gate

return value: Gate

  • Gate subtraction, a wrapper function over matrix subtraction

data Gate Source #

Constructors

Gate 

Fields

Instances

Eq Gate Source # 

Methods

(==) :: Gate -> Gate -> Bool #

(/=) :: Gate -> Gate -> Bool #

Show Gate Source # 

Methods

showsPrec :: Int -> Gate -> ShowS #

show :: Gate -> String #

showList :: [Gate] -> ShowS #