[Numpy-discussion] Consider improving numpy.outer's behavior with zero-dimensional vectors

Nathaniel Smith njs at pobox.com
Wed Apr 15 18:40:45 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

For future reference, that's not the number -- you have to click
through to "Code" and then look at a single-language result to get
anything remotely meaningful. In this case b/c they're different by an
order of magnitude, and in general because sometimes the "top line"
number is completely made up (like it has no relation to the
per-language numbers on the left and then changes around randomly if
you simply reload the page).

(So 29,397 is what you want in this case.)

Also that count then tends to have tons of duplicates (e.g. b/c there
are hundreds of copies of numpy itself on github), so you need a big
grain of salt when looking at the absolute number, but it can be
useful, esp. for relative comparisons.

-n



More information about the NumPy-Discussion mailing list