qat.ir.instruction_builder module

class InstructionBuilder(hardware_model, instructions=[])

Bases: ABC

abstract ECR(control, target)
S(target)
SX(target)
SXdg(target)
Sdg(target)
T(target)
Tdg(target)
abstract U(target, theta, phi, lamb, pulse_channel=None)
abstract X(target, theta=3.141592653589793, pulse_channel=None)
abstract Y(target, theta=3.141592653589793, pulse_channel=None)
abstract Z(target, theta=3.141592653589793, pulse_channel=None)
add(*instructions, flatten=False)

Add one or more instruction(s) into this builder. All methods should use this instead of accessing the instructions tree directly as it deals with composite instructions.

assign(name, value)
cX(controllers, target, theta=3.141592653589793)
cY(controllers, target, theta=3.141592653589793)
cZ(controllers, target, theta=3.141592653589793)
abstract ccnot(controllers, target)
cnot(control, target)
static constrain(angle)

Constrain the rotation angle to avoid redundant rotations around the Bloch sphere.

abstract controlled(controllers, builder)
cswap(controllers, target, destination)
had(target)
property instructions
property number_of_instructions
repeat(repeat_count, repetition_period=None)
reset(targets)
results_processing(variable, res_format)
returns(variables=None)

Add return statement.

abstract swap(target, destination)
class QuantumInstructionBuilder(hardware_model, instructions=[])

Bases: InstructionBuilder

ECR(control, target)
U(target, theta, phi, lamb, pulse_channel=None)

Adds an arbitrary rotation around the Bloch sphere with 3 Euler angles to the builder (see https://doi.org/10.48550/arXiv.1707.03429).

Parameters:
  • target (Qubit) – The qubit to be rotated.

  • theta (float) – Rotation angle.

  • phi (float) – Rotation angle.

  • lamb (float) – Rotation angle.

  • pulse_channel (Optional[PulseChannel]) – The pulse channel the pulses get sent to.

X(target, theta=3.141592653589793, **kwargs)
Y(target, theta=3.141592653589793, **kwargs)
Z(target, theta=3.141592653589793, **kwargs)
ZX(target1, target2, theta=0.7853981633974483)

Adds a two-qubit interaction gate exp(-i heta Z x X) to the builder.

Parameters:
  • target1 (Qubit) – The qubit to which Z gets applied to.

  • target2 (Qubit) – The qubit to which X gets applied to.

  • theta (float) – The applied rotation angle.

acquire(target, delay=1e-06, **kwargs)
ccnot(controllers, target)
cnot(control, target)
controlled(controllers, builder)
delay(target, duration)
frequency_shift(target, theta=3.141592653589793, **kwargs)
measure(targets, mode=INTEGRATOR, output_variable=None, sync_qubits=True)

Measure one or more qubits.

Parameters:
  • targets (Qubit | set[Qubit]) – The qubit(s) to be measured.

  • mode (AcquireMode) – The type of acquisition at the level of the control hardware.

  • sync_qubits (bool) – Flag determining whether to align the measurements of all qubits in targets or not. Sync between qubits is on by default.

Return type:

QuantumInstructionBuilder

measure_mean_signal(target, output_variable=None)
measure_mean_z(target, axis=SEQUENCE, output_variable=None)
measure_scope_mode(target, output_variable=None)
measure_single_shot_binned(target, axis=SEQUENCE, output_variable=None)
measure_single_shot_signal(target, axis=SEQUENCE, output_variable=None)
measure_single_shot_z(target, axis=SEQUENCE, output_variable=None)

Measure a single qubit along the z-axis.

Parameters:
  • target (Qubit) – The qubit to be measured.

  • axis (ProcessAxis) – The type of axis which the post-processing of readouts should occur on.

  • output_variable (Optional[str]) – The variable where the output of the acquire should be saved.

phase_shift(target, theta=3.141592653589793, **kwargs)
post_processing(target, output_variable, process_type, axes=None, args=None)
pulse(**kwargs)
swap(target, destination)
synchronize(targets)