[Rsiena-commits] r14 - pkg/RSiena/R

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Wed Sep 23 04:30:16 CEST 2009


Author: ripleyrm
Date: 2009-09-23 04:30:16 +0200 (Wed, 23 Sep 2009)
New Revision: 14

Modified:
   pkg/RSiena/R/phase1.r
   pkg/RSiena/R/phase3.r
Log:
Fix sequence errors and progress value with multiple processors.

Modified: pkg/RSiena/R/phase1.r
===================================================================
--- pkg/RSiena/R/phase1.r	2009-09-22 23:35:09 UTC (rev 13)
+++ pkg/RSiena/R/phase1.r	2009-09-23 02:30:16 UTC (rev 14)
@@ -59,11 +59,16 @@
     xsmall$cconditional <- x$cconditional
     zsmall$condvar <- z$condvar
     nits <- seq(1, firstNit, int)
-    nits6 <- min(nits[nits >= 6 ])
+    if (any(nits >= 6))
+    {
+        nits6 <- min(nits[nits >= 6 ])
+    }
+    else
+        nits6 <- -1
     for (nit in nits)
     {
          z$nit <- nit
-         if (nit == nits[2])
+         if (length(nits) > 1 && nit == nits[2])
          {
              time1 <- proc.time()['elapsed']
              if (x$checktime)
@@ -513,7 +518,12 @@
     }
                                         # browser()
     if (z$Phase == 1 && z$nit <= 10)
-        z$npos <- z$npos + ifelse(abs(diag(fras[1, , ])) > 1e-6, 1, 0)
+    {
+        for (ii in 1: min(10 - z$nit + 1, int))
+        {
+            z$npos <- z$npos + ifelse(abs(diag(fras[ii, , ])) > 1e-6, 1, 0)
+        }
+    }
     sdf <- fras / rep(z$epsilon, z$pp)
     z$sdf0 <- sdf
                                         # browser()

Modified: pkg/RSiena/R/phase3.r
===================================================================
--- pkg/RSiena/R/phase3.r	2009-09-22 23:35:09 UTC (rev 13)
+++ pkg/RSiena/R/phase3.r	2009-09-23 02:30:16 UTC (rev 14)
@@ -112,7 +112,7 @@
                 writefreq <- z$writefreq
             }
         }
-        if (nit <= 5 || nit == 10 || nit %% z$writefreq == 0 ||
+        if (nit <= 5 || nit == 10 || (int==1 && nit %% z$writefreq == 0 ) ||
             (int > 1 && nit %in% nits[seq(z$writefreq + 1, x$n3 %/% int,
                                           z$writefreq)]))
         {
@@ -129,8 +129,8 @@
             if (nit %% z$writefreq == 0 || (int > 1 &&
                        nit %% z$writefreq == 1) )
             {
-                increment <- ifelse(nit <= 5, 1,
-                                    ifelse(nit <= 10, 5, z$writefreq))
+                increment <- ifelse(nit <= 5, int,
+                                    ifelse(nit <= 10, 5, z$writefreq * int))
                 val<- getProgressBar(z$pb)
                 if (x$FinDiff.method)
                     val <- val + increment * (z$pp + 1)



More information about the Rsiena-commits mailing list