- def __init__(self, n, field=QQ, **kwargs):
- S = _complex_hermitian_basis(n)
+ def __init__(self, n, field=QQ, normalize_basis=True, **kwargs):
+ S = _complex_hermitian_basis(n, field)
+
+ if n > 1 and normalize_basis:
+ # We'll need sqrt(2) to normalize the basis, and this
+ # winds up in the multiplication table, so the whole
+ # algebra needs to be over the field extension.
+ R = PolynomialRing(field, 'z')
+ z = R.gen()
+ p = z**2 - 2
+ if p.is_irreducible():
+ field = NumberField(p, 'sqrt2', embedding=RLF(2).sqrt())
+ S = [ s.change_ring(field) for s in S ]
+ self._basis_normalizers = tuple(
+ ~(self.__class__.natural_inner_product(s,s).sqrt())
+ for s in S )
+ S = tuple( s*c for (s,c) in zip(S,self._basis_normalizers) )
+