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

Function PyArray_Zeros

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

NUMPY_API * Zeros * * steals a reference to type. On failure or when dtype->subarray is * true, dtype will be decrefed. * accepts NULL type */

Source from the content-addressed store, hash-verified

2849 * accepts NULL type
2850 */
2851NPY_NO_EXPORT PyObject *
2852PyArray_Zeros(int nd, npy_intp const *dims, PyArray_Descr *type, int is_f_order)
2853{
2854 PyArrayObject *ret;
2855
2856 if (!type) {
2857 type = PyArray_DescrFromType(NPY_DEFAULT_TYPE);
2858 }
2859
2860 ret = (PyArrayObject *)PyArray_NewFromDescr_int(
2861 &PyArray_Type, type,
2862 nd, dims, NULL, NULL,
2863 is_f_order, NULL, NULL,
2864 _NPY_ARRAY_ZEROED);
2865
2866 if (ret == NULL) {
2867 return NULL;
2868 }
2869
2870 return (PyObject *)ret;
2871}
2872
2873/*NUMPY_API
2874 * Empty

Callers 3

array_zerosFunction · 0.85
prepare_indexFunction · 0.85
PyArray_MapIterNewFunction · 0.85

Calls 1

PyArray_NewFromDescr_intFunction · 0.85

Tested by

no test coverage detected