README.md

Fri, 03 May 2024 13:08:41 -0500

author
Tuomo Valkonen <tuomov@iki.fi>
date
Fri, 03 May 2024 13:08:41 -0500
changeset 32
d0134d0b8ed3
parent 20
8b80aa64adec
permissions
-rw-r--r--

Update manifest

11
762e20b8a343 Added README.md
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff changeset
1
13
f237f22e36d4 Change README title
Tuomo Valkonen <tuomov@iki.fi>
parents: 12
diff changeset
2 # AlgTools
11
762e20b8a343 Added README.md
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff changeset
3
762e20b8a343 Added README.md
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff changeset
4 Author: Tuomo Valkonen <tuomov@iki.fi>
762e20b8a343 Added README.md
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff changeset
5
762e20b8a343 Added README.md
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff changeset
6 This repository contains some general utility routines and tools for doing
762e20b8a343 Added README.md
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff changeset
7 iterative algorithms in Julia:
762e20b8a343 Added README.md
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff changeset
8
762e20b8a343 Added README.md
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff changeset
9 * Tools to facilitate working with `Channel`s
762e20b8a343 Added README.md
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff changeset
10 * Linked lists and writing them to log files.
762e20b8a343 Added README.md
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff changeset
11 * Structs: iteration, field replacement
762e20b8a343 Added README.md
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff changeset
12 * Calculation of norms, dot products, projections
762e20b8a343 Added README.md
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff changeset
13 * Conditional thread execution macros
12
0a72b8aec56a Installation instructions
Tuomo Valkonen <tuomov@iki.fi>
parents: 11
diff changeset
14 * Template for conveniently writing iterative algorithms using `do`-block anonymous functions as algorithm steps, with visualisation/verbosity implemented generally in iterator.
20
8b80aa64adec Add abstract LinOps
Tuomo Valkonen <tuomov@iki.fi>
parents: 17
diff changeset
15 * Abstract linear operators with arbitrary domains and codomains; `LinOp{X,Y}`.
11
762e20b8a343 Added README.md
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff changeset
16
14
adf8eb3a1df9 Link ImageTools
Tuomo Valkonen <tuomov@iki.fi>
parents: 13
diff changeset
17 The code is used by [ImageTools][] and both, for example, by <http://dx.doi.org/10.5281/zenodo.3659180>.
11
762e20b8a343 Added README.md
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff changeset
18
12
0a72b8aec56a Installation instructions
Tuomo Valkonen <tuomov@iki.fi>
parents: 11
diff changeset
19 ## Installation
0a72b8aec56a Installation instructions
Tuomo Valkonen <tuomov@iki.fi>
parents: 11
diff changeset
20
0a72b8aec56a Installation instructions
Tuomo Valkonen <tuomov@iki.fi>
parents: 11
diff changeset
21 To install this package, first clone the repository with [Mercurial](https://www.mercurial-scm.org/):
0a72b8aec56a Installation instructions
Tuomo Valkonen <tuomov@iki.fi>
parents: 11
diff changeset
22
0a72b8aec56a Installation instructions
Tuomo Valkonen <tuomov@iki.fi>
parents: 11
diff changeset
23 ```console
0a72b8aec56a Installation instructions
Tuomo Valkonen <tuomov@iki.fi>
parents: 11
diff changeset
24 $ hg clone https://tuomov.iki.fi/repos/AlgTools/
0a72b8aec56a Installation instructions
Tuomo Valkonen <tuomov@iki.fi>
parents: 11
diff changeset
25 ```
0a72b8aec56a Installation instructions
Tuomo Valkonen <tuomov@iki.fi>
parents: 11
diff changeset
26
0a72b8aec56a Installation instructions
Tuomo Valkonen <tuomov@iki.fi>
parents: 11
diff changeset
27 (Canonical public repository URL indicated here.)
0a72b8aec56a Installation instructions
Tuomo Valkonen <tuomov@iki.fi>
parents: 11
diff changeset
28 Then add the repository to Julia with `Pkg.develop`:
0a72b8aec56a Installation instructions
Tuomo Valkonen <tuomov@iki.fi>
parents: 11
diff changeset
29
0a72b8aec56a Installation instructions
Tuomo Valkonen <tuomov@iki.fi>
parents: 11
diff changeset
30 ```console
0a72b8aec56a Installation instructions
Tuomo Valkonen <tuomov@iki.fi>
parents: 11
diff changeset
31 julia>] develop LOCATION_OF/AlgTools/
0a72b8aec56a Installation instructions
Tuomo Valkonen <tuomov@iki.fi>
parents: 11
diff changeset
32 ```
0a72b8aec56a Installation instructions
Tuomo Valkonen <tuomov@iki.fi>
parents: 11
diff changeset
33
0a72b8aec56a Installation instructions
Tuomo Valkonen <tuomov@iki.fi>
parents: 11
diff changeset
34 Here replace `LOCATION_OF/AlgTools` with path where you cloned AlgTools. (If you did not change directory after cloning, simply use `AlgTools`.)
0a72b8aec56a Installation instructions
Tuomo Valkonen <tuomov@iki.fi>
parents: 11
diff changeset
35 Afterwards, you may use the package with:
0a72b8aec56a Installation instructions
Tuomo Valkonen <tuomov@iki.fi>
parents: 11
diff changeset
36
0a72b8aec56a Installation instructions
Tuomo Valkonen <tuomov@iki.fi>
parents: 11
diff changeset
37 ```console
0a72b8aec56a Installation instructions
Tuomo Valkonen <tuomov@iki.fi>
parents: 11
diff changeset
38 julia> using AlgTools
0a72b8aec56a Installation instructions
Tuomo Valkonen <tuomov@iki.fi>
parents: 11
diff changeset
39 ```
0a72b8aec56a Installation instructions
Tuomo Valkonen <tuomov@iki.fi>
parents: 11
diff changeset
40
0a72b8aec56a Installation instructions
Tuomo Valkonen <tuomov@iki.fi>
parents: 11
diff changeset
41 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.
0a72b8aec56a Installation instructions
Tuomo Valkonen <tuomov@iki.fi>
parents: 11
diff changeset
42
17
c4c2ab568324 Improve example in README
Tuomo Valkonen <tuomov@iki.fi>
parents: 14
diff changeset
43 ## Iterative algorithms in a functional fashion
c4c2ab568324 Improve example in README
Tuomo Valkonen <tuomov@iki.fi>
parents: 14
diff changeset
44
c4c2ab568324 Improve example in README
Tuomo Valkonen <tuomov@iki.fi>
parents: 14
diff changeset
45 The package includes `simple_iterate` which helps separating the computational step of iterative algorithms from visualisation and other reporting routines.
c4c2ab568324 Improve example in README
Tuomo Valkonen <tuomov@iki.fi>
parents: 14
diff changeset
46 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.
11
762e20b8a343 Added README.md
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff changeset
47
17
c4c2ab568324 Improve example in README
Tuomo Valkonen <tuomov@iki.fi>
parents: 14
diff changeset
48 The approach is heavily indebted to functional programming.
c4c2ab568324 Improve example in README
Tuomo Valkonen <tuomov@iki.fi>
parents: 14
diff changeset
49 The computational step is to be implemented as a `do`-block anonymous function.
c4c2ab568324 Improve example in README
Tuomo Valkonen <tuomov@iki.fi>
parents: 14
diff changeset
50 That function gets passed another function `verbose` as a parameter.
c4c2ab568324 Improve example in README
Tuomo Valkonen <tuomov@iki.fi>
parents: 14
diff changeset
51 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.
c4c2ab568324 Improve example in README
Tuomo Valkonen <tuomov@iki.fi>
parents: 14
diff changeset
52
c4c2ab568324 Improve example in README
Tuomo Valkonen <tuomov@iki.fi>
parents: 14
diff changeset
53 ### Simple example
11
762e20b8a343 Added README.md
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff changeset
54
762e20b8a343 Added README.md
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff changeset
55 ```julia
762e20b8a343 Added README.md
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff changeset
56 using AlgTools.Iterate
762e20b8a343 Added README.md
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff changeset
57
762e20b8a343 Added README.md
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff changeset
58 params = (verbose_iter = 10, maxiter = 100,)
762e20b8a343 Added README.md
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff changeset
59
762e20b8a343 Added README.md
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff changeset
60 begin
762e20b8a343 Added README.md
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff changeset
61 local x = 1
762e20b8a343 Added README.md
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff changeset
62 simple_iterate(params) do verbose
762e20b8a343 Added README.md
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff changeset
63 # This is our computational step, as an anonymous
762e20b8a343 Added README.md
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff changeset
64 # `do`-block function. It has one parameter: `verbose`,
762e20b8a343 Added README.md
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff changeset
65 # itself a function.
762e20b8a343 Added README.md
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff changeset
66 x = x + √x
762e20b8a343 Added README.md
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff changeset
67 verbose() do
762e20b8a343 Added README.md
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff changeset
68 # This is another anonymous function that will
762e20b8a343 Added README.md
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff changeset
69 # only get called when decided by `verbose`.
762e20b8a343 Added README.md
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff changeset
70 # If we do get called, return current value
762e20b8a343 Added README.md
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff changeset
71 return x, nothing
762e20b8a343 Added README.md
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff changeset
72 end
762e20b8a343 Added README.md
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff changeset
73 end
762e20b8a343 Added README.md
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff changeset
74 end
762e20b8a343 Added README.md
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff changeset
75 ```
762e20b8a343 Added README.md
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff changeset
76 This will output
762e20b8a343 Added README.md
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff changeset
77 ```
762e20b8a343 Added README.md
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff changeset
78 10/100 J=31.051164
762e20b8a343 Added README.md
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff changeset
79 20/100 J=108.493699
762e20b8a343 Added README.md
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff changeset
80 30/100 J=234.690039
762e20b8a343 Added README.md
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff changeset
81 40/100 J=410.056327
762e20b8a343 Added README.md
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff changeset
82 50/100 J=634.799262
762e20b8a343 Added README.md
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff changeset
83 60/100 J=909.042928
762e20b8a343 Added README.md
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff changeset
84 70/100 J=1232.870172
762e20b8a343 Added README.md
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff changeset
85 80/100 J=1606.340254
762e20b8a343 Added README.md
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff changeset
86 90/100 J=2029.497673
762e20b8a343 Added README.md
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff changeset
87 100/100 J=2502.377071
762e20b8a343 Added README.md
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff changeset
88 ```
762e20b8a343 Added README.md
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff changeset
89
14
adf8eb3a1df9 Link ImageTools
Tuomo Valkonen <tuomov@iki.fi>
parents: 13
diff changeset
90 [ImageTools]: https://tuomov.iki.fi/software/ImageTools/

mercurial