KerMor  0.9
Model order reduction for nonlinear dynamical systems and nonlinear approximation
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
kermorpp.h
Go to the documentation of this file.
1 /*
2  * kermorpp.h
3  *
4  * Created on: 23.07.2013
5  * Author: CreaByte
6  */
7 
8 #ifndef KERMORPP_H_
9 #define KERMORPP_H_
10 
11 //#define DEBUG true
12 
13 #if defined(WIN32)
14 #define DIR_SEPARATOR "\\"
15 #else
16 #define DIR_SEPARATOR "/"
17 #endif
18 
19 #include <Eigen/Core>
20 
21 using namespace std;
22 using namespace Eigen;
23 
24 namespace kermorpp {
25 
26 const int INT_BYTES = sizeof(int); // 4
27 const int DOUBLE_BYTES = sizeof(double); // 8
28 
29 class RBFKernel {
30 
31 public:
32  RBFKernel(double gamma);
33  virtual ~RBFKernel();
34 
35  MatrixXd evaluate(MatrixXd x, MatrixXd y);
36  friend ostream & operator<<(ostream & os, const RBFKernel & k);
37 
38 protected:
39  virtual MatrixXd rbf_eval_rsq(MatrixXd rsq) = 0;
40 
41 public:
42  double _gamma;
43 };
44 
45 class Util {
46 public:
47  static VectorXd loadVector(string file);
48  static MatrixXd loadMatrix(string file);
49 private:
50  static inline bool little_endian(void);
51 };
52 
54 public:
56  virtual ~KernelExpansion();
57  static KernelExpansion* loadFrom(string dir);
58  MatrixXd evaluate(MatrixXd points);
59  friend ostream & operator<<(ostream & os, const KernelExpansion & k);
60 
61 public:
62  MatrixXd coeffs;
63  MatrixXd centers;
65 };
66 
67 class Wendland: public RBFKernel {
68 public:
69  Wendland(double gamma, int d, int k);
70  virtual ~Wendland();
71 protected:
72  MatrixXd rbf_eval_rsq(MatrixXd rsq);
73 
74 private:
75  int _d, _k;
76 };
77 
78 class Gaussian: public RBFKernel {
79 public:
80  Gaussian(double gamma);
81  virtual ~Gaussian();
82 protected:
83  MatrixXd rbf_eval_rsq(MatrixXd rsq);
84 };
85 
86 }
87 
88 #endif /* KERMORPP_H_ */
const int INT_BYTES
Definition: kermorpp.h:26
A double value.
const int DOUBLE_BYTES
Definition: kermorpp.h:27
RBFKernel * kernel
Definition: kermorpp.h:64
ostream & operator<<(ostream &s, const KernelExpansion &k)