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

◆ rectangular()

MAYAFLUX_API std::vector< double > MayaFlux::Kinesis::Discrete::rectangular ( size_t  n,
size_t  support = std::numeric_limits< size_t >::max(),
size_t  offset = 0 
)

Rectangular (boxcar) taper coefficients.

Unity across a contiguous support region, zero elsewhere. The default arguments give unity across the whole length, which is the identity taper; a narrower support gates a region and suppresses the rest, which is the form used for frame extraction, impulse response truncation, and segment isolation ahead of a transform.

A support of 0 yields an all-zero vector. An offset at or beyond n leaves no unity region.

Parameters
nLength in samples
supportWidth of the unity region; defaults to the full length
offsetIndex where the unity region begins
Returns
Coefficient vector of length n

Definition at line 52 of file Taper.cpp.

53{
54 std::vector<double> w(n, 0.0);
55 const size_t start = std::min(offset, n);
56 const size_t end = std::min(start + support, n);
57 for (size_t i = start; i < end; ++i)
58 w[i] = 1.0;
59 return w;
60}
float offset

References offset.