12 Aug
2013
12 Aug
'13
4:01 p.m.
Hi, I have a (n,2) shaped array representing points and I would like to double each point as in: A = np.arange(10*2).reshape(10,2) B = np.repeat( A, 2, axis=0 ) Is it possible to do the same using 'as_strided' to avoid copy (and still get the same output shape for B) ? I found this reference: http://stackoverflow.com/questions/5564098/repeat-numpy-array-without-replic... but did not manage to adapt it to my case. Bonus question (if previous 'as_strided' trick is possible), would this work or do I need a different construct ? A = np.arange(10*2).reshape(10,2) B = np.repeat( A[::2], 2, axis=0 ) Nicolas