How can I find sqrt
of sparse matrix containing negative numbers in python? scipy.sparse.csr_matrix.sqrt
and numpy.sqrt
doesn't work for negative numbers. I also tried to use cmath.sqrt(mat_name.data)
. But it's not working also.
Asked
Active
Viewed 238 times
1

galib
- 93
- 2
- 9
-
Are you looking for the square root of each individual number in the matrix, or a matrix square root in the sense of matrix multiplication? – kaya3 Nov 21 '19 at 21:18
-
individual numbers of a matrix – galib Nov 21 '19 at 22:17
1 Answers
1
from numpy.lib.scimath import sqrt
works to find sqrt
of sparse matrix with negative numbers. Found the answer here How can I take the square root of -1 using python? from @David Zwicker

galib
- 93
- 2
- 9