---
title: ChangeBasis (latest version)
description: API reference for samplomatic.ChangeBasis in the latest version of samplomatic
source: https://eu-de.quantum.cloud.ibm.com/docs/en/api/samplomatic/auto/change-basis
---

# samplomatic.ChangeBasis

*class* `samplomatic.ChangeBasis(decomposition: DecompositionMode | Literal['rzsx', 'rzrx'] = DecompositionMode.RZSX, mode: ChangeBasisMode | Literal['measure', 'prepare'] = ChangeBasisMode.MEASURE, ref: str | None = None, dressing: DressingMode | Literal['left', 'right'] = DressingMode.LEFT)`

[GitHub](https://github.com/Qiskit/samplomatic/tree/main/samplomatic/annotations/change_basis.py#L23-L71)

Directive to add basis changing gates.

The resulting [`Samplex`](/docs/api/samplomatic/auto/samplex-samplex "samplomatic.samplex.Samplex") built from a circuit with a box with this annotation has a tensor input with name `basis_changes.ref` and shape `'(len(box_instruction.qubits),)'`. The tensor is indexed in physical qubit order, in other words, the order of the qubits in the outer-most circuit, restricted to those used by the box.

**Parameters**

- **decomposition** – How to decompose basis changing gates.
- **dressing** – Which side of the box to attach the dressing instructions.
- **mode** – Whether to add gates to prepare or measure in a given basis.
- **ref** – A unique identifier of this basis change. If `None`, it is set to `mode.value`.

### \_\_init\_\_

`__init__(decomposition: DecompositionMode | Literal['rzsx', 'rzrx'] = DecompositionMode.RZSX, mode: ChangeBasisMode | Literal['measure', 'prepare'] = ChangeBasisMode.MEASURE, ref: str | None = None, dressing: DressingMode | Literal['left', 'right'] = DressingMode.LEFT)`

[GitHub](https://github.com/Qiskit/samplomatic/tree/main/samplomatic/annotations/change_basis.py#L42-L52)

## Methods

|                                                                                                                           |   |
| ------------------------------------------------------------------------------------------------------------------------- | - |
| [`__init__`](#samplomatic.ChangeBasis.__init__ "samplomatic.ChangeBasis.__init__")(\[decomposition, mode, ref, dressing]) |   |

## Attributes

|                 |   |
| --------------- | - |
| `decomposition` |   |
| `dressing`      |   |
| `mode`          |   |
| `ref`           |   |
| `namespace`     |   |
