def _iter_log(p, matrix_v, max_iter, tol): matrix_lv = gs.zeros_like(matrix_v) for _ in range(max_iter): matrix_lv = gs.linalg.logm(matrix_v) matrix_c = matrix_lv[..., p:, p:] norm_matrix_c = gs.linalg.norm(matrix_c) if norm_matrix_c <= tol: break matrix_phi = gs.linalg.expm(-Matrices.to_skew_symmetric(matrix_c)) aux_matrix = gs.matmul(matrix_v[..., :, p:], matrix_phi) matrix_v = gs.concatenate([matrix_v[..., :, :p], aux_matrix], axis=-1) return matrix_lv
def projection(cls, mat): r"""Compute the skew-symmetric component of a matrix. The skew-symmetric part of a matrix :math: `X` is defined by .. math: (X - X^T) / 2 Parameters ---------- mat : array-like, shape=[..., n, n] Matrix. Returns ------- skew_sym : array-like, shape=[..., n, n] Skew-symmetric matrix. """ return Matrices.to_skew_symmetric(mat)
def to_tangent(self, vector, base_point=None): """Project a vector to a tangent space of the manifold. Compute the bracket (commutator) of the base_point with the skew-symmetric part of vector. Parameters ---------- vector : array-like, shape=[..., n, n] Vector. base_point : array-like, shape=[..., n, n] Point on the manifold. Returns ------- tangent_vec : array-like, shape=[..., n, n] Tangent vector at base point. """ skew = Matrices.to_skew_symmetric(vector) return Matrices.bracket(base_point, skew)