Replaced linalg.sqrtm with linalg.fractional_matrix_power to prevent numerical errors when computing the square root of sparse matrices. The previous method was causing very large complex values, especially when dealing with sparse matrices, leading to inaccuracies. The fractional_matrix_power method effectively resolves this issue, ensuring accurate computations without generating large complex values.
Replaced
linalg.sqrtm
withlinalg.fractional_matrix_power
to prevent numerical errors when computing the square root of sparse matrices. The previous method was causing very large complex values, especially when dealing with sparse matrices, leading to inaccuracies. Thefractional_matrix_power
method effectively resolves this issue, ensuring accurate computations without generating large complex values.