cirq.eye_tensor

cirq.eye_tensor(half_shape: Tuple[int, …], *, dtype: Type[numpy.number]) → numpy.array[source]

Returns an identity matrix reshaped into a tensor.

Parameters
  • half_shape – A tuple representing the number of quantum levels of each qubit the returned matrix applies to. half_shape is (2, 2, 2) for a three-qubit identity operation tensor.

  • dtype – The numpy dtype of the new array.

Returns

The created numpy array with shape half_shape + half_shape.