[Numpy-discussion] Choosing between NumPy and SciPy functions
Stefan van der Walt
stefan at sun.ac.za
Tue Oct 28 05:53:44 EDT 2014
On 2014-10-27 15:26:58, D. Michael McFarland <dmmcf at dmmcf.net> wrote:
> What I would like to ask about is the situation this illustrates, where
> both NumPy and SciPy provide similar functionality (sometimes identical,
> to judge by the documentation). Is there some guidance on which is to
> be preferred? I could argue that using only NumPy when possible avoids
> unnecessary dependence on SciPy in some code, or that using SciPy
> consistently makes for a single interface and so is less error prone.
> Is there a rule of thumb for cases where SciPy names shadow NumPy names?
I'm not sure if you've received an answer to your question so far. My
advice: use the SciPy functions. SciPy is often built on more extensive
Fortran libraries not available during NumPy compilation, and I am not
aware of any cases where a function in NumPy is faster or more extensive
than the equivalent in SciPy.
If you want code that falls back gracefully when SciPy is not available,
you may use the ``numpy.dual`` library.
More information about the NumPy-Discussion