-
Notifications
You must be signed in to change notification settings - Fork 4
/
base.jl
97 lines (74 loc) · 2.39 KB
/
base.jl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
"""
Definition of continuation problem.
Numerical continuation algorithms find curves in ``\\mathbb R^{N}``
implicitly defined by
```math
H(u) = 0
```
where ``H: \\mathbb R^{N} \\to \\mathbb R^{N-1}``.
A continuation problem type (a subtype of
`AbstractContinuationProblem`) defines problems for such algorithms to
solve by providing how to compute:
* ``H(u)``: [`residual`](@ref), [`residual!`](@ref)
* its derivative ``\\partial H / \\partial u``: [`residual_jacobian!`](@ref)
* an initial guess ``u_0``: [`get_u0`](@ref)
* and computation cache: [`get_prob_cache`](@ref).
"""
abstract type AbstractContinuationProblem end
"""
Cache for computing ``H`` and its Jacobian.
"""
abstract type AbstractProblemCache{P} end
"""
residual(u, cache) ↦ H
Compute ``H(u) \\in \\mathbb R^{N - 1}`` (aka in-place computation).
The definition of ``H`` is specified by `cache`.
The name `residual` of the function is came from the problem we are to
solve: i.e., find the set of ``u`` such that ``H(u) = 0``. Thus, the
vector returned by `residual(u, cache)` is considered to be a
residual.
# Arguments
- `u::AbstractVector` (size: `(N,)`)
- `cache::AbstractProblemCache`
"""
function residual end
"""
residual!(H, u, cache) ↦ H
Compute ``H(u) \\in \\mathbb R^{N - 1}`` and store the result in `H`
(aka out-of-place computation).
The definition of ``H`` is specified by `cache`.
See also: [`residual`](@ref)
# Arguments
- `H::AbstractVector` (size: `(N - 1,)`)
- `u::AbstractVector` (size: `(N,)`)
- `cache::AbstractProblemCache`
"""
function residual! end
"""
residual_jacobian!(H, J, u, cache) ↦ (H, J)
Compute ``H(u)`` and its Jacobian ``\\partial H / \\partial u``.
# Arguments
- `H::AbstractVector` (size: `(N - 1,)`) ``= H(u)``
- `J::AbstractMatrix` (size: `(N - 1, N)`) ``= \\partial H / \\partial u``
- `u::AbstractVector` (size: `(N,)`)
- `cache::AbstractProblemCache`
"""
function residual_jacobian! end
"""
isindomain(u, cache) :: Bool
# Arguments
- `u::AbstractVector` (size: `(N,)`)
- `cache::AbstractProblemCache`
"""
function isindomain end
"""
get_prob_cache(prob::AbstractContinuationProblem) :: AbstractProblemCache
"""
function get_prob_cache end
# TODO: Rename AbstractProblemCache to ProblemCache and use it instead
# of get_prob_cache.
"""
get_u0(prob::AbstractContinuationProblem) ↦ u0
"""
function get_u0 end
abstract type AbstractContinuationCache{PC <: AbstractProblemCache} end