https://github.com/cran/Matrix
Raw File
Tip revision: f0c53d7e01345fc68fb3686d88d520c5120bfe6d authored by Douglas Bates on 20 April 2005, 00:00:00 UTC
version 0.95-7
Tip revision: f0c53d7
dgRMatrix.R
#### Sparse Matrices in Compressed row-oriented format

### contains = "dMatrix"

setAs("dgRMatrix", "dgTMatrix",
      function(from) .Call("compressed_to_dgTMatrix", from, FALSE))

##setAs("dgRMatrix", "matrix",
##      function(from) .Call("csc_to_matrix", from))

##setAs("dgRMatrix", "dgeMatrix",
##      function(from) .Call("csc_to_dgeMatrix", from))

##setAs("matrix", "dgRMatrix",
##      function(from) {
##          storage.mode(from) <- "double"
##          .Call("matrix_to_csc", from)
##      })

##setMethod("diag", signature(x = "dgRMatrix"),
##          function(x = 1, nrow, ncol = n) .Call("csc_getDiag", x))

## try to define for "Matrix" -- once and for all -- but that fails -- why?
setMethod("dim", signature(x = "dgRMatrix"),
          function(x) x@Dim, valueClass = "integer")

##setMethod("t", signature(x = "dgRMatrix"),
##          function(x) .Call("csc_transpose", x),
##          valueClass = "dgRMatrix")

setMethod("image", "dgRMatrix",
          function(x, ...) {
              x = as(x, "dgTMatrix")
              callGeneric()
          })
back to top