• Home
  • Raw
  • Download

Lines Matching refs:ndbuf

88 struct ndbuf;
89 typedef struct ndbuf { struct
90 struct ndbuf *next; argument
91 struct ndbuf *prev; argument
111 ndbuf_t *ndbuf; in ndbuf_new() argument
126 ndbuf = PyMem_Malloc(sizeof *ndbuf); in ndbuf_new()
127 if (ndbuf == NULL) { in ndbuf_new()
132 ndbuf->next = NULL; in ndbuf_new()
133 ndbuf->prev = NULL; in ndbuf_new()
134 ndbuf->len = len; in ndbuf_new()
135 ndbuf->offset= offset; in ndbuf_new()
137 ndbuf->data = PyMem_Malloc(len); in ndbuf_new()
138 if (ndbuf->data == NULL) { in ndbuf_new()
140 PyMem_Free(ndbuf); in ndbuf_new()
144 ndbuf->flags = flags; in ndbuf_new()
145 ndbuf->exports = 0; in ndbuf_new()
147 base = &ndbuf->base; in ndbuf_new()
149 base->buf = ndbuf->data; in ndbuf_new()
158 base->internal = ndbuf; in ndbuf_new()
160 return ndbuf; in ndbuf_new()
164 ndbuf_free(ndbuf_t *ndbuf) in ndbuf_free() argument
166 Py_buffer *base = &ndbuf->base; in ndbuf_free()
168 PyMem_XFree(ndbuf->data); in ndbuf_free()
174 PyMem_Free(ndbuf); in ndbuf_free()
265 init_flags(ndbuf_t *ndbuf) in init_flags() argument
267 if (ndbuf->base.ndim == 0) in init_flags()
268 ndbuf->flags |= ND_SCALAR; in init_flags()
269 if (ndbuf->base.suboffsets) in init_flags()
270 ndbuf->flags |= ND_PIL; in init_flags()
271 if (PyBuffer_IsContiguous(&ndbuf->base, 'C')) in init_flags()
272 ndbuf->flags |= ND_C; in init_flags()
273 if (PyBuffer_IsContiguous(&ndbuf->base, 'F')) in init_flags()
274 ndbuf->flags |= ND_FORTRAN; in init_flags()
822 init_simple(ndbuf_t *ndbuf, PyObject *items, PyObject *format, in init_simple() argument
826 Py_buffer *base = &ndbuf->base; in init_simple()
838 base->readonly = !(ndbuf->flags & ND_WRITABLE); in init_simple()
887 strides_from_shape(const ndbuf_t *ndbuf, int flags) in strides_from_shape() argument
889 const Py_buffer *base = &ndbuf->base; in strides_from_shape()
1030 init_suboffsets(ndbuf_t *ndbuf) in init_suboffsets() argument
1032 Py_buffer *base = &ndbuf->base; in init_suboffsets()
1048 data = PyMem_Malloc(ndbuf->len + addsize); in init_suboffsets()
1054 memcpy(data + addsize, ndbuf->data, ndbuf->len); in init_suboffsets()
1056 PyMem_Free(ndbuf->data); in init_suboffsets()
1057 ndbuf->data = data; in init_suboffsets()
1058 ndbuf->len += addsize; in init_suboffsets()
1059 base->buf = ndbuf->data; in init_suboffsets()
1076 start = addsize + ndbuf->offset + imin; in init_suboffsets()
1103 ndbuf->flags &= ~(ND_C|ND_FORTRAN); in init_suboffsets()
1104 ndbuf->offset = 0; in init_suboffsets()
1120 init_structure(ndbuf_t *ndbuf, PyObject *shape, PyObject *strides, in init_structure() argument
1123 Py_buffer *base = &ndbuf->base; in init_structure()
1127 if (ndbuf->flags & ND_PIL) { in init_structure()
1132 ndbuf->flags |= (ND_SCALAR|ND_C|ND_FORTRAN); in init_structure()
1146 base->strides = strides_from_shape(ndbuf, ndbuf->flags); in init_structure()
1150 if (verify_structure(base->len, base->itemsize, ndbuf->offset, in init_structure()
1155 base->buf = ndbuf->data + ndbuf->offset; in init_structure()
1162 ndbuf->flags |= ND_C; in init_structure()
1164 ndbuf->flags |= ND_FORTRAN; in init_structure()
1168 if (ndbuf->flags & ND_PIL) { in init_structure()
1170 return init_suboffsets(ndbuf); in init_structure()
1180 ndbuf_t *ndbuf; in init_ndbuf() local
1241 ndbuf = ndbuf_new(nitems, itemsize, offset, flags); in init_ndbuf()
1242 if (ndbuf == NULL) { in init_ndbuf()
1248 if (init_simple(ndbuf, items, format, itemsize) < 0) in init_ndbuf()
1250 if (init_structure(ndbuf, shape, strides, ndim) < 0) in init_ndbuf()
1254 return ndbuf; in init_ndbuf()
1258 ndbuf_free(ndbuf); in init_ndbuf()
1268 ndbuf_t *ndbuf; in ndarray_push_base() local
1270 ndbuf = init_ndbuf(items, shape, strides, offset, format, flags); in ndarray_push_base()
1271 if (ndbuf == NULL) in ndarray_push_base()
1274 ndbuf_push(nd, ndbuf); in ndarray_push_base()
1419 ndbuf_t *ndbuf = self->head; in ndarray_getbuf() local
1420 Py_buffer *base = &ndbuf->base; in ndarray_getbuf()
1421 int baseflags = ndbuf->flags; in ndarray_getbuf()
1538 ndbuf_t *ndbuf = view->internal; in ndarray_releasebuf() local
1539 if (--ndbuf->exports == 0 && ndbuf != self->head) in ndarray_releasebuf()
1540 ndbuf_delete(self, ndbuf); in ndarray_releasebuf()
1590 ndbuf_t *ndbuf = self->head; in ndarray_item() local
1591 Py_buffer *base = &ndbuf->base; in ndarray_item()
1783 ndbuf_t *ndbuf; in ndarray_subscript() local
1817 ndbuf = nd->head; in ndarray_subscript()
1818 base = &ndbuf->base; in ndarray_subscript()
1823 ndbuf->flags |= ND_OWN_ARRAYS; in ndarray_subscript()
1849 init_flags(ndbuf); in ndarray_subscript()
2012 ndbuf_t *ndbuf = self->head; in ndarray_get_offset() local
2013 return PyLong_FromSsize_t(ndbuf->offset); in ndarray_get_offset()
2158 ndbuf_t *ndbuf = ((NDArrayObject *)self)->head; in ndarray_tobytes() local
2159 Py_buffer *src = &ndbuf->base; in ndarray_tobytes()
2164 if (ND_C_CONTIGUOUS(ndbuf->flags)) in ndarray_tobytes()
2180 dest.strides = strides_from_shape(ndbuf, 0); in ndarray_tobytes()
2236 const ndbuf_t *ndbuf; in ndarray_memoryview_from_buffer() local
2245 ndbuf = nd->head; /* self is ndarray/original exporter */ in ndarray_memoryview_from_buffer()
2248 ndbuf = ((NDArrayObject *)view->obj)->head; in ndarray_memoryview_from_buffer()
2257 p = PyMem_Realloc(infobuf, ndbuf->len); in ndarray_memoryview_from_buffer()
2268 memcpy(infobuf, ndbuf->data, ndbuf->len); in ndarray_memoryview_from_buffer()
2269 info.buf = infobuf + ((char *)view->buf - ndbuf->data); in ndarray_memoryview_from_buffer()