pytket.quipper

Parser from Quipper ASCII to tket circuits

pytket.quipper.quipper.circuit_from_quipper(input_file)[source]

Generate a pytket Circuit given a program in Quipper ASCII format. Limitations (due to current limitations of pytket):

  • Subroutines must be defined over the full set of qubits.

  • Global phases are ignored.

  • Only limited support for controlled gates (depending on the gate type).

  • No support for ‘QInit’ and ‘QTerm’. All qubits must run from the begining to the end of the circuit.

  • No support for the legacy keywords (‘QNot’, ‘QMultinot’, ‘QHad’, ‘QSwap’, ‘QW’). These are now represented in Quipper as types of ‘QGate’.

  • No support for ‘QMeas’ (which in Quipper converts a Q wire to a C wire).

  • No support for: ‘GPhase’ (global phase), ‘QPrep’, ‘QUnprep’, ‘QDiscard’, or ‘DTerm’.

  • No support for classical operations (‘CNot’, ‘CGate’, ‘CSwap’, ‘CInit’, ‘CTerm’, ‘CDiscard’).

Parameters:

input_file (str) – name of file to read

Return type:

Circuit

class pytket.quipper.quipper.CDiscard(wire: Wire)[source]
class pytket.quipper.quipper.CInit(value: bool, wire: Wire)[source]
class pytket.quipper.quipper.CTerm(value: bool, wire: Wire)[source]
class pytket.quipper.quipper.Comment(comment: str, inverted: bool, wire_comments: list[tuple[Wire, str]])[source]
class pytket.quipper.quipper.Control(controlled, no_control)[source]
controlled: list[ControlWire]

Alias for field number 0

no_control: bool

Alias for field number 1

class pytket.quipper.quipper.ControlWire(wire, negative)[source]
negative: bool

Alias for field number 1

wire: Wire

Alias for field number 0

class pytket.quipper.quipper.Program(inputs, gates, outputs)[source]
gates: list[_Gate]

Alias for field number 1

inputs: list[TypeAssignment]

Alias for field number 0

outputs: list[TypeAssignment]

Alias for field number 2

class pytket.quipper.quipper.QDiscard(wire: Wire)[source]
class pytket.quipper.quipper.QGate(op: QGate_Op, inverted: bool, wires: list[Wire], control: Control)[source]
enum pytket.quipper.quipper.QGate_Op(value)[source]

Valid values are as follows:

Not = <QGate_Op.Not: 1>
H = <QGate_Op.H: 2>
MultiNot = <QGate_Op.MultiNot: 3>
Y = <QGate_Op.Y: 4>
Z = <QGate_Op.Z: 5>
S = <QGate_Op.S: 6>
T = <QGate_Op.T: 7>
E = <QGate_Op.E: 8>
Omega = <QGate_Op.Omega: 9>
V = <QGate_Op.V: 10>
Swap = <QGate_Op.Swap: 11>
W = <QGate_Op.W: 12>
IX = <QGate_Op.IX: 13>
class pytket.quipper.quipper.QInit(value: bool, wire: Wire)[source]
class pytket.quipper.quipper.QMeas(wire: Wire)[source]
class pytket.quipper.quipper.QRot(op: QRot_Op, inverted: bool, timestep: float, wire: Wire)[source]
enum pytket.quipper.quipper.QRot_Op(value)[source]

Valid values are as follows:

ExpZt = <QRot_Op.ExpZt: 1>
R = <QRot_Op.R: 2>
class pytket.quipper.quipper.QTerm(value: bool, wire: Wire)[source]
class pytket.quipper.quipper.Start(circuit, subroutines)[source]
circuit: Program

Alias for field number 0

subroutines: list[Subroutine]

Alias for field number 1

class pytket.quipper.quipper.Subroutine(name, shape, controllable, circuit)[source]
circuit: Program

Alias for field number 3

controllable: Subroutine_Control

Alias for field number 2

name: str

Alias for field number 0

shape: str

Alias for field number 1

class pytket.quipper.quipper.SubroutineCall(repetitions: int, name: str, shape: str, inverted: bool, inputs: list[Wire], outputs: list[Wire], control: Control)[source]
enum pytket.quipper.quipper.Subroutine_Control(value)[source]

Valid values are as follows:

yes = <Subroutine_Control.yes: 1>
no = <Subroutine_Control.no: 2>
classically = <Subroutine_Control.classically: 3>
class pytket.quipper.quipper.TypeAssignment(wire, type)[source]
type: TypeAssignment_Type

Alias for field number 1

wire: Wire

Alias for field number 0

enum pytket.quipper.quipper.TypeAssignment_Type(value)[source]

Valid values are as follows:

Qbit = <TypeAssignment_Type.Qbit: 1>
Cbit = <TypeAssignment_Type.Cbit: 2>
class pytket.quipper.quipper.Wire(i)[source]
i: int

Alias for field number 0