added Hilbert transform filter

This commit is contained in:
Ahmet Inan 2019-03-31 21:59:16 +02:00
commit 8d3a6e83d8
2 changed files with 16 additions and 0 deletions

View file

@ -87,5 +87,20 @@ public:
}
};
template <typename TYPE>
struct HilbertTransform
{
TYPE operator () (int n, int N)
{
if (N&1) {
int x = n - (N - 1) / 2;
return x&1 ? TYPE(2) / (Const<TYPE>::Pi() * TYPE(x)) : TYPE(0);
} else {
TYPE x = TYPE(n) - TYPE(0.5) * TYPE(N - 1);
return TYPE(1) / (Const<TYPE>::Pi() * x);
}
}
};
}