CircosHeatmap-aardio/dist/lib/r-library/matrixStats/benchmarking/colRowWeightedMedians_subset.md.rsp

76 lines
2.0 KiB
Plaintext
Raw Permalink Normal View History

2025-01-12 00:52:51 +08:00
<%@include file="includes/setup.md.rsp"%>
<%@string colname="colWeightedMedians"%>
<%@string rowname="rowWeightedMedians"%>
<%@string fcnname="colRowWeightedMedians_subset"%>
<%@meta title="${colname}() and ${rowname}() benchmarks on subsetted computation"%>
<%@meta author="Dongcan Jiang"%>
<%@meta date="2015-06-07"%>
<%@include file="${header}"%>
# <%@meta name="title"%>
This report benchmark the performance of <%=colname%>() and <%=rowname%> on subsetted computation.
## Data
```r
<%=withCapture({
<%@include file="R/random-matrices.R"%>
data <- rmatrices(mode = "double")
})%>
```
## Results
<% for (dataLabel in names(data)) { %>
<% message(dataLabel) %>
### <%=dataLabel%> matrix
```r
<%=withCapture({
X <- data[[.dataLabel.]]
rows <- sample.int(nrow(X), size = nrow(X)*0.7)
cols <- sample.int(ncol(X), size = ncol(X)*0.7)
X_S <- X[rows, cols]
w <- runif(nrow(X))
w_S <- w[rows]
gc()
colStats <- microbenchmark(
"colWeightedMedians_X_w_S" = colWeightedMedians(X_S, w = w_S, na.rm = FALSE),
"colWeightedMedians(X, w, rows, cols)" = colWeightedMedians(X, w = w, rows = rows, cols = cols, na.rm = FALSE),
"colWeightedMedians(X[rows, cols], w[rows])" = colWeightedMedians(X[rows, cols], w = w[rows], na.rm = FALSE),
unit = "ms"
)
X <- t(X)
X_S <- t(X_S)
gc()
rowStats <- microbenchmark(
"rowWeightedMedians_X_w_S" = rowWeightedMedians(X_S, w = w_S, na.rm = FALSE),
"rowWeightedMedians(X, w, cols, rows)" = rowWeightedMedians(X, w = w, rows = cols, cols = rows, na.rm = FALSE),
"rowWeightedMedians(X[cols, rows], w[rows])" = rowWeightedMedians(X[cols, rows], w = w[rows], na.rm = FALSE),
unit = "ms"
)
})%>
```
<% crBenchmarkResults(colStats, rowStats, tags=dataLabel) %>
<% } # for (dataLabel ...) %>
<%@include file="${footer}"%>
<%---------------------------------------------------------------------------
HISTORY:
2015-06-07
o Created.
---------------------------------------------------------------------------%>