CorrelationSurface#

class tqec.computation.CorrelationSurface(span)[source]#

Bases: object

A correlation surface in a computation is a set of measurements whose values determine the parity of the logical operators at the inputs and outputs associated with the surface.

Note

We use the term “correlation surface”, “pauli web” and “observable” interchangeably in the library.

Here we represent the correlation surface by the set of edges it spans in the ZX graph. The insight is that the spiders pose parity constraints on the operators supported on the incident edges. The flow of the logical operators through the ZX graph, respecting the parity constraints, forms the correlation between the inputs and outputs. However, the sign of measurement outcomes is neglected in this representation. And we need to recover the measurements when instantiating an explicit logical observable from the correlation surface.

Each edge establishes a correlation between the logical operators at the two ends of the edge. For example, an edge connecting two Z nodes represents the correlation between the logical Z operators at the two nodes.

Parameters:

span (frozenset[ZXEdge])

span#

A set of ZXEdge representing the span of the correlation surface.

Type:

frozenset[tqec.computation.correlation.ZXEdge]

Methods

__init__(span)

area()

Return the area of the correlation surface.

bases_at(v)

Get the bases of the surfaces present at the vertex.

edges_at(v)

Return the set of edges incident to the vertex in the correlation surface.

external_stabilizer(io_ports)

Get the Pauli operator supported on the given input/output ports.

external_stabilizer_on_graph(graph)

Get the external stabilizer of the correlation surface on the graph.

from_pauli_web(pauli_web)

Create a correlation surface from a Pauli web.

span_vertices()

Return the set of vertices in the correlation surface.

to_pauli_web(g)

Convert the correlation surface to a Pauli web.

Attributes

is_single_node

Whether the correlation surface contains only a single node.

span

Detailed methods

__init__(span)#
Parameters:

span (frozenset[ZXEdge])

Return type:

None

area()[source]#

Return the area of the correlation surface.

The area of the correlation surface is the number of nodes it spans. A X node and a Z node with the same id are counted as two nodes.

Return type:

int

bases_at(v)[source]#

Get the bases of the surfaces present at the vertex.

Parameters:

v (int)

Return type:

set[Basis]

edges_at(v)[source]#

Return the set of edges incident to the vertex in the correlation surface.

Parameters:

v (int)

Return type:

set[ZXEdge]

external_stabilizer(io_ports)[source]#

Get the Pauli operator supported on the given input/output ports.

Parameters:

io_ports (list[int]) – The list of input/output ports to consider.

Returns:

The Pauli operator supported on the given ports.

Return type:

str

external_stabilizer_on_graph(graph)[source]#

Get the external stabilizer of the correlation surface on the graph.

If the provided graph is an open graph, the external stabilizer is the Pauli operator supported on the input/output ports of the graph. Otherwise, the external stabilizer is the Pauli operator supported on the leaf nodes of the graph.

Parameters:
  • g – The block graph to consider.

  • graph (BlockGraph)

Returns:

The Pauli operator that is the external stabilizer of the correlation surface.

Return type:

str

static from_pauli_web(pauli_web)[source]#

Create a correlation surface from a Pauli web.

Parameters:

pauli_web (PauliWeb[int, tuple[int, int]])

Return type:

CorrelationSurface

span_vertices()[source]#

Return the set of vertices in the correlation surface.

Return type:

set[int]

to_pauli_web(g)[source]#

Convert the correlation surface to a Pauli web.

Parameters:

g (GraphS) – The ZX graph the correlation surface is based on.

Returns:

A PauliWeb representation of the correlation surface.

Return type:

PauliWeb[int, tuple[int, int]]