-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Basic usage example * more usage * address review and export two symbols * types are exported * Restructure docs
- Loading branch information
1 parent
1715f95
commit 5dc2f06
Showing
7 changed files
with
45 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
name = "ManifoldDiff" | ||
uuid = "af67fdf4-a580-4b9f-bbec-742ef357defd" | ||
authors = ["Seth Axen <[email protected]>", "Mateusz Baran <[email protected]>", "Ronny Bergmann <[email protected]>"] | ||
version = "0.4.0" | ||
version = "0.4.1" | ||
|
||
[deps] | ||
ADTypes = "47edcb42-4c32-4615-8424-f2b9edc5f35b" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
# Basic usage | ||
|
||
You can calculate Riemannian gradient of a function defined in its embedding in multiple ways. | ||
[`DifferentiationInterface.jl`](https://github.com/JuliaDiff/DifferentiationInterface.jl) can be used to select the backend. | ||
|
||
```@example | ||
using ManifoldDiff | ||
using DifferentiationInterface | ||
using Manifolds, FiniteDifferences, ForwardDiff, Zygote | ||
rb_onb_fd51 = TangentDiffBackend(AutoFiniteDifferences(central_fdm(5, 1))) | ||
rb_onb_fwdd = TangentDiffBackend(AutoForwardDiff()) | ||
rb_proj_zyg = RiemannianProjectionBackend(AutoZygote()) | ||
s2 = Sphere(2) | ||
A = [1.0 2.0 5.0; 2.0 -1.0 4.0; 5.0 4.0 0.0] | ||
f(p) = p' * A * p | ||
q = [0.0, 1.0, 0.0] | ||
println(ManifoldDiff.gradient(s2, f, q, rb_onb_fd51)) | ||
println(ManifoldDiff.gradient(s2, f, q, rb_onb_fwdd)) | ||
println(ManifoldDiff.gradient(s2, f, q, rb_proj_zyg)) | ||
``` | ||
|
||
In this example `rb_onb_fd51` corresponds to a finite differencing scheme, `rb_onb_fwdd` calculates gradient using [`ForwardDiff.jl`](https://github.com/JuliaDiff/ForwardDiff.jl) and `rb_proj_zyg` uses [`Zygote.jl`](https://github.com/FluxML/Zygote.jl) for reverse mode automatic differentiation. | ||
|
||
[`TangentDiffBackend`](@ref) reduces dimensionality of the problem to the intrinsic dimension of the manifold, while [`RiemannianProjectionBackend`](@ref) relies on converting Euclidean gradient in the embedding to the Riemannian one. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
5dc2f06
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@JuliaRegistrator register
Release Notes:
Added
5dc2f06
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Registration pull request created: JuliaRegistries/General/120555
Tagging
After the above pull request is merged, it is recommended that a tag is created on this repository for the registered package version.
This will be done automatically if the Julia TagBot GitHub Action is installed, or can be done manually through the github interface, or via: