SCM

SCM Repository

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

Diff of /pkg/tests/simple.R

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

revision 960, Sat Oct 1 20:10:45 2005 UTC revision 961, Sat Oct 1 20:11:51 2005 UTC
# Line 94  Line 94 
94    
95  (lkt <- as(as(kt1, "dgCMatrix"), "lgCMatrix"))# ok  (lkt <- as(as(kt1, "dgCMatrix"), "lgCMatrix"))# ok
96  (clt <- crossprod(lkt))  (clt <- crossprod(lkt))
97  if(FALSE) ## FIXME: This gives CHOLMOD errors and a *seg.fault* !!!  if(FALSE)
98      crossprod(clt)      crossprod(clt)
99  ## CHOLMOD error: matrix cannot be symmetric  ## CHOLMOD error: matrix cannot be symmetric
100  ## CHOLMOD error: argument missing  
101    
102  ### "d" <-> "l"  for (symmetric) sparse :  ### "d" <-> "l"  for (symmetric) sparse :
103  data(mm)  data(mm)
# Line 111  Line 111 
111    
112  lmm <- as(mm, "lgCMatrix")  lmm <- as(mm, "lgCMatrix")
113  xlx <- crossprod(lmm)  xlx <- crossprod(lmm)
114  ## now xlx and lxpx should really be the same -- at least `as matrix':  ## now A = lxpx and B = xlx should be close, but not quite the same
115  m1 <- as(xlx,  "matrix")  ## since <x,y> = 0 is well possible when x!=0 and y!=0 .
116  m2 <- as(lxpx, "matrix")  ## However,  A[i,j] != 0 ==> B[i,j] != 0:
117  if(FALSE) ## BUG -- FIXME -- these should be equal!  A <- as(as(lxpx, "lgCMatrix"), "lgTMatrix")
118      stopifnot(identical(m1,m2))  B <- as(as(xlx,  "lgCMatrix"), "lgTMatrix")
119  ## bug :  ij <- function(a) a@i + ncol(a) * a@j
120  table(m1 == m2)  stopifnot(all(ij(A) %in% ij(B)))
 ##  FALSE   TRUE  
 ##     78 506866  
   
   
121    
122  proc.time()  proc.time()

Legend:
Removed from v.960  
changed lines
  Added in v.961

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