Skip to content

Commit 6ac3aba

Browse files
committed
Remaining documentation
1 parent b366170 commit 6ac3aba

File tree

10 files changed

+144
-28
lines changed

10 files changed

+144
-28
lines changed

.github/workflows/CI.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@ jobs:
2828
os:
2929
- ubuntu-latest
3030
- macos-latest
31-
- windows-latest
3231
steps:
3332
- uses: actions/checkout@v4
3433
- uses: julia-actions/setup-julia@v1

.github/workflows/CI_Windows.yml

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
name: CI Windows
2+
on:
3+
pull_request:
4+
branches:
5+
- master
6+
push:
7+
branches:
8+
- master
9+
concurrency:
10+
# Skip intermediate builds: always.
11+
# Cancel intermediate builds: only if it is a pull request build.
12+
group: ${{ github.workflow }}-${{ github.ref }}
13+
cancel-in-progress: ${{ startsWith(github.ref, 'refs/pull/') }}
14+
jobs:
15+
test:
16+
runs-on: ${{ matrix.os }}
17+
strategy:
18+
fail-fast: false
19+
matrix:
20+
group:
21+
- RootFinding
22+
- NLLSSolvers
23+
- 23TestProblems
24+
- Wrappers
25+
- Miscellaneous
26+
version:
27+
- '1.10'
28+
os:
29+
- windows-latest
30+
steps:
31+
- uses: actions/checkout@v4
32+
- uses: julia-actions/setup-julia@v1
33+
with:
34+
version: ${{ matrix.version }}
35+
- uses: actions/cache@v3
36+
env:
37+
cache-name: cache-artifacts
38+
with:
39+
path: ~/.julia/artifacts
40+
key: ${{ runner.os }}-test-${{ env.cache-name }}-${{ hashFiles('**/Project.toml') }}
41+
restore-keys: |
42+
${{ runner.os }}-test-${{ env.cache-name }}-
43+
${{ runner.os }}-test-
44+
${{ runner.os }}-
45+
- uses: julia-actions/julia-buildpkg@v1
46+
- uses: julia-actions/julia-runtest@v1
47+
env:
48+
GROUP: ${{ matrix.group }}
49+
JULIA_NUM_THREADS: 11
50+
- uses: julia-actions/julia-processcoverage@v1
51+
with:
52+
directories: src,ext
53+
- uses: codecov/codecov-action@v3
54+
with:
55+
file: lcov.info

docs/make.jl

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,9 @@ makedocs(; sitename = "NonlinearSolve.jl",
1515
authors = "Chris Rackauckas",
1616
modules = [NonlinearSolve, SimpleNonlinearSolve, SteadyStateDiffEq, Sundials,
1717
DiffEqBase, SciMLBase],
18-
clean = true, doctest = false,
19-
# linkcheck = true,
20-
draft = true, ## FIXME: REMOVE
18+
clean = true, doctest = false, linkcheck = true,
2119
linkcheck_ignore = ["https://twitter.com/ChrisRackauckas/status/1544743542094020615"],
22-
# checkdocs = :export,
23-
warnonly = true,
24-
plugins = [bib],
20+
checkdocs = :exports, warnonly = false, plugins = [bib],
2521
format = Documenter.HTML(assets = ["assets/favicon.ico", "assets/citations.css"],
2622
canonical = "https://docs.sciml.ai/NonlinearSolve/stable/"),
2723
pages)

docs/src/devdocs/algorithm_helpers.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ NonlinearSolve.LevenbergMarquardtTrustRegion
5757
NonlinearSolve.GenericTrustRegionScheme
5858
```
5959

60-
## Miscelleneous
60+
## Miscellaneous
6161

6262
```@docs
6363
SimpleNonlinearSolve.__nextfloat_tdir

