qat.purr.compiler.instructions module

class Acquire(channel, time=None, mode=None, output_variable=None, existing_names=None, delay=None, filter=None)

Bases: QuantumComponent, QuantumInstruction

property channel: PulseChannel
property duration
generate_name(existing_names=None)
suffix_incrementor: int = 0
class AcquireMode(value)

Bases: Enum

An enumeration.

INTEGRATOR = 'integrator'
RAW = 'raw'
SCOPE = 'scope'
class Assign(name, value)

Bases: Instruction

Assigns the variable ‘x’ the value ‘y’. This can be performed as a part of running on the QPU or by a post-processing pass.

class BinaryOperator(left, right)

Bases: object

Binary operator, such as x == y, x != y etc.

class CrossResonanceCancelPulse(quantum_target, shape, width, amp=1.0, phase=0.0, drag=0.0, rise=0.0, amp_setup=0.0, scale_factor=1.0, zero_at_edges=0, beta=0.0, frequency=0.0, internal_phase=0.0, std_dev=0.0, square_width=0.0, ignore_channel_scale=False)

Bases: Pulse

class CrossResonancePulse(quantum_target, shape, width, amp=1.0, phase=0.0, drag=0.0, rise=0.0, amp_setup=0.0, scale_factor=1.0, zero_at_edges=0, beta=0.0, frequency=0.0, internal_phase=0.0, std_dev=0.0, square_width=0.0, ignore_channel_scale=False)

Bases: Pulse

class CustomPulse(quantum_target, samples, ignore_channel_scale=False)

Bases: Waveform

Send a pulse down this particular channel.

property duration
class Delay(quantum_target, time)

Bases: QuantumInstruction

property duration
class DeviceUpdate(target, attribute, value)

Bases: QuantumInstruction

Dynamically assigns a value to a particular symbol or hardware attribute during execution.

Note

It’s still unknown how this will be represented in the instructions themselves, but that’ll come later.

For now we perform programatic modification and a before/after state.

class DrivePulse(quantum_target, shape, width, amp=1.0, phase=0.0, drag=0.0, rise=0.0, amp_setup=0.0, scale_factor=1.0, zero_at_edges=0, beta=0.0, frequency=0.0, internal_phase=0.0, std_dev=0.0, square_width=0.0, ignore_channel_scale=False)

Bases: Pulse

class Equals(left, right)

Bases: BinaryOperator

class FrequencyShift(channel, frequency)

Bases: QuantumInstruction

property channel: PulseChannel
class GreaterOrEqualThan(left, right)

Bases: BinaryOperator

class GreaterThan(left, right)

Bases: BinaryOperator

class Id(quantum_targets=None)

Bases: QuantumInstruction

Simply a no-op, called an Identity gate.

class IndexAccessor(name, index)

Bases: Variable

Used to access an array index on a particular variable.

class Instruction

Bases: object

class Jump(label, condition=None)

Bases: Instruction

Classic jump instruction, should be linked to label with an optional condition.

class Label(name)

Bases: Instruction

Label to apply to a line of code. Used as anchors for other instructions like jumps.

If you need a name, use generate_name and pass in existing values.

static generate_name(existing_names=None)
static with_random_name(existing_names=None)
class LessOrEqualThan(left, right)

Bases: BinaryOperator

class LessThan(left, right)

Bases: BinaryOperator

class MeasurePulse(quantum_target, shape, width, amp=1.0, phase=0.0, drag=0.0, rise=0.0, amp_setup=0.0, scale_factor=1.0, zero_at_edges=0, beta=0.0, frequency=0.0, internal_phase=0.0, std_dev=0.0, square_width=0.0, ignore_channel_scale=False)

Bases: Pulse

class NotEquals(left, right)

Bases: BinaryOperator

class PhaseReset(reset_channels)

Bases: QuantumInstruction

Reset the phase shift of all the channels

add_channels(reset_channels)
quantum_targets: List[PulseChannel]
class PhaseShift(channel, phase)

Bases: QuantumInstruction

property channel: PulseChannel
class PostProcessType(value)

Bases: Enum

An enumeration.

DISCRIMINATE = 'discriminate'
DOWN_CONVERT = 'down_convert'
LINEAR_MAP_COMPLEX_TO_REAL = 'linear_map_real'
MEAN = 'mean'
MUL = 'mul'
class PostProcessing(acquire, process, axes=None, args=None)

Bases: QuantumInstruction

States what post-processing should happen after data has been acquired. This can happen in the FPGA’s or a software post-process.

property acquire: Acquire
class ProcessAxis(value)

Bases: Enum

An enumeration.

SEQUENCE = 'sequence'
TIME = 'time'
class Pulse(quantum_target, shape, width, amp=1.0, phase=0.0, drag=0.0, rise=0.0, amp_setup=0.0, scale_factor=1.0, zero_at_edges=0, beta=0.0, frequency=0.0, internal_phase=0.0, std_dev=0.0, square_width=0.0, ignore_channel_scale=False)

Bases: Waveform

Send a pulse down this particular channel.

property duration
class QuantumInstruction(quantum_targets=None)

Bases: Instruction

Any node that deals particularly with quantum operations. All quantum operations must have some sort of target on the quantum computer, such as a qubit, channel, or another form of component.

property duration
class QuantumMetadata

Bases: Instruction

class Repeat(repeat_count, repetition_period=None)

Bases: Instruction

Global meta-instruction that applies to the entire list of instructions. Repeat value of the current operations, also known as shots.

class Reset(qubit)

Bases: QuantumInstruction

Resets this qubit to its starting state.

class ResultsProcessing(variable, res_processing)

Bases: Instruction

class Return(variables=None)

Bases: Instruction

A statement defining what to return from a quantum execution.

class SecondStatePulse(quantum_target, shape, width, amp=1.0, phase=0.0, drag=0.0, rise=0.0, amp_setup=0.0, scale_factor=1.0, zero_at_edges=0, beta=0.0, frequency=0.0, internal_phase=0.0, std_dev=0.0, square_width=0.0, ignore_channel_scale=False)

Bases: Pulse

class Sweep(operations=None)

Bases: Instruction

This is a global meta-instruction that performs a sweep over values, effectively performing a loop over the instructions replacing a variable with a specific value per time.

Nested sweeps are run in the order they’re added and are performed after repeats. So a 1000 repeat with a 4 sweep followed by a 2 will run a total of 8000 iterations.

property length
class SweepOperation

Bases: object

Common parent for all things that need differentiating during a sweep.

class SweepValue(name, value)

Bases: SweepOperation

class Synchronize(sync_channels)

Bases: QuantumInstruction

Tells the QPU to wait for all the related channels to be free before continuing execution on any of them.

add_channels(sync_channels)
quantum_targets: List[PulseChannel]
class Variable(name, var_type=None, value=None)

Bases: object

States that this value is actually a variable that should be fetched instead.

static generate_name(existing_names=None)
static with_random_name(existing_names=None, var_type=None, value=None)
class Waveform(quantum_targets=None)

Bases: QuantumInstruction

property channel: PulseChannel
build_generated_name(existing_names=None, prefix=None)
is_generated_name(name)