Open Joshuaalbert opened 2 months ago
Thanks for the report! So the tricky thing here is that jax.scipy.sparse.linalg.cg
implements the API of scipy.sparse.linalg.cg
, which has no explicit symmetric
flag. We could probably add an optional symmetric
argument to JAX's version that lets the user override the default. What do you think?
That sounds like a good solution.
It this a change you're interested in contributing?
@jakevdp I submitted #23486
Description
Instead of taking an explicit
symmetric
argument, which could be passed from user, or some auxillary information to determine the dtype of linear operator the RHS's dtype is used as a proxy for the dtype of the linear operator whencheck_symmetric=True
. However, it is entirely possible that implicit up-casting is expected by user, such that linear operator is real, but RHS is complex, or that linear operator is symmetric but complex, in both casesmatvec == vecmat
for positive definite linear operators. This could be a problem for some users ofjsp.solve_cg
.System info (python version, jaxlib version, accelerator, etc.)