isce3  0.1.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Pages
Kernels.h
1 #pragma once
2 
3 #include "forward.h"
4 
5 #include <cmath>
6 #include <vector>
7 
8 #include <isce3/math/Bessel.h>
9 
10 namespace isce3 { namespace core {
11 
18 template<typename T>
19 class Kernel {
20 public:
21  Kernel(double width) : _halfwidth(fabs(width / 2.0)) {}
22 
24  virtual ~Kernel() {}
25 
27  virtual T operator()(double x) const = 0;
28 
33  double width() const { return _halfwidth * 2; }
34 
35 protected:
36  double _halfwidth;
37 };
38 
40 template<typename T>
41 class BartlettKernel : public Kernel<T> {
42 public:
44  BartlettKernel(double width) : Kernel<T>(width) {}
45 
46  T operator()(double x) const override;
47 };
48 
50 template<typename T>
51 class LinearKernel : public BartlettKernel<T> {
52 public:
53  LinearKernel() : BartlettKernel<T>(2.0) {}
54 };
55 
62 template<typename T>
63 class KnabKernel : public Kernel<T> {
64 public:
71  KnabKernel(double width, double bandwidth)
72  : Kernel<T>(width), _bandwidth(bandwidth)
73  {}
74 
75  T operator()(double x) const override;
76 
78  double bandwidth() const { return _bandwidth; }
79 
80 private:
81  double _bandwidth;
82 };
83 
91 template<typename T>
92 class NFFTKernel : public Kernel<T> {
93 public:
100  NFFTKernel(int m, int n, int fft_size);
101 
102  T operator()(double x) const override;
103 
104 private:
105  int _m;
106  int _n;
107  int _fft_size;
108  T _scale;
109  T _b;
110 };
111 
113 template<typename T>
114 class TabulatedKernel : public Kernel<T> {
115 public:
121  template<typename Tin>
122  TabulatedKernel(const Kernel<Tin>& kernel, int n);
123 
124  T operator()(double x) const override;
125 
126  const std::vector<T>& table() const { return _table; }
127 
128 private:
129  std::vector<T> _table;
130  int _imax;
131  T _1_dx;
132 };
133 
135 template<typename T>
136 class ChebyKernel : public Kernel<T> {
137 public:
143  template<typename Tin>
144  ChebyKernel(const Kernel<Tin>& kernel, int n);
145 
146  T operator()(double x) const override;
147 
148  const std::vector<T>& coeffs() const { return _coeffs; }
149 
150 private:
151  std::vector<T> _coeffs;
152  T _scale;
153 };
154 
155 }} // namespace isce3::core
156 
157 #include "Kernels.icc"
NFFTKernel(int m, int n, int fft_size)
Constructor of NFFT kernel.
Definition: Kernels.icc:60
ChebyKernel(const Kernel< Tin > &kernel, int n)
Constructor that computes fit of another Kernel.
Definition: Kernels.icc:140
T operator()(double x) const override
Evaluate kernel at given location in [-halfwidth, halfwidth].
Definition: Kernels.icc:48
double bandwidth() const
Get bandwidth of kernel.
Definition: Kernels.h:78
double width() const
Get width of kernel.
Definition: Kernels.h:33
virtual T operator()(double x) const =0
Evaluate kernel at given location in [-halfwidth, halfwidth].
T operator()(double x) const override
Evaluate kernel at given location in [-halfwidth, halfwidth].
Definition: Kernels.icc:16
Abstract base class for all kernels.
Definition: forward.h:40
T operator()(double x) const override
Evaluate kernel at given location in [-halfwidth, halfwidth].
Definition: Kernels.icc:174
virtual ~Kernel()
Virtual destructor (allow destruction of base Kernel pointer)
Definition: Kernels.h:24
T operator()(double x) const override
Evaluate kernel at given location in [-halfwidth, halfwidth].
Definition: Kernels.icc:121
KnabKernel(double width, double bandwidth)
Constructor of Knab&#39;s kernel.
Definition: Kernels.h:71
BartlettKernel(double width)
Triangle function constructor.
Definition: Kernels.h:44
T operator()(double x) const override
Evaluate kernel at given location in [-halfwidth, halfwidth].
Definition: Kernels.icc:73
TabulatedKernel(const Kernel< Tin > &kernel, int n)
Constructor of tabulated kernel.

Generated for ISCE3.0 by doxygen 1.8.5.