Create a new AnnotatedOperation.
An annotated operation can be viewed as an extension of
ControlledGate (which also allows adding control to the base operation). However, an important difference is that the circuit definition of an annotated operation is not constructed when the operation is declared, and instead happens during transpilation, specifically during the
HighLevelSynthesis transpiler pass.
An annotated operation can be also viewed as a “higher-level” or “more abstract” object that can be added to a quantum circuit. This enables writing transpiler optimization passes that make use of this higher-level representation, for instance removing a gate that is immediately followed by its inverse.
- base_op (Operation) – base operation being modified
- modifiers (Modifier | List (opens in a new tab)[Modifier]) – ordered list of modifiers. Supported modifiers include
op1 = AnnotatedOperation(SGate(), [InverseModifier(), ControlModifier(2)]) op2_inner = AnnotatedGate(SGate(), InverseModifier()) op2 = AnnotatedGate(op2_inner, ControlModifier(2))
Both op1 and op2 are semantically equivalent to an
SGate() which is first inverted and then controlled by 2 qubits.
Unique string identifier for operation type.
Number of classical bits.
Number of qubits.
Return a copy of the
Return a matrix representation (allowing to construct Operator).