-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* add a gradient, fix some doc links. * resolve #13 * resolve #14 * Rename inverse_retract_diff_argument_fd_approx to differential_inverse_retract_argument_fd_approx * add Number and formatting. * A note on the naming scheme. * bump version to 0.3 due to the renaming. * fix markdown. Co-authored-by: Mateusz Baran <mateuszbaran89@gmail.com>
- Loading branch information
1 parent
6ddb681
commit 7e0a7a3
Showing
15 changed files
with
252 additions
and
54 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
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,3 +1,17 @@ | ||
# ManifoldDiff | ||
|
||
The package __ManifoldDiff__ aims to provide automatic calculation of Riemannian gradients of functions defined on manifolds. It builds upon [`Manifolds.jl`](https://github.com/JuliaManifolds/Manifolds.jl). | ||
|
||
## Naming scheme | ||
|
||
Providing a derivative, differential or gradient for a given function, this package adds that information to the function name. | ||
For example | ||
|
||
* `grad_f` for a gradient ``\operatorname{grad} f`` | ||
* `differential_f` for ``Df`` (also called pushforward) | ||
* `differential_f_variable` if `f` has multiple variables / parameters, since a usual writing in math is ``f_x`` in this case | ||
* `adjoint_differential_f` for pullbacks | ||
* `adjoint_differential_f_variable` if `f` has multiple variables / parameters | ||
* `f_derivative` for ``f'`` | ||
|
||
the scheme is not completely fixed but tries to follow the mathematical notation. |
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,68 @@ | ||
@doc raw""" | ||
Y = geodesic_derivative(M, p, X, t::Number; γt = geodesic(M, p, X, t)) | ||
geodesic_derivative!(M, Y, p, X, t::Number; γt = geodesic(M, p, X, t)) | ||
Evaluate the derivative of the geodesic ``γ(t)`` with ``γ_{p,X}(0) = p`` and ``\dot γ_{p,X}(0) = X`` at ``t``. | ||
The formula reads | ||
```math | ||
\dot γ(t) = \mathcal P_{γ(t) \gets p} X | ||
``` | ||
where $\mathcal P$ denotes the parallel transport. | ||
This computation can also be done in-place of ``Y``. | ||
# Optional Parameters | ||
* `γt` – (`geodesic(M, p, X, t)`) the point on the geodesic at ``t``. | ||
This way if the point was computed earlier it can be resued here. | ||
""" | ||
function geodesic_derivative(M, p, X, t::Number; q = geodesic(M, p, X, t)) | ||
return parallel_transport_to(M, p, X, q) | ||
end | ||
function geodesic_derivative!(M, Y, p, X, t::Number; q = geodesic(M, p, X, t)) | ||
parallel_transport_to!(M, Y, p, X, q) | ||
return Y | ||
end | ||
|
||
@doc raw""" | ||
Y = shortest_geodesic_derivative(M, p, X, t::Number; γt = shortest_geodesic(M, p, q, t)) | ||
shortest_geodesic_derivative!(M, Y, p, X, t::Number; γt = shortest_geodesic(M, p, q, t)) | ||
Evaluate the derivative of the shortest geodesic ``γ(t)`` with ``γ_{p,q}(0) = p`` and ``\dot γ_{p,q}(1) = q`` | ||
at ``t``. | ||
The formula reads | ||
```math | ||
\dot γ(t) = \mathcal P_{γ(t) \gets p} \log_pq | ||
``` | ||
where $\mathcal P$ denotes the parallel transport. | ||
This computation can also be done in-place of ``Y``. | ||
# Optional Parameters | ||
* `γt = geodesic(M, p, X, t)` the point on the geodesic at ``t``. | ||
This way if the point was computed earlier it can be resued here. | ||
""" | ||
function shortest_geodesic_derivative( | ||
M, | ||
p, | ||
q, | ||
t::Number; | ||
γt = shortest_geodesic(M, p, q, t), | ||
) | ||
return parallel_transport_to(M, p, log(M, p, q), γt) | ||
end | ||
function shortest_geodesic_derivative!( | ||
M, | ||
Y, | ||
p, | ||
q, | ||
t::Number; | ||
γt = shortest_geodesic(M, p, q, t), | ||
) | ||
log!(M, Y, p, q) | ||
parallel_transport_to!(M, Y, p, Y, γt) | ||
return Y | ||
end |
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
Oops, something went wrong.
7e0a7a3
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
7e0a7a3
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/77605
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: