SCM Repository

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

View of /pkg/R/dsTMatrix.R

Parent Directory Parent Directory | Revision Log Revision Log

Revision 1538 - (download) (annotate)
Fri Sep 8 13:18:50 2006 UTC (13 years, 3 months ago) by bates
File size: 1522 byte(s)
Update description after removal of Metis et al.
### Coercion and Methods for Symmetric Triplet Matrices

## Now in ./Tsparse.R
## setAs("dsTMatrix", "dsCMatrix",
##       function(from) .Call(Tsparse_to_Csparse, from, FALSE))

setAs("dsTMatrix", "dgTMatrix",
      function(from) .Call(dsTMatrix_as_dgTMatrix, from))

setAs("dsTMatrix", "lsTMatrix",
      function(from) new("lsTMatrix", i = from@i, j = from@j, uplo = from@uplo,
                         Dim = from@Dim, Dimnames = from@Dimnames))

## Conversion <--> dense storage is via dsyMatrix :
setAs("dsTMatrix", "dsyMatrix",
      function(from) .Call(dsTMatrix_as_dsyMatrix, from))

setAs("dsTMatrix", "dgeMatrix",
      function(from) as(as(from, "dsyMatrix"), "dgeMatrix"))
setAs("dsTMatrix", "matrix",
      function(from) as(as(from, "dsyMatrix"), "matrix"))

to_dsT <- function(from) as(as(from, "dsyMatrix"), "dsTMatrix")
setAs("dgeMatrix", "dsTMatrix", to_dsT)
setAs("matrix",    "dsTMatrix", to_dsT)

setMethod("t", signature(x = "dsTMatrix"),
          new("dsTMatrix", Dim = x@Dim,
              i = x@j, j = x@i, x = x@x,
              uplo = if (x@uplo == "U") "L" else "U"),
          valueClass = "dsTMatrix")

setMethod("writeHB", signature(obj = "dsTMatrix"),
          function(obj, file, ...) callGeneric(as(obj, "CsparseMatrix"), file, ...))

setMethod("writeMM", signature(obj = "dsTMatrix"),
          function(obj, file, ...)
                if (obj@uplo == "U") t(obj) else obj,
                as.character(file), "DST"))
ViewVC Help
Powered by ViewVC 1.0.0  
Thanks to:
Vienna University of Economics and Business Powered By FusionForge