Manifold | R Documentation |
An R6::R6Class object implementing the base Manifold
class. In other words, a topological space that locally resembles Euclidean
space near each point.
rgeomstats::PythonClass
-> Manifold
dim
An integer value specifying the dimension of the manifold.
shape
An integer vector specifying the shape of one element of the
manifold. Defaults to NULL
.
metric
A RiemannianMetric object specifying the metric to use on
the manifold. Defaults to NULL
.
default_coords_type
A string specifying the coordinate type.
Choices are extrensic
or intrinsic
. Dedaults to intrinsic
.
default_point_type
A string specifying the point type. Choices are
vector
or matrix
. It is automatically determined depending on the
manifold.
new()
The Manifold
class constructor.
Manifold$new( dim, shape = NULL, metric = NULL, default_coords_type = "intrinsic", py_cls = NULL )
dim
An integer value specifying the dimension of the manifold.
shape
An integer vector specifying the shape of one element of the
manifold. Defaults to NULL
.
metric
A RiemannianMetric
object specifying the metric to use
on the manifold. Defaults to NULL
.
default_coords_type
A string specifying the coordinate type.
Choices are extrinsic
or intrinsic
. Defaults to intrinsic
.
py_cls
A Python object of class Manifold
. Defaults to NULL
in
which case it is instantiated on the fly using the other input
arguments.
An object of class Manifold
.
belongs()
Evaluates if a point belongs to the manifold.
Manifold$belongs(point, atol = gs$backend$atol)
point
A numeric array of shape [… \times \{\mathrm{dim}\}] specifying one or more points to be checked.
atol
A numeric value specifying the absolute tolerance for
checking. Defaults to gs$backend$atol
.
A boolean value or vector storing whether the corresponding points belong to the manifold.
if (reticulate::py_module_available("geomstats")) { spd3 <- SPDMatrix(n = 3) A <- diag(1, 3) spd3$belongs(diag(1, 3)) }
is_tangent()
Checks whether a vector is tangent at a base point.
Manifold$is_tangent(vector, base_point = NULL, atol = gs$backend$atol)
vector
A numeric array of shape [… \times [\mathrm{dim}]] specifying one or more vectors to be checked.
base_point
A numeric array of shape [… \times
[\mathrm{dim}]] specifying one or more base points on the manifold.
Defaults to NULL
in which case the identity is used.
atol
A numeric value specifying the absolute tolerance for
checking. Defaults to gs$backend$atol
.
A boolean value or vector storing whether the corresponding points are tangent to the manifold at corresponding base points.
if (reticulate::py_module_available("geomstats")) { spd3 <- SPDMatrix(n = 3) A <- diag(1, 3) spd3$is_tangent(diag(1, 3)) }
to_tangent()
Projects a vector to a tangent space of the manifold.
Manifold$to_tangent(vector, base_point = NULL)
vector
A numeric array of shape [… \times [\mathrm{dim}]] specifying one or more vectors to project on the manifold.
base_point
A numeric array of shape [… \times
[\mathrm{dim}]] specifying one or more base points on the manifold.
Defaults to NULL
in which case the identity is used.
A numeric array of shape [… \times \{\mathrm{dim}\}] storing the corresponding projections onto the manifold at corresponding base points.
if (reticulate::py_module_available("geomstats")) { spd3 <- SPDMatrix(n = 3) A <- diag(1, 3) spd3$to_tangent(diag(1, 3)) }
random_point()
Samples random points on the manifold.
Manifold$random_point(n_samples = 1, bound = 1)
n_samples
An integer value specifying the number of samples to be
drawn. Defaults to 1L
.
bound
A numeric value specifying the bound of the interval in
which to sample for non-compact manifolds. Defaults to 1L
.
If the manifold is compact, a uniform distribution is used.
A numeric array of shape [… \times \{\mathrm{dim}\}] storing a sample of points on the manifold.
if (reticulate::py_module_available("geomstats")) { spd3 <- SPDMatrix(n = 3) # spd3$random_point(10) # TO DO: uncomment when bug fixed in gs }
regularize()
Regularizes a point to the canonical representation for the manifold.
Manifold$regularize(point)
point
A numeric array of shape [… \times [\mathrm{dim}]] specifying one or more points on the manifold.
A numeric array of the same shape storing the corresponding regularized points.
if (reticulate::py_module_available("geomstats")) { spd3 <- SPDMatrix(n = 3) A <- diag(1, 3) spd3$regularize(diag(1, 3)) }
set_metric()
Sets the Riemannian Metric associated to the manifold.
Manifold$set_metric(metric)
metric
An object of class RiemannianMetric
.
The Manifold class itself invisibly.
if (reticulate::py_module_available("geomstats")) { spd3 <- SPDMatrix(n = 3) spd3$metric spd3$set_metric(SPDMetricBuresWasserstein$new(n = 3)) spd3$metric }
random_tangent_vec()
Generates a random tangent vector.
Manifold$random_tangent_vec(base_point, n_samples = 1)
base_point
A numeric array of shape [… \times \{\mathrm{dim}\}] specifying one or more base points on the manifold.
n_samples
An integer value specifying the number of samples to be
drawn. Defaults to 1L
.
A numeric array of shape [… \times \{\mathrm{dim}\}] storing a sample of vectors that are tangent to the manifold at corresponding base points.
if (reticulate::py_module_available("geomstats")) { spd3 <- SPDMatrix(n = 3) spd3$random_tangent_vec(diag(1, 3), 10) }
clone()
The objects of this class are cloneable with this method.
Manifold$clone(deep = FALSE)
deep
Whether to make a deep clone.
Nina Miolane
## ------------------------------------------------ ## 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) }
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.