SCM

SCM Repository

[matrix] View of /pkg/R/lgCMatrix.R
ViewVC logotype

View of /pkg/R/lgCMatrix.R

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1548 - (download) (annotate)
Mon Sep 11 22:13:07 2006 UTC (12 years, 5 months ago) by maechler
File size: 1982 byte(s)
new nMatrix and subclasses; lsparse change to have x slot; many consequences
#### Logical Sparse Matrices in Compressed column-oriented format

### contains = "lsparseMatrix"

## Can use CsparseMatrix methods for all of these

## setMethod("%*%", signature(x = "lgCMatrix", y = "lgCMatrix"),
##           function(x, y)
##           .Call(lgCMatrix_lgCMatrix_mm, x, y),
##           valueClass = "lgCMatrix")

## setMethod("t", signature(x = "lgCMatrix"),
##           function(x) .Call(lgCMatrix_trans, x),
##           valueClass = "lgCMatrix")


## setMethod("diag", signature(x = "lgCMatrix"),
## 	  function(x, nrow, ncol = n) .Call(lgCMatrix_diag, x))

## setMethod("crossprod", signature(x = "lgCMatrix", y = "missing"),
## 	  function(x, y = NULL)
##           .Call(lgCMatrix_crossprod, x, TRUE, NULL),
## 	  valueClass = "lsCMatrix")

## setMethod("tcrossprod", signature(x = "lgCMatrix", y = "missing"),
## 	  function(x, y = NULL)
##           .Call(lgCMatrix_crossprod, x, FALSE, NULL),
## 	  valueClass = "lsCMatrix")

setAs("lgCMatrix", "dgCMatrix",
      function(from) new("dgCMatrix", i = from@i, p = from@p,
                         x = as.double(from@x),
                         Dim = from@Dim, Dimnames = from@Dimnames))

setAs("lgCMatrix", "lgTMatrix",
      function(from) new("lgTMatrix", i = from@i, x = from@x,
                         j = .Call(Matrix_expand_pointers, from@p),
                         Dim = from@Dim, Dimnames = from@Dimnames))

setAs("lgCMatrix", "lgeMatrix",
      function(from)
	  new("lgeMatrix", x = c(as(from, "matrix")), # is fast,
	      Dim = from@Dim, Dimnames = from@Dimnames))

setAs("lgCMatrix", "matrix", ## FIXME: this is for ngC !
      function(from) .Call(lcsc_to_matrix, from))

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


setMethod("image", "lgCMatrix",
          function(x, ...) {
              x <- as(as(x, "dgCMatrix"), "dgTMatrix")
              callGeneric()
          })


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