8000 REV: 8daf144 and following. Strides must be clean to be contiguous by seberg · Pull Request #2735 · numpy/numpy · GitHub
[go: up one dir, main page]

Skip to content

REV: 8daf144 and following. Strides must be clean to be contiguous #2735

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

Closed
wants to merge 2 commits into from
Closed
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
BUG: Fix small issue with flags setting in ctors.
  • Loading branch information
seberg committed Nov 14, 2012
commit fa09b2d4dcd2c0f650515f9f2267bcd53533bce5
5 changes: 2 additions & 3 deletions numpy/core/src/multiarray/ctors.c
Original file line number Diff line number Diff line change
Expand Up @@ -3572,8 +3572,7 @@ _array_fill_strides(npy_intp *strides, npy_intp *dims, int nd, size_t itemsize,
strides[i] = itemsize;
itemsize *= dims[i] ? dims[i] : 1;
}
if ((nd != 0) && (strides[0] != strides[nd-1])) {
/* Unless all strides are itemsize its not both */
if ((nd > 1) && ((strides[0] != strides[nd-1]) || (dims[0] > 2))) {
*objflags = ((*objflags)|NPY_ARRAY_F_CONTIGUOUS) &
~NPY_ARRAY_C_CONTIGUOUS;
}
Expand All @@ -3586,7 +3585,7 @@ _array_fill_strides(npy_intp *strides, npy_intp *dims, int nd, size_t itemsize,
strides[i] = itemsize;
itemsize *= dims[i] ? dims[i] : 1;
}
if ((nd != 0) && (strides[0] != strides[nd-1])) {
if ((nd > 1) && ((strides[0] != strides[nd-1]) || (dims[nd-1] > 2))) {
*objflags = ((*objflags)|NPY_ARRAY_C_CONTIGUOUS) &
~NPY_ARRAY_F_CONTIGUOUS;
}
Expand Down
0