[Robast-commits] r327 - branches/robast-0.7/pkg/RandVar/R

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Fri Jul 17 19:17:20 CEST 2009


Author: stamats
Date: 2009-07-17 19:17:17 +0200 (Fri, 17 Jul 2009)
New Revision: 327

Modified:
   branches/robast-0.7/pkg/RandVar/R/Matrixmult.R
Log:
nasty little bug in matrix multiplication - wrong order of maps generated

Modified: branches/robast-0.7/pkg/RandVar/R/Matrixmult.R
===================================================================
--- branches/robast-0.7/pkg/RandVar/R/Matrixmult.R	2009-07-16 07:49:47 UTC (rev 326)
+++ branches/robast-0.7/pkg/RandVar/R/Matrixmult.R	2009-07-17 17:17:17 UTC (rev 327)
@@ -57,9 +57,9 @@
             stop("non-conformable arguments")
         map <- vector("list", dx[1]*dy[2])
 
-        for(i in 1:dx[1])
-            for(j in 1:dy[2])
-                map[[(i-1)*dy[2] + j]] <- Map(t(x[i,]) %*% y[,j])[[1]]
+        for(i in 1:dy[2])
+            for(j in 1:dx[1])
+                map[[(i-1)*dx[1] + j]] <- Map(t(x[j,]) %*% y[,i])[[1]]
         
         y at Map <- map
         y at Dim <- c(dx[1], dy[2])
@@ -194,9 +194,9 @@
             stop("the two random matrices have different ranges")
         map <- vector("list", dx[1]*dy[2])
 
-        for(i in 1:dx[1])
-            for(j in 1:dy[2])
-                map[[(i-1)*dy[2] + j]] <- Map(x[i,] %*% y[,j])[[1]]
+        for(i in 1:dy[2])
+            for(j in 1:dx[1])
+                map[[(i-1)*dx[1] + j]] <- Map(x[j,] %*% y[,i])[[1]]
         
         x at Map <- map
         x at Dim <- c(dx[1], dy[2])



More information about the Robast-commits mailing list