📅  最后修改于: 2022-03-11 14:45:31.949000             🧑  作者: Mango
""" for this matrix:
[[ 8, 9, 4],
[10, 5, 18],
[ 5, 6, 6]]
"""
n = 5
rows = mat4.shape[0]
row_col_idxs = [(e//rows, e-(e//rows * rows))
for e in mat4.flatten().argsort()[::-1][:n]]
""" result: [(1, 2), (1, 0), (0, 1), (0, 0), (2, 2)] """