The R Project SVN R-packages

Rev

Rev 739 | Rev 1193 | Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | Download | RSS feed

setMethod("crossprod", signature(x = "dgCMatrix", y = "missing"),
          function(x, y = NULL)
          .Call("csc_crossprod", x))

setMethod("crossprod", signature(x = "dgCMatrix", y = "matrix"),
          function(x, y = NULL)
          .Call("csc_matrix_crossprod", x, y))

setMethod("crossprod", signature(x = "dgCMatrix", y = "numeric"),
          function(x, y = NULL)
          .Call("csc_matrix_crossprod", x, as.matrix(y)))

setMethod("tcrossprod", signature(x = "dgCMatrix"),
          function(x)
          .Call("csc_tcrossprod", x))

setMethod("dim", signature(x = "dgCMatrix"),
          function(x) x@Dim, valueClass = "integer")

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

setAs("dgCMatrix", "dgTMatrix",
      function(from)
      .Call("csc_to_dgTMatrix", from)
      )

setAs("dgCMatrix", "matrix",
      function(from)
      .Call("csc_to_matrix", from))

setAs("dgCMatrix", "dgeMatrix",
      function(from)
      .Call("csc_to_dgeMatrix", from))

setAs("dgCMatrix", "dgBCMatrix",
      function(from) new("dgBCMatrix", p = from@p, i = from@i,
                         x = array(from@x, c(1, 1, length(from@x)))))

setAs("matrix", "dgCMatrix",
      function(from) {
          storage.mode(from) = "double"
          .Call("matrix_to_csc", from)
      })

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

setMethod("image", "dgCMatrix",
          function(x, ...) {
              x = as(x, "dgTMatrix")
              callGeneric()
          })