Le mercredi 28 janvier 2015 à 23:44 -0800, Kirill Ignatiev a écrit :
> The documentation for Base.reshape says
> 
> 
> > Create an array with the same data as the given array, but with
> different dimensions. An implementation for a particular type of array
> may choose whether the data is copied or shared.
> 
> 
> So if I want to guarantee that the reshaped array shares the same
> data, and that modifying the new array modifies the old array, what
> should I use?
Indeed this behavior doesn't sound very useful as it's unpredictable. On
a particularly inspired day, Stefan called it "Schrödinger's copy".

Though if you only work with the standard `Array` type, it's fine to
rely on the fact that the data is not copied. You could then restrict
the signature of your function to only accept `Array`, not any
`AbstractArray`, at least until more consistency is attained.


Regards

Reply via email to