src/abstract_types.jl

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -250,8 +250,7 @@ Abstract Type for the Caches created by AbstractDampingFunctions
250250
- `requires_normal_form_rhs(f)`: whether or not the residual is needed in normal form.
251251
No default.
252252
- `returns_norm_form_damping(f)`: whether or not the damping function returns the
253-
damping factor in normal form. Defaults to `requires_normal_form_jacobian(f) ||
254-
requires_normal_form_rhs(f)`.
253+
damping factor in normal form. Defaults to `requires_normal_form_jacobian(f) || requires_normal_form_rhs(f)`.
255254
- `(cache::AbstractDampingFunctionCache)(::Nothing)`: returns the damping factor. The type
256255
of the damping factor returned from `solve!` is guaranteed to be the same as this.
257256
@@ -315,8 +314,8 @@ Abstract Type for all Jacobian Initialization Algorithms used in NonlinearSolve.
315314
316315
```julia
317316
SciMLBase.init(prob::AbstractNonlinearProblem, alg::AbstractJacobianInitialization,
318-
solver, f::F, fu, u, p; linsolve = missing, internalnorm::IN = DEFAULT_NORM,
319-
kwargs...)
317+
solver, f::F, fu, u, p; linsolve = missing, internalnorm::IN = DEFAULT_NORM,
318+
kwargs...)
320319
```
321320
322321
Returns a [`NonlinearSolve.InitializedApproximateJacobianCache`](@ref).
@@ -366,13 +365,13 @@ Abstract Type for all Approximate Jacobian Update Rule Caches used in NonlinearS
366365
367366
### Interface Functions
368367
369-
- `store_inverse_jacobian(alg)`: Return `INV`
368+
- `store_inverse_jacobian(alg)`: Return `INV`
370369
371370
### `SciMLBase.solve!` specification
372371
373372
```julia
374373
SciMLBase.solve!(cache::AbstractApproximateJacobianUpdateRuleCache, J, fu, u, du;
375-
kwargs...) --> J or J⁻¹
374+
kwargs...) --> J / J⁻¹
376375
```
377376
"""
378377
abstract type AbstractApproximateJacobianUpdateRuleCache{INV} end

src/core/approximate_jacobian.jl

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,28 @@
1+
"""
2+
ApproximateJacobianSolveAlgorithm{concrete_jac, name}(; linesearch = missing,
3+
trustregion = missing, descent, update_rule, reinit_rule, initialization,
4+
max_resets::Int = typemax(Int), max_shrink_times::Int = typemax(Int))
5+
ApproximateJacobianSolveAlgorithm(; concrete_jac = nothing,
6+
name::Symbol = :unknown, kwargs...)
7+
8+
Nonlinear Solve Algorithms using an Iterative Approximation of the Jacobian. Most common
9+
examples include [`Broyden`](@ref)'s Method.
10+
11+
### Keyword Arguments
12+
13+
- `trustregion`: Globalization using a Trust Region Method. This needs to follow the
14+
[`NonlinearSolve.AbstractNonlinearSolveTrustRegionAlgorithm`](@ref) interface.
15+
- `descent`: The descent method to use to compute the step. This needs to follow the
16+
[`NonlinearSolve.AbstractDescentAlgorithm`](@ref) interface.
17+
- `max_shrink_times`: The maximum number of times the trust region radius can be shrunk
18+
before the algorithm terminates.
19+
- `update_rule`: The update rule to use to update the Jacobian. This needs to follow the
20+
[`NonlinearSolve.AbstractApproximateJacobianUpdateRule`](@ref) interface.
21+
- `reinit_rule`: The reinitialization rule to use to reinitialize the Jacobian. This
22+
needs to follow the [`NonlinearSolve.AbstractResetCondition`](@ref) interface.
23+
- `initialization`: The initialization method to use to initialize the Jacobian. This
24+
needs to follow the [`NonlinearSolve.AbstractJacobianInitialization`](@ref) interface.
25+
"""
126
@concrete struct ApproximateJacobianSolveAlgorithm{concrete_jac, name} <:
227
AbstractNonlinearSolveAlgorithm{name}
328
linesearch

src/core/generalized_first_order.jl

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,27 @@
1+
"""
2+
GeneralizedFirstOrderAlgorithm{concrete_jac, name}(; descent, linesearch = missing,
3+
trustregion = missing, jacobian_ad = nothing, forward_ad = nothing,
4+
reverse_ad = nothing, max_shrink_times::Int = typemax(Int))
5+
GeneralizedFirstOrderAlgorithm(; concrete_jac = nothing, name::Symbol = :unknown,
6+
kwargs...)
7+
8+
This is a Generalization of First-Order (uses Jacobian) Nonlinear Solve Algorithms. The most
9+
common example of this is Newton-Raphson Method.
10+
11+
First Order here refers to the order of differentiation, and should not be confused with the
12+
order of convergence.
13+
14+
`trustregion` and `linesearch` cannot be specified together.
15+
16+
### Keyword Arguments
17+
18+
- `trustregion`: Globalization using a Trust Region Method. This needs to follow the
19+
[`NonlinearSolve.AbstractNonlinearSolveTrustRegionAlgorithm`](@ref) interface.
20+
- `descent`: The descent method to use to compute the step. This needs to follow the
21+
[`NonlinearSolve.AbstractDescentAlgorithm`](@ref) interface.
22+
- `max_shrink_times`: The maximum number of times the trust region radius can be shrunk
23+
before the algorithm terminates.
24+
"""
125
@concrete struct GeneralizedFirstOrderAlgorithm{concrete_jac, name} <:
226
AbstractNonlinearSolveAlgorithm{name}
327
linesearch

src/core/spectral_methods.jl

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,24 @@
11
# For spectral methods we currently only implement DF-SANE since after reading through
22
# papers, this seems to be the only one that is widely used. If we have a list of more
33
# papers we can see what is the right level of abstraction to implement here
4+
"""
5+
GeneralizedDFSane{name}(linesearch, σ_min, σ_max, σ_1)
6+
7+
A generalized version of the DF-SANE algorithm. This algorithm is a Jacobian-Free Spectral
8+
Method.
9+
10+
### Arguments
11+
12+
- `linesearch`: Globalization using a Line Search Method. This needs to follow the
13+
[`NonlinearSolve.AbstractNonlinearSolveLineSearchAlgorithm`](@ref) interface. This
14+
is not optional currently, but that restriction might be lifted in the future.
15+
- `σ_min`: The minimum spectral parameter allowed. This is used to ensure that the
16+
spectral parameter is not too small.
17+
- `σ_max`: The maximum spectral parameter allowed. This is used to ensure that the
18+
spectral parameter is not too large.
19+
- `σ_1`: The initial spectral parameter. If this is not provided, then the algorithm
20+
initializes it as `σ_1 = <u, u> / <u, f(u)>`.
21+
"""
422
@concrete struct GeneralizedDFSane{name} <: AbstractNonlinearSolveAlgorithm{name}
523
linesearch
624
σ_min

src/internal/approximate_initialization.jl

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ end
135135
TrueJacobianInitialization(structure, autodiff)
136136
137137
Initialize the Jacobian to be the true Jacobian and maintain the structure as specified
138-
by `structure`. `autodiff` is used to compute the true Jacobian and if not specied we
138+
by `structure`. `autodiff` is used to compute the true Jacobian and if not specified we
139139
make a selection automatically.
140140
"""
141141
@concrete struct TrueJacobianInitialization <: AbstractJacobianInitialization
@@ -162,12 +162,12 @@ A cache for Approximate Jacobian.
162162
163163
### Arguments
164164
165-
* `J`: The current Jacobian.
166-
* `structure`: The structure of the Jacobian.
167-
* `alg`: The initialization algorithm.
168-
* `cache`: The Jacobian cache [`NonlinearSolve.JacobianCache`](@ref) (if needed).
169-
* `initialized`: A boolean indicating whether the Jacobian has been initialized.
170-
* `internalnorm`: The norm to be used.
165+
- `J`: The current Jacobian.
166+
- `structure`: The structure of the Jacobian.
167+
- `alg`: The initialization algorithm.
168+
- `cache`: The Jacobian cache [`NonlinearSolve.JacobianCache`](@ref) (if needed).
169+
- `initialized`: A boolean indicating whether the Jacobian has been initialized.
170+
- `internalnorm`: The norm to be used.
171171
172172
### Interface
173173

