[Yuima-commits] r649 - in pkg/yuima: . R src

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Mon May 21 07:48:18 CEST 2018


Author: iacus
Date: 2018-05-21 07:48:17 +0200 (Mon, 21 May 2018)
New Revision: 649

Modified:
   pkg/yuima/DESCRIPTION
   pkg/yuima/R/rng.R
   pkg/yuima/src/euler.c
Log:
cleaning up wrong files

Modified: pkg/yuima/DESCRIPTION
===================================================================
--- pkg/yuima/DESCRIPTION	2018-05-18 05:16:10 UTC (rev 648)
+++ pkg/yuima/DESCRIPTION	2018-05-21 05:48:17 UTC (rev 649)
@@ -1,7 +1,7 @@
 Package: yuima
 Type: Package
 Title: The YUIMA Project Package for SDEs
-Version: 1.8.0
+Version: 1.8.1
 Depends: R(>= 2.10.0), methods, zoo, stats4, utils, expm, cubature, mvtnorm
 Imports: Rcpp (>= 0.12.1), boot (>= 1.3-2)
 Author: YUIMA Project Team

Modified: pkg/yuima/R/rng.R
===================================================================
--- pkg/yuima/R/rng.R	2018-05-18 05:16:10 UTC (rev 648)
+++ pkg/yuima/R/rng.R	2018-05-21 05:48:17 UTC (rev 649)
@@ -118,7 +118,7 @@
     }
     
     ## univariate case
-    if(is.na(Lambda)){
+    if(any(is.na(Lambda))){
         if(length(mu)!=1 || length(beta)!=1){
             stop("Error: wrong input dimension.")
         }
@@ -195,7 +195,7 @@
     }
     
     ## univariate case
-    if(is.na(Lambda)){
+    if(any(is.na(Lambda))){
         if(length(mu)!=1 || length(beta)!=1){
             stop("Error: wrong input dimension.")
         }
@@ -276,7 +276,7 @@
   if(missing(Lambda))
    Lambda <- NA
   
-  if(is.na(Lambda)){
+  if(any(is.na(Lambda))){
     ## univariate case
     if(length(mu)!=1 || length(beta)!=1){
       stop("Error: wrong input dimension.")
@@ -350,7 +350,7 @@
   }
   if(missing(Lambda))
     Lambda <- NA
-  if(is.na(Lambda)){
+  if(any(is.na(Lambda))){
     ## univariate case
     if(length(mu)!=1 || length(beta)!=1){
       stop("Error: wrong input dimension.")
@@ -440,7 +440,7 @@
   if(missing(Lambda))
    Lambda <- NA
 
-  if(any(is.na(Lambda)==TRUE) & length(Lambda)==1){
+  if(any(is.na(Lambda)) & length(Lambda)==1){
     ## univariate case
     gamma <- sqrt(alpha^2 - beta^2)
     if(gamma <0){
@@ -508,7 +508,7 @@
     stop("delta must be positive.")
   if(missing(Lambda))
     Lambda <- NA
-  if(is.na(Lambda)){
+  if(any(is.na(Lambda))){
     #univraiate case
     if(length(beta)>1||length(mu)>1)
       stop("beta and mu must be numeric")
@@ -642,7 +642,7 @@
   if( b <= 0 )
     stop("b must be positive value.")
   
-  if(is.na(Lambda)){
+  if(any(is.na(Lambda))){
     ## univariate case
     if(length(mu)!=1 || length(beta)!=1){
       stop("Error: wrong input dimension.")

Modified: pkg/yuima/src/euler.c
===================================================================
--- pkg/yuima/src/euler.c	2018-05-18 05:16:10 UTC (rev 648)
+++ pkg/yuima/src/euler.c	2018-05-21 05:48:17 UTC (rev 649)
@@ -16,7 +16,7 @@
     
     int i, j, k, n, d, r;
     double *rdt, *rdW, *rX, *rx0, *b, *sigma;
-    SEXP X, xpar, tpar;
+    SEXP X, xpar, tpar, b0, sigma0;
     //SEXP X, xpar, tpar, xvar, tvar;
     
     PROTECT(x0 = AS_NUMERIC(x0));
@@ -67,8 +67,10 @@
         /*defineVar(install("env"), env, rho);*/
         
         /* evaluate coefficients */
-        b = REAL(eval(drift, rho));
-        sigma = REAL(eval(diffusion, rho));
+        PROTECT(b0 = eval(drift, rho));
+        PROTECT(sigma0 = eval(diffusion, rho));
+        b = REAL(b0);
+        sigma = REAL(sigma0);
         
         for (j = 0; j < d; j++) {
             rX[j + (i + 1) * d] = rX[j + i * d] + b[j] * rdt[i];
@@ -82,6 +84,8 @@
         /*rX[i + 1] = rX[i] + *REAL(eval(drift, rho)) * REAL(dt)[i] + *REAL(eval(diffusion, rho)) * REAL(dW)[i];*/
         
         REAL(tpar)[0] += rdt[i];
+        
+        UNPROTECT(2);
     }
     
     UNPROTECT(6);



More information about the Yuima-commits mailing list