pub struct Calibrations {
pub calibrations: CalibrationSet<Calibration>,
pub measure_calibrations: CalibrationSet<MeasureCalibrationDefinition>,
}
Expand description
A collection of Quil calibrations (DEFCAL
instructions) with utility methods.
Fields§
§calibrations: CalibrationSet<Calibration>
§measure_calibrations: CalibrationSet<MeasureCalibrationDefinition>
Implementations§
Source§impl Calibrations
impl Calibrations
Sourcepub fn calibrations(&self) -> Vec<&Calibration>
pub fn calibrations(&self) -> Vec<&Calibration>
Return a vector containing a reference to all Calibration
s in the set.
Sourcepub fn measure_calibrations(&self) -> Vec<&MeasureCalibrationDefinition>
pub fn measure_calibrations(&self) -> Vec<&MeasureCalibrationDefinition>
Return a vector containing a reference to all MeasureCalibrationDefinition
s
in the set.
Sourcepub fn iter_calibrations(&self) -> impl Iterator<Item = &Calibration>
pub fn iter_calibrations(&self) -> impl Iterator<Item = &Calibration>
Iterate over all Calibration
s in the set
Sourcepub fn iter_measure_calibrations(
&self,
) -> impl Iterator<Item = &MeasureCalibrationDefinition>
pub fn iter_measure_calibrations( &self, ) -> impl Iterator<Item = &MeasureCalibrationDefinition>
Iterate over all MeasureCalibrationDefinition
s calibrations 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.
Return only the expanded instructions; for more information about the expansion process,
see Self::expand_with_detail
.
Sourcepub fn expand_with_detail(
&self,
instruction: &Instruction,
previous_calibrations: &[Instruction],
) -> Result<Option<CalibrationExpansionOutput>, ProgramError>
pub fn expand_with_detail( &self, instruction: &Instruction, previous_calibrations: &[Instruction], ) -> Result<Option<CalibrationExpansionOutput>, 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.
Also return information about the expansion.
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 insert_calibration(
&mut self,
calibration: Calibration,
) -> Option<Calibration>
pub fn insert_calibration( &mut self, calibration: Calibration, ) -> Option<Calibration>
Insert a Calibration
into the set.
If a calibration with the same [CalibrationSignature
] already exists in the set, it will
be replaced, and the old calibration is returned.
Sourcepub fn insert_measurement_calibration(
&mut self,
calibration: MeasureCalibrationDefinition,
) -> Option<MeasureCalibrationDefinition>
pub fn insert_measurement_calibration( &mut self, calibration: MeasureCalibrationDefinition, ) -> Option<MeasureCalibrationDefinition>
Insert a [MeasureCalibration
] into the set.
If a calibration with the same [CalibrationSignature
] already exists in the set, it will
be replaced, and the old calibration is returned.
Sourcepub fn extend(&mut self, other: Calibrations)
pub fn extend(&mut self, other: Calibrations)
Append another CalibrationSet
onto this one.
Calibrations with conflicting [CalibrationSignature
]s are overwritten by the ones in the
given set.
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 Calibrations
impl Clone for Calibrations
Source§fn clone(&self) -> Calibrations
fn clone(&self) -> Calibrations
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moreSource§impl Debug for Calibrations
impl Debug for Calibrations
Source§impl Default for Calibrations
impl Default for Calibrations
Source§fn default() -> Calibrations
fn default() -> Calibrations
Source§impl PartialEq for Calibrations
impl PartialEq for Calibrations
impl StructuralPartialEq for Calibrations
Auto Trait Implementations§
impl Freeze for Calibrations
impl RefUnwindSafe for Calibrations
impl Send for Calibrations
impl Sync for Calibrations
impl Unpin for Calibrations
impl UnwindSafe for Calibrations
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)Source§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
Source§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
self
from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
self
is actually part of its subset T
(and can be converted to it).Source§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
self.to_subset
but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
self
to the equivalent element of its superset.