-
Notifications
You must be signed in to change notification settings - Fork 3
Open
Description
Currently a managed iteration takes the form:
function managed_iteration!{T<:AbstractArray}(f!::Base.Callable,
mgr::IterationManager,
dest::T,
istate::IterationState{T};
by::Base.Callable=default_by)
pre_hook(mgr, istate)
while !(finished(mgr, istate))
f!(dest, istate.prev)
update!(istate, dest; by=by)
iter_hook(mgr, istate)
end
post_hook(mgr, istate)
istate
end
but I think it will be more general if the dest
and f!(dest, istate.prev)
happen inside the update!
call. I may not have a single parameter vector that I want to update in this fashion, and it may be non-trivial or inefficient to make a f!
method of this form.
My proposal:
function managed_iteration!(mgr::IterationManager, istate::IterationState)
pre_hook(mgr, istate)
while !(finished(mgr, istate))
update!(mgr, istate)
iter_hook(mgr, istate)
end
post_hook(mgr, istate)
istate
end
We can add convenience managers/states to reproduce the same form above, but the core loop is more general. Also, we can just have both forms and let multiple dispatch work.
Metadata
Metadata
Assignees
Labels
No labels