You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I rewrote the readme to give a bit of a cleaner look, and then did a big
(LLM-assisted this time) review of the language to get rid of some
remaining typos and inconsistencies.
I think I'd be happy to register after this :)
A first approach to algorithms is a simple for-loop for a maximum number of iterations.
26
-
Using an interface instead allows to both specify different criteria to stop easily, even in their combination.
27
-
Furthermore a generic interface allows to both “hook into” an algorithm easily as well as combining them.
28
-
29
-
A common interface for algorithms allows to reuse common code – especially stopping criteria, but especially also logging, debug, recording, and caching capabilities.
30
-
Finally, a common interface also allows to easily combine existing algorithms, hence enhancing interoperability, for example using one algorithm as a sub routine of another one.
31
-
32
-
# Main features
33
-
34
-
See the [initial discussion](https://github.com/JuliaManifolds/AlgorithmsInterface.jl/discussions/1)
35
-
as well as the [overview on existing things](https://github.com/JuliaManifolds/AlgorithmsInterface.jl/discussions/2)
@@ -405,9 +405,9 @@ function AlgorithmsInterface.step!(problem::SqrtProblem, algorithm::HeronAlgorit
405
405
# Suppose we check for numerical issues
406
406
if !isfinite(state.iterate) || mod(state.iteration, 10) == 0
407
407
emit_message(problem, algorithm, state, :Restart)
408
-
state.iterate = rand() # Reset the iterate an try again
408
+
state.iterate = rand() # Reset the iterate and try again
409
409
end
410
-
410
+
411
411
# Normal step
412
412
S = problem.S
413
413
x = state.iterate
@@ -438,7 +438,7 @@ nothing # hide
438
438
439
439
### Performance considerations
440
440
441
-
* Logging actions may be fast or slow, since the overhead is only incurred when actually using them.
441
+
* Logging actions can be as fast or slow as needed; the overhead is only incurred when they are actually used.
442
442
* Algorithms should be mindful of emitting events in hot loops. These events incur an overhead similar to accessing a `ScopedValue` (~10-100 ns), even when no logging action is registered.
443
443
* For expensive operations (plotting, I/O), it is often better to collect data during iteration and process afterward.
444
444
* Use `set_global_logging_state!(false)` for production benchmarks.
@@ -466,18 +466,18 @@ When designing custom logging contexts for your algorithms:
466
466
Implementing logging involves three main components:
467
467
468
468
1.**LoggingAction**: Define what happens when a logging event occurs.
469
-
- Use `CallbackAction` for quick inline functions.
470
-
- Implement custom subtypes for reusable, stateful logging.
* Document custom contexts in your algorithm's documentation.
480
+
* Use descriptive symbol names.
481
481
482
482
The logging system is designed for composability and zero-overhead when disabled, letting you instrument algorithms without compromising performance or code clarity.
Copy file name to clipboardExpand all lines: docs/src/stopping_criterion.md
+21-21Lines changed: 21 additions & 21 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -27,7 +27,7 @@ The package ships several concrete [`StoppingCriterion`](@ref)s:
27
27
28
28
Each criterion has an associated [`StoppingCriterionState`](@ref) storing dynamic data (iteration when met, elapsed time, etc.).
29
29
30
-
Recall our [example implementation](@ref sec_heron) for Heron's method, where we we added a `stopping_criterion` to the `Algorithm`, as well as a `stopping_criterion_state` to the `State`.
30
+
Recall our [example implementation](@ref sec_heron) for Heron's method, where we added a `stopping_criterion` to the `Algorithm`, as well as a `stopping_criterion_state` to the `State`.
0 commit comments