We currently used minres as the default solver in sparse_generic_solve:
|
# ---------- default solvers ---------- |
|
if solve is None and transpose_solve is None: |
|
from .utils import minres |
|
|
|
solve = minres |
|
transpose_solve = minres |
|
elif solve is None: |
|
solve = transpose_solve |
|
elif transpose_solve is None: |
|
transpose_solve = solve |
While this makes sense for symmetric matrices and is documented, it may be confusing for new users who may expect sparse_generic_solve to mostly work out of the box even for non-symmetric matrices. Switching to BiCGSTAB would lead to a more intuitive behaviour.
Users who know their matrix is symmetric can always make the choice to specify a more specific solver such as minres. If we want to simplify that path, we can also create another thin wrapper along the lines of:
def sparse_generic_symmetric_solve(
A: torch.Tensor,
B: torch.Tensor,
solve: Optional[Callable[..., torch.Tensor]] = None,
**kwargs,
) -> torch.Tensor:
# ---------- default solvers ----------
if solve is None
from .utils import minres
solve = minres
return sparse_generic_solve(A, B, solve=solve, transpose_solve=solve, **kwargs)
We currently used minres as the default solver in
sparse_generic_solve:torchsparsegradutils/torchsparsegradutils/sparse_solve.py
Lines 407 to 416 in efa515c
While this makes sense for symmetric matrices and is documented, it may be confusing for new users who may expect
sparse_generic_solveto mostly work out of the box even for non-symmetric matrices. Switching to BiCGSTAB would lead to a more intuitive behaviour.Users who know their matrix is symmetric can always make the choice to specify a more specific solver such as minres. If we want to simplify that path, we can also create another thin wrapper along the lines of: