True
"""
- Xu = cls.real_unembed(X)
- Yu = cls.real_unembed(Y)
- tr = (Xu*Yu).trace()
-
- try:
- # Works in QQ, AA, RDF, et cetera.
- return tr.real()
- except AttributeError:
- # A quaternion doesn't have a real() method, but does
- # have coefficient_tuple() method that returns the
- # coefficients of 1, i, j, and k -- in that order.
- return tr.coefficient_tuple()[0]
+ # This does in fact compute the real part of the trace.
+ # If we compute the trace of e.g. a complex matrix M,
+ # then we do so by adding up its diagonal entries --
+ # call them z_1 through z_n. The real embedding of z_1
+ # will be a 2-by-2 REAL matrix [a, b; -b, a] whose trace
+ # as a REAL matrix will be 2*a = 2*Re(z_1). And so forth.
+ return (X*Y).trace()/cls.dimension_over_reals()
class RealMatrixEJA(MatrixEJA):