# SCM Repository

[matrix] Diff of /pkg/Matrix/R/ddenseMatrix.R
 [matrix] / pkg / Matrix / R / ddenseMatrix.R # Diff of /pkg/Matrix/R/ddenseMatrix.R

revision 1463, Tue Aug 29 22:30:57 2006 UTC revision 1618, Fri Oct 6 15:44:01 2006 UTC
# Line 32  Line 32
32        function(from) .Call(dense_to_Csparse, from))        function(from) .Call(dense_to_Csparse, from))
33
34  setAs("matrix", "CsparseMatrix",  setAs("matrix", "CsparseMatrix",
35        function(from)        function(from) {
36        .Call(dense_to_Csparse, .Call(dup_mMatrix_as_dgeMatrix, from)))              if(is.numeric(from))
37                    .Call(dense_to_Csparse, .Call(dup_mMatrix_as_dgeMatrix, from))
38                else if(is.logical(from)) ## FIXME: this works, but maybe wastefully
39                    as(Matrix(from, sparse=TRUE), "CsparseMatrix")
40                else stop('not-yet-implemented coercion to "CsparseMatrix"')
41          })
42
43
44  ## special case needed in the Matrix function  ## special case needed in the Matrix function
45  setAs("matrix", "dgCMatrix",  setAs("matrix", "dgCMatrix",
# Line 236  Line 242
242                new("dgeMatrix", Dim = c(nrx + nry, nc), Dimnames = dn,                new("dgeMatrix", Dim = c(nrx + nry, nc), Dimnames = dn,
243                    x = c(rbind2(as(x,"matrix"), as(y,"matrix"))))                    x = c(rbind2(as(x,"matrix"), as(y,"matrix"))))
244            })            })
245
246    ### FIXME: band() et al should be extended from "ddense" to "dense" !
247    ###        However, needs much work to generalize dup_mMatrix_as_dgeMatrix()
248
249  ## NB: have extra tril(), triu() methods for symmetric ["dsy" and "dsp"] and  ## NB: have extra tril(), triu() methods for symmetric ["dsy" and "dsp"] and
250  ##     for triangular ["dtr" and "dtp"]  ##     for triangular ["dtr" and "dtp"]
251  setMethod("tril", "ddenseMatrix",  setMethod("tril", "ddenseMatrix",

Legend:
 Removed from v.1463 changed lines Added in v.1618  