Displaying 3 results from an estimated 3 matches for "yn_plus_one".
Did you mean:
xn_plus_one
2017 Dec 03
5
Rcpp, dyn.load and C++ problems
...confusion
for me.
Anyway,
This is the C++-code:
#include <Rcpp.h>
using namespace Rcpp;
// [[Rcpp::export]]
List compute_values_cpp(int totalPoints = 1e5, double angle_increment =
0.01, int radius = 400, double grow = 3.64) {
double xn = 0.5;
double angle = 0.1;
double xn_plus_one, yn_plus_one;
NumericVector x(totalPoints);
NumericVector y(totalPoints);
for (int i=0; i<totalPoints; i++) {
xn_plus_one = xn*cos(angle)*radius;
yn_plus_one = xn*sin(angle)*radius;
angle += angle_increment;
xn = grow*xn*(1-xn);
x[i] = xn_plus_one;
y[i] = yn_plus_one;
}
ret...
2017 Dec 03
0
Rcpp, dyn.load and C++ problems
...e:
>
> #include <Rcpp.h>
> using namespace Rcpp;
>
> // [[Rcpp::export]]
> List compute_values_cpp(int totalPoints = 1e5, double angle_increment =
> 0.01, int radius = 400, double grow = 3.64) {
> double xn = 0.5;
> double angle = 0.1;
> double xn_plus_one, yn_plus_one;
> NumericVector x(totalPoints);
> NumericVector y(totalPoints);
>
> for (int i=0; i<totalPoints; i++) {
> xn_plus_one = xn*cos(angle)*radius;
> yn_plus_one = xn*sin(angle)*radius;
> angle += angle_increment;
> xn = grow*xn*(1-xn);
> x[i] = xn...
2017 Dec 03
0
Rcpp, dyn.load and C++ problems
...or reference, the current mmsp.cpp follows.
Dirk
#include <Rcpp.h>
using namespace Rcpp;
// [[Rcpp::export]]
List compute_values_cpp(int totalPoints = 1e5, double angle_increment =
0.01, int radius = 400, double grow = 3.64) {
double xn = 0.5;
double angle = 0.1;
double xn_plus_one, yn_plus_one;
NumericVector x(totalPoints);
NumericVector y(totalPoints);
for (int i=0; i<totalPoints; i++) {
xn_plus_one = xn*cos(angle)*radius;
yn_plus_one = xn*sin(angle)*radius;
angle += angle_increment;
xn = grow*xn*(1-xn);
x[i] = xn_plus_one;
y[i] = yn_plus_one;
}
ret...