Pattern Generation

graphix.transpiler module

class graphix.transpiler.Circuit(width)[source]

Gate-to-MBQC transpiler.

Holds gate operations and translates into MBQC measurement patterns.

width

Number of logical qubits (for gate network)

Type

int

instruction

List containing the gate sequence applied.

Type

list

__init__(width)[source]
Parameters

width (int) – number of logical qubits for the gate network

transpile(opt=False)[source]

gate-to-MBQC transpile function.

Parameters

opt (bool) – Whether or not to use pre-optimized gateset with local-Clifford decoration.

Returns

pattern

Return type

graphix.pattern.Pattern object

standardize_and_transpile(opt=True)[source]

gate-to-MBQC transpile function. Commutes all byproduct through gates, instead of through measurement commands, to generate standardized measurement pattern.

Parameters

opt (bool) – Whether or not to use pre-optimized gateset with local-Clifford decoration.

Returns

pattern

Return type

graphix.pattern.Pattern object

simulate_statevector(input_state=None)[source]

Run statevector simultion of the gate sequence, using graphix.Statevec

Returns

stete – output state of the statevector simulation.

Return type

graphix.Statevec

cnot(control, target)[source]

CNOT gate

controlint

control qubit

targetint

target qubit

h(qubit)[source]

Hadamard gate

qubitint

target qubit

s(qubit)[source]

S gate

qubitint

target qubit

x(qubit)[source]

Pauli X gate

qubitint

target qubit

y(qubit)[source]

Pauli Y gate

qubitint

target qubit

z(qubit)[source]

Pauli Z gate

qubitint

target qubit

rx(qubit, angle)[source]

X rotation gate

qubitint

target qubit

anglefloat

rotation angle in radian

ry(qubit, angle)[source]

Y rotation gate

qubitint

target qubit

anglefloat

angle in radian

rz(qubit, angle)[source]

Z rotation gate

qubitint

target qubit

anglefloat

rotation angle in radian

graphix.generator module

graphix.generator.generate_from_graph(graph, angles, inputs, outputs, timeout=100)[source]

Generate the measurement pattern from open graph and measurement angles.

This function takes an open graph G = (nodes, edges, input, outputs), specified by networks.Graph and two lists specifying input and output nodes. Currently we support XY-plane measurements.

Searches for the flow in the open graph using flow() and if found, construct the measurement pattern according to the theorem 1 of [NJP 9, 250 (2007)].

Then, if no flow was found, searches for gflow using gflow(), from which measurement pattern can be constructed from theorem 2 of [NJP 9, 250 (2007)].

The constructed measurement pattern deterministically realize the unitary embedding

\[U = \left( \prod_i \langle +_{\alpha_i} |_i \right) E_G N_{I^C},\]

where the measurements (bras) with always \(\langle+|\) bases determined by the measurement angles \(\alpha_i\) are applied to the measuring nodes, i.e. the randomness of the measurement is eliminated by the added byproduct commands.

See also

flow() gflow() graphix.pattern.Pattern

Parameters
  • graph (networkx.Graph) – graph on which MBQC should be performed

  • angles (dict) – measurement angles for each nodes on the graph (unit of pi), except output nodes

  • inputs (list) – list of node indices for input nodes

  • outputs (list) – list of node indices for output nodes

  • timeout (int) – optional argument for flow and gflow search depth

Returns

pattern – constructed pattern.

Return type

graphix.pattern.Pattern object