cirq.IdentityGate

class cirq.IdentityGate(num_qubits: Optional[int] = None, qid_shape: Tuple[int, ...] = None)[source]

A Gate that perform no operation on qubits.

The unitary matrix of this gate is a diagonal matrix with all 1s on the
diagonal and all 0s off the diagonal in any basis.

cirq.I is the single qubit identity gate.

__init__(num_qubits: Optional[int] = None, qid_shape: Tuple[int, ...] = None)[source]
Parameters
  • num_qubits

  • qid_shape – Specifies the dimension of each qid the measurement applies to. The default is 2 for every qubit.

Raises

ValueError – If the length of qid_shape doesn’t equal num_qubits.

Methods

controlled([num_controls, control_values, …])

Returns a controlled version of this gate. If no arguments are

num_qubits()

The number of qubits this gate acts on.

on(*qubits)

Returns an application of this gate to the given qubits.

on_each(*targets)

Returns a list of operations that applies the single qubit identity

validate_args(qubits)

Checks if this gate can be applied to the given qubits.

wrap_in_linear_combination([coefficient])