8000 ENH: Make 1-dimensional axes not matter for contiguous flags by seberg · Pull Request #2694 · numpy/numpy · GitHub
[go: up one dir, main page]

Skip to content

ENH: Make 1-dimensional axes not matter for contiguous flags #2694

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 12 commits into from
Oct 25, 2012
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
MNT: Remove unnecessary special cases in _UpdateContiguousFlags
Remove unnecessary special cases for 0 and 1-d arrays as suggested
by njsmith.
  • Loading branch information
seberg committed Oct 23, 2012
commit 02ebf8b3e7674a6b8a06636feaa6c761fcdf4e2d
16 changes: 0 additions & 16 deletions numpy/core/src/multiarray/flagsobject.c
Original file line number Diff line number Diff line change
Expand Up @@ -101,23 +101,7 @@ _UpdateContiguousFlags(PyArrayObject *ap)
int i;
npy_bool is_c_contig = 1;

if (PyArray_NDIM(ap) == 0) {
PyArray_ENABLEFLAGS(ap, NPY_ARRAY_C_CONTIGUOUS);
PyArray_ENABLEFLAGS(ap, NPY_ARRAY_F_CONTIGUOUS);
return;
}
sd = PyArray_DESCR(ap)->elsize;
if (PyArray_NDIM(ap) == 1) {
if (PyArray_DIMS(ap)[0] == 1 || sd == PyArray_STRIDES(ap)[0]) {
PyArray_ENABLEFLAGS(ap, NPY_ARRAY_C_CONTIGUOUS);
PyArray_ENABLEFLAGS(ap, NPY_ARRAY_F_CONTIGUOUS);
return;
}
PyArray_CLEARFLAGS(ap, NPY_ARRAY_C_CONTIGUOUS);
PyArray_CLEARFLAGS(ap, NPY_ARRAY_F_CONTIGUOUS);
return;
}

for (i = PyArray_NDIM(ap) - 1; i >= 0; --i) {
dim = PyArray_DIMS(ap)[i];
/* contiguous by definition */
Expand Down
0