ich bin gerade dabei eine Programm zu schreiben, dass eine Permutation beinhaltet und mir diese als auch die Permutationsmatrix aus gibt. Ich hoffe das man mir hier auf die Sprünge helfen kann!
Code: Alles auswählen
import numpy as np
M=np.array([[1, 2, 3, 4], [1, 1, 1, 1], [1, 1, 1, 1], [1, 2, 3, 4], [5, 4, 3, 1]])
def Permutation(X):
id=np.identity(max(np.shape(X)))
print (M, "M")
X[:, [3, 0]] = X[:, [0, 3]]
print (M, "permutiertes M ?")
id[:, [3, 0]] = id[:, [0, 3]]
return X, id
print (Permutation(M)[0])