Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def rotor_between_objects_device(L1, L2, rotor):
L1sqrd_val = numba.cuda.local.array(32, dtype=numba.float64)
gp_device(L1, L1, L1sqrd_val)
if L1sqrd_val[0] > 0:
C_val = numba.cuda.local.array(32, dtype=numba.float64)
sigma_val = numba.cuda.local.array(32, dtype=numba.float64)
k_value = numba.cuda.local.array(32, dtype=numba.float64)
gp_device(L2, L1, C_val)
C_val[0] += 1.0
gp_mult_with_adjoint(C_val, sigma_val)
positive_root_device(sigma_val, k_value)
annhilate_k_device(k_value, C_val, rotor)
else:
L21 = numba.cuda.local.array(32, dtype=numba.float64)
L12 = numba.cuda.local.array(32, dtype=numba.float64)
gp_device(L2, L1, L21)
gp_device(L1, L2, L12)
sumval = 0.0
for i in range(32):
if i == 0:
sumval += abs(L12[i] + L21[i] - 2.0)
else:
sumval += abs(L12[i] + L21[i])
rotor[i] = -L21[i]
def rotor_between_lines_device(L1, L2, rotor):
L21_val = numba.cuda.local.array(32, dtype=numba.float64)
L12_val = numba.cuda.local.array(32, dtype=numba.float64)
gp_device(L2, L1, L21_val)
gp_device(L1, L2, L12_val)
beta_val = numba.cuda.local.array(32, dtype=numba.float64)
K_val = numba.cuda.local.array(32, dtype=numba.float64)
for i in range(32):
K_val[i] = L21_val[i] + L12_val[i]
beta_val[i] = 0.0
K_val[0] += 2.0
project_val_cuda(K_val, beta_val, 4)
alpha = 2.0 * K_val[0]
denominator = math.sqrt(alpha / 2)
normalisation_val = numba.cuda.local.array(32, dtype=numba.float64)
def apply_rotor_device(mv, rotor, output):
rotor_adjoint = numba.cuda.local.array(32, dtype=numba.float64)
temp = numba.cuda.local.array(32, dtype=numba.float64)
adjoint_device(rotor, rotor_adjoint)
gp_device(mv, rotor_adjoint, temp)
gp_device(rotor, temp, output)
def rotor_between_lines_device(L1, L2, rotor):
L21_val = numba.cuda.local.array(32, dtype=numba.float64)
L12_val = numba.cuda.local.array(32, dtype=numba.float64)
gp_device(L2, L1, L21_val)
gp_device(L1, L2, L12_val)
beta_val = numba.cuda.local.array(32, dtype=numba.float64)
K_val = numba.cuda.local.array(32, dtype=numba.float64)
for i in range(32):
K_val[i] = L21_val[i] + L12_val[i]
beta_val[i] = 0.0
K_val[0] += 2.0
project_val_cuda(K_val, beta_val, 4)
alpha = 2.0 * K_val[0]
denominator = math.sqrt(alpha / 2)
normalisation_val = numba.cuda.local.array(32, dtype=numba.float64)
output_val = numba.cuda.local.array(32, dtype=numba.float64)
def annhilate_k_device(K_val, C_val, output):
k_4 = numba.cuda.local.array(32, dtype=numba.float64)
project_val_cuda(K_val, k_4, 4)
for i in range(32):
k_4[i] = -k_4[i]
k_4[0] += K_val[0]
gp_device(k_4, C_val, output)
normalise_mv_device(output)
def gp_mult_with_adjoint(value, output):
other_value = numba.cuda.local.array(32, dtype=numba.float64)
adjoint_device(value, other_value)
gp_device(value, other_value, output)