get diagonal indices numpy code example Example: numpy get diagonal matrix from matrix np.diag(np.diag(x))