-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Modify alternating update kwarg naming, structure, and also solver_in…
…terface.
- Loading branch information
Showing
5 changed files
with
188 additions
and
171 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,43 +1,47 @@ | ||
function exponentiate_solver() | ||
function solver( | ||
function exponentiate_updater( | ||
init; | ||
psi_ref!, | ||
PH_ref!, | ||
outputlevel, | ||
which_sweep, # keep, change name | ||
region_updates, | ||
which_region_update, | ||
region_kwargs, # region_kwargs (timestep for solver) | ||
updater_kwargs, | ||
) | ||
default_updater_kwargs=(; | ||
krylovdim=30, #from here only solver kwargs | ||
maxiter=100, | ||
outputlevel=0, | ||
tol=1E-12, | ||
ishermitian=true, | ||
issymmetric=true, | ||
region, | ||
sweep_regions, | ||
sweep_step, | ||
solver_krylovdim=30, | ||
solver_maxiter=100, | ||
solver_outputlevel=0, | ||
solver_tol=1E-12, | ||
substep, | ||
normalize, | ||
time_step, | ||
) | ||
eager=true | ||
) | ||
updater_kwargs=merge(default_updater_kwargs,updater_kwargs) #last collection has precedence | ||
#H=copy(PH_ref![]) | ||
H = PH_ref![] ###since we are not changing H we don't need the copy | ||
# let's test whether given region and sweep regions we can find out what the previous and next region were | ||
# this will be needed in subspace expansion | ||
region_ind = sweep_step | ||
next_region = | ||
region_ind == length(sweep_regions) ? nothing : first(sweep_regions[region_ind + 1]) | ||
previous_region = region_ind == 1 ? nothing : first(sweep_regions[region_ind - 1]) | ||
#@show step_kwargs | ||
substep=get(region_kwargs,:substep,nothing) | ||
time_step=get(region_kwargs,:time_step,nothing) | ||
@assert !isnothing(time_step) && !isnothing(substep) | ||
region_ind = which_region_update | ||
next_region = region_ind == length(region_updates) ? nothing : first(region_updates[region_ind + 1]) | ||
previous_region = region_ind == 1 ? nothing : first(region_updates[region_ind - 1]) | ||
|
||
phi, exp_info = KrylovKit.exponentiate( | ||
H, | ||
time_step, | ||
init; | ||
ishermitian, | ||
issymmetric, | ||
tol=solver_tol, | ||
krylovdim=solver_krylovdim, | ||
maxiter=solver_maxiter, | ||
verbosity=solver_outputlevel, | ||
eager=true, | ||
ishermitian=updater_kwargs[:ishermitian], | ||
issymmetric=updater_kwargs[:issymmetric], | ||
tol=updater_kwargs[:tol], | ||
krylovdim=updater_kwargs[:krylovdim], | ||
maxiter=updater_kwargs[:maxiter], | ||
verbosity=updater_kwargs[:outputlevel], | ||
eager=updater_kwargs[:eager], | ||
) | ||
return phi, (; info=exp_info) | ||
end | ||
return solver | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.