-- Hoogle documentation, generated by Haddock
-- See Hoogle, http://www.haskell.org/hoogle/


-- | A library for implementing Quantum Algorithms
--   
--   A library useful for implementing Quantum Algorithms. It contains
--   definitions of Quantum Gates, Qubits.
@package qchas
@version 1.1.0.0


-- | <ul>
--   <li>Module : Gates</li>
--   <li>Description : Basic Quantum Gates</li>
--   <li>Copyright : (c) Mihai Sebastian Ardelean, 2018</li>
--   <li>License : BSD3</li>
--   <li>Maintainer : ardeleanasm@gmail.com</li>
--   <li>Portability : POSIX</li>
--   </ul>
module Quantum.Gates

-- | <ul>
--   <li>xGate function represent a Pauli X-Gate</li>
--   </ul>
--   
--   <pre>
--   &gt;&gt;&gt; xGate
--   (2&gt;&lt;2)
--   [ 0.0 :+ 0.0, 1.0 :+ 0.0
--   , 1.0 :+ 0.0, 0.0 :+ 0.0 ]
--   </pre>
xGate :: Gate

-- | <ul>
--   <li>yGate function represent a Pauli Y-Gate</li>
--   </ul>
--   
--   <pre>
--   &gt;&gt;&gt; yGate
--   (2&gt;&lt;2)
--   [ 0.0 :+ 0.0, 0.0 :+ (-1.0)
--   , 0.0 :+ 1.0,    0.0 :+ 0.0 ]
--   </pre>
yGate :: Gate

-- | <ul>
--   <li>zGate function represent a Pauli Z-Gate</li>
--   </ul>
--   
--   <pre>
--   &gt;&gt;&gt; zGate
--   (2&gt;&lt;2)
--   [ 1.0 :+ 0.0,       0.0 :+ 0.0
--   , 0.0 :+ 0.0, (-1.0) :+ (-0.0) ]
--   </pre>
zGate :: Gate

-- | <ul>
--   <li>hGate function represent a Hadamard Gate</li>
--   </ul>
--   
--   <pre>
--   &gt;&gt;&gt; hGate
--    (2&gt;&lt;2)
--    [ 0.7071067811865475 :+ 0.0,    0.7071067811865475 :+ 0.0
--    , 0.7071067811865475 :+ 0.0, (-0.7071067811865475) :+ 0.0 ]
--   </pre>
hGate :: Gate

-- | <ul>
--   <li>iGate function represent an Identity Matrix</li>
--   </ul>
--   
--   <pre>
--   &gt;&gt;&gt; iGate
--   (2&gt;&lt;2)
--   [ 1.0 :+ 0.0, 0.0 :+ 0.0
--   , 0.0 :+ 0.0, 1.0 :+ 0.0 ]
--   </pre>
iGate :: Gate

-- | <ul>
--   <li>cPhaseShifGate function represent a Controlled Phase-Shift
--   Gate</li>
--   </ul>
--   
--   <pre>
--   &gt;&gt;&gt; cPhaseShifGate
--   (4&gt;&lt;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) ]
--   </pre>
cPhaseShifGate :: Gate

-- | <ul>
--   <li>cNotGate function represent a Controlled-Not Gate</li>
--   </ul>
--   
--   <pre>
--   &gt;&gt;&gt; cNotGate
--   (4&gt;&lt;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 ]
--   </pre>
cNotGate :: Gate

-- | <ul>
--   <li>swapGate function represent a Swap Gate</li>
--   </ul>
--   
--   <pre>
--   &gt;&gt;&gt; swapGate
--   (4&gt;&lt;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 ]
--   </pre>
swapGate :: Gate
newtype Gate
Gate :: Matrix C -> Gate

-- | Gate constructor accepts a parameter of type Matrix C
[gateMatrix] :: Gate -> Matrix C
instance GHC.Show.Show Quantum.Gates.Gate
instance GHC.Classes.Eq Quantum.Gates.Gate


-- | <ul>
--   <li>Module : Qubits</li>
--   <li>Description : Definitions of |0&gt;, |1&gt;, |+&gt; and
--   |-&gt;</li>
--   <li>Copyright : (c) Mihai Sebastian Ardelean, 2018</li>
--   <li>License : BSD3</li>
--   <li>Maintainer : ardeleanasm@gmail.com</li>
--   <li>Portability : POSIX</li>
--   </ul>
module Quantum.Qubits
newtype Qubit
Qubit :: Matrix C -> Qubit

-- | Qubit constructor accepts a parameter of type Matrix C
[qubitState] :: Qubit -> Matrix C

-- | <ul>
--   <li>qZero function is used to represent a 0 qubit |0&gt;</li>
--   </ul>
--   
--   <pre>
--   &gt;&gt;&gt; qZero
--   (2&gt;&lt;1)
--   [ 1.0 :+ 0.0
--   , 0.0 :+ 0.0 ]
--   </pre>
qZero :: Qubit

-- | <ul>
--   <li>qOne function is used to represent a 1 qubit |1&gt;</li>
--   </ul>
--   
--   <pre>
--   &gt;&gt;&gt; qOne
--   (2&gt;&lt;1)
--   [ 0.0 :+ 0.0
--   , 1.0 :+ 0.0 ]
--   </pre>
qOne :: Qubit

-- | <ul>
--   <li>qPlus function is used to represent a + qubit |+&gt;</li>
--   <li>|+&gt; can be also obtained by applying Hadamard Gate on |0&gt;.
--   See <a>apply</a> for more information</li>
--   </ul>
--   
--   <pre>
--   &gt;&gt;&gt; qPlus
--   (2&gt;&lt;1)
--   [ 0.7071067811865475 :+ 0.0
--   , 0.7071067811865475 :+ 0.0 ]
--   </pre>
qPlus :: Qubit

