SCM Repository

[matrix] Diff of /pkg/R/Ops.R
 [matrix] / pkg / R / Ops.R

Diff of /pkg/R/Ops.R

revision 2004, Tue Jul 17 22:12:30 2007 UTC revision 2005, Wed Jul 18 14:46:20 2007 UTC
# Line 446  Line 446
446  ## Here's the common functionality  ## Here's the common functionality
447  .do.Logic.lsparse <- function(e1,e2, d, dn, isOR, ij1, ij2) {  .do.Logic.lsparse <- function(e1,e2, d, dn, isOR, ij1, ij2) {
448      ii <- WhichintersectInd(ij1, ij2, nrow=d[1])      ii <- WhichintersectInd(ij1, ij2, nrow=d[1])
449      I1 <- ii[[1]]      I1 <- ii[[1]] ; has1 <- length(I1) > 0
450      I2 <- ii[[2]]      I2 <- ii[[2]] ; has2 <- length(I2) > 0
451
452      ## 1) common indices      ## 1) common indices
453      i <- ij1[I1, 1]      i <- ij1[I1, 1]
# Line 455  Line 455
455
456      if(isOR) { ## i.e. .Generic == "|" i.e. not "&"      if(isOR) { ## i.e. .Generic == "|" i.e. not "&"
457          x <- e1@x[I1] | e2@x[I2]          x <- e1@x[I1] | e2@x[I2]
458
459          ## 2) "e1 o  FALSE":          ## 2) "e1 o  FALSE":
460          x2 <- e1@x[- I1] # == callGeneric(e1@x[- I1], FALSE)          x2 <- if(has1) e1@x[- I1] else e1@x # == callGeneric(e1@x[- I1], FALSE)
461          ## 3) "0  o e1":          ## 3) "0  o e1":
462          x3 <- e2@x[- I2] # == callGeneric(FALSE, e2@x[- I2])          x3 <- if(has2) e2@x[- I2] else e2@x # == callGeneric(FALSE, e2@x[- I2])
463          i <- c(i, ij1[-I1, 1], ij2[-I2, 1])          i <- c(i,
464          j <- c(j, ij1[-I1, 2], ij2[-I2, 2])                 if(has1) ij1[-I1, 1] else ij1[, 1],
465                   if(has2) ij2[-I2, 1] else ij2[, 1])
466            j <- c(j,
467                   if(has1) ij1[-I1, 2] else ij1[, 2],
468                   if(has2) ij2[-I2, 2] else ij2[, 2])
469          x <- c(x, x2,            x3)          x <- c(x, x2,            x3)
470      } else { ## AND      } else { ## AND
471          x <- e1@x[I1] & e2@x[I2]          x <- e1@x[I1] & e2@x[I2]

Legend:
 Removed from v.2004 changed lines Added in v.2005