]> gitweb.michael.orlitzky.com - sage.d.git/commitdiff
eja: test that complex/quaternion embeddings are homomorphisms.
authorMichael Orlitzky <michael@orlitzky.com>
Sat, 20 Jul 2019 19:25:52 +0000 (15:25 -0400)
committerMichael Orlitzky <michael@orlitzky.com>
Mon, 29 Jul 2019 03:19:01 +0000 (23:19 -0400)
mjo/eja/euclidean_jordan_algebra.py

index b8c7a912b1ded8149f7aefdf14b90b99d1056b2b..24eaf50f381fbab7107bf5f3512354c221148199 100644 (file)
@@ -1264,6 +1264,20 @@ def _embed_complex_matrix(M):
         [ 0 -1| 6  0]
         [ 1  0| 0  6]
 
+    TESTS:
+
+    Embedding is a homomorphism (isomorphism, in fact)::
+
+        sage: set_random_seed()
+        sage: n = ZZ.random_element(5)
+        sage: F = QuadraticField(-1, 'i')
+        sage: X = random_matrix(F, n)
+        sage: Y = random_matrix(F, n)
+        sage: actual = _embed_complex_matrix(X) * _embed_complex_matrix(Y)
+        sage: expected = _embed_complex_matrix(X*Y)
+        sage: actual == expected
+        True
+
     """
     n = M.nrows()
     if M.ncols() != n:
@@ -1293,7 +1307,9 @@ def _unembed_complex_matrix(M):
         [  2*i + 1   4*i + 3]
         [ 10*i + 9 12*i + 11]
 
-    TESTS::
+    TESTS:
+
+    Unembedding is the inverse of embedding::
 
         sage: set_random_seed()
         sage: F = QuadraticField(-1, 'i')
@@ -1347,6 +1363,18 @@ def _embed_quaternion_matrix(M):
         [-3  4  1 -2]
         [-4 -3  2  1]
 
+    Embedding is a homomorphism (isomorphism, in fact)::
+
+        sage: set_random_seed()
+        sage: n = ZZ.random_element(5)
+        sage: Q = QuaternionAlgebra(QQ,-1,-1)
+        sage: X = random_matrix(Q, n)
+        sage: Y = random_matrix(Q, n)
+        sage: actual = _embed_quaternion_matrix(X)*_embed_quaternion_matrix(Y)
+        sage: expected = _embed_quaternion_matrix(X*Y)
+        sage: actual == expected
+        True
+
     """
     quaternions = M.base_ring()
     n = M.nrows()
@@ -1385,7 +1413,9 @@ def _unembed_quaternion_matrix(M):
         sage: _unembed_quaternion_matrix(M)
         [1 + 2*i + 3*j + 4*k]
 
-    TESTS::
+    TESTS:
+
+    Unembedding is the inverse of embedding::
 
         sage: set_random_seed()
         sage: Q = QuaternionAlgebra(QQ, -1, -1)