, offset=0)[source]

Get indices for the main or minor diagonals of a matrix.

This returns a tuple of indices that can be used to access the main diagonal of an array a with a.ndim == 2 dimensions and shape (n, n).

  • n (int) – The size, along each dimension, of the arrays for which the returned indices can be used.

  • offset (int, optional) – The diagonal offset.