Just a quick question. Does anyone know if it is possible to supply a seed for the iterative methods in LinearSolve?

I have a large sparse system, and even using some Krylov iterative solver, my estimate is Mathematica should take around 12 hours to find a solution. However, I have an idea of what the solution should look like, and I think I could speed up the process by supplying Mathematica with an accurate initial guess. Does anyone knows if there is an option for that? My current code looks like this:

SparseArray`KrylovLinearSolve[thisLHSOp, thisRHS, Method -> "GMRES", 
 Tolerance -> 10^ (-10), MaxIterations -> Automatic]

Any advice would be appreciated.

  • 2
    $\begingroup$ I wonder if you could use a pre-conditioner as a trick to provide your initial estimate (see mathematica.stackexchange.com/q/172337/27951). Im thinking of having a pre-conditioner function that provides your initial estimate when called for the first time, but that just "passes values through" afterwards. It would be helpful if you could provide (a reduced version of ) your system for us to play with. $\endgroup$
    – MarcoB
    Commented Oct 4, 2021 at 16:59
  • $\begingroup$ @MarcoB thank you, that is a great idea, I will have a look! My system is some chebyshev discretization of a PDE. The thisLHSOp is actually not an explicit matrix, but a linear operator I created to avoid storing the huge (dense) matrix in memory. I can try and make a toy version of it if you want to play around, but it is a bit messy $\endgroup$ Commented Oct 4, 2021 at 17:05
  • 5
    $\begingroup$ In the documentation to LinearSolve, there is a section devoted to Method -> "Krylov", therein can be found a "StartingVector" sub-option. $\endgroup$
    – yarchik
    Commented Oct 4, 2021 at 17:38
  • $\begingroup$ @yarchik thamk you so much, I completely missed that section! $\endgroup$ Commented Oct 4, 2021 at 17:47


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.