Safe Haskell | None |
---|
This module contains a data type to represent the four Pauli operators, along with various operations on them, including commutativity relations.
Synopsis
- data Pauli
- data Sign
- negative :: Sign -> Bool
- negate :: Sign -> Sign
- multiply_sign :: Sign -> Sign -> Sign
- data SignPlus
- multiply_signPlus :: SignPlus -> SignPlus -> SignPlus
- signPlus_to_sign :: SignPlus -> Sign
- levi_civita :: Pauli -> Pauli -> Pauli -> SignPlus
- kronecker_delta :: Pauli -> Pauli -> Bool
- commute :: Pauli -> Pauli -> (SignPlus, Pauli)
- type Matrix1 a = (a, a, a, a)
- toMatrix1 :: Floating r => Pauli -> Matrix1 (Cplx r)
- scale1 :: Num a => a -> Matrix1 a -> Matrix1 a
- fromMatrix1 :: (Floating r, Eq r, Show r) => Matrix1 (Cplx r) -> (Sign, Pauli)
- multiplyMatrix1 :: Num a => Matrix1 a -> Matrix1 a -> Matrix1 a
- transpose1 :: Num r => Matrix1 (Cplx r) -> Matrix1 (Cplx r)
- my_Y :: Floating r => Matrix1 (Cplx r)
- type Matrix2 a = Matrix1 (Matrix1 a)
- tensor1 :: Num a => Matrix1 a -> Matrix1 a -> Matrix2 a
- control1 :: Num a => Matrix1 a -> Matrix2 a
- toMatrix2 :: Floating r => (Pauli, Pauli) -> Matrix2 (Cplx r)
- scale2 :: Num a => a -> Matrix2 a -> Matrix2 a
- fromMatrix2 :: (Floating r, Eq r, Show r) => Matrix2 (Cplx r) -> (Sign, Pauli, Pauli)
- multiplyMatrix2 :: Num a => Matrix2 a -> Matrix2 a -> Matrix2 a
- transpose2 :: Floating r => Matrix2 (Cplx r) -> Matrix2 (Cplx r)
- my_IY :: Floating r => Matrix2 (Cplx r)
Documentation
The Pauli operators can be used to generate a stabilizer group for the Clifford operators.
The generators of a stabilizer group require a sign.
In general, Pauli operators can commute, or anti-commute, so we need to add signs or ±i.
signPlus_to_sign :: SignPlus -> Sign Source #
levi_civita :: Pauli -> Pauli -> Pauli -> SignPlus Source #
The Levi-Civita symbol, for the permutations of three Pauli operators.
commute :: Pauli -> Pauli -> (SignPlus, Pauli) Source #
The combination of the commutation and anti-commutation operators can be used to essentially multiply an (ordered) pair of Pauli operators.
toMatrix1 :: Floating r => Pauli -> Matrix1 (Cplx r) Source #
Give the matrix for each Pauli operator.
fromMatrix1 :: (Floating r, Eq r, Show r) => Matrix1 (Cplx r) -> (Sign, Pauli) Source #
If a matrix is Pauli, then return the Pauli operator, otherwise throw an error.
multiplyMatrix1 :: Num a => Matrix1 a -> Matrix1 a -> Matrix1 a Source #
Matrix multiplication for 2×2-matrices.
transpose1 :: Num r => Matrix1 (Cplx r) -> Matrix1 (Cplx r) Source #
Compute the transpose of a 2×2 complex-valued matrix.
type Matrix2 a = Matrix1 (Matrix1 a) Source #
A 4×4-matrix is represented as a 2×2-matrix of 2×2-matrices.
tensor1 :: Num a => Matrix1 a -> Matrix1 a -> Matrix2 a Source #
The tensor product of two 2×2-matrices is a 4×4 matrix.
control1 :: Num a => Matrix1 a -> Matrix2 a Source #
A controlled operation can be expressed with just the operation to be controlled.
toMatrix2 :: Floating r => (Pauli, Pauli) -> Matrix2 (Cplx r) Source #
Take the tensor of a pair of Pauli operators, and return a 4×4 matrix.
fromMatrix2 :: (Floating r, Eq r, Show r) => Matrix2 (Cplx r) -> (Sign, Pauli, Pauli) Source #
If a matrix is the tensor product of two Pauli operators, then return the pair of Pauli operators, otherwise throw an error.
multiplyMatrix2 :: Num a => Matrix2 a -> Matrix2 a -> Matrix2 a Source #
Matrix multiplication for 4×4 matrices.