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 2096, Fri Dec 7 17:44:44 2007 UTC revision 2097, Sat Dec 8 13:36:13 2007 UTC
# Line 605  Line 605 
605          cols <- by[[2]]          cols <- by[[2]]
606          rl <- levels(rows)          rl <- levels(rows)
607          cl <- levels(cols)          cl <- levels(cols)
         ## FIXME?  y == 1 seems the most common case.  
         ##         Shouldn't we rather use a pattern matrix then ??  
608          if (is.null(y))          if (is.null(y))
609              y <- rep.int(1, length(rows))              y <- rep.int(1, length(rows))
         else if(!is.double(y))  
             y <- as.double(y)  
610          as(new("dgTMatrix",          as(new("dgTMatrix",
611                 i = as.integer(rows) - 1L,                 i = as.integer(rows) - 1L,
612                 j = as.integer(cols) - 1L,                 j = as.integer(cols) - 1L,
613                 x = y,                 x = as.double(y),
614                 Dim = c(length(rl), length(cl)),                 Dim = c(length(rl), length(cl)),
615                 Dimnames = list(rl, cl)), "CsparseMatrix")                 Dimnames = list(rl, cl)), "CsparseMatrix")
616      }      }

Legend:
Removed from v.2096  
changed lines
  Added in v.2097

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