# Differentiation

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

## Differentiation backends

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.

source
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.

source

## 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 AbstractOrthonormalBasis basis using specified retraction, inverse_retraction and using backend diff_backend.

source
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.

source
Manifolds.differentialMethod
differential(M::AbstractManifold, 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)$.

source
Manifolds.gradientMethod
gradient(M::AbstractManifold, 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.

source
• Absil2008

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