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)
flatten()

Flatten the instruction builder by removing nested structures like InstructionBlocks.

had(target)
property instructions
jump(label, condition=None)
property number_of_instructions
repeat(repeat_count)
reset(targets)
results_processing(variable, res_format)
returns(variables=None)

Add return statement.

abstract swap(target, destination)
PydQuantumInstructionBuilder

alias of QuantumInstructionBuilder

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, frequency)
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 the signal of a single qubit. Execution results in an array of complex numbers that show the war signal output form the hardware. Each entry is for each qubit measured, and is the mean of the results from measure_single_signal_shot.

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

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

measure_mean_z(target, axis=SEQUENCE, output_variable=None)

Measure a single qubit along the z-axis. Execution results in an array of floats centred around 0, where anything above 0 shows a bias towards a +Z measurement, and below 0 shows a bias towards a -Z measurement. Each entry is for each qubit measured, and is the mean of the results from measure_single_shot_z.

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.

measure_scope_mode(target, output_variable=None)

Measure the scope mode

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

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

measure_single_shot_binned(target, axis=SEQUENCE, output_variable=None)

Measure a single qubit along the z-axis. Execution results in an array of ±1s, where 1 indicates a +Z measurement, and -1 indicates a -Z measurement. It takes the results from measure_single_shot_z and applies a binning operation to round the results to ±1. The array is an ndarray, where the first dimension is for each of the qubits measured, the second dimension is for each shot run.

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.

measure_single_shot_signal(target, axis=SEQUENCE, output_variable=None)

Measure the signal of a single qubit. Execution results in an array of complex numbers that show the war signal output form the hardware. The array is an ndarray, where the first dimension is for each of the qubits measured, the second dimension is for each shot run.

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.

measure_single_shot_z(target, axis=SEQUENCE, output_variable=None)

Measure a single qubit along the z-axis. Execution results in an array of floats centred around 0, where anything above 0 shows a bias towards a +Z measurement, and below 0 shows a bias towards a -Z measurement. The array is an ndarray, where the first dimension is for each of the qubits measured, the second dimension is for each shot run.

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)
pretty_print()
pulse(**kwargs)
swap(target, destination)
synchronize(targets)