[Scipy-tickets] [SciPy] #675: Hadamard function

SciPy Trac scipy-tickets@scipy....
Wed Mar 24 08:37:21 CDT 2010


#675: Hadamard function
--------------------------+-------------------------------------------------
 Reporter:  Ivo           |       Owner:  somebody    
     Type:  enhancement   |      Status:  needs_review
 Priority:  normal        |   Milestone:  0.8.0       
Component:  scipy.linalg  |     Version:              
 Keywords:                |  
--------------------------+-------------------------------------------------

Comment(by warren):

 Replying to [comment:4 charris]:
 > Why not use the numpy log2 function? Or one of the other methods of
 checking for a power of two? For example, n == (-n & n) works for positive
 two's complement integers.
 >

 For a base-2 log of a scalar, my preference is math.log.  It is faster
 than numpy's log2.  I realize speed is not crucial when it is used just
 once at the beginning of a function--I guess that's just the way I paint
 my bikeshed. :)  Is there a compelling reason to *not* use math.log?

 As long as it is first verified that n is an int, `n == (-n & n)` would
 also work.  But the function needs the base-2 log for the loop anyway, so
 I don't think much is gained by that--unless the loop were rewritten using
 something like `while n:` with `n >>= 1` in the loop.  That could work,
 but I see that as just different, not necessarily better.


 > Are you going to include a fast Hadamard transform also? It is simpler
 than the Walsh transform and you can get from one to the other by indexing
 with a Grey code.


 That sounds like a great idea, but I am not planning to add this.

-- 
Ticket URL: <http://projects.scipy.org/scipy/ticket/675#comment:5>
SciPy <http://www.scipy.org>
SciPy is open-source software for mathematics, science, and engineering.


More information about the Scipy-tickets mailing list