• Home
  • Raw
  • Download

Lines Matching refs:ndim

253     (view->suboffsets && view->suboffsets[dest->ndim-1] >= 0)
258 assert(dest->ndim > 0 && src->ndim > 0); in last_dim_is_contiguous()
261 dest->strides[dest->ndim-1] == dest->itemsize && in last_dim_is_contiguous()
262 src->strides[src->ndim-1] == src->itemsize); in last_dim_is_contiguous()
296 if (dest->ndim != src->ndim) in equiv_shape()
299 for (i = 0; i < dest->ndim; i++) { in equiv_shape()
359 copy_rec(const Py_ssize_t *shape, Py_ssize_t ndim, Py_ssize_t itemsize, in copy_rec() argument
366 assert(ndim >= 1); in copy_rec()
368 if (ndim == 1) { in copy_rec()
380 copy_rec(shape+1, ndim-1, itemsize, in copy_rec()
393 assert(dest->ndim == 1); in copy_single()
425 assert(dest->ndim > 0); in copy_buffer()
431 mem = PyMem_Malloc(dest->shape[dest->ndim-1] * dest->itemsize); in copy_buffer()
438 copy_rec(dest->shape, dest->ndim, dest->itemsize, in copy_buffer()
455 assert(view->ndim > 0); in init_strides_from_shape()
457 view->strides[view->ndim-1] = view->itemsize; in init_strides_from_shape()
458 for (i = view->ndim-2; i >= 0; i--) in init_strides_from_shape()
468 assert(view->ndim > 0); in init_fortran_strides_from_shape()
471 for (i = 1; i < view->ndim; i++) in init_fortran_strides_from_shape()
485 assert(src->ndim >= 1); in buffer_to_contiguous()
489 strides = PyMem_Malloc(src->ndim * (sizeof *src->strides)); in buffer_to_contiguous()
543 if (src->ndim == 0) { in init_shape_strides()
548 if (src->ndim == 1) { in init_shape_strides()
554 for (i = 0; i < src->ndim; i++) in init_shape_strides()
557 for (i = 0; i < src->ndim; i++) in init_shape_strides()
574 for (i = 0; i < src->ndim; i++) in init_suboffsets()
585 for (i = 0; i < view->ndim; i++) in init_len()
599 switch (view->ndim) { in init_flags()
627 memory_alloc(int ndim) in memory_alloc() argument
632 PyObject_GC_NewVar(PyMemoryViewObject, &PyMemoryView_Type, 3*ndim); in memory_alloc()
640 mv->view.ndim = ndim; in memory_alloc()
642 mv->view.strides = mv->ob_array + ndim; in memory_alloc()
643 mv->view.suboffsets = mv->ob_array + 2 * ndim; in memory_alloc()
667 if (src->ndim > PyBUF_MAX_NDIM) { in mbuf_add_view()
674 mv = memory_alloc(src->ndim); in mbuf_add_view()
698 int ndim) in mbuf_add_incomplete_view() argument
706 assert(ndim <= PyBUF_MAX_NDIM); in mbuf_add_incomplete_view()
708 mv = memory_alloc(ndim); in mbuf_add_incomplete_view()
848 assert(src->ndim > 0); in memory_from_contiguous_copy()
865 mv = (PyMemoryViewObject *)mbuf_add_incomplete_view(mbuf, NULL, src->ndim); in memory_from_contiguous_copy()
876 for (i = 0; i < src->ndim; i++) { in memory_from_contiguous_copy()
999 fb = PyMem_Malloc(sizeof *fb + 3 * src->ndim * (sizeof *fb->array)); in PyBuffer_ToContiguous()
1004 fb->view.ndim = src->ndim; in PyBuffer_ToContiguous()
1006 fb->view.strides = fb->array + src->ndim; in PyBuffer_ToContiguous()
1007 fb->view.suboffsets = fb->array + 2 * src->ndim; in PyBuffer_ToContiguous()
1191 assert(view->ndim >= 1); in cast_to_1D()
1192 assert(Py_SIZE(mv) == 3*view->ndim); in cast_to_1D()
1194 assert(view->strides == mv->ob_array + view->ndim); in cast_to_1D()
1195 assert(view->suboffsets == mv->ob_array + 2*view->ndim); in cast_to_1D()
1230 view->ndim = 1; in cast_to_1D()
1246 copy_shape(Py_ssize_t *shape, const PyObject *seq, Py_ssize_t ndim, in copy_shape() argument
1252 for (i = 0; i < ndim; i++) { in copy_shape()
1285 cast_to_ND(PyMemoryViewObject *mv, const PyObject *shape, int ndim) in cast_to_ND() argument
1290 assert(view->ndim == 1); /* ndim from cast_to_1D() */ in cast_to_ND()
1291 assert(Py_SIZE(mv) == 3*(ndim==0?1:ndim)); /* ndim of result array */ in cast_to_ND()
1293 assert(view->strides == mv->ob_array + (ndim==0?1:ndim)); in cast_to_ND()
1296 view->ndim = ndim; in cast_to_ND()
1297 if (view->ndim == 0) { in cast_to_ND()
1303 len = copy_shape(view->shape, shape, ndim, view->itemsize); in cast_to_ND()
1326 for (i = 0; i < view->ndim; i++) in zero_in_shape()
1352 Py_ssize_t ndim = 1; in memory_cast() local
1370 if ((shape || self->view.ndim != 1) && zero_in_shape(self)) { in memory_cast()
1377 ndim = PySequence_Fast_GET_SIZE(shape); in memory_cast()
1378 if (ndim > PyBUF_MAX_NDIM) { in memory_cast()
1384 if (self->view.ndim != 1 && ndim != 1) { in memory_cast()
1392 mbuf_add_incomplete_view(self->mbuf, &self->view, ndim==0 ? 1 : (int)ndim); in memory_cast()
1398 if (shape && cast_to_ND(mv, shape, (int)ndim) < 0) in memory_cast()
1494 view->ndim = 1; in memory_getbuf()
2067 tolist_rec(const char *ptr, Py_ssize_t ndim, const Py_ssize_t *shape, in tolist_rec() argument
2074 assert(ndim >= 1); in tolist_rec()
2078 if (ndim == 1) in tolist_rec()
2087 item = tolist_rec(xptr, ndim-1, shape+1, in tolist_rec()
2113 if (view->ndim == 0) { in memory_tolist()
2116 else if (view->ndim == 1) { in memory_tolist()
2122 return tolist_rec(view->buf, view->ndim, view->shape, in memory_tolist()
2278 if (nindices > view->ndim) { in ptr_from_tuple()
2281 view->ndim, nindices); in ptr_from_tuple()
2313 if (view->ndim == 0) { in memory_item()
2317 if (view->ndim == 1) { in memory_item()
2344 if (nindices < view->ndim) { in memory_item_multi()
2433 if (view->ndim == 0) { in memory_subscript()
2509 if (view->ndim == 0) { in memory_ass_sub()
2524 if (1 < view->ndim) { in memory_ass_sub()
2538 if (PySlice_Check(key) && view->ndim == 1) { in memory_ass_sub()
2566 if (PyTuple_GET_SIZE(key) < view->ndim) { in memory_ass_sub()
2593 return self->view.ndim == 0 ? 1 : self->view.shape[0]; in memory_length()
2757 Py_ssize_t ndim, const Py_ssize_t *shape, in cmp_rec() argument
2765 assert(ndim >= 1); in cmp_rec()
2770 if (ndim == 1) { in cmp_rec()
2780 equal = cmp_rec(xp, xq, ndim-1, shape+1, in cmp_rec()
2856 if (vv->ndim == 0) { in memory_richcompare()
2860 else if (vv->ndim == 1) { in memory_richcompare()
2867 equal = cmp_rec(vv->buf, ww->buf, vv->ndim, vv->shape, in memory_richcompare()
3015 return _IntTupleFromSsizet(self->view.ndim, self->view.shape); in memory_shape_get()
3022 return _IntTupleFromSsizet(self->view.ndim, self->view.strides); in memory_strides_get()
3029 return _IntTupleFromSsizet(self->view.ndim, self->view.suboffsets); in memory_suboffsets_get()
3043 return PyLong_FromLong(self->view.ndim); in memory_ndim_get()