Skip to content

Commit 1242ba3

Browse files
committed
DOC: Comment fixups based on Marten's review
1 parent 13cd98a commit 1242ba3

File tree

3 files changed

+11
-7
lines changed

3 files changed

+11
-7
lines changed

numpy/core/src/multiarray/array_method.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -787,6 +787,13 @@ _masked_stridedloop_data_free(NpyAuxData *auxdata)
787787
* This function wraps a regular unmasked strided-loop as a
788788
* masked strided-loop, only calling the function for elements
789789
* where the mask is True.
790+
*
791+
* TODO: Reductions also use this code to implement masked reductions.
792+
* Before consolidating them, reductions had a special case for
793+
* broadcasts: when the mask stride was 0 the code does not check all
794+
* elements as `npy_memchr` currently does.
795+
* It may be worthwhile to add such an optimization again if broadcasted
796+
* masks are common enough.
790797
*/
791798
static int
792799
generic_masked_strided_loop(PyArrayMethod_Context *context,

numpy/core/src/umath/dispatching.c

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -862,10 +862,11 @@ logical_ufunc_promoter(PyUFuncObject *NPY_UNUSED(ufunc),
862862
&& op_dtypes[2]->type_num != NPY_OBJECT)) {
863863
return 0;
864864
}
865-
/* Actually, we have to use the OBJECT loop after all, set all we can
866-
* to object (that might not work out, but just try).
865+
/*
866+
* Actually, we have to use the OBJECT loop after all, set all we can
867+
* to object (that might not work out, but try).
867868
*
868-
* TODO: Change this to check for `op_dtypes[0] == NULL` to STOP
869+
* NOTE: Change this to check for `op_dtypes[0] == NULL` to STOP
869870
* returning `object` for `np.logical_and.reduce(obj_arr)`
870871
* which will also affect `np.all` and `np.any`!
871872
*/

numpy/core/src/umath/ufunc_object.c

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2849,10 +2849,6 @@ reduce_loop(PyArrayMethod_Context *context,
28492849
strides_copy[1] = strides[1];
28502850
strides_copy[2] = strides[0];
28512851
if (masked) {
2852-
/*
2853-
* TODO: This code had a broadcasted-mask optimization that may
2854-
* make sense in the array-method masked strided loop code.
2855-
*/
28562852
dataptrs_copy[3] = dataptrs[2];
28572853
strides_copy[3] = strides[2];
28582854
}

0 commit comments

Comments
 (0)