[Numpy-discussion] ANN: Numpy 1.10.0rc1 released.

Sebastian Berg sebastian at sipsolutions.net
Thu Sep 24 07:39:19 EDT 2015


On Do, 2015-09-24 at 13:14 +0200, Sebastian Berg wrote:
> On Do, 2015-09-24 at 03:26 -0700, Stefan van der Walt wrote:
> > On 2015-09-24 00:17:33, Jens Jørgen Mortensen <jensj at fysik.dtu.dk> wrote:
> > > jensj at jordan:~$ python
> > > Python 2.7.9 (default, Apr  2 2015, 15:33:21)
> > > [GCC 4.9.2] on linux2
> > > Type "help", "copyright", "credits" or "license" for more information.
> > >  >>> import numpy as np
> > >  >>> a = np.zeros((2, 2, 2))
> > >  >>> b = np.zeros((2, 2, 2))
> > >  >>> a[0, 0] = 7
> > >  >>> b[0, 0] = 6
> > >  >>> np.vdot(a[:, :, 0], b[:, :, 0]).real
> > > 84.0
> > >  >>> np.__version__
> > > '1.10.0rc1'
> > >
> > > The result should be 42.  This is on Ubuntu 15.04.
> > 
> > The input is not supposed to be matrices—but the docstring specifically
> > states that those should then be ravelled, so this is indeed a bug.
> > 
> > If I bisected correctly, the problematic change is this one:
> > 
> 
> Hmmm, unless we want to make sure that the output of ravel is always
> contiguous (which would be a difference from `.reshape(-1)`.
> It would be a bit safer, and not a useless feature maybe, since we can
> point to `.reshape(-1)` as well for those who do not care.
> 

So to say, I am not quite sure yet. But if anyone is even a tiny bit
nervous about doing less copying/not guaranteeing a contiguous result,
lets change the definition of ravel to return a contiguous array always
(and document it pointing people to reshape if they have no need for
it).


> As far as I can see a contiguous output was not guaranteed for
> "keeporder", but nobody probably ever used keeporder....
> 
> - Sebastian
> 
> 
> > 
> > commit 44877b36870ec2a0505c536a30b9fbf06a414c17
> > Author: Sebastian Berg <sebastian at sipsolutions.net>
> > Date:   Wed Sep 3 18:33:06 2014 +0200
> > 
> >     ENH: Allow ravel to reshape in place when possible
> >     
> >     This fixes a lot of corner cases in reshape 'K' when the array
> >     is not contiguous in the first place, it was previously never
> >     ravelled in place.
> >     
> >     Closes gh-5033
> > 
> > 
> > Stéfan
> > _______________________________________________
> > 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/20150924/fa524c26/attachment.sig>


More information about the NumPy-Discussion mailing list