qchas-1.1.0.0: A library for implementing Quantum Algorithms

Safe HaskellNone
LanguageHaskell2010

Operations.QuantumOperations

Description

  • Module : Operations.QuantumOperations
  • Description : Quantum Operations
  • Copyright : (c) Mihai Sebastian Ardelean, 2018
  • License : BSD3
  • Maintainer : ardeleanasm@gmail.com
  • Portability : POSIX

Synopsis

Documentation

class QubitOperations a where Source #

Class QubitOperations used to define common operations that can be made with Qubit

Minimal complete definition

entangle, (|>), (|><|), (*)

Methods

entangle :: a -> a -> a Source #

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

(|>) :: a -> Gate -> a Source #

  • |> function is used to apply a gate on a qubit
>>> qZero |> hGate
(2><1)
  [ 0.7071067811865475 :+ 0.0
  , 0.7071067811865475 :+ 0.0 ]

(|><|) :: a -> a -> Gate Source #

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

(*) :: a -> Complex Double -> a Source #

  • mul function is used to multiply the states with a constant.
>>> qZero * 5
(2><1)
  [ 5.0 :+ 0.0, 0.0 :+ 0.0
  , 0.0 :+ 0.0, 0.0 :+ 0.0 ]

Instances

class GateOperations a where Source #

Class GateOperations used to define common operations that can be made with Gate

Minimal complete definition

(<*>)

Methods

(<*>) :: a -> a -> a Source #

  • Kronecker product operator is used to create gates that can be used on multiple qubits
>>> hGate <*> hGate
(4><4)
[ 0.4999999999999999 :+ 0.0,    0.4999999999999999 :+ 0.0,    0.4999999999999999 :+ 0.0,    0.4999999999999999 :+ 0.0
, 0.4999999999999999 :+ 0.0, (-0.4999999999999999) :+ 0.0,    0.4999999999999999 :+ 0.0, (-0.4999999999999999) :+ 0.0
, 0.4999999999999999 :+ 0.0,    0.4999999999999999 :+ 0.0, (-0.4999999999999999) :+ 0.0, (-0.4999999999999999) :+ 0.0
, 0.4999999999999999 :+ 0.0, (-0.4999999999999999) :+ 0.0, (-0.4999999999999999) :+ 0.0,    0.4999999999999999 :+ 0.0 ]}

Instances

GateOperations Gate Source #

GateOperations instance for Gate

Methods

(<*>) :: Gate -> Gate -> Gate Source #