Lines Matching refs:nd
65 #define ND_IS_CONSUMER(nd) \ argument
66 (((NDArrayObject *)nd)->head == &((NDArrayObject *)nd)->staticbuf)
178 ndbuf_push(NDArrayObject *nd, ndbuf_t *elt) in ndbuf_push() argument
180 elt->next = nd->head; in ndbuf_push()
181 if (nd->head) nd->head->prev = elt; in ndbuf_push()
182 nd->head = elt; in ndbuf_push()
187 ndbuf_delete(NDArrayObject *nd, ndbuf_t *elt) in ndbuf_delete() argument
192 nd->head = elt->next; in ndbuf_delete()
201 ndbuf_pop(NDArrayObject *nd) in ndbuf_pop() argument
203 ndbuf_delete(nd, nd->head); in ndbuf_pop()
210 NDArrayObject *nd; in ndarray_new() local
212 nd = PyObject_New(NDArrayObject, &NDArray_Type); in ndarray_new()
213 if (nd == NULL) in ndarray_new()
216 nd->flags = 0; in ndarray_new()
217 nd->head = NULL; in ndarray_new()
218 return (PyObject *)nd; in ndarray_new()
243 ndarray_init_staticbuf(PyObject *exporter, NDArrayObject *nd, int flags) in ndarray_init_staticbuf() argument
245 Py_buffer *base = &nd->staticbuf.base; in ndarray_init_staticbuf()
250 nd->head = &nd->staticbuf; in ndarray_init_staticbuf()
252 nd->head->next = NULL; in ndarray_init_staticbuf()
253 nd->head->prev = NULL; in ndarray_init_staticbuf()
254 nd->head->len = -1; in ndarray_init_staticbuf()
255 nd->head->offset = -1; in ndarray_init_staticbuf()
256 nd->head->data = NULL; in ndarray_init_staticbuf()
258 nd->head->flags = base->readonly ? 0 : ND_WRITABLE; in ndarray_init_staticbuf()
259 nd->head->exports = 0; in ndarray_init_staticbuf()
658 ndarray_as_list(NDArrayObject *nd) in ndarray_as_list() argument
662 Py_buffer *base = &nd->head->base; in ndarray_as_list()
671 base = &nd->head->base; in ndarray_as_list()
680 assert(ND_C_CONTIGUOUS(nd->head->flags)); in ndarray_as_list()
689 assert(ND_C_CONTIGUOUS(nd->head->flags)); in ndarray_as_list()
690 strides = strides_from_shape(nd->head, 0); in ndarray_as_list()
1264 ndarray_push_base(NDArrayObject *nd, PyObject *items, in ndarray_push_base() argument
1274 ndbuf_push(nd, ndbuf); in ndarray_push_base()
1282 NDArrayObject *nd = (NDArrayObject *)self; in ndarray_init() local
1312 if (ndarray_init_staticbuf(v, nd, getbuf) < 0) in ndarray_init()
1315 init_flags(nd->head); in ndarray_init()
1316 nd->head->flags |= flags; in ndarray_init()
1336 nd->flags |= ND_VAREXPORT; in ndarray_init()
1341 return ndarray_push_base(nd, v, shape, strides, offset, format, flags); in ndarray_init()
1348 NDArrayObject *nd = (NDArrayObject *)self; in ndarray_push() local
1368 if (ND_IS_CONSUMER(nd)) { in ndarray_push()
1373 if (!(nd->flags&ND_VAREXPORT) && nd->head->exports > 0) { in ndarray_push()
1376 nd->head->exports, nd->head->exports==1 ? "" : "s"); in ndarray_push()
1380 if (ndarray_push_base(nd, items, shape, strides, in ndarray_push()
1390 NDArrayObject *nd = (NDArrayObject *)self; in ndarray_pop() local
1391 if (ND_IS_CONSUMER(nd)) { in ndarray_pop()
1396 if (nd->head->exports > 0) { in ndarray_pop()
1399 nd->head->exports, nd->head->exports==1 ? "" : "s"); in ndarray_pop()
1402 if (nd->head->next == NULL) { in ndarray_pop()
1408 ndbuf_pop(nd); in ndarray_pop()
1607 NDArrayObject *nd; in ndarray_item() local
1610 nd = (NDArrayObject *)ndarray_new(&NDArray_Type, NULL, NULL); in ndarray_item()
1611 if (nd == NULL) in ndarray_item()
1614 if (ndarray_init_staticbuf((PyObject *)self, nd, PyBUF_FULL_RO) < 0) { in ndarray_item()
1615 Py_DECREF(nd); in ndarray_item()
1619 subview = &nd->staticbuf.base; in ndarray_item()
1629 init_flags(&nd->staticbuf); in ndarray_item()
1631 return (PyObject *)nd; in ndarray_item()
1782 NDArrayObject *nd; in ndarray_subscript() local
1806 nd = (NDArrayObject *)ndarray_new(&NDArray_Type, NULL, NULL); in ndarray_subscript()
1807 if (nd == NULL) in ndarray_subscript()
1811 if (ndarray_init_staticbuf((PyObject *)self, nd, PyBUF_FULL_RO) < 0) { in ndarray_subscript()
1812 Py_DECREF(nd); in ndarray_subscript()
1817 ndbuf = nd->head; in ndarray_subscript()
1820 Py_DECREF(nd); in ndarray_subscript()
1851 return (PyObject *)nd; in ndarray_subscript()
1859 Py_DECREF(nd); in ndarray_subscript()
1867 NDArrayObject *nd; in ndarray_ass_subscript() local
1910 nd = (NDArrayObject *)ndarray_subscript(self, key); in ndarray_ass_subscript()
1911 if (nd != NULL) { in ndarray_ass_subscript()
1912 dest = &nd->head->base; in ndarray_ass_subscript()
1914 Py_DECREF(nd); in ndarray_ass_subscript()
2088 NDArrayObject *nd = (NDArrayObject *)self; in ndarray_c_contig() local
2089 int ret = PyBuffer_IsContiguous(&nd->head->base, 'C'); in ndarray_c_contig()
2091 if (ret != ND_C_CONTIGUOUS(nd->head->flags)) { in ndarray_c_contig()
2102 NDArrayObject *nd = (NDArrayObject *)self; in ndarray_fortran_contig() local
2103 int ret = PyBuffer_IsContiguous(&nd->head->base, 'F'); in ndarray_fortran_contig()
2105 if (ret != ND_FORTRAN_CONTIGUOUS(nd->head->flags)) { in ndarray_fortran_contig()
2116 NDArrayObject *nd = (NDArrayObject *)self; in ndarray_contig() local
2117 int ret = PyBuffer_IsContiguous(&nd->head->base, 'A'); in ndarray_contig()
2119 if (ret != ND_ANY_CONTIGUOUS(nd->head->flags)) { in ndarray_contig()
2198 NDArrayObject *nd = (NDArrayObject *)self; in ndarray_add_suboffsets() local
2199 Py_buffer *base = &nd->head->base; in ndarray_add_suboffsets()
2222 nd->head->flags &= ~(ND_C|ND_FORTRAN); in ndarray_add_suboffsets()
2234 const NDArrayObject *nd = (NDArrayObject *)self; in ndarray_memoryview_from_buffer() local
2235 const Py_buffer *view = &nd->head->base; in ndarray_memoryview_from_buffer()
2244 if (!ND_IS_CONSUMER(nd)) in ndarray_memoryview_from_buffer()
2245 ndbuf = nd->head; /* self is ndarray/original exporter */ in ndarray_memoryview_from_buffer()
2607 const NDArrayObject *nd = (NDArrayObject *)self; in ndarray_hash() local
2608 const Py_buffer *view = &nd->head->base; in ndarray_hash()