MCPcopy Create free account
hub / github.com/numpy/numpy / PyArray_UpdateFlags

Function PyArray_UpdateFlags

numpy/core/src/multiarray/flagsobject.c:61–89  ·  view source on GitHub ↗

NUMPY_API * Update Several Flags at once. */

Source from the content-addressed store, hash-verified

59 * Update Several Flags at once.
60 */
61NPY_NO_EXPORT void
62PyArray_UpdateFlags(PyArrayObject *ret, int flagmask)
63{
64 /* Always update both, as its not trivial to guess one from the other */
65 if (flagmask & (NPY_ARRAY_F_CONTIGUOUS | NPY_ARRAY_C_CONTIGUOUS)) {
66 _UpdateContiguousFlags(ret);
67 }
68 if (flagmask & NPY_ARRAY_ALIGNED) {
69 if (IsAligned(ret)) {
70 PyArray_ENABLEFLAGS(ret, NPY_ARRAY_ALIGNED);
71 }
72 else {
73 PyArray_CLEARFLAGS(ret, NPY_ARRAY_ALIGNED);
74 }
75 }
76 /*
77 * This is not checked by default WRITEABLE is not
78 * part of UPDATE_ALL
79 */
80 if (flagmask & NPY_ARRAY_WRITEABLE) {
81 if (_IsWriteable(ret)) {
82 PyArray_ENABLEFLAGS(ret, NPY_ARRAY_WRITEABLE);
83 }
84 else {
85 PyArray_CLEARFLAGS(ret, NPY_ARRAY_WRITEABLE);
86 }
87 }
88 return;
89}
90
91/*
92 * Check whether the given array is stored contiguously

Callers 10

array_shape_setFunction · 0.85
array_strides_setFunction · 0.85
array_descr_setFunction · 0.85
array_setstateFunction · 0.85
PyArray_NewFromDescr_intFunction · 0.85
PyArray_FromInterfaceFunction · 0.85
PyArray_TransposeFunction · 0.85
PyArray_RawIterBaseInitFunction · 0.85
PyArray_BroadcastToShapeFunction · 0.85

Calls 5

_UpdateContiguousFlagsFunction · 0.85
IsAlignedFunction · 0.85
PyArray_ENABLEFLAGSFunction · 0.85
PyArray_CLEARFLAGSFunction · 0.85
_IsWriteableFunction · 0.85

Tested by

no test coverage detected