Skip to content

Commit 3e808d1

Browse files
Merge pull request #221 from ArnoStrouwen/docs1
Documenter 1.0 upgrade.
2 parents 127e44b + ede7183 commit 3e808d1

File tree

12 files changed

+146
-89
lines changed

12 files changed

+146
-89
lines changed

.JuliaFormatter.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
style = "sciml"
2+
format_markdown = true

.github/workflows/CI.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,13 @@ on:
33
pull_request:
44
branches:
55
- master
6+
paths-ignore:
7+
- 'docs/**'
68
push:
79
branches:
810
- master
11+
paths-ignore:
12+
- 'docs/**'
913
jobs:
1014
test:
1115
runs-on: ubuntu-latest

.github/workflows/FormatCheck.yml

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
name: format-check
2+
3+
on:
4+
push:
5+
branches:
6+
- 'master'
7+
- 'release-'
8+
tags: '*'
9+
pull_request:
10+
11+
jobs:
12+
build:
13+
runs-on: ${{ matrix.os }}
14+
strategy:
15+
matrix:
16+
julia-version: [1]
17+
julia-arch: [x86]
18+
os: [ubuntu-latest]
19+
steps:
20+
- uses: julia-actions/setup-julia@latest
21+
with:
22+
version: ${{ matrix.julia-version }}
23+
24+
- uses: actions/checkout@v4
25+
- name: Install JuliaFormatter and format
26+
# This will use the latest version by default but you can set the version like so:
27+
#
28+
# julia -e 'using Pkg; Pkg.add(PackageSpec(name="JuliaFormatter", version="0.13.0"))'
29+
run: |
30+
julia -e 'using Pkg; Pkg.add(PackageSpec(name="JuliaFormatter"))'
31+
julia -e 'using JuliaFormatter; format(".", verbose=true)'
32+
- name: Format check
33+
run: |
34+
julia -e '
35+
out = Cmd(`git diff --name-only`) |> read |> String
36+
if out == ""
37+
exit(0)
38+
else
39+
@error "Some files have not been formatted !!!"
40+
write(stdout, out)
41+
exit(1)
42+
end'

docs/Project.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,5 @@ Documenter = "e30172f5-a6a5-5a46-863b-614d45cd2de4"
33
SciMLOperators = "c0aeaf25-5076-4817-a8d5-81caf7dfa961"
44

55
[compat]
6-
Documenter = "0.27"
6+
Documenter = "1"
77
SciMLOperators = "0.2, 0.3"

