[Numpy-discussion] Changes to np.vander

Jaime Fernández del Río jaime.frio at gmail.com
Sat Mar 29 21:07:39 EDT 2014


On Sat, Mar 29, 2014 at 8:55 AM, <josef.pktd at gmail.com> wrote:

> On Sat, Mar 29, 2014 at 7:31 AM,  <josef.pktd at gmail.com> wrote:
> > On Sat, Mar 29, 2014 at 12:12 AM, Jaime Fernández del Río
> > <jaime.frio at gmail.com> wrote:
> >> Hi,
> >>
> >> I have submitted a PR (https://github.com/numpy/numpy/pull/4568) that
> speeds
> >> up `np.vander` by using accumulated multiplication instead of
> exponentiation
> >> to compute the Vandermonde matrix. For largish matrices the speed-ups
> can be
> >> quite dramatic, over an order of magnitude.
> >>
> >> Julian has raised concerns on numerical stability and loss of precision,
> >> which don't seem to be all that relevant. Do speak up if you think
> >> otherwise.
> >>
> >> We are also discussing replacing a recently added kwarg, "order", which
> now
> >> accepts a string, either "increasing" or "decreasing", to indicate the
> >> ordering of the matrix columns. This was not present in 1.8, so can
> still be
> >> modified. The proposal is to replace it with a "reversed" boolean flag.
> >> Unfortunately, the return of np.vander in 1.8 and before is the opposite
> >> (i.e. its reversed) from the standard definition, which has powers
> >> increasing from left to right. So it is not clear what the reversed
> keyword
> >> should refer to:
> >>
> >> 1. If it refers to the standard definition, then it would default to
> False
> >> for backwards compatibility, but be consistent with the conventional
> >> definition.
> >>
> >> 2. If it refers to the existing behavior of numpy's vander, then it
> would
> >> default to True, and not be consistent with the conventional definition.
> >>
> >> I prefer option 1, but would like to hear other's opinions. Which could
> of
> >> course include naming the boolean flag more ingeniously, or keeping the
> >> string flag. If he's reading, I'd specially like to hear Warren
> Weckesser's
> >> thoughts, as he is the one who added the "order" kwarg.
> >
> > "order" is not a good name, I would find it very confusing (I'm
> > usually mixing up order and degree)
> > http://en.wikipedia.org/wiki/Order_of_a_polynomial
> >
> > how about calling the keyword "increasing=False" ?
> > which would avoid defining what it's reversed against.
>
> Obviously I didn't read the PR before answering.
>
> But it shows that `increasing` might be obvious, or that Warren and I
> think the same way.
>

Great minds think alike! It seems we have a 4 people consensus,
"increasing" it is. Thanks for the feedback.

Jaime
-- 
(\__/)
( O.o)
( > <) Este es Conejo. Copia a Conejo en tu firma y ayúdale en sus planes
de dominación mundial.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/numpy-discussion/attachments/20140329/3816cbe6/attachment.html>


More information about the NumPy-Discussion mailing list