示例#1
0
def test_wrap_around():
    a = np.array([+1, 0])
    b = np.array([-1, 0])

    bv = S1.logmap(a, b)
    b2 = S1.expmap(bv)
    d = S1.distance(b, b2)

    printm('a', a, 'b', b, 'vel', bv[1], 'd', np.array(d))
    check_allclose(d, 0, atol=1e-7)
示例#2
0
 def assert_close(self, a, b, atol=1e-8, msg=None):
     ''' 
         Asserts that two points on the manifold are close to the given
         tolerance. 
     '''
     distance = self.distance(a, b)
     if msg is None:
         msg = ""
     if distance > atol:
         msg += "\nThe two points should be the same:\n"
         msg += "- a: %s\n" % self.friendly(a)
         msg += "- b: %s\n" % self.friendly(b)
         msg += formatm('a', a, 'b', b)
         check_allclose(distance, 0, atol=atol, err_msg=msg)
     return distance