Differentiation
Documentation for Manifolds.jl
's methods and types for finite differences and automatic differentiation.
Differentiation backends
Manifolds.AbstractDiffBackend
— TypeAbstractDiffBackend
An abstract type for diff backends. See FiniteDifferencesBackend
for an example.
Manifolds.CurrentDiffBackend
— TypeCurrentDiffBackend(backend::AbstractDiffBackend)
A mutable struct for storing the current differentiation backend in a global constant _current_diff_backend
.
See also
Manifolds.FiniteDifferencesBackend
— TypeFiniteDifferencesBackend(method::FiniteDifferenceMethod = central_fdm(5, 1))
Differentiation backend based on the FiniteDifferences package.
Manifolds._derivative
— Function_derivative(f, t[, backend::AbstractDiffBackend])
Compute the derivative of a callable f
at time t
computed using the given backend
, an object of type Manifolds.AbstractDiffBackend
. If the backend is not explicitly specified, it is obtained using the function Manifolds.diff_backend
.
This function calculates plain Euclidean derivatives, for Riemannian differentiation see for example differential
.
Not specifying the backend explicitly will usually result in a type instability and decreased performance.
Manifolds._gradient
— Function_gradient(f, p[, backend::AbstractDiffBackend])
Compute the gradient of a callable f
at point p
computed using the given backend
, an object of type AbstractDiffBackend
. If the backend is not explicitly specified, it is obtained using the function diff_backend
.
This function calculates plain Euclidean gradients, for Riemannian gradient calculation see for example gradient
.
Not specifying the backend explicitly will usually result in a type instability and decreased performance.
Manifolds.diff_backend!
— Methoddiff_backend!(backend::AbstractDiffBackend)
Set current backend for differentiation to backend
.
Manifolds.diff_backend
— Methoddiff_backend() -> AbstractDiffBackend
Get the current differentiation backend.
Manifolds.diff_backends
— Methoddiff_backends() -> Vector{AbstractDiffBackend}
Get vector of currently valid differentiation backends.
Manifolds._current_diff_backend
— Constant_current_diff_backend
The instance of Manifolds.CurrentDiffBackend
that stores the globally default differentiation backend.
Manifolds._diff_backends
— Constant_diff_backends
A vector of valid Manifolds.AbstractDiffBackend
.
Riemannian differentiation backends
Manifolds.AbstractRiemannianDiffBackend
— TypeAbstractRiemannianDiffBackend
An abstract type for diff backends. See RiemannianONBDiffBackend
for an example.
Manifolds.CurrentRiemannianDiffBackend
— TypeCurrentRiemannianDiffBackend(backend::AbstractRiemannianDiffBackend)
A mutable struct for storing the current Riemannian differentiation backend in global constants Manifolds._current_rgradient_backend
and Manifolds._current_rdifferential_backend
.
See also
AbstractRiemannianDiffBackend
, rdifferential_backend
, rdifferential_backend!
Manifolds.RiemannianONBDiffBackend
— TypeRiemannianONBDiffBackend(
diff_backend::AbstractDiffBackend
retraction::AbstractRetractionMethod
inverse_retraction::AbstractInverseRetractionMethod
basis::Union{AbstractOrthonormalBasis,CachedBasis{<:AbstractOrthonormalBasis}},
) <: AbstractRiemannianDiffBackend
Riemannian differentiation based on differentiation in an AbstractOrthonormalBasis
basis
using specified retraction
, inverse_retraction
and using backend diff_backend
.
Manifolds.RiemannianProjectionGradientBackend
— TypeRiemannianProjectionGradientBackend(
diff_backend::AbstractDiffBackend
) <: AbstractRiemannianDiffBackend
Riemannian differentiation based on differentiation in the ambient space and projection to the given manifold. Differentiation in the ambient space is performed using the backend diff_backend
.
Only valid for manifolds that are embedded in a special way in the Euclidean space. See [Absil2008], Section 3.6.1 for details.
Manifolds.differential
— Methoddifferential(M::Manifold, f, t::Real, backend::AbstractDiffBackend = rdifferential_backend())
Compute the Riemannian differential of a curve $f: ℝ\to M$ on a manifold M
represented by function f
at time t
using the given backend. It is calculated as the tangent vector equal to $\mathrm{d}f_t(t)[1]$.
Manifolds.gradient
— Methodgradient(M::Manifold, f, p, backend::AbstractRiemannianDiffBackend = rgradient_backend())
Compute the Riemannian gradient $∇f(p)$ of a real field on manifold M
represented by function f
at point p
using the given backend.
Manifolds.rdifferential_backend!
— Methodrdifferential_backend!(backend::AbstractRiemannianDiffBackend)
Set current Riemannian differential backend for differentiation to backend
.
Manifolds.rdifferential_backend
— Methodrdifferential_backend() -> AbstractRiemannianDiffBackend
Get the current differentiation backend for Riemannian differentials.
Manifolds.rgradient_backend!
— Methodrgradient_backend!(backend::AbstractRiemannianDiffBackend)
Set current Riemannian gradient backend for differentiation to backend
.
Manifolds.rgradient_backend
— Methodrgradient_backend() -> AbstractRiemannianDiffBackend
Get the current differentiation backend for Riemannian gradients.
Manifolds._current_rdifferential_backend
— Constant_current_rdifferential_backend
The instance of Manifolds.CurrentRiemannianDiffBackend
that stores the globally default differentiation backend for calculating differentials.
See also
Manifolds._current_rgradient_backend
— Constant_current_rgradient_backend
The instance of Manifolds.CurrentRiemannianDiffBackend
that stores the globally default differentiation backend for calculating gradients.
See also
Manifolds.gradient(::Manifold, ::Any, ::Any, ::AbstractRiemannianDiffBackend)
- Absil2008
Absil, P. A., et al. Optimization Algorithms on Matrix Manifolds. 2008.