next_fast_len#

cbclib.bin.next_fast_len(target: int, backend: str = 'numpy')[source]#

Find the next fast size of input data to fft, for zero-padding, etc. FFT algorithms gain their speed by a recursive divide and conquer strategy. This relies on efficient functions for small prime factors of the input length. Thus, the transforms are fastest when using composites of the prime factors handled by the fft implementation. If there are efficient functions for all radices <= n, then the result will be a number x >= target with only prime factors < n. (Also known as n-smooth numbers)

Parameters
  • target (int) – Length to start searching from. Must be a positive integer.

  • backend (str) – Find n-smooth number for the FFT implementation from the numpy (‘numpy’) or FFTW (‘fftw’) library.

Raises
Returns

The smallest fast length greater than or equal to target.

Return type

int