SCM

SCM Repository

[matrix] Diff of /pkg/R/dtCMatrix.R
ViewVC logotype

Diff of /pkg/R/dtCMatrix.R

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1173, Mon Jan 16 20:02:16 2006 UTC revision 1174, Mon Jan 16 20:03:48 2006 UTC
# Line 7  Line 7 
7                           uplo = from@uplo, diag = from@diag,                           uplo = from@uplo, diag = from@diag,
8                           Dim = from@Dim, Dimnames = from@Dimnames))                           Dim = from@Dim, Dimnames = from@Dimnames))
9    
10    setAs("matrix", "dtCMatrix",
11          function(from) as(as(from, "dtTMatrix"), "dtCMatrix"))
12    
13  setAs("dtCMatrix", "dgCMatrix",  setAs("dtCMatrix", "dgCMatrix",
14        function(from) {        function(from) {
15            if(from@diag == "U") { ## add diagonal of 1's            if(from@diag == "U") { ## add diagonal of 1's
# Line 25  Line 28 
28    
29  setAs("dtCMatrix", "dgeMatrix",  setAs("dtCMatrix", "dgeMatrix",
30        function(from) as(as(from, "dgTMatrix"), "dgeMatrix"))        function(from) as(as(from, "dgTMatrix"), "dgeMatrix"))
31    
32    ## These are all needed because cholmod doesn't support triangular:
33    ## (see end of ./Csparse.R )
34    setAs("dtCMatrix", "dtTMatrix",
35          function(from) {# and this is not elegant:
36              x <- as(from, "dgTMatrix")
37              ## FIXME: if(from@diag == "U") should drop diagonal entries:
38              new("dtTMatrix", x = x@x, i = x@i, j = x@j,
39                  Dim = x@Dim, Dimnames = x@Dimnames,
40                  uplo = from@uplo, diag = "N")
41          })
42    
43    setAs("dtCMatrix", "TsparseMatrix", function(from) as(from, "dtTMatrix"))
44    setAs("dtCMatrix", "dtrMatrix",
45          function(from) as(as(from, "dtTMatrix"), "dtrMatrix"))

Legend:
Removed from v.1173  
changed lines
  Added in v.1174

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