def setUp(self): gs.random.seed(1234) self.dimension = 2 self.space = EuclideanSpace(self.dimension) self.metric = self.space.metric self.n_samples = 3
def __init__(self, dimension): assert isinstance(dimension, int) and dimension > 0 super(Hypersphere, self).__init__(dimension=dimension, embedding_manifold=EuclideanSpace(dimension + 1)) self.embedding_metric = self.embedding_manifold.metric self.metric = HypersphereMetric(dimension)
def __init__(self, n): assert isinstance(n, int) and n > 1 self.n = n self.dimension = int((n * (n - 1)) / 2 + n) super(SpecialEuclideanGroup, self).__init__( dimension=self.dimension, identity=gs.zeros(self.dimension)) # TODO(nina): keep the names rotations and translations here? self.rotations = SpecialOrthogonalGroup(n=n) self.translations = EuclideanSpace(dimension=n) self.point_representation = 'vector' if n == 3 else 'matrix'
def setUp(self): gs.random.seed(1234) self.dimension = 2 self.space = EuclideanSpace(self.dimension) self.metric = self.space.metric self.n_samples = 3 self.one_point_a = gs.array([0., 1.]) self.one_point_b = gs.array([2., 10.]) self.n_points_a = gs.array([[2., 1.], [-2., -4.], [-5., 1.]]) self.n_points_b = gs.array([[2., 10.], [8., -1.], [-3., 6.]])
def __init__(self, n): assert n > 1 if n is not 3: raise NotImplementedError('Only SE(3) is implemented.') self.n = n self.dimension = int((n * (n - 1)) / 2 + n) super(SpecialEuclideanGroup, self).__init__( dimension=self.dimension, identity=np.zeros(self.dimension)) # TODO(nina): keep the names rotations and translations here? self.rotations = SpecialOrthogonalGroup(n=n) self.translations = EuclideanSpace(dimension=n)
def __init__(self, n, point_type=None): assert isinstance(n, int) and n > 1 self.n = n self.dimension = int((n * (n - 1)) / 2 + n) self.default_point_type = point_type if point_type is None: self.default_point_type = 'vector' if n == 3 else 'matrix' super(SpecialEuclideanGroup, self).__init__(dimension=self.dimension) # TODO(nina): keep the names rotations and translations here? self.rotations = SpecialOrthogonalGroup(n=n) self.translations = EuclideanSpace(dimension=n)
def __init__(self, n, point_type=None, epsilon=0.): assert isinstance(n, int) and n > 1 self.n = n self.dimension = int((n * (n - 1)) / 2 + n) self.epsilon = epsilon self.default_point_type = point_type if point_type is None: self.default_point_type = 'vector' if n == 3 else 'matrix' super(SpecialEuclideanGroup, self).__init__(dimension=self.dimension) self.rotations = SpecialOrthogonalGroup(n=n, epsilon=epsilon) self.translations = EuclideanSpace(dimension=n)
""" Parameterized manifold. """ import math import numpy as np import geomstats.backend as gs from geomstats.embedded_manifold import EmbeddedManifold from geomstats.euclidean_space import EuclideanMetric from geomstats.euclidean_space import EuclideanSpace from geomstats.riemannian_metric import RiemannianMetric R2 = EuclideanSpace(dimension=2) R3 = EuclideanSpace(dimension=3) def get_mask_i_float(i, n): range_n = gs.arange(n) i_float = gs.cast(gs.array([i]), gs.int32)[0] mask_i = gs.equal(range_n, i_float) mask_i_float = gs.cast(mask_i, gs.float32) return mask_i_float class DiscretizedCurvesSpace(EmbeddedManifold): """ Space of discretized curves sampled at points in embedding_manifold. """