Skip to content
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

Time-stepping Krylov: special case for expv_timestep #378

Merged
merged 1 commit into from Jun 11, 2018
Merged

Time-stepping Krylov: special case for expv_timestep #378

merged 1 commit into from Jun 11, 2018

Conversation

MSeeker1340
Copy link
Contributor

As suggested by @ChrisRackauckas, added a special case for phiv_timestep which calculates just the first term $exp(tA)*b$.

We can already do this using phiv_timestep(!) alone, but that requires using a n-by-1 matrix B, which is a bit unintuitive. expv_timestep(!) is basically a wrapper for phiv_timestep(!) that allows a vector b as input. (Internally it is reshaped to the n-by-1 matrix form).

I was initially a bit worried about doing extra work for the special case. After more carefully examining the code for updating the W matrix and u, I found that all the loops are no-ops for p == 0, so we're not losing performance here.

@ChrisRackauckas
Copy link
Member

I was initially a bit worried about doing extra work for the special case. After more carefully examining the code for updating the W matrix and u, I found that all the loops are no-ops for p == 0, so we're not losing performance here.

Great! Yes, most things should be no-ops. The only thing to be careful about is the interior expm! call. The Sidje algorithm in the case of just expv has the inner part simplify to just using exp, right? I assume that right now you're doing expm! on a 1x1 in expv_timestep? If that's the case, that's something to specialize on.

@MSeeker1340
Copy link
Contributor Author

The Sidje algorithm in the case of just expv has the inner part simplify to just using exp, right?

I see the misunderstanding here. The Sidje algorithm computes expm! on a (m + p) x (m + p) matrix where m is the Krylov subspace size and p is the highest order phi. Even for p=0 (that is, expv_timestep) we still need to compute expm! on the original m x m Heisenberg matrix H. So there's nothing to optimize/specialize here.

@ChrisRackauckas
Copy link
Member

oh perfect. Then yeah, this is good.

@ChrisRackauckas ChrisRackauckas merged commit cacf50b into SciML:master Jun 11, 2018
@MSeeker1340 MSeeker1340 deleted the krylov-expv-timestep branch June 11, 2018 17:13
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.

None yet

2 participants