From c10a6da2475371483d6050fea1339098e1877ecc Mon Sep 17 00:00:00 2001 From: Stefan Witzel Date: Wed, 30 Aug 2023 10:34:07 +0200 Subject: [PATCH 1/2] Consistent action of conjugation According to Transform.apply_to_tuple() a potential conjugation is first applied before the matrix is multiplied. Since the action is from the left this means that conjugation is on the right. Thus in Transform.merge() conjugation has to be applied to the entries of the product of the factors to the right not to the left. This commit fixes this. --- hyperbolic/poincare/transform.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/hyperbolic/poincare/transform.py b/hyperbolic/poincare/transform.py index e44c5f8..e0607ac 100644 --- a/hyperbolic/poincare/transform.py +++ b/hyperbolic/poincare/transform.py @@ -95,13 +95,13 @@ def identity(): def merge(*transfoms): a,b,c,d = 1,0,0,1 conj = False - for i, trans in enumerate(transfoms): + for trans in reversed(transfoms): a2,b2,c2,d2 = trans.abcd if trans.conj: a,b,c,d = (a.conjugate(), b.conjugate(), c.conjugate(), d.conjugate()) conj = not conj - a,b,c,d = a*a2+c*b2, b*a2+d*b2, a*c2+c*d2, b*c2+d*d2 + a,b,c,d = a2*a+c2*b, b2*a+d2*b, a2*c+c2*d, b2*c+d2*d return Transform(a,b,c,d,conj=conj) @staticmethod def shift_origin(new_origin, new_x=None): From 4fa98cd7d184c8961ce79eebb363d576e4ccfce6 Mon Sep 17 00:00:00 2001 From: Stefan Witzel Date: Thu, 31 Aug 2023 22:18:41 +0200 Subject: [PATCH 2/2] Transform.merge: corrected order of multiplication. --- hyperbolic/poincare/transform.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hyperbolic/poincare/transform.py b/hyperbolic/poincare/transform.py index e0607ac..809f75d 100644 --- a/hyperbolic/poincare/transform.py +++ b/hyperbolic/poincare/transform.py @@ -101,7 +101,7 @@ def merge(*transfoms): a,b,c,d = (a.conjugate(), b.conjugate(), c.conjugate(), d.conjugate()) conj = not conj - a,b,c,d = a2*a+c2*b, b2*a+d2*b, a2*c+c2*d, b2*c+d2*d + a,b,c,d = a2*a+b2*c, a2*b+b2*d, c2*a+d2*c, c2*b+d2*d return Transform(a,b,c,d,conj=conj) @staticmethod def shift_origin(new_origin, new_x=None):