Skip to content

Incorporate initial guesses into residual for iterative solvers. #376

@shakedregev

Description

@shakedregev

Summary

We should have an option to add an initial guess (for iterative refinement or regular iterative solve).
If there is an initial guess $x$ to the solution of $Ax=b$, we can compute $r=b-Ax$.
We then solve $Ay=r$ and return $x+y$ as the solution.
An ideal implementation is one where we have the same function name and it can take either two arguments ($A,b$) or three ($A,b,x$). The first is the current implementation, and the second will add a wrapper that stores the initial guess, and add it to the solution obtained from solving $Ay=r$.

Rationale

Right now, when we use an iterative solver directly, we have no option of supplying an initial guess. When we use it for iterative refinement, we use an initial guess in a way that is less numerically accurate.

Description

Some features to make this complete:

  1. Check if $|b|_2</code>&lt;<code>|b-Ax|_2$. If it is, warn the user that their initial guess is worse than all 0s and ignore that initial guess.
  2. If a nonzero guess was supplied, check if $|b-Ax-Ay|_2</code>&gt;<code>|b-Ax|_2$. Note that the order of subtraction is important for the left side. If it is, warn the user that the iterative solver was not able to find a solution better than the initial guess, and output $x$ (not $x+y$). For iterative refinement, this corresponds to not improving upon the direct solve.

Additional information

No response

Metadata

Metadata

Assignees

Labels

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions