[Yuima-commits] r149 - pkg/yuima/R

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Fri Apr 8 08:46:55 CEST 2011


Author: hinohide
Date: 2011-04-08 08:46:54 +0200 (Fri, 08 Apr 2011)
New Revision: 149

Modified:
   pkg/yuima/R/asymptotic_term.R
   pkg/yuima/R/simFunctional.R
Log:
bug in asymptotic_term is fixed

Modified: pkg/yuima/R/asymptotic_term.R
===================================================================
--- pkg/yuima/R/asymptotic_term.R	2011-04-08 01:16:10 UTC (rev 148)
+++ pkg/yuima/R/asymptotic_term.R	2011-04-08 06:46:54 UTC (rev 149)
@@ -1283,12 +1283,16 @@
       for(k in 1:k.size){
         my.x <- rbind(my.x,tmp.x)
       }
-      est.points <- my.x[,sample(seq(1,ncol(my.x),by=1),ncol(my.x),rep=FALSE)]
+
+      est.ind <- seq(1,ncol(my.x),by=10)
+      est.points <- my.x[,est.ind]
+      width <- diff(tmp.x)
+      
       tmp <- 0
-      for(i in 1:ncol(est.points)){
-        tmp <- tmp + gz_pi1(est.points[,i])
+      for(i in 1:(ncol(est.points)-1)){
+        tmp <- tmp + gz_pi1(est.points[,i])*width[i]
       }
-      tmp <- tmp/ncol(est.points)
+      
 ##    }else if( 2 <= k.size || k.size <= 20 ){ # use 'cubatur()' to solve multi-dim integration.
     }else if( (2 <= k.size || k.size <= 20) && FALSE ){ # use 'cubatur()' to solve multi-dim integration. 
       max <- 10*lambda.max
@@ -1514,11 +1518,11 @@
   
   ## calculation
   yuima.warn("Calculating d0 ...")
-  print(system.time(d0 <- get.d0.term()))
+  d0 <- get.d0.term()
 
   yuima.warn("Done\n")
   yuima.warn("Calculating d1 term ...")
-  print(system.time(d1 <- get.d1.term()))
+  d1 <- get.d1.term()
   yuima.warn("Done\n")
   terms <- list(d0=d0, d1=d1)
   return(terms)

Modified: pkg/yuima/R/simFunctional.R
===================================================================
--- pkg/yuima/R/simFunctional.R	2011-04-08 01:16:10 UTC (rev 148)
+++ pkg/yuima/R/simFunctional.R	2011-04-08 06:46:54 UTC (rev 149)
@@ -111,58 +111,13 @@
             dt <- Terminal/division
             X <- xinit
             Xt <- xinit
-  ##           k <- matrix(numeric(d.size^2), nrow=d.size,ncol=d.size)
-##             k1 <- matrix(numeric(d.size^2), nrow=d.size,ncol=d.size)
-##             k2 <- matrix(numeric(d.size^2), nrow=d.size,ncol=d.size)
-##             k3 <- matrix(numeric(d.size^2), nrow=d.size,ncol=d.size)
-##             k4 <- matrix(numeric(d.size^2), nrow=d.size,ncol=d.size)
+
             k <- numeric(d.size)
             k1 <- numeric(d.size)
             k2 <- numeric(d.size)
             k3 <- numeric(d.size)
             k4 <- numeric(d.size)
             
-            ##:: fix bug 07/23
-            #assign(pars,0) ## epsilon=0
-
-            
-  ##           ## runge kutta
-##             for(t in 1:division){
-##               ## k1
-##               for(i in 1:d.size){
-##                 assign(modelstate[i],Xt[i])
-##               }
-##               for(i in 1:d.size){
-##                 k1[,i] <- dt*eval(V0[i])
-##               }
-##               ## k2
-##               for(i in 1:d.size){
-##                 assign(modelstate[i],Xt[i]+k1[i]/2)
-##               }
-##               for(i in 1:d.size){
-##                 k2[,i] <- dt*eval(V0[i])
-##               }
-##               ## k3
-##               for(i in 1:d.size){
-##                 assign(modelstate[i],Xt[i]+k2[i]/2)
-##               }
-##               for(i in 1:d.size){
-##                 k3[,i] <- dt*eval(V0[i])
-##               }
-##               ## k4
-##               for(i in 1:d.size){
-##                 assign(modelstate[i],Xt[i]+k3[i])
-##               }
-
-##               for(i in 1:d.size){
-##                 k4[,i] <- dt*eval(V0[i])
-##               }
-##               ## V0(X(t+dt))
-##               k <- (k1+k2+k2+k3+k3+k4)/6
-##               Xt <- Xt+k
-##               X <- rbind(X,Xt)
-##             }
-
             ## runge kutta
             for(t in 1:division){
               ## k1
@@ -239,7 +194,6 @@
 setMethod("F0", signature(yuima="yuima"),
           function(yuima, expand.var="e"){
 
-            ##:: fix bug 07/23
             X.t0 <- Get.X.t0(yuima, expand.var=expand.var)
             F0 <- funcFe.(yuima, X.t0, 0, expand.var=expand.var)
             return(F0)
@@ -255,7 +209,6 @@
           function(yuima, expand.var="e"){
             e <- gete(yuima at functional)
 
-            ##:: fix bug 0723
             Fe <- simFunctional(yuima, expand.var=expand.var)
             F0 <- F0(yuima, expand.var=expand.var)
             



More information about the Yuima-commits mailing list