[Numpy-discussion] Consider improving numpy.outer's behavior with zero-dimensional vectors
josef.pktd at gmail.com
josef.pktd at gmail.com
Wed Apr 15 18:12:06 EDT 2015
On Wed, Apr 15, 2015 at 6:08 PM, <josef.pktd at gmail.com> wrote:
> On Wed, Apr 15, 2015 at 5:31 PM, Neil Girdhar <mistersheik at gmail.com> wrote:
>> Does it work for you to set
>>
>> outer = np.multiply.outer
>>
>> ?
>>
>> It's actually faster on my machine.
>
> I assume it does because np.corrcoeff uses it, and it's the same type
> of use cases.
> However, I'm not using it very often (I prefer broadcasting), but I've
> seen it often enough when reviewing code.
>
> This is mainly to point out that it could be a popular function (that
> maybe shouldn't be deprecated)
>
> https://github.com/search?utf8=%E2%9C%93&q=np.outer
> 416914
After thinking another minute:
I think it should not be deprecated, it's like toepliz. We can use it
also to normalize 2d arrays where columns and rows are different not
symmetric as in the corrcoef case.
Josef
>
> Josef
>
>
>>
>> On Wed, Apr 15, 2015 at 5:29 PM, <josef.pktd at gmail.com> wrote:
>>>
>>> On Wed, Apr 15, 2015 at 7:35 AM, Neil Girdhar <mistersheik at gmail.com>
>>> wrote:
>>> > Yes, I totally agree. If I get started on the PR to deprecate np.outer,
>>> > maybe I can do it as part of the same PR?
>>> >
>>> > On Wed, Apr 15, 2015 at 4:32 AM, Sebastian Berg
>>> > <sebastian at sipsolutions.net>
>>> > wrote:
>>> >>
>>> >> Just a general thing, if someone has a few minutes, I think it would
>>> >> make sense to add the ufunc.reduce thing to all of these functions at
>>> >> least in the "See Also" or "Notes" section in the documentation.
>>> >>
>>> >> These special attributes are not that well known, and I think that
>>> >> might
>>> >> be a nice way to make it easier to find.
>>> >>
>>> >> - Sebastian
>>> >>
>>> >> On Di, 2015-04-14 at 22:18 -0400, Nathaniel Smith wrote:
>>> >> > I am, yes.
>>> >> >
>>> >> > On Apr 14, 2015 9:17 PM, "Neil Girdhar" <mistersheik at gmail.com>
>>> >> > wrote:
>>> >> > Ok, I didn't know that. Are you at pycon by any chance?
>>> >> >
>>> >> > On Tue, Apr 14, 2015 at 7:16 PM, Nathaniel Smith
>>> >> > <njs at pobox.com> wrote:
>>> >> > On Tue, Apr 14, 2015 at 3:48 PM, Neil Girdhar
>>> >> > <mistersheik at gmail.com> wrote:
>>> >> > > Yes, I totally agree with you regarding np.sum and
>>> >> > np.product, which is why
>>> >> > > I didn't suggest np.add.reduce, np.multiply.reduce.
>>> >> > I wasn't sure whether
>>> >> > > cumsum and cumprod might be on the line in your
>>> >> > judgment.
>>> >> >
>>> >> > Ah, I see. I think we should treat them the same for
>>> >> > now -- all the
>>> >> > comments I made apply to a lesser or greater extent
>>> >> > (in particular,
>>> >> > cumsum and cumprod both do the thing where they
>>> >> > dispatch to .cumsum()
>>> >> > .cumprod() method).
>>> >> >
>>> >> > -n
>>> >> >
>>> >> > --
>>> >> > Nathaniel J. Smith -- http://vorpus.org
>>> >> > _______________________________________________
>>> >> > NumPy-Discussion mailing list
>>> >> > NumPy-Discussion at scipy.org
>>> >> >
>>> >> > http://mail.scipy.org/mailman/listinfo/numpy-discussion
>>> >> >
>>> >> >
>>> >> >
>>> >> >
>>> >> > _______________________________________________
>>> >> > NumPy-Discussion mailing list
>>> >> > NumPy-Discussion at scipy.org
>>> >> > http://mail.scipy.org/mailman/listinfo/numpy-discussion
>>> >> >
>>> >> > _______________________________________________
>>> >> > NumPy-Discussion mailing list
>>> >> > NumPy-Discussion at scipy.org
>>> >> > http://mail.scipy.org/mailman/listinfo/numpy-discussion
>>> >>
>>> >>
>>> >> _______________________________________________
>>> >> NumPy-Discussion mailing list
>>> >> NumPy-Discussion at scipy.org
>>> >> http://mail.scipy.org/mailman/listinfo/numpy-discussion
>>> >>
>>> >
>>> >
>>> > _______________________________________________
>>> > NumPy-Discussion mailing list
>>> > NumPy-Discussion at scipy.org
>>> > http://mail.scipy.org/mailman/listinfo/numpy-discussion
>>> >
>>>
>>>
>>> I'm just looking at this thread.
>>>
>>> I see outer used quite often
>>>
>>> corrcoef = cov / np.outer(std, std)
>>>
>>> (even I use it sometimes instead of
>>> cov / std[:,None] / std
>>>
>>> Josef
>>> _______________________________________________
>>> NumPy-Discussion mailing list
>>> NumPy-Discussion at scipy.org
>>> http://mail.scipy.org/mailman/listinfo/numpy-discussion
>>
>>
>>
>> _______________________________________________
>> NumPy-Discussion mailing list
>> NumPy-Discussion at scipy.org
>> http://mail.scipy.org/mailman/listinfo/numpy-discussion
>>
More information about the NumPy-Discussion
mailing list