Differentiation

Documentation for Manifolds.jl's methods and types for finite differences and automatic differentiation.

Differentiation backends

Manifolds.FiniteDifferencesBackendType
FiniteDifferencesBackend(method::FiniteDifferenceMethod = central_fdm(5, 1))

Differentiation backend based on the FiniteDifferences package.

Manifolds._derivativeFunction
_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.

Note

Not specifying the backend explicitly will usually result in a type instability and decreased performance.

Manifolds._gradientFunction
_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.

Note

Not specifying the backend explicitly will usually result in a type instability and decreased performance.

Manifolds.diff_backend!Method
diff_backend!(backend::AbstractDiffBackend)

Set current backend for differentiation to backend.

Manifolds.diff_backendMethod
diff_backend() -> AbstractDiffBackend

Get the current differentiation backend.

Manifolds.diff_backendsMethod
diff_backends() -> Vector{AbstractDiffBackend}

Get vector of currently valid differentiation backends.

Riemannian differentiation backends

Manifolds.RiemannianONBDiffBackendType
RiemannianONBDiffBackend(
    diff_backend::AbstractDiffBackend
    retraction::AbstractRetractionMethod
    inverse_retraction::AbstractInverseRetractionMethod
    basis::Union{AbstractOrthonormalBasis,CachedBasis{<:AbstractOrthonormalBasis}},
) <: AbstractRiemannianDiffBackend

Riemannian differentiation based on differentiation in an AbstractOrthonormalBasisbasis using specified retraction, inverse_retraction and using backend diff_backend.

Manifolds.RiemannianProjectionGradientBackendType
RiemannianProjectionGradientBackend(
    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.differentialMethod
differential(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.gradientMethod
gradient(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!Method
rdifferential_backend!(backend::AbstractRiemannianDiffBackend)

Set current Riemannian differential backend for differentiation to backend.

Manifolds.rdifferential_backendMethod
rdifferential_backend() -> AbstractRiemannianDiffBackend

Get the current differentiation backend for Riemannian differentials.

Manifolds.rgradient_backend!Method
rgradient_backend!(backend::AbstractRiemannianDiffBackend)

Set current Riemannian gradient backend for differentiation to backend.

Manifolds.rgradient_backendMethod
rgradient_backend() -> AbstractRiemannianDiffBackend

Get the current differentiation backend for Riemannian gradients.

  • Absil2008

    Absil, P. A., et al. Optimization Algorithms on Matrix Manifolds. 2008.