def _matvec(self, x):
# careful here: splu.solve will throw away imaginary
# part of x if M is real
x = np.asarray(x)
if self.isreal and np.issubdtype(x.dtype, np.complexfloating):
return (self.M_lu.solve(np.real(x).astype(self.dtype)) +
1j * self.M_lu.solve(np.imag(x).astype(self.dtype)))
else:
return self.M_lu.solve(x.astype(self.dtype))
评论列表
文章目录