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

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Fri Nov 22 03:03:34 CET 2013


Author: kyuta
Date: 2013-11-22 03:03:34 +0100 (Fri, 22 Nov 2013)
New Revision: 262

Modified:
   pkg/yuima/DESCRIPTION
   pkg/yuima/NEWS
   pkg/yuima/R/cce.R
   pkg/yuima/src/cce_functions.c
Log:
modify cce.R, cce_functions.c

Modified: pkg/yuima/DESCRIPTION
===================================================================
--- pkg/yuima/DESCRIPTION	2013-11-21 01:20:01 UTC (rev 261)
+++ pkg/yuima/DESCRIPTION	2013-11-22 02:03:34 UTC (rev 262)
@@ -1,8 +1,8 @@
 Package: yuima
 Type: Package
 Title: The YUIMA Project package (unstable version)
-Version: 0.1.216
-Date: 2013-11-21
+Version: 0.1.217
+Date: 2013-11-22
 Depends: methods, zoo, stats4, utils
 Suggests: cubature, mvtnorm
 Author: YUIMA Project Team.

Modified: pkg/yuima/NEWS
===================================================================
--- pkg/yuima/NEWS	2013-11-21 01:20:01 UTC (rev 261)
+++ pkg/yuima/NEWS	2013-11-22 02:03:34 UTC (rev 262)
@@ -15,4 +15,5 @@
             modify cce.R, llag.R, sim.euler.R, bns.test.Rd, cce.Rd, llag.Rd, mpv.Rd, noisy.sampling.Rd
 2013/10/28: modify llag.R
 2013/10/30: modify cce.R, cce_functions.c
-2013/11/21: modify llag.R
\ No newline at end of file
+2013/11/21: modify llag.R
+2013/11/22: modify cce.R, cce_functions.c
\ No newline at end of file

Modified: pkg/yuima/R/cce.R
===================================================================
--- pkg/yuima/R/cce.R	2013-11-21 01:20:01 UTC (rev 261)
+++ pkg/yuima/R/cce.R	2013-11-22 02:03:34 UTC (rev 262)
@@ -86,12 +86,22 @@
     refresh.times <- double(MinL)
     refresh.times[1] <- max(sapply(ser.times,"[",1))
     
+    #idx <- matrix(.C("refreshsampling",
+    #                 as.integer(d.size),
+    #                 integer(d.size),
+    #                 as.double(unlist(ser.times)),
+    #                 as.double(refresh.times),
+    #                 as.integer(append(ser.lengths,0,after=0)),
+    #                 min(sapply(ser.times,FUN="tail",n=1)),
+    #                 as.integer(MinL),
+    #                 result=integer(d.size*MinL))$result,ncol=d.size)
     idx <- matrix(.C("refreshsampling",
                      as.integer(d.size),
                      integer(d.size),
                      as.double(unlist(ser.times)),
                      as.double(refresh.times),
-                     as.integer(append(ser.lengths,0,after=0)),
+                     as.integer(ser.lengths),
+                     as.integer(diffinv(ser.lengths[-d.size],xi=0)),
                      min(sapply(ser.times,FUN="tail",n=1)),
                      as.integer(MinL),
                      result=integer(d.size*MinL))$result,ncol=d.size)
@@ -167,12 +177,23 @@
     refresh.times <- double(MinL)
     refresh.times[1] <- max(sapply(ser.times,"[",1))
     
