SCM

SCM Repository

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

Diff of /pkg/R/Matrix.R

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

revision 1314, Mon Jul 10 15:23:48 2006 UTC revision 1315, Mon Jul 10 16:08:05 2006 UTC
# Line 97  Line 97 
97              nrow <- ceiling(length(data)/ncol)              nrow <- ceiling(length(data)/ncol)
98          else if (missing(ncol))          else if (missing(ncol))
99              ncol <- ceiling(length(data)/nrow)              ncol <- ceiling(length(data)/nrow)
100            if(length(data) == 1 && data == 0 && !identical(sparse,FALSE)) {
101                if(is.null(sparse)) sparse <- TRUE
102                ## will be sparse: do NOT construct full matrix!
103                data <- new(if(is.numeric(data)) "dgTMatrix" else
104                            if(is.logical(data)) "lgTMatrix" else
105                            stop("invalid 'data'"),
106                            Dim = as.integer(c(nrow,ncol)),
107                            Dimnames = if(is.null(dimnames))
108                            list(NULL,NULL) else dimnames)
109            } else { ## normal case
110          data <- .Internal(matrix(data, nrow, ncol, byrow))          data <- .Internal(matrix(data, nrow, ncol, byrow))
111          if(is.null(sparse))          if(is.null(sparse))
112              sparse <- sparseDefault(data)              sparse <- sparseDefault(data)
113          dimnames(data) <- dimnames          dimnames(data) <- dimnames
114            }
115      } else if (!is.null(dimnames))      } else if (!is.null(dimnames))
116          dimnames(data) <- dimnames          dimnames(data) <- dimnames
117    
# Line 192  Line 203 
203                Y <- as(Y, "matrix") ; Matrix(callGeneric()) })                Y <- as(Y, "matrix") ; Matrix(callGeneric()) })
204    
205    
206    setMethod("diag", signature(x = "Matrix"),
207              function(x, nrow, ncol) .bail.out.1(.Generic, class(x)))
208  setMethod("t", signature(x = "Matrix"),  setMethod("t", signature(x = "Matrix"),
209            function(x) .bail.out.1(.Generic, class(x)))            function(x) .bail.out.1(.Generic, class(x)))
210    

Legend:
Removed from v.1314  
changed lines
  Added in v.1315

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