-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
preconditioning #7
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great, thanks for adding this! I think it might make sense to also add a preconditioned version of the transition matrix A to complete this PR?
Hm.... should they both be using the same preconditioner? and also should both functions compute the preconditioner? transition_matrix_and_cov_cholf_1d
transition_matrix_and_cov_cholf_precond_1d |
This is what the "Stable Implementation ..." paper does at least.
Probably not as that would lead to duplication? So maybe either have one function for A, Q, P each, or as you suggest one function that computes both the transition matrix and covariance. I don't know what the best version is; I think that personally in ProbNumDiffEq.jl I would still use my own preconditioner implementation (here) to update them in-place at each step, so for me it would not matter too much which you choose. |
So maybe the way to go is to have functions precond
transition_matrix_precond_1d
cov_cholf_precond_1d where the latter two only return preconditioned matrices, the correct matrices can then be obtained by multiplying with precond(ndiff, dt, ReverseTaylor()) |> Diagonal |
A slight problem with the above of course is that the routines dont know with eltype to use for the arrays. transition_matrix_precond_1d(ndiff::Integer, T, ::ReverseTaylor)
transition_cov_cholf_precond_1d(ndiff::Integer, T, ::ReverseTaylor) where |
src/iwp.jl
Outdated
@@ -82,6 +82,20 @@ function _transition_matrix_1d(ndiff::Integer, dt::T, ::ReverseTaylor) where {T< | |||
end | |||
|
|||
|
|||
precond(ndiff::Integer, dt::Real, ::ReverseTaylor) = @. sqrt(dt) * dt^(0:ndiff) / factorial(0:ndiff) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there a particular reason for why this doesn't output a Diagonal
directly? Then all the functiosns return matrices.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We could certainly return a Diagonal matrix instead. But now, weekend.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@nathanaelbosch fine now?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me! I think the implementation could be made slightly more efficient, at least from what I recall I replaced some parts to compute products cumulatively instead of calling factorial and things like that, but the result is much less readable, so I'd say this is perfectly fine :) Thanks a lot!
add preconditoned version of cholesky computation as per feature request.