Description Usage Arguments Value Examples
For two points x,y \in \mathcal{M}, two modes of distances are available; intrinsic for geodesic distance on the manifold and extrinsic for standard norm after equivariant embedding into Euclidean space.
1 | rstat.pdist(input, type = c("intrinsic", "extrinsic"), as.dist = TRUE)
|
input |
a S3 object of |
type |
type of distance, either |
as.dist |
logical; if |
a S3 dist
object or symmetric matrix of pairwise distances according to type
parameter.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 | ### Generate 50 data points on Sphere S^2 near (0,0,1).
ndata = 50
theta = seq(from=-0.99,to=0.99,length.out=ndata)*pi
tmpx = cos(theta) + rnorm(ndata,sd=0.1)
tmpy = sin(theta) + rnorm(ndata,sd=0.1)
### Wrap it as 'riemdata' class
data = list()
for (i in 1:ndata){
tgt = c(tmpx[i],tmpy[i],1)
data[[i]] = tgt/sqrt(sum(tgt^2)) # project onto Sphere
}
spdata = RiemBase::riemfactory(data, name="sphere")
### Compute Two Types of Distances and Visualize
dist.int = rstat.pdist(spdata, type="intrinsic", as.dist=FALSE)
dist.ext = rstat.pdist(spdata, type="extrinsic", as.dist=FALSE)
### Visualize
opar <- par(no.readonly=TRUE)
par(mfrow=c(1,2))
image(dist.int, main="intrinsic")
image(dist.ext, main="extrinsic")
par(opar)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.