Created
September 11, 2019 18:13
-
-
Save t-mart/5f400fc7baeab7033dbd8765126863f9 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# create a list of 2d indices of A in decreasing order by the size of the | |
# (real) entry of A that they index to | |
def sortedIndices(A): | |
indexList = [(i,j) for i in range(A.shape[0]) for j in range(A.shape[1])] | |
indexList.sort(key=lambda x: -A[x]) | |
return np.array(indexList) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment