to_global_op

to_global_op(op, qargs, n_qubits)[source]

Convert a local operator to a global operator by inserting identities on qubits which aren’t used.

Parameters:
  • op (SparsePauliOp) – Local operator to expand.

  • qargs (list[int]) – Qubit indices for local operator.

  • n_qubits (int) – Number of qubits in the global system.

Returns:

An operator on n_qubits qubits

Raises:

ValueError – Qubit ID out of range

Return type:

SparsePauliOp