pauli_rotations#

Note

This section is still under active development

class lsqecc.pauli_rotations.PauliOpCircuit(no_of_qubit, name='')#

Bases: object

Class for representing quantum circuit.

class DecomposerType(value)#

Bases: enum.Enum

An enumeration.

add_pauli_block(new_block, index=None)#

Add a rotation to the circuit

Parameters
  • rotation (PauliRotation) – Targeted rotation

  • index (int, optional) – Index location. Default: End of the circuit

Return type

None

add_pauli_blocks(block_list)#

Adds blocks at the end of the circuit

add_single_operator(qubit, operator_type, rotation_amount, index=None)#

Add a single Pauli operator rotation (X, Z, Y) to the circuit.

Parameters
  • qubit (int) – Targeted qubit

  • operator_type (PauliOperator) – Operator type (X, Y, Z)

  • index (int, optional) – Index location. Default: end of the circuit

Return type

None

apply_transformation(start_index=0)#

Apply Litinski’s Transformation

Return type

None

static are_commuting(block1, block2)#

Check if 2 Pauli Product blocks commute or anti-commute.

Returns

True if they commute, False if they anti-commute

Return type

bool

circuit_has_measurements()#

Check if circuit has any Measurement blocks.

Returns

True if measurements block are present, False if not present

Return type

bool

get_basic_form()#

Returns a circuit where all pauli rotations are either by pi/2, pi/4 or pi/8

Return type

PauliOpCircuit

static load_from_pyzx(circuit)#

Generate circuit from PyZX Circuit

Returns

PyZX Circuit

Return type

circuit

static load_reversible_from_qasm_string(qasm_string, decomposer=DecomposerType.PyZX)#

Load a string as if it were a QASM circuit. Only supports reversible circuits.

Return type

PauliOpCircuit

render_ascii()#

Return circuit diagram in text format

Return type

str

render_latex()#

Generate latex render output of the current circuit.

Return type

str

swap_adjacent_blocks(index)#

Move a pi over four rotation block past its’ neighbor block

Parameters

index (int) – Index of the targeted block in the current circuit

Return type

None

to_y_free_equivalent()#

Return a Y-operator-free copy of the current circuit.

Return type

PauliOpCircuit

class lsqecc.pauli_rotations.PauliOperator(value)#

Bases: enum.Enum

Representation of a Pauli operator inside of a rotation block

static are_commuting(a, b)#

Returns True if a and b are commute and False if anti-commute.

Return type

bool

static multiply_operators(a, b)#

Given 2 Pauli operators A and B, return the nearest Pauli operator as the product of A and B and the coefficient required for such product.

Returns

(coefficient, resultant Pauli operator). Coefficient is either 1, -i or i.

Return type

tuple

class lsqecc.pauli_rotations.PauliRotation(no_of_qubit, rotation_amount)#

Bases: lsqecc.pauli_rotations.rotation.PauliProductOperation, lsqecc.simulation.conditional_operation_control.ConditionalOperation

Class for representing a Pauli Product Rotation Block.

static from_r_gate(num_qubits, target_qubit, phase_type, phase)#

Note that the convention for rz and rx is different from our pauli rotation convention. So an rz(theta) is theta/2 Z rotation in our formalism

to_basic_form_approximation(compress_rotations=False)#

Get an approximation in terms of pi/2, pi/4 and pi/8

Return type

List[PauliRotation]

to_basic_form_decomposition(compress_rotations=False)#

Express in terms of pi/2, pi/4 and pi/8

Return type

List[PauliRotation]

class lsqecc.pauli_rotations.Measurement(no_of_qubit, isNegative=False)#

Bases: lsqecc.pauli_rotations.rotation.PauliProductOperation, lsqecc.simulation.conditional_operation_control.ConditionalOperation

Representing a Pauli Product Measurement Block