The Quipper System

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.

Synopsis

# Documentation

data Pauli Source #

The Pauli operators can be used to generate a stabilizer group for the Clifford operators.

Constructors

 I X Y Z

Instances

 # Methods(==) :: Pauli -> Pauli -> Bool #(/=) :: Pauli -> Pauli -> Bool # # MethodsshowsPrec :: Int -> Pauli -> ShowS #show :: Pauli -> String #showList :: [Pauli] -> ShowS #

data Sign Source #

The generators of a stabilizer group require a sign.

Constructors

 Plus Minus

Instances

 # Methods(==) :: Sign -> Sign -> Bool #(/=) :: Sign -> Sign -> Bool # # Methodscompare :: Sign -> Sign -> Ordering #(<) :: Sign -> Sign -> Bool #(<=) :: Sign -> Sign -> Bool #(>) :: Sign -> Sign -> Bool #(>=) :: Sign -> Sign -> Bool #max :: Sign -> Sign -> Sign #min :: Sign -> Sign -> Sign # # MethodsshowsPrec :: Int -> Sign -> ShowS #show :: Sign -> String #showList :: [Sign] -> ShowS #

Returns a boolean as to whether a Sign is negative (i.e.. Minus).

Returns the negation of a Sign.

Two signs can be multiplied.

data SignPlus Source #

In general, Pauli operators can commute, or anti-commute, so we need to add signs or ±i.

Constructors

 MinusI PlusI One Sign

Instances

 # MethodsshowList :: [SignPlus] -> ShowS #

Two signPluss can be multiplied.

Extract a Sign embedded in a SignPlus, or throw an error if the argument is not an embedded Sign.

The Levi-Civita symbol, for the permutations of three Pauli operators.

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.

type Matrix1 a = (a, a, a, a) Source #

Represent a 2×2-matrix as a 4-tuple.

toMatrix1 :: Floating r => Pauli -> Matrix1 (Cplx r) Source #

Give the matrix for each Pauli operator.

scale1 :: Num a => a -> Matrix1 a -> Matrix1 a Source #

Scale a 2-by-2 matrix.

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.

my_Y :: Floating r => Matrix1 (Cplx r) Source #

Return the matrix for Pauli-Y, which is iXZ.

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.

scale2 :: Num a => a -> Matrix2 a -> Matrix2 a Source #

Scale 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.

transpose2 :: Floating r => Matrix2 (Cplx r) -> Matrix2 (Cplx r) Source #

The transpose of a 4×4 complex valued matrix.

my_IY :: Floating r => Matrix2 (Cplx r) Source #

The tensor product IY can be defined by i(IX)(IZ).