SCM

SCM Repository

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

View of /pkg/R/lsTMatrix.R

Parent Directory Parent Directory | Revision Log Revision Log


Revision 2185 - (download) (annotate)
Sat Apr 26 20:33:16 2008 UTC (11 years, 5 months ago) by mmaechler
File size: 920 byte(s)
more <Ops> methods, notably for lMatrix & nMatrix
#### Logical Sparse Symmetric Matrices in Triplet format

### contains = "lsparseMatrix"

setAs("lsTMatrix", "matrix",
      function(from) as(as(from, "lgTMatrix"), "matrix"))

setAs("lsTMatrix", "lgCMatrix", # for diag
      function(from) as(as(from, "lsCMatrix"), "lgCMatrix"))

setAs("lsTMatrix", "lgTMatrix",
      function(from) .Call(lsTMatrix_as_lgTMatrix, from))


if(FALSE) # should use  as(., "dMatrix")
setAs("lsTMatrix", "dsTMatrix",
      function(from)
      new("dsTMatrix", i = from@i, j = from@j, uplo = from@uplo,
	  x = as.double(from@x), # *not* just 1; from@x *can* have FALSE
	  Dim = from@Dim, Dimnames = from@Dimnames))

setAs("lsTMatrix", "lsyMatrix",
      function(from) .Call(lsTMatrix_as_lsyMatrix, from))


setMethod("t", "lsTMatrix",
	  function(x)
	  new("lsTMatrix", Dim = x@Dim, Dimnames = x@Dimnames,
	      i = x@j, j = x@i, x = x@x,
	      uplo = if (x@uplo == "U") "L" else "U"))

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