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

Function array_transpose

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

Source from the content-addressed store, hash-verified

2375
2376
2377static PyObject *
2378array_transpose(PyArrayObject *self, PyObject *args)
2379{
2380 PyObject *shape = Py_None;
2381 Py_ssize_t n = PyTuple_Size(args);
2382 PyArray_Dims permute;
2383 PyObject *ret;
2384
2385 if (n > 1) {
2386 shape = args;
2387 }
2388 else if (n == 1) {
2389 shape = PyTuple_GET_ITEM(args, 0);
2390 }
2391
2392 if (shape == Py_None) {
2393 ret = PyArray_Transpose(self, NULL);
2394 }
2395 else {
2396 if (!PyArray_IntpConverter(shape, &permute)) {
2397 return NULL;
2398 }
2399 ret = PyArray_Transpose(self, &permute);
2400 npy_free_cache_dim_obj(permute);
2401 }
2402
2403 return ret;
2404}
2405
2406#define _CHKTYPENUM(typ) ((typ) ? (typ)->type_num : NPY_NOTYPE)
2407

Callers

nothing calls this directly

Calls 3

PyArray_TransposeFunction · 0.85
PyArray_IntpConverterFunction · 0.85
npy_free_cache_dim_objFunction · 0.85

Tested by

no test coverage detected