Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def main():
cu_discriminant = vectorize(['f4(f4, f4, f4)', 'f8(f8, f8, f8)'],
target='cuda')(poly.discriminant)
N = 1e+8 // 2
print('Data size', N)
A, B, C = poly.generate_input(N, dtype=np.float32)
D = np.empty(A.shape, dtype=A.dtype)
stream = cuda.stream()
print('== One')
ts = time()
with stream.auto_synchronize():
**numba_flags)(*user_args,
**user_kwargs)
# Alternative way of calling:
# user_returns = jit(cache=True)(self.user_function) \
# (*user_args, **user_kwargs)
elif numba_mode == 'generated_jit':
user_returns = generated_jit(self.user_function,
**numba_flags)(*user_args,
**user_kwargs)
elif numba_mode == 'njit':
numba_flags['cache'] = True # Always force cache
user_returns = njit(self.user_function,
**numba_flags)(*user_args, **user_kwargs)
elif numba_mode == 'vectorize':
numba_signature = self.decorator_arguments['numba_signature']
user_returns = vectorize(
numba_signature,
**numba_flags
)(self.user_function)(*user_args, **user_kwargs)
elif numba_mode == 'guvectorize':
numba_signature = self.decorator_arguments['numba_signature']
numba_decl = self.decorator_arguments['numba_declaration']
user_returns = guvectorize(
numba_signature,
numba_decl,
**numba_flags
)(self.user_function)(*user_args, **user_kwargs)
elif numba_mode == 'stencil':
user_returns = stencil(
**numba_flags
)(self.user_function)(*user_args, **user_kwargs)
elif numba_mode == 'cfunc':
@vectorize(nopython=True)
def beta_logcdf(alpha, beta, x):
return pbeta(x, alpha, beta, 1, 1)
@vectorize(['complex64(complex64)'], target='parallel')
def complex_squared(a):
"""
Implements array division on GPU
Parameters
----------
:param a Two Numpy arrays of the same shape, dtype=numpy.complex64
Returns
-------
a**2
"""
return a**2
@vectorize(nopython=True)
def fdist_logcdf(v1, v2, x):
return pf(x, v1, v2, 1, 1)
@vectorize(nopython=True)
def cauchy_cf(mu, sigma, x):
return np.exp(mu*1j*x - sigma*np.abs(x))
@vectorize(nopython=True)
def cauchy_mgf(mu, sigma, x):
return None
@vectorize(nopython=True)
def cauchy_ccdf(mu, sigma, x):
return pcauchy(x, mu, sigma, 0, 0)
@vectorize([bool_(float64, float64)])
def ray(x, y):
# where xy is a coordinate
n = len(poly)
inside = False
p2x = 0.0
p2y = 0.0
xints = 0.0
p1x, p1y = poly[0]
for i in range(n + 1):
p2x, p2y = poly[i % n]
if y > min(p1y, p2y):
if y <= max(p1y, p2y):
if x <= max(p1x, p2x):
if p1y != p2y:
xints = (y - p1y) * (p2x - p1x) / (p2y - p1y) + p1x
if p1x == p2x or x <= xints:
@vectorize(nopython=True)
def hyper_cdf(s, f, n, x):
return phyper(x, s, f, n, 1, 0)