From: Michael Orlitzky Date: Sat, 20 Jul 2019 19:25:52 +0000 (-0400) Subject: eja: test that complex/quaternion embeddings are homomorphisms. X-Git-Url: https://gitweb.michael.orlitzky.com/?a=commitdiff_plain;h=633d193089c3f42aa2e14e0342d5e7030ad74be8;p=sage.d.git eja: test that complex/quaternion embeddings are homomorphisms. --- diff --git a/mjo/eja/euclidean_jordan_algebra.py b/mjo/eja/euclidean_jordan_algebra.py index b8c7a91..24eaf50 100644 --- a/mjo/eja/euclidean_jordan_algebra.py +++ b/mjo/eja/euclidean_jordan_algebra.py @@ -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)