Lines Matching refs:ndim
264 def strides_from_shape(ndim, shape, itemsize, layout): argument
267 if ndim == 0:
271 for i in range(ndim-2, -1, -1):
275 for i in range(1, ndim):
321 def getindex(ndim, ind, strides): argument
324 for i in range(ndim):
333 ndim = len(shape)
334 sstrides = strides_from_shape(ndim, shape, 1, 'C')
335 dstrides = strides_from_shape(ndim, shape[::-1], 1, 'C')
338 fr = getindex(ndim, ind, sstrides)
339 to = getindex(ndim, ind[::-1], dstrides)
435 def verify_structure(memlen, itemsize, ndim, shape, strides, offset): argument
449 if ndim <= 0:
450 return ndim == 0 and not shape and not strides
454 imin = sum(strides[j]*(shape[j]-1) for j in range(ndim)
456 imax = sum(strides[j]*(shape[j]-1) for j in range(ndim)
468 memlen, itemsize, ndim, shape, strides, offset = t
470 for i in range(ndim):
478 memlen, itemsize, ndim, shape, strides, offset = t
495 ndim = randrange(maxdim+1)
496 if (ndim == 0):
498 return itemsize, itemsize, ndim, (), (), 0
503 return memlen, itemsize, ndim, (), (), offset
511 shape = [0] * ndim
513 for i in range(ndim):
516 ndim = len(shape)
522 strides = [0] * ndim
523 strides[ndim-1] = itemsize * randrange(-maxstride, maxstride+1)
524 if not zero_stride and strides[ndim-1] == 0:
525 strides[ndim-1] = itemsize
527 for i in range(ndim-2, -1, -1):
537 imin = sum(strides[j]*(shape[j]-1) for j in range(ndim)
539 imax = sum(strides[j]*(shape[j]-1) for j in range(ndim)
549 return memlen, itemsize, ndim, shape, strides, offset
564 def randslice_from_shape(ndim, shape): argument
567 lslices = [0] * ndim
568 rslices = [0] * ndim
569 for n in range(ndim):
580 ndim = randrange(1, maxdim+1)
588 lshape = [0]*ndim; rshape = [0]*ndim
589 lslices = [0]*ndim; rslices = [0]*ndim
591 for n in range(ndim):
627 memlen, itemsize, ndim, shape, strides, offset = t
633 memlen, itemsize, ndim, shape, strides, offset = t
658 if exporter.ndim == 0 or itemsize != bytelen:
682 ndim = randrange(4, 6)
684 yield [randrange(minshape, 5) for _ in range(ndim)]
685 ndim = randrange(2, 4)
687 yield [randrange(minshape, 5) for _ in range(ndim)]
698 def genslices_ndim(ndim, shape): argument
700 iterables = [genslices(shape[n]) for n in range(ndim)]
716 def rslices_ndim(ndim, shape, iterations=5): argument
720 yield tuple(rslice(shape[n]) for n in range(ndim))
723 yield tuple(rslice(shape[n], allow_empty=True) for n in range(ndim))
725 yield tuple(slice(0,1,0) for _ in range(ndim))
774 ndim, shape, strides, argument
789 self.assertGreater(ndim, 0)
792 for n in range(1, ndim):
798 suboffsets = [suboffset0] + [-1 for v in range(ndim-1)]
811 self.assertEqual(result.ndim, ndim)
884 if ndim == 0:
956 self.assertEqual(m.ndim, ndim)
962 n = 1 if ndim == 0 else len(lst)
1004 ndim = ex.ndim
1012 ndim = 1
1019 ndim=ndim, shape=shape, strides=strides,
1082 if ex1.ndim == 0 or (ex1.ndim == 1 and shape and strides):
1084 if ex2 and ex2.ndim == 1 and shape and strides:
1308 ndim=0, shape=(), strides=(),
1320 ndim=1, shape=(nitems,), strides=(itemsize,),
1341 ndim=1, shape=shape, strides=strides,
1351 for ndim in range(5):
1352 shape_t = [randrange(2, 10) for _ in range(ndim)]
1360 if ndim == 0 and flags == ND_PIL:
1366 strides = strides_from_shape(ndim, shape, itemsize, 'C')
1370 ndim=ndim, shape=shape, strides=strides,
1381 ndim=ndim, shape=shape, strides=strides,
1388 strides = strides_from_shape(ndim, shape, itemsize, 'F')
1392 ndim=ndim, shape=shape, strides=strides,
1724 ndim = len(shape_t)
1735 for slices in rslices_ndim(ndim, shape):
1756 ndim = len(shape_t)
1770 for slices in rslices_ndim(ndim, shape):
1840 ndim=nd.ndim, shape=nd.shape, strides=nd.strides,
1845 ndim = len(shape_t)
1853 lslices, rslices = randslice_from_shape(ndim, shape)
1914 ndim=z.ndim, shape=z.shape, strides=z.strides,
1999 ndim=zl.ndim, shape=zl.shape,
2004 ndim=zr.ndim, shape=zr.shape,
2376 ndim = len(shape)
2377 strides = strides_from_shape(ndim, shape, 1, 'C')
2382 ndim=ndim, shape=shape, strides=strides,
2389 ndim=ndim, shape=shape, strides=strides,
2398 ndim=ndim, shape=shape, strides=strides,
2408 lst = [items] if ndim == 0 else items
2411 ndim=1, shape=[ex.nbytes], strides=(1,),
2423 ndim = len(shape)
2424 strides = strides_from_shape(ndim, shape, 1, 'F')
2429 ndim=ndim, shape=shape, strides=strides,
2436 ndim=ndim, shape=shape, strides=strides,
2446 ndim = len(shape)
2451 ndim=ndim, shape=shape, strides=ex.strides,
2458 ndim=ndim, shape=shape, strides=ex.strides,
2708 ndim=1, shape=[31*srcsize], strides=(1,),
2716 ndim=1, shape=[31], strides=(srcsize,),
2727 ndim=1, shape=destshape, strides=(1,),
2738 ndim=0, shape=(), strides=(),
2786 ndim = len(tshape)
2791 ndim=ndim, shape=tshape, strides=strides,
2797 ndim = len(shape)
2803 ndim=ndim, shape=shape, strides=strides,
2808 ndim=ndim, shape=shape, strides=strides,
2821 self.assertEqual(m2.ndim, 1)
2832 self.assertEqual(m2.ndim, 1)
4334 ndim=1, shape=[12], strides=[1],
4354 ndim=1, shape=[12], strides=[1],
4367 ndim=1, shape=[12], strides=[1],
4376 ndim=1, shape=[12], strides=[1],
4396 ndim=1, shape=[12], strides=[1],
4411 ndim=1, shape=[12], strides=[1],