[Mattice-commits] r85 - pkg/R

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Mon Dec 15 05:47:31 CET 2008


Author: andrew_hipp
Date: 2008-12-15 05:47:29 +0100 (Mon, 15 Dec 2008)
New Revision: 85

Modified:
   pkg/R/regimes.R
Log:
regMatRec works up to 2 maxMax nodes, but trips

Modified: pkg/R/regimes.R
===================================================================
--- pkg/R/regimes.R	2008-12-12 21:54:13 UTC (rev 84)
+++ pkg/R/regimes.R	2008-12-15 04:47:29 UTC (rev 85)
@@ -154,11 +154,15 @@
 ## not working correctly with maxNodes > 1
   outmat <- matrix(NA, nrow = 0, ncol = n)
   for (i in 1:(n-1)) {
-    temp <- numeric(n)
-    temp[1:i] <- c(rep(0, (i-1)), 1)
-    if (maxNodes > 1) temp[(i+1):n] <- regMatRec(n - 1, maxNodes - 1)
+    temp <- c(rep(0, (i-1)), 1)
+    remainder <- n - i
+    if (maxNodes > 1 && n > 0) {
+      nextMat <- regMatRec(remainder, maxNodes - 1)
+      temp <- cbind(matrix(temp, dim(nextMat)[2], length(temp), byrow = T), nextMat)
+      }
     else temp[(i+1):n] <- rep(0, length((i+1):n))
     outmat <- rbind(outmat, temp)
+  print(outmat)
   }
   outmat <- rbind(outmat, c(rep(0, n-1), 1))
   return(outmat)



More information about the Mattice-commits mailing list