nums.core.array.application.ArrayApplication¶
-
class
nums.core.array.application.ArrayApplication(cm, fs)[source]¶ -
map_bop(op_name, arr_1, arr_2, out=None, where=True, args=None, kwargs=None)[source]¶ A map for binary operators that applies element-wise to every entry of the input arrays.
- Parameters
op_name (
str) – An element-wise binary operator.arr_1 (
BlockArray) – A BlockArray.arr_2 (
BlockArray) – A BlockArray.out (
Optional[BlockArray]) – A BlockArray to which the result is written.where – An indicator specifying the indices to which op is applied.
args – Args provided to op.
kwargs – Keyword args provided to op.
- Return type
BlockArray- Returns
A BlockArray.
-
map_uop(op_name, arr, out=None, where=True, args=None, kwargs=None)[source]¶ A map, for unary operators, that applies to every entry of an array.
- Parameters
op_name (
str) – An element-wise unary operator.arr (
BlockArray) – A BlockArray.out (
Optional[BlockArray]) – A BlockArray to which the result is written.where – An indicator specifying the indices to which op is applied.
args – Args provided to op.
kwargs – Keyword args provided to op.
- Return type
BlockArray- Returns
A BlockArray.
-
median(arr)[source]¶ Compute the median of a BlockArray.
- Parameters
a – A BlockArray.
- Return type
BlockArray- Returns
The median value.
-
top_k(arr, k, largest=True)[source]¶ Find the k largest or smallest elements of a BlockArray.
If there are multiple kth elements that are equal in value, then no guarantees are made as to which ones are included in the top k.
- Parameters
arr (
BlockArray) – A BlockArray.k (
int) – Number of top elements to return.largest – Whether to return largest or smallest elements.
- Return type
Tuple[BlockArray,BlockArray]- Returns
A tuple containing two BlockArrays, (values, indices). values: Values of the top k elements, unsorted. indices: Indices of the top k elements, ordered by their corresponding values.
-