src/internal/linear_solve.jl

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,12 @@ import LinearSolve: AbstractFactorization, DefaultAlgorithmChoice, DefaultLinear
66
Construct a cache for solving linear systems of the form `A * u = b`. Following cases are
77
handled:
88
9-
1. `A` is Number, then we solve it with `u = b / A`
10-
2. `A` is `SMatrix`, then we solve it with `u = A \\ b` (using the defaults from base
11-
Julia)
12-
3. `A` is `Diagonal`, then we solve it with `u = b ./ A.diag`
13-
4. In all other cases, we use `alg` to solve the linear system using
14-
[LinearSolve.jl](https://github.com/SciML/LinearSolve.jl).
9+
1. `A` is Number, then we solve it with `u = b / A`
10+
2. `A` is `SMatrix`, then we solve it with `u = A \\ b` (using the defaults from base
11+
Julia)
12+
3. `A` is `Diagonal`, then we solve it with `u = b ./ A.diag`
13+
4. In all other cases, we use `alg` to solve the linear system using
14+
[LinearSolve.jl](https://github.com/SciML/LinearSolve.jl).
1515
1616
### Solving the System
1717
@@ -25,7 +25,7 @@ Returns the solution of the system `u` and stores the updated cache in `cache.li
2525
2626
#### Keyword Arguments
2727
28-
* `reuse_A_if_factorization`: If `true`, then the factorization of `A` is reused if
28+
- `reuse_A_if_factorization`: If `true`, then the factorization of `A` is reused if
2929
possible. This is useful when solving the same system with different `b` values.
3030
If the algorithm is an iterative solver, then we reset the internal linear solve cache.
3131

0 commit comments

Comments
 (0)