Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def test_innermorphic(self):
for p, q in [(2, 0), (3, 0), (4, 0)]:
layout, blades = Cl(p, q)
A = Frame(layout.randomV(p+q))
R = layout.randomRotor()
B = Frame([R*a*~R for a in A])
self.assertTrue(A.is_innermorphic_to(B))
def test_frame_inv(self):
for p, q in [(2, 0), (3, 0), (4, 0)]:
layout, blades = Cl(p, q)
A = Frame(layout.randomV(p + q))
self.check_inv(A)
def test_innermorphic(self):
for p, q in [(2, 0), (3, 0), (4, 0)]:
layout, blades = Cl(p, q)
A = Frame(layout.randomV(p+q))
R = layout.randomRotor()
B = Frame([R*a*~R for a in A])
self.assertTrue(A.is_innermorphic_to(B))
try:
B = Frame(B)
B_En = B.En
except Exception:
pass
N = len(A)
# Determine and remove scaling factors caused by homogenization
if remove_scaling:
lam = omoh(A, B)
B = Frame([B[k] * lam[k] for k in range(N)])
try:
# compute ratio of volumes for each frame. take Nth root
A = Frame(A[:])
B = Frame(B[:])
alpha = abs(B.En / A.En) ** (1. / N)
if abs(alpha - 1) > eps:
spinor = True
# we have a spinor, remove the scaling (add it back in at the end)
B = [b / alpha for b in B]
except Exception:
# probably A and B are not pure vector correspondence
# whatever, it might still work
pass
# Find the Versor
# store each reflector/rotor in a list, make full versor at the
# end of the loop
r_list = []
# make copy of original frames, so we can rotate A
A = A[:]
B = B[:]
if len(A) != len(B):
raise ValueError('len(A)!=len(B)')
if eps is None:
eps = global_eps()
# Determine if we have a spinor
spinor = False
# store peudoscalar of frame B, in case known det (see end)
try:
B = Frame(B)
B_En = B.En
except Exception:
pass
N = len(A)
# Determine and remove scaling factors caused by homogenization
if remove_scaling:
lam = omoh(A, B)
B = Frame([B[k] * lam[k] for k in range(N)])
try:
# compute ratio of volumes for each frame. take Nth root
A = Frame(A[:])
B = Frame(B[:])
alpha = abs(B.En / A.En) ** (1. / N)
eps = global_eps()
# Determine if we have a spinor
spinor = False
# store peudoscalar of frame B, in case known det (see end)
try:
B = Frame(B)
B_En = B.En
except Exception:
pass
N = len(A)
# Determine and remove scaling factors caused by homogenization
if remove_scaling:
lam = omoh(A, B)
B = Frame([B[k] * lam[k] for k in range(N)])
try:
# compute ratio of volumes for each frame. take Nth root
A = Frame(A[:])
B = Frame(B[:])
alpha = abs(B.En / A.En) ** (1. / N)
if abs(alpha - 1) > eps:
spinor = True
# we have a spinor, remove the scaling (add it back in at the end)
B = [b / alpha for b in B]
except Exception:
# probably A and B are not pure vector correspondence
# whatever, it might still work
pass
# store peudoscalar of frame B, in case known det (see end)
try:
B = Frame(B)
B_En = B.En
except Exception:
pass
N = len(A)
# Determine and remove scaling factors caused by homogenization
if remove_scaling:
lam = omoh(A, B)
B = Frame([B[k] * lam[k] for k in range(N)])
try:
# compute ratio of volumes for each frame. take Nth root
A = Frame(A[:])
B = Frame(B[:])
alpha = abs(B.En / A.En) ** (1. / N)
if abs(alpha - 1) > eps:
spinor = True
# we have a spinor, remove the scaling (add it back in at the end)
B = [b / alpha for b in B]
except Exception:
# probably A and B are not pure vector correspondence
# whatever, it might still work
pass
# Find the Versor
# store each reflector/rotor in a list, make full versor at the
# end of the loop