Learn R Programming

RiemBase (version 0.2.5)

rbase.curvedist: Distance between Two Curves with Finite Difference Approximation

Description

Suppose we have to two curves \(f,g:I\subset \mathbf{R} \rightarrow \mathcal{M}\) evaluated at finite locations \(t_0 \le \ldots \le t_N\), rbase.curvedist computes distance between two curves \(f\) and \(g\) using finite difference approximation with trapezoidal rule. In order to induce no interpolation, two curves should be of same length.

Usage

rbase.curvedist(curve1, curve2, t = NULL, type = c("intrinsic", "extrinsic"))

Arguments

curve1

a S3 object of riemdata class, whose $data element is of length \(N\).

curve2

a S3 object of riemdata class, whose $data element is of length \(N\).

t

a length-\(N\) vector of locations. If NULL is given, it uses a equidistanct sequence from 1 to \(N\).

type

type of Riemannian distance ("intrinsic" or "extrnisic").

Value

computed distance.

Examples

Run this code
# NOT RUN {
### Generate two sets of 10 2-frames in R^4 : as grassmann points
ndata = 10
data1 = array(0,c(4,2,ndata))
data2 = array(0,c(4,2,ndata))
for (i in 1:ndata){
  tgt = matrix(rnorm(4*4),nrow=4)
  data1[,,i] = qr.Q(qr(tgt))[,1:2]
}
for (i in 1:ndata){
  tgt = matrix(rnorm(4*5, sd=2),nrow=4)
  data2[,,i] = qr.Q(qr(tgt))[,1:2]
}

gdata1 = riemfactory(data1, name="grassmann") # wrap as 'riemdata' class.
gdata2 = riemfactory(data2, name="grassmann")

rbase.curvedist(gdata1, gdata2)
# }
# NOT RUN {
# }

Run the code above in your browser using DataLab