File: etsTargetFunction.h

package info (click to toggle)
r-cran-forecast 8.13-1
  • links: PTS, VCS
  • area: main
  • in suites: bullseye, sid
  • size: 2,248 kB
  • sloc: cpp: 975; ansic: 648; sh: 13; makefile: 2
file content (62 lines) | stat: -rw-r--r-- 1,465 bytes parent folder | download
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
#include <vector>

#include <Rcpp.h>

extern "C" {

void etscalc(double *, int *, double *, int *, int *, int *, int *,
		double *, double *, double *, double *, double *, double *, double *, int *);

void cpolyroot(double *opr, double *opi, int *degree,
			double *zeror, double *zeroi, Rboolean *fail);
}

class EtsTargetFunction {

public:

	void eval(const double* p_var, int p_var_length);
	void init(std::vector<double> & p_y, int p_nstate, int p_errortype,
			int p_trendtype, int p_seasontype, bool p_damped,
			std::vector<double> & p_lower, std::vector<double> & p_upper, std::string p_opt_crit,
			int p_nmse, std::string p_bounds, int p_m,
			bool p_optAlpha, bool p_optBeta, bool p_optGamma, bool p_optPhi,
			bool p_givenAlpha, bool p_givenBeta, bool p_givenGamma, bool p_givenPhi,
			double alpha, double beta, double gamma, double phi);

	double getObjVal() { return(objval); };


private:

	bool check_params();
	bool admissible();

	std::vector<double> par;
	std::vector<double> y;

	int nstate;
	int errortype;
	int trendtype;
	int seasontype;
	bool damped;
	std::vector<double> par_noopt;
	std::vector<double> lower;
	std::vector<double> upper;
	std::string opt_crit;
	int nmse;
	std::string bounds;
	int m;
	int n;

	std::vector<double> state;
	double alpha, beta, gamma, phi;

	std::vector<double> e;
	std::vector<double> amse;

	double lik, objval;

	bool optAlpha, optBeta, optGamma, optPhi, givenAlpha, givenBeta, givenGamma, givenPhi;

};