[Numpy-discussion] Concatenating Arrays to make Views
Mon Dec 15 14:24:24 CST 2008
2008/12/15 Benjamin Haynor <firstname.lastname@example.org>:
> I was wondering if I can concatenate 3 arrays, where the result will be a
> view of the original three arrays, instead of a copy of the data. For
> example, suppose I write the following
> import numpy as n
> a = n.array([[1,2],[3,4]])
> b = n.array([[5,6],[7,8]])
> c = n.array([[9,10],[11,12]])
> c = n.r_[a,b]
> Now c = :
> I was hoping to get an array, such that, when I change d, a, b, and c will
> also change appropriately.
> Any ideas?
An array must be a contiguous piece of memory, so this is impossible
unless you allocate d first and make a b and c views of it.
More information about the Numpy-discussion