-- | <ul>
--   <li>qMinus function is used to represent a - qubit |-&gt;</li>
--   <li>Same as |+&gt;, qubit |-&gt; can be obtained by applying Hadamard
--   Gate on |1&gt;. See <a>apply</a> for more information</li>
--   </ul>
--   
--   <pre>
--   &gt;&gt;&gt; qMinus
--   (2&gt;&lt;1)
--   [       0.7071067811865475 :+ 0.0
--   , (-0.7071067811865475) :+ (-0.0) ]
--   </pre>
qMinus :: Qubit
instance GHC.Show.Show Quantum.Qubits.Qubit
instance GHC.Classes.Eq Quantum.Qubits.Qubit

module Core.QOperationsInternal
entangleTwoQubits :: Qubit -> Qubit -> Qubit
applyGate :: Gate -> Qubit -> Qubit
outerProduct :: Qubit -> Qubit -> Gate
multiply :: Qubit -> Complex Double -> Qubit
kron :: Gate -> Gate -> Gate


-- | <ul>
--   <li>Module : Operations.QuantumOperations</li>
--   <li>Description : Quantum Operations</li>
--   <li>Copyright : (c) Mihai Sebastian Ardelean, 2018</li>
--   <li>License : BSD3</li>
--   <li>Maintainer : ardeleanasm@gmail.com</li>
--   <li>Portability : POSIX</li>
--   </ul>
module Operations.QuantumOperations

-- | Class QubitOperations used to define common operations that can be
--   made with <a>Qubit</a>
class QubitOperations a

-- | <ul>
--   <li>entangle function is used to perform the Kronecker product between
--   two qubits.</li>
--   </ul>
--   
--   <pre>
--   &gt;&gt;&gt; entangle qZero qOne
--   (4&gt;&lt;1)
--     [ 0.0 :+ 0.0
--     , 1.0 :+ 0.0
--     , 0.0 :+ 0.0
--     , 0.0 :+ 0.0 ]
--   </pre>
entangle :: QubitOperations a => a -> a -> a

-- | <ul>
--   <li>|&gt; function is used to apply a gate on a qubit</li>
--   </ul>
--   
--   <pre>
--   &gt;&gt;&gt; qZero |&gt; hGate
--   (2&gt;&lt;1)
--     [ 0.7071067811865475 :+ 0.0
--     , 0.7071067811865475 :+ 0.0 ]
--   </pre>
(|>) :: QubitOperations a => a -> Gate -> a

-- | <ul>
--   <li>|&gt;&lt;| function represents the outer product.</li>
--   </ul>
--   
--   <pre>
--   &gt;&gt;&gt; qZero |&gt;&lt;| qZero
--   (2&gt;&lt;2)
--     [ 1.0 :+ 0.0, 0.0 :+ 0.0
--     , 0.0 :+ 0.0, 0.0 :+ 0.0 ]
--   </pre>
(|><|) :: QubitOperations a => a -> a -> Gate

-- | <ul>
--   <li>mul function is used to multiply the states with a constant.</li>
--   </ul>
--   
--   <pre>
--   &gt;&gt;&gt; qZero * 5
--   (2&gt;&lt;1)
--     [ 5.0 :+ 0.0, 0.0 :+ 0.0
--     , 0.0 :+ 0.0, 0.0 :+ 0.0 ]
--   </pre>
(*) :: QubitOperations a => a -> Complex Double -> a

-- | Class GateOperations used to define common operations that can be made
--   with <a>Gate</a>
class GateOperations a

-- | <ul>
--   <li>Kronecker product operator is used to create gates that can be
--   used on multiple qubits</li>
--   </ul>
--   
--   <pre>
--   &gt;&gt;&gt; hGate &lt;*&gt; hGate
--   (4&gt;&lt;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 ]}
--   </pre>
(<*>) :: GateOperations a => a -> a -> a
instance Operations.QuantumOperations.GateOperations Quantum.Gates.Gate
instance Operations.QuantumOperations.QubitOperations Quantum.Qubits.Qubit

module Core.MeasureProcessInternal
startMeasurementProcess :: Qubit -> Qubit


-- | <ul>
--   <li>Module : MeasurementPerformer</li>
--   <li>Description : Definition of qubit measure function</li>
--   <li>Copyright : (c) Mihai Sebastian Ardelean, 2018</li>
--   <li>License : BSD3</li>
--   <li>Maintainer : ardeleanasm@gmail.com</li>
--   <li>Portability : POSIX</li>
--   </ul>
module Quantum.MeasurementPerformer

-- | Class MeasurementPerformer used to define measure operation that can
--   be made with <a>Qubit</a>
class MeasurementPerformer a

-- | <ul>
--   <li>measure function is used to perform qubit measurement</li>
--   </ul>
--   
--   <pre>
--   &gt;&gt;&gt; measure circuit
--   Qubit {qubitState = (4&gt;&lt;1)
--     [ 0.0 :+ 0.0
--     , 1.0 :+ 0.0
--     , 0.0 :+ 0.0
--     , 0.0 :+ 0.0 ]}
--   </pre>
measure :: MeasurementPerformer a => a -> a
instance Quantum.MeasurementPerformer.MeasurementPerformer Quantum.Qubits.Qubit


-- | <ul>
--   <li>Module : QC</li>
--   <li>Description : Quantum Computing</li>
--   <li>Copyright : (c) Mihai Sebastian Ardelean, 2018</li>
--   <li>License : BSD3</li>
--   <li>Maintainer : ardeleanasm@gmail.com</li>
--   <li>Portability : POSIX</li>
--   </ul>
--   
--   This module is used to import needed modules for Quantum Computing.
module QC
