Skip to content

Commit 25e6975

Browse files
Export and document gradient functions
1 parent a6d6094 commit 25e6975

File tree

3 files changed

+19
-4
lines changed

3 files changed

+19
-4
lines changed

docs/Manifest.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ uuid = "69de0a69-1ddd-5017-9359-2bf0b02dc9f0"
6666
version = "0.3.6"
6767

6868
[[Pkg]]
69-
deps = ["Dates", "LibGit2", "Markdown", "Printf", "REPL", "Random", "SHA", "UUIDs"]
69+
deps = ["Dates", "LibGit2", "Libdl", "Logging", "Markdown", "Printf", "REPL", "Random", "SHA", "UUIDs"]
7070
uuid = "44cfe95a-1eb2-52ea-b672-e2afdf69b78f"
7171

7272
[[Printf]]

docs/src/pages/api.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
## Finite Differences
2+
13
```@docs
24
FiniteDifferenceMethod
35
fdm
@@ -8,3 +10,13 @@ assert_approx_equal
810
FiniteDifferences.DEFAULT_CONDITION
911
FiniteDifferences.TINY
1012
```
13+
14+
## Gradients
15+
16+
```@docs
17+
grad
18+
jacobian
19+
jvp
20+
j′vp
21+
to_vec
22+
```

src/grad.jl

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
export grad, jacobian, jvp, j′vp, to_vec
2+
13
"""
24
grad(fdm, f, x::AbstractVector)
35
@@ -51,7 +53,8 @@ _j′vp(fdm, f, ȳ::AV{<:Real}, x::Vector{<:Real}) = jacobian(fdm, f, x, length
5153
"""
5254
jvp(fdm, f, x, ẋ)
5355
54-
Compute a Jacobian-vector product with any types of arguments for which `to_vec` is defined.
56+
Compute a Jacobian-vector product with any types of arguments for which [`to_vec`](@ref)
57+
is defined.
5558
"""
5659
function jvp(fdm, f, (x, ẋ)::Tuple{Any, Any})
5760
x_vec, vec_to_x = to_vec(x)
@@ -66,7 +69,7 @@ end
6669
"""
6770
j′vp(fdm, f, ȳ, x...)
6871
69-
Compute an adjoint with any types of arguments for which `to_vec` is defined.
72+
Compute an adjoint with any types of arguments for which [`to_vec`](@ref) is defined.
7073
"""
7174
function j′vp(fdm, f, ȳ, x)
7275
x_vec, vec_to_x = to_vec(x)
@@ -76,7 +79,7 @@ end
7679
j′vp(fdm, f, ȳ, xs...) = j′vp(fdm, xs->f(xs...), ȳ, xs)
7780

7881
"""
79-
to_vec(x)
82+
to_vec(x) -> Tuple{<:AbstractVector, <:Function}
8083
8184
Transform `x` into a `Vector`, and return a closure which inverts the transformation.
8285
"""

0 commit comments

Comments
 (0)