Get a view of the diagonal entries of an ndarray