An R6::R6Class object implementing the base Manifold
class. In other words, a topological space that locally resembles Euclidean
space near each point.
Public fields
dimAn integer value specifying the dimension of the manifold.
shapeAn integer vector specifying the shape of one element of the manifold. Defaults to
NULL.metricA RiemannianMetric object specifying the metric to use on the manifold. Defaults to
NULL.default_coords_typeA string specifying the coordinate type. Choices are
extrensicorintrinsic. Dedaults tointrinsic.default_point_typeA string specifying the point type. Choices are
vectorormatrix. It is automatically determined depending on the manifold.
Methods
Method new()
The Manifold class constructor.
Usage
Manifold$new(
dim,
shape = NULL,
metric = NULL,
default_coords_type = "intrinsic",
py_cls = NULL
)Arguments
dimAn integer value specifying the dimension of the manifold.
shapeAn integer vector specifying the shape of one element of the manifold. Defaults to
NULL.metricA
RiemannianMetricobject specifying the metric to use on the manifold. Defaults toNULL.default_coords_typeA string specifying the coordinate type. Choices are
extrinsicorintrinsic. Defaults tointrinsic.py_clsA Python object of class
Manifold. Defaults toNULLin which case it is instantiated on the fly using the other input arguments.
Method belongs()
Evaluates if a point belongs to the manifold.
Arguments
pointA numeric array of shape \([\dots \times \{\mathrm{dim}\}]\) specifying one or more points to be checked.
atolA numeric value specifying the absolute tolerance for checking. Defaults to
gs$backend$atol.
Examples
if (reticulate::py_module_available("geomstats")) {
spd3 <- SPDMatrix(n = 3)
A <- diag(1, 3)
spd3$belongs(diag(1, 3))
}Method is_tangent()
Checks whether a vector is tangent at a base point.
Arguments
vectorA numeric array of shape \([\dots \times [\mathrm{dim}]]\) specifying one or more vectors to be checked.
base_pointA numeric array of shape \([\dots \times [\mathrm{dim}]]\) specifying one or more base points on the manifold. Defaults to
NULLin which case the identity is used.atolA numeric value specifying the absolute tolerance for checking. Defaults to
gs$backend$atol.
Returns
A boolean value or vector storing whether the corresponding points are tangent to the manifold at corresponding base points.
Examples
if (reticulate::py_module_available("geomstats")) {
spd3 <- SPDMatrix(n = 3)
A <- diag(1, 3)
spd3$is_tangent(diag(1, 3))
}Method to_tangent()
Projects a vector to a tangent space of the manifold.
Arguments
vectorA numeric array of shape \([\dots \times [\mathrm{dim}]]\) specifying one or more vectors to project on the manifold.
base_pointA numeric array of shape \([\dots \times [\mathrm{dim}]]\) specifying one or more base points on the manifold. Defaults to
NULLin which case the identity is used.
Returns
A numeric array of shape \([\dots \times \{\mathrm{dim}\}]\) storing the corresponding projections onto the manifold at corresponding base points.
Examples
if (reticulate::py_module_available("geomstats")) {
spd3 <- SPDMatrix(n = 3)
A <- diag(1, 3)
spd3$to_tangent(diag(1, 3))
}Method random_point()
Samples random points on the manifold.
Arguments
n_samplesAn integer value specifying the number of samples to be drawn. Defaults to
1L.boundA numeric value specifying the bound of the interval in which to sample for non-compact manifolds. Defaults to
1L.
Returns
A numeric array of shape \([\dots \times \{\mathrm{dim}\}]\) storing a sample of points on the manifold.
Examples
if (reticulate::py_module_available("geomstats")) {
spd3 <- SPDMatrix(n = 3)
# spd3$random_point(10) # TO DO: uncomment when bug fixed in gs
}Method regularize()
Regularizes a point to the canonical representation for the manifold.
Arguments
pointA numeric array of shape \([\dots \times [\mathrm{dim}]]\) specifying one or more points on the manifold.
Examples
if (reticulate::py_module_available("geomstats")) {
spd3 <- SPDMatrix(n = 3)
A <- diag(1, 3)
spd3$regularize(diag(1, 3))
}Method set_metric()
Sets the Riemannian Metric associated to the manifold.
Arguments
metricAn object of class
RiemannianMetric.
Examples
if (reticulate::py_module_available("geomstats")) {
spd3 <- SPDMatrix(n = 3)
spd3$metric
spd3$set_metric(SPDMetricBuresWasserstein$new(n = 3))
spd3$metric
}Method random_tangent_vec()
Generates a random tangent vector.
Arguments
base_pointA numeric array of shape \([\dots \times \{\mathrm{dim}\}]\) specifying one or more base points on the manifold.
n_samplesAn integer value specifying the number of samples to be drawn. Defaults to
1L.
Returns
A numeric array of shape \([\dots \times \{\mathrm{dim}\}]\) storing a sample of vectors that are tangent to the manifold at corresponding base points.
Examples
if (reticulate::py_module_available("geomstats")) {
spd3 <- SPDMatrix(n = 3)
spd3$random_tangent_vec(diag(1, 3), 10)
}Examples
## ------------------------------------------------
## Method `Manifold$belongs`
## ------------------------------------------------
if (reticulate::py_module_available("geomstats")) {
spd3 <- SPDMatrix(n = 3)
A <- diag(1, 3)
spd3$belongs(diag(1, 3))
}
## ------------------------------------------------
## Method `Manifold$is_tangent`
## ------------------------------------------------
if (reticulate::py_module_available("geomstats")) {
spd3 <- SPDMatrix(n = 3)
A <- diag(1, 3)
spd3$is_tangent(diag(1, 3))
}
## ------------------------------------------------
## Method `Manifold$to_tangent`
## ------------------------------------------------
if (reticulate::py_module_available("geomstats")) {
spd3 <- SPDMatrix(n = 3)
A <- diag(1, 3)
spd3$to_tangent(diag(1, 3))
}
## ------------------------------------------------
## Method `Manifold$random_point`
## ------------------------------------------------
if (reticulate::py_module_available("geomstats")) {
spd3 <- SPDMatrix(n = 3)
# spd3$random_point(10) # TO DO: uncomment when bug fixed in gs
}
## ------------------------------------------------
## Method `Manifold$regularize`
## ------------------------------------------------
if (reticulate::py_module_available("geomstats")) {
spd3 <- SPDMatrix(n = 3)
A <- diag(1, 3)
spd3$regularize(diag(1, 3))
}
## ------------------------------------------------
## Method `Manifold$set_metric`
## ------------------------------------------------
if (reticulate::py_module_available("geomstats")) {
spd3 <- SPDMatrix(n = 3)
spd3$metric
spd3$set_metric(SPDMetricBuresWasserstein$new(n = 3))
spd3$metric
}
## ------------------------------------------------
## Method `Manifold$random_tangent_vec`
## ------------------------------------------------
if (reticulate::py_module_available("geomstats")) {
spd3 <- SPDMatrix(n = 3)
spd3$random_tangent_vec(diag(1, 3), 10)
}
