pytket.tableau¶
- class pytket._tket.tableau.UnitaryRevTableau¶
Equivalent to the UnitaryTableau, except that the rows indicate the action at the input corresponding to either an X or a Z on a single output.
- __init__(*args, **kwargs)¶
Overloaded function.
__init__(self: pytket._tket.tableau.UnitaryRevTableau, nqb: int) -> None
Constructs a
UnitaryRevTableau
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._tket.tableau.UnitaryRevTableau, 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
UnitaryRevTableau
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._tket.tableau.UnitaryRevTableau, arg0: pytket._tket.circuit.Circuit) -> None
Constructs a
UnitaryRevTableau
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._tket.tableau.UnitaryRevTableau, type: pytket._tket.circuit.OpType, qbs: Sequence[pytket._tket.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._tket.tableau.UnitaryRevTableau, type: pytket._tket.circuit.OpType, qbs: Sequence[pytket._tket.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._tket.tableau.UnitaryRevTableau, paulis: pytket._tket.pauli.QubitPauliTensor) pytket._tket.pauli.QubitPauliTensor ¶
Combine rows to yield the effect of a given Pauli string.
- Parameters:
paulis – The Pauli string \(P\) to consider at the output.
- Returns:
The Pauli string \(Q\) such that \(UQ=PU\).
- get_xrow(self: pytket._tket.tableau.UnitaryRevTableau, qb: pytket._tket.unit_id.Qubit) pytket._tket.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 \(UP=X_{qb}U\).
- get_zrow(self: pytket._tket.tableau.UnitaryRevTableau, qb: pytket._tket.unit_id.Qubit) pytket._tket.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 \(UP=Z_{qb}U\).
- to_circuit(self: pytket._tket.tableau.UnitaryRevTableau) pytket._tket.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._tket.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._tket.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._tket.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._tket.tableau.UnitaryTableau, arg0: pytket._tket.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._tket.tableau.UnitaryTableau, type: pytket._tket.circuit.OpType, qbs: Sequence[pytket._tket.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._tket.tableau.UnitaryTableau, type: pytket._tket.circuit.OpType, qbs: Sequence[pytket._tket.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._tket.tableau.UnitaryTableau, paulis: pytket._tket.pauli.QubitPauliTensor) pytket._tket.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._tket.tableau.UnitaryTableau, qb: pytket._tket.unit_id.Qubit) pytket._tket.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._tket.tableau.UnitaryTableau, qb: pytket._tket.unit_id.Qubit) pytket._tket.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._tket.tableau.UnitaryTableau) pytket._tket.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._tket.tableau.UnitaryTableauBox¶
A Clifford unitary specified by its actions on Paulis.
- __init__(*args, **kwargs)¶
Overloaded function.
__init__(self: pytket._tket.tableau.UnitaryTableauBox, tab: pytket._tket.tableau.UnitaryTableau) -> None
Construct from a given tableau.
- Parameters:
tab – The
UnitaryTableau
representing the desired unitary.
__init__(self: pytket._tket.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._tket.tableau.UnitaryTableauBox) pytket._tket.circuit.Circuit ¶
- Returns:
The
Circuit
described by the box.
- get_tableau(self: pytket._tket.tableau.UnitaryTableauBox) pytket._tket.tableau.UnitaryTableau ¶
- Returns:
The tableau representing the unitary operation.