V = VectorSpace(field, degree)
- # If we were asked to orthonormalize, and if the orthonormal
- # basis is different from the given one, then we also want to
- # compute multiplication and inner-product tables for the
- # deorthonormalized basis. These can be used later to
- # construct a deorthonormalized copy of this algebra over QQ
- # in which several operations are much faster.
+ # Save a copy of an algebra with the original, rational basis
+ # and over QQ where computations are fast.
self._rational_algebra = None
- if orthonormalize:
- if self.base_ring() is not QQ:
- # There's no point in constructing the extra algebra if this
- # one is already rational. If the original basis is rational
- # but normalization would make it irrational, then this whole
- # constructor will just fail anyway as it tries to stick an
- # irrational number into a rational algebra.
- #
- # Note: the same Jordan and inner-products work here,
- # because they are necessarily defined with respect to
- # ambient coordinates and not any particular basis.
- self._rational_algebra = RationalBasisEuclideanJordanAlgebra(
- basis,
- jordan_product,
- inner_product,
- field=QQ,
- orthonormalize=False,
- prefix=prefix,
- category=category,
- check_field=False,
- check_axioms=False)
+ if field is not QQ:
+ # There's no point in constructing the extra algebra if this
+ # one is already rational.
+ #
+ # Note: the same Jordan and inner-products work here,
+ # because they are necessarily defined with respect to
+ # ambient coordinates and not any particular basis.
+ self._rational_algebra = RationalBasisEuclideanJordanAlgebra(
+ basis,
+ jordan_product,
+ inner_product,
+ field=QQ,
+ orthonormalize=False,
+ prefix=prefix,
+ category=category,
+ check_field=False,
+ check_axioms=False)
+ if orthonormalize:
# Compute the deorthonormalized tables before we orthonormalize
# the given basis. The "check" parameter here guarantees that
# the basis is linearly-independent.
Algebraic Real Field
"""
- if self.base_ring() is QQ or self._rational_algebra is None:
+ if self._rational_algebra is None:
# There's no need to construct *another* algebra over the
# rationals if this one is already over the
# rationals. Likewise, if we never orthonormalized our