+    #obj <- .C("refreshsamplingphy",
+    #          as.integer(d.size),
+    #          integer(d.size),
+    #          as.double(unlist(ser.times)),
+    #          rtimes=as.double(refresh.times),
+    #          as.integer(append(ser.lengths,0,after=0)),
+    #          min(sapply(ser.times,FUN="tail",n=1)),
+    #          as.integer(MinL),
+    #          Samplings=integer(d.size*(MinL+1)),
+    #          rNum=integer(1))
     obj <- .C("refreshsamplingphy",
               as.integer(d.size),
               integer(d.size),
               as.double(unlist(ser.times)),
               rtimes=as.double(refresh.times),
-              as.integer(append(ser.lengths,0,after=0)),
+              as.integer(ser.lengths),
+              as.integer(diffinv(ser.lengths[-d.size],xi=0)),
               min(sapply(ser.times,FUN="tail",n=1)),
               as.integer(MinL),
               Samplings=integer(d.size*(MinL+1)),

Modified: pkg/yuima/src/cce_functions.c
===================================================================
--- pkg/yuima/src/cce_functions.c	2013-11-21 01:20:01 UTC (rev 261)
+++ pkg/yuima/src/cce_functions.c	2013-11-22 02:03:34 UTC (rev 262)
@@ -1,14 +1,13 @@
 #include <Rinternals.h>
 
-void ctsubsampling(double *znum, double *ztime, int *frequency, int *nsparse,
-                   int *n, double *grid, double *result)
+void ctsubsampling(double *znum, double *ztime, int *frequency, int *nsparse, int *n, double *grid, double *result)
 {
   int t, i, k;
-  
+   
   for(t = 0; t < *frequency; t++){
-    k = 1;
     for(i = 0; i < *nsparse; i++){
-      while((ztime[k]<=grid[i])&&(k < *n)){
+        k = 1;
+      while((ztime[k]<=grid[i])&&(k<*n)){
         k++;
       }
       result[(*nsparse)*t+i] += znum[k-1];
@@ -20,16 +19,18 @@
 
 
 void refreshsampling(int *Dim, int* I, double *Times, double *rtimes,
-                     int *Lengths, double *MinTime, int *MinL,
+                     int *Lengths, int *D, double *MinTime, int *MinL,
                      int *Samplings)
 {
   int d, i, J;
   double Tmp;
   
   for(d = 0; d < *Dim; d++) {
-    while(Times[Lengths[d] * d + (I[d]+1)] <= rtimes[0]){
+    /*while(Times[Lengths[d] * d + (I[d]+1)] <= rtimes[0]){*/
+    while(Times[D[d] + (I[d]+1)] <= rtimes[0]){
       I[d]++;
-      if((I[d]+1) >= Lengths[d + 1]){
+      /*if((I[d]+1) >= Lengths[d + 1]){*/
+      if((I[d]+1) >= Lengths[d]){
         break;
       }
     }
@@ -45,9 +46,11 @@
     for(d = 0; d < *Dim; d++) {
       Tmp = rtimes[i];
       J = I[d];
-      while((J < (Lengths[d + 1]-1)) && (Tmp <= rtimes[i])) {
+      /*while((J < (Lengths[d + 1]-1)) && (Tmp <= rtimes[i])) {*/
+      while((J < (Lengths[d]-1)) && (Tmp <= rtimes[i])) {
         J++;
-        Tmp = Times[Lengths[d] * d + J];
+        /*Tmp = Times[Lengths[d] * d + J];*/
+        Tmp = Times[D[d] + J];
       }
       if(Tmp > rtimes[i + 1])
         rtimes[i + 1] = Tmp;
@@ -56,9 +59,11 @@
     i++;
       
     for(d = 0; d < *Dim; d++) {
-      while(Times[Lengths[d] * d + (I[d]+1)] <= rtimes[i]){
+      /*while(Times[Lengths[d] * d + (I[d]+1)] <= rtimes[i]){*/
+      while(Times[D[d] + (I[d]+1)] <= rtimes[i]){
         I[d]++;
-        if((I[d]+1) >= Lengths[d + 1]){
+        /*if((I[d]+1) >= Lengths[d + 1]){*/
+        if((I[d]+1) >= Lengths[d]){
           break;
         }
       }
@@ -70,7 +75,7 @@
 
 
 void refreshsamplingphy(int *Dim, int* I, double *Times, double *rtimes,
-                        int *Lengths, double *MinTime, int *MinL,
+                        int *Lengths, int *D, double *MinTime, int *MinL,
                         int *Samplings, int *rNum)
 {
   int d, i;
@@ -83,11 +88,14 @@
   for(i = 0; rtimes[i] < *MinTime; i++) {
     rtimes[i + 1] = rtimes[i];
     for(d = 0; d < *Dim; d++) {
-      while(I[d] < (Lengths[d + 1] - 1)){
+      /*while(I[d] < (Lengths[d + 1] - 1)){*/
+      while(I[d] < (Lengths[d] - 1)){
         I[d]++;
-        if(Times[Lengths[d] * d + I[d]] > rtimes[i]){
+        /*if(Times[Lengths[d] * d + I[d]] > rtimes[i]){*/
+        if(Times[D[d] + I[d]] > rtimes[i]){
           Samplings[(*MinL + 1) * d + (i + 1)] = I[d] + 1;
-          Tmp = Times[Lengths[d] * d + I[d]];
+          /*Tmp = Times[Lengths[d] * d + I[d]];*/
+          Tmp = Times[D[d] + I[d]];
           if(rtimes[i + 1] < Tmp){
             rtimes[i + 1] = Tmp; 
           }
@@ -100,9 +108,11 @@
   *rNum = i + 1;
   
   for(d = 0; d < *Dim; d++) {
-    while(I[d] < (Lengths[d + 1] -1)){
+    /*while(I[d] < (Lengths[d + 1] -1)){*/
+    while(I[d] < (Lengths[d] -1)){
       I[d]++;
-      if(Times[Lengths[d] * d + I[d]] > rtimes[i]){
+      /*if(Times[Lengths[d] * d + I[d]] > rtimes[i]){*/
+      if(Times[D[d] + I[d]] > rtimes[i]){
         Samplings[(*MinL + 1) * d + (i + 1)] = I[d] + 1;
         break;
       }
@@ -255,20 +265,6 @@
 }
 
 
-void msrc(int *M, int *N, double *xg, double *xl, double *ygamma, double *ylambda,
-          double *result)
-{
-  int m, i;
-  
-  for(m = 0; m < *M; m++) {
-    for(i = m; i < *N; i++){
-      result[m] += (xg[i] - xl[i-m]) * (ygamma[i] - ylambda[i-m]);
-    }
-  }
-  
-}
-
-
 void HYcrosscov(int *gridL, int *xL, int *yL, double *grid, double *xtime,
                 double *ytime, double *tmptime, double *dX, double *dY, double *value)
 {
@@ -307,4 +303,4 @@
         }
     }
   }
-}
+}
\ No newline at end of file



More information about the Yuima-commits mailing list