The Quipper System

Libraries.Stabilizers.Clifford

Contents

Description

This module contains an implementation of a quantum simulator that uses the stabilizer states of the Clifford group (i.e. the Pauli group), to provide efficient simulation of quantum circuits constructed from elements of the Clifford group. The module provides an implementation of the Clifford group operators {x,y,z,h,s,controlled-x} which form a generating set for the Clifford group.

Synopsis

# Documentation

type Qubit = Int Source #

A qubit is defined as an integer reference.

data Tableau Source #

The state of the system is a representation of a stabilizer tableau.

Constructors

 ST Qubit !(Map Qubit Sign) !(Map (Qubit, Qubit) Pauli) !(Map Qubit Sign) !(Map (Qubit, Qubit) Pauli)

Instances

 # A tableau can be shown, by enumerating over the qubits in scope. MethodsshowList :: [Tableau] -> ShowS #

Accessor function for the next_qubit field of a Tableau

Accessor function for the sign field of a Tableau

Accessor function for the tableau field of a Tableau

Accessor function for the de_sign field of a Tableau

Accessor function for the de_tableau field of a Tableau

lookup :: (Ord k, Show k, Show v) => k -> Map k v -> v Source #

A local Map lookup function that throws an error if the key doesn't exist.

An initial (empty) tableau.

A new qubit in the state |0〉 or |1〉 can be added to a tableau.

type Unitary = Pauli -> (Sign, Pauli) Source #

A (Clifford) unitary can be defined as a function acting on Pauli operators.

data MinPauli Source #

The minimal definition of a unitary requires the actions on X and Z.

Constructors

 Xmin Zmin

type MinUnitary = MinPauli -> (Sign, Pauli) Source #

The minimal definition of a unitary requires the actions on X and Z.

The definition of a Unitary can be constructed from a MinimalUnitary.

from_matrix :: (Floating r, Eq r, Show r) => Matrix1 (Cplx r) -> Unitary Source #

It is possible to construct a Unitary from a 2×2-matrix.

A unitary can be applied to a qubit in a given tableau. By folding through each row

Apply the unitary to the given column, in the given row.

type Unitary2 = (Pauli, Pauli) -> (Sign, Pauli, Pauli) Source #

A two-qubit (Clifford) unitary can be defined as a function acting on a pair of Pauli operators.

data MinPauli2 Source #

The minimal definition of a two-qubit unitary requires the actions on IX, XI, IZ, and ZI.

Constructors

 IX XI IZ ZI

type MinUnitary2 = MinPauli2 -> (Sign, Pauli, Pauli) Source #

The minimal definition of a two-qubit unitary requires the actions on IX, XI, IZ, and ZI.

The definition of a Unitary2 can be constructed from a MinimalUnitary2.

from_matrix2 :: (Floating r, Eq r, Show r) => Matrix2 (Cplx r) -> Unitary2 Source #

It is possible to construct a Unitary2 from a 4×4-matrix.

from_matrix_controlled :: (Floating r, Show r, Eq r) => Matrix1 (Cplx r) -> Unitary2 Source #

It is possible to construct a Unitary2 from controlling a 2×2-matrix.

A two-qubit unitary can be applied to a pair of qubits in a given tableau.

A measurement, in the computational basis, can be made of a qubit in the Tableau, returning the measurement result, and the resulting Tableau.

This function reduces a tableau so that it contains either plus or minus Zq. Note that it is only called in the case where Zq is generated by the tableau (i.e., during measurement).

Multiply the stabilizers for the two given rows, in the given tableau, and update the first row with the result of the multiplication.

The Pauli X operator is a Clifford group unitary.

We can (equivalently) define Pauli-X as a MinUnitary.

We can (equivalently) construct Pauli-X from a MinUnitary.

We can (equivalently) construct Pauli-X from a matrix.

The Pauli Y-operator is a Clifford group unitary.

We can (equivalently) define Pauli-Y as a MinUnitary.

We can (equivalently) construct Pauli-Y from a MinUnitary.

We can (equivalently) construct Pauli-Y from a matrix.

The Pauli Z-operator is a Clifford group unitary.

We can (equivalently) define Pauli-Z as a MinUnitary.

We can (equivalently) construct Pauli-Z from a MinUnitary.

We can (equivalently) construct Pauli-Z from a matrix.

The Hadamard-gate is a Clifford group unitary.

We can (equivalently) define Hadamard as a MinUnitary.

We can (equivalently) construct Hadamard from a MinUnitary.

We can (equivalently) construct Hadamard from a matrix. Although rounding errors break this!!!

The phase-gate is a Clifford group unitary.

We can (equivalently) define phase gate as a MinUnitary.

We can (equivalently) construct phase gate from a MinUnitary.

We can (equivalently) construct phase gate from a matrix.

The phase-gate is a Clifford group unitary.

We can (equivalently) define phase gate as a MinUnitary.

We can (equivalently) construct phase gate from a MinUnitary.

We can (equivalently) construct phase gate from a matrix.

The controlled-not is a Clifford group 2-qubit unitary.

We can (equivalently) define CNot as a MinUnitary2.

We can (equivalently) construct CNot from a MinUnitary2.

We can (equivalently) construct CNot from a matrix.

The controlled-Z is a Clifford group 2-qubit unitary.

We can (equivalently) define controlled-Z as a MinUnitary2.

We can (equivalently) construct controlled-Z from a MinUnitary2.

We can (equivalently) construct controlled-Z from a matrix.

type CliffordCirc a = StateT Tableau IO a Source #

A Clifford group circuit is implicitly simulated using a state monad over a Tableau.

Initialize a new qubit.

init_qubits :: [Bool] -> CliffordCirc [Qubit] Source #

Initialize multiple qubits.

Apply a Pauli-X gate to the given qubit.

Apply a Pauli-Y gate to the given qubit.

Apply a Pauli-Z gate to the given qubit.

Apply a Hadamard gate to the given qubit.

Apply a phase gate to the given qubit.

Apply a given Unitary to the given qubit.

Apply a controlled-X gate to the given qubits.

Apply a controlled-Z gate to the given qubits.

Apply a given Unitary2 to the given qubits

Measure the given qubit in the computational basis.

Measure the given list of qubits.

For testing purposes, we can show the tableau during a simulation.

Return the evaluated Tableau for the given circuit.

sim :: CliffordCirc a -> IO a Source #

Return the result of simulating the given circuit.

A swap gate can be defined in terms of three controlled-not gates.

A controlled-Z gate can (equivalently) be defined in terms of Hadamard and controlled-X.

bell :: (Bool, Bool) -> CliffordCirc (Qubit, Qubit) Source #

Each of the four Bell states can be generated, indexed by a pair of boolean values.

Create a Bell state, and measure it.

controlled_if :: Bool -> (Qubit -> CliffordCirc ()) -> Qubit -> CliffordCirc () Source #

A single-qubit operation can be controlled by a classical boolean value.

A simple, single qubit, teleportation circuit.

A wrapper around the teleportation circuit that initializes a qubit in the given boolean state, and measures the teleported qubit.

Measure an equal superposition.

# Orphan instances

 # Methods # Methods(==) :: Unitary -> Unitary -> Bool #(/=) :: Unitary -> Unitary -> Bool #