---
title: AnnotatedOperation (v0.46)
description: API reference for qiskit.circuit.AnnotatedOperation in qiskit v0.46
source: https://eu-de.quantum.cloud.ibm.com/docs/en/api/qiskit/0.46/qiskit.circuit.AnnotatedOperation
---

# AnnotatedOperation

*class* `qiskit.circuit.AnnotatedOperation(base_op, modifiers)`

[GitHub](https://github.com/qiskit/qiskit/tree/stable/0.46/qiskit/circuit/annotated_operation.py)

Bases: [`Operation`](/docs/api/qiskit/0.46/qiskit.circuit.Operation "qiskit.circuit.operation.Operation")

Annotated operation.

Create a new AnnotatedOperation.

An “annotated operation” allows to add a list of modifiers to the “base” operation. For now, the only supported modifiers are of types [`InverseModifier`](/docs/api/qiskit/0.46/qiskit.circuit.InverseModifier "qiskit.circuit.InverseModifier"), [`ControlModifier`](/docs/api/qiskit/0.46/qiskit.circuit.ControlModifier "qiskit.circuit.ControlModifier") and [`PowerModifier`](/docs/api/qiskit/0.46/qiskit.circuit.PowerModifier "qiskit.circuit.PowerModifier").

An annotated operation can be viewed as an extension of [`ControlledGate`](/docs/api/qiskit/0.46/qiskit.circuit.ControlledGate "qiskit.circuit.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`](/docs/api/qiskit/0.46/qiskit.transpiler.passes.HighLevelSynthesis "qiskit.transpiler.passes.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.

**Parameters**

- **base\_op** ([*Operation*](/docs/api/qiskit/0.46/qiskit.circuit.Operation "qiskit.circuit.operation.Operation")) – base operation being modified
- **modifiers** (*Modifier |* [*List*](https://docs.python.org/3/library/typing.html#typing.List)*\[Modifier]*) – ordered list of modifiers. Supported modifiers include `InverseModifier`, `ControlModifier` and `PowerModifier`.

Examples:

```python
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.

## Attributes

### name

Unique string identifier for operation type.

### num\_clbits

Number of classical bits.

### num\_qubits

Number of qubits.

## Methods

### copy

`copy()`

Return a copy of the [`AnnotatedOperation`](#qiskit.circuit.AnnotatedOperation "qiskit.circuit.AnnotatedOperation").

**Return type**

[*AnnotatedOperation*](#qiskit.circuit.AnnotatedOperation "qiskit.circuit.annotated_operation.AnnotatedOperation")

### to\_matrix

`to_matrix()`

Return a matrix representation (allowing to construct Operator).
