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

Function array_squeeze

numpy/core/src/multiarray/methods.c:210–235  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

208}
209
210static PyObject *
211array_squeeze(PyArrayObject *self,
212 PyObject *const *args, Py_ssize_t len_args, PyObject *kwnames)
213{
214 PyObject *axis_in = NULL;
215 npy_bool axis_flags[NPY_MAXDIMS];
216 NPY_PREPARE_ARGPARSER;
217
218 if (npy_parse_arguments("squeeze", args, len_args, kwnames,
219 "|axis", NULL, &axis_in,
220 NULL, NULL, NULL) < 0) {
221 return NULL;
222 }
223
224 if (axis_in == NULL || axis_in == Py_None) {
225 return PyArray_Squeeze(self);
226 }
227 else {
228 if (PyArray_ConvertMultiAxis(axis_in, PyArray_NDIM(self),
229 axis_flags) != NPY_SUCCEED) {
230 return NULL;
231 }
232
233 return PyArray_SqueezeSelected(self, axis_flags);
234 }
235}
236
237static PyObject *
238array_view(PyArrayObject *self,

Callers

nothing calls this directly

Calls 4

PyArray_SqueezeFunction · 0.85
PyArray_ConvertMultiAxisFunction · 0.85
PyArray_NDIMFunction · 0.85
PyArray_SqueezeSelectedFunction · 0.85

Tested by

no test coverage detected