Lines Matching refs:ndim
263 def strides_from_shape(ndim, shape, itemsize, layout): argument
266 if ndim == 0:
270 for i in range(ndim-2, -1, -1):
274 for i in range(1, ndim):
320 def getindex(ndim, ind, strides): argument
323 for i in range(ndim):
332 ndim = len(shape)
333 sstrides = strides_from_shape(ndim, shape, 1, 'C')
334 dstrides = strides_from_shape(ndim, shape[::-1], 1, 'C')
337 fr = getindex(ndim, ind, sstrides)
338 to = getindex(ndim, ind[::-1], dstrides)
434 def verify_structure(memlen, itemsize, ndim, shape, strides, offset): argument
448 if ndim <= 0:
449 return ndim == 0 and not shape and not strides
453 imin = sum(strides[j]*(shape[j]-1) for j in range(ndim)
455 imax = sum(strides[j]*(shape[j]-1) for j in range(ndim)
467 memlen, itemsize, ndim, shape, strides, offset = t
469 for i in range(ndim):
477 memlen, itemsize, ndim, shape, strides, offset = t
494 ndim = randrange(maxdim+1)
495 if (ndim == 0):
497 return itemsize, itemsize, ndim, (), (), 0
502 return memlen, itemsize, ndim, (), (), offset
510 shape = [0] * ndim
512 for i in range(ndim):
515 ndim = len(shape)
521 strides = [0] * ndim
522 strides[ndim-1] = itemsize * randrange(-maxstride, maxstride+1)
523 if not zero_stride and strides[ndim-1] == 0:
524 strides[ndim-1] = itemsize
526 for i in range(ndim-2, -1, -1):
536 imin = sum(strides[j]*(shape[j]-1) for j in range(ndim)
538 imax = sum(strides[j]*(shape[j]-1) for j in range(ndim)
548 return memlen, itemsize, ndim, shape, strides, offset
563 def randslice_from_shape(ndim, shape): argument
566 lslices = [0] * ndim
567 rslices = [0] * ndim
568 for n in range(ndim):
579 ndim = randrange(1, maxdim+1)
587 lshape = [0]*ndim; rshape = [0]*ndim
588 lslices = [0]*ndim; rslices = [0]*ndim
590 for n in range(ndim):
626 memlen, itemsize, ndim, shape, strides, offset = t
632 memlen, itemsize, ndim, shape, strides, offset = t
657 if exporter.ndim == 0 or itemsize != bytelen:
681 ndim = randrange(4, 6)
683 yield [randrange(minshape, 5) for _ in range(ndim)]
684 ndim = randrange(2, 4)
686 yield [randrange(minshape, 5) for _ in range(ndim)]
697 def genslices_ndim(ndim, shape): argument
699 iterables = [genslices(shape[n]) for n in range(ndim)]
715 def rslices_ndim(ndim, shape, iterations=5): argument
719 yield tuple(rslice(shape[n]) for n in range(ndim))
722 yield tuple(rslice(shape[n], allow_empty=True) for n in range(ndim))
724 yield tuple(slice(0,1,0) for _ in range(ndim))
773 ndim, shape, strides, argument
788 self.assertGreater(ndim, 0)
791 for n in range(1, ndim):
797 suboffsets = [suboffset0] + [-1 for v in range(ndim-1)]
810 self.assertEqual(result.ndim, ndim)
883 if ndim == 0:
955 self.assertEqual(m.ndim, ndim)
961 n = 1 if ndim == 0 else len(lst)
1003 ndim = ex.ndim
1011 ndim = 1
1018 ndim=ndim, shape=shape, strides=strides,
1081 if ex1.ndim == 0 or (ex1.ndim == 1 and shape and strides):
1083 if ex2 and ex2.ndim == 1 and shape and strides:
1307 ndim=0, shape=(), strides=(),
1319 ndim=1, shape=(nitems,), strides=(itemsize,),
1340 ndim=1, shape=shape, strides=strides,
1350 for ndim in range(5):
1351 shape_t = [randrange(2, 10) for _ in range(ndim)]
1359 if ndim == 0 and flags == ND_PIL:
1365 strides = strides_from_shape(ndim, shape, itemsize, 'C')
1369 ndim=ndim, shape=shape, strides=strides,
1380 ndim=ndim, shape=shape, strides=strides,
1387 strides = strides_from_shape(ndim, shape, itemsize, 'F')
1391 ndim=ndim, shape=shape, strides=strides,
1723 ndim = len(shape_t)
1734 for slices in rslices_ndim(ndim, shape):
1755 ndim = len(shape_t)
1769 for slices in rslices_ndim(ndim, shape):
1839 ndim=nd.ndim, shape=nd.shape, strides=nd.strides,
1844 ndim = len(shape_t)
1852 lslices, rslices = randslice_from_shape(ndim, shape)
1913 ndim=z.ndim, shape=z.shape, strides=z.strides,
1998 ndim=zl.ndim, shape=zl.shape,
2003 ndim=zr.ndim, shape=zr.shape,
2375 ndim = len(shape)
2376 strides = strides_from_shape(ndim, shape, 1, 'C')
2381 ndim=ndim, shape=shape, strides=strides,
2388 ndim=ndim, shape=shape, strides=strides,
2397 ndim=ndim, shape=shape, strides=strides,
2407 lst = [items] if ndim == 0 else items
2410 ndim=1, shape=[ex.nbytes], strides=(1,),
2422 ndim = len(shape)
2423 strides = strides_from_shape(ndim, shape, 1, 'F')
2428 ndim=ndim, shape=shape, strides=strides,
2435 ndim=ndim, shape=shape, strides=strides,
2445 ndim = len(shape)
2450 ndim=ndim, shape=shape, strides=ex.strides,
2457 ndim=ndim, shape=shape, strides=ex.strides,
2707 ndim=1, shape=[31*srcsize], strides=(1,),
2715 ndim=1, shape=[31], strides=(srcsize,),
2726 ndim=1, shape=destshape, strides=(1,),
2737 ndim=0, shape=(), strides=(),
2785 ndim = len(tshape)
2790 ndim=ndim, shape=tshape, strides=strides,
2796 ndim = len(shape)
2802 ndim=ndim, shape=shape, strides=strides,
2807 ndim=ndim, shape=shape, strides=strides,
2820 self.assertEqual(m2.ndim, 1)
2831 self.assertEqual(m2.ndim, 1)
4333 ndim=1, shape=[12], strides=[1],
4353 ndim=1, shape=[12], strides=[1],
4366 ndim=1, shape=[12], strides=[1],
4375 ndim=1, shape=[12], strides=[1],
4395 ndim=1, shape=[12], strides=[1],
4410 ndim=1, shape=[12], strides=[1],