SCM

SCM Repository

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

Diff of /pkg/tests/indexing.R

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1373, Mon Aug 14 21:15:38 2006 UTC revision 1374, Tue Aug 15 18:17:44 2006 UTC
# Line 159  Line 159 
159  mc[1,4] <- -99 ; stopifnot(mc[1,4] == -99)  mc[1,4] <- -99 ; stopifnot(mc[1,4] == -99)
160  mc[1:2,4:3] <- 4:1; stopifnot(as.matrix(mc[1:2,4:3]) == 4:1)  mc[1:2,4:3] <- 4:1; stopifnot(as.matrix(mc[1:2,4:3]) == 4:1)
161    
 ## Debugging:  R bug --   debug(Matrix:::replCmat)  has no effect  
   
162  mc[-1, 3] <- -2:1 # 0 should not be entered; 'value' recycled  mc[-1, 3] <- -2:1 # 0 should not be entered; 'value' recycled
163  mt[-1, 3] <- -2:1  mt[-1, 3] <- -2:1
164  stopifnot(mc@x != 0, mt@x != 0,  stopifnot(mc@x != 0, mt@x != 0,
165            mc[-1,3] == -2:1, mt[-1,3] == -2:1) ##--> BUG -- fixed            mc[-1,3] == -2:1, mt[-1,3] == -2:1) ##--> BUG -- fixed
 ## source("~/R/Pkgs/Matrix/R/Tsparse.R")  
 ## Matrix_expand_pointers <- Matrix:::Matrix_expand_pointers  
 ## -> open ../R/dgCMatrix.R  --> replCmat  .. now eval-line by line ..  
166    
167  ev <- 1:5 %% 2 == 0  ev <- 1:5 %% 2 == 0
168  mc[ev, 3] <- 0:1  mc[ev, 3] <- 0:1
169  ##FIXME stopifnot(mc[ev, 3] == 0:1) ##-> BUG  {very peculiar; the 2nd time it works ...}  if(FALSE)## FIXME
170     stopifnot(mc[ev, 3] == 0:1) ##-> BUG  {very peculiar; the 2nd time it works ...}
171  validObject(mc)  validObject(mc)
172  mc # now shows a non-structural zeros  mc # now shows a non-structural zeros
173  mc[ii, jj] <- 1:6  mc[ii, jj] <- 1:6
174  mc[c(2,5), c(3,5)] <- 3.2  mc[c(2,5), c(3,5)] <- 3.2
175  validObject(mc)  validObject(mc)
176  (m. <- mc)  (m. <- mc)
177  ## FIXME: mc[4,] <- 0 # -> error -- another Bug  if(FALSE)## FIXME:
178     mc[4,] <- 0 # -> error -- another Bug
179    
180  H <- Hilbert(9)  H <- Hilbert(9)
181  Hc <- as(round(H, 3), "dsCMatrix")  Hc <- as(round(H, 3), "dsCMatrix")# a sparse matrix with no 0 ...
182  tril(Hc[1:5, 1:5])  (trH <- tril(Hc[1:5, 1:5]))
183    stopifnot(is(trH, "triangularMatrix"), trH@uplo == "L")
184    
185  H[c(1:2, 4, 6:7), c(2:4,6)] <- 0  i <- c(1:2, 4, 6:7); j <- c(2:4,6)
186    H[i,j] <- 0
187  (H. <- round(as(H, "sparseMatrix"), 3)[ , 2:7])  (H. <- round(as(H, "sparseMatrix"), 3)[ , 2:7])
188  Hc. <- Hc  Hc. <- Hc
189  ## This assignment does not achieve the correct effect.  replCmat should be changed.  Hc.[i,j] <- 0 ## now "works", but setting "non-structural" 0s
190  Hc.[c(1:2, 4, 6:7), c(2:4,6)] <- 0  stopifnot(as.matrix(Hc.[i,j]) == 0)
191  Hc.[, 1:6]  Hc.[, 1:6]
192    
193  cat('Time elapsed: ', proc.time(),'\n') # for ``statistical reasons''  cat('Time elapsed: ', proc.time(),'\n') # for ``statistical reasons''

Legend:
Removed from v.1373  
changed lines
  Added in v.1374

root@r-forge.r-project.org
ViewVC Help
Powered by ViewVC 1.0.0  
Thanks to:
Vienna University of Economics and Business Powered By FusionForge