Safe Haskell | None |
---|
Libraries.Stabilizers.Pauli
Description
This module contains a data type to represent the four Pauli operators, along with various operations on them, including commutativity relations.
- 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.
multiply_sign :: Sign -> Sign -> SignSource
Two signs can be multiplied.
In general, Pauli operators can commute, or anti-commute, so we need to add signs or ±i.
multiply_signPlus :: SignPlus -> SignPlus -> SignPlusSource
Two signPlus
s can be multiplied.
levi_civita :: Pauli -> Pauli -> Pauli -> SignPlusSource
The Levi-Civita symbol, for the permutations of three Pauli operators.
kronecker_delta :: Pauli -> Pauli -> BoolSource
The Kronecker delta for two 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.
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 aSource
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 aSource
The tensor product of two 2×2-matrices is a 4×4 matrix.
control1 :: Num a => Matrix1 a -> Matrix2 aSource
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 aSource
Matrix multiplication for 4×4 matrices.
transpose2 :: Floating r => Matrix2 (Cplx r) -> Matrix2 (Cplx r)Source
The transpose of a 4×4 complex valued matrix.