
Most of the functions for RiemBase
package require data to be wrapped as a riemdata
class.
Since manifolds of interests endow data points with specific constraints, the function riemfactory
first checks the requirements to characterize the manifold and then wraps the data into
riemdata
class, which is simply a list of manifold-valued data and the name of manifold.
Manifold name input is, fortunately, case-insensitive.
riemfactory(
data,
name = c("euclidean", "grassmann", "spd", "sphere", "stiefel")
)
data to be wrapped as riemdata
class. Following input formats are considered,
an Euclidean
or Sphere
manifold case.
an
unnamed list where each element of the list is a single data point. Sizes of all elements must match.
the name of Riemmanian manifold for data to which data belong.
a named riemdata
S3 object containing
a list of manifold-valued data points.
size of each data matrix.
name of the manifold of interests.
# NOT RUN {
# Test with Sphere S^2 in R^3 example
## Prepare a matrix and list of 20 samples on S^2
sp.mat = array(0,c(3,20)) # each vector will be recorded as a column
sp.list = list()
for (i in 1:20){
tgt = rnorm(3) # sample random numbers
tgt = tgt/sqrt(sum(tgt*tgt)) # normalize
sp.mat[,i] = tgt # record it as column vector
sp.list[[i]] = tgt # record it as an element in a list
}
## wrap it using 'riemfactory'
rsp1 = riemfactory(sp.mat, name="Sphere")
rsp2 = riemfactory(sp.list, name="spHeRe")
# }
# NOT RUN {
# }
Run the code above in your browser using DataLab