SCM

SCM Repository

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

Diff of /pkg/R/sparseMatrix.R

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

revision 1388, Thu Aug 17 22:37:19 2006 UTC revision 1389, Fri Aug 18 13:53:33 2006 UTC
# Line 196  Line 196 
196    
197  ### --- show() method ---  ### --- show() method ---
198    
199  prSpMatrix <- function(object, zero.print = ".")  ## FIXME(?) -- ``merge this'' (at least ``synchronize'') with
200    ## - - -   prMatrix() from ./Auxiliaries.R
201    prSpMatrix <- function(object, digits = getOption("digits"),
202                           maxp = getOption("max.print"), zero.print = ".")
203  {  {
204      stopifnot(is(object, "sparseMatrix"))      stopifnot(is(object, "sparseMatrix"))
205        d <- dim(x)
206        if(prod(d) > maxp) { # "Large" => will be "cut"
207            ## only coerce to dense that part which won't be cut :
208            nr <- maxp %/% d[2]
209            m <- as(object[1:max(1, nr), ,drop=FALSE], "Matrix")
210        } else {
211      m <- as(object, "matrix")      m <- as(object, "matrix")
212        }
213      logi <- is(object,"lsparseMatrix")      logi <- is(object,"lsparseMatrix")
214      if(logi)      if(logi)
215          x <- array(character(length(m)), dim(m), dimnames=dimnames(m))          x <- array(character(length(m)), dim(m), dimnames=dimnames(m))
# Line 233  Line 243 
243         cat(sprintf('%d x %d sparse Matrix of class "%s"\n', d[1], d[2], cl))         cat(sprintf('%d x %d sparse Matrix of class "%s"\n', d[1], d[2], cl))
244         maxp <- getOption("max.print")         maxp <- getOption("max.print")
245         if(prod(d) <= maxp)         if(prod(d) <= maxp)
246             prSpMatrix(object)             prSpMatrix(object, maxp = maxp)
247         else { ## d[1] > maxp / d[2] >= nr : -- this needs [,] working:         else { ## d[1] > maxp / d[2] >= nr : -- this needs [,] working:
248             nr <- maxp %/% d[2]             nr <- maxp %/% d[2]
249             n2 <- ceiling(nr / 2)             n2 <- ceiling(nr / 2)

Legend:
Removed from v.1388  
changed lines
  Added in v.1389

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