[Numpy-discussion] in place random generation

Robert Kern robert.kern@gmail....
Fri Mar 9 13:12:05 CST 2007


Anne Archibald wrote:
> On 09/03/07, Robert Kern <robert.kern@gmail.com> wrote:
>> Mark P. Miller wrote:
>>> As an aside, are the random number generators from scipy.random the same
>>> as those for numpy.random?  If not, will those of us who need to just
>>> use a few random numbers here and there throughout our code (we don't
>>> need arrays of random numbers or broadcasting abilities) benefit more
>>> from using those libraries?
>> scipy.random is not a package. scipy/__init__.py does a "from numpy import *"
>> and thus pulls in numpy.random.
> 
> Why does it do this? It makes it a bit confusing (for example, the
> post above), but presumably it was done for a compelling reason...

Back when scipy was based on Numeric, scipy provided a slew of new, basic array
functions (e.g. linspace(), et al.) that have now been folded into numpy. It
also overrode the math ufuncs with faster variants that would yield nans and
infs rather than throwing a ZeroDivisionError. The idea was to be able to use
"scipy" as a replacement for "Numeric".

I wish we didn't do it today, either, but we are stuck with a lot of legacy code.

-- 
Robert Kern

"I have come to believe that the whole world is an enigma, a harmless enigma
 that is made terrible by our own mad attempt to interpret it as though it had
 an underlying truth."
  -- Umberto Eco


More information about the Numpy-discussion mailing list