arrlp.sortloop module
- arrlp.sortloop(array, *arrays, axis=None, cuda=False, **kwargs)[source]
This generator allows to loop on unique values of an array rapidly by first sorting the array.
- Parameters:
array (ndarray) – The array to determine unique values and slices.
*arrays (ndarrays) – Other arrays to slice in parallel with array.
cuda (bool) – True to use on GPU in cupy.
axis (int or None) – Axis along which to find unique values. If None, flattens the array.
- Returns:
positions (array) – Positions corresponding to the current masked elements.
value (float or int) – first array value which was used for defining the masked region
*arrays – other array elements in the masked region
Examples
>>> from arrlp import sortloop ... >>> for pos, r, y, x in sortloop(R, Y, X) : ... result[pos] = scalar_function(y, x) # masked for each r