diff --git a/utilities.py b/utilities.py index 61771fdbbc747493453c1fb7ae9478a273cfa792..0026bf518b8db21ca2a6b4cd42a26940dee243ab 100644 --- a/utilities.py +++ b/utilities.py @@ -18,16 +18,20 @@ def identity_matrix(n): return np.identity(n).astype(np.float32).copy(order="F") -def random_array_on_device(queue, *shape): - ary = empty_array_on_device(queue, *shape) - cl.clrandom.fill_rand(ary) - return ary +def empty_array(*shape): + return np.empty(shape, dtype=np.float32, order="F") def empty_array_on_device(queue, *shape): return cl.array.empty(queue, shape, dtype=np.float32, order="F") +def random_array_on_device(queue, *shape): + ary = empty_array_on_device(queue, *shape) + cl.clrandom.fill_rand(ary) + return ary + + def arrays_from_string(string_arrays): return split_map_to_list(string_arrays, array_from_string, ":")