[Numpy-discussion] How to concatenate two arrayswithout duplicating memory?

Citi, Luca lciti@essex.ac...
Wed Sep 2 03:57:36 CDT 2009

As Gaël pointed out you cannot create A, B and then C
as the concatenation of A and B without duplicating
the vectors.

> I am looking for a way to have a non contiguous array C in which the 
> "left" (10000, 2000) elements point to A and the "right" (10000, 4000) 
> elements point to B. 

But you can still re-link A to the left elements
and B to the right ones afterwards by using views into C.

>>> C=numpy.concatenate((A, B), axis=1)
>>> A,B = C[:,:2000], C[:,2000:]


More information about the NumPy-Discussion mailing list