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

Function PyArray_NewLikeArray

numpy/core/src/multiarray/ctors.c:1157–1167  ·  view source on GitHub ↗

NUMPY_API * Creates a new array with the same shape as the provided one, * with possible memory layout order and data type changes. * * prototype - The array the new one should be like. * order - NPY_CORDER - C-contiguous result. * NPY_FORTRANORDER - Fortran-contiguous result. * NPY_ANYORDER - Fortran if prototype is Fortran, C otherwise. * NPY_KEEPO

Source from the content-addressed store, hash-verified

1155 * dtype->subarray is true, dtype will be decrefed.
1156 */
1157NPY_NO_EXPORT PyObject *
1158PyArray_NewLikeArray(PyArrayObject *prototype, NPY_ORDER order,
1159 PyArray_Descr *dtype, int subok)
1160{
1161 if (prototype == NULL) {
1162 PyErr_SetString(PyExc_ValueError,
1163 "prototype is NULL in PyArray_NewLikeArray");
1164 return NULL;
1165 }
1166 return PyArray_NewLikeArrayWithShape(prototype, order, dtype, -1, NULL, subok);
1167}
1168
1169/*NUMPY_API
1170 * Generic new array creation routine.

Callers 7

array_datetime_as_stringFunction · 0.85
array_astypeFunction · 0.85
PyArray_FromArrayFunction · 0.85
new_array_for_sumFunction · 0.85
PyArray_NewCopyFunction · 0.85
PyArray_AssignArrayFunction · 0.85

Calls 1

Tested by

no test coverage detected