utils.arrays¶
Module: utils.arrays
¶
Array utilities
- nipy.utils.arrays.strides_from(shape, dtype, order='C')¶
Return strides as for continuous array shape shape and given dtype
- Parameters:
- shapesequence
shape of array to calculate strides from
- dtypedtype-like
dtype specifier for array
- order{‘C’, ‘F’}, optional
whether array is C or FORTRAN ordered
- Returns:
- stridestuple
sequence length
len(shape)
giving strides for continuous array with given shape, dtype and order
Examples
>>> strides_from((2,3,4), 'i4') (48, 16, 4) >>> strides_from((3,2), np.float64) (16, 8) >>> strides_from((5,4,3), np.bool_, order='F') (1, 5, 20)