Description Usage Arguments Details Value Author(s) Examples
Create time series produced by general symmetric map
1 | gsm_iter_cpp(N, x0, r, alpha, N_discr, skipFirst, method)
|
N |
integer - Number of iterations |
x0 |
double - starting value |
r |
double - controll parameter |
alpha |
double - exponent of general symmetric map |
N_discr |
integer - controlls discretization of state space (zero corresponds to continuous case) |
skipFirst |
Boolean - If set to FALSE, the resulting time series contains the initial value x0 |
method |
integer - method of discretization with 1... round routine from base package (fast) or 2... matrix multiplication (slow) |
This routine is implemented in C++
vector of type double - the resulting time series
J.C. Lemm, P. v.W. Crommelin
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 | //C++ DEFINITION
Rcpp::NumericVector gsm_iter_cpp(int N, double x0, double r, double alpha, int N_discr,bool skipFirst, int method){
if(method==1){
if(N_discr>0){
N_discr--; //Decrement because the rounding routine maps to N_discr + 1 values
}
Rcpp::NumericVector X(N);
if(skipFirst){
if(N_discr == 0){
X[0] = gsm_cpp(x0,r,alpha);
}else{
X[0] = round(gsm_cpp(x0,r,alpha)*N_discr)/N_discr;
}
}else{
X[0] = x0;
}
if(N>1){
if(N_discr == 0){
for(int i=1; i<N ; i++){
X[i] = gsm_cpp(X[i-1],r,alpha);
}
}else{
for(int i=1; i<N ; i++){
X[i] = round(gsm_cpp(X[i-1],r,alpha)*N_discr)/N_discr;
}
}
}
return(X);
}else{
return(Dgsm_iter_cpp(N,x0,r,alpha,N_discr,skipFirst));
}
}
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.