Title: | Interface to 'Geomstats' |
Version: | 0.0.1 |
Description: | Provides an interface to the Python package 'Geomstats' authored by Miolane et al. (2020) <doi:10.48550/arXiv.2004.04667>. |
License: | MIT + file LICENSE |
Encoding: | UTF-8 |
RoxygenNote: | 7.2.1 |
Suggests: | testthat (≥ 3.0.0) |
Config/testthat/edition: | 3 |
URL: | https://github.com/LMJL-Alea/rgeomstats, https://lmjl-alea.github.io/rgeomstats/ |
BugReports: | https://github.com/LMJL-Alea/rgeomstats/issues |
Config/reticulate: | list( packages = list( list(package = "geomstats") ) ) |
Imports: | cli, purrr, R6, Rdpack, reticulate, rlang |
RdMacros: | Rdpack |
NeedsCompilation: | no |
Packaged: | 2022-11-03 21:11:20 UTC; stamm-a |
Author: | Aymeric Stamm |
Maintainer: | Aymeric Stamm <aymeric.stamm@math.cnrs.fr> |
Repository: | CRAN |
Date/Publication: | 2022-11-04 10:10:02 UTC |
rgeomstats: Interface to 'Geomstats'
Description
Provides an interface to the Python package 'Geomstats' authored by Miolane et al. (2020) arXiv:2004.04667.
Author(s)
Maintainer: Aymeric Stamm aymeric.stamm@math.cnrs.fr (ORCID)
Other contributors:
Nicolas Guigui (ORCID) (Author of the Geomstats Python package) [contributor]
Alice Le Brigant (ORCID) (Author of the Geomstats Python package) [contributor]
Johan Mathe (Author of the Geomstats Python package) [contributor]
Nina Miolane (ORCID) (Author of the Geomstats Python package) [contributor]
Xavier Pennec (ORCID) (Author of the Geomstats Python package) [contributor]
Luis Pereira (Author of the Geomstats Python package) [contributor]
Yann Thanwerdas (ORCID) (Author of the Geomstats Python package) [contributor]
See Also
Useful links:
Report bugs at https://github.com/LMJL-Alea/rgeomstats/issues
Abstract Class for Connections
Description
An R6::R6Class object implementing the base Connection
class for affine connections.
Super class
rgeomstats::PythonClass
-> Connection
Public fields
dim
An integer value specifying the dimension of the underlying manifold.
shape
An integer vector specifying the shape of one element of the manifold. Defaults to
NULL
.default_coords_type
A string specifying the coordinate type. Choices are
extrensic
orintrinsic
. Dedaults tointrinsic
.default_point_type
A string specifying the point type. Choices are
vector
ormatrix
. It is automatically determined depending on the manifold.
Methods
Public methods
Inherited methods
Method new()
The Connection
class constructor.
Usage
Connection$new( dim, shape = NULL, default_coords_type = "intrinsic", py_cls = NULL )
Arguments
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
.default_coords_type
A string specifying the coordinate type. Choices are
extrensic
orintrinsic
. Defaults tointrinsic
.py_cls
A Python object of class
Connection
. Defaults toNULL
in which case it is instantiated on the fly using the other input arguments.metric
A
RiemannianMetric
object specifying the metric to use on the manifold. Defaults toNULL
.
Returns
An object of class Connection
.
Method christoffels()
Christoffel symbols associated with the connection.
Usage
Connection$christoffels(base_point)
Arguments
base_point
A numeric array of shape
dim
specifying a base point on the manifold.
Returns
A numeric array of shape c(dim, dim, dim)
storing the
Christoffel symbols, with the contravariant index on the first
dimension.
Method geodesic_equation()
Computes the geodesic ODE associated with the connection.
Usage
Connection$geodesic_equation(state, .time)
Arguments
state
A numeric array of shape
dim
specifying a tangent vector to the manifold at the position specified by.time
..time
A numeric array of shape
dim
specifying a point on the manifold at which to compute the geodesic ODE.
Returns
A numeric array of shape dim
storing the value of the vector
field to be integrated at position.
Method exp()
Exponential map associated to the affine connection.
Usage
Connection$exp(tangent_vec, base_point, n_steps = 100, step = "euler")
Arguments
tangent_vec
A numeric array of shape
dim
specifying a tangent vector atbase_point
.base_point
A numeric array of shape
dim
specifying a base point on the manifold.n_steps
An integer value specifying the number of discrete time steps to take in the integration. Defaults to
100L
.step
A string specifying which numerical scheme to use for integration. Choices are
euler
orrk4
. Defaults toeuler
.
Details
Exponential map at base_point of tangent_vec computed by integration of the geodesic equation (initial value problem), using the christoffel symbols.
Returns
A numeric array of shape dim
storing the exponential of the
input tangent vector, which lies on on the manifold.
Method log()
Logarithm map associated to the affine connection.
Usage
Connection$log( point, base_point, n_steps = 100, step = "euler", max_iter = 25, verbose = FALSE, tol = gs$backend$atol )
Arguments
point
A numeric array of shape
dim
specifying a point on the manifold.base_point
A numeric array of shape
dim
specifying a base point on the manifold.n_steps
An integer value specifying the number of discrete time steps to take in the integration. Defaults to
100L
.step
A string specifying which numerical scheme to use for integration. Choices are
euler
orrk4
. Defaults toeuler
.max_iter
An integer value specifying the number of iterations. Defaults to
25L
.verbose
A boolean specifying whether the optimizer should display intermediate messages pertaining to its convergence. Defaults to
FALSE
.tol
A numeric value specifying the absolute tolerance for optimization convergence. Defaults to
gs$backend$atol
.
Details
Solves the boundary value problem associated to the geodesic equation using the Christoffel symbols and conjugate gradient descent.
Returns
A numeric array of shape dim
storing the exponential of the
input tangent vector, which lies on on the manifold.
Method ladder_parallel_transport()
Approximate parallel transport using the pole ladder scheme.
Usage
Connection$ladder_parallel_transport( tangent_vec, base_point, direction, n_rungs = 1, scheme = "pole", alpha = 1, ... )
Arguments
tangent_vec
A numeric array of shape
dim
specifying a tangent vector atbase_point
.base_point
A numeric array of shape
dim
specifying a base point on the manifold.direction
Tangent vector at base point specifying the initial speed of the geodesic along which to transport.
n_rungs
A scalar integer specifying the Number of steps of the ladder. Defaults to
1L
.scheme
A string specifying the scheme to use for the construction of the ladder at each step. Choices are either
pole
orschild
. Defaults topole
.alpha
A numeric value specifying the exponent for the scaling of the vector to transport. Must be greater or equal to 1 and Guigui and Pennec (2022) proved that
alpha = 2
is optimal. Defaults to2
....
Extra arguments to be passed to calls to
$exp()
and$log()
in auxiliary single ladder step functions.
Details
Approximate parallel transport using either the pole ladder or
the Schild's ladder scheme
(Lorenzi and Pennec 2014). Pole ladder is exact in
symmetric spaces and of order two in general while Schild's ladder is a
first order approximation (Guigui and Pennec 2022).
Both schemes are available on any affine connection manifolds whose
exponential and logarithm maps are implemented. tangent_vec
is
transported along the geodesic starting at the base_point
with
initial tangent vector direction
.
References
Guigui N, Pennec X (2022).
“Numerical accuracy of ladder schemes for parallel transport on manifolds.”
Foundations of Computational Mathematics, 22(3), 757–790.
Lorenzi M, Pennec X (2014).
“Efficient parallel transport of deformations in time series of images: from Schild’s to pole ladder.”
Journal of mathematical imaging and vision, 50(1), 5–17.
Returns
A named list with 3 components:
-
transported_tangent_vector
: Approximation of the parallel transport of the input tangent vector. -
trajectory
: A list of lengthn_steps
storing the geodesics of the construction, only ifreturn_geodesics = TRUE
in the step function. The geodesics are methods of the class connection. -
end_point
:
Method curvature()
Computes the curvature.
Usage
Connection$curvature(tangent_vec_a, tangent_vec_b, tangent_vec_c, base_point)
Arguments
tangent_vec_a
Tangent vector at
base_point
.tangent_vec_b
Tangent vector at
base_point
.tangent_vec_c
Tangent vector at
base_point
.base_point
A numeric array of shape
dim
specifying a base point on the manifold.
Details
For three vector fields X|_P = \mathrm{tangent\_vec\_a}
,
Y|_P = \mathrm{tangent\_vec\_b}
, Z|_P =
\mathrm{tangent\_vec\_c}
with tangent vector specified in argument at
the base point P
, the curvature is defined by
R(X,Y)Z =
\nabla_{[X,Y]}Z - \nabla_X\nabla_Y Z + \nabla_Y\nabla_X Z.
Returns
Tangent vector at base_point
.
Method directional_curvature()
Computes the directional curvature (tidal force operator).
Usage
Connection$directional_curvature(tangent_vec_a, tangent_vec_b, base_point)
Arguments
tangent_vec_a
Tangent vector at
base_point
.tangent_vec_b
Tangent vector at
base_point
.base_point
A numeric array of shape
dim
specifying a base point on the manifold.
Details
For two vector fields X|_P = \mathrm{tangent\_vec\_a}
and
Y|_P = \mathrm{tangent\_vec\_b}
with tangent vector specified in
argument at the base point P
, the directional curvature, better
known in relativity as the tidal force operator, is defined by
R_Y(X) = R(Y,X)Y.
Returns
Tangent vector at base_point
.
Method curvature_derivative()
Computes the covariant derivative of the curvature.
Usage
Connection$curvature_derivative( tangent_vec_a, tangent_vec_b, tangent_vec_c, tangent_vec_d, base_point = NULL )
Arguments
tangent_vec_a
Tangent vector at
base_point
.tangent_vec_b
Tangent vector at
base_point
.tangent_vec_c
Tangent vector at
base_point
.tangent_vec_d
Tangent vector at
base_point
.base_point
A numeric array of shape
dim
specifying a base point on the manifold.
Details
For four vector fields H|_P = \mathrm{tangent\_vec\_a}
,
X|_P = \mathrm{tangent\_vec\_b}
, Y|_P =
\mathrm{tangent\_vec\_c}
, Z|_P = \mathrm{tangent\_vec\_d}
with
tangent vector value specified in argument at the base point P
,
the covariant derivative of the curvature (\nabla_H R)(X, Y) Z
|_P
is computed at the base point P
.
Returns
Tangent vector at base_point
.
Method directional_curvature_derivative()
Computes the covariant derivative of the directional curvature.
Usage
Connection$directional_curvature_derivative( tangent_vec_a, tangent_vec_b, base_point = NULL )
Arguments
tangent_vec_a
Tangent vector at
base_point
.tangent_vec_b
Tangent vector at
base_point
.base_point
A numeric array of shape
dim
specifying a base point on the manifold.
Details
For two vector fields X|_P = \mathrm{tangent\_vec\_a}
,
Y|_P = \mathrm{tangent\_vec\_b}
with tangent vector value
specified in argument at the base point P
, the covariant
derivative (in the direction X
) (\nabla_X R_Y)(X) |_P =
(\nabla_X R)(Y, X) Y |_P
of the directional curvature (in the
direction Y
) R_Y(X) = R(Y, X) Y
is a quadratic tensor in
X
and Y
that plays an important role in the computation of
the moments of the empirical Fréchet mean
(Pennec 2019).
References
Pennec X (2019). “Curvature effects on the empirical mean in Riemannian and affine Manifolds: a non-asymptotic high concentration expansion in the small-sample regime.” arXiv preprint arXiv:1906.07418.
Returns
Tangent vector at base_point
.
Method geodesic()
Generates parametrized function for the geodesic curve.
Usage
Connection$geodesic( initial_point, end_point = NULL, initial_tangent_vec = NULL )
Arguments
initial_point
Point on the manifold specifying the initial point of the geodesic.
end_point
Point on the manifold specifying the end point of the geodesic. Defaults to
NULL
, in which case an initial tangent vector must be given.initial_tangent_vec
Tangent vector at base point specifying the initial speed of the geodesics. Defaults to
NULL
, in which case an end point must be given and a logarithm is computed.
Details
Geodesic curve defined by either:
an initial point and an initial tangent vector,
an initial point and an end point.
Returns
A function representing the time-parametrized geodesic curve. If a list of initial conditions is passed, the output list will contain, for each time point, a list with the geodesic values each initial condition.
Method parallel_transport()
Computes the parallel transport of a tangent vector.
Usage
Connection$parallel_transport( tangent_vec, base_point, direction = NULL, end_point = NULL )
Arguments
tangent_vec
A numeric array of shape
dim
specifying a tangent vector atbase_point
.base_point
A numeric array of shape
dim
specifying a base point on the manifold.direction
Tangent vector at base point specifying the point along which the parallel transport is computed. Defaults to
NULL
.end_point
Point on the manifold specifying the point to transport to. Defaults to
NULL
.
Details
Closed-form solution for the parallel transport of a tangent
vector along the geodesic between two points base_point
and
end_point
or alternatively defined by t \mapsto
\exp_\mathrm{base_point} (t \mathrm{direction})
.
Returns
Tangent vector transported at t \mapsto
\exp_\mathrm{base_point} (t \mathrm{direction})
.
Method injectivity_radius()
Computes the radius of the injectivity domain.
Usage
Connection$injectivity_radius(base_point)
Arguments
base_point
A numeric array of shape
dim
specifying a base point on the manifold.
Details
This is is the supremum of radii r for which the exponential map is a diffeomorphism from the open ball of radius r centered at the base point onto its image.
Returns
A numeric value representing the injectivity radius.
Method clone()
The objects of this class are cloneable with this method.
Usage
Connection$clone(deep = FALSE)
Arguments
deep
Whether to make a deep clone.
Author(s)
Nicolas Guigui
Abstract Class for Level Set Manifolds
Description
Class for manifolds embedded in a vector space by a submersion.
Super classes
rgeomstats::PythonClass
-> rgeomstats::Manifold
-> LevelSet
Public fields
embedding_space
An object of class
VectorSpace
specifying the embedding space.embedding_metric
???
submersion
???
value
???
tangent_submersion
???
Methods
Public methods
Inherited methods
rgeomstats::PythonClass$get_python_class()
rgeomstats::PythonClass$set_python_class()
rgeomstats::Manifold$belongs()
rgeomstats::Manifold$is_tangent()
rgeomstats::Manifold$random_point()
rgeomstats::Manifold$random_tangent_vec()
rgeomstats::Manifold$regularize()
rgeomstats::Manifold$set_metric()
rgeomstats::Manifold$to_tangent()
Method new()
The LevelSet
class constructor.
Usage
LevelSet$new( dim, embedding_space, submersion, value, tangent_submersion, default_coords_type = "intrinsic", ..., py_cls = NULL )
Arguments
dim
An integer value specifying the dimension of the manifold.
embedding_space
An object of class
VectorSpace
specifying the embedding space.submersion
???
value
???
tangent_submersion
???
default_coords_type
A string specifying the coordinate type. Choices are
extrinsic
orintrinsic
. Defaults tointrinsic
....
Extra arguments to be passed to parent class constructors. See
Manifold
class.py_cls
A Python object of class
LevelSet
. Defaults toNULL
in which case it is instantiated on the fly using the other input arguments.
Returns
An object of class LevelSet
.
Method intrinsic_to_extrinsic_coords()
Converts from intrinsic to extrinsic coordinates.
Usage
LevelSet$intrinsic_to_extrinsic_coords(point_intrinsic)
Arguments
point_intrinsic
A numeric array of shape
dim
specifying a point in the embedded manifold in intrinsic coordinates.
Returns
A numeric array of shape dim_embedding
representing the same
point in the embedded manifold in extrinsic coordinates.
Method extrinsic_to_intrinsic_coords()
Converts from extrinsic to intrinsic coordinates.
Usage
LevelSet$extrinsic_to_intrinsic_coords(point_extrinsic)
Arguments
point_extrinsic
A numeric array of shape
dim_embedding
specifying a point in the embedded manifold in extrinsic coordinates, i.E. in the coordinates of the embedding manifold.
Returns
A numeric array of shape dim
representing the same point in the
embedded manifold in intrinsic coordinates.
Method projection()
Projects a point in embedding manifold on embedded manifold.
Usage
LevelSet$projection(point)
Arguments
point
A numeric array of shape
dim_embedding
specifying a point in the embedding manifold.
Returns
A numeric array of shape dim_embedding
storing the projected
point.
Method clone()
The objects of this class are cloneable with this method.
Usage
LevelSet$clone(deep = FALSE)
Arguments
deep
Whether to make a deep clone.
Author(s)
Nicolas Guigui and Nina Miolane
Abstract Class for Lie Groups
Description
Class for Lie groups. In this class, point_type
('vector'
or
'matrix'
) will be used to describe the format of the points on the Lie
group. If point_type
is 'vector'
, the format of the inputs is
dimension
, where dimension
is the dimension of the Lie group. If
point_type
is 'matrix'
, the format of the inputs is c(n, n)
where n
is the parameter of \mathrm{GL}(n)
e.g. the amount of rows and
columns of the matrix.
Super classes
rgeomstats::PythonClass
-> rgeomstats::Manifold
-> LieGroup
Public fields
lie_algebra
An object of class
MatrixLieAlgebra
orNULL
representing the tangent space at the identity.left_canonical_metric
An object of class
InvariantMetric
representing the left invariant metric that corresponds to the Euclidean inner product at the identity.right_canonical_metric
An object of class
InvariantMetric
representing the left invariant metric that corresponds to the Euclidean inner product at the identity.metrics
A list of objects of class
RiemannianMetric
.
Methods
Public methods
Inherited methods
rgeomstats::PythonClass$get_python_class()
rgeomstats::PythonClass$set_python_class()
rgeomstats::Manifold$belongs()
rgeomstats::Manifold$is_tangent()
rgeomstats::Manifold$random_point()
rgeomstats::Manifold$random_tangent_vec()
rgeomstats::Manifold$regularize()
rgeomstats::Manifold$set_metric()
rgeomstats::Manifold$to_tangent()
Method new()
The LieGroup
class constructor.
Usage
LieGroup$new(dim, shape, lie_algebra = NULL, ..., py_cls = NULL)
Arguments
dim
An integer value specifying the dimension of the manifold.
shape
An integer vector specifying the shape of one element of the Lie group.
lie_algebra
An object of class
MatrixLieAlgebra
orNULL
specifying the tangent space at the identity....
Extra arguments to be passed to parent class constructors. See
Manifold
class.py_cls
A Python object of class
LieGroup
. Defaults toNULL
in which case it is instantiated on the fly using the other input arguments.
Returns
An object of class LieGroup
.
Method exp()
Exponentiates a left-invariant vector field from a base point.
Usage
LieGroup$exp(tangent_vec, base_point = NULL)
Arguments
tangent_vec
A numeric array of shape
[\dots \times \{ \mathrm{dim}, [n \times n] \}]
specifying one or more tangent vectors at corresponding base points.base_point
A numeric array of shape
[\dots \times \{ \mathrm{dim}, [n \times n] \}]
specifying one or more base points on the manifold. Defaults to identity ifNULL
.
Details
The vector input is not an element of the Lie algebra, but of
the tangent space at base_point
: if g
denotes base_point
,
v
the tangent vector, and V = g^{-1} v
the associated Lie
algebra vector, then
\exp(v, g) = \mathrm{mul}(g, \exp(V))
.
Therefore, the Lie exponential is obtained when base_point
is NULL
,
or the identity.
Returns
A numeric array of shape [\dots \times \{ \mathrm{dim}, [n
\times n] \}]
storing the group exponential of the input tangent
vector(s).
Examples
if (reticulate::py_module_available("geomstats")) { so3 <- SpecialOrthogonal(n = 3, point_type = "vector") so3$exp(rep(0, 3)) }
Method exp_from_identity()
Compute the group exponential of tangent vector from the identity.
Usage
LieGroup$exp_from_identity(tangent_vec)
Arguments
tangent_vec
A numeric array of shape
[\dots \times \{ \mathrm{dim}, [n \times n] \}]
specifying one or more tangent vectors at corresponding base points.
Returns
A numeric array of shape [\dots \times \{ \mathrm{dim}, [n
\times n] \}]
storing the group exponential of the input tangent
vector(s).
Examples
if (reticulate::py_module_available("geomstats")) { so3 <- SpecialOrthogonal(n = 3, point_type = "vector") so3$exp_from_identity(rep(0, 3)) }
Method exp_not_from_identity()
Calculate the group exponential at base_point
.
Usage
LieGroup$exp_not_from_identity(tangent_vec, base_point)
Arguments
tangent_vec
A numeric array of shape
[\dots \times \{ \mathrm{dim}, [n \times n] \}]
specifying one or more tangent vectors at corresponding base points.base_point
A numeric array of shape
[\dots \times \{ \mathrm{dim}, [n \times n] \}]
specifying one or more base points on the manifold. Defaults to identity ifNULL
.
Returns
A numeric array of shape [\dots \times \{ \mathrm{dim}, [n
\times n] \}]
storing the group exponential of the input tangent
vector(s).
Examples
if (reticulate::py_module_available("geomstats")) { so3 <- SpecialOrthogonal(n = 3, point_type = "vector") so3$exp_not_from_identity(rep(0, 3), rep(0, 3)) }
Method log()
Computes a left-invariant vector field bringing base_point
to point
.
Usage
LieGroup$log(point, base_point = NULL)
Arguments
point
A numeric array of shape
[\dots \times \{ \mathrm{dim}, [n \times n] \}]
specifying one or more points on the manifold.base_point
A numeric array of shape
[\dots \times \{ \mathrm{dim}, [n \times n] \}]
specifying one or more base points on the manifold. Defaults to identity ifNULL
.
Details
The output is a vector of the tangent space at base_point
, so
not a Lie algebra element if base_point
is not the identity.
Furthermore, denoting point
by g
and base_point
by h
,
the output satisfies
g = \exp(\log(g, h), h)
.
Returns
A numeric array of shape [\dots \times \{ \mathrm{dim}, [n
\times n] \}]
storing the group logarithm of the input point(s).
Examples
if (reticulate::py_module_available("geomstats")) { so3 <- SpecialOrthogonal(n = 3, point_type = "vector") so3$log(rep(0, 3)) }
Method log_from_identity()
Computes the group logarithm of point
from the identity.
Usage
LieGroup$log_from_identity(point)
Arguments
point
A numeric array of shape
[\dots \times \{ \mathrm{dim}, [n \times n] \}]
specifying one or more points on the manifold.
Returns
A numeric array of shape [\dots \times \{ \mathrm{dim}, [n
\times n] \}]
storing the group logarithm of the input point(s).
Examples
if (reticulate::py_module_available("geomstats")) { so3 <- SpecialOrthogonal(n = 3, point_type = "vector") so3$log_from_identity(rep(0, 3)) }
Method log_not_from_identity()
Computes the group logarithm at base_point
.
Usage
LieGroup$log_not_from_identity(point, base_point)
Arguments
point
A numeric array of shape
[\dots \times \{ \mathrm{dim}, [n \times n] \}]
specifying one or more points on the manifold.base_point
A numeric array of shape
[\dots \times \{ \mathrm{dim}, [n \times n] \}]
specifying one or more base points on the manifold. Defaults to identity ifNULL
.
Returns
A numeric array of shape [\dots \times \{ \mathrm{dim}, [n
\times n] \}]
storing the group logarithm of the input point(s).
Examples
if (reticulate::py_module_available("geomstats")) { so3 <- SpecialOrthogonal(n = 3, point_type = "vector") so3$log_not_from_identity(rep(0, 3), rep(0, 3)) }
Method get_identity()
Gets the identity of the group.
Usage
LieGroup$get_identity()
Returns
A numeric array of shape \{ \mathrm{dim}, [n \times n] \}
storing the identity of the Lie group.
Examples
if (reticulate::py_module_available("geomstats")) { so3 <- SpecialOrthogonal(n = 3, point_type = "vector") so3$get_identity() }
Method lie_bracket()
Computes the lie bracket of two tangent vectors.
Usage
LieGroup$lie_bracket(tangent_vector_a, tangent_vector_b, base_point = NULL)
Arguments
tangent_vector_a
A numeric array of shape
[\dots \times n \times n]
specifying one or more tangent vectors at corresponding base points.tangent_vector_b
A numeric array of shape
[\dots \times n \times n]
specifying one or more tangent vectors at corresponding base points.base_point
A numeric array of shape
[\dots \times \{ \mathrm{dim}, [n \times n] \}]
specifying one or more base points on the manifold. Defaults to identity ifNULL
.
Details
For matrix Lie groups with tangent vectors A
and B
at the same base point P
, this is given by (translate to
identity, compute commutator, go back):
[A,B] = A_P^{-1}B -
B_P^{-1}A
.
Returns
A numeric array of shape [\dots \times n \times n]
storing
the Lie bracket of the two input tangent vectors.
Examples
if (reticulate::py_module_available("geomstats")) { so3 <- SpecialOrthogonal(n = 3, point_type = "vector") so3$lie_bracket(diag(0, 3), diag(0, 3)) }
Method tangent_translation_map()
Computes the push-forward map by the left/right translation.
Usage
LieGroup$tangent_translation_map( point, left_or_right = "left", inverse = FALSE )
Arguments
point
A numeric array of shape
[\dots \times \{ \mathrm{dim}, [n \times n] \}]
specifying one or more points on the manifold.left_or_right
A character string specifying whether to compute the map for the left or right translation. Choices are
"left"
or"right
. Defaults to"left"
.inverse
A boolean specifying whether to inverse the Jacobian matrix. If set to
TRUE
, the push forward by the translation by the inverse of the point is returned. Defaults toFALSE
.
Details
Computes the push-forward map of the left/right translation by
the point. It corresponds to the tangent map, or differential of the
group multiplication by the point or its inverse. For groups with a
vector representation, it is only implemented at identity, but it can
be used at other points with inverse = TRUE
. This method wraps the
Jacobian translation which actually computes the matrix representation
of the map.
Returns
A function computing the tangent map of the left/right
translation by point
. It can be applied to tangent vectors.
Examples
if (reticulate::py_module_available("geomstats")) { so3 <- SpecialOrthogonal(n = 3, point_type = "vector") so3$tangent_translation_map(rep(0, 3)) }
Method compose()
Performs function composition corresponding to the Lie group.
Usage
LieGroup$compose(point_a, point_b)
Arguments
point_a
A numeric array of shape
[\dots \times \{ \mathrm{dim}, [n \times n] \}]
specifying one or more left factors in the product.point_b
A numeric array of shape
[\dots \times \{ \mathrm{dim}, [n \times n] \}]
specifying one or more right factors in the product.
Returns
A numeric array of shape [\dots \times \{ \mathrm{dim}, [n
\times n] \}]
storing the product of point_a
and point_b
along the
first dimension.
Examples
if (reticulate::py_module_available("geomstats")) { so3 <- SpecialOrthogonal(n = 3, point_type = "vector") so3$compose(rep(0, 3), rep(0, 3)) }
Method jacobian_translation()
Computes the Jacobian of left/right translation by a point.
Usage
LieGroup$jacobian_translation(point, left_or_right = "left")
Arguments
point
A numeric array of shape
[\dots \times \{ \mathrm{dim}, [n \times n] \}]
specifying one or more points on the manifold.left_or_right
A character string specifying whether to compute the map for the left or right translation. Choices are
"left"
or"right
. Defaults to"left"
.
Returns
A numeric array of shape [\dots \times \mathrm{dim} \times
\mathrm{dim}]
storing the Jacobian of the left/right translation by
point
.
Examples
if (reticulate::py_module_available("geomstats")) { so3 <- SpecialOrthogonal(n = 3, point_type = "vector") so3$jacobian_translation(rep(0, 3)) }
Method inverse()
Computes the inverse law of the Lie group.
Usage
LieGroup$inverse(point)
Arguments
point
A numeric array of shape
[\dots \times \{ \mathrm{dim}, [n \times n] \}]
specifying one or more points to be inverted.
Returns
A numeric array of shape [\dots \times \{ \mathrm{dim}, [n
\times n] \}]
storing the inverted points.
Examples
if (reticulate::py_module_available("geomstats")) { so3 <- SpecialOrthogonal(n = 3, point_type = "vector") so3$inverse(rep(0, 3)) }
Method add_metric()
Adds a metric to the class $metrics
attribute.
Usage
LieGroup$add_metric(metric)
Arguments
metric
An object of class
RiemannianMetric
.
Returns
The class itself invisibly.
Method clone()
The objects of this class are cloneable with this method.
Usage
LieGroup$clone(deep = FALSE)
Arguments
deep
Whether to make a deep clone.
Author(s)
Nina Miolane
Examples
## ------------------------------------------------
## Method `LieGroup$exp`
## ------------------------------------------------
if (reticulate::py_module_available("geomstats")) {
so3 <- SpecialOrthogonal(n = 3, point_type = "vector")
so3$exp(rep(0, 3))
}
## ------------------------------------------------
## Method `LieGroup$exp_from_identity`
## ------------------------------------------------
if (reticulate::py_module_available("geomstats")) {
so3 <- SpecialOrthogonal(n = 3, point_type = "vector")
so3$exp_from_identity(rep(0, 3))
}
## ------------------------------------------------
## Method `LieGroup$exp_not_from_identity`
## ------------------------------------------------
if (reticulate::py_module_available("geomstats")) {
so3 <- SpecialOrthogonal(n = 3, point_type = "vector")
so3$exp_not_from_identity(rep(0, 3), rep(0, 3))
}
## ------------------------------------------------
## Method `LieGroup$log`
## ------------------------------------------------
if (reticulate::py_module_available("geomstats")) {
so3 <- SpecialOrthogonal(n = 3, point_type = "vector")
so3$log(rep(0, 3))
}
## ------------------------------------------------
## Method `LieGroup$log_from_identity`
## ------------------------------------------------
if (reticulate::py_module_available("geomstats")) {
so3 <- SpecialOrthogonal(n = 3, point_type = "vector")
so3$log_from_identity(rep(0, 3))
}
## ------------------------------------------------
## Method `LieGroup$log_not_from_identity`
## ------------------------------------------------
if (reticulate::py_module_available("geomstats")) {
so3 <- SpecialOrthogonal(n = 3, point_type = "vector")
so3$log_not_from_identity(rep(0, 3), rep(0, 3))
}
## ------------------------------------------------
## Method `LieGroup$get_identity`
## ------------------------------------------------
if (reticulate::py_module_available("geomstats")) {
so3 <- SpecialOrthogonal(n = 3, point_type = "vector")
so3$get_identity()
}
## ------------------------------------------------
## Method `LieGroup$lie_bracket`
## ------------------------------------------------
if (reticulate::py_module_available("geomstats")) {
so3 <- SpecialOrthogonal(n = 3, point_type = "vector")
so3$lie_bracket(diag(0, 3), diag(0, 3))
}
## ------------------------------------------------
## Method `LieGroup$tangent_translation_map`
## ------------------------------------------------
if (reticulate::py_module_available("geomstats")) {
so3 <- SpecialOrthogonal(n = 3, point_type = "vector")
so3$tangent_translation_map(rep(0, 3))
}
## ------------------------------------------------
## Method `LieGroup$compose`
## ------------------------------------------------
if (reticulate::py_module_available("geomstats")) {
so3 <- SpecialOrthogonal(n = 3, point_type = "vector")
so3$compose(rep(0, 3), rep(0, 3))
}
## ------------------------------------------------
## Method `LieGroup$jacobian_translation`
## ------------------------------------------------
if (reticulate::py_module_available("geomstats")) {
so3 <- SpecialOrthogonal(n = 3, point_type = "vector")
so3$jacobian_translation(rep(0, 3))
}
## ------------------------------------------------
## Method `LieGroup$inverse`
## ------------------------------------------------
if (reticulate::py_module_available("geomstats")) {
so3 <- SpecialOrthogonal(n = 3, point_type = "vector")
so3$inverse(rep(0, 3))
}
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
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
orintrinsic
. Dedaults tointrinsic
.default_point_type
A string specifying the point type. Choices are
vector
ormatrix
. 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
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 toNULL
.default_coords_type
A string specifying the coordinate type. Choices are
extrinsic
orintrinsic
. Defaults tointrinsic
.py_cls
A Python object of class
Manifold
. Defaults toNULL
in 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
point
A numeric array of shape
[\dots \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
.
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
vector
A numeric array of shape
[\dots \times [\mathrm{dim}]]
specifying one or more vectors to be checked.base_point
A numeric array of shape
[\dots \times [\mathrm{dim}]]
specifying one or more base points on the manifold. Defaults toNULL
in which case the identity is used.atol
A 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
vector
A numeric array of shape
[\dots \times [\mathrm{dim}]]
specifying one or more vectors to project on the manifold.base_point
A numeric array of shape
[\dots \times [\mathrm{dim}]]
specifying one or more base points on the manifold. Defaults toNULL
in 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_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
.
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
point
A 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
metric
An 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_point
A numeric array of shape
[\dots \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
.
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
deep
Whether 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)
}
Abstract Class for Matrix Lie Algebras
Description
There are two main forms of representation for elements of a
matrix Lie algebra implemented here. The first one is as a matrix, as
elements of R^{n \times n}
. The second is by choosing a basis and
remembering the coefficients of an element in that basis. This basis will
be provided in child classes (e.g. SkewSymmetricMatrices
).
Super classes
rgeomstats::PythonClass
-> rgeomstats::Manifold
-> rgeomstats::VectorSpace
-> MatrixLieAlgebra
Public fields
n
An integer value representing the number of rows and columns in the matrix representation of the Lie algebra.
Methods
Public methods
Inherited methods
rgeomstats::PythonClass$get_python_class()
rgeomstats::PythonClass$set_python_class()
rgeomstats::Manifold$belongs()
rgeomstats::Manifold$is_tangent()
rgeomstats::Manifold$random_point()
rgeomstats::Manifold$random_tangent_vec()
rgeomstats::Manifold$regularize()
rgeomstats::Manifold$set_metric()
rgeomstats::Manifold$to_tangent()
rgeomstats::VectorSpace$projection()
Method new()
The MatrixLieAlgebra
class constructor.
Usage
MatrixLieAlgebra$new(dim, n, ..., py_cls = NULL)
Arguments
dim
An integer value specifying the dimension of the Lie algebra as a real vector space.
n
An integer value representing the number of rows and columns in the matrix representation of the Lie algebra.
...
Extra arguments to be passed to parent class constructors. See
VectorSpace
andManifold
classes.py_cls
A Python object of class
MatrixLieAlgebra
. Defaults toNULL
in which case it is instantiated on the fly using the other input arguments.
Returns
An object of class MatrixLieAlgebra
.
Method baker_campbell_hausdorff()
Calculates the Baker-Campbell-Hausdorff approximation of given order.
Usage
MatrixLieAlgebra$baker_campbell_hausdorff(matrix_a, matrix_b, order = 2)
Arguments
matrix_a
A numeric array of shape
... \times n \times n
specifying a matrix or a sample of matrices.matrix_b
A numeric array of shape
... \times n \times n
specifying a matrix or a sample of matrices.order
An integer value specifying the order to which the approximation is calculated. Note that this is NOT the same as using only
e_i
withi < \mathrm{order}
. Defaults to2L
.
Details
The implementation is based on
Casas and Murua (2009) with the
pre-computed constants taken from
(). Our coefficients are
truncated to enable us to calculate BCH up to order 15
. This
represents
Z = \log \left( \exp(X) \exp(Y) \right)
as an infinite linear combination of the form
Z = \sum_i z_i e_i
where
z_i
are rational numbers and e_i
are iterated Lie brackets
starting with e_1 = X
, e_2 = Y
, each e_i
is given by
some (i^\prime,i^{\prime\prime})
such that e_i =
[e_i^\prime, e_i^{\prime\prime}]
.
Returns
A numeric array of shape ... \times n \times n
storing a
matrix or a sample of matrices corresponding to the BCH
approximation(s) between input matrices.
Method basis_representation()
Computes the coefficients of matrices in the given basis.
Usage
MatrixLieAlgebra$basis_representation(matrix_representation)
Arguments
matrix_representation
A numeric array of shape
... \times n \times n
specifying a matrix or a sample of matrices in its matrix representation.
Returns
A numeric array of shape ... \times \mathrm{dim}
storing a
matrix or a sample of matrices in its basis representation.
Method matrix_representation()
Compute the matrix representation for the given basis coefficients.
Usage
MatrixLieAlgebra$matrix_representation(basis_representation)
Arguments
basis_representation
A numeric array of shape
... \times \mathrm{dim}
storing a matrix or a sample of matrices in its basis representation.
Details
Sums the basis elements according to the coefficients given in basis representation.
Returns
A numeric array of shape ... \times n \times n
specifying a
matrix or a sample of matrices in its matrix representation.
Method clone()
The objects of this class are cloneable with this method.
Usage
MatrixLieAlgebra$clone(deep = FALSE)
Arguments
deep
Whether to make a deep clone.
Author(s)
Stefan Heyder
Abstract Class for Matrix Lie Groups
Description
Class for matrix Lie groups.
Super classes
rgeomstats::PythonClass
-> rgeomstats::Manifold
-> MatrixLieGroup
Public fields
lie_algebra
An object of class
MatrixLieAlgebra
orNULL
representing the tangent space at the identity.n
The size of the
n \times n
matrix elements.left_canonical_metric
An object of class
InvariantMetric
representing the left invariant metric that corresponds to the Euclidean inner product at the identity.right_canonical_metric
An object of class
InvariantMetric
representing the left invariant metric that corresponds to the Euclidean inner product at the identity.
Methods
Public methods
Inherited methods
rgeomstats::PythonClass$get_python_class()
rgeomstats::PythonClass$set_python_class()
rgeomstats::Manifold$belongs()
rgeomstats::Manifold$is_tangent()
rgeomstats::Manifold$random_point()
rgeomstats::Manifold$random_tangent_vec()
rgeomstats::Manifold$regularize()
rgeomstats::Manifold$set_metric()
rgeomstats::Manifold$to_tangent()
Method new()
The MatrixLieGroup
class constructor.
Usage
MatrixLieGroup$new(dim, n, lie_algebra = NULL, ..., py_cls = NULL)
Arguments
dim
An integer value specifying the dimension of the manifold.
n
The size of the
n \times n
matrix elements.lie_algebra
An object of class
MatrixLieAlgebra
orNULL
representing the tangent space at the identity....
Extra arguments to be passed to parent class constructors. See
Manifold
class.py_cls
A Python object of class
MatrixLieGroup
. Defaults toNULL
in which case it is instantiated on the fly using the other input arguments.
Returns
An object of class MatrixLieGroup
.
Method exp()
Exponentiates a left-invariant vector field from a base point.
Usage
MatrixLieGroup$exp(tangent_vec, base_point = NULL)
Arguments
tangent_vec
A numeric array of shape
[\dots \times n \times n]
specifying one or more tangent vectors at corresponding base points.base_point
A numeric array of shape
[\dots \times n \times n]
specifying one or more base points on the manifold. Defaults to identity ifNULL
.
Details
The vector input is not an element of the Lie algebra, but of
the tangent space at base_point
: if g
denotes base_point
,
v
the tangent vector, and V = g^{-1} v
the associated Lie
algebra vector, then
\exp(v, g) = \mathrm{mul}(g, \exp(V))
.
Therefore, the Lie exponential is obtained when base_point
is NULL
,
or the identity.
Returns
A numeric array of shape [\dots \times n \times n]
storing
the left multiplication of the Lie exponential of the input tangent
vectors with the corresponding base points.
Examples
if (reticulate::py_module_available("geomstats")) { so3 <- SpecialOrthogonal(n = 3) # so3$exp(diag(1, 3)) # TO DO: fix in gs }
Method log()
Computes a left-invariant vector field bringing base_point
to point
.
Usage
MatrixLieGroup$log(point, base_point = NULL)
Arguments
point
A numeric array of shape
[\dots \times n \times n]
specifying one or more points.base_point
A numeric array of shape
[\dots \times n \times n]
specifying one or more base points on the manifold. Defaults to identity ifNULL
.
Details
The output is a vector of the tangent space at base_point
, so
not a Lie algebra element if base_point
is not the identity.
Furthermore, denoting point
by g
and base_point
by h
,
the output satisfies
g = \exp(\log(g, h), h)
.
Returns
A numeric array of shape [\dots \times n \times n]
such
that its Lie exponential at corresponding base points matches
corresponding points.
Examples
if (reticulate::py_module_available("geomstats")) { so3 <- SpecialOrthogonal(n = 3) so3$log(diag(1, 3)) }
Method get_identity()
Gets the identity of the group.
Usage
MatrixLieGroup$get_identity()
Returns
A numeric array of shape n \times n
storing the identity
of the Lie group.
Examples
if (reticulate::py_module_available("geomstats")) { so3 <- SpecialOrthogonal(n = 3) so3$get_identity() }
Method lie_bracket()
Computes the lie bracket of two tangent vectors.
Usage
MatrixLieGroup$lie_bracket( tangent_vector_a, tangent_vector_b, base_point = NULL )
Arguments
tangent_vector_a
A numeric array of shape
[\dots \times n \times n]
specifying one or more tangent vectors at corresponding base points.tangent_vector_b
A numeric array of shape
[\dots \times n \times n]
specifying one or more tangent vectors at corresponding base points.base_point
A numeric array of shape
[\dots \times n \times n]
specifying one or more base points on the manifold. Defaults to identity ifNULL
.
Details
For matrix Lie groups with tangent vectors A
and B
at the same base point P
, this is given by (translate to
identity, compute commutator, go back):
[A,B] = A_P^{-1}B -
B_P^{-1}A
.
Returns
A numeric array of shape [\dots \times n \times n]
storing
the Lie bracket of the two input tangent vectors.
Examples
if (reticulate::py_module_available("geomstats")) { so3 <- SpecialOrthogonal(n = 3) so3$lie_bracket(diag(0, 3), diag(1, 3)) }
Method tangent_translation_map()
Computes the push-forward map by the left/right translation.
Usage
MatrixLieGroup$tangent_translation_map( point, left_or_right = "left", inverse = FALSE )
Arguments
point
A numeric array of shape
[\dots \times \{ \mathrm{dim}, [n \times n] \} ]
specifying one or more points at which to compute the map.left_or_right
A character string specifying whether to compute the map for the left or right translation. Choices are
"left"
or"right
. Defaults to"left"
.inverse
A boolean specifying whether to inverse the Jacobian matrix. If set to
TRUE
, the push forward by the translation by the inverse of the point is returned. Defaults toFALSE
.
Details
Computes the push-forward map of the left/right translation by
the point. It corresponds to the tangent map, or differential of the
group multiplication by the point or its inverse. For groups with a
vector representation, it is only implemented at identity, but it can
be used at other points with inverse = TRUE
. This method wraps the
Jacobian translation which actually computes the matrix representation
of the map.
Returns
A function taking as argument a numeric array tangent_vec
of
shape [\dots \times \{ \mathrm{dim}, [n \times n] \} ]
specifying
one or more tangent vectors and returning a numeric array of shape
[\dots \times \{ \mathrm{dim}, [n \times n] \} ]
storing the
result of the tangent mapping of the left/right translation of input
tangent points by corresponding base points.
Examples
if (reticulate::py_module_available("geomstats")) { so3 <- SpecialOrthogonal(n = 3) tangent_map <- so3$tangent_translation_map(diag(1, 3)) tangent_map(diag(1, 3)) }
Method compose()
Performs function composition corresponding to the Lie group.
Usage
MatrixLieGroup$compose(point_a, point_b)
Arguments
point_a
A numeric array of shape
[\dots \times \{ \mathrm{dim}, n \times n \}]
specifying one or more left factors in the product.point_b
A numeric array of shape
[\dots \times \{ \mathrm{dim}, n \times n \}]
specifying one or more right factors in the product.
Returns
A numeric array of shape [\dots \times \{ \mathrm{dim}, n
\times n \}]
storing the product of point_a
and point_b
along the
first dimension.
Examples
if (reticulate::py_module_available("geomstats")) { so3 <- SpecialOrthogonal(n = 3) so3$compose(diag(1, 3), diag(1, 3)) }
Method inverse()
Computes the inverse law of the Lie group.
Usage
MatrixLieGroup$inverse(point)
Arguments
point
A numeric array of shape
[\dots \times \{ \mathrm{dim}, n \times n \}]
specifying one or more points to be inverted.
Returns
A numeric array of the same shape storing the inverted points.
Examples
if (reticulate::py_module_available("geomstats")) { so3 <- SpecialOrthogonal(n = 3) so3$inverse(diag(1, 3)) }
Method clone()
The objects of this class are cloneable with this method.
Usage
MatrixLieGroup$clone(deep = FALSE)
Arguments
deep
Whether to make a deep clone.
Author(s)
Nina Miolane
Examples
## ------------------------------------------------
## Method `MatrixLieGroup$exp`
## ------------------------------------------------
if (reticulate::py_module_available("geomstats")) {
so3 <- SpecialOrthogonal(n = 3)
# so3$exp(diag(1, 3)) # TO DO: fix in gs
}
## ------------------------------------------------
## Method `MatrixLieGroup$log`
## ------------------------------------------------
if (reticulate::py_module_available("geomstats")) {
so3 <- SpecialOrthogonal(n = 3)
so3$log(diag(1, 3))
}
## ------------------------------------------------
## Method `MatrixLieGroup$get_identity`
## ------------------------------------------------
if (reticulate::py_module_available("geomstats")) {
so3 <- SpecialOrthogonal(n = 3)
so3$get_identity()
}
## ------------------------------------------------
## Method `MatrixLieGroup$lie_bracket`
## ------------------------------------------------
if (reticulate::py_module_available("geomstats")) {
so3 <- SpecialOrthogonal(n = 3)
so3$lie_bracket(diag(0, 3), diag(1, 3))
}
## ------------------------------------------------
## Method `MatrixLieGroup$tangent_translation_map`
## ------------------------------------------------
if (reticulate::py_module_available("geomstats")) {
so3 <- SpecialOrthogonal(n = 3)
tangent_map <- so3$tangent_translation_map(diag(1, 3))
tangent_map(diag(1, 3))
}
## ------------------------------------------------
## Method `MatrixLieGroup$compose`
## ------------------------------------------------
if (reticulate::py_module_available("geomstats")) {
so3 <- SpecialOrthogonal(n = 3)
so3$compose(diag(1, 3), diag(1, 3))
}
## ------------------------------------------------
## Method `MatrixLieGroup$inverse`
## ------------------------------------------------
if (reticulate::py_module_available("geomstats")) {
so3 <- SpecialOrthogonal(n = 3)
so3$inverse(diag(1, 3))
}
Class for N-Fold Product Manifolds
Description
Class for an n
-fold product manifold M^n
. It defines
a manifold as the product manifold of n
copies of a given base
manifold M
.
Super classes
rgeomstats::PythonClass
-> rgeomstats::Manifold
-> NFoldManifold
Methods
Public methods
Inherited methods
rgeomstats::PythonClass$get_python_class()
rgeomstats::PythonClass$set_python_class()
rgeomstats::Manifold$belongs()
rgeomstats::Manifold$is_tangent()
rgeomstats::Manifold$random_point()
rgeomstats::Manifold$random_tangent_vec()
rgeomstats::Manifold$regularize()
rgeomstats::Manifold$set_metric()
rgeomstats::Manifold$to_tangent()
Method new()
The NFoldManifold
class constructor.
Usage
NFoldManifold$new( base_manifold, n_copies, metric = NULL, default_coords_type = "intrinsic", py_cls = NULL )
Arguments
base_manifold
An R6::R6Class specifying the base manifold to copy.
n_copies
An integer value specifying the number of replication of the base manifold.
metric
An R6::R6Class specifying the base metric to use. Defaults to
NULL
which uses the Riemannian metric.default_coords_type
A string specifying the coordinate type. Choices are
"intrinsic"
or"extrinsic"
. Defaults to"intrinsic"
.py_cls
A Python object of class
NFoldManifold
. Defaults toNULL
in which case it is instantiated on the fly using the other input arguments.
Returns
A NFoldManifold
R6::R6Class object.
Examples
if (reticulate::py_module_available("geomstats")) { nfm <- NFoldManifold$new( base_manifold = SPDMatrix(n = 3), n_copies = 3 ) nfm }
Method clone()
The objects of this class are cloneable with this method.
Usage
NFoldManifold$clone(deep = FALSE)
Arguments
deep
Whether to make a deep clone.
Author(s)
Nicolas Guigui
Examples
## ------------------------------------------------
## Method `NFoldManifold$new`
## ------------------------------------------------
if (reticulate::py_module_available("geomstats")) {
nfm <- NFoldManifold$new(
base_manifold = SPDMatrix(n = 3),
n_copies = 3
)
nfm
}
Abstract Class for Open Set Manifolds
Description
Class for manifolds that are open sets of a vector space. In this case, tangent vectors are identified with vectors of the ambient space.
Super classes
rgeomstats::PythonClass
-> rgeomstats::Manifold
-> OpenSet
Public fields
ambient_space
An object of class
VectorSpace
specifying the ambient space.
Methods
Public methods
Inherited methods
rgeomstats::PythonClass$get_python_class()
rgeomstats::PythonClass$set_python_class()
rgeomstats::Manifold$belongs()
rgeomstats::Manifold$is_tangent()
rgeomstats::Manifold$random_point()
rgeomstats::Manifold$random_tangent_vec()
rgeomstats::Manifold$regularize()
rgeomstats::Manifold$set_metric()
rgeomstats::Manifold$to_tangent()
Method new()
The OpenSet
class constructor.
Usage
OpenSet$new(dim, ambient_space, ..., py_cls = NULL)
Arguments
dim
An integer value specifying the dimension of the manifold.
ambient_space
An object of class
VectorSpace
specifying the ambient space....
Extra arguments to be passed to parent class constructors. See
Manifold
class.py_cls
A Python object of class
OpenSet
. Defaults toNULL
in which case it is instantiated on the fly using the other input arguments.
Returns
An object of class OpenSet
.
Method projection()
Project a point in the ambient space onto the manifold.
Usage
OpenSet$projection(point)
Arguments
point
A numeric array of shape
[\dots \times \{\mathrm{dim}\}]
specifying one or more vectors in the ambient space of the manifold.
Returns
A numeric array of the same shape storing the corresponding projections onto the manifold.
Examples
if (reticulate::py_module_available("geomstats")) { spd3 <- SPDMatrix(n = 3) spd3$projection(diag(1, 3)) }
Method clone()
The objects of this class are cloneable with this method.
Usage
OpenSet$clone(deep = FALSE)
Arguments
deep
Whether to make a deep clone.
Author(s)
Nicolas Guigui and Nina Miolane
See Also
SPDMatrix
Examples
## ------------------------------------------------
## Method `OpenSet$projection`
## ------------------------------------------------
if (reticulate::py_module_available("geomstats")) {
spd3 <- SPDMatrix(n = 3)
spd3$projection(diag(1, 3))
}
Abstract Class for Riemannian Metrics
Description
An R6::R6Class object implementing the base
RiemannianMetric
class. This is an abstract class for Riemannian and
pseudo-Riemannian metrics which are the associated Levi-Civita connection
on the tangent bundle.
Super classes
rgeomstats::PythonClass
-> rgeomstats::Connection
-> RiemannianMetric
Public fields
signature
An integer vector specifying the signature of the metric.
Methods
Public methods
Inherited methods
rgeomstats::PythonClass$get_python_class()
rgeomstats::PythonClass$set_python_class()
rgeomstats::Connection$christoffels()
rgeomstats::Connection$curvature()
rgeomstats::Connection$curvature_derivative()
rgeomstats::Connection$directional_curvature()
rgeomstats::Connection$directional_curvature_derivative()
rgeomstats::Connection$exp()
rgeomstats::Connection$geodesic()
rgeomstats::Connection$geodesic_equation()
rgeomstats::Connection$injectivity_radius()
rgeomstats::Connection$ladder_parallel_transport()
rgeomstats::Connection$log()
rgeomstats::Connection$parallel_transport()
Method new()
The RiemannianMetric
class constructor.
Usage
RiemannianMetric$new( dim, shape = NULL, signature = NULL, default_coords_type = "intrinsic", py_cls = NULL )
Arguments
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
.signature
An integer vector specifying the signature of the metric. Defaults to
c(dim, 0L)
.default_coords_type
A string specifying the coordinate type. Choices are
extrensic
orintrinsic
. Defaults tointrinsic
.py_cls
A Python object of class
RiemannianMetric
. Defaults toNULL
in which case it is instantiated on the fly using the other input arguments.
Returns
An object of class RiemannianMetric
.
Method metric_matrix()
Metric matrix at the tangent space at a base point.
Usage
RiemannianMetric$metric_matrix(base_point = NULL)
Arguments
base_point
A numeric array of shape
dim
specifying a point on the manifold. Defaults toNULL
.
Returns
A numeric array of shape dim x dim
storing the inner-product
matrix.
Examples
if (reticulate::py_module_available("geomstats")) { # mt <- SPDMetricLogEuclidean$new(n = 3) # mt$metric_matrix() }
Method cometric_matrix()
Inner co-product matrix at the cotangent space at a base point. This represents the cometric matrix, i.e. the inverse of the metric matrix.
Usage
RiemannianMetric$cometric_matrix(base_point = NULL)
Arguments
base_point
A numeric array of shape
dim
specifying a point on the manifold. Defaults toNULL
.
Returns
A numeric array of shape dim x dim
storing the inverse of the
inner-product matrix.
Examples
if (reticulate::py_module_available("geomstats")) { # mt <- SPDMetricLogEuclidean$new(n = 3) # mt$cometric_matrix() }
Method inner_product_derivative_matrix()
Compute derivative of the inner prod matrix at base point.
Usage
RiemannianMetric$inner_product_derivative_matrix(base_point)
Arguments
base_point
A numeric array of shape
dim
specifying a point on the manifold. Defaults toNULL
.
Returns
A numeric array of shape dim x dim
storing the derivative of
the inverse of the inner-product matrix.
Examples
if (reticulate::py_module_available("geomstats")) { # mt <- SPDMetricLogEuclidean$new(n = 3) # mt$inner_product_derivative_matrix() }
Method inner_product()
Inner product between two tangent vectors at a base point.
Usage
RiemannianMetric$inner_product(tangent_vec_a, tangent_vec_b, base_point)
Arguments
tangent_vec_a
A numeric array of shape
dim
specifying a tangent vector at base point.tangent_vec_b
A numeric array of shape
dim
specifying a tangent vector at base point.base_point
A numeric array of shape
dim
specifying a point on the manifold. Defaults toNULL
.
Returns
A scalar value representing the inner product between the two input tangent vectors at the input base point.
Examples
if (reticulate::py_module_available("geomstats")) { mt <- SPDMetricLogEuclidean$new(n = 3) mt$inner_product(diag(0, 3), diag(1, 3), base_point = diag(1, 3)) }
Method inner_coproduct()
Computes inner coproduct between two cotangent vectors at base point. This is the inner product associated to the cometric matrix.
Usage
RiemannianMetric$inner_coproduct( cotangent_vec_a, cotangent_vec_b, base_point = NULL )
Arguments
cotangent_vec_a
A numeric array of shape
dim
specifying a cotangent vector at base point.cotangent_vec_b
A numeric array of shape
dim
specifying a cotangent vector at base point.base_point
A numeric array of shape
dim
specifying a point on the manifold. Defaults toNULL
.
Returns
A scalar value representing the inner coproduct between the two input cotangent vectors at the input base point.
Examples
if (reticulate::py_module_available("geomstats")) { # mt <- SPDMetricLogEuclidean$new(n = 3) # mt$inner_coproduct(diag(0, 3), diag(1, 3), base_point = diag(1, 3)) }
Method hamiltonian()
Computes the Hamiltonian energy associated to the cometric.
The Hamiltonian at state (q, p)
is defined by
H(q, p) =
\frac{1}{2} \langle p, p \rangle_q,
where \langle \cdot, \cdot
\rangle_q
is the cometric at q
.
Usage
RiemannianMetric$hamiltonian(state)
Arguments
state
A list with two components: (i) a numeric array of shape
dim
specifying the position which is a point on the manifold and (ii) a numeric array of shapedim
specifying the momentum which is a cotangent vector.
Returns
A numeric value representing the Hamiltonian energy at state
.
Examples
if (reticulate::py_module_available("geomstats")) { # mt <- SPDMetricLogEuclidean$new(n = 3) # mt$hamiltonian() }
Method squared_norm()
Computes the square of the norm of a vector. Squared norm of a vector associated to the inner product at the tangent space at a base point.
Usage
RiemannianMetric$squared_norm(vector, base_point = NULL)
Arguments
vector
A numeric array of shape
dim
specifying a vector.base_point
A numeric array of shape
dim
specifying a point on the manifold. Defaults toNULL
.
Returns
A numeric value representing the squared norm of the input vector.
if (reticulate::py_module_available("geomstats")) mt <- SPDMetricLogEuclidean$new(n = 3) mt$squared_norm(diag(0, 3), diag(1, 3))
Method norm()
Computes the norm of a vector associated to the inner product at the tangent space at a base point.
Usage
RiemannianMetric$norm(vector, base_point = NULL)
Arguments
vector
A numeric array of shape
dim
specifying a vector.base_point
A numeric array of shape
dim
specifying a point on the manifold. Defaults toNULL
.
Details
This only works for positive-definite Riemannian metrics and inner products.
Returns
A numeric value representing the norm of the input vector.
if (reticulate::py_module_available("geomstats")) mt <- SPDMetricLogEuclidean$new(n = 3) mt$norm(diag(0, 3), diag(1, 3))
Method normalize()
Normalizes a tangent vector at a given point.
Usage
RiemannianMetric$normalize(vector, base_point = NULL)
Arguments
vector
A numeric array of shape
dim
specifying a vector.base_point
A numeric array of shape
dim
specifying a point on the manifold. Defaults toNULL
.
Returns
A numeric array of shape dim
storing the normalized version of
the input tangent vector.
Examples
if (reticulate::py_module_available("geomstats")) { # mt <- SPDMetricLogEuclidean$new(n = 3) # mt$normalize(diag(2, 3), diag(1, 3)) }
Method random_unit_tangent_vec()
Generates a random unit tangent vector at a given point.
Usage
RiemannianMetric$random_unit_tangent_vec(base_point = NULL, n_vectors = 1)
Arguments
base_point
A numeric array of shape
dim
specifying a point on the manifold. Defaults toNULL
.n_vectors
An integer value specifying the number of vectors to be generated at
base_point
. For vectorization purposes,n_vectors
can be greater than 1 iffbase_point
corresponds to a single point. Defaults to1L
.
Returns
A numeric array of shape c(n_vectors, dim)
storing random unit
tangent vectors at base_point
.
Examples
if (reticulate::py_module_available("geomstats")) { # mt <- SPDMetricLogEuclidean$new(n = 3) # mt$random_unit_tangent_vec(diag(1, 3)) }
Method squared_dist()
Squared geodesic distance between two points.
Usage
RiemannianMetric$squared_dist(point_a, point_b, ...)
Arguments
point_a
A numeric array of shape
dim
on the manifold.point_b
A numeric array of shape
dim
on the manifold....
Extra parameters to be passed to the
$log()
method of the parentConnection
class.
Returns
A numeric value storing the squared geodesic distance between the two input points.
if (reticulate::py_module_available("geomstats")) mt <- SPDMetricLogEuclidean$new(n = 3) mt$squared_dist(diag(1, 3), diag(1, 3))
Method dist()
Geodesic distance between two points.
Usage
RiemannianMetric$dist(point_a, point_b, ...)
Arguments
point_a
A numeric array of shape
dim
on the manifold.point_b
A numeric array of shape
dim
on the manifold....
Extra parameters to be passed to the
$log()
method of the parentConnection
class.
Details
It only works for positive definite Riemannian metrics.
Returns
A numeric value storing the geodesic distance between the two input points.
Examples
if (reticulate::py_module_available("geomstats")) { mt <- SPDMetricLogEuclidean$new(n = 3) mt$dist(diag(1, 3), diag(1, 3)) }
Method dist_broadcast()
Computes the geodesic distance between points.
Usage
RiemannianMetric$dist_broadcast(points_a, points_b)
Arguments
points_a
A numeric array of shape
c(n_samples_a, dim)
specifying a set of points on the manifold.points_b
A numeric array of shape
c(n_samples_b, dim)
specifying a set of points on the manifold.
Details
If n_samples_a == n_samples_b
then dist
is the element-wise
distance result of a point in points_a
with the point from points_b
of the same index. If n_samples_a != n_samples_b
then dist
is the
result of applying geodesic distance for each point from points_a
to
all points from points_b
.
Returns
A numeric array of shape c(n_samples_a, dim)
if n_samples_a == n_samples_b
or of shape c(n_samples_a, n_samples_b, dim)
if
n_samples_a != n_samples_b
storing the geodesic distance between
points in set A and points in set B.
Examples
if (reticulate::py_module_available("geomstats")) { mt <- SPDMetricLogEuclidean$new(n = 3) mt$dist(diag(1, 3), diag(1, 3)) }
Method dist_pairwise()
Computes the pairwise distance between points.
Usage
RiemannianMetric$dist_pairwise(points, n_jobs = 1, ...)
Arguments
points
A numeric array of shape
c(n_samples, dim)
specifying a set of points on the manifold.n_jobs
An integer value specifying the number of cores for parallel computation. Defaults to
1L
....
Extra parameters to be passed tothe
joblib.Parallel
Python class. See joblib documentation for details.
Returns
A numeric matrix of shape c(n_samples, n_samples)
storing the
pairwise geodesic distances between all the points.
Method diameter()
Computes the diameter of set of points on a manifold.
Usage
RiemannianMetric$diameter(points)
Arguments
points
A numeric array of shape
c(n_samples, dim)
specifying a set of points on the manifold.
Details
The diameter is the maximum over all pairwise distances.
Returns
A numeric value representing the largest distance between any two points in the input set.
Method closest_neighbor_index()
Finds the closest neighbor to a point among a set of neighbors.
Usage
RiemannianMetric$closest_neighbor_index(point, neighbors)
Arguments
point
A numeric array of shape
dim
specifying a point on the manifold.neighbors
A numeric array of shape
c(n_neighbors, dim)
specifying a set of neighboring points for the inputpoint
.
Returns
An integer value representing the index of the neighbor in
neighbors
that is closest to point
.
Method normal_basis()
Normalizes the basis with respect to the metric. This corresponds to a renormalization of each basis vector.
Usage
RiemannianMetric$normal_basis(basis, base_point = NULL)
Arguments
basis
A numeric array of shape
c(dim, dim)
specifying a basis.base_point
A numeric array of shape
dim
specifying a point on the manifold. Defaults toNULL
.
Returns
A numeric array of shape c(dim, n, n)
storing the normal basis.
Method sectional_curvature()
Computes the sectional curvature.
Usage
RiemannianMetric$sectional_curvature( tangent_vec_a, tangent_vec_b, base_point = NULL )
Arguments
tangent_vec_a
A numeric array of shape
c(n, n)
specifying a tangent vector atbase_point
.tangent_vec_b
A numeric array of shape
c(n, n)
specifying a tangent vector atbase_point
.base_point
A numeric array of shape
dim
specifying a point on the manifold. Defaults toNULL
.
Details
For two orthonormal tangent vectors x
and y
at a
base point, the sectional curvature is defined by
\langle R(x,
y)x, y \rangle = \langle R_x(y), y \rangle.
For non-orthonormal vectors, it is
\langle R(x, y)x, y \rangle / \\|x \wedge y\\|^2.
See also https://en.wikipedia.org/wiki/Sectional_curvature.
Returns
A numeric value representing the sectional curvature at
base_point
.
Method clone()
The objects of this class are cloneable with this method.
Usage
RiemannianMetric$clone(deep = FALSE)
Arguments
deep
Whether to make a deep clone.
Author(s)
Nina Miolane
Examples
## ------------------------------------------------
## Method `RiemannianMetric$metric_matrix`
## ------------------------------------------------
if (reticulate::py_module_available("geomstats")) {
# mt <- SPDMetricLogEuclidean$new(n = 3)
# mt$metric_matrix()
}
## ------------------------------------------------
## Method `RiemannianMetric$cometric_matrix`
## ------------------------------------------------
if (reticulate::py_module_available("geomstats")) {
# mt <- SPDMetricLogEuclidean$new(n = 3)
# mt$cometric_matrix()
}
## ------------------------------------------------
## Method `RiemannianMetric$inner_product_derivative_matrix`
## ------------------------------------------------
if (reticulate::py_module_available("geomstats")) {
# mt <- SPDMetricLogEuclidean$new(n = 3)
# mt$inner_product_derivative_matrix()
}
## ------------------------------------------------
## Method `RiemannianMetric$inner_product`
## ------------------------------------------------
if (reticulate::py_module_available("geomstats")) {
mt <- SPDMetricLogEuclidean$new(n = 3)
mt$inner_product(diag(0, 3), diag(1, 3), base_point = diag(1, 3))
}
## ------------------------------------------------
## Method `RiemannianMetric$inner_coproduct`
## ------------------------------------------------
if (reticulate::py_module_available("geomstats")) {
# mt <- SPDMetricLogEuclidean$new(n = 3)
# mt$inner_coproduct(diag(0, 3), diag(1, 3), base_point = diag(1, 3))
}
## ------------------------------------------------
## Method `RiemannianMetric$hamiltonian`
## ------------------------------------------------
if (reticulate::py_module_available("geomstats")) {
# mt <- SPDMetricLogEuclidean$new(n = 3)
# mt$hamiltonian()
}
## ------------------------------------------------
## Method `RiemannianMetric$normalize`
## ------------------------------------------------
if (reticulate::py_module_available("geomstats")) {
# mt <- SPDMetricLogEuclidean$new(n = 3)
# mt$normalize(diag(2, 3), diag(1, 3))
}
## ------------------------------------------------
## Method `RiemannianMetric$random_unit_tangent_vec`
## ------------------------------------------------
if (reticulate::py_module_available("geomstats")) {
# mt <- SPDMetricLogEuclidean$new(n = 3)
# mt$random_unit_tangent_vec(diag(1, 3))
}
## ------------------------------------------------
## Method `RiemannianMetric$dist`
## ------------------------------------------------
if (reticulate::py_module_available("geomstats")) {
mt <- SPDMetricLogEuclidean$new(n = 3)
mt$dist(diag(1, 3), diag(1, 3))
}
## ------------------------------------------------
## Method `RiemannianMetric$dist_broadcast`
## ------------------------------------------------
if (reticulate::py_module_available("geomstats")) {
mt <- SPDMetricLogEuclidean$new(n = 3)
mt$dist(diag(1, 3), diag(1, 3))
}
Class for the Manifold of Symmetric Positive Definite Matrices
Description
Class for the manifold of symmetric positive definite (SPD) matrices.
Super classes
rgeomstats::PythonClass
-> rgeomstats::Manifold
-> rgeomstats::OpenSet
-> SPDMatrices
Public fields
n
An integer value specifying the number of rows and columns of the matrices.
Methods
Public methods
Inherited methods
rgeomstats::PythonClass$get_python_class()
rgeomstats::PythonClass$set_python_class()
rgeomstats::Manifold$belongs()
rgeomstats::Manifold$is_tangent()
rgeomstats::Manifold$random_point()
rgeomstats::Manifold$random_tangent_vec()
rgeomstats::Manifold$regularize()
rgeomstats::Manifold$set_metric()
rgeomstats::Manifold$to_tangent()
rgeomstats::OpenSet$projection()
Method new()
The SPDMatrices
class constructor.
Usage
SPDMatrices$new(n, ..., py_cls = NULL)
Arguments
n
An integer value specifying the number of rows and columns of the matrices.
...
Extra arguments to be passed to parent class constructors. See
OpenSet
andManifold
classes.py_cls
A Python object of class
SPDMatrices
. Defaults toNULL
in which case it is instantiated on the fly using the other input arguments.
Returns
An object of class SPDMatrices
.
Examples
if (reticulate::py_module_available("geomstats")) { spd3 <- SPDMatrix(n = 3) spd3 }
Method cholesky_factor()
Computes Cholesky factor for a symmetric positive definite matrix.
Usage
SPDMatrices$cholesky_factor(mat)
Arguments
mat
A numeric array of shape
[\dots \times n \times n]
specifying one or more SPD matrices.
Returns
A numeric array of the same shape storing the corresponding Cholesky factors.
Examples
if (reticulate::py_module_available("geomstats")) { spd3 <- SPDMatrix(n = 3) V <- cbind( c(sqrt(2) / 2, -sqrt(2) / 2, 0), c(sqrt(2) / 2, sqrt(2) / 2, 0), c(0, 0, 1) ) A <- V %*% diag(1:3) %*% t(V) spd3$cholesky_factor(A) }
Method differential_cholesky_factor()
Computes the differential of the Cholesky factor map.
Usage
SPDMatrices$differential_cholesky_factor(tangent_vec, base_point)
Arguments
tangent_vec
A numeric array of shape
[\dots \times n \times n]
specifying one or more symmetric matrices at corresponding base points.base_point
A numeric array of shape
[\dots \times n \times n]
specifying one or more SPD matrices specifying base points for the input tangent vectors.
Returns
A numeric array of shape [\dots \times n \times n]
storing
the differentials of the corresponding Cholesky factor maps.
Examples
if (reticulate::py_module_available("geomstats")) { spd3 <- SPDMatrix(n = 3) V <- cbind( c(sqrt(2) / 2, -sqrt(2) / 2, 0), c(sqrt(2) / 2, sqrt(2) / 2, 0), c(0, 0, 1) ) A <- V %*% diag(1:3) %*% t(V) spd3$differential_cholesky_factor(diag(1, 3), A) }
Method expm()
Computes the matrix exponential for a symmetric matrix.
Usage
SPDMatrices$expm(mat)
Arguments
mat
A numeric array of shape
[\dots \times n \times n]
specifying one or more symmetric matrices.
Returns
A numeric array of the same shape storing the corresponding matrix exponentials.
Examples
if (reticulate::py_module_available("geomstats")) { spd3 <- SPDMatrix(n = 3) spd3$expm(diag(-1, 3)) }
Method differential_exp()
Computes the differential of the matrix exponential.
Usage
SPDMatrices$differential_exp(tangent_vec, base_point)
Arguments
tangent_vec
A numeric array of shape
[\dots \times n \times n]
specifying one or more symmetric matrices at corresponding base points.base_point
A numeric array of shape
[\dots \times n \times n]
specifying one or more SPD matrices specifying base points for the input tangent vectors.
Returns
A numeric array of shape [\dots \times n \times]
storing
the differentials of matrix exponential at corresponding base points
applied to corresponding tangent vectors.
Examples
if (reticulate::py_module_available("geomstats")) { spd3 <- SPDMatrix(n = 3) V <- cbind( c(sqrt(2) / 2, -sqrt(2) / 2, 0), c(sqrt(2) / 2, sqrt(2) / 2, 0), c(0, 0, 1) ) A <- V %*% diag(1:3) %*% t(V) spd3$differential_exp(diag(1, 3), A) }
Method inverse_differential_exp()
Computes the inverse of the differential of the matrix exponential.
Usage
SPDMatrices$inverse_differential_exp(tangent_vec, base_point)
Arguments
tangent_vec
A numeric array of shape
[\dots \times n \times n]
specifying one or more symmetric matrices at corresponding base points.base_point
A numeric array of shape
[\dots \times n \times n]
specifying one or more SPD matrices specifying base points for the input tangent vectors.
Returns
A numeric array of shape [\dots \times n \times]
storing
the inverse of the differentials of matrix exponential at corresponding
base points applied to corresponding tangent vectors.
Examples
if (reticulate::py_module_available("geomstats")) { spd3 <- SPDMatrix(n = 3) V <- cbind( c(sqrt(2) / 2, -sqrt(2) / 2, 0), c(sqrt(2) / 2, sqrt(2) / 2, 0), c(0, 0, 1) ) A <- V %*% diag(1:3) %*% t(V) spd3$inverse_differential_exp(diag(1, 3), A) }
Method logm()
Computes the matrix logarithm of an SPD matrix.
Usage
SPDMatrices$logm(mat)
Arguments
mat
A numeric array of shape
[\dots \times n \times n]
specifying one or more SPD matrices.
Returns
A numeric array of the same shape storing the logarithms of the input SPD matrices.
Examples
if (reticulate::py_module_available("geomstats")) { spd3 <- SPDMatrix(n = 3) spd3$logm(diag(1, 3)) }
Method differential_log()
Computes the differential of the matrix logarithm.
Usage
SPDMatrices$differential_log(tangent_vec, base_point)
Arguments
tangent_vec
A numeric array of shape
[\dots \times n \times n]
specifying one or more symmetric matrices at corresponding base points.base_point
A numeric array of shape
[\dots \times n \times n]
specifying one or more SPD matrices specifying base points for the input tangent vectors.
Returns
A numeric array of shape [\dots \times n \times]
storing
the differentials of matrix logarithm at corresponding base points
applied to corresponding tangent vectors.
Examples
if (reticulate::py_module_available("geomstats")) { spd3 <- SPDMatrix(n = 3) V <- cbind( c(sqrt(2) / 2, -sqrt(2) / 2, 0), c(sqrt(2) / 2, sqrt(2) / 2, 0), c(0, 0, 1) ) A <- V %*% diag(1:3) %*% t(V) spd3$differential_log(diag(1, 3), A) }
Method inverse_differential_log()
Computes the inverse of the differential of the matrix logarithm.
Usage
SPDMatrices$inverse_differential_log(tangent_vec, base_point)
Arguments
tangent_vec
A numeric array of shape
[\dots \times n \times n]
specifying one or more symmetric matrices at corresponding base points.base_point
A numeric array of shape
[\dots \times n \times n]
specifying one or more SPD matrices specifying base points for the input tangent vectors.
Returns
A numeric array of shape [\dots \times n \times]
storing
the inverse of the differentials of matrix logarithm at corresponding
base points applied to corresponding tangent vectors.
Examples
if (reticulate::py_module_available("geomstats")) { spd3 <- SPDMatrix(n = 3) V <- cbind( c(sqrt(2) / 2, -sqrt(2) / 2, 0), c(sqrt(2) / 2, sqrt(2) / 2, 0), c(0, 0, 1) ) A <- V %*% diag(1:3) %*% t(V) spd3$inverse_differential_log(diag(1, 3), A) }
Method powerm()
Computes the matrix power of an SPD matrix.
Usage
SPDMatrices$powerm(mat, power)
Arguments
mat
A numeric array of shape
[\dots \times n \times n]
specifying one or more SPD matrices.power
A numeric value or vector specifying the desired power(s).
Returns
A numeric array of the same shape as mat
storing the
corresponding matrix powers computed as:
A^p = \exp(p \log(A)).
If power
is a vector, a list of such arrays is returned.
Examples
if (reticulate::py_module_available("geomstats")) { spd3 <- SPDMatrix(n = 3) spd3$powerm(diag(1, 3), 2) }
Method differential_power()
Computes the differential of the matrix power function.
Usage
SPDMatrices$differential_power(power, tangent_vec, base_point)
Arguments
power
An integer value specifying the desired power.
tangent_vec
A numeric array of shape
[\dots \times n \times n]
specifying one or more symmetric matrices at corresponding base points.base_point
A numeric array of shape
[\dots \times n \times n]
specifying one or more SPD matrices specifying base points for the input tangent vectors.
Returns
A numeric array of shape [\dots \times n \times]
storing
the differential of the power function
A^p = \exp(p \log(A))
at corresponding base points applied to corresponding tangent vectors.
Examples
if (reticulate::py_module_available("geomstats")) { spd3 <- SPDMatrix(n = 3) V <- cbind( c(sqrt(2) / 2, -sqrt(2) / 2, 0), c(sqrt(2) / 2, sqrt(2) / 2, 0), c(0, 0, 1) ) A <- V %*% diag(1:3) %*% t(V) spd3$differential_power(2, diag(1, 3), A) }
Method inverse_differential_power()
Computes the inverse of the differential of the matrix power function.
Usage
SPDMatrices$inverse_differential_power(power, tangent_vec, base_point)
Arguments
power
An integer value specifying the desired power.
tangent_vec
A numeric array of shape
[\dots \times n \times n]
specifying one or more symmetric matrices at corresponding base points.base_point
A numeric array of shape
[\dots \times n \times n]
specifying one or more SPD matrices specifying base points for the input tangent vectors.
Returns
A numeric array of shape [\dots \times n \times]
storing
the inverse of the differential of the power function
A^p =
\exp(p \log(A))
at corresponding base points applied to corresponding tangent vectors.
Examples
if (reticulate::py_module_available("geomstats")) { spd3 <- SPDMatrix(n = 3) V <- cbind( c(sqrt(2) / 2, -sqrt(2) / 2, 0), c(sqrt(2) / 2, sqrt(2) / 2, 0), c(0, 0, 1) ) A <- V %*% diag(1:3) %*% t(V) spd3$inverse_differential_power(2, diag(1, 3), A) }
Method clone()
The objects of this class are cloneable with this method.
Usage
SPDMatrices$clone(deep = FALSE)
Arguments
deep
Whether to make a deep clone.
Author(s)
Yann Thanwerdas
See Also
Other symmetric positive definite matrix classes:
SPDMatrix()
Examples
## ------------------------------------------------
## Method `SPDMatrices$new`
## ------------------------------------------------
if (reticulate::py_module_available("geomstats")) {
spd3 <- SPDMatrix(n = 3)
spd3
}
## ------------------------------------------------
## Method `SPDMatrices$cholesky_factor`
## ------------------------------------------------
if (reticulate::py_module_available("geomstats")) {
spd3 <- SPDMatrix(n = 3)
V <- cbind(
c(sqrt(2) / 2, -sqrt(2) / 2, 0),
c(sqrt(2) / 2, sqrt(2) / 2, 0),
c(0, 0, 1)
)
A <- V %*% diag(1:3) %*% t(V)
spd3$cholesky_factor(A)
}
## ------------------------------------------------
## Method `SPDMatrices$differential_cholesky_factor`
## ------------------------------------------------
if (reticulate::py_module_available("geomstats")) {
spd3 <- SPDMatrix(n = 3)
V <- cbind(
c(sqrt(2) / 2, -sqrt(2) / 2, 0),
c(sqrt(2) / 2, sqrt(2) / 2, 0),
c(0, 0, 1)
)
A <- V %*% diag(1:3) %*% t(V)
spd3$differential_cholesky_factor(diag(1, 3), A)
}
## ------------------------------------------------
## Method `SPDMatrices$expm`
## ------------------------------------------------
if (reticulate::py_module_available("geomstats")) {
spd3 <- SPDMatrix(n = 3)
spd3$expm(diag(-1, 3))
}
## ------------------------------------------------
## Method `SPDMatrices$differential_exp`
## ------------------------------------------------
if (reticulate::py_module_available("geomstats")) {
spd3 <- SPDMatrix(n = 3)
V <- cbind(
c(sqrt(2) / 2, -sqrt(2) / 2, 0),
c(sqrt(2) / 2, sqrt(2) / 2, 0),
c(0, 0, 1)
)
A <- V %*% diag(1:3) %*% t(V)
spd3$differential_exp(diag(1, 3), A)
}
## ------------------------------------------------
## Method `SPDMatrices$inverse_differential_exp`
## ------------------------------------------------
if (reticulate::py_module_available("geomstats")) {
spd3 <- SPDMatrix(n = 3)
V <- cbind(
c(sqrt(2) / 2, -sqrt(2) / 2, 0),
c(sqrt(2) / 2, sqrt(2) / 2, 0),
c(0, 0, 1)
)
A <- V %*% diag(1:3) %*% t(V)
spd3$inverse_differential_exp(diag(1, 3), A)
}
## ------------------------------------------------
## Method `SPDMatrices$logm`
## ------------------------------------------------
if (reticulate::py_module_available("geomstats")) {
spd3 <- SPDMatrix(n = 3)
spd3$logm(diag(1, 3))
}
## ------------------------------------------------
## Method `SPDMatrices$differential_log`
## ------------------------------------------------
if (reticulate::py_module_available("geomstats")) {
spd3 <- SPDMatrix(n = 3)
V <- cbind(
c(sqrt(2) / 2, -sqrt(2) / 2, 0),
c(sqrt(2) / 2, sqrt(2) / 2, 0),
c(0, 0, 1)
)
A <- V %*% diag(1:3) %*% t(V)
spd3$differential_log(diag(1, 3), A)
}
## ------------------------------------------------
## Method `SPDMatrices$inverse_differential_log`
## ------------------------------------------------
if (reticulate::py_module_available("geomstats")) {
spd3 <- SPDMatrix(n = 3)
V <- cbind(
c(sqrt(2) / 2, -sqrt(2) / 2, 0),
c(sqrt(2) / 2, sqrt(2) / 2, 0),
c(0, 0, 1)
)
A <- V %*% diag(1:3) %*% t(V)
spd3$inverse_differential_log(diag(1, 3), A)
}
## ------------------------------------------------
## Method `SPDMatrices$powerm`
## ------------------------------------------------
if (reticulate::py_module_available("geomstats")) {
spd3 <- SPDMatrix(n = 3)
spd3$powerm(diag(1, 3), 2)
}
## ------------------------------------------------
## Method `SPDMatrices$differential_power`
## ------------------------------------------------
if (reticulate::py_module_available("geomstats")) {
spd3 <- SPDMatrix(n = 3)
V <- cbind(
c(sqrt(2) / 2, -sqrt(2) / 2, 0),
c(sqrt(2) / 2, sqrt(2) / 2, 0),
c(0, 0, 1)
)
A <- V %*% diag(1:3) %*% t(V)
spd3$differential_power(2, diag(1, 3), A)
}
## ------------------------------------------------
## Method `SPDMatrices$inverse_differential_power`
## ------------------------------------------------
if (reticulate::py_module_available("geomstats")) {
spd3 <- SPDMatrix(n = 3)
V <- cbind(
c(sqrt(2) / 2, -sqrt(2) / 2, 0),
c(sqrt(2) / 2, sqrt(2) / 2, 0),
c(0, 0, 1)
)
A <- V %*% diag(1:3) %*% t(V)
spd3$inverse_differential_power(2, diag(1, 3), A)
}
Class for the Manifold of Symmetric Positive Definite Matrices
Description
This function generates an instance of the class for the manifold of
symmetric positive definite matrices \mathrm{SPD}(n)
.
Usage
SPDMatrix(n, ...)
Arguments
n |
An integer value specifying the number of rows and columns of the matrices. |
... |
Extra arguments to be passed to parent class constructors. See
|
Value
An object of class SPDMatrices
.
Author(s)
Yann Thanwerdas
See Also
Other symmetric positive definite matrix classes:
SPDMatrices
Examples
if (reticulate::py_module_available("geomstats")) {
spd3 <- SPDMatrix(n = 3)
spd3
}
Class for the Affine Metric on the Manifold of Symmetric Positive Definite Matrices
Description
An R6::R6Class object implementing the SPDMetricAffine
class. This is the class for the affine-invariant metric on the SPD
manifold (Thanwerdas and Pennec 2019).
Super classes
rgeomstats::PythonClass
-> rgeomstats::Connection
-> rgeomstats::RiemannianMetric
-> SPDMetricAffine
Public fields
n
An integer value specifying the shape of the matrices:
n \times n
.power_affine
An integer value specifying the power transformation of the classical SPD metric.
Methods
Public methods
Inherited methods
rgeomstats::PythonClass$get_python_class()
rgeomstats::PythonClass$set_python_class()
rgeomstats::Connection$christoffels()
rgeomstats::Connection$curvature()
rgeomstats::Connection$curvature_derivative()
rgeomstats::Connection$directional_curvature()
rgeomstats::Connection$directional_curvature_derivative()
rgeomstats::Connection$exp()
rgeomstats::Connection$geodesic()
rgeomstats::Connection$geodesic_equation()
rgeomstats::Connection$injectivity_radius()
rgeomstats::Connection$ladder_parallel_transport()
rgeomstats::Connection$log()
rgeomstats::Connection$parallel_transport()
rgeomstats::RiemannianMetric$closest_neighbor_index()
rgeomstats::RiemannianMetric$cometric_matrix()
rgeomstats::RiemannianMetric$diameter()
rgeomstats::RiemannianMetric$dist()
rgeomstats::RiemannianMetric$dist_broadcast()
rgeomstats::RiemannianMetric$dist_pairwise()
rgeomstats::RiemannianMetric$hamiltonian()
rgeomstats::RiemannianMetric$inner_coproduct()
rgeomstats::RiemannianMetric$inner_product()
rgeomstats::RiemannianMetric$inner_product_derivative_matrix()
rgeomstats::RiemannianMetric$metric_matrix()
rgeomstats::RiemannianMetric$norm()
rgeomstats::RiemannianMetric$normal_basis()
rgeomstats::RiemannianMetric$normalize()
rgeomstats::RiemannianMetric$random_unit_tangent_vec()
rgeomstats::RiemannianMetric$sectional_curvature()
rgeomstats::RiemannianMetric$squared_dist()
rgeomstats::RiemannianMetric$squared_norm()
Method new()
The SPDMetricAffine
class constructor.
Usage
SPDMetricAffine$new(n, power_affine = 1, py_cls = NULL)
Arguments
n
An integer value specifying the shape of the matrices:
n \times n
.power_affine
An integer value specifying the power transformation of the classical SPD metric. Defaults to
1L
.py_cls
A Python object of class
SPDMetricAffine
. Defaults toNULL
in which case it is instantiated on the fly using the other input arguments.
Returns
An object of class SPDMetricAffine
.
Method clone()
The objects of this class are cloneable with this method.
Usage
SPDMetricAffine$clone(deep = FALSE)
Arguments
deep
Whether to make a deep clone.
Author(s)
Yann Thanwerdas
References
Thanwerdas Y, Pennec X (2019). “Is affine-invariance well defined on SPD matrices? A principled continuum of metrics.” In International Conference on Geometric Science of Information, 502–510. Springer.
Class for the Bures-Wasserstein Metric on the Manifold of Symmetric Positive Definite Matrices
Description
An R6::R6Class object implementing the
SPDMetricBuresWasserstein
class. This is the class for the
Bures-Wasserstein metric on the SPD manifold
(Bhatia et al. 2019; Malagò et al. 2018).
Super classes
rgeomstats::PythonClass
-> rgeomstats::Connection
-> rgeomstats::RiemannianMetric
-> SPDMetricBuresWasserstein
Public fields
n
An integer value specifying the shape of the matrices:
n \times n
.
Methods
Public methods
Inherited methods
rgeomstats::PythonClass$get_python_class()
rgeomstats::PythonClass$set_python_class()
rgeomstats::Connection$christoffels()
rgeomstats::Connection$curvature()
rgeomstats::Connection$curvature_derivative()
rgeomstats::Connection$directional_curvature()
rgeomstats::Connection$directional_curvature_derivative()
rgeomstats::Connection$exp()
rgeomstats::Connection$geodesic()
rgeomstats::Connection$geodesic_equation()
rgeomstats::Connection$injectivity_radius()
rgeomstats::Connection$ladder_parallel_transport()
rgeomstats::Connection$log()
rgeomstats::Connection$parallel_transport()
rgeomstats::RiemannianMetric$closest_neighbor_index()
rgeomstats::RiemannianMetric$cometric_matrix()
rgeomstats::RiemannianMetric$diameter()
rgeomstats::RiemannianMetric$dist()
rgeomstats::RiemannianMetric$dist_broadcast()
rgeomstats::RiemannianMetric$dist_pairwise()
rgeomstats::RiemannianMetric$hamiltonian()
rgeomstats::RiemannianMetric$inner_coproduct()
rgeomstats::RiemannianMetric$inner_product()
rgeomstats::RiemannianMetric$inner_product_derivative_matrix()
rgeomstats::RiemannianMetric$metric_matrix()
rgeomstats::RiemannianMetric$norm()
rgeomstats::RiemannianMetric$normal_basis()
rgeomstats::RiemannianMetric$normalize()
rgeomstats::RiemannianMetric$random_unit_tangent_vec()
rgeomstats::RiemannianMetric$sectional_curvature()
rgeomstats::RiemannianMetric$squared_dist()
rgeomstats::RiemannianMetric$squared_norm()
Method new()
The SPDMetricBuresWasserstein
class constructor.
Usage
SPDMetricBuresWasserstein$new(n, py_cls = NULL)
Arguments
n
An integer value specifying the shape of the matrices:
n \times n
.py_cls
A Python object of class
SPDMetricBuresWasserstein
. Defaults toNULL
in which case it is instantiated on the fly using the other input arguments.
Returns
An object of class SPDMetricBuresWasserstein
.
Method clone()
The objects of this class are cloneable with this method.
Usage
SPDMetricBuresWasserstein$clone(deep = FALSE)
Arguments
deep
Whether to make a deep clone.
Author(s)
Yann Thanwerdas
References
Bhatia R, Jain T, Lim Y (2019).
“On the Bures–Wasserstein distance between positive definite matrices.”
Expositiones Mathematicae, 37(2), 165–191.
Malagò L, Montrucchio L, Pistone G (2018).
“Wasserstein Riemannian geometry of Gaussian densities.”
Information Geometry, 1(2), 137–179.
Class for the Euclidean Metric on the Manifold of Symmetric Positive Definite Matrices
Description
An R6::R6Class object implementing the SPDMetricEuclidean
class. This is the class for the Euclidean metric on the SPD manifold.
Super classes
rgeomstats::PythonClass
-> rgeomstats::Connection
-> rgeomstats::RiemannianMetric
-> SPDMetricEuclidean
Public fields
n
An integer value specifying the shape of the matrices:
n \times n
.power_euclidean
An integer value specifying the power transformation of the classical SPD metric.
Methods
Public methods
Inherited methods
rgeomstats::PythonClass$get_python_class()
rgeomstats::PythonClass$set_python_class()
rgeomstats::Connection$christoffels()
rgeomstats::Connection$curvature()
rgeomstats::Connection$curvature_derivative()
rgeomstats::Connection$directional_curvature()
rgeomstats::Connection$directional_curvature_derivative()
rgeomstats::Connection$exp()
rgeomstats::Connection$geodesic()
rgeomstats::Connection$geodesic_equation()
rgeomstats::Connection$injectivity_radius()
rgeomstats::Connection$ladder_parallel_transport()
rgeomstats::Connection$log()
rgeomstats::Connection$parallel_transport()
rgeomstats::RiemannianMetric$closest_neighbor_index()
rgeomstats::RiemannianMetric$cometric_matrix()
rgeomstats::RiemannianMetric$diameter()
rgeomstats::RiemannianMetric$dist()
rgeomstats::RiemannianMetric$dist_broadcast()
rgeomstats::RiemannianMetric$dist_pairwise()
rgeomstats::RiemannianMetric$hamiltonian()
rgeomstats::RiemannianMetric$inner_coproduct()
rgeomstats::RiemannianMetric$inner_product()
rgeomstats::RiemannianMetric$inner_product_derivative_matrix()
rgeomstats::RiemannianMetric$metric_matrix()
rgeomstats::RiemannianMetric$norm()
rgeomstats::RiemannianMetric$normal_basis()
rgeomstats::RiemannianMetric$normalize()
rgeomstats::RiemannianMetric$random_unit_tangent_vec()
rgeomstats::RiemannianMetric$sectional_curvature()
rgeomstats::RiemannianMetric$squared_dist()
rgeomstats::RiemannianMetric$squared_norm()
Method new()
The SPDMetricEuclidean
class constructor.
Usage
SPDMetricEuclidean$new(n, power_euclidean = 1, py_cls = NULL)
Arguments
n
An integer value specifying the shape of the matrices:
n \times n
.power_euclidean
An integer value specifying the power transformation of the classical SPD metric. Defaults to
1L
.py_cls
A Python object of class
SPDMetricEuclidean
. Defaults toNULL
in which case it is instantiated on the fly using the other input arguments.
Returns
An object of class SPDMetricEuclidean
.
Method clone()
The objects of this class are cloneable with this method.
Usage
SPDMetricEuclidean$clone(deep = FALSE)
Arguments
deep
Whether to make a deep clone.
Author(s)
Yann Thanwerdas
Class for the log-Euclidean Metric on the Manifold of Symmetric Positive Definite Matrices
Description
An R6::R6Class object implementing the
SPDMetricLogEuclidean
class. This is the class for the
log-Euclidean metric on the SPD manifold.
Super classes
rgeomstats::PythonClass
-> rgeomstats::Connection
-> rgeomstats::RiemannianMetric
-> SPDMetricLogEuclidean
Public fields
n
An integer value specifying the shape of the matrices:
n \times n
.
Methods
Public methods
Inherited methods
rgeomstats::PythonClass$get_python_class()
rgeomstats::PythonClass$set_python_class()
rgeomstats::Connection$christoffels()
rgeomstats::Connection$curvature()
rgeomstats::Connection$curvature_derivative()
rgeomstats::Connection$directional_curvature()
rgeomstats::Connection$directional_curvature_derivative()
rgeomstats::Connection$exp()
rgeomstats::Connection$geodesic()
rgeomstats::Connection$geodesic_equation()
rgeomstats::Connection$injectivity_radius()
rgeomstats::Connection$ladder_parallel_transport()
rgeomstats::Connection$log()
rgeomstats::Connection$parallel_transport()
rgeomstats::RiemannianMetric$closest_neighbor_index()
rgeomstats::RiemannianMetric$cometric_matrix()
rgeomstats::RiemannianMetric$diameter()
rgeomstats::RiemannianMetric$dist()
rgeomstats::RiemannianMetric$dist_broadcast()
rgeomstats::RiemannianMetric$dist_pairwise()
rgeomstats::RiemannianMetric$hamiltonian()
rgeomstats::RiemannianMetric$inner_coproduct()
rgeomstats::RiemannianMetric$inner_product()
rgeomstats::RiemannianMetric$inner_product_derivative_matrix()
rgeomstats::RiemannianMetric$metric_matrix()
rgeomstats::RiemannianMetric$norm()
rgeomstats::RiemannianMetric$normal_basis()
rgeomstats::RiemannianMetric$normalize()
rgeomstats::RiemannianMetric$random_unit_tangent_vec()
rgeomstats::RiemannianMetric$sectional_curvature()
rgeomstats::RiemannianMetric$squared_dist()
rgeomstats::RiemannianMetric$squared_norm()
Method new()
The SPDMetricLogEuclidean
class constructor.
Usage
SPDMetricLogEuclidean$new(n, py_cls = NULL)
Arguments
n
An integer value specifying the shape of the matrices:
n \times n
.py_cls
A Python object of class
SPDMetricLogEuclidean
. Defaults toNULL
in which case it is instantiated on the fly using the other input arguments.
Returns
An object of class SPDMetricLogEuclidean
.
Examples
if (reticulate::py_module_available("geomstats")) { mt <- SPDMetricLogEuclidean$new(n = 3) mt }
Method clone()
The objects of this class are cloneable with this method.
Usage
SPDMetricLogEuclidean$clone(deep = FALSE)
Arguments
deep
Whether to make a deep clone.
Author(s)
Yann Thanwerdas
Examples
## ------------------------------------------------
## Method `SPDMetricLogEuclidean$new`
## ------------------------------------------------
if (reticulate::py_module_available("geomstats")) {
mt <- SPDMetricLogEuclidean$new(n = 3)
mt
}
Class for the Special Orthogonal Group
Description
This function generates an instance of the class for the special orthogonal
group \mathrm{SO}(n)
.
Usage
SpecialOrthogonal(n, point_type = "matrix", epsilon = 0, ..., py_cls = NULL)
Arguments
n |
An integer value representing the shape of the |
point_type |
A character string specifying how elements of the group
should be represented. Choices are either |
epsilon |
A numeric value specifying the precision to use for
calculations involving potential division by 0 in rotations. Defaults to
|
... |
Extra arguments to be passed to parent class constructors. See
|
py_cls |
A Python object of class |
Value
An object of class SpecialOrthogonal
which is an instance of one
of three different R6::R6Class
depending on the values of the input
arguments. Specifically:
if
n == 2
andpoint_type == "vector"
, then the user wants to instantiate the space of 2D rotations in vector representations and thus the output is an instance of theSpecialOrthogonal2Vectors
class;if
n == 3
andpoint_type == "vector"
, then the user wants to instantiate the space of 3D rotations in vector representations and thus the output is an instance of theSpecialOrthogonal3Vectors
class;in all other cases, either the user is dealing with rotations in matrix representation or with rotations in dimension greater than 3 and thus the output is an instance of the
SpecialOrthogonalMatrices
class.
Author(s)
Nicolas Guigui and Nina Miolane
See Also
Other special orthogonal classes:
SpecialOrthogonal2Vectors
,
SpecialOrthogonal3Vectors
,
SpecialOrthogonalMatrices
Examples
if (reticulate::py_module_available("geomstats")) {
so3 <- SpecialOrthogonal(n = 3)
so3
}
Abstract Class for the 2D Special Orthogonal Group in Vector Representation
Description
Class for the special orthogonal group \mathrm{SO}(2)
in
vector form, i.e. the Lie group of planar rotations. This class is
specific to the vector representation of rotations. For the matrix
representation, use the SpecialOrthogonal
class and set n = 2
.
Super classes
rgeomstats::PythonClass
-> rgeomstats::Manifold
-> rgeomstats::LieGroup
-> rgeomstats::SpecialOrthogonalVectors
-> SpecialOrthogonal2Vectors
Methods
Public methods
Inherited methods
rgeomstats::PythonClass$get_python_class()
rgeomstats::PythonClass$set_python_class()
rgeomstats::Manifold$belongs()
rgeomstats::Manifold$is_tangent()
rgeomstats::Manifold$random_point()
rgeomstats::Manifold$random_tangent_vec()
rgeomstats::Manifold$regularize()
rgeomstats::Manifold$set_metric()
rgeomstats::Manifold$to_tangent()
rgeomstats::LieGroup$add_metric()
rgeomstats::LieGroup$compose()
rgeomstats::LieGroup$exp()
rgeomstats::LieGroup$exp_from_identity()
rgeomstats::LieGroup$exp_not_from_identity()
rgeomstats::LieGroup$get_identity()
rgeomstats::LieGroup$inverse()
rgeomstats::LieGroup$jacobian_translation()
rgeomstats::LieGroup$lie_bracket()
rgeomstats::LieGroup$log()
rgeomstats::LieGroup$log_from_identity()
rgeomstats::LieGroup$log_not_from_identity()
rgeomstats::LieGroup$tangent_translation_map()
rgeomstats::SpecialOrthogonalVectors$projection()
rgeomstats::SpecialOrthogonalVectors$regularize_tangent_vec()
rgeomstats::SpecialOrthogonalVectors$regularize_tangent_vec_at_identity()
rgeomstats::SpecialOrthogonalVectors$skew_matrix_from_vector()
rgeomstats::SpecialOrthogonalVectors$vector_from_skew_matrix()
Method new()
The SpecialOrthogonal2Vectors
class constructor.
Usage
SpecialOrthogonal2Vectors$new(epsilon = 0, py_cls = NULL)
Arguments
epsilon
A numeric value specifying the precision to use for calculations involving potential division by 0 in rotations. Defaults to
0
.py_cls
A Python object of class
SpecialOrthogonal2Vectors
. Defaults toNULL
in which case it is instantiated on the fly using the other input arguments.
Returns
An object of class SpecialOrthogonal2Vectors
.
Method rotation_vector_from_matrix()
Converts rotation matrix (in 2D) to rotation vector
(axis-angle) getting the angle through the atan2()
function.
Usage
SpecialOrthogonal2Vectors$rotation_vector_from_matrix(rot_mat)
Arguments
rot_mat
A numeric array of shape
[\dots \times 2 \times 2]
specifying one or more 2D rotation matrices.
Returns
A numeric array of shape [\dots \times 1]
storing the
corresponding axis-angle representations.
Examples
if (reticulate::py_module_available("geomstats")) { so2 <- SpecialOrthogonal(n = 2, point_type = "vector") so2$rotation_vector_from_matrix(diag(1, 2)) }
Method matrix_from_rotation_vector()
Convert a 2D rotation from vector to matrix representation.
Usage
SpecialOrthogonal2Vectors$matrix_from_rotation_vector(rot_vec)
Arguments
rot_vec
A numeric array of shape
... \times 1
specifying one or more 2D rotations in vector representation.
Returns
A numeric array of shape ... \times 2 \times 2
storing the
corresponding 2D rotation matrices.
Examples
if (reticulate::py_module_available("geomstats")) { so2 <- SpecialOrthogonal(n = 2, point_type = "vector") so2$matrix_from_rotation_vector(array(0)) }
Method random_uniform()
Samples in \mathrm{SO}(2)
from a uniform distribution.
Usage
SpecialOrthogonal2Vectors$random_uniform(n_samples = 1)
Arguments
n_samples
An integer value specifying the sample size. Defaults to
1L
.
Returns
A numeric array of shape ... \times 1
storing a sample of
2D rotations in axis-angle representation uniformly sampled in
\mathrm{SO}(2)
.
Method clone()
The objects of this class are cloneable with this method.
Usage
SpecialOrthogonal2Vectors$clone(deep = FALSE)
Arguments
deep
Whether to make a deep clone.
Author(s)
Nicolas Guigui and Nina Miolane
See Also
Other special orthogonal classes:
SpecialOrthogonal3Vectors
,
SpecialOrthogonalMatrices
,
SpecialOrthogonal()
Examples
## ------------------------------------------------
## Method `SpecialOrthogonal2Vectors$rotation_vector_from_matrix`
## ------------------------------------------------
if (reticulate::py_module_available("geomstats")) {
so2 <- SpecialOrthogonal(n = 2, point_type = "vector")
so2$rotation_vector_from_matrix(diag(1, 2))
}
## ------------------------------------------------
## Method `SpecialOrthogonal2Vectors$matrix_from_rotation_vector`
## ------------------------------------------------
if (reticulate::py_module_available("geomstats")) {
so2 <- SpecialOrthogonal(n = 2, point_type = "vector")
so2$matrix_from_rotation_vector(array(0))
}
Abstract Class for the 3D Special Orthogonal Group in Vector Representation
Description
Class for the special orthogonal group \mathrm{SO}(3)
in
vector form, i.e. the Lie group of 3D rotations. This class is specific to
the vector representation of rotations. For the matrix representation, use
the SpecialOrthogonal
class and set n = 3
.
Super classes
rgeomstats::PythonClass
-> rgeomstats::Manifold
-> rgeomstats::LieGroup
-> rgeomstats::SpecialOrthogonalVectors
-> SpecialOrthogonal3Vectors
Public fields
bi_invariant_metric
An object of class
BiInvariantMetric
specifying the metric to equip the manifold with.
Methods
Public methods
-
SpecialOrthogonal3Vectors$quaternion_from_tait_bryan_angles()
-
SpecialOrthogonal3Vectors$rotation_vector_from_tait_bryan_angles()
-
SpecialOrthogonal3Vectors$tait_bryan_angles_from_quaternion()
-
SpecialOrthogonal3Vectors$tait_bryan_angles_from_rotation_vector()
Inherited methods
rgeomstats::PythonClass$get_python_class()
rgeomstats::PythonClass$set_python_class()
rgeomstats::Manifold$belongs()
rgeomstats::Manifold$is_tangent()
rgeomstats::Manifold$random_point()
rgeomstats::Manifold$random_tangent_vec()
rgeomstats::Manifold$regularize()
rgeomstats::Manifold$set_metric()
rgeomstats::Manifold$to_tangent()
rgeomstats::LieGroup$add_metric()
rgeomstats::LieGroup$compose()
rgeomstats::LieGroup$exp()
rgeomstats::LieGroup$exp_from_identity()
rgeomstats::LieGroup$exp_not_from_identity()
rgeomstats::LieGroup$get_identity()
rgeomstats::LieGroup$inverse()
rgeomstats::LieGroup$jacobian_translation()
rgeomstats::LieGroup$lie_bracket()
rgeomstats::LieGroup$log()
rgeomstats::LieGroup$log_from_identity()
rgeomstats::LieGroup$log_not_from_identity()
rgeomstats::LieGroup$tangent_translation_map()
rgeomstats::SpecialOrthogonalVectors$projection()
rgeomstats::SpecialOrthogonalVectors$regularize_tangent_vec()
rgeomstats::SpecialOrthogonalVectors$regularize_tangent_vec_at_identity()
rgeomstats::SpecialOrthogonalVectors$skew_matrix_from_vector()
rgeomstats::SpecialOrthogonalVectors$vector_from_skew_matrix()
Method new()
The SpecialOrthogonal3Vectors
class constructor.
Usage
SpecialOrthogonal3Vectors$new(epsilon = 0, py_cls = NULL)
Arguments
epsilon
A numeric value specifying the precision to use for calculations involving potential division by 0 in rotations. Defaults to
0
.py_cls
A Python object of class
SpecialOrthogonal3Vectors
. Defaults toNULL
in which case it is instantiated on the fly using the other input arguments.
Returns
An object of class SpecialOrthogonal3Vectors
.
Method rotation_vector_from_matrix()
Converts a 3D rotation from matrix to axis-angle representation.
Usage
SpecialOrthogonal3Vectors$rotation_vector_from_matrix(rot_mat)
Arguments
rot_mat
A numeric array of shape
[\dots \times 3 \times 3]
specifying one or more 3D rotation matrices.
Details
Gets the angle \theta
through the trace of the rotation
matrix. The eigenvalues are:
\{ 1, \cos \theta + i \sin \theta,
\cos \theta - i \sin \theta \}
so that
\mathrm{trace} = 1 + 2
\cos \theta, \{ -1 \leq \mathrm{trace} \leq 3 \}.
The rotation vector is the vector associated to the skew-symmetric matrix
S_r = \frac{\theta}{(2 \sin \theta) (R - R^T)}.
For the edge case where the angle is close to \pi
, the rotation
vector (up to sign) is derived by using the following equality (see the
axis-angle representation on Wikipedia):
\mathrm{outer}(r, r) =
\frac{1}{2} (R + I_3).
In nD, the rotation vector stores the n(n-1)/2
values of the
skew-symmetric matrix representing the rotation.
Returns
A numeric array of shape [\dots \times 3]
storing the
corresponding axis-angle representations.
Examples
if (reticulate::py_module_available("geomstats")) { so3 <- SpecialOrthogonal(n = 3, point_type = "vector") so3$rotation_vector_from_matrix(diag(1, 3)) }
Method matrix_from_rotation_vector()
Converts a 3D rotation from axis-angle to matrix representation.
Usage
SpecialOrthogonal3Vectors$matrix_from_rotation_vector(rot_vec)
Arguments
rot_vec
A numeric array of shape
[\dots \times 3]
specifying one or more 3D rotations in axis-angle representation.
Returns
A numeric array of shape [\dots \times 3 \times 3]
storing
the corresponding matrix representations.
Examples
if (reticulate::py_module_available("geomstats")) { so3 <- SpecialOrthogonal(n = 3, point_type = "vector") so3$matrix_from_rotation_vector(rep(0, 3)) }
Method quaternion_from_matrix()
Converts a 3D rotation from matrix to unit quaternion representation.
Usage
SpecialOrthogonal3Vectors$quaternion_from_matrix(rot_mat)
Arguments
rot_mat
A numeric array of shape
[\dots \times 3 \times 3]
specifying one or more 3D rotations in matrix representation.
Returns
A numeric array of shape [\dots \times 4]
storing the
corresponding unit quaternion representations.
Examples
if (reticulate::py_module_available("geomstats")) { so3 <- SpecialOrthogonal(n = 3, point_type = "vector") so3$quaternion_from_matrix(diag(1, 3)) }
Method quaternion_from_rotation_vector()
Converts a 3D rotation from axis-angle to unit quaternion representation.
Usage
SpecialOrthogonal3Vectors$quaternion_from_rotation_vector(rot_vec)
Arguments
rot_vec
A numeric array of shape
[\dots \times 3]
specifying one or more 3D rotations in axis-angle representation.
Returns
A numeric array of shape [\dots \times 4]
storing the
corresponding unit quaternion representations.
Examples
if (reticulate::py_module_available("geomstats")) { so3 <- SpecialOrthogonal(n = 3, point_type = "vector") so3$quaternion_from_rotation_vector(rep(0, 3)) }
Method rotation_vector_from_quaternion()
Converts a 3D rotation from unit quaternion to axis-angle representation.
Usage
SpecialOrthogonal3Vectors$rotation_vector_from_quaternion(quaternion)
Arguments
quaternion
A numeric array of shape
[\dots \times 4]
specifying one or more 3D rotations in unit quaternion representation.
Returns
A numeric array of shape [\dots \times 3]
storing the
corresponding axis-angle representations.
Examples
if (reticulate::py_module_available("geomstats")) { so3 <- SpecialOrthogonal(n = 3, point_type = "vector") so3$rotation_vector_from_quaternion(array(c(1, rep(0, 3)))) }
Method matrix_from_quaternion()
Converts a 3D rotation from unit quaternion to matrix representation.
Usage
SpecialOrthogonal3Vectors$matrix_from_quaternion(quaternion)
Arguments
quaternion
A numeric array of shape
[\dots \times 4]
specifying one or more 3D rotations in unit quaternion representation.
Returns
A numeric array of shape [\dots \times 3 \times 3]
storing
the corresponding matrix representations.
Examples
if (reticulate::py_module_available("geomstats")) { so3 <- SpecialOrthogonal(n = 3, point_type = "vector") so3$matrix_from_quaternion(c(1, rep(0, 3))) }
Method matrix_from_tait_bryan_angles()
Converts a 3D rotation from Tait-Bryan angle to matrix representation.
Usage
SpecialOrthogonal3Vectors$matrix_from_tait_bryan_angles( tait_bryan_angles, extrinsic_or_intrinsic = "extrinsic", order = "zyx" )
Arguments
tait_bryan_angles
A numeric array of shape
[\dots \times 3]
specifying one or more 3D rotations in Tait-Bryan angle representation.extrinsic_or_intrinsic
A character string specifying the coordinate frame in which the Tait-Bryan angles are expressed. Choices are either
"extrinsic"
(fixed frame) or"intrinsic"
(moving frame). Defaults to"extrinsic"
.order
A character string specifying the order of the rotation composition around the three axes of the chosen coordinate frame. Choices are either
"xyz"
or"zyx"
. Defaults to"zyx"
.
Details
Converts a rotation given in terms of the Tait-Bryan angles
[angle_1, angle_2, angle_3]
in extrinsic (fixed) or intrinsic
(moving) coordinate frame in the corresponding matrix representation.
If the order is zyx
, into the rotation matrix rot_mat = X(angle_1) Y(angle_2) Z(angle_3)
where:
-
X(angle_1)
is a rotation of angleangle_1
around axisx
; -
Y(angle_2)
is a rotation of angleangle_2
around axisy
; -
Z(angle_3)
is a rotation of angleangle_3
around axisz
.
Exchanging 'extrinsic'
and 'intrinsic'
amounts to exchanging the
order.
Returns
A numeric array of shape [\dots \times 3 \times 3]
storing
the corresponding matrix representations.
Examples
if (reticulate::py_module_available("geomstats")) { so3 <- SpecialOrthogonal(n = 3, point_type = "vector") so3$matrix_from_tait_bryan_angles(rep(0, 3)) }
Method tait_bryan_angles_from_matrix()
Converts a 3D rotation from matrix to Tait-Bryan angle representation.
Usage
SpecialOrthogonal3Vectors$tait_bryan_angles_from_matrix( rot_mat, extrinsic_or_intrinsic = "extrinsic", order = "zyx" )
Arguments
rot_mat
A numeric array of shape
[\dots \times 3 \times 3]
specifying one or more 3D rotations in matrix representation.extrinsic_or_intrinsic
A character string specifying the coordinate frame in which the Tait-Bryan angles are expressed. Choices are either
"extrinsic"
(fixed frame) or"intrinsic"
(moving frame). Defaults to"extrinsic"
.order
A character string specifying the order of the rotation composition around the three axes of the chosen coordinate frame. Choices are either
"xyz"
or"zyx"
. Defaults to"zyx"
.
Details
Converts a rotation given in matrix representation into its
Tait-Bryan angle representation [angle_1, angle_2, angle_3]
in
extrinsic (fixed) or intrinsic (moving) coordinate frame in the
corresponding matrix representation. If the order is zyx
, into the
rotation matrix rot_mat = X(angle_1) Y(angle_2) Z(angle_3)
where:
-
X(angle_1)
is a rotation of angleangle_1
around axisx
; -
Y(angle_2)
is a rotation of angleangle_2
around axisy
; -
Z(angle_3)
is a rotation of angleangle_3
around axisz
.
Exchanging 'extrinsic'
and 'intrinsic'
amounts to exchanging the
order.
Returns
A numeric array of shape [\dots \times 3]
storing the
corresponding Tait-Bryan angle representations.
Examples
if (reticulate::py_module_available("geomstats")) { so3 <- SpecialOrthogonal(n = 3, point_type = "vector") so3$tait_bryan_angles_from_matrix(diag(1, 3)) }
Method quaternion_from_tait_bryan_angles()
Converts a 3D rotation from Tait-Bryan angle to unit quaternion representation.
Usage
SpecialOrthogonal3Vectors$quaternion_from_tait_bryan_angles( tait_bryan_angles, extrinsic_or_intrinsic = "extrinsic", order = "zyx" )
Arguments
tait_bryan_angles
A numeric array of shape
[\dots \times 3]
specifying one or more 3D rotations in Tait-Bryan angle representation.extrinsic_or_intrinsic
A character string specifying the coordinate frame in which the Tait-Bryan angles are expressed. Choices are either
"extrinsic"
(fixed frame) or"intrinsic"
(moving frame). Defaults to"extrinsic"
.order
A character string specifying the order of the rotation composition around the three axes of the chosen coordinate frame. Choices are either
"xyz"
or"zyx"
. Defaults to"zyx"
.
Returns
A numeric array of shape [\dots \times 4]
storing the
corresponding unit quaternion representations.
Examples
if (reticulate::py_module_available("geomstats")) { so3 <- SpecialOrthogonal(n = 3, point_type = "vector") so3$quaternion_from_tait_bryan_angles(rep(0, 3)) }
Method rotation_vector_from_tait_bryan_angles()
Converts a 3D rotation from Tait-Bryan angle to axis-angle representation.
Usage
SpecialOrthogonal3Vectors$rotation_vector_from_tait_bryan_angles( tait_bryan_angles, extrinsic_or_intrinsic = "extrinsic", order = "zyx" )
Arguments
tait_bryan_angles
A numeric array of shape
[\dots \times 3]
specifying one or more 3D rotations in Tait-Bryan angle representation.extrinsic_or_intrinsic
A character string specifying the coordinate frame in which the Tait-Bryan angles are expressed. Choices are either
"extrinsic"
(fixed frame) or"intrinsic"
(moving frame). Defaults to"extrinsic"
.order
A character string specifying the order of the rotation composition around the three axes of the chosen coordinate frame. Choices are either
"xyz"
or"zyx"
. Defaults to"zyx"
.
Returns
A numeric array of shape [\dots \times 3]
storing the
corresponding axis-angle representations.
Examples
if (reticulate::py_module_available("geomstats")) { so3 <- SpecialOrthogonal(n = 3, point_type = "vector") so3$rotation_vector_from_tait_bryan_angles(rep(0, 3)) }
Method tait_bryan_angles_from_quaternion()
Converts a 3D rotation from matrix to Tait-Bryan angle representation.
Usage
SpecialOrthogonal3Vectors$tait_bryan_angles_from_quaternion( quaternion, extrinsic_or_intrinsic = "extrinsic", order = "zyx" )
Arguments
quaternion
A numeric array of shape
[\dots \times 4]
specifying one or more 3D rotations in unit quaternion representation.extrinsic_or_intrinsic
A character string specifying the coordinate frame in which the Tait-Bryan angles are expressed. Choices are either
"extrinsic"
(fixed frame) or"intrinsic"
(moving frame). Defaults to"extrinsic"
.order
A character string specifying the order of the rotation composition around the three axes of the chosen coordinate frame. Choices are either
"xyz"
or"zyx"
. Defaults to"zyx"
.
Returns
A numeric array of shape [\dots \times 3]
storing the
corresponding Tait-Bryan angle representations.
Examples
if (reticulate::py_module_available("geomstats")) { so3 <- SpecialOrthogonal(n = 3, point_type = "vector") so3$tait_bryan_angles_from_quaternion(c(1, rep(0, 3))) }
Method tait_bryan_angles_from_rotation_vector()
Converts a 3D rotation from axis-angle to Tait-Bryan angle representation.
Usage
SpecialOrthogonal3Vectors$tait_bryan_angles_from_rotation_vector( rot_vec, extrinsic_or_intrinsic = "extrinsic", order = "zyx" )
Arguments
rot_vec
A numeric array of shape
[\dots \times 3]
specifying one or more 3D rotations in axis-angle representation.extrinsic_or_intrinsic
A character string specifying the coordinate frame in which the Tait-Bryan angles are expressed. Choices are either
"extrinsic"
(fixed frame) or"intrinsic"
(moving frame). Defaults to"extrinsic"
.order
A character string specifying the order of the rotation composition around the three axes of the chosen coordinate frame. Choices are either
"xyz"
or"zyx"
. Defaults to"zyx"
.
Returns
A numeric array of shape [\dots \times 3]
storing the
corresponding Tait-Bryan angle representations.
Examples
if (reticulate::py_module_available("geomstats")) { so3 <- SpecialOrthogonal(n = 3, point_type = "vector") so3$tait_bryan_angles_from_rotation_vector(rep(0, 3)) }
Method random_uniform()
Samples in \mathrm{SO}(3)
from a uniform distribution.
Usage
SpecialOrthogonal3Vectors$random_uniform(n_samples = 1)
Arguments
n_samples
An integer value specifying the sample size. Defaults to
1L
.
Returns
A numeric array of shape [\dots \times 3]
storing a sample
of 3D rotations in axis-angle representation uniformly sampled in
\mathrm{SO}(3)
.
Examples
if (reticulate::py_module_available("geomstats")) { so3 <- SpecialOrthogonal(n = 3, point_type = "vector") so3$random_uniform() }
Method clone()
The objects of this class are cloneable with this method.
Usage
SpecialOrthogonal3Vectors$clone(deep = FALSE)
Arguments
deep
Whether to make a deep clone.
Author(s)
Nicolas Guigui and Nina Miolane
See Also
Other special orthogonal classes:
SpecialOrthogonal2Vectors
,
SpecialOrthogonalMatrices
,
SpecialOrthogonal()
Examples
## ------------------------------------------------
## Method `SpecialOrthogonal3Vectors$rotation_vector_from_matrix`
## ------------------------------------------------
if (reticulate::py_module_available("geomstats")) {
so3 <- SpecialOrthogonal(n = 3, point_type = "vector")
so3$rotation_vector_from_matrix(diag(1, 3))
}
## ------------------------------------------------
## Method `SpecialOrthogonal3Vectors$matrix_from_rotation_vector`
## ------------------------------------------------
if (reticulate::py_module_available("geomstats")) {
so3 <- SpecialOrthogonal(n = 3, point_type = "vector")
so3$matrix_from_rotation_vector(rep(0, 3))
}
## ------------------------------------------------
## Method `SpecialOrthogonal3Vectors$quaternion_from_matrix`
## ------------------------------------------------
if (reticulate::py_module_available("geomstats")) {
so3 <- SpecialOrthogonal(n = 3, point_type = "vector")
so3$quaternion_from_matrix(diag(1, 3))
}
## ------------------------------------------------
## Method `SpecialOrthogonal3Vectors$quaternion_from_rotation_vector`
## ------------------------------------------------
if (reticulate::py_module_available("geomstats")) {
so3 <- SpecialOrthogonal(n = 3, point_type = "vector")
so3$quaternion_from_rotation_vector(rep(0, 3))
}
## ------------------------------------------------
## Method `SpecialOrthogonal3Vectors$rotation_vector_from_quaternion`
## ------------------------------------------------
if (reticulate::py_module_available("geomstats")) {
so3 <- SpecialOrthogonal(n = 3, point_type = "vector")
so3$rotation_vector_from_quaternion(array(c(1, rep(0, 3))))
}
## ------------------------------------------------
## Method `SpecialOrthogonal3Vectors$matrix_from_quaternion`
## ------------------------------------------------
if (reticulate::py_module_available("geomstats")) {
so3 <- SpecialOrthogonal(n = 3, point_type = "vector")
so3$matrix_from_quaternion(c(1, rep(0, 3)))
}
## ------------------------------------------------
## Method `SpecialOrthogonal3Vectors$matrix_from_tait_bryan_angles`
## ------------------------------------------------
if (reticulate::py_module_available("geomstats")) {
so3 <- SpecialOrthogonal(n = 3, point_type = "vector")
so3$matrix_from_tait_bryan_angles(rep(0, 3))
}
## ------------------------------------------------
## Method `SpecialOrthogonal3Vectors$tait_bryan_angles_from_matrix`
## ------------------------------------------------
if (reticulate::py_module_available("geomstats")) {
so3 <- SpecialOrthogonal(n = 3, point_type = "vector")
so3$tait_bryan_angles_from_matrix(diag(1, 3))
}
## ------------------------------------------------
## Method `SpecialOrthogonal3Vectors$quaternion_from_tait_bryan_angles`
## ------------------------------------------------
if (reticulate::py_module_available("geomstats")) {
so3 <- SpecialOrthogonal(n = 3, point_type = "vector")
so3$quaternion_from_tait_bryan_angles(rep(0, 3))
}
## ------------------------------------------------
## Method `SpecialOrthogonal3Vectors$rotation_vector_from_tait_bryan_angles`
## ------------------------------------------------
if (reticulate::py_module_available("geomstats")) {
so3 <- SpecialOrthogonal(n = 3, point_type = "vector")
so3$rotation_vector_from_tait_bryan_angles(rep(0, 3))
}
## ------------------------------------------------
## Method `SpecialOrthogonal3Vectors$tait_bryan_angles_from_quaternion`
## ------------------------------------------------
if (reticulate::py_module_available("geomstats")) {
so3 <- SpecialOrthogonal(n = 3, point_type = "vector")
so3$tait_bryan_angles_from_quaternion(c(1, rep(0, 3)))
}
## ------------------------------------------------
## Method `SpecialOrthogonal3Vectors$tait_bryan_angles_from_rotation_vector`
## ------------------------------------------------
if (reticulate::py_module_available("geomstats")) {
so3 <- SpecialOrthogonal(n = 3, point_type = "vector")
so3$tait_bryan_angles_from_rotation_vector(rep(0, 3))
}
## ------------------------------------------------
## Method `SpecialOrthogonal3Vectors$random_uniform`
## ------------------------------------------------
if (reticulate::py_module_available("geomstats")) {
so3 <- SpecialOrthogonal(n = 3, point_type = "vector")
so3$random_uniform()
}
Abstract Class for Special Orthogonal Groups in Matrix Representation
Description
Class for special orthogonal groups in matrix representation.
Super classes
rgeomstats::PythonClass
-> rgeomstats::Manifold
-> rgeomstats::MatrixLieGroup
-> SpecialOrthogonalMatrices
Public fields
bi_invariant_metric
An object of class
BiInvariantMetric
specifying the metric to equip the manifold with.
Methods
Public methods
Inherited methods
rgeomstats::PythonClass$get_python_class()
rgeomstats::PythonClass$set_python_class()
rgeomstats::Manifold$is_tangent()
rgeomstats::Manifold$random_point()
rgeomstats::Manifold$random_tangent_vec()
rgeomstats::Manifold$regularize()
rgeomstats::Manifold$set_metric()
rgeomstats::Manifold$to_tangent()
rgeomstats::MatrixLieGroup$compose()
rgeomstats::MatrixLieGroup$exp()
rgeomstats::MatrixLieGroup$get_identity()
rgeomstats::MatrixLieGroup$inverse()
rgeomstats::MatrixLieGroup$lie_bracket()
rgeomstats::MatrixLieGroup$log()
rgeomstats::MatrixLieGroup$tangent_translation_map()
Method new()
The SpecialOrthogonalMatrices
class constructor.
Usage
SpecialOrthogonalMatrices$new(n, ..., py_cls = NULL)
Arguments
n
An integer value specifying the number of rows and columns of the matrices.
...
Extra arguments to be passed to parent class constructors. See
MatrixLieAlgebra
,LevelSet
andManifold
classes.py_cls
A Python object of class
SpecialOrthogonalMatrices
. Defaults toNULL
in which case it is instantiated on the fly using the other input arguments.
Returns
An object of class SpecialOrthogonalMatrices
.
Method belongs()
Evaluates if a point belongs to the manifold.
Usage
SpecialOrthogonalMatrices$belongs(point, atol = gs$backend$atol)
Arguments
point
A numeric array of shape
[\dots \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
.
Returns
A boolean value or vector storing whether the input points belong to the manifold.
Examples
if (reticulate::py_module_available("geomstats")) { so3 <- SpecialOrthogonal(n = 3) so3$belongs(diag(1, 3)) }
Method intrinsic_to_extrinsic_coords()
Converts from intrinsic to extrinsic coordinates.
Usage
SpecialOrthogonalMatrices$intrinsic_to_extrinsic_coords(point_intrinsic)
Arguments
point_intrinsic
A numeric array of shape
[\dots \times \{ \mathrm{dim} \}]
specifying one or more points on the embedded manifold in intrinsic coordinates.
Returns
A numeric array of shape [\dots \times \{
\mathrm{dim_embedding} \}]
storing the same points on the embedded
manifold in extrinsic coordinates.
Method extrinsic_to_intrinsic_coords()
Converts from extrinsic to intrinsic coordinates.
Usage
SpecialOrthogonalMatrices$extrinsic_to_intrinsic_coords(point_extrinsic)
Arguments
point_extrinsic
A numeric array of shape
[\dots \times \{ \mathrm{dim_embedding} \}]
specifying one or more points on the embedded manifold in extrinsic coordinates.
Returns
A numeric array of shape [\dots \times \{ \mathrm{dim} \}]
storing the same points on the embedded manifold in intrinsic
coordinates.
Method projection()
Project a matrix on \mathrm{SO}(n)
by minimizing the
Frobenius norm.
Usage
SpecialOrthogonalMatrices$projection(point)
Arguments
point
A numeric array of shape
[\dots \times n \times n]
specifying one or more matrices.
Returns
A numeric array of the same shape storing the projected matrices.
Examples
if (reticulate::py_module_available("geomstats")) { so3 <- SpecialOrthogonal(3) so3$projection(diag(1, 3)) }
Method clone()
The objects of this class are cloneable with this method.
Usage
SpecialOrthogonalMatrices$clone(deep = FALSE)
Arguments
deep
Whether to make a deep clone.
Author(s)
Nicolas Guigui and Nina Miolane
See Also
Other special orthogonal classes:
SpecialOrthogonal2Vectors
,
SpecialOrthogonal3Vectors
,
SpecialOrthogonal()
Examples
## ------------------------------------------------
## Method `SpecialOrthogonalMatrices$belongs`
## ------------------------------------------------
if (reticulate::py_module_available("geomstats")) {
so3 <- SpecialOrthogonal(n = 3)
so3$belongs(diag(1, 3))
}
## ------------------------------------------------
## Method `SpecialOrthogonalMatrices$projection`
## ------------------------------------------------
if (reticulate::py_module_available("geomstats")) {
so3 <- SpecialOrthogonal(3)
so3$projection(diag(1, 3))
}
Abstract Class for Special Orthogonal Groups in Vector Representation
Description
Class for the special orthogonal groups
\mathrm{SO}(\{2,3\})
in vector form, i.e. the Lie groups of planar
and 3D rotations. This class is specific to the vector representation of
rotations. For the matrix representation, use the SpecialOrthogonal
class and set n = 2
or n = 3
.
Super classes
rgeomstats::PythonClass
-> rgeomstats::Manifold
-> rgeomstats::LieGroup
-> SpecialOrthogonalVectors
Public fields
n
An integer value specifying the number of rows and columns of the matrices.
epsilon
A numeric value specifying the precision to use for calculations involving potential divison by 0 in rotations.
Methods
Public methods
Inherited methods
rgeomstats::PythonClass$get_python_class()
rgeomstats::PythonClass$set_python_class()
rgeomstats::Manifold$belongs()
rgeomstats::Manifold$is_tangent()
rgeomstats::Manifold$random_point()
rgeomstats::Manifold$random_tangent_vec()
rgeomstats::Manifold$regularize()
rgeomstats::Manifold$set_metric()
rgeomstats::Manifold$to_tangent()
rgeomstats::LieGroup$add_metric()
rgeomstats::LieGroup$compose()
rgeomstats::LieGroup$exp()
rgeomstats::LieGroup$exp_from_identity()
rgeomstats::LieGroup$exp_not_from_identity()
rgeomstats::LieGroup$get_identity()
rgeomstats::LieGroup$inverse()
rgeomstats::LieGroup$jacobian_translation()
rgeomstats::LieGroup$lie_bracket()
rgeomstats::LieGroup$log()
rgeomstats::LieGroup$log_from_identity()
rgeomstats::LieGroup$log_not_from_identity()
rgeomstats::LieGroup$tangent_translation_map()
Method new()
The SpecialOrthogonalVectors
class constructor.
Usage
SpecialOrthogonalVectors$new(n, epsilon = 0, py_cls = NULL)
Arguments
n
An integer value specifying the number of rows and columns of the matrices.
epsilon
A numeric value specifying the precision to use for calculations involving potential divison by 0 in rotations. Defaults to
0
.py_cls
A Python object of class
SpecialOrthogonalVectors
. Defaults toNULL
in which case it is instantiated on the fly using the other input arguments.
Returns
An object of class SpecialOrthogonalVectors
.
Method projection()
Projects a matrix on \mathrm{SO}(2)
or
\mathrm{SO}(3)
using the Frobenius norm.
Usage
SpecialOrthogonalVectors$projection(point)
Arguments
point
A numeric array of shape
[\dots \times n \times n]
specifying one or more matrices to be projected.
Returns
A numeric array of the same shape as the input point storing the projected matrices.
Examples
if (reticulate::py_module_available("geomstats")) { so2 <- SpecialOrthogonal(n = 2, point_type = "vector") so2$projection(diag(1, 2)) }
Method skew_matrix_from_vector()
Gets the skew-symmetric matrix derived from the vector. In
3D, computes the skew-symmetric matrix, known as the cross-product of a
vector, associated to the vector vec
.
Usage
SpecialOrthogonalVectors$skew_matrix_from_vector(vec)
Arguments
vec
A numeric array of shape
[\dots \times \mathrm{dim}]
specifying one or more vectors from which to compute corresponding skew matrix representations.
Returns
A numeric array of shape [\dots \times n \times n]
storing
the corresponding skew matrix representations.
Examples
if (reticulate::py_module_available("geomstats")) { so2 <- SpecialOrthogonal(n = 2, point_type = "vector") so2$skew_matrix_from_vector(array(0)) }
Method vector_from_skew_matrix()
Derives a vector from the skew-symmetric matrix. In 3D, computes the vector defining the cross-product associated to a skew-symmetric matrix.
Usage
SpecialOrthogonalVectors$vector_from_skew_matrix(skew_mat)
Arguments
skew_mat
A numeric array of shape
[\dots \times n \times n]
specifying skew matrices.
Returns
A numeric array of shape [\dots \times \mathrm{dim}]
storing the corresponding vector representations.
Examples
if (reticulate::py_module_available("geomstats")) { so2 <- SpecialOrthogonal(n = 2, point_type = "vector") so2$vector_from_skew_matrix(diag(0, 2)) }
Method regularize_tangent_vec_at_identity()
Regularizes a tangent vector at the identity. In 2D,
regularizes a tangent vector by getting its norm at the identity to be
less than \pi
.
Usage
SpecialOrthogonalVectors$regularize_tangent_vec_at_identity( tangent_vec, metric = NULL )
Arguments
tangent_vec
A numeric array of shape
[\dots \times 1]
specifying one or more tangent vectors at base point.metric
An object of class
RiemannianMetric
specifying the metric to compute the norm of the tangent vector orNULL
. If it is set toNULL
, it defaults to using the Euclidean metric.
Returns
A numeric array of shape [\dots \times 1]
storing the
regularized tangent vector(s).
Examples
if (reticulate::py_module_available("geomstats")) { so2 <- SpecialOrthogonal(n = 2, point_type = "vector") so2$regularize_tangent_vec_at_identity(array(0)) }
Method regularize_tangent_vec()
Regularizes a tangent vector at a base point. In 2D,
regularizes a tangent vector by getting the norm of its parallel
transport to the identity, determined by the metric, to be less than
\pi
.
Usage
SpecialOrthogonalVectors$regularize_tangent_vec( tangent_vec, base_point, metric = NULL )
Arguments
tangent_vec
A numeric array of shape
[\dots \times 1]
specifying one or more tangent vectors at corresponding base points.base_point
A numeric array of shape
[\dots \times 1]
specifying one or more points on the manifold.metric
An object of class
RiemannianMetric
specifying the metric to compute the norm of the tangent vector orNULL
. If it is set toNULL
, it defaults to using the Euclidean metric.
Returns
A numeric array of shape [\dots \times 1]
storing the
regularized tangent vector(s).
Examples
if (reticulate::py_module_available("geomstats")) { so2 <- SpecialOrthogonal(n = 2, point_type = "vector") so2$regularize_tangent_vec(array(0), array(1)) }
Method clone()
The objects of this class are cloneable with this method.
Usage
SpecialOrthogonalVectors$clone(deep = FALSE)
Arguments
deep
Whether to make a deep clone.
Author(s)
Nicolas Guigui and Nina Miolane
Examples
## ------------------------------------------------
## Method `SpecialOrthogonalVectors$projection`
## ------------------------------------------------
if (reticulate::py_module_available("geomstats")) {
so2 <- SpecialOrthogonal(n = 2, point_type = "vector")
so2$projection(diag(1, 2))
}
## ------------------------------------------------
## Method `SpecialOrthogonalVectors$skew_matrix_from_vector`
## ------------------------------------------------
if (reticulate::py_module_available("geomstats")) {
so2 <- SpecialOrthogonal(n = 2, point_type = "vector")
so2$skew_matrix_from_vector(array(0))
}
## ------------------------------------------------
## Method `SpecialOrthogonalVectors$vector_from_skew_matrix`
## ------------------------------------------------
if (reticulate::py_module_available("geomstats")) {
so2 <- SpecialOrthogonal(n = 2, point_type = "vector")
so2$vector_from_skew_matrix(diag(0, 2))
}
## ------------------------------------------------
## Method `SpecialOrthogonalVectors$regularize_tangent_vec_at_identity`
## ------------------------------------------------
if (reticulate::py_module_available("geomstats")) {
so2 <- SpecialOrthogonal(n = 2, point_type = "vector")
so2$regularize_tangent_vec_at_identity(array(0))
}
## ------------------------------------------------
## Method `SpecialOrthogonalVectors$regularize_tangent_vec`
## ------------------------------------------------
if (reticulate::py_module_available("geomstats")) {
so2 <- SpecialOrthogonal(n = 2, point_type = "vector")
so2$regularize_tangent_vec(array(0), array(1))
}
Abstract Class for Vector Space Manifolds
Description
Abstract class for vector spaces.
Super classes
rgeomstats::PythonClass
-> rgeomstats::Manifold
-> VectorSpace
Public fields
basis
Basis of the vector space.
Methods
Public methods
Inherited methods
rgeomstats::PythonClass$get_python_class()
rgeomstats::PythonClass$set_python_class()
rgeomstats::Manifold$belongs()
rgeomstats::Manifold$is_tangent()
rgeomstats::Manifold$random_point()
rgeomstats::Manifold$random_tangent_vec()
rgeomstats::Manifold$regularize()
rgeomstats::Manifold$set_metric()
rgeomstats::Manifold$to_tangent()
Method new()
The VectorSpace
class constructor.
Usage
VectorSpace$new(shape, ..., py_cls = NULL)
Arguments
shape
An integer vector specifying the shape of one element of the manifold. Defaults to
NULL
....
Extra arguments to be passed to parent class constructors. See
Manifold
class.py_cls
A Python object of class
VectorSpace
. Defaults toNULL
in which case it is instantiated on the fly using the other input arguments.
Returns
An object of class VectorSpace
.
Method projection()
Project a point onto the vector space.
Usage
VectorSpace$projection(point)
Arguments
point
A numeric array of shape
dim
specifying a vector in the ambient space onto the manifold.
Details
This method is for compatibility and returns point
. point
should have the right shape.
Returns
A numeric array of shape dim
storing the input vector
projected onto the manifold.
Method clone()
The objects of this class are cloneable with this method.
Usage
VectorSpace$clone(deep = FALSE)
Arguments
deep
Whether to make a deep clone.
Author(s)
Nicolas Guigui and Nina Miolane