SCM

SCM Repository

[matrix] Diff of /pkg/Matrix/R/ngCMatrix.R
ViewVC logotype

Diff of /pkg/Matrix/R/ngCMatrix.R

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

revision 2627, Mon Dec 6 14:33:15 2010 UTC revision 2628, Sat Dec 11 16:56:51 2010 UTC
# Line 2  Line 2 
2    
3  ### contains = "nsparseMatrix"  ### contains = "nsparseMatrix"
4    
5  .ngC2d <- function(from)  nC2d <- function(from) .Call(nz_pattern_to_Csparse, from, 0L)## 0 --> "double"
6      new("dgCMatrix", i = from@i, p = from@p, x = rep.int(1, length(from@i)),  nC2l <- function(from) .Call(nz_pattern_to_Csparse, from, 1L)## 1 --> "logical"
         Dim = from@Dim, Dimnames = from@Dimnames)  
   
 .ngC2l <- function(from)  
     new("lgCMatrix", i = from@i, p = from@p, x = rep.int(TRUE, length(from@i)),  
         Dim = from@Dim, Dimnames = from@Dimnames)  
   
 setAs("ngCMatrix", "dMatrix", .ngC2d)# < instead of "dgCMatrix"  
 setAs("ngCMatrix", "dsparseMatrix", .ngC2d)  
 setAs("ngCMatrix", "dgCMatrix", .ngC2d)  
   
 setAs("ngCMatrix", "lMatrix", .ngC2l)  
 setAs("ngCMatrix", "lsparseMatrix", .ngC2l)  
 setAs("ngCMatrix", "lgCMatrix", .ngC2l)  
7    
8  rm(.ngC2d,.ngC2l) # don't even keep "hidden"  if(FALSE) { ## nice idea, but needs more method re-definitions ---
9    setAs("nCsparseMatrix", "dMatrix", nC2d)
10    setAs("nCsparseMatrix", "dsparseMatrix", nC2d)
11    setAs("nCsparseMatrix", "dgCMatrix", nC2d)
12    
13    setAs("nCsparseMatrix", "lMatrix", nC2l)
14    setAs("nCsparseMatrix", "lsparseMatrix", nC2l)
15    setAs("nCsparseMatrix", "lgCMatrix", nC2l)
16    } else {
17    setAs("ngCMatrix", "dMatrix", nC2d)
18    setAs("ngCMatrix", "dsparseMatrix", nC2d)
19    setAs("ngCMatrix", "dgCMatrix", nC2d)
20    
21    setAs("ngCMatrix", "lMatrix", nC2l)
22    setAs("ngCMatrix", "lsparseMatrix", nC2l)
23    setAs("ngCMatrix", "lgCMatrix", nC2l)
24    }
25    
26  if(FALSE) ## rather use ("Csparse*, to= "Tsparse*"):  if(FALSE) ## rather use ("Csparse*, to= "Tsparse*"):
27  setAs("ngCMatrix", "ngTMatrix",  setAs("ngCMatrix", "ngTMatrix",

Legend:
Removed from v.2627  
changed lines
  Added in v.2628

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