Create a diagonal matrix

import numpy as np

m = np.diag((2,5,7))
print(m)
[[2 0 0]
 [0 5 0]
 [0 0 7]]

About this Entry

Related Content


Comments