"""
# The basis may not be orthonormalized, so just having an
# orthogonal matrix is not sufficient to determine isometry.
- return all(
- b1.inner_product(b2) == self(b1).inner_product(self(b2))
- for b1 in self.domain().basis()
- for b2 in self.domain().basis()
- )
+ # Note: inner products are symmetric, so we only need to
+ # check the "above diagonal" pairs.
+ J = self.domain()
+ results = []
+ for i in range(J.dimension()):
+ for j in range(i+1):
+ results.append(
+ J.monomial(i).inner_product(J.monomial(j))
+ ==
+ self(J.monomial(i)).inner_product(self(J.monomial(j)))
+ )
+ return all(results)
def is_homomorphism(self):
True
"""
- return all(
- self(b1*b2) == self(b1)*self(b2)
- for b1 in self.domain().basis()
- for b2 in self.domain().basis()
- )
+ J = self.domain()
+ results = []
+ for i in range(J.dimension()):
+ for j in range(i+1):
+ # Multiplication is commutative, so we only
+ # need to test the "above-diagonal" pairs.
+ results.append(
+ self(J.monomial(i)*J.monomial(j))
+ ==
+ self(J.monomial(i))*self(J.monomial(j))
+ )
+ return all(results)
def is_isomorphism(self):