+
+
+class ComplexMatrixAlgebra(HurwitzMatrixAlgebra):
+ r"""
+ The algebra of ``n``-by-``n`` matrices with complex entries over
+ (a subfield of) the real numbers.
+
+ These differ from the usual complex matrix spaces in SageMath
+ because the scalar field is real (and not assumed to be the same
+ as the space from which the entries are drawn). The space of
+ `1`-by-`1` complex matrices will have dimension two, for example.
+
+ SETUP::
+
+ sage: from mjo.hurwitz import ComplexMatrixAlgebra
+
+ EXAMPLES::
+
+ sage: ComplexMatrixAlgebra(3)
+ Module of 3 by 3 matrices with entries in Algebraic Field
+ over the scalar ring Algebraic Real Field
+ sage: ComplexMatrixAlgebra(3,QQ)
+ Module of 3 by 3 matrices with entries in Algebraic Field
+ over the scalar ring Rational Field
+
+ ::
+
+ sage: A = ComplexMatrixAlgebra(2)
+ sage: (I,) = A.entry_algebra().gens()
+ sage: A([ [1+I, 1],
+ ....: [-1, -I] ])
+ +-------+----+
+ | I + 1 | 1 |
+ +-------+----+
+ | -1 | -I |
+ +-------+----+
+
+ ::
+
+ sage: A1 = ComplexMatrixAlgebra(1,QQ)
+ sage: A2 = ComplexMatrixAlgebra(2,QQ)
+ sage: cartesian_product([A1,A2])
+ Module of 1 by 1 matrices with entries in Algebraic Field over
+ the scalar ring Rational Field (+) Module of 2 by 2 matrices with
+ entries in Algebraic Field over the scalar ring Rational Field
+
+ TESTS::
+
+ sage: set_random_seed()
+ sage: A = ComplexMatrixAlgebra(ZZ.random_element(10))
+ sage: x = A.random_element()
+ sage: x*A.one() == x and A.one()*x == x
+ True
+
+ """
+ def __init__(self, n, scalars=AA, **kwargs):
+ from sage.rings.all import QQbar
+ super().__init__(QQbar, scalars, n, **kwargs)