[Numpy-discussion] when did column_stack become C-contiguous?

Sebastian Berg sebastian at sipsolutions.net
Mon Oct 19 05:16:59 EDT 2015


On Mo, 2015-10-19 at 01:34 -0400, josef.pktd at gmail.com wrote:
> 

<snip>


> 
> It looks like in 1.9 it depends on the order of the 2-d arrays, which
> it didn't do in 1.6
> 

Yes, it uses concatenate, and concatenate probably changed in 1.7 to use
"K" (since "K" did not really exists before 1.7 IIRC).
Not sure what we can do about it, the order is not something that is
easily fixed unless explicitly given. It might be optimized (as in this
case I would guess).
Whether or not doing the fastest route for these kind of functions is
faster for the user is of course impossible to know, we can only hope
that in most cases it is better.
If someone has an idea how to decide I am all ears, but I think all we
can do is put in asserts/tests in the downstream code if it relies
heavily on the order (or just copy, if the order is wrong) :(, another
example is change of the output order in advanced indexing in some
cases, it makes it faster sometimes, and probably slower in others, what
is right seems very much non-trivial.

- Sebastian


> 
> >>> np.column_stack((np.ones(10), np.ones((10, 2), order='F'))).flags
>   C_CONTIGUOUS : False
>   F_CONTIGUOUS : True
>   OWNDATA : True
>   WRITEABLE : True
>   ALIGNED : True
>   UPDATEIFCOPY : False
> 
> 
> 
> 
> which means the default order looks more like "K" now, not "C", IIUC
> 
> 
> Josef
> 
> 
>  
>         
>         
>         Josef
>          
>                 
>                 
>                 
>                 
>                 Stephan
>                 
>                 _______________________________________________
>                 NumPy-Discussion mailing list
>                 NumPy-Discussion at scipy.org
>                 https://mail.scipy.org/mailman/listinfo/numpy-discussion
>                 
>         
>         
> 
> 
> _______________________________________________
> NumPy-Discussion mailing list
> NumPy-Discussion at scipy.org
> https://mail.scipy.org/mailman/listinfo/numpy-discussion

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: This is a digitally signed message part
URL: <http://mail.python.org/pipermail/numpy-discussion/attachments/20151019/91dc2143/attachment.sig>


More information about the NumPy-Discussion mailing list