Skip to content

Kaiser Window #52

Description

@ulikoehler

In some of my projects I'm using the Kaiser Window as a DPSS window approximation. In some cases I was able to improve the SNR by using Kaiser windows instead of .

In #51 I added some extra window functions. However, I couldn't add the Kaiser function because the formula depends on the modified Bessel function of the first kind.

My implementation (which is hereby released under CC0 1.0 Universal) depends on boost::math which provides Bessel functions:

template<typename T, typename std::enable_if<std::is_floating_point<T>::value>::type* = nullptr>
void kaiserWindow(T* out, size_t n, T alpha = 2.0) {
    using namespace boost::math;
    const T denom = (T)n - 1.0;
    const T piAlpha = boost::math::constants::pi<T>() * alpha;
    for (size_t i = 0; i < n; ++i) {
        T term1 = (2.0 * i / denom) - 1.0;
        out[i] = cyl_bessel_i(0, piAlpha * std::sqrt(1.0 - term1 * term1)) / cyl_bessel_i(0, piAlpha);
    }
}

However, boost::math is a huge template library. I'd like to avoid introducing it as a aquila dependency just because of a single window function.

Do you see any alternative to using boost::math for this?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions