I used svd of a matrix A
of size 64*64 in Python as follows.
U,D,V=svd(A)
Now, D
is an array of all eigenvalues of A
. How to rewrite all values in D
as a diagonal matrix? For example, if D=[d1,d2,d3,d4]
, how to have
D_new=[[d1,0,0,0],[0,d2,0,0],[0,0,0,d3],[0,0,0,d4]]?