README.md

Mon, 30 Mar 2020 16:46:47 -0500

author
Tuomo Valkonen <tuomov@iki.fi>
date
Mon, 30 Mar 2020 16:46:47 -0500
changeset 11
762e20b8a343
child 12
0a72b8aec56a
permissions
-rw-r--r--

Added README.md


# Algorithm tools for Julia

Author: Tuomo Valkonen <tuomov@iki.fi>

This repository contains some general utility routines and tools for doing
iterative algorithms in Julia:

  * Tools to facilitate working with `Channel`s
  * Linked lists and writing them to log files.
  * Structs: iteration, field replacement
  * Calculation of norms, dot products, projections
  * Conditional thread execution macros
  * Template for conveniently writing iterative algorithms using `do`-block anonymous functions as algorithm steps, with visualisation/verbosity implemented generally in iterator. 

  The code is used, for example, by <http://dx.doi.org/10.5281/zenodo.3659180>.

## Iterative algorithms example

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:

```julia
using AlgTools.Iterate

params = (verbose_iter = 10, maxiter = 100,)

begin
    local x = 1
    simple_iterate(params) do verbose
        # This is our computational step, as an anonymous
        # `do`-block function. It has one parameter: `verbose`,
        # itself a function.
        x = x + √x
        verbose() do
            # This is another anonymous function that will
            # only get called when decided by `verbose`.
            # If we do get called, return current value
            return x, nothing
        end
    end
end
```
This will output
```
10/100 J=31.051164
20/100 J=108.493699
30/100 J=234.690039
40/100 J=410.056327
50/100 J=634.799262
60/100 J=909.042928
70/100 J=1232.870172
80/100 J=1606.340254
90/100 J=2029.497673
100/100 J=2502.377071
```

mercurial