Rather than reinvent the wheel, I wonder if anyone could refer me to a 1D linear convolution code snippet in ANSI C? I did a search on google and in stack overflow, but couldn\'
Not tested, but it seems like it would work...
void conv(const double v1[], size_t n1, const double v2[], size_t n2, double r[])
{
for (size_t n = 0; n < n1 + n2 - 1; n++)
for (size_t k = 0; k < max(n1, n2); k++)
r[n] += (k < n1 ? v1[k] : 0) * (n - k < n2 ? v2[n - k] : 0);
}