-
Notifications
You must be signed in to change notification settings - Fork 2
/
odeneuralprogram.h
72 lines (71 loc) · 2.29 KB
/
odeneuralprogram.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
# ifndef __ODENEURALPROGRAM__H
# define __ODENEURALPROGRAM__H
# include <neuralprogram.h>
# include <QString>
# include <QLibrary>
typedef vector<double> Data;
typedef double(*DOUBLE_FUNCTION)();
typedef int(*INTEGER_FUNCTION)();
/* ODE1: ODE of first order, with the boundary condition y(x0)=f0.
* ODE2: ODE of second order, with the boundary conditions y(x0)=f0
* and y'(x0)=ff0.
* ODE3: ODE of second order, with the boundary conditions y(x0)=f0
* and y(x1)=f1.
* */
# define ODE1 1
# define ODE2 2
# define ODE3 3
/* GODE1FF: Type definition for functions of first order equations in
* the form GODE1FF(x,y,y')=0.
* GODE2FF: Type definition for functions of second order equations in
* the form GODE2FF(x,y,y',y'')=0.
* GFODE1FF: Same as GODE1FF, but for fortran.
* GFODE2FF: Same as GODE2FF, but for fortran.
* */
typedef double(*GODE1FF)(double,double,double);
typedef double(*GODE2FF)(double,double,double,double);
typedef double(*GFODE1FF)(double*,double*,double*);
typedef double(*GFODE2FF)(double*,double*,double*,double*);
typedef double(*GDODE1FF)(double,double,double,double,double);
typedef double(*GDODE2FF)(double,double,double,double,double,double,double);
typedef double(*GFDODE1FF)(double*,double*,double*,double*,double*);
typedef double(*GFDODE2FF)(double*,double*,double*,double*,double *,double *);
class OdeNeuralProgram :
public NeuralProgram
{
private:
vector<Data> trainx;
vector<Data> testx;
vector<Data> valx;
GODE1FF ode1ff;
GODE2FF ode2ff;
GDODE1FF dode1ff;
GDODE2FF dode2ff;
GFDODE1FF fdode1ff;
GFDODE2FF fdode2ff;
GFODE1FF fode1ff;
GFODE2FF fode2ff;
int kind;
int npoints;
double x0,x1;
double f0,f1,ff0;
QLibrary *ptr;
public:
OdeNeuralProgram(QString filename);
virtual double getTrainError();
virtual double getTestError();
virtual void getDeriv(Data &g);
virtual double penalty1();
virtual double penalty2();
virtual double penalty3();
virtual double penalty4();
int getKind() const;
double getX0() const;
double getX1() const;
double getF0() const;
double getF1() const;
double getFF0() const;
virtual void printOutput(QString filename);
~OdeNeuralProgram();
};
# endif