37 julia> using AlgTools |
37 julia> using AlgTools |
38 ``` |
38 ``` |
39 |
39 |
40 This package is not and is not planned to be available via `Pkg.add` as it is based on the worst and must unusable version control system ever invented: Git. |
40 This package is not and is not planned to be available via `Pkg.add` as it is based on the worst and must unusable version control system ever invented: Git. |
41 |
41 |
42 ## Iterative algorithms example |
42 ## Iterative algorithms in a functional fashion |
43 |
43 |
44 The package includes `simple_iterate` which helps separating the computational step of iterative algorithms for visualisation routines. It is merely intended to serve as a template, as different applications require different visualisation routines to be implemented in a replacement of `simple_iterate`. The computational step is implemented as a `do`-block anonymous function that gets passed another function is a parameter for doing the verbosity on request. Example: |
44 The package includes `simple_iterate` which helps separating the computational step of iterative algorithms from visualisation and other reporting routines. |
|
45 It is merely intended to serve as a template, as different applications require different visualisation routines to be implemented in a replacement of `simple_iterate`; in particular [ImageTools][] implements its own version. |
|
46 |
|
47 The approach is heavily indebted to functional programming. |
|
48 The computational step is to be implemented as a `do`-block anonymous function. |
|
49 That function gets passed another function `verbose` as a parameter. |
|
50 To (potentially) report the current status, the computational step only needs to call `verbose` with yet another function as a parameter. Whether the status is actually reported—and whether it needs to be calculated—is decided by `verbose`, and its parameter called as needed. |
|
51 |
|
52 ### Simple example |
45 |
53 |
46 ```julia |
54 ```julia |
47 using AlgTools.Iterate |
55 using AlgTools.Iterate |
48 |
56 |
49 params = (verbose_iter = 10, maxiter = 100,) |
57 params = (verbose_iter = 10, maxiter = 100,) |