def log(self, x, y): xty = utils.transposem(x) @ y u = utils.logm(xty) return (u - utils.transposem(u)) / 2.0
def dist(self, x, y, keepdims=False): x_sqrt_inv = tf.linalg.inv(tf.linalg.sqrtm(x)) log = utils.logm(x_sqrt_inv @ y @ x_sqrt_inv) return tf.linalg.norm(log, axis=[-2, -1], ord="fro", keepdims=keepdims)
def log(self, x, y): x_sqrt = tf.linalg.sqrtm(x) x_sqrt_inv = tf.linalg.inv(x_sqrt) return x_sqrt @ utils.logm(x_sqrt_inv @ y @ x_sqrt_inv) @ x_sqrt
def pairmean(self, x, y): return tf.linalg.expm((utils.logm(x) + utils.logm(y)) / 2.0)
def geodesic(self, x, u, t): return tf.linalg.expm(utils.logm(x) + t * self._diff_log(x, u))
def log(self, x, y): return self._diff_exp(utils.logm(x), utils.logm(y) - utils.logm(x))
def exp(self, x, u): return tf.linalg.expm(utils.logm(x) + self._diff_log(x, u))
def dist(self, x, y, keepdims=False): diff = utils.logm(y) - utils.logm(x) return tf.linalg.norm(diff, axis=[-2, -1], ord="fro", keepdims=keepdims)