Learn R Programming

rotations (version 1.5)

weighted.mean.SO3: Weighted mean rotation

Description

Compute the weighted geometric or projected mean of a sample of rotations.

Usage

"weighted.mean" (x, w, type = "projected", epsilon = 1e-05, maxIter = 2000, ...)
"weighted.mean" (x, w, type = "projected", epsilon = 1e-05, maxIter = 2000, ...)

Arguments

x
$n-by-p$ matrix where each row corresponds to a random rotation in matrix form ($p=9$) or quaternion ($p=4$) form.
w
vector of weights the same length as the number of rows in x giving the weights to use for elements of x.
type
string indicating "projected" or "geometric" type mean estimator.
epsilon
stopping rule for the geometric method.
maxIter
maximum number of iterations allowed before returning most recent estimate.
...
only used for consistency with mean.default.

Value

Weighted mean of the sample in the same parameterization.

Details

This function takes a sample of 3D rotations (in matrix or quaternion form) and returns the weighted projected arithmetic mean $S_P$ or geometric mean $S_G$ according to the type option. For a sample of $n$ rotations in matrix form $Ri in SO(3), i=1,2,\dots,n$, the weighted mean is defined as $$\widehat{\bm{S}}=argmin_{\bm{S}\in SO(3)}\sum_{i=1}^nw_id^2(\bm{R}_i,\bm{S})$$ where $d$ is the Riemannian or Euclidean distance. For more on the projected mean see Moakher (2002) and for the geometric mean see Manton (2004).

References

Moakher M (2002). "Means and averaging in the group of rotations." SIAM Journal on Matrix Analysis and Applications, 24(1), pp. 1-16.

Manton JH (2004). "A globally convergent numerical algorithm for computing the centre of mass on compact Lie groups." In Control, Automation, Robotics and Vision Conference, 2004. ICARCV 2004 8th, volume 3, pp. 2211-2216. IEEE.

See Also

median.SO3, mean.SO3, bayes.mean

Examples

Run this code
Rs <- ruars(20, rvmises, kappa = 0.01)
mean(Rs)                   #Find the equal-weight projected mean
wt <- abs(1/mis.angle(Rs)) #Use the rotation misorientation angle as weight
weighted.mean(Rs, wt)      #as weight
rot.dist(mean(Rs))
rot.dist(weighted.mean(Rs, wt)) #usually much smaller than unweighted mean

#Can do the same thing with quaternions
Qs <- as.Q4(Rs)
mean(Qs)
wt <- abs(1/mis.angle(Qs))
weighted.mean(Qs, wt)
rot.dist(mean(Qs))
rot.dist(weighted.mean(Qs, wt))

Run the code above in your browser using DataLab