MayaFlux 1.0.0
Digital-First Multimedia Processing Framework
Loading...
Searching...
No Matches

◆ chebyshev_series()

MAYAFLUX_API double MayaFlux::Kinesis::Discrete::chebyshev_series ( std::span< const double >  window,
std::span< const double >  coefs 
)
noexcept

Sum of coefs[k] * T_k(window[0]) over Chebyshev polynomials.

Because T_k(cos t) = cos(kt), a sine of amplitude one passed through this has harmonic k at weight coefs[k]. The input is clamped to [-1, 1] and the sum is evaluated by Clenshaw's recurrence.

Definition at line 156 of file Kernels.cpp.

157{
158 if (coefs.empty())
159 return 0.0;
160
161 const double x = std::clamp(window.empty() ? 0.0 : window.front(), -1.0, 1.0);
162 double b1 = 0.0;
163 double b2 = 0.0;
164
165 for (size_t k = coefs.size() - 1; k >= 1; --k) {
166 const double b0 = coefs[k] + 2.0 * x * b1 - b2;
167 b2 = b1;
168 b1 = b0;
169 }
170 return coefs.front() + x * b1 - b2;
171}
std::weak_ptr< Core::Window > window
Definition Picker.cpp:23

References window.