On 11/19/06, A. M. Archibald <[EMAIL PROTECTED]> wrote: > Hi, > > I have a function that would like to be able to take an array, look at > its 'strides' and 'shape' tuples, and fabricate another array that is > similar to the first but has the adjusted values. > > For a simple example: > > def fiddle(a): > strides = list(a.strides) > strides[0]*=2 > shape = list(a.shape) > shape[0]//=2 > return N.ndarray.__new__(N.ndarray, strides=strides, shape=shape, > buffer=a, dtype=a.dtype)
Is there anything wrong in using slicing for that? >>> m=numpy.matrix([[2,3,4], [3,2,1]]) >>> m.shape, m.strides ((2, 3), (12, 4)) >>> n = m[::2,:] >>> n.shape, n.strides ((1, 3), (24, 4)) cheers, fw _______________________________________________ Numpy-discussion mailing list Numpy-discussion@scipy.org http://projects.scipy.org/mailman/listinfo/numpy-discussion