Skip to content

Commit 6792475

Browse files
authored
Merge pull request #1182 from m-muecke/refactor/ets-drop-dead-damped-param
refactor(ets): remove unused damped parameter from EtsTargetFunction
2 parents 8a57781 + a72ac51 commit 6792475

7 files changed

Lines changed: 10 additions & 16 deletions

File tree

R/RcppExports.R

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@ calcTBATSFaster <- function(y, yHat, wTranspose, F, x, g, e, xNought) {
1717
invisible(.Call(`_forecast_calcTBATSFaster`, y, yHat, wTranspose, F, x, g, e, xNought))
1818
}
1919

20-
etsTargetFunctionInit <- function(y, nstate, errortype, trendtype, seasontype, damped, lower, upper, opt_crit, nmse, bounds, m, optAlpha, optBeta, optGamma, optPhi, givenAlpha, givenBeta, givenGamma, givenPhi, alpha, beta, gamma, phi, rho) {
21-
.Call(`_forecast_etsTargetFunctionInit`, y, nstate, errortype, trendtype, seasontype, damped, lower, upper, opt_crit, nmse, bounds, m, optAlpha, optBeta, optGamma, optPhi, givenAlpha, givenBeta, givenGamma, givenPhi, alpha, beta, gamma, phi, rho)
20+
etsTargetFunctionInit <- function(y, nstate, errortype, trendtype, seasontype, lower, upper, opt_crit, nmse, bounds, m, optAlpha, optBeta, optGamma, optPhi, givenAlpha, givenBeta, givenGamma, givenPhi, alpha, beta, gamma, phi, rho) {
21+
.Call(`_forecast_etsTargetFunctionInit`, y, nstate, errortype, trendtype, seasontype, lower, upper, opt_crit, nmse, bounds, m, optAlpha, optBeta, optGamma, optPhi, givenAlpha, givenBeta, givenGamma, givenPhi, alpha, beta, gamma, phi, rho)
2222
}
2323

2424
etsNelderMead <- function(par, env, abstol, intol, alpha, beta, gamma, trace, maxit) {

R/ets.R

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -928,7 +928,6 @@ etsTargetFunctionInitWrapper <- function(
928928
errortype = switch(errortype, A = 1L, M = 2L),
929929
trendtype = switch(trendtype, N = 0L, A = 1L, M = 2L),
930930
seasontype = switch(seasontype, N = 0L, A = 1L, M = 2L),
931-
damped = damped,
932931
lower = lowerb,
933932
upper = upperb,
934933
opt_crit = opt.crit,

man/forecast-package.Rd

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/RcppExports.cpp

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -80,8 +80,8 @@ BEGIN_RCPP
8080
END_RCPP
8181
}
8282
// etsTargetFunctionInit
83-
Rcpp::Environment etsTargetFunctionInit(const Rcpp::NumericVector& y, int nstate, int errortype, int trendtype, int seasontype, bool damped, const Rcpp::NumericVector& lower, const Rcpp::NumericVector& upper, const std::string& opt_crit, int nmse, const std::string& bounds, int m, bool optAlpha, bool optBeta, bool optGamma, bool optPhi, bool givenAlpha, bool givenBeta, bool givenGamma, bool givenPhi, double alpha, double beta, double gamma, double phi, Rcpp::Environment& rho);
84-
RcppExport SEXP _forecast_etsTargetFunctionInit(SEXP ySEXP, SEXP nstateSEXP, SEXP errortypeSEXP, SEXP trendtypeSEXP, SEXP seasontypeSEXP, SEXP dampedSEXP, SEXP lowerSEXP, SEXP upperSEXP, SEXP opt_critSEXP, SEXP nmseSEXP, SEXP boundsSEXP, SEXP mSEXP, SEXP optAlphaSEXP, SEXP optBetaSEXP, SEXP optGammaSEXP, SEXP optPhiSEXP, SEXP givenAlphaSEXP, SEXP givenBetaSEXP, SEXP givenGammaSEXP, SEXP givenPhiSEXP, SEXP alphaSEXP, SEXP betaSEXP, SEXP gammaSEXP, SEXP phiSEXP, SEXP rhoSEXP) {
83+
Rcpp::Environment etsTargetFunctionInit(const Rcpp::NumericVector& y, int nstate, int errortype, int trendtype, int seasontype, const Rcpp::NumericVector& lower, const Rcpp::NumericVector& upper, const std::string& opt_crit, int nmse, const std::string& bounds, int m, bool optAlpha, bool optBeta, bool optGamma, bool optPhi, bool givenAlpha, bool givenBeta, bool givenGamma, bool givenPhi, double alpha, double beta, double gamma, double phi, Rcpp::Environment& rho);
84+
RcppExport SEXP _forecast_etsTargetFunctionInit(SEXP ySEXP, SEXP nstateSEXP, SEXP errortypeSEXP, SEXP trendtypeSEXP, SEXP seasontypeSEXP, SEXP lowerSEXP, SEXP upperSEXP, SEXP opt_critSEXP, SEXP nmseSEXP, SEXP boundsSEXP, SEXP mSEXP, SEXP optAlphaSEXP, SEXP optBetaSEXP, SEXP optGammaSEXP, SEXP optPhiSEXP, SEXP givenAlphaSEXP, SEXP givenBetaSEXP, SEXP givenGammaSEXP, SEXP givenPhiSEXP, SEXP alphaSEXP, SEXP betaSEXP, SEXP gammaSEXP, SEXP phiSEXP, SEXP rhoSEXP) {
8585
BEGIN_RCPP
8686
Rcpp::RObject rcpp_result_gen;
8787
Rcpp::RNGScope rcpp_rngScope_gen;
@@ -90,7 +90,6 @@ BEGIN_RCPP
9090
Rcpp::traits::input_parameter< int >::type errortype(errortypeSEXP);
9191
Rcpp::traits::input_parameter< int >::type trendtype(trendtypeSEXP);
9292
Rcpp::traits::input_parameter< int >::type seasontype(seasontypeSEXP);
93-
Rcpp::traits::input_parameter< bool >::type damped(dampedSEXP);
9493
Rcpp::traits::input_parameter< const Rcpp::NumericVector& >::type lower(lowerSEXP);
9594
Rcpp::traits::input_parameter< const Rcpp::NumericVector& >::type upper(upperSEXP);
9695
Rcpp::traits::input_parameter< const std::string& >::type opt_crit(opt_critSEXP);
@@ -110,7 +109,7 @@ BEGIN_RCPP
110109
Rcpp::traits::input_parameter< double >::type gamma(gammaSEXP);
111110
Rcpp::traits::input_parameter< double >::type phi(phiSEXP);
112111
Rcpp::traits::input_parameter< Rcpp::Environment& >::type rho(rhoSEXP);
113-
rcpp_result_gen = Rcpp::wrap(etsTargetFunctionInit(y, nstate, errortype, trendtype, seasontype, damped, lower, upper, opt_crit, nmse, bounds, m, optAlpha, optBeta, optGamma, optPhi, givenAlpha, givenBeta, givenGamma, givenPhi, alpha, beta, gamma, phi, rho));
112+
rcpp_result_gen = Rcpp::wrap(etsTargetFunctionInit(y, nstate, errortype, trendtype, seasontype, lower, upper, opt_crit, nmse, bounds, m, optAlpha, optBeta, optGamma, optPhi, givenAlpha, givenBeta, givenGamma, givenPhi, alpha, beta, gamma, phi, rho));
114113
return rcpp_result_gen;
115114
END_RCPP
116115
}
@@ -299,7 +298,7 @@ static const R_CallMethodDef CallEntries[] = {
299298
{"_forecast_calcBATSFaster", (DL_FUNC) &_forecast_calcBATSFaster, 13},
300299
{"_forecast_calcWTilda", (DL_FUNC) &_forecast_calcWTilda, 2},
301300
{"_forecast_calcTBATSFaster", (DL_FUNC) &_forecast_calcTBATSFaster, 8},
302-
{"_forecast_etsTargetFunctionInit", (DL_FUNC) &_forecast_etsTargetFunctionInit, 25},
301+
{"_forecast_etsTargetFunctionInit", (DL_FUNC) &_forecast_etsTargetFunctionInit, 24},
303302
{"_forecast_etsNelderMead", (DL_FUNC) &_forecast_etsNelderMead, 9},
304303
{"_forecast_makeBATSWMatrix", (DL_FUNC) &_forecast_makeBATSWMatrix, 4},
305304
{"_forecast_makeBATSGMatrix", (DL_FUNC) &_forecast_makeBATSGMatrix, 6},

src/etsTargetFunction.cpp

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ void EtsTargetFunction::init(const std::vector<double> &p_y,
99
int p_errortype,
1010
int p_trendtype,
1111
int p_seasontype,
12-
bool p_damped,
1312
const std::vector<double> &p_lower,
1413
const std::vector<double> &p_upper,
1514
std::string p_opt_crit,
@@ -35,7 +34,6 @@ void EtsTargetFunction::init(const std::vector<double> &p_y,
3534

3635
this->trendtype = p_trendtype;
3736
this->seasontype = p_seasontype;
38-
this->damped = p_damped;
3937

4038
this->lower = p_lower;
4139
this->upper = p_upper;
@@ -128,7 +126,7 @@ void EtsTargetFunction::eval(const double *p_par, int p_par_length) {
128126
this->objval = R_PosInf;
129127
return;
130128
}
131-
};
129+
}
132130

133131
etscalc_internal(this->y.data(), this->n, this->state.data(), nullptr, this->m,
134132
this->errortype, this->trendtype, this->seasontype,

src/etsTargetFunction.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ class EtsTargetFunction {
1818

1919
void eval(const double* p_var, int p_var_length);
2020
void init(const std::vector<double> &p_y, int p_nstate, int p_errortype,
21-
int p_trendtype, int p_seasontype, bool p_damped,
21+
int p_trendtype, int p_seasontype,
2222
const std::vector<double> &p_lower, const std::vector<double> &p_upper,
2323
std::string p_opt_crit, int p_nmse, std::string p_bounds, int p_m,
2424
bool p_optAlpha, bool p_optBeta, bool p_optGamma, bool p_optPhi,
@@ -39,7 +39,6 @@ class EtsTargetFunction {
3939
int errortype;
4040
int trendtype;
4141
int seasontype;
42-
bool damped;
4342
std::vector<double> lower;
4443
std::vector<double> upper;
4544
std::string opt_crit;

src/etsTargetFunctionWrapper.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ Rcpp::Environment etsTargetFunctionInit(const Rcpp::NumericVector &y,
1818
int errortype,
1919
int trendtype,
2020
int seasontype,
21-
bool damped,
2221
const Rcpp::NumericVector &lower,
2322
const Rcpp::NumericVector &upper,
2423
const std::string &opt_crit,
@@ -41,7 +40,7 @@ Rcpp::Environment etsTargetFunctionInit(const Rcpp::NumericVector &y,
4140
EtsTargetFunction* sp = new EtsTargetFunction();
4241

4342
sp->init(Rcpp::as<std::vector<double>>(y), nstate, errortype, trendtype,
44-
seasontype, damped, Rcpp::as<std::vector<double>>(lower),
43+
seasontype, Rcpp::as<std::vector<double>>(lower),
4544
Rcpp::as<std::vector<double>>(upper), opt_crit, nmse, bounds, m,
4645
optAlpha, optBeta, optGamma, optPhi, givenAlpha, givenBeta,
4746
givenGamma, givenPhi, alpha, beta, gamma, phi);

0 commit comments

Comments
 (0)