> On Wed, Apr 14, 2010 at 10:25, Peter Shinners <p...@shinners.org> > wrote: >> Is there a way to combine two 1D arrays with the same size into a 2D >> array? It seems like the internal pointers and strides could be >> combined. My primary goal is to not make any copies of the data. > > There is absolutely no way to get around that, I am afraid.
You could start with the 2d array... instead of: > >>> a = np.array((1,2,3,4)) > >>> b = np.array((11,12,13,14)) > >>> c = np.magical_fuse(a, b) # what goes here? perhaps something like: >>> c = np.empty((2,4), int) >>> a = c[0] >>> b = c[1] Now a and b are views on c. So if you (say) pass them to, say, some (strides-aware) C routine that fills them in element-by-element, c will get filled in at the same time. Zach _______________________________________________ NumPy-Discussion mailing list NumPy-Discussion@scipy.org http://mail.scipy.org/mailman/listinfo/numpy-discussion