Skip to content

Commit bbdaa0c

Browse files
committed
WIP support for engine="flox"
1 parent 59ed451 commit bbdaa0c

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

flox/aggregate_flox.py

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,9 @@ def _np_grouped_op(group_idx, array, op, axis=-1, size=None, fill_value=None, dt
2525
most of this code is from shoyer's gist
2626
https://gist.github.com/shoyer/f538ac78ae904c936844
2727
"""
28-
# assumes input is sorted, which I do in core._prepare_for_flox
28+
# For numpy arrays, assumes input is sorted, which I do in _prepare_for_flox
29+
# For cupy arrays, sorting is not needed
30+
2931
aux = group_idx
3032

3133
flag = np.concatenate((np.array([True], like=array), aux[1:] != aux[:-1]))
@@ -38,7 +40,12 @@ def _np_grouped_op(group_idx, array, op, axis=-1, size=None, fill_value=None, dt
3840
dtype = array.dtype
3941

4042
if out is None:
41-
out = np.full(array.shape[:-1] + (size,), fill_value=fill_value, dtype=dtype)
43+
out = np.full(array.shape[:-1] + (size,), fill_value=fill_value, dtype=dtype, like=array)
44+
45+
# if isinstance(array, cupy_array_type):
46+
# op = cupy_ops[op]
47+
# op(out, group_idx, array)
48+
# return out
4249

4350
if (len(uniques) == size) and (uniques == np.arange(size, like=array)).all():
4451
# The previous version of this if condition

0 commit comments

Comments
 (0)