Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
Vhat = self.gradeInvol()
Vrev = ~self
Vinv = Vrev/(self*Vrev)[()]
# Test if the versor inverse (~V)/(V * ~V) is truly the inverse of the
# multivector V
if (Vhat*Vinv).grades(eps=0.000001) != {0}:
return False
if not np.sum(np.abs((Vhat*Vinv).value - (Vinv*Vhat).value)) < 0.0001:
return False
# applying a versor (and hence an invertible blade) to a vector should
# not change the grade
if not all(
(Vhat*e*Vrev).grades(eps=0.000001) == {1}
for e in cf.basis_vectors(self.layout).values()
):
return False
return True
def basis_vectors(self):
return cf.basis_vectors(self)