input:b0011v0002p0013e0006-e0,1,2,k110,111,r0,1,8,amlsfw
     9ˆÍŽþ\efÄ)¤xÏÒ99ÑÀÎ  c    9# Depends: session
LoadModule session_cookie_module /usr/lib/apache2/modules/mod_session_cookie.so
  6   ;ˆl–ßi~”ji?u	Aà¸”Å£�þ]yÐ,ÙdyÒŒAŒ`óÓ„d2/ÒÁÏ ?÷     ;#### Tools for Package Testing --- in Matrix, sourced by ./test-tools.R
#### -------------------------

### ------- Part III --  "Matrix" (classes) specific ----------------------

## lower.tri() and upper.tri()  -- masking  base definitions
##	R/src/library/base/R/lower.tri.R
##	R/src/library/base/R/upper.tri.R
## but we do __not__ want to coerce to "base R" 'matrix' via as.matrix():
##
lower.tri <- function(x, diag = FALSE) if(diag) row(x) >= col(x) else row(x) > col(x)
upper.tri <- function(x, diag = FALSE) if(diag) row(x) <= col(x) else row(x) < col(x)

lsM <- function(...) {
    for(n in ls(..., envir=parent.frame()))
        if(is((. <- get(n)),"Matrix"))
            cat(sprintf("%5s: '%s' [%d x %d]\n",n,class(.), nrow(.),ncol(.)))
}

asD <- function(m) { ## as "Dense"
    if(canCoerce(m, "denseMatrix")) as(m, "denseMatrix")
    else if(canCoerce(m, (cl <- paste(.M.kind(m), "denseMatrix", sep=''))))
        as(m, cl)
    else if(canCoerce(m, "dgeMatrix")) as(m, "dgeMatrix")
    else stop("cannot coerce to a typical dense Matrix")
}

## "normal" sparse Matrix: Csparse, no diag="U"
asCsp <- function(x) diagU2N(as(x, "CsparseMatrix"))

##' @title quasi-identical dimnames
Qidentical.DN <- function(dx, dy) {

    stopifnot(is.list(dx) || is.null(dx),
	      is.list(dy) || is.null(dy))
    ## "empty"
    (is.null.DN(dx) && is.null.DN(dy)) || identical(dx, dy)
}

##' quasi-identical()  for 'Matrix' matrices
Qidentical <- function(x,y, strictClass = TRUE) {
    if(!identical(class(x), cy <- class(y))) {
        if(strictClass || !is(x, cy))
           return(FALSE)
        ## else try further
    }
    slts <- slotNames(x) ## MJ: should be slotNames(y), since is(x, class(y)) ??
    if("Dimnames" %in% slts) { ## always (or we have no 'Matrix')
	slts <- slts[slts != "Dimnames"]
	if(!Qidentical.DN(x@Dimnames, y@Dimnames) &&
	   ## allow for "completion" of (NULL, <names>) dimnames of symmetricMatrix:
	   !Qidentical.DN(dimnames(x), dimnames(y)))
	    return(FALSE)
    }
    if("factors" %in% slts) { ## allow one empty and one non-empty 'factors'
        slts <- slts[slts != "factors"]
        ## if both are not empty, they must be the same:
        if(length(xf <- x@factors) && length(yf <- y@factors))
            if(!identical(xf, yf)) return(FALSE)
    }
    for(sl in slts)
        if(!identical(slot(x,sl), slot(y,sl)))
            return(FALSE)
    TRUE
}

## MJ: It seems intuitive to allow either of is(x, class(y))
##     and is(y, class(x)) when strictClass=FALSE ...
.MJ.Qidentical <- function(x, y, strictClass = TRUE, skipSlots = NULL) {
    isxy <- identical(cx <- class(x), cy <- class(y))
    if (!isxy) {
        if (strictClass)
            return(FALSE)
        isxy <- is(x, cy)
        if (!(isxy || is(y, cx)))
            return(FALSE)
        ## else try further
    }
    slts <- slotNames(if (isxy) y else x)
    if (length(skipSlots))
        slts <- setdiff(slts, skipSlots)
    if ("Dimnames" %in% slts) { ## always, or we have no "Matrix"
	## allow symmetrization of 'Dimnames' for "symmetricMatrix" :
	slts <- slts[slts != "Dimnames"]
        if(!Qidentical.DN(x@Dimnames, y@Dimnames) &&
	   !Qidentical.DN(dimnames(x), dimnames(y)))
	    return(FALSE)
    }
    if ("factors" %in% slts) {
        ## allow one empty and one non-empty 'factors' :
        slts <- slts[slts != "factors"]
        ## if both are not empty, they must be the same:
        if (length(xf <- x@factors) && length(yf <- y@factors) &&
           !identical(xf, yf))
            return(FALSE)
    }
    for (slt in slts)
        if (!identical(slot(x, slt), slot(y, slt)))
            return(FALSE)
    TRUE
}

##' quasi-identical()  for traditional ('matrix') matrices
mQidentical <- function(x,y, strictClass = TRUE) {
    if(!identical(class(x), cy <- class(y))) {
        if(stri