docs/make.jl

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,9 @@ makedocs(
99
sitename="SciMLOperators.jl",
1010
authors="Vedant Puri, Alex Jones, Chris Rackauckas",
1111
modules=[SciMLOperators],
12-
clean=true,doctest=false,
13-
format = Documenter.HTML(analytics = "UA-90474609-3",
12+
clean=true, doctest=false, linkcheck = true,
13+
warnonly = [:docs_block, :missing_docs, :cross_references, :linkcheck],
14+
format = Documenter.HTML(
1415
assets = ["assets/favicon.ico"],
1516
canonical="https://docs.sciml.ai/SciMLOperators/stable"),
1617
pages=pages

docs/src/index.md

Lines changed: 52 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -7,22 +7,23 @@ operators, fast tensor-product evaluations, pre-cached mutating
77
evaluations, as well as `Zygote`-compatible non-mutating evaluations.
88

99
The lazily implemented operator algebra allows the user to update the
10-
operator state by passing in an update function that accepts arbirary
10+
operator state by passing in an update function that accepts arbitrary
1111
parameter objects. Further, our operators behave like `AbstractMatrix` types
12-
thanks to overloads defined for methods in `Base`, and `LinearAlgebra`.
12+
thanks to overloads defined for methods in `Base`, and `LinearAlgebra`.
1313

1414
Therefore, an `AbstractSciMLOperator` can be passed to `LinearSolve.jl`,
15-
or `NonlinearSolve.jl` as a linear/nonlinear operator, or to
15+
or `NonlinearSolve.jl` as a linear or nonlinear operator, or to
1616
`OrdinaryDiffEq.jl` as an `ODEFunction`. Examples of usage within the
1717
`SciML` ecosystem are provided in the documentation.
1818

19+
1920
## Installation
20-
`SciMLOperators.jl` is a registerd package and can be installed via
2121

22-
```
23-
julia> import Pkg
24-
julia> Pkg.add("SciMLOperators")
25-
```
22+
To install SciMLOperators.jl, use the Julia package manager:
23+
24+
```julia
25+
using Pkg
26+
Pkg.add("SciMLOperators")
2627

2728
## Examples
2829

@@ -61,8 +62,8 @@ u_kron = rand(N ^ 3)
6162
v_kron = L3(u_kron, p, t) # == L3 * u_kron
6263
```
6364

64-
For mutating operator evaluations, call `cache_operator` to generate
65-
in-place cache so the operation is nonallocating.
65+
For mutating operator evaluations, call `cache_operator` to generate an
66+
in-place cache, so the operation is nonallocating.
6667

6768
```julia
6869
α, β = rand(2)
@@ -76,7 +77,7 @@ L2(v, u, p, t) # == mul!(v, L2, u)
7677
L4(v, u, p, t, α, β) # == mul!(v, L4, u, α, β)
7778
```
7879

79-
The calling signature `L(u, p, t)`, for out-of-place evaluations is
80+
The calling signature `L(u, p, t)`, for out-of-place evaluations, is
8081
equivalent to `L * u`, and the in-place evaluation `L(v, u, p, t, args...)`
8182
is equivalent to `LinearAlgebra.mul!(v, L, u, args...)`, where the arguments
8283
`p, t` are passed to `L` to update its state. More details are provided
@@ -95,75 +96,82 @@ object `p`.
9596

9697
* Matrix-free operators with `FunctionOperator`
9798
* Fast tensor product evaluation with `TensorProductOperator`
98-
* Lazy algebra: addition, subtraction, multiplication, inverse, adjoint, transpose
99+
* Lazy algebra: addition, subtraction, multiplication, inverse, adjoint, and transpose
99100
* Couple fast methods for operator evaluation with inversion via `InvertibleOperator`
100101
* One-line API to update operator state depending on arbitrary parameters.
101-
* Mutating, nonmutating update behaviour (Zygote compatible)
102-
* One-line API to pre-caching operators for in-place operator evaluations
102+
* Mutating and nonmutating update behavior (Zygote compatible)
103+
* One-line API for pre-caching operators for in-place operator evaluations
103104

104105
## Contributing
105106

106-
- Please refer to the
107-
[SciML ColPrac: Contributor's Guide on Collaborative Practices for Community Packages](https://github.com/SciML/ColPrac/blob/master/README.md)
108-
for guidance on PRs, issues, and other matters relating to contributing to SciML.
109-
- There are a few community forums:
110-
- The #diffeq-bridged and #sciml-bridged channels in the
111-
[Julia Slack](https://julialang.org/slack/)
112-
- [JuliaDiffEq](https://gitter.im/JuliaDiffEq/Lobby) on Gitter
113-
- On the Julia Discourse forums (look for the [modelingtoolkit tag](https://discourse.julialang.org/tag/modelingtoolkit)
114-
- See also [SciML Community page](https://sciml.ai/community/)
107+
- Please refer to the
108+
[SciML ColPrac: Contributor's Guide on Collaborative Practices for Community Packages](https://github.com/SciML/ColPrac/blob/master/README.md)
109+
for guidance on PRs, issues, and other matters relating to contributing to SciML.
110+
111+
- See the [SciML Style Guide](https://github.com/SciML/SciMLStyle) for common coding practices and other style decisions.
112+
- There are a few community forums:
113+
114+
+ The #diffeq-bridged and #sciml-bridged channels in the
115+
[Julia Slack](https://julialang.org/slack/)
116+
+ The #diffeq-bridged and #sciml-bridged channels in the
117+
[Julia Zulip](https://julialang.zulipchat.com/#narrow/stream/279055-sciml-bridged)
118+
+ On the [Julia Discourse forums](https://discourse.julialang.org)
119+
+ See also [SciML Community page](https://sciml.ai/community/)
115120

116121
## Reproducibility
122+
117123
```@raw html
118124
<details><summary>The documentation of this SciML package was built using these direct dependencies,</summary>
119125
```
126+
120127
```@example
121128
using Pkg # hide
122129
Pkg.status() # hide
123130
```
131+
124132
```@raw html
125133
</details>
126134
```
135+
127136
```@raw html
128137
<details><summary>and using this machine and Julia version.</summary>
129138
```
139+
130140
```@example
131141
using InteractiveUtils # hide
132142
versioninfo() # hide
133143
```
144+
134145
```@raw html
135146
</details>
136147
```
148+
137149
```@raw html
138150
<details><summary>A more complete overview of all dependencies and their versions is also provided.</summary>
139151
```
152+
140153
```@example
141154
using Pkg # hide
142-
Pkg.status(;mode = PKGMODE_MANIFEST) # hide
155+
Pkg.status(; mode = PKGMODE_MANIFEST) # hide
143156
```
157+
144158
```@raw html
145159
</details>
146160
```
147-
```@raw html
148-
You can also download the
149-
<a href="
150-
```
151-
```@eval
152-
using TOML
153-
version = TOML.parse(read("../../Project.toml",String))["version"]
154-
name = TOML.parse(read("../../Project.toml",String))["name"]
155-
link = "https://github.com/SciML/"*name*".jl/tree/gh-pages/v"*version*"/assets/Manifest.toml"
156-
```
157-
```@raw html
158-
">manifest</a> file and the
159-
<a href="
160-
```
161+
161162
```@eval
162163
using TOML
163-
version = TOML.parse(read("../../Project.toml",String))["version"]
164-
name = TOML.parse(read("../../Project.toml",String))["name"]
165-
link = "https://github.com/SciML/"*name*".jl/tree/gh-pages/v"*version*"/assets/Project.toml"
166-
```
167-
```@raw html
168-
">project</a> file.
164+
using Markdown
165+
version = TOML.parse(read("../../Project.toml", String))["version"]
166+
name = TOML.parse(read("../../Project.toml", String))["name"]
167+
link_manifest = "https://github.com/SciML/" * name * ".jl/tree/gh-pages/v" * version *
168+
"/assets/Manifest.toml"
169+
link_project = "https://github.com/SciML/" * name * ".jl/tree/gh-pages/v" * version *
170+
"/assets/Project.toml"
171+
Markdown.parse("""You can also download the
172+
[manifest]($link_manifest)
173+
file and the
174+
[project]($link_project)
175+
file.
176+
""")
169177
```

docs/src/interface.md

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,14 @@
55
These are the formal properties that an `AbstractSciMLOperator` should obey
66
for it to work in the solvers.
77

8-
1. An `AbstractSciMLOperator` represents a linear or nonlinear operator with input/output
9-
being `AbstractArray`s. Specifically, a SciMLOperator, `L`, of size `(M, N)` accepts
8+
1. An `AbstractSciMLOperator` represents a linear or nonlinear operator, with input/output
9+
being `AbstractArray`s. Specifically, a SciMLOperator, `L`, of size `(M, N)` accepts an
1010
input argument `u` with leading length `N`, i.e. `size(u, 1) == N`, and returns an
1111
`AbstractArray` of the same dimension with leading length `M`, i.e. `size(L * u, 1) == M`.
1212
2. SciMLOperators can be applied to an `AbstractArray` via overloaded `Base.*`, or
1313
the in-place `LinearAlgebra.mul!`. Additionally, operators are allowed to be time,
1414
or parameter dependent. The state of a SciMLOperator can be updated by calling
15-
the mutating function `update_coefficients!(L, u, p, t)` where `p` representes
15+
the mutating function `update_coefficients!(L, u, p, t)` where `p` represents
1616
parameters, and `t`, time. Calling a SciMLOperator as `L(du, u, p, t)` or out-of-place
1717
`L(u, p, t)` will automatically update the state of `L` before applying it to `u`.
1818
`L(u, p, t)` is the same operation as `L(u, p, t) * u`.
@@ -25,11 +25,11 @@ for it to work in the solvers.
2525
## Overloaded Traits
2626

2727
Thanks to overloads defined for evaluation methods and traits in
28-
`Base`, `LinearAlgebra`, the behaviour of a `SciMLOperator` is
28+
`Base`, `LinearAlgebra`, the behavior of a `SciMLOperator` is
2929
indistinguishable from an `AbstractMatrix`. These operators can be
3030
passed to linear solver packages, and even to ordinary differential
3131
equation solvers. The list of overloads to the `AbstractMatrix`
32-
interface include, but are not limited, the following:
32+
interface includes, but is not limited to, the following:
3333

3434
- `Base: size, zero, one, +, -, *, /, \, ∘, inv, adjoint, transpose, convert`
3535
- `LinearAlgebra: mul!, ldiv!, lmul!, rmul!, factorize, issymmetric, ishermitian, isposdef`
@@ -94,13 +94,13 @@ L(u, p, t) != zeros(N) # true
9494
The out-of-place evaluation function `L(u, p, t)` calls
9595
`update_coefficients` under the hood, which recursively calls
9696
the `update_func` for each component `SciMLOperator`.
97-
Therefore the out-of-place evaluation function is equivalent to
97+
Therefore, the out-of-place evaluation function is equivalent to
9898
calling `update_coefficients` followed by `Base.*`. Notice that
9999
the out-of-place evaluation does not return the updated operator.
100100

101-
On the other hand,, the in-place evaluation function, `L(v, u, p, t)`,
101+
On the other hand, the in-place evaluation function, `L(v, u, p, t)`,
102102
mutates `L`, and is equivalent to calling `update_coefficients!`
103-
followed by `mul!`. The in-place update behaviour works the same way
103+
followed by `mul!`. The in-place update behavior works the same way,
104104
with a few `<!>`s appended here and there. For example,
105105

106106
```julia
@@ -133,11 +133,11 @@ mul!(v, u, p, t) != zero(N) # true
133133
L(v, u, p, t) != zero(N) # true
134134
```
135135

136-
The update behaviour makes this package flexible enough to be used
136+
The update behavior makes this package flexible enough to be used
137137
in `OrdianryDiffEq`. As the parameter object `p` is often reserved
138-
for sensitivy computation via automatic-differentiation, a user may
138+
for sensitivity computation via automatic-differentiation, a user may
139139
prefer to pass in state information via other arguments. For that
140-
reason, we allow for update functions with arbitrary keyword arguments.
140+
reason, we allow update functions with arbitrary keyword arguments.
141141

142142
```julia
143143
mat_update_func = (A, u, p, t; scale = 0.0) -> scale * (p * p')
@@ -178,24 +178,24 @@ has_ldiv!
178178

179179
## Note About Affine Operators
180180

181-
Affine operators are operators which have the action `Q*x = A*x + b`. These operators have
182-
no matrix representation, since if there was it would be a linear operator instead of an
181+
Affine operators are operators that have the action `Q*x = A*x + b`. These operators have
182+
no matrix representation, since if there was, it would be a linear operator instead of an
183183
affine operator. You can only represent an affine operator as a linear operator in a
184184
dimension of one larger via the operation: `[A b] * [u;1]`, so it would require something modified
185185
to the input as well. As such, affine operators are a distinct generalization of linear operators.
186186

187-
While it this seems like it might doom the idea of using matrix-free affine operators, it turns out
187+
While it seems like it might doom the idea of using matrix-free affine operators, it turns out
188188
that affine operators can be used in all cases where matrix-free linear solvers are used due to
189-
an easy genearlization of the standard convergence proofs. If Q is the affine operator
189+
an easy generalization of the standard convergence proofs. If Q is the affine operator
190190
``Q(x) = Ax + b``, then solving ``Qx = c`` is equivalent to solving ``Ax + b = c`` or ``Ax = c-b``.
191-
If you know do this same "plug-and-chug" handling of the affine operator in into the GMRES/CG/etc.
191+
If you now do this same plug-and-chug handling of the affine operator into the GMRES/CG/etc.
192192
convergence proofs, move the affine part to the rhs residual, and show it converges to solving
193193
``Ax = c-b``, and thus GMRES/CG/etc. solves ``Q(x) = c`` for an affine operator properly.
194194

195-
That same trick then can be used pretty much anywhere you would've had a linear operator to extend
195+
That same trick can be used mostly anywhere you would've had a linear operator to extend
196196
the proof to affine operators, so then ``exp(A*t)*v`` operations via Krylov methods work for A being
197-
affine as well, and all sorts of things. Thus affine operators have no matrix representation but they
198-
are still compatible with essentially any Krylov method which would otherwise be compatible with
197+
affine as well, and all sorts of things. Thus, affine operators have no matrix representation, but they
198+
are still compatible with essentially any Krylov method, which would otherwise be compatible with
199199
matrix-free representations, hence their support in the SciMLOperators interface.
200200

201201
## Note about keyword arguments to `update_coefficients!`

0 commit comments

Comments
 (0)