SCM

SCM Repository

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

Diff of /pkg/R/Tsparse.R

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

revision 1365, Thu Aug 10 18:52:55 2006 UTC revision 1366, Sat Aug 12 17:31:39 2006 UTC
# Line 1  Line 1 
1  #### "TsparseMatrix" : Virtual class of sparse matrices in triplet-format  #### "TsparseMatrix" : Virtual class of sparse matrices in triplet-format
2    
3  setAs("TsparseMatrix", "CsparseMatrix",  setAs("TsparseMatrix", "CsparseMatrix",
4        ## FIXME: this loses 'triangular' (and 'symmetric' ??)        ## |-> cholmod_T -> cholmod_C -> chm_sparse_to_SEXP
5        function(from)        ## adjusted for triangular matrices not represented in cholmod
6        .Call(Tsparse_to_Csparse, from) ## ../src/Tsparse.c        function(from) .Call(Tsparse_to_Csparse, from, ## ../src/Tsparse.c
7        ## |-> cholmod_T -> cholmod_C -> chm_sparse_to_SEXP(* , 1)                             is(from, "triangularMatrix"))
8        )        )
9    ##           ans <- .Call(Tsparse_to_Csparse, from) ## ../src/Tsparse.c
10    ##
11    ##           if (is(from, "triangularMatrix")) {
12    ##               ## regenerate the matrix with the triangular properties
13    ##               ## FIXME: move this to the C code
14    ##               if (is(ans, "lMatrix"))
15    ##                   return(new("ltCMatrix", i = ans@i, p = ans@p,
16    ##                              Dim = ans@Dim, Dimnames = ans@Dimnames,
17    ##                              uplo = from@uplo, diag = from@diag))
18    ##               return(new(ifelse(is(ans, "dMatrix"), "dtCMatrix", "ztCMatrix"),
19    ##                          i = ans@i, p = ans@p, x = ans@x,
20    ##                          Dim = ans@Dim, Dimnames = ans@Dimnames,
21    ##                          uplo = from@uplo, diag = from@diag))
22    ##           }
23    ##           ans
24    ##       })
25    
26  ### "[" :  ### "[" :
27  ### -----  ### -----
# Line 262  Line 278 
278                .Call(Csparse_crossprod, x, trans = TRUE, triplet = TRUE)                .Call(Csparse_crossprod, x, trans = TRUE, triplet = TRUE)
279            })            })
280    
281    ## Must define methods for y = "missing" first so they have precedence
282    ## (this will change in R-2.4.0).
283    
284    setMethod("crossprod", signature(x = "TsparseMatrix", y = "ANY"),
285              function(x, y = NULL) callGeneric(as(x, "CsparseMatrix"), y))
286    
287    setMethod("tcrossprod", signature(x = "TsparseMatrix", y = "ANY"),
288              function(x, y = NULL) callGeneric(as(x, "CsparseMatrix"), y))
289    
290    setMethod("%*%", signature(x = "TsparseMatrix", y = "ANY"),
291              function(x, y) callGeneric(as(x, "CsparseMatrix"), y))
292    
293    ## Not yet.  Don't have methods for y = "CsparseMatrix" and general x
294    #setMethod("%*%", signature(x = "ANY", y = "TsparseMatrix"),
295    #          function(x, y) callGeneric(x, as(y, "CsparseMatrix")))
296    
297  setMethod("colSums", signature(x = "TsparseMatrix"), .as.dgT.Fun,  setMethod("colSums", signature(x = "TsparseMatrix"), .as.dgT.Fun,
298            valueClass = "numeric")            valueClass = "numeric")
299  setMethod("colMeans", signature(x = "TsparseMatrix"), .as.dgT.Fun,  setMethod("colMeans", signature(x = "TsparseMatrix"), .as.dgT.Fun,

Legend:
Removed from v.1365  
changed lines
  Added in v.1366

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