made methods const

This commit is contained in:
Ahmet Inan 2021-04-01 12:32:02 +02:00
commit d7acee8494
2 changed files with 13 additions and 13 deletions

View file

@ -18,7 +18,7 @@ class LowPass
TYPE f;
public:
LowPass(TYPE cutoff) : f(TYPE(2) * cutoff) {}
TYPE operator () (int n, int N)
TYPE operator () (int n, int N) const
{
TYPE x = TYPE(n) - TYPE(0.5) * TYPE(N - 1);
return f * sinc(f * x);
@ -32,7 +32,7 @@ class LowPass2
TYPE fac;
public:
LowPass2(int num, int den) : num(num), den(den), fac(TYPE(2*num)/TYPE(den)) {}
TYPE operator () (int n, int N)
TYPE operator () (int n, int N) const
{
int twox = 2 * n - (N - 1);
return !twox ? fac : fac *
@ -47,7 +47,7 @@ class HighPass
TYPE f;
public:
HighPass(TYPE cutoff) : f(TYPE(2) * cutoff) {}
TYPE operator () (int n, int N)
TYPE operator () (int n, int N) const
{
TYPE x = TYPE(n) - TYPE(0.5) * TYPE(N - 1);
// if (N%1) return delta(x) - f * sinc(f * x);
@ -63,7 +63,7 @@ class HighPass2
TYPE fac;
public:
HighPass2(int num, int den) : num(num), den(den), fac(TYPE(2*num)/TYPE(den)) {}
TYPE operator () (int n, int N)
TYPE operator () (int n, int N) const
{
int twox = 2 * n - (N - 1);
return !twox ? TYPE(1) - fac :
@ -80,7 +80,7 @@ class BandPass
public:
BandPass(TYPE cutoff0, TYPE cutoff1) :
f0(TYPE(2) * cutoff0), f1(TYPE(2) * cutoff1) {}
TYPE operator () (int n, int N)
TYPE operator () (int n, int N) const
{
TYPE x = TYPE(n) - TYPE(0.5) * TYPE(N - 1);
return f1 * sinc(f1 * x) - f0 * sinc(f0 * x);
@ -90,7 +90,7 @@ public:
template <typename TYPE>
struct HilbertTransform
{
TYPE operator () (int n, int N)
TYPE operator () (int n, int N) const
{
if (N&1) {
int x = n - (N - 1) / 2;