(x)
| 133 | """Create LinearOperator implicitly acting as a sparse matrix inverse.""" |
| 134 | splu = spla.splu(matrix.tocsc(), permc_spec=permc_spec, **kw) |
| 135 | def solve(x): |
| 136 | if np.iscomplexobj(x) and matrix.dtype == np.float64: |
| 137 | return splu.solve(x.real) + 1j*splu.solve(x.imag) |
| 138 | else: |
| 139 | return splu.solve(x) |
| 140 | return spla.LinearOperator(shape=matrix.shape, dtype=matrix.dtype, matvec=solve, matmat=solve) |
| 141 | |
| 142 |