The Quipper System

Safe HaskellNone

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 

data Sign Source

The generators of a stabilizer group require a sign.

Constructors

Plus 
Minus 

negative :: Sign -> BoolSource

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

negate :: Sign -> SignSource

Returns the negation of a Sign.

multiply_sign :: Sign -> Sign -> SignSource

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

multiply_signPlus :: SignPlus -> SignPlus -> SignPlusSource

Two signPluss can be multiplied.

signPlus_to_sign :: SignPlus -> SignSource

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

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.

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 aSource

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

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

scale2 :: Num a => a -> Matrix2 a -> Matrix2 aSource

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

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

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