Go to the documentation of this file.00001 #pragma once
00002
00003 #include "basics/typedefs.hh"
00004
00005 namespace concepts {
00006
00019 inline void LinearConvolution(const Real* X, const Real* Y, Real* Z, int lenx,
00020 int leny)
00021 {
00022 Real *zptr;
00023 Real s;
00024 const Real *xp;
00025 const Real *yp;
00026 int lenz;
00027 int i,n,n_lo,n_hi;
00028
00029 lenz = lenx + leny - 1;
00030
00031 zptr = Z;
00032
00033 for (i=0; i < lenz; ++i) {
00034 s=0.0;
00035 n_lo= (0 > (i-leny+1)) ? 0 : i-leny+1;
00036 n_hi= (lenx-1<i ? lenx-1 : i);
00037 xp = X + n_lo;
00038 yp = Y + i - n_lo;
00039 for (n=n_lo;n<=n_hi;n++) {
00040 s += *xp * *yp;
00041 xp++;
00042 yp--;
00043 }
00044 *zptr=s;
00045 zptr++;
00046 }
00047 }
00048
00049 }