[Numpy-discussion] Fast sizes for FFT

Sturla Molden sturla.molden at gmail.com
Wed Dec 24 07:07:50 EST 2014


On 24/12/14 04:33, Robert McGibbon wrote:
> Alex Griffing pointed out on github that this feature was recently added
> to scipy in https://github.com/scipy/scipy/pull/3144. Sweet!


I use different padsize search than the one in SciPy. It would be 
interesting to see which is faster.


from numpy cimport intp_t

cdef intp_t checksize(intp_t n):
     while not (n % 5): n /= 5
     while not (n % 3): n /= 3
     while not (n % 2): n /= 2
     return (1 if n == 1 else 0)

def _next_regular(target):
     cdef intp_t n = target
     while not checksize(n):
         n += 1
     return n



Sturla





More information about the NumPy-Discussion mailing list