Struct quil_rs::program::Program

source ·
pub struct Program {
    pub calibrations: CalibrationSet,
    pub frames: FrameSet,
    pub memory_regions: BTreeMap<String, MemoryRegion>,
    pub waveforms: BTreeMap<String, Waveform>,
    pub instructions: Vec<Instruction>,
}
Expand description

A Quil Program instance describes a quantum program with metadata used in execution.

This contains not only instructions which are executed in turn on the quantum processor, but also the “headers” used to describe and manipulate those instructions, such as calibrations and frame definitions.

Fields§

§calibrations: CalibrationSet§frames: FrameSet§memory_regions: BTreeMap<String, MemoryRegion>§waveforms: BTreeMap<String, Waveform>§instructions: Vec<Instruction>

Implementations§

Add an instruction to the end of the program.

Expand any instructions in the program which have a matching calibration, leaving the others unchanged. Recurses though each instruction while ensuring there is no cycle in the expansion graph (i.e. no calibration expands directly or indirectly into itself)

Build a program from a list of instructions

Return the frames which are either “used” or “blocked” by the given instruction.

An instruction “uses” a frame if it plays on that frame; it “blocks” a frame if the instruction prevents other instructions from playing on that frame until complete.

Return None if the instruction does not execute in the context of a frame - such as classical instructions.

See the Quil-T spec for more information.

Returns a HashSet consisting of every Qubit that is used in the program.

Simplify this program into a new Program which contains only instructions and definitions which are executed; effectively, perform dead code removal.

Removes:

  • All calibrations, following calibration expansion
  • Frame definitions which are not used by any instruction such as PULSE or CAPTURE
  • Waveform definitions which are not used by any instruction

When a valid program is simplified, it remains valid.

Trait Implementations§

Returns a copy of the value. Read more
Performs copy-assignment from source. Read more
Formats the value using the given formatter. Read more
Returns the “default value” for a type. Read more
Converts to this type from the input type.
The associated error which can be returned from parsing.
Parses a string s to return a value of this type. Read more
This method tests for self and other values to be equal, and is used by ==.
This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.

Auto Trait Implementations§

Blanket Implementations§

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The resulting type after obtaining ownership.
Creates owned data from borrowed data, usually by cloning. Read more
Uses borrowed data to replace owned data, usually by cloning. Read more
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.