Skip to content

Commit 870cc93

Browse files
committed
format docstrings
1 parent 85198de commit 870cc93

File tree

5 files changed

+51
-48
lines changed

5 files changed

+51
-48
lines changed

.JuliaFormatter.toml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
style = "sciml"
2-
format_markdown = true
2+
format_markdown = true
3+
format_docstrings = true

src/dense.jl

Lines changed: 21 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ Defined by [ADTypes.jl](https://github.com/SciML/ADTypes.jl).
1111
1212
# Fields
1313
14-
- `ruleconfig::RC`: a [`ChainRulesCore.RuleConfig`](https://juliadiff.org/ChainRulesCore.jl/stable/rule_author/superpowers/ruleconfig.html) object.
14+
- `ruleconfig::RC`: a [`ChainRulesCore.RuleConfig`](https://juliadiff.org/ChainRulesCore.jl/stable/rule_author/superpowers/ruleconfig.html) object.
1515
"""
1616
Base.@kwdef struct AutoChainRules{RC} <: AbstractADType
1717
ruleconfig::RC
@@ -38,18 +38,19 @@ mode(::AutoDiffractor) = ForwardOrReverseMode()
3838
AutoEnzyme{M}
3939
4040
Struct used to select the [Enzyme.jl](https://github.com/EnzymeAD/Enzyme.jl) backend for automatic differentiation.
41-
41+
4242
Defined by [ADTypes.jl](https://github.com/SciML/ADTypes.jl).
43-
43+
4444
# Constructors
4545
4646
AutoEnzyme(; mode=nothing)
4747
4848
# Fields
4949
50-
- `mode::M`: can be either
51-
- an object subtyping `EnzymeCore.Mode` (like `EnzymeCore.Forward` or `EnzymeCore.Reverse`) if a specific mode is required
52-
- `nothing` to choose the best mode automatically
50+
- `mode::M`: can be either
51+
52+
+ an object subtyping `EnzymeCore.Mode` (like `EnzymeCore.Forward` or `EnzymeCore.Reverse`) if a specific mode is required
53+
+ `nothing` to choose the best mode automatically
5354
"""
5455
Base.@kwdef struct AutoEnzyme{M} <: AbstractADType
5556
mode::M = nothing
@@ -85,9 +86,9 @@ Defined by [ADTypes.jl](https://github.com/SciML/ADTypes.jl).
8586
8687
# Fields
8788
88-
- `fdtype::T1`: finite difference type
89-
- `fdjtype::T2`: finite difference type for the Jacobian
90-
- `fdhtype::T3`: finite difference type for the Hessian
89+
- `fdtype::T1`: finite difference type
90+
- `fdjtype::T2`: finite difference type for the Jacobian
91+
- `fdhtype::T3`: finite difference type for the Hessian
9192
"""
9293
Base.@kwdef struct AutoFiniteDiff{T1, T2, T3} <: AbstractADType
9394
fdtype::T1 = Val(:forward)
@@ -110,7 +111,7 @@ Defined by [ADTypes.jl](https://github.com/SciML/ADTypes.jl).
110111
111112
# Fields
112113
113-
- `fdm::T`: a [`FiniteDifferenceMethod`](https://juliadiff.org/FiniteDifferences.jl/stable/pages/api/#FiniteDifferences.FiniteDifferenceMethod)
114+
- `fdm::T`: a [`FiniteDifferenceMethod`](https://juliadiff.org/FiniteDifferences.jl/stable/pages/api/#FiniteDifferences.FiniteDifferenceMethod)
114115
"""
115116
Base.@kwdef struct AutoFiniteDifferences{T} <: AbstractADType
116117
fdm::T
@@ -131,11 +132,11 @@ Defined by [ADTypes.jl](https://github.com/SciML/ADTypes.jl).
131132
132133
# Type parameters
133134
134-
- `chunksize`: the preferred [chunk size](https://juliadiff.org/ForwardDiff.jl/stable/user/advanced/#Configuring-Chunk-Size) to evaluate several derivatives at once
135+
- `chunksize`: the preferred [chunk size](https://juliadiff.org/ForwardDiff.jl/stable/user/advanced/#Configuring-Chunk-Size) to evaluate several derivatives at once
135136
136137
# Fields
137138
138-
- `tag::T`: a [custom tag](https://juliadiff.org/ForwardDiff.jl/release-0.10/user/advanced.html#Custom-tags-and-tag-checking-1) to handle nested differentiation calls (usually not necessary)
139+
- `tag::T`: a [custom tag](https://juliadiff.org/ForwardDiff.jl/release-0.10/user/advanced.html#Custom-tags-and-tag-checking-1) to handle nested differentiation calls (usually not necessary)
139140
"""
140141
struct AutoForwardDiff{chunksize, T} <: AbstractADType
141142
tag::T
@@ -149,22 +150,22 @@ mode(::AutoForwardDiff) = ForwardMode()
149150

150151
"""
151152
AutoPolyesterForwardDiff{chunksize,T}
152-
153+
153154
Struct used to select the [PolyesterForwardDiff.jl](https://github.com/JuliaDiff/PolyesterForwardDiff.jl) backend for automatic differentiation.
154-
155+
155156
Defined by [ADTypes.jl](https://github.com/SciML/ADTypes.jl).
156-
157+
157158
# Constructors
158-
159+
159160
AutoPolyesterForwardDiff(; chunksize=nothing, tag=nothing)
160161
161162
# Type parameters
162163
163-
- `chunksize`: the preferred [chunk size](https://juliadiff.org/ForwardDiff.jl/stable/user/advanced/#Configuring-Chunk-Size) to evaluate several derivatives at once
164+
- `chunksize`: the preferred [chunk size](https://juliadiff.org/ForwardDiff.jl/stable/user/advanced/#Configuring-Chunk-Size) to evaluate several derivatives at once
164165
165166
# Fields
166167
167-
- `tag::T`: a [custom tag](https://juliadiff.org/ForwardDiff.jl/release-0.10/user/advanced.html#Custom-tags-and-tag-checking-1) to handle nested differentiation calls (usually not necessary)
168+
- `tag::T`: a [custom tag](https://juliadiff.org/ForwardDiff.jl/release-0.10/user/advanced.html#Custom-tags-and-tag-checking-1) to handle nested differentiation calls (usually not necessary)
168169
"""
169170
struct AutoPolyesterForwardDiff{chunksize, T} <: AbstractADType
170171
tag::T
@@ -189,7 +190,7 @@ Defined by [ADTypes.jl](https://github.com/SciML/ADTypes.jl).
189190
190191
# Fields
191192
192-
- `compile::Bool`: whether to [compile the tape](https://juliadiff.org/ReverseDiff.jl/api/#ReverseDiff.compile) prior to differentiation
193+
- `compile::Bool`: whether to [compile the tape](https://juliadiff.org/ReverseDiff.jl/api/#ReverseDiff.compile) prior to differentiation
193194
"""
194195
Base.@kwdef struct AutoReverseDiff <: AbstractADType
195196
compile::Bool = false
@@ -225,7 +226,7 @@ Defined by [ADTypes.jl](https://github.com/SciML/ADTypes.jl).
225226
226227
# Fields
227228
228-
- `safe_mode::Bool`: whether to run additional checks to catch errors early. On by default. Turn off to maximise performance if your code runs correctly.
229+
- `safe_mode::Bool`: whether to run additional checks to catch errors early. On by default. Turn off to maximise performance if your code runs correctly.
229230
"""
230231
Base.@kwdef struct AutoTapir <: AbstractADType
231232
safe_mode::Bool = true

src/mode.jl

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,10 @@ Abstract supertype for the traits identifying differentiation modes.
55
66
# Subtypes
77
8-
- [`ForwardMode`](@ref)
9-
- [`ReverseMode`](@ref)
10-
- [`ForwardOrReverseMode`](@ref)
11-
- [`SymbolicMode`](@ref)
8+
- [`ForwardMode`](@ref)
9+
- [`ReverseMode`](@ref)
10+
- [`ForwardOrReverseMode`](@ref)
11+
- [`SymbolicMode`](@ref)
1212
"""
1313
abstract type AbstractMode end
1414

@@ -41,7 +41,8 @@ struct ReverseMode <: AbstractMode end
4141
Trait for AD choices that can work either in [`ForwardMode`](@ref) or [`ReverseMode`](@ref), depending on their configuration.
4242
4343
!!! warning
44-
This trait should rarely be used, because more precise dispatches to [`ForwardMode`](@ref) or [`ReverseMode`](@ref) should be defined.
44+
45+
This trait should rarely be used, because more precise dispatches to [`ForwardMode`](@ref) or [`ReverseMode`](@ref) should be defined.
4546
"""
4647
struct ForwardOrReverseMode <: AbstractMode end
4748

src/sparse.jl

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@ Abstract supertype for sparsity pattern detectors.
77
88
# Required methods
99
10-
- [`jacobian_sparsity`](@ref)
11-
- [`hessian_sparsity`](@ref)
10+
- [`jacobian_sparsity`](@ref)
11+
- [`hessian_sparsity`](@ref)
1212
"""
1313
abstract type AbstractSparsityDetector end
1414

@@ -34,7 +34,7 @@ Trivial sparsity detector, which always returns a full sparsity pattern (only on
3434
3535
# See also
3636
37-
- [`AbstractSparsityDetector`](@ref)
37+
- [`AbstractSparsityDetector`](@ref)
3838
"""
3939
struct NoSparsityDetector <: AbstractSparsityDetector end
4040

@@ -51,18 +51,18 @@ Abstract supertype for Jacobian/Hessian coloring algorithms, defined for example
5151
5252
# Required methods
5353
54-
- [`column_coloring`](@ref)
55-
- [`row_coloring`](@ref)
56-
- [`symmetric_coloring`](@ref)
54+
- [`column_coloring`](@ref)
55+
- [`row_coloring`](@ref)
56+
- [`symmetric_coloring`](@ref)
5757
5858
# Note
5959
6060
The terminology and definitions are taken from the following paper:
6161
6262
> "What Color Is Your Jacobian? Graph Coloring for Computing Derivatives"
63-
>
63+
>
6464
> Assefaw Hadish Gebremedhin, Fredrik Manne, and Alex Pothen (2005)
65-
>
65+
>
6666
> https://epubs.siam.org/doi/10.1137/S0036144504444711
6767
"""
6868
abstract type AbstractColoringAlgorithm end
@@ -92,8 +92,8 @@ Use algorithm `ca` to construct a symmetrically structurally orthogonal partitio
9292
9393
The result is a coloring vector `c` of length `size(M, 1) == size(M, 2)` such that for every non-zero coefficient `M[i, j]`, at least one of the following conditions holds:
9494
95-
- column `j` is the only column of its color `c[j]` with a non-zero coefficient in row `i`;
96-
- column `i` is the only column of its color `c[i]` with a non-zero coefficient in row `j`.
95+
- column `j` is the only column of its color `c[j]` with a non-zero coefficient in row `i`;
96+
- column `i` is the only column of its color `c[i]` with a non-zero coefficient in row `j`.
9797
"""
9898
function symmetric_coloring end
9999

@@ -104,7 +104,7 @@ Trivial coloring algorithm, which always returns a different color for each matr
104104
105105
# See also
106106
107-
- [`AbstractColoringAlgorithm`](@ref)
107+
- [`AbstractColoringAlgorithm`](@ref)
108108
"""
109109
struct NoColoringAlgorithm <: AbstractColoringAlgorithm end
110110

@@ -121,9 +121,9 @@ Wraps an ADTypes.jl object to deal with sparse Jacobians and Hessians.
121121
122122
# Fields
123123
124-
- `dense_ad::D`: the underlying AD package, subtyping [`AbstractADType`](@ref)
125-
- `sparsity_detector::S`: the sparsity pattern detector, subtyping [`AbstractSparsityDetector`](@ref)
126-
- `coloring_algorithm::C`: the coloring algorithm, subtyping [`AbstractColoringAlgorithm`](@ref)
124+
- `dense_ad::D`: the underlying AD package, subtyping [`AbstractADType`](@ref)
125+
- `sparsity_detector::S`: the sparsity pattern detector, subtyping [`AbstractSparsityDetector`](@ref)
126+
- `coloring_algorithm::C`: the coloring algorithm, subtyping [`AbstractColoringAlgorithm`](@ref)
127127
128128
# Constructors
129129
@@ -158,10 +158,10 @@ end
158158
dense_ad(ad::AutoSparse)::AbstractADType
159159
160160
Return the underlying AD package for a sparse AD choice.
161-
161+
162162
# See also
163163
164-
- [`AutoSparse`](@ref)
164+
- [`AutoSparse`](@ref)
165165
"""
166166
dense_ad(ad::AutoSparse) = ad.dense_ad
167167

@@ -174,8 +174,8 @@ Return the sparsity pattern detector for a sparse AD choice.
174174
175175
# See also
176176
177-
- [`AutoSparse`](@ref)
178-
- [`AbstractSparsityDetector`](@ref)
177+
- [`AutoSparse`](@ref)
178+
- [`AbstractSparsityDetector`](@ref)
179179
"""
180180
sparsity_detector(ad::AutoSparse) = ad.sparsity_detector
181181

@@ -186,7 +186,7 @@ Return the coloring algorithm for a sparse AD choice.
186186
187187
# See also
188188
189-
- [`AutoSparse`](@ref)
190-
- [`AbstractColoringAlgorithm`](@ref)
189+
- [`AutoSparse`](@ref)
190+
- [`AbstractColoringAlgorithm`](@ref)
191191
"""
192192
coloring_algorithm(ad::AutoSparse) = ad.coloring_algorithm

test/dense.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -139,8 +139,8 @@ end
139139
@test ad isa AutoTapir
140140
@test mode(ad) isa ReverseMode
141141
@test ad.safe_mode
142-
143-
ad = AutoTapir(; safe_mode=false)
142+
143+
ad = AutoTapir(; safe_mode = false)
144144
@test !ad.safe_mode
145145
end
146146

0 commit comments

Comments
 (0)