# SCM Repository

[matrix] Diff of /pkg/tests/indexing.R
 [matrix] / pkg / tests / indexing.R

# Diff of /pkg/tests/indexing.R

revision 1705, Sat Dec 16 12:37:25 2006 UTC revision 1707, Thu Dec 21 08:03:05 2006 UTC
# Line 196  Line 196
196  mc[-1, 3] <- -2:1 # 0 should not be entered; 'value' recycled  mc[-1, 3] <- -2:1 # 0 should not be entered; 'value' recycled
197  mt[-1, 3] <- -2:1  mt[-1, 3] <- -2:1
198  stopifnot(mc@x != 0, mt@x != 0,  stopifnot(mc@x != 0, mt@x != 0,
199            mc[-1,3] == -2:1, mt[-1,3] == -2:1) ##--> BUG -- fixed            mc[-1,3] == -2:1, mt[-1,3] == -2:1) ## failed earlier
200
201  ev <- 1:5 %% 2 == 0  mc0 <- mc
202  mc[ev, 3] <- 0:1  set.seed(1)
203  if(FALSE)## FIXME  for(i in 1:20) {
204   stopifnot(mc[ev, 3] == 0:1) ##-> BUG  {very peculiar; the 2nd time it works ...}      mc <- mc0
205        ev <- 1:5 %% 2 == round(runif(1))# 0 or 1
206        j <- sample(ncol(mc), 1 + round(runif(1)))
207        nv <- rpois(sum(ev) * length(j), lambda = 1)
208        mc[ev, j] <- nv
209        if(i < 5) print(mc[ev,j, drop = FALSE])
210        stopifnot(as.vector(mc[ev, j]) == nv) ## failed earlier...
211  validObject(mc)  validObject(mc)
212  mc # now shows a non-structural zeros  }
213
214    mc # no longer has non-structural zeros
215  mc[ii, jj] <- 1:6  mc[ii, jj] <- 1:6
216  mc[c(2,5), c(3,5)] <- 3.2  mc[c(2,5), c(3,5)] <- 3.2
217  validObject(mc)  validObject(mc)

Legend:
 Removed from v.1705 changed lines Added in v.1707

 root@r-forge.r-project.org ViewVC Help Powered by ViewVC 1.0.0
Thanks to: