Pauli.insert_paulis

Pauli.insert_paulis(indices=None, paulis=None, pauli_labels=None)[source]

Insert or append pauli to the targeted indices.

If indices is None, it means append at the end.

Parameters
  • indices (list[int]) – the qubit indices to be inserted

  • paulis (Pauli) – the to-be-inserted or appended pauli

  • pauli_labels (list[str]) – the to-be-inserted or appended pauli label

Note

the indices refers to the location of original paulis, e.g. if indices = [0, 2], pauli_labels = [‘Z’, ‘I’] and original pauli = ‘ZYXI’ the pauli will be updated to ZY’I’XI’Z’ ‘Z’ and ‘I’ are inserted before the qubit at 0 and 2.

Returns

self

Return type

Pauli

Raises

QiskitError – provide both paulis and pauli_labels at the same time