SCM

SCM Repository

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

View of /pkg/R/nsTMatrix.R

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1599 - (download) (annotate)
Fri Sep 29 09:39:50 2006 UTC (13 years, 4 months ago) by maechler
File size: 801 byte(s)
more coercion methods (for rare matrices)  => less exceptions
#### Sparse Symmetric non-zero pattern Matrices in Triplet format

### contains = "nsparseMatrix"

setAs("nsTMatrix", "matrix",
      function(from) as(as(from, "ngTMatrix"), "matrix"))

setAs("nsTMatrix", "ngTMatrix",
      function(from) new("ngTMatrix", i = from@i, j = from@j,
                         Dim = from@Dim, Dimnames = from@Dimnames))

setAs("nsTMatrix", "dsTMatrix",
      function(from) new("dsTMatrix", i = from@i, j = from@j,
                         x = rep.int(1, length(from@i)), uplo = from@uplo,
                         diag = from@diag,
                         Dim = from@Dim, Dimnames = from@Dimnames))

## untested:
setMethod("image", "nsTMatrix",
          function(x, ...) {
              x <- as(as(x, "dsTMatrix"), "dgTMatrix")
              callGeneric()
          })

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