Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Kaiser Window #52

Open
ulikoehler opened this issue Oct 20, 2015 · 1 comment
Open

Kaiser Window #52

ulikoehler opened this issue Oct 20, 2015 · 1 comment

Comments

@ulikoehler
Copy link

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?

@pfeatherstone
Copy link

C++17 now has bessel functions in the standard library

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants