braket.circuits.compiler_directive module
- class braket.circuits.compiler_directive.CompilerDirective(ascii_symbols: Sequence[str])[source]
Bases:
Operator
A directive specifying how the compiler should process a part of the circuit.
For example, a directive may tell the compiler not to modify some gates in the circuit.
Inits a
CompilerDirective
.- Parameters:
ascii_symbols (Sequence[str]) – ASCII string symbols for the compiler directiver. These are used when printing a diagram of circuits.
- property name: str
The name of the operator.
- Returns:
str – The name of the operator.
- property ascii_symbols: tuple[str, ...]
Returns the ascii symbols for the compiler directive.
- Type:
tuple[str, …]
- to_ir(target: QubitSet | None = None, ir_type: IRType = IRType.JAQCD, serialization_properties: SerializationProperties | None = None, **kwargs) Any [source]
Returns IR object of the compiler directive.
- Parameters:
target (QubitSet | None) – target qubit(s). Defaults to None
ir_type (IRType) – The IRType to use for converting the compiler directive object to its IR representation. Defaults to IRType.JAQCD.
serialization_properties (SerializationProperties | None) – The serialization properties to use while serializing the object to the IR representation. The serialization properties supplied must correspond to the supplied
ir_type
. Defaults to None.
- Returns:
Any – IR object of the compiler directive.
- Raises:
ValueError – If the supplied
ir_type
is not supported.
- counterpart() CompilerDirective [source]
Returns the “opposite” counterpart to this compiler directive.
For example, the counterpart of a directive that starts a box is the directive that ends the box.
- Returns:
CompilerDirective – The counterpart compiler directive