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

◆ cascade()

MAYAFLUX_API std::vector< double > MayaFlux::Kinesis::Discrete::cascade ( std::span< const double >  lhs,
std::span< const double >  rhs 
)

Polynomial product of two coefficient vectors.

Cascading two sections is multiplication of their transfer functions, which is convolution of the numerators and of the denominators separately. Apply once to the a pair and once to the b pair to collapse two sections into a single higher-order recurrence.

Parameters
lhsFirst coefficient vector
rhsSecond coefficient vector
Returns
Vector of length lhs.size() + rhs.size() - 1

Definition at line 298 of file Coefficients.cpp.

299{
300 if (lhs.empty() || rhs.empty())
301 return {};
302
303 std::vector<double> out(lhs.size() + rhs.size() - 1, 0.0);
304 for (size_t i = 0; i < lhs.size(); ++i) {
305 for (size_t j = 0; j < rhs.size(); ++j)
306 out[i + j] += lhs[i] * rhs[j];
307 }
308 return out;
309}