Skip to content

Commit

Permalink
Add comments
Browse files Browse the repository at this point in the history
  • Loading branch information
sklam committed Feb 2, 2022
1 parent a764d8e commit 5967666
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion numba/np/npyimpl.py
Original file line number Diff line number Diff line change
Expand Up @@ -384,10 +384,16 @@ def numpy_ufunc_kernel(context, builder, sig, args, ufunc, kernel_class):

loopshape = outputs[0].shape

input_layouts = [inp.layout for inp in inputs if isinstance(inp, _ArrayHelper)]
# count the number of C and F layout arrays, respectively
input_layouts = [inp.layout for inp in inputs
if isinstance(inp, _ArrayHelper)]
num_c_layout = len([x for x in input_layouts if x == 'C'])
num_f_layout = len([x for x in input_layouts if x == 'F'])

# Only choose F iteration order if more arrays are in F layout.
# Default to C order otherwise.
# This is a best effort for performance. NumPy has more fancy logic that
# uses array iterators in non-trivial cases.
if num_f_layout > num_c_layout:
order = 'F'
else:
Expand Down

0 comments on commit 5967666

Please sign in to comment.