qchas-1.0.0: A library for implementing Quantum Algorithms

Safe HaskellNone
LanguageHaskell2010

Utils

Description

  • Module : Utils
  • Description : Definitions of basic mathematical operations on qubits and gates
  • Copyright : (c) Mihai Sebastian Ardelean, 2017
  • License : BSD3
  • Maintainer : ardeleanasm@gmail.com
  • Portability : POSIX

Synopsis

Documentation

entangle Source #

Arguments

:: Qubit

first Qubit argument

-> Qubit

second Qubit argument

-> Qubit

return value: Qubit

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

Arguments

:: Gate

Gate argument

-> Qubit

Qubit argument

-> Qubit

return value: Qubit

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

(|>) Source #

Arguments

:: Qubit

Qubit argument

-> Gate

Gate argument

-> Qubit

return value: Qubit

  • |> function have the same effect like apply.
>>> qZero |> hGate
 (2><1)
 [ 0.7071067811865475 :+ 0.0
 , 0.7071067811865475 :+ 0.0 ]

gateProduct Source #

Arguments

:: Gate

Gate argument

-> Gate

Gate argument

-> Gate

return value: Gate

  • gateKronecker function is used to create gates that can be used on multiple qubits