Calculates Karcher mean or median of a collection of curves using the elastic square-root velocity (SRVF) framework.
curve_karcher_mean(
beta,
mode = "O",
rotated = TRUE,
scale = TRUE,
lambda = 0,
maxit = 20,
ms = c("mean", "median"),
ncores = 1L
)
An object of class fdacurve
which is a list with the following
components:
beta: A numeric array of shape \(L \times M \times N\) specifying the \(N\)-sample of \(L\)-dimensional curves evaluated on \(M\) points. The curves might be slightly different from the input curves as they have been centered.
mu
: A numeric array of shape \(L \times M\) specifying the Karcher
mean or median of the SRVFs of the input curves.
type
: A character string specifying whether the Karcher mean or median
is returned.
betamean
: A numeric array of shape \(L \times M\) specifying the
Karcher mean or median of the input curves.
v
: A numeric array of shape \(L \times M \times N\) specifying the
shooting vectors.
q
: A numeric array of shape \(L \times M \times N\) specifying the
SRVFs of the input curves.
E
: A numeric vector of shape \(N\) specifying XXX (TO DO)
cent
: A numeric array of shape \(L \times M\) specifying the centers
of the input curves.
len
: A numeric vector of shape \(N\) specifying the length of the
input curves.
len_q
: A numeric vector of shape \(N\) specifying the length of the
SRVFs of the input curves.
qun
: A numeric vector of shape \(maxit\) specifying the consecutive
values of the cost function.
mean_scale
: A numeric value specifying the mean length of the input
curves.
mean_scale_q
: A numeric value specifying the mean length of the SRVFs
of the input curves.
mode
: A character string specifying the mode of the input curves.
rotated
: A boolean specifying whether the metric is rotation-invariant.
scale
: A boolean specifying whether the metric is scale-invariant.
ms
: A character string specifying whether the Karcher mean or median is
returned.
lambda
: A numeric value specifying the elasticity ??? (TO DO).
rsamps
: ??? (TO DO).
A numeric array of shape \(L \times M \times N\) specifying an \(N\)-sample of \(L\)-dimensional curves evaluated on \(M\) points.
A character string specifying whether the input curves should be
considered open (mode == "O"
) or closed (mode == "C"
). Defaults to
"O"
.
A boolean specifying whether to make the metric
rotation-invariant. Defaults to FALSE
.
A boolean specifying whether the distance should be made
invariant by scaling. This is effectively achieved by making SRVFs having
unit length and switching to an appropriate metric on the sphere between
normalized SRVFs. Defaults to TRUE
.
A numeric value specifying the elasticity. Defaults to 0.0
.
An integer value specifying the maximum number of iterations.
Defaults to 20L
.
A character string specifying whether the Karcher mean ("mean") or
Karcher median ("median") is returned. Defaults to "mean"
.
An integer value specifying the number of cores to use for
parallel computation. Defaults to 1L
. The maximum number of available
cores is determined by the parallel package. One core is always left
out to avoid overloading the system.
Srivastava, A., Klassen, E., Joshi, S., Jermyn, I., (2011). Shape analysis of elastic curves in Euclidean spaces. Pattern Analysis and Machine Intelligence, IEEE Transactions on 33 (7), 1415-1428.
out <- curve_karcher_mean(beta[, , 1, 1:2], maxit = 2)
# note: use more shapes, small for speed
Run the code above in your browser using DataLab