SCM

SCM Repository

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

View of /pkg/Matrix/R/ngCMatrix.R

Parent Directory Parent Directory | Revision Log Revision Log


Revision 3084 - (download) (annotate)
Wed Apr 1 14:54:53 2015 UTC (4 years, 5 months ago) by mmaechler
File size: 1166 byte(s)
rename nC2d/nC2l to .nC2d / .nC2l and export
#### Logical Sparse Matrices in Compressed column-oriented format

### contains = "nsparseMatrix"

.nC2d <- function(from) .Call(nz_pattern_to_Csparse, from, 0L)## 0 --> "double"
.nC2l <- function(from) .Call(nz_pattern_to_Csparse, from, 1L)## 1 --> "logical"

if(FALSE) { ## nice idea, but needs more method re-definitions ---
setAs("nCsparseMatrix", "dMatrix", .nC2d)
setAs("nCsparseMatrix", "dsparseMatrix", .nC2d)
setAs("nCsparseMatrix", "dgCMatrix", .nC2d)

setAs("nCsparseMatrix", "lMatrix", .nC2l)
setAs("nCsparseMatrix", "lsparseMatrix", .nC2l)
setAs("nCsparseMatrix", "lgCMatrix", .nC2l)
} else {
setAs("ngCMatrix", "dMatrix", .nC2d)
setAs("ngCMatrix", "dsparseMatrix", .nC2d)
setAs("ngCMatrix", "dgCMatrix", .nC2d)

setAs("ngCMatrix", "lMatrix", .nC2l)
setAs("ngCMatrix", "lsparseMatrix", .nC2l)
setAs("ngCMatrix", "lgCMatrix", .nC2l)
}

setAs("ngCMatrix", "matrix", function(from) .Call(ngC_to_matrix, from))
## not this: .Call(Csparse_to_matrix, from)), since it goes via dense -> double precision

## TODO (maybe): write  matrix_to_lcsc()  in ../src/ngCMatrix.c
setAs("matrix", "ngCMatrix",
      function(from) as(as(from, "ngTMatrix"), "ngCMatrix"))


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