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 1832, Tue May 1 10:18:27 2007 UTC revision 1845, Wed May 16 21:24:41 2007 UTC
# Line 282  Line 282 
282  setMethod("t", signature(x = "Matrix"),  setMethod("t", signature(x = "Matrix"),
283            function(x) .bail.out.1(.Generic, class(x)))            function(x) .bail.out.1(.Generic, class(x)))
284    
 setMethod("dim<-", signature(x = "Matrix", value = "ANY"),  
           function(x, value) {  
               if(!is.numeric(value) || length(value) != 2)  
                   stop("dim(.) value must be numeric of length 2")  
               if(prod(dim(x)) != prod(value <- as.integer(value)))  
                   stop("dimensions don't match the number of cells")  
               clx <- class(x)  
               if(substring(clx,2) == "geMatrix") {  
                   x@Dim <- value  
                   if(length(x@factors) > 0)  
                       x@factors <- list()  
                   x  
               } else if(extends(clx, "denseMatrix")) {  
                   x <- as_geSimpl2(x, clx)  
                   dim(x) <- value  
               } else { ## FIXME: this is very inefficient for large sparse x  
                   Matrix(as.vector(x), value[1], value[2])  
               }  
           })  
   
285  ## MM: More or less "Cut & paste" from  ## MM: More or less "Cut & paste" from
286  ## --- diff.default() from  R/src/library/base/R/diff.R :  ## --- diff.default() from  R/src/library/base/R/diff.R :
287  setMethod("diff", signature(x = "Matrix"),  setMethod("diff", signature(x = "Matrix"),

Legend:
Removed from v.1832  
changed lines
  Added in v.1845

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