Reputation: 2158
I have a 512 x 512
matrix Avg
and it has many zero and non-zero values. Now I want an inplace element-wise square root of the matrix. This is part of my code
import numpy as np
from scipy.linalg import sqrtm
Avg = sqrtm(Avg)
np.savetxt('Avg.txt', Avg)
But, the output is all nan
and it says that the matrix is singular and may not have a square root.
Upvotes: 1
Views: 727
Reputation: 249394
You say you want an element-wise square root. That's np.sqrt()
, not scipy.linalg.sqrtm()
:
Avg = np.sqrt(Avg)
Upvotes: 3