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 1831, Fri Apr 27 13:38:19 2007 UTC revision 1832, Tue May 1 10:18:27 2007 UTC
# Line 78  Line 78 
78                lens <- unlist(lapply(eWts, length))                lens <- unlist(lapply(eWts, length))
79                i <- rep.int(0:(dm[1]-1), lens) # column indices (0-based)                i <- rep.int(0:(dm[1]-1), lens) # column indices (0-based)
80                To <- unlist(lapply(eWts, names))                To <- unlist(lapply(eWts, names))
81                j <- as.integer(match(To,nd) - 1:1) # row indices (0-based)                j <- as.integer(match(To,nd) - 1L) # row indices (0-based)
82                ## symm <- symm && <weights must also be symmetric>: improbable                ## symm <- symm && <weights must also be symmetric>: improbable
83                ## if(symm) new("dsTMatrix", .....) else                ## if(symm) new("dsTMatrix", .....) else
84                new("dgTMatrix", i = i, j = j, x = unlist(eWts),                new("dgTMatrix", i = i, j = j, x = unlist(eWts),
# Line 130  Line 130 
130          eMode <- "directed"          eMode <- "directed"
131      }      }
132      ## every edge is there only once, either upper or lower triangle      ## every edge is there only once, either upper or lower triangle
133      ft1 <- cbind(rn[from@i + 1:1], rn[from@j + 1:1])      ft1 <- cbind(rn[from@i + 1L], rn[from@j + 1L])
134      ## not yet: graph::ftM2graphNEL(.........)      ## not yet: graph::ftM2graphNEL(.........)
135      ftM2graphNEL(ft1, W = from@x, V= rn, edgemode= eMode)      ftM2graphNEL(ft1, W = from@x, V= rn, edgemode= eMode)
136    
# Line 242  Line 242 
242          ## show only "structural" zeros as 'zero.print', not all of them..          ## show only "structural" zeros as 'zero.print', not all of them..
243          ## -> cannot use 'm'          ## -> cannot use 'm'
244          d <- dim(x)          d <- dim(x)
245          ne <- length(iN0 <- 1:1 + encodeInd(non0ind(object, cl), nr = d[1]))          ne <- length(iN0 <- 1L + encodeInd(non0ind(object, cl), nr = d[1]))
246          if(0 < ne && ne < prod(d)) {          if(0 < ne && ne < prod(d)) {
247              align <- match.arg(align)              align <- match.arg(align)
248              if(align == "fancy") {              if(align == "fancy") {
# Line 250  Line 250 
250                  ## now 'format' the zero.print by padding it with ' ' on the right:                  ## now 'format' the zero.print by padding it with ' ' on the right:
251                  ## case 1: non-exponent:  fi[2,] + as.logical(fi[2,] > 0)                  ## case 1: non-exponent:  fi[2,] + as.logical(fi[2,] > 0)
252                  ## the column numbers of all 'zero' entries -- (*large*)                  ## the column numbers of all 'zero' entries -- (*large*)
253                  cols <- 1:1 + (0:(prod(d)-1:1))[-iN0] %/% d[1]                  cols <- 1L + (0:(prod(d)-1L))[-iN0] %/% d[1]
254                  pad <-                  pad <-
255                      ifelse(fi[3,] == 0,                      ifelse(fi[3,] == 0,
256                             fi[2,] + as.logical(fi[2,] > 0),                             fi[2,] + as.logical(fi[2,] > 0),

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

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