pyquil.quilbase module¶
Contains the core pyQuil objects that correspond to Quil instructions.
- class pyquil.quilbase.AbstractInstruction[source]¶
Bases:
object
Abstract class for representing single instructions.
- class pyquil.quilbase.ArithmeticBinaryOp(left: MemoryReference, right: MemoryReference | int | float)[source]¶
Bases:
Arithmetic
,AbstractInstruction
Base class for binary arithmetic classical instructions.
Initialize the operands of the binary arithmetic instruction.
- property left: MemoryReference¶
The left hand side of the binary expression.
- op: ClassVar[ArithmeticOperator]¶
- out() str [source]¶
Return the instruction as a valid Quil string. Raises an error if the instruction contains placeholders.
- property right: MemoryReference | int | float¶
The left hand side of the binary expression.
- class pyquil.quilbase.Capture(frame: Frame, kernel: WaveformReference | TemplateWaveform, memory_region: MemoryReference, nonblocking: bool = False)[source]¶
Bases:
Capture
,AbstractInstruction
The CAPTURE instruction.
Initialize a new CAPTURE instruction.
- get_qubit_indices() set[int] [source]¶
Get the qubits the capture instruction operates on, as integer indices.
- get_qubits(indices: bool = True) set[Qubit | QubitPlaceholder | FormalArgument | int] | set[int] [source]¶
Get the qubits the capture instruction operates on.
Deprecated since version 4.0: The indices flag will be removed, use get_qubit_indices() instead.
- property kernel: WaveformReference | TemplateWaveform¶
Get the kernel waveform.
- property memory_region: MemoryReference¶
Get the memory reference that the capture is written to.
- property nonblocking: bool¶
Whether the capture is non-blocking.
- class pyquil.quilbase.ClassicalAdd(left: MemoryReference, right: MemoryReference | int | float)[source]¶
Bases:
ArithmeticBinaryOp
The ADD instruction.
Initialize the operands of the binary arithmetic instruction.
- op: ClassVar[ArithmeticOperator] = Add¶
- class pyquil.quilbase.ClassicalAnd(left: MemoryReference, right: MemoryReference | int)[source]¶
Bases:
LogicalBinaryOp
The AND instruction.
Initialize the operands of the binary logical instruction.
- op: ClassVar[BinaryOperator] = And¶
- class pyquil.quilbase.ClassicalComparison(target: MemoryReference, left: MemoryReference, right: MemoryReference | int | float)[source]¶
Bases:
Comparison
,AbstractInstruction
Base class for ternary comparison instructions.
Initialize a new comparison instruction.
- property left: MemoryReference¶
The left hand side of the comparison.
- op: ClassVar[ComparisonOperator]¶
- property right: MemoryReference | int | float¶
The right hand side of the comparison.
- property target: MemoryReference¶
The target of the comparison.
- class pyquil.quilbase.ClassicalConvert(left: MemoryReference, right: MemoryReference)[source]¶
Bases:
Convert
,AbstractInstruction
The CONVERT instruction.
Initialize a new CONVERT instruction.
- property left: MemoryReference¶
Return the left hand side (or “destination”) of the conversion instruction.
- property right: MemoryReference¶
Return the right hand side (or “source”) of the conversion instruction.
- class pyquil.quilbase.ClassicalDiv(left: MemoryReference, right: MemoryReference | int | float)[source]¶
Bases:
ArithmeticBinaryOp
The DIV instruction.
Initialize the operands of the binary arithmetic instruction.
- op: ClassVar[ArithmeticOperator] = Divide¶
- class pyquil.quilbase.ClassicalEqual(target: MemoryReference, left: MemoryReference, right: MemoryReference | int | float)[source]¶
Bases:
ClassicalComparison
The EQ comparison instruction.
Initialize a new comparison instruction.
- op: ClassVar[ComparisonOperator] = ComparisonOperator.Equal¶
- class pyquil.quilbase.ClassicalExchange(left: MemoryReference, right: MemoryReference)[source]¶
Bases:
Exchange
,AbstractInstruction
The EXCHANGE instruction.
Initialize a new EXCHANGE instruction.
- property left: MemoryReference¶
The left hand side of the exchange instruction.
- property right: MemoryReference¶
The left hand side of the exchange instruction.
- class pyquil.quilbase.ClassicalExclusiveOr(left: MemoryReference, right: MemoryReference | int)[source]¶
Bases:
LogicalBinaryOp
The XOR instruction.
Initialize the operands of the binary logical instruction.
- op: ClassVar[BinaryOperator] = Xor¶
- class pyquil.quilbase.ClassicalGreaterEqual(target: MemoryReference, left: MemoryReference, right: MemoryReference | int | float)[source]¶
Bases:
ClassicalComparison
The GE comparison instruction.
Initialize a new comparison instruction.
- op: ClassVar[ComparisonOperator] = ComparisonOperator.GreaterThanOrEqual¶
- class pyquil.quilbase.ClassicalGreaterThan(target: MemoryReference, left: MemoryReference, right: MemoryReference | int | float)[source]¶
Bases:
ClassicalComparison
The GT comparison instruction.
Initialize a new comparison instruction.
- op: ClassVar[ComparisonOperator] = ComparisonOperator.GreaterThan¶
- class pyquil.quilbase.ClassicalInclusiveOr(left: MemoryReference, right: MemoryReference | int)[source]¶
Bases:
LogicalBinaryOp
The IOR instruction.
Initialize the operands of the binary logical instruction.
- op: ClassVar[BinaryOperator] = Ior¶
- class pyquil.quilbase.ClassicalLessEqual(target: MemoryReference, left: MemoryReference, right: MemoryReference | int | float)[source]¶
Bases:
ClassicalComparison
The LE comparison instruction.
Initialize a new comparison instruction.
- op: ClassVar[ComparisonOperator] = ComparisonOperator.LessThanOrEqual¶
- class pyquil.quilbase.ClassicalLessThan(target: MemoryReference, left: MemoryReference, right: MemoryReference | int | float)[source]¶
Bases:
ClassicalComparison
The LT comparison instruction.
Initialize a new comparison instruction.
- op: ClassVar[ComparisonOperator] = ComparisonOperator.LessThan¶
- class pyquil.quilbase.ClassicalLoad(target: MemoryReference, left: str, right: MemoryReference)[source]¶
Bases:
Load
,AbstractInstruction
The LOAD instruction.
Initialize a new LOAD instruction.
- property left: str¶
The left hand side of the LOAD instruction.
- property right: MemoryReference¶
The right hand side of the LOAD instruction.
- property target: MemoryReference¶
The MemoryReference that the instruction loads into.
- class pyquil.quilbase.ClassicalMove(left: MemoryReference, right: MemoryReference | int | float)[source]¶
Bases:
Move
,AbstractInstruction
The MOVE instruction.
Initialize a new MOVE instruction.
- property left: MemoryReference¶
The left hand side (or “destination”) of the move instruction.
- property right: MemoryReference | int | float¶
The right hand side (or “source”) of the move instruction.
- class pyquil.quilbase.ClassicalMul(left: MemoryReference, right: MemoryReference | int | float)[source]¶
Bases:
ArithmeticBinaryOp
The MUL instruction.
Initialize the operands of the binary arithmetic instruction.
- op: ClassVar[ArithmeticOperator] = Multiply¶
- class pyquil.quilbase.ClassicalNeg(target: MemoryReference)[source]¶
Bases:
UnaryClassicalInstruction
The NEG instruction.
Initialize a new unary classical instruction.
- op: ClassVar[UnaryOperator] = Neg¶
- class pyquil.quilbase.ClassicalNot(target: MemoryReference)[source]¶
Bases:
UnaryClassicalInstruction
The NOT instruction.
Initialize a new unary classical instruction.
- op: ClassVar[UnaryOperator] = Not¶
- class pyquil.quilbase.ClassicalStore(target: str, left: MemoryReference, right: MemoryReference | int | float)[source]¶
Bases:
Store
,AbstractInstruction
The STORE instruction.
Initialize a new STORE instruction.
- property left: MemoryReference¶
The left hand side of the STORE instruction.
- property right: MemoryReference | int | float¶
The left hand side of the STORE instruction.
- property target: str¶
The target of the STORE instruction.
- class pyquil.quilbase.ClassicalSub(left: MemoryReference, right: MemoryReference | int | float)[source]¶
Bases:
ArithmeticBinaryOp
The SUB instruction.
Initialize the operands of the binary arithmetic instruction.
- op: ClassVar[ArithmeticOperator] = Subtract¶
- class pyquil.quilbase.Declare(name: str, memory_type: str, memory_size: int = 1, shared_region: str | None = None, offsets: Sequence[tuple[int, str]] | None = None)[source]¶
Bases:
Declaration
,AbstractInstruction
A DECLARE directive.
This is printed in Quil as:
DECLARE <name> <memory-type> (SHARING <other-name> (OFFSET <amount> <type>)* )?
Initialize a new DECLARE directive.
- asdict() dict[str, Sequence[tuple[int, str]] | str | None | int] [source]¶
Get the DECLARE directive as a dictionary.
- property memory_size: int¶
Get the number of elements being declared.
- property memory_type: str¶
Get the type of memory being declared.
- property offsets: list[tuple[int, str]]¶
Get the offsets for this declaration.
Get the memory region this declaration is sharing with, if any.
- class pyquil.quilbase.DefCalibration(name: str, parameters: Sequence[Expression | MemoryReference | int | float | complex | number], qubits: Sequence[Qubit | FormalArgument], instrs: Sequence[AbstractInstruction], modifiers: list[GateModifier] | None = None)[source]¶
Bases:
Calibration
,AbstractInstruction
A calibration definition.
Initialize a new calibration definition.
- property instrs: list[AbstractInstruction]¶
The instructions in the calibration.
- property instructions: list[AbstractInstruction]¶
The instructions in the calibration.
- property parameters: Sequence[Expression | MemoryReference | int | float | complex | number]¶
The parameters of the calibration.
- property qubits: list[Qubit | QubitPlaceholder | FormalArgument | int]¶
The qubits the calibration operates on.
- class pyquil.quilbase.DefCircuit(name: str, parameters: list[Parameter], qubits: list[FormalArgument], instructions: list[AbstractInstruction])[source]¶
Bases:
CircuitDefinition
,AbstractInstruction
A circuit definition.
Initialize a new circuit definition.
- property instructions: list[AbstractInstruction]¶
Get the instructions in the circuit.
- property qubit_variables: list[FormalArgument]¶
Get the qubit parameters of the circuit.
- class pyquil.quilbase.DefFrame(frame: Frame, direction: str | None = None, initial_frequency: float | None = None, hardware_object: str | None = None, sample_rate: float | None = None, center_frequency: float | None = None, enable_raw_capture: str | None = None, channel_delay: float | None = None)[source]¶
Bases:
FrameDefinition
,AbstractInstruction
A frame definition.
Get the frame definition.
- property center_frequency: Frame¶
Get the CENTER-FREQUENCY attribute of the frame.
Deprecated since version 4.0: Quil now supports generic key/value pairs in DEFFRAMEs. Use get_attribute(‘CENTER-FREQUENCY’) instead.
- property channel_delay: Frame¶
Get the CHANNEL-DELAY attribute of the frame.
Deprecated since version 4.0: Quil now supports generic key/value pairs in DEFFRAMEs. Use get_attribute(‘CHANNEL-DELAY’) instead.
- property direction: str | None¶
Get the DIRECTION attribute of the frame.
Deprecated since version 4.0: Quil now supports generic key/value pairs in DEFFRAMEs. Use get_attribute(‘DIRECTION’) instead.
- get_attribute(name: str) str | float | None [source]¶
Get an attribute’s value on the frame definition.
- property hardware_object: str | None¶
Get the HARDWARE-OBJECT attribute of the frame.
Deprecated since version 4.0: Quil now supports generic key/value pairs in DEFFRAMEs. Use get_attribute(‘HARDWARE-OBJECT’) instead.
- property initial_frequency: float | None¶
Get the INITIAL-FREQUENCY attribute of the frame.
Deprecated since version 4.0: Quil now supports generic key/value pairs in DEFFRAMEs. Use set_attribute(‘INITIAL-FREQUENCY’) instead.
- class pyquil.quilbase.DefGate(name: str, matrix: list[list[Expression]] | ndarray | matrix, parameters: list[Parameter] | None = None)[source]¶
Bases:
GateDefinition
,AbstractInstruction
A DEFGATE directive.
Initialize a new gate definition.
- Parameters:
name – The name of the newly defined gate.
matrix – The matrix defining this gate.
parameters – list of parameters that are used in this gate
- get_constructor() Callable[[...], Gate] | Callable[[...], Callable[[...], Gate]] [source]¶
Return a function that constructs this gate on variable qubit indices.
For example, mygate.get_constructor()(1) applies the gate to qubit 1.
- property matrix: ndarray¶
Get the matrix that defines this GateDefinition.
- class pyquil.quilbase.DefGateByPaulis(gate_name: str, parameters: list[Parameter], arguments: list[Qubit | QubitPlaceholder | FormalArgument | int], body: PauliSum)[source]¶
Bases:
DefGate
A gate definition defined by the exponentiation of a PauliSum.
Initialize a new gate, defined by a PauliSum.
- property arguments: list[FormalArgument]¶
Get the arguments the gate takes.
- class pyquil.quilbase.DefMeasureCalibration(qubit: Qubit | FormalArgument | None, memory_reference: MemoryReference, instrs: list[AbstractInstruction])[source]¶
Bases:
MeasureCalibrationDefinition
,AbstractInstruction
A measure calibration definition.
Initialize a new measure calibration definition.
- property instrs: list[AbstractInstruction]¶
Get the instructions in the calibration.
- property instructions: list[AbstractInstruction]¶
The instructions in the calibration.
- property memory_reference: MemoryReference | None¶
Get the memory reference this calibration writes to.
- property qubit: Qubit | QubitPlaceholder | FormalArgument | int | None¶
Get the qubit this calibration matches.
- class pyquil.quilbase.DefPermutationGate(name: str, permutation: list[int] | ndarray)[source]¶
Bases:
DefGate
A gate defined by a permutation of numbers.
Initialize a new gate definition with a permutation.
- property permutation: list[int]¶
Get the permutation that defines the gate.
- class pyquil.quilbase.DefWaveform(name: str, parameters: list[Parameter], entries: list[complex | Expression])[source]¶
Bases:
WaveformDefinition
,AbstractInstruction
A waveform definition.
Initialize a new waveform definition.
- property entries: Sequence[Expression | MemoryReference | int | float | complex | number]¶
Get the entries in the waveform definition.
- class pyquil.quilbase.Delay(frames: list[Frame], qubits: Sequence[int | Qubit | FormalArgument], duration: float)[source]¶
Bases:
Delay
,AbstractInstruction
The DELAY instruction.
Initialize a new DELAY instruction.
- property duration: float¶
Get the duration of the delay.
- property qubits: list[Qubit | QubitPlaceholder | FormalArgument | int]¶
Get the qubits the delay operates on.
- class pyquil.quilbase.DelayFrames(frames: list[Frame], duration: float)[source]¶
Bases:
Delay
A DELAY instruction that operates on frames.
Initialize a new DELAY instruction that operates on frames.
- class pyquil.quilbase.DelayQubits(qubits: Sequence[Qubit | FormalArgument], duration: float)[source]¶
Bases:
Delay
Initialize a new DELAY instruction that operates on qubits.
Initialize a new DELAY instruction that operates on qubits.
- class pyquil.quilbase.Fence(qubits: list[Qubit | FormalArgument])[source]¶
Bases:
Fence
,AbstractInstruction
The FENCE instruction.
Initialize a new FENCE instruction.
- property qubits: list[Qubit | QubitPlaceholder | FormalArgument | int]¶
Get the qubits the fence operates on.
Note: If qubits is empty, then the instruction fences all qubits.
- class pyquil.quilbase.FenceAll[source]¶
Bases:
Fence
A FENCE instruction that operates on all qubits.
Initialize a new FenceAll instruction.
- class pyquil.quilbase.Gate(name: str, params: Sequence[Expression | MemoryReference | int | float | complex | number], qubits: Sequence[Qubit | QubitPlaceholder | FormalArgument | int], modifiers: Sequence[GateModifier] = [])[source]¶
Bases:
Gate
,AbstractInstruction
A quantum gate instruction.
Initialize a new gate instruction.
- controlled(control_qubit: Qubit | Qubit | QubitPlaceholder | FormalArgument | int | Sequence[Qubit | QubitPlaceholder | FormalArgument | int | Qubit]) Gate [source]¶
Add the CONTROLLED modifier to the gate with the given control qubit or Sequence of control qubits.
- forked(fork_qubit: Qubit | Qubit | QubitPlaceholder | FormalArgument | int, alt_params: Sequence[Expression | MemoryReference | int | float | complex | number] | Sequence[Expression]) Gate [source]¶
Add the FORKED modifier to the gate with the given fork qubit and given additional parameters.
- get_qubits(indices: bool = True) Sequence[Qubit | QubitPlaceholder | FormalArgument | int] [source]¶
Get the qubits the gate operates on.
Deprecated since version 4.0: The indices flag will be removed, use get_qubit_indices() instead.
- property modifiers: list[str]¶
Get all modifiers applied to the gate.
- property params: Sequence[Expression | MemoryReference | int | float | complex | number]¶
Get the parameters the gate operates on.
- property qubits: list[Qubit | QubitPlaceholder | FormalArgument | int]¶
Get the qubits the gate operates on.
- class pyquil.quilbase.Halt[source]¶
Bases:
SimpleInstruction
The HALT instruction.
- instruction: ClassVar[Instruction] = Halt¶
- class pyquil.quilbase.Include(filename)[source]¶
Bases:
Include
,AbstractInstruction
An INCLUDE directive.
- class pyquil.quilbase.Jump(target: Label | LabelPlaceholder)[source]¶
Bases:
Jump
,AbstractInstruction
Representation of an unconditional jump instruction (JUMP).
Initialize a new jump instruction.
- out() str [source]¶
Return the instruction as a valid Quil string. Raises an error if the target is an unresolved placeholder.
- property target: Label | LabelPlaceholder¶
Get the target of the jump.
- class pyquil.quilbase.JumpTarget(label: Label | LabelPlaceholder)[source]¶
Bases:
Label
,AbstractInstruction
Representation of a target that can be jumped to.
Initialize a new target.
- property label: Label | LabelPlaceholder¶
Get the target as a label.
- class pyquil.quilbase.JumpUnless(target: Label | LabelPlaceholder, condition: MemoryReference)[source]¶
Bases:
JumpUnless
,AbstractInstruction
The JUMP-UNLESS instruction.
Initialize a new JumpUnless instruction.
- Parameters:
target – The target to jump to if the condition is true.
condition – A memory reference that determines if the jump should be performed. The memory reference must refer to an INTEGER or BIT. The jump will be performed if the value in the reference is 0 when the instruction is evaluated.
- property condition: MemoryReference¶
Get the MemoryReference the instruction uses to determine if the jump should be performed or not.
- out() str [source]¶
Return the instruction as valid Quil. Raises an error if the target is an unresolved placeholder.
- property target: Label | LabelPlaceholder¶
Get the target the instruction will jump to if the condition bit is not 1.
- class pyquil.quilbase.JumpWhen(target: Label | LabelPlaceholder, condition: MemoryReference)[source]¶
Bases:
JumpWhen
,AbstractInstruction
The JUMP-WHEN instruction.
Initialize a new JumpWhen instruction.
- Parameters:
target – The target to jump to if the condition is true.
condition – A memory reference that determines if the jump should be performed. The memory reference must refer to an INTEGER or BIT. The jump will be performed if the value in the reference is not 0 when the instruction is evaluated.
- property condition: MemoryReference¶
Get the MemoryReference the instruction uses to determine if the jump should be performed or not.
- out() str [source]¶
Return the instruction as valid Quil. Raises an error if the target is an unresolved placeholder.
- property target: Label | LabelPlaceholder¶
Get the target the instruction will jump to if the condition bit is not 1.
- class pyquil.quilbase.LogicalBinaryOp(left: MemoryReference, right: MemoryReference | int)[source]¶
Bases:
BinaryLogic
,AbstractInstruction
Base class for binary logical classical instructions.
Initialize the operands of the binary logical instruction.
- property left: MemoryReference¶
The left hand side of the binary expression.
- op: ClassVar[BinaryOperator]¶
- out() str [source]¶
Return the instruction as a valid Quil string. Raises an error if the instruction contains placeholders.
- property right: MemoryReference | int¶
The right hand side of the binary expression.
- class pyquil.quilbase.Measurement(qubit: Qubit | QubitPlaceholder | FormalArgument | int, classical_reg: MemoryReference | None)[source]¶
Bases:
Measurement
,AbstractInstruction
A Quil measurement instruction.
Initialize a new measurement instruction.
- property classical_reg: MemoryReference | None¶
Get the MemoryReference that this instruction writes to, if any.
- get_qubit_indices() set[int] [source]¶
Get the qubit this instruction measures, as an integer index.
- get_qubits(indices: bool = True) set[Qubit | QubitPlaceholder | FormalArgument | int] | set[int] [source]¶
Get the qubit this instruction measures.
Deprecated since version 4.0: The indices flag will be removed, use get_qubit_indices() instead.
- property qubit: Qubit | QubitPlaceholder | FormalArgument | int¶
Get the qubit the instruction measures.
- class pyquil.quilbase.Nop[source]¶
Bases:
SimpleInstruction
The NOP instruction.
- instruction: ClassVar[Instruction] = Nop¶
- class pyquil.quilbase.Pragma(command: str, args: Sequence[Qubit | FormalArgument | int | str] = (), freeform_string: str = '')[source]¶
Bases:
Pragma
,AbstractInstruction
A PRAGMA instruction.
This is printed in QUIL as:
PRAGMA <command> <arg1> <arg2> … <argn> “<freeform_string>”
Initialize a new PRAGMA instruction.
- property args: tuple[Qubit | QubitPlaceholder | FormalArgument | int]¶
Get the arguments of the PRAGMA command.
- property command: str¶
Get the pragma command identifier.
- property freeform_string: str¶
Get the PRAGMA’s freeform string.
- class pyquil.quilbase.Pulse(frame: Frame, waveform: WaveformReference | TemplateWaveform, nonblocking: bool = False)[source]¶
Bases:
Pulse
,AbstractInstruction
A PULSE instruction.
Initialize a new Pulse instruction.
- get_qubits(indices: bool = True) set[Qubit | QubitPlaceholder | FormalArgument | int] | set[int] [source]¶
Get the qubits the pulse operates on.
Deprecated since version 4.0: The indices flag will be removed, use get_qubit_indices() instead.
- property nonblocking: bool¶
Return whether the pulse is non-blocking.
- property waveform: WaveformReference | TemplateWaveform¶
Get the waveform of the pulse.
- class pyquil.quilbase.RawCapture(frame: Frame, duration: float, memory_region: MemoryReference, nonblocking: bool = False)[source]¶
Bases:
RawCapture
,AbstractInstruction
The RAW-CAPTURE instruction.
Initialize a new RAW-CAPTURE instruction.
- property duration: complex¶
Get the duration of the capture.
- get_qubit_indices() set[int] [source]¶
Get the qubits the raw-capture instruction operates on, as integer indices.
- get_qubits(indices: bool = True) set[Qubit | QubitPlaceholder | FormalArgument | int] | set[int] [source]¶
Get the qubits the raw-capture instruction operates on.
Deprecated since version 4.0: The indices flag will be removed, use get_qubit_indices() instead.
- property memory_region: MemoryReference¶
Get the memory region that the capture is written to.
- property nonblocking: bool¶
Whether the capture is non-blocking.
- class pyquil.quilbase.Reset(qubit: Qubit | QubitPlaceholder | FormalArgument | int | None = None)[source]¶
Bases:
Reset
,AbstractInstruction
The RESET instruction.
Initialize a new reset instruction.
- get_qubit_indices() set[int] | None [source]¶
Get the qubit this instruction resets, as an integer index.
- get_qubits(indices: bool = True) set[Qubit | QubitPlaceholder | FormalArgument | int] | None [source]¶
Get the qubit this instruction resets.
Deprecated since version 4.0: The indices flag will be removed, use get_qubit_indices() instead.
- property qubit: Qubit | QubitPlaceholder | FormalArgument | int | None¶
Get the qubit this instruction resets, if any.
- class pyquil.quilbase.ResetQubit(qubit: Qubit | QubitPlaceholder | FormalArgument | int)[source]¶
Bases:
Reset
A targeted RESET instruction.
Initialize a new reset instruction, with a target qubit.
- class pyquil.quilbase.SetFrequency(frame: Frame, freq: Expression | MemoryReference | int | float | complex | number)[source]¶
Bases:
SetFrequency
,AbstractInstruction
A SET-FREQUENCY instruction.
Initialize a new SET-FREQUENCY instruction.
- property freq: Expression | MemoryReference | int | float | complex | number¶
Get the frequency that is set.
- get_qubits(indices: bool = True) set[Qubit | QubitPlaceholder | FormalArgument | int] | set[int] [source]¶
Get the qubits the frequency is set on.
Deprecated since version 4.0: The indices flag will be removed, use get_qubit_indices() instead.
- class pyquil.quilbase.SetPhase(frame: Frame, phase: Expression | MemoryReference | int | float | complex | number)[source]¶
Bases:
SetPhase
,AbstractInstruction
The SET-PHASE instruction.
Initialize a new SET-PHASE instruction.
- get_qubits(indices: bool = True) set[Qubit | QubitPlaceholder | FormalArgument | int] | set[int] [source]¶
Get the quibts the phase is set on.
Deprecated since version 4.0: The indices flag will be removed, use get_qubit_indices() instead.
- property phase: Expression | MemoryReference | int | float | complex | number¶
Get the phase this instruction sets.
- class pyquil.quilbase.SetScale(frame: Frame, scale: Expression | MemoryReference | int | float | complex | number)[source]¶
Bases:
SetScale
,AbstractInstruction
The SET-SCALE instruction.
Initialize a new SET-SCALE instruction.
- get_qubits(indices: bool = True) set[Qubit | QubitPlaceholder | FormalArgument | int] | set[int] [source]¶
Get the qubits the scale is set on.
Deprecated since version 4.0: The indices flag will be removed, use get_qubit_indices() instead.
- property scale: Expression | MemoryReference | int | float | complex | number¶
Get the scale that is set.
- class pyquil.quilbase.ShiftFrequency(frame: Frame, freq: Expression | MemoryReference | int | float | complex | number)[source]¶
Bases:
ShiftFrequency
,AbstractInstruction
The SHIFT-FREQUENCY instruction.
Initialize a new SHIFT-FREQUENCY instruction.
- property freq: Expression | MemoryReference | int | float | complex | number¶
Get the parameter that defines how the frequency is shifted.
- get_qubit_indices() set[int] [source]¶
Get the qubits the frequency is shifted on, as integer indices.
- get_qubits(indices: bool = True) set[Qubit | QubitPlaceholder | FormalArgument | int] | set[int] [source]¶
Get the qubits the frequency is shifted on.
Deprecated since version 4.0: The indices flag will be removed, use get_qubit_indices() instead.
- class pyquil.quilbase.ShiftPhase(frame: Frame, phase: Expression | MemoryReference | int | float | complex | number)[source]¶
Bases:
ShiftPhase
,AbstractInstruction
The SHIFT-PHASE instruction.
Initialize a new SHIFT-PHASE instruction.
- get_qubits(indices: bool = True) set[Qubit | QubitPlaceholder | FormalArgument | int] | set[int] [source]¶
Get the qubits the phase is shifted on.
Deprecated since version 4.0: The indices flag will be removed, use get_qubit_indices() instead.
- property phase: Expression | MemoryReference | int | float | complex | number¶
Get the parameter that defines how the phase is shifted.
- class pyquil.quilbase.SimpleInstruction[source]¶
Bases:
AbstractInstruction
Base class for simple instructions with no arguments.
- instruction: ClassVar[Instruction]¶
- class pyquil.quilbase.SwapPhases(frameA: Frame, frameB: Frame)[source]¶
Bases:
SwapPhases
,AbstractInstruction
The SWAP-PHASES instruction.
Initialize a new SWAP-PHASES instruction.
- get_qubit_indices() set[int] [source]¶
Get the qubits the swap-phases instruction operates on, as integer indices.
- get_qubits(indices: bool = True) set[Qubit | QubitPlaceholder | FormalArgument | int] | set[int] [source]¶
Get the qubits the swap-phases instruction operates on.
Deprecated since version 4.0: The indices flag will be removed, use get_qubit_indices() instead.
- class pyquil.quilbase.UnaryClassicalInstruction(target: MemoryReference)[source]¶
Bases:
UnaryLogic
,AbstractInstruction
Base class for unary classical instructions.
Initialize a new unary classical instruction.
- op: ClassVar[UnaryOperator]¶
- out() str [source]¶
Return the instruction as a valid Quil string. Raises an error if the instruction contains placeholders.
- property target: MemoryReference¶
The MemoryReference that the instruction operates on.
- class pyquil.quilbase.Wait[source]¶
Bases:
SimpleInstruction
The WAIT instruction.
- instruction: ClassVar[Instruction] = Wait¶