Struct quil_rs::program::CalibrationSet
source · pub struct CalibrationSet {
pub calibrations: Vec<Calibration>,
pub measure_calibrations: Vec<MeasureCalibrationDefinition>,
}
Expand description
A collection of Quil calibrations (DEFCAL
instructions) with utility methods.
Fields§
§calibrations: Vec<Calibration>
§measure_calibrations: Vec<MeasureCalibrationDefinition>
Implementations§
source§impl CalibrationSet
impl CalibrationSet
sourcepub fn calibrations(&self) -> &[Calibration]
pub fn calibrations(&self) -> &[Calibration]
Return all Calibration
s in the set
sourcepub fn measure_calibrations(&self) -> &[MeasureCalibrationDefinition]
pub fn measure_calibrations(&self) -> &[MeasureCalibrationDefinition]
Return all MeasureCalibrationDefinition
s in the set
sourcepub fn expand(
&self,
instruction: &Instruction,
previous_calibrations: &[Instruction]
) -> Result<Option<Vec<Instruction>>, ProgramError>
pub fn expand( &self, instruction: &Instruction, previous_calibrations: &[Instruction] ) -> Result<Option<Vec<Instruction>>, ProgramError>
Given an instruction, return the instructions to which it is expanded if there is a match. Recursively calibrate instructions, returning an error if a calibration directly or indirectly expands into itself.
sourcepub fn get_match_for_measurement(
&self,
measurement: &Measurement
) -> Option<&MeasureCalibrationDefinition>
pub fn get_match_for_measurement( &self, measurement: &Measurement ) -> Option<&MeasureCalibrationDefinition>
Returns the last-specified MeasureCalibrationDefinition
that matches the target
qubit (if any), or otherwise the last-specified one that specified no qubit.
If multiple calibrations match the measurement, the precedence is as follows:
- Match fixed qubit.
- Match variable qubit.
- Match no qubit.
In the case of multiple calibrations with equal precedence, the last one wins.
sourcepub fn get_match_for_gate(&self, gate: &Gate) -> Option<&Calibration>
pub fn get_match_for_gate(&self, gate: &Gate) -> Option<&Calibration>
Return the final calibration which matches the gate per the QuilT specification:
A calibration matches a gate if:
- It has the same name
- It has the same modifiers
- It has the same qubit count (any mix of fixed & variable)
- It has the same parameter count (both specified and unspecified)
- All fixed qubits in the calibration definition match those in the gate
- All specified parameters in the calibration definition match those in the gate
sourcepub fn push(&mut self, calibration: Calibration)
👎Deprecated: use ScheduledProgram#push_calibration instead
pub fn push(&mut self, calibration: Calibration)
Add another gate calibration to the set.
Deprecated in favor of Self::push_calibration
sourcepub fn push_calibration(&mut self, calibration: Calibration)
pub fn push_calibration(&mut self, calibration: Calibration)
Add another gate calibration (DEFCAL
) to the set.
sourcepub fn push_measurement_calibration(
&mut self,
calibration: MeasureCalibrationDefinition
)
pub fn push_measurement_calibration( &mut self, calibration: MeasureCalibrationDefinition )
Add another measurement calibration (DEFCAL MEASURE
) to the set.
sourcepub fn extend(&mut self, other: CalibrationSet)
pub fn extend(&mut self, other: CalibrationSet)
Append another CalibrationSet
onto this one
sourcepub fn into_instructions(self) -> Vec<Instruction>
pub fn into_instructions(self) -> Vec<Instruction>
Return the Quil instructions which describe the contained calibrations, consuming the CalibrationSet
.
sourcepub fn to_instructions(&self) -> Vec<Instruction>
pub fn to_instructions(&self) -> Vec<Instruction>
Return the Quil instructions which describe the contained calibrations.
Trait Implementations§
source§impl Clone for CalibrationSet
impl Clone for CalibrationSet
source§fn clone(&self) -> CalibrationSet
fn clone(&self) -> CalibrationSet
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moresource§impl Debug for CalibrationSet
impl Debug for CalibrationSet
source§impl Default for CalibrationSet
impl Default for CalibrationSet
source§fn default() -> CalibrationSet
fn default() -> CalibrationSet
source§impl PartialEq<CalibrationSet> for CalibrationSet
impl PartialEq<CalibrationSet> for CalibrationSet
source§fn eq(&self, other: &CalibrationSet) -> bool
fn eq(&self, other: &CalibrationSet) -> bool
self
and other
values to be equal, and is used
by ==
.