Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
Quantum.QDataTypes
Description
Documentation
type State = Vector (Complex Double) Source #
The State
type is an alias for a vector of complex numbers.
In the context of quantum computing, a State
represents a quantum state
as a column vector where each element is a complex number. The length of
the vector is typically \(2^n\) for a system of n
qubits.
For example, a State
could be:
[1 :+ 0, 0 :+ 0, 0 :+ 0, 0 :+ 0] -- Represents |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