Re: [Numpy-discussion] Choosing between NumPy and SciPy functions

2014-10-28 Thread Pierre Barbier de Reuille
I would add one element to the discussion: for some (odd) reasons, SciPy is
lacking the functions `rfftn` and `irfftn`, functions using half the memory
space compared to their non-real equivalent `fftn` and `ifftn`. However, I
haven't (yet) seriously tested `scipy.fftpack.fftn` vs. `np.fft.rfftn` to
check if there is a serious performance gain (beside memory usage).

Cheers,

Pierre

On Tue Oct 28 2014 at 10:54:00 Stefan van der Walt ste...@sun.ac.za wrote:

 Hi Michael

 On 2014-10-27 15:26:58, D. Michael McFarland dm...@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.

 Regards
 Stéfan
 ___
 NumPy-Discussion mailing list
 NumPy-Discussion@scipy.org
 http://mail.scipy.org/mailman/listinfo/numpy-discussion

___
NumPy-Discussion mailing list
NumPy-Discussion@scipy.org
http://mail.scipy.org/mailman/listinfo/numpy-discussion


Re: [Numpy-discussion] inplace unary operations?

2014-08-31 Thread Pierre Barbier de Reuille
Just to point out another solution to change the sign:

 arr *= -1

Both solutions take the same time on my computer. However, the boolean
equivalent:

 arr ^= True

is a lot slower than using negative.

My two cents ...



-- 
Dr. Barbier de Reuille, Pierre
Institute of Plant Sciences
Altenbergrain 21, CH-3013 Bern, Switzerland
http://www.botany.unibe.ch/associated/systemsx/index.php


On 31 August 2014 15:31, josef.p...@gmail.com wrote:




 On Sat, Aug 30, 2014 at 1:45 PM, Nathaniel Smith n...@pobox.com wrote:

 On Sat, Aug 30, 2014 at 6:43 PM,  josef.p...@gmail.com wrote:
  Is there a way to negate a boolean, or to change the sign of a float
 inplace
  ?

 np.logical_not(arr, out=arr)
 np.negative(arr, out=arr)


 Thanks Nathaniel.

 np.negative might save a bit of memory and time when we have to negate the
 loglikelihood all the time.

 Josef




 -n

 --
 Nathaniel J. Smith
 Postdoctoral researcher - Informatics - University of Edinburgh
 http://vorpus.org
 ___
 NumPy-Discussion mailing list
 NumPy-Discussion@scipy.org
 http://mail.scipy.org/mailman/listinfo/numpy-discussion



 ___
 NumPy-Discussion mailing list
 NumPy-Discussion@scipy.org
 http://mail.scipy.org/mailman/listinfo/numpy-discussion


___
NumPy-Discussion mailing list
NumPy-Discussion@scipy.org
http://mail.scipy.org/mailman/listinfo/numpy-discussion