8000 MAINT: Minor ufunc cleanup by eric-wieser · Pull Request #8876 · numpy/numpy · GitHub
[go: up one dir, main page]

Skip to content

MAINT: Minor ufunc cleanup #8876

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
May 1, 2017
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
MAINT: Compute core_dim_ixs_size near where it is used
  • Loading branch information
eric-wieser committed Apr 6, 2017
commit 19ae9fb4f03d0d8379c64bbd5589dad961436044
6 changes: 4 additions & 2 deletions numpy/core/src/umath/ufunc_object.c
Original file line number Diff line number Diff line change
Expand Up @@ -2226,7 +2226,6 @@ PyUFunc_GeneralizedFunction(PyUFuncObject *ufunc,

/* Fill in op_axes for all the operands */
j = broadcast_ndim;
core_dim_ixs_size = 0;
for (i = 0; i < nop; ++i) {
int n;
if (op[i]) {
Expand Down Expand Up @@ -2268,7 +2267,6 @@ PyUFunc_GeneralizedFunction(PyUFuncObject *ufunc,
}

op_axes[i] = op_axes_arrays[i];
core_dim_ixs_size += ufunc->core_num_dims[i];
}

/* Get the buffersize and errormask */
Expand Down Expand Up @@ -2383,6 +2381,10 @@ PyUFunc_GeneralizedFunction(PyUFuncObject *ufunc,
* Set up the inner strides array. Because we're not doing
* buffering, the strides are fixed throughout the looping.
*/
core_dim_ixs_size = 0;
for (i = 0; i < nop; ++i) {
core_dim_ixs_size += ufunc->core_num_dims[i];
}
inner_strides = (npy_intp *)PyArray_malloc(
NPY_SIZEOF_INTP * (nop+core_dim_ixs_size));
if (inner_strides == NULL) {
Expand Down
0