Quaternion Distributions

Sample truly uniform from quaternions and robust implementations for small normally distributed quaternion perturbations.

KernelDistributions.nonzero_signMethod
nonzero_sign(q)

Compared to the implementation in Quaternions.jl, this implementation does not return a Quaternion with (0,0,0,0) but the identity with (1,0,0,0). Eq. (44) in J. Sola, „Quaternion kinematics for the error-state KF“.

source
KernelDistributions.:⊕Method
⊕(q, θ)

'The ‘plus’ operator [qs = qr ⊕ θ] : SO(3) × R3 → SO(3) produces an element S of SO(3) which is the result of composing a reference element R of SO(3) with a (often small) rotation. This rotation is specified by a vector of θ ∈ R3 in the vector space tangent [...]' (eq. 158, Sola 2012)

source
KernelDistributions.:⊖Method
⊖(qs, qr)

'The ‘minus’ operator [θ = qs ⊖ qr] : SO(3) × SO(3) → R3 is the inverse of [qs = qr ⊕ θ]. It returns the vectorial angular difference θ ∈ R3 between two elements of SO(3). This difference is expressed in the vector space tangent to the reference element [...]' (eq. 161, Sola 2012)

source
KernelDistributions.exp_mapMethod
exp_map(x, y, z)

Convert an axis-angle rotation vector to a Quaternion (formerly qrotation in Quaternions.jl, Sola 2012)). Exponential for quaternions can be reformulated to the exponential map using (eq. 46, Sola 2012)).

source
KernelDistributions.log_mapMethod
log_map(q)

Convert a Quaternion to an axis angle rotation vector. Exponential for quaternions can be reformulated to the exponential map using (eq. 46, Sola 2012) - log similar.

source
Statistics.covMethod
cov(x::AbstractVector{<:Quaternion}, w::AbstractWeights, dims::Int; corrected=false)

For particle filters use analytic / reliability weights which describe an importance of each observation. Compatibility with matrix function by ignoring dims.

source
Statistics.meanMethod
mean(q::AbstractVector{<:Quaternion}, w::AbstractWeights)

Calculate the weighted mean Quaternion via eigenvalue decomposition. Based on "Averaging Quaternions", Markley et al. 2007.

source
StatsBase.mean_and_covFunction
mean_and_cov(x::AbstractVector{<:Quaternion}, w::AbstractWeights, dims::Int; corrected=false)

For particle filters use analytic / reliability weights which describe an importance of each observation. Compatibility with matrix function by ignoring dims.

source