Skip to content

Customizing scipy's oaconvolve #34

@NimaSarajpoor

Description

@NimaSarajpoor

scipy_oaconvolve_sdp.py is one of the existing modules for computing sliding-dot-product. However, it outperforms pocketfft_r2c_c2r_sdp.py in certain cases only.

In this comment, a suggestion was made to modify scipy's oaconvolve. Have provided a summary below:

(1) When it fallbacks, it fallbacks to fftconvolve. Can we fallback to a better algo, such as pocketfft_r2c_c2r_sdp.py ?

(2) If it does not fallback, it computes theIFFT(FFT(block) * FFT(query)) via this function, which uses scipy.fft.rfftn and scipy.fft.irfftn for real-valued arrays. Can we replace them with r2cn and c2rn from pocketfft?

(3) To compute the optimal length of block, it calls the function scipy.fft.next_fast_len. However, if uses the default real=False when calling this function. Read about this parameter here. Can we set this to True?

(4) The optimal size of block is a value N that minimizes the following equation, which shows the number of multiplication in FFT-IFFT operation per sample output. See the function _calc_oa_lens.

$$ \frac{N(log_{2}^{N} + 1)}{N - M + 1} $$

However, should we modify this to reflect the number of multiplication in RFFT-IRFFT operations? And based on that, find the optimal length?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions