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

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Tue Jan 25 07:47:07 CET 2022


Author: kyuta
Date: 2022-01-25 07:47:06 +0100 (Tue, 25 Jan 2022)
New Revision: 779

Modified:
   pkg/yuima/DESCRIPTION
   pkg/yuima/NEWS
   pkg/yuima/src/euler.c
Log:
fixed a protection issue in euler.c

Modified: pkg/yuima/DESCRIPTION
===================================================================
--- pkg/yuima/DESCRIPTION	2022-01-04 15:29:23 UTC (rev 778)
+++ pkg/yuima/DESCRIPTION	2022-01-25 06:47:06 UTC (rev 779)
@@ -1,7 +1,7 @@
 Package: yuima
 Type: Package
 Title: The YUIMA Project Package for SDEs
-Version: 1.15.0
+Version: 1.15.1
 Depends: R(>= 2.10.0), methods, zoo, stats4, utils, expm, cubature,
         mvtnorm
 Imports: Rcpp (>= 0.12.1), boot (>= 1.3-2), glassoFast, wavethresh,

Modified: pkg/yuima/NEWS
===================================================================
--- pkg/yuima/NEWS	2022-01-04 15:29:23 UTC (rev 778)
+++ pkg/yuima/NEWS	2022-01-25 06:47:06 UTC (rev 779)
@@ -83,3 +83,4 @@
 2021/12/15: added ae.R, ae.cpp, ae.Rd, aeCharacteristic.Rd, aeDensity.Rd, aeExpectation.Rd, aeKurtosis.Rd, aeMarginal.Rd
             aeMean.Rd, aeMoment.Rd, aeSd.Rd, aeSkewness.Rd, yuima.ae-class.Rd, updated NAMESPACE, updated yuima_init.c,
 			updated DESCRIPTION to add package calculus in Imports
+2021/1/25: fixed a protection issue in euler.c

Modified: pkg/yuima/src/euler.c
===================================================================
--- pkg/yuima/src/euler.c	2022-01-04 15:29:23 UTC (rev 778)
+++ pkg/yuima/src/euler.c	2022-01-25 06:47:06 UTC (rev 779)
@@ -47,8 +47,10 @@
     PROTECT(t0 = AS_NUMERIC(t0));
     REAL(tpar)[0] = REAL(t0)[0]; /* initial time */
     
-    PROTECT(b0 = allocVector(REALSXP, d));
-    PROTECT(sigma0 = allocVector(REALSXP, d*r));
+    //PROTECT(b0 = allocVector(REALSXP, d));
+    //PROTECT(sigma0 = allocVector(REALSXP, d*r));
+    PROTECT(b0 = allocVector(VECSXP, 1));
+    PROTECT(sigma0 = allocVector(VECSXP, 1));
     
     PROTECT(xpar = allocVector(REALSXP, 1));
      
@@ -79,12 +81,18 @@
         PROTECT(sigma0 = AS_NUMERIC(eval(diffusion, rho)));
         */
         /* PROTECT(b0 = allocVector(REALSXP, d));  */
-        b0 = AS_NUMERIC(eval(drift, rho));
+        //b0 = AS_NUMERIC(eval(drift, rho));
+        //b0 = PROTECT(AS_NUMERIC(eval(drift, rho)));
         /* PROTECT(sigma0 = allocVector(REALSXP, d*r)); */
-        sigma0 = AS_NUMERIC(eval(diffusion, rho)); 
+        //sigma0 = AS_NUMERIC(eval(diffusion, rho)); 
+        //sigma0 = PROTECT(AS_NUMERIC(eval(diffusion, rho))); 
+        SET_VECTOR_ELT(b0, 0, eval(drift, rho));
+        SET_VECTOR_ELT(sigma0, 0, eval(diffusion, rho));
         
-        b = REAL(b0);
-        sigma = REAL(sigma0);
+        //b = REAL(b0);
+        //sigma = REAL(sigma0);
+        b = REAL(VECTOR_ELT(b0, 0));
+        sigma = REAL(VECTOR_ELT(sigma0, 0));
         
         for (j = 0; j < d; j++) {
             rX[j + (i + 1) * d] = rX[j + i * d] + b[j] * rdt[i];
@@ -98,8 +106,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(1); /* xpar */
     UNPROTECT(2); /* b0, sigma0 */ 



More information about the Yuima-commits mailing list