pytket.tableau#
- class pytket.tableau.UnitaryTableau#
Stabilizer tableau for a unitary in the style of Aaronson&Gottesman “Improved Simulation of Stabilizer Circuits”: rows indicate the action at the output corresponding to either an X or a Z on a single input.
- __init__(*args, **kwargs)#
Overloaded function.
__init__(self: pytket.tableau.UnitaryTableau, nqb: int) -> None
Constructs a
UnitaryTableau
representing the identity operation over some number of qubits. Qubits will be indexed sequentially in the default register.- Parameters:
nqb – The number of qubits in the unitary.
__init__(self: pytket.tableau.UnitaryTableau, xx: numpy.ndarray[bool[m, n]], xz: numpy.ndarray[bool[m, n]], xph: numpy.ndarray[bool[m, 1]], zx: numpy.ndarray[bool[m, n]], zz: numpy.ndarray[bool[m, n]], zph: numpy.ndarray[bool[m, 1]]) -> None
Constructs a
UnitaryTableau
from the binary tables of its components.- Parameters:
xx – The X component of the X rows.
xz – The Z component of the X rows.
xph – The phases of the X rows.
zx – The X component of the Z rows.
zz – The Z component of the Z rows.
zph – The phases of the Z rows.
__init__(self: pytket.tableau.UnitaryTableau, arg0: pytket.circuit.Circuit) -> None
Constructs a
UnitaryTableau
from a unitaryCircuit
. Throws an exception if the input contains non-unitary operations.- Parameters:
circ – The unitary circuit to convert to a tableau.
- apply_gate_at_end(self: pytket.tableau.UnitaryTableau, type: pytket.circuit.OpType, qbs: Sequence[pytket.unit_id.Qubit]) None #
Update the tableau according to adding a Clifford gate after the current unitary, i.e. updates \(U\) to \(GU\) for a gate \(G\).
- Parameters:
type – The
OpType
of the gate to add. Must be an unparameterised Clifford gate type.qbs – The qubits to apply the gate to. Length must match the arity of the given gate type.
- apply_gate_at_front(self: pytket.tableau.UnitaryTableau, type: pytket.circuit.OpType, qbs: Sequence[pytket.unit_id.Qubit]) None #
Update the tableau according to adding a Clifford gate before the current unitary, i.e. updates \(U\) to \(UG\) for a gate \(G\).
- Parameters:
type – The
OpType
of the gate to add. Must be an unparameterised Clifford gate type.qbs – The qubits to apply the gate to. Length must match the arity of the given gate type.
- get_row_product(self: pytket.tableau.UnitaryTableau, paulis: pytket.pauli.QubitPauliTensor) pytket.pauli.QubitPauliTensor #
Combine rows to yield the effect of a given Pauli string.
- Parameters:
paulis – The Pauli string \(P\) to consider at the input.
- Returns:
The Pauli string \(Q\) such that \(QU=UP\).
- get_xrow(self: pytket.tableau.UnitaryTableau, qb: pytket.unit_id.Qubit) pytket.pauli.QubitPauliTensor #
Read off an X row as a Pauli string.
- Parameters:
qb – The qubits whose X row to read off.
- Returns:
The Pauli string \(P\) such that \(PU=UX_{qb}\).
- get_zrow(self: pytket.tableau.UnitaryTableau, qb: pytket.unit_id.Qubit) pytket.pauli.QubitPauliTensor #
Read off an Z row as a Pauli string.
- Parameters:
qb – The qubits whose Z row to read off.
- Returns:
The Pauli string \(P\) such that \(PU=UZ_{qb}\).
- to_circuit(self: pytket.tableau.UnitaryTableau) pytket.circuit.Circuit #
Synthesises a unitary
Circuit
realising the same unitary as the tableau. Uses the method from Aaronson & Gottesman: “Improved Simulation of Stabilizer Circuits”, Theorem 8. This is not optimised for gate count, so is not recommended for performance-sensitive usage.
- class pytket.tableau.UnitaryTableauBox#
A Clifford unitary specified by its actions on Paulis.
- __init__(*args, **kwargs)#
Overloaded function.
__init__(self: pytket.tableau.UnitaryTableauBox, tab: pytket.tableau.UnitaryTableau) -> None
Construct from a given tableau.
- Parameters:
tab – The
UnitaryTableau
representing the desired unitary.
__init__(self: pytket.tableau.UnitaryTableauBox, xx: numpy.ndarray[bool[m, n]], xz: numpy.ndarray[bool[m, n]], xph: numpy.ndarray[bool[m, 1]], zx: numpy.ndarray[bool[m, n]], zz: numpy.ndarray[bool[m, n]], zph: numpy.ndarray[bool[m, 1]]) -> None
Construct the tableau from the binary tables of its components.
- Parameters:
xx – The X component of the X rows.
xz – The Z component of the X rows.
xph – The phases of the X rows.
zx – The X component of the Z rows.
zz – The Z component of the Z rows.
zph – The phases of the Z rows.
- get_circuit(self: pytket.tableau.UnitaryTableauBox) pytket.circuit.Circuit #
- Returns:
The
Circuit
described by the box.
- get_tableau(self: pytket.tableau.UnitaryTableauBox) pytket.tableau.UnitaryTableau #
- Returns:
The tableau representing the unitary operation.