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
The AcquireMode is used to specify the type of acquisition at the level of the control hardware.
Note that different backends will only allow selected acquisition modes.
RAW: Returns the time-series acquisition data for each shot
SCOPE: Returns the time-series acquisition data where each point is averaged over
the number of shots - INTEGRATOR: Down-conversion and integration of the acquisition data has occurred on the hardware so that a single data point is returned for each shot
- 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 EndRepeat
Bases:
Instruction
Basic scoping. Marks the end of the most recent repeat
- class EndSweep
Bases:
Instruction
Basic scoping. Marks the end of the most recent sweep
- 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 InstructionBlock
Bases:
object
An Instruction grouping type. Allows working with blocks of Instructions as a unit.
-
instructions:
List
[Instruction
]
-
instructions:
- 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 MeasureBlock(targets, mode, output_variables=None, existing_names=None)
Bases:
QuantumInstructionBlock
Groups multiple qubit measurements together.
- add_measurements(targets, mode, output_variables=None, existing_names=None)
- property duration
- get_acquires(targets)
- property instructions: List[QuantumInstruction]
- property quantum_targets
- 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
PostProcessType is used in a PostProcessing instruction to determine how readouts should be processed. It describes a type of classical post-processing:
DOWN_CONVERT: Down-converts the readout measurement, should only be used along the
axis ProcessAxis.TIME. - MEAN: Takes an average over the given axis. - LINEAR_MAP_COMPLEX_TO_REAL: Maps the (complex) measured value onto a (real) z-projection using a supplied linear mapping. - DISCRIMINATE: Converts a z-projection to a classical bit by comparison with a supplied discrimination threshold.
- 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.
- class ProcessAxis(value)
Bases:
Enum
ProcessAxis is used during classical post-processing of readouts. It specifies the axis which the post-processing should occur on. Often used in conjunction with the AcquireMode to determine the correct method for post-processing.
TIME: Instructs the post-processing to be performed over the time-series data
returned from a readout. - SEQUENCE: Instructs the post-processing to be performed over the shots.
- 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 QuantumInstructionBlock
Bases:
InstructionBlock
Allows working with blocks of QuantumInstructions as a unit.
-
duration:
float
-
instructions:
List
[QuantumInstruction
]
-
quantum_targets:
List
[QuantumComponent
]
-
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)
- calculate_duration(instruction, return_samples=True)
Calculates the duration of the instruction for this particular piece of hardware.
- is_generated_name(name)
- remove_floating_point(x)