<%@include file="includes/setup.md.rsp"%>

<%@string colname="colOrderStats"%>
<%@string rowname="rowOrderStats"%>
<%@meta title="${colname}() and ${rowname}() benchmarks"%>
<%@meta author="Henrik Bengtsson"%>
<%@meta date="2014-06-09"%>

<%@include file="${header}"%>

<%
use("Biobase", how = "load")
rowQ <- Biobase::rowQ
%>

# <%@meta name="title"%>

This report benchmark the performance of <%=colname%>() and <%=rowname%>() against alternative methods.

## Alternative methods

* apply() + quantile(..., type = 3L)
* Biobase::rowQ()

<% for (mode in c("integer", "double")) { %>

## Data type "<%=mode%>"

### Data
```r
<%=withCapture({
<%@include file="R/random-matrices.R"%>
data <- rmatrices(mode = mode)
})%>
```

### Results

<% for (dataLabel in names(data)) { %>
<% mprintf("%s: %s\n", mode, dataLabel)  %>
#### <%=dataLabel%> <%=mode%> matrix


```r
<%=withCapture({
X <- data[[.dataLabel.]]
gc()

probs <- 0.3
which <- round(probs*nrow(X))

colStats <- microbenchmark(
 colOrderStats    = colOrderStats(X, which = which, na.rm = FALSE),
 "apply+quantile" = apply(X, MARGIN = 2L, FUN = quantile, probs = probs, na.rm = FALSE, type = 3L),
 "rowQ(t(X))"     = rowQ(t(X), which = which),
 unit = "ms"
)

X <- t(X)
gc()

rowStats <- microbenchmark(
 rowOrderStats    = rowOrderStats(X, which = which, na.rm = FALSE),
 "apply+quantile" = apply(X, MARGIN = 1L, FUN = quantile, probs = probs, na.rm = FALSE, type = 3L),
 rowQ             = rowQ(X, which = which),
 unit = "ms"
)
})%>
```


<% crBenchmarkResults(colStats, rowStats, tags=c(mode, dataLabel)) %>

<% } # for (dataLabel ...) %>

<% } # for (mode ...) %>


<%@include file="${footer}"%>


<%---------------------------------------------------------------------------
HISTORY:
2014-06-09
o Created.
---------------------------------------------------------------------------%>
