def test_ldexp(ctx_factory): context = ctx_factory() queue = cl.CommandQueue(context) for s in sizes: a = cl_array.arange(queue, s, dtype=np.float32) a2 = cl_array.arange(queue, s, dtype=np.float32) * 1e-3 b = clmath.ldexp(a, a2) a = a.get() a2 = a2.get() b = b.get() for i in range(s): assert math.ldexp(a[i], int(a2[i])) == b[i]
def test_ldexp(ctx_getter): context = ctx_getter() queue = cl.CommandQueue(context) for s in sizes: a = cl_array.arange(context, queue, s, dtype=numpy.float32) a2 = cl_array.arange(context, queue, s, dtype=numpy.float32)*1e-3 b = clmath.ldexp(a,a2) a = a.get() a2 = a2.get() b = b.get() for i in range(s): assert math.ldexp(a[i], int(a2[i])) == b[i]