|
12 | 12 | import unittest |
13 | 13 | from math import pi |
14 | 14 | import math |
15 | | -from scipy.linalg import logm |
| 15 | +from scipy.linalg import expm, logm |
16 | 16 | import pytest |
17 | 17 | import sys |
18 | 18 |
|
@@ -88,6 +88,25 @@ def test_trlog2(self): |
88 | 88 |
|
89 | 89 | nt.assert_array_almost_equal(trlog2(T, twist=True), vexa(logm(T))) |
90 | 90 |
|
| 91 | + def test_trlog2_quadrants(self): |
| 92 | + for c, s in ( |
| 93 | + (1, 0), |
| 94 | + (math.sqrt(3) / 2, 0.5), |
| 95 | + (-0.5, math.sqrt(3) / 2), |
| 96 | + (-0.5, -math.sqrt(3) / 2), |
| 97 | + (-1, 0), |
| 98 | + (0, 1), |
| 99 | + (0, -1), |
| 100 | + ): |
| 101 | + R = np.array([[c, -s], [s, c]]) |
| 102 | + for T in (R, rt2tr(R, [1, 2])): |
| 103 | + for twist in (False, True): |
| 104 | + with self.subTest(c=c, s=s, shape=T.shape, twist=twist): |
| 105 | + S = trlog2(T, twist=twist) |
| 106 | + if twist: |
| 107 | + S = skew(S) if T.shape == (2, 2) else skewa(S) |
| 108 | + nt.assert_allclose(expm(S), T, atol=1e-12, rtol=0) |
| 109 | + |
91 | 110 | def test_trexp2(self): |
92 | 111 | R = trexp2(skew(0.5)) |
93 | 112 | nt.assert_array_almost_equal(R, rot2(0.5)) |
|
0 commit comments