[SciPy-user] Concatenate without making a copy? + sandbox: models

Vincent Nijs v-nijs at kellogg.northwestern.edu
Wed Jan 3 21:30:35 CST 2007


z = c_[d['x0'],d['x1']]

Still makes a copy however. That is, if I set z[0,0] = -1, z is changed by d
and x are not. 

Is there an alternative command to c_ that would not make the copy?

Also, what if x.shape is (5,3). Could you concatenate d['x0'] and d['x2']?

Vincent


On 1/3/07 9:19 PM, "Robert Kern" <robert.kern at gmail.com> wrote:

> Vincent Nijs wrote:
>> Robert,
>> 
>> If x is:
>> 
>> Array([[1,4],
>>        [2,3],
>>        [3,5]])
>> 
>> And d = {'x0':x[:,0], 'x1':x[:,1]}
>> 
>> Would d['x0'] and d['x1'] be next to each other in memory?
> 
> Yes, they would, for these purposes.




More information about the SciPy-user mailing list