| Manifold {rgeomstats} | R Documentation |
Abstract Class for Manifolds
Description
An R6::R6Class object implementing the base Manifold
class. In other words, a topological space that locally resembles Euclidean
space near each point.
Super class
rgeomstats::PythonClass -> Manifold
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
Public methods
Inherited 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.
Returns
An object of class Manifold.
Method belongs()
Evaluates if a point belongs to the manifold.
Usage
Manifold$belongs(point, atol = gs$backend$atol)
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.
Returns
A boolean value or vector storing whether the corresponding points belong to the manifold.
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.
Usage
Manifold$is_tangent(vector, base_point = NULL, atol = gs$backend$atol)
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 toNULLin 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.
Usage
Manifold$to_tangent(vector, base_point = NULL)
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 toNULLin 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.
Usage
Manifold$random_point(n_samples = 1, bound = 1)
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.
Details
If the manifold is compact, a uniform distribution is used.
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.
Usage
Manifold$regularize(point)
Arguments
pointA numeric array of shape
[\dots \times [\mathrm{dim}]]specifying one or more points on the manifold.
Returns
A numeric array of the same shape storing the corresponding regularized points.
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.
Usage
Manifold$set_metric(metric)
Arguments
metricAn object of class
RiemannianMetric.
Returns
The Manifold class itself invisibly.
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.
Usage
Manifold$random_tangent_vec(base_point, n_samples = 1)
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)
}
Method clone()
The objects of this class are cloneable with this method.
Usage
Manifold$clone(deep = FALSE)
Arguments
deepWhether to make a deep clone.
Author(s)
Nina Miolane
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)
}