Skip to content

Update arnoldi.jl to include a reorthogonalisation option - #262

Open
cneverett wants to merge 4 commits into
SciML:masterfrom
cneverett:patch-1
Open

cneverett wants to merge 4 commits into
SciML:masterfrom
cneverett:patch-1

Conversation

@cneverett

@cneverett cneverett commented Jul 28, 2026 •

Copy link
Copy Markdown

Added an option to reorthogonalise (reorth) each basis vector during its construction in arnoldi!. This helps numerical roundoff from leading to poor basis orthogonalisation, even with a modified Gram-Schmidt procedure, especially when the Krylov subspace dimension is large. This can lead to better stability and smaller errors for large, highly stiff, non-normal systems.

This is my first time contributing to SciML, so I am not familiar with the format of pull requests. This pull request only adds a small feature and I have updated the function documentation to include it. I am not sure if it needs any specific tests.

Checklist

  • Appropriate tests were added
  • Any code changes were done in a way that does not break public API
  • All documentation related to code changes were updated
  • The new code follows the
    contributor guidelines, in particular the SciML Style Guide and
    COLPRAC.
  • Any new documentation only uses public API

Additional context

Add any other context about the problem here.

Added an option to reorthogonalise (`reorth`) each basis vector during its construction in `arnoldi!`. This helps numerical roundoff from leading to poor basis orthogonalisation, especially when the Krylov subspace dimension is large.
@ChrisRackauckas

Copy link
Copy Markdown
Member

Do you have a test case where this was shown to be a tangible improvement?

@cneverett

Copy link
Copy Markdown
Author

Unfortunately I don't have a simple test case that shows the improvement. I have been developing a modified version of arnoldi! to work with very large systems that I have been modelling (stiff, non-normal Jacobians of size around 10^4x10^4 needing Krylov dimensions of around 256 to captures dynamics accurately) and I doing so I have found that adding in this simple re-orthogonalisation process does help reduce the errest of functions like phiv! used for time stepping and reduce noise in the output results.

I can try to come up with a simple test-case to demonstrate these findings but it will take time. Or I could use the systems I am currently modelling and show some outputs with and without this re-orthogonalisation?

@ChrisRackauckas

Copy link
Copy Markdown
Member

Tests fail.

This should get at least one test exercising it.

`reorth` now a kwarg to `arnoldi_step!` set by default to `false` to avoid downstream breaking of functions
@cneverett

Copy link
Copy Markdown
Author

I have now made reorth a kwarg in arnoldi_step! (set to false by default) so it shouldn't break downstream tests by changing the number of arguments.

I will come up with at least one test demonstrating the difference, which will take a little time.

cneverett and others added 2 commits October 6, 2026 14:54
…rove orthogonalisation of V matrix in cases of high stiffness or non-normal A matrices
@cneverett
cneverett marked this pull request as draft October 6, 2026 15:08
@cneverett

Copy link
Copy Markdown
Author

Apologies for the delay, other work had to take priority.

I have added a very simple test that demonstrates the use of this reorth option by considering norm(V' * V - I) where V is generated with and without reorth for the same A matrix that is non-normal and stiff. Without re-orthogonalisation the orthonormality of the vectors in V is only at around 1e-8, where as with re-orthogonalisation this drops to near machine precision for Float64. I also added a check that the first vectors in V for both cases are identical as these vectors should not be affected by this process.

@cneverett
cneverett marked this pull request as ready for review October 6, 2026 15:13

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants