Skip to content

Commit

Permalink
Merge c366be8 into c6a6b19
Browse files Browse the repository at this point in the history
  • Loading branch information
Dongcan-Jiang committed Aug 19, 2015
2 parents c6a6b19 + c366be8 commit f332a7c
Show file tree
Hide file tree
Showing 54 changed files with 2,197 additions and 369 deletions.
12 changes: 6 additions & 6 deletions R/rowCounts.R
Expand Up @@ -84,7 +84,7 @@ rowCounts <- function(x, rows=NULL, cols=NULL, value=TRUE, na.rm=FALSE, dim.=dim
if (is.numeric(x) || is.logical(x)) {
na.rm <- as.logical(na.rm)
hasNAs <- TRUE
counts <- .Call("rowCounts", x, dim., rows, cols, value, 2L, na.rm, hasNAs, PACKAGE="matrixStats")
counts <- .Call("rowCounts", x, dim., rows, cols, value, 2L, na.rm, hasNAs, mc.cores, PACKAGE="matrixStats")
} else {
if (is.vector(x)) dim(x) <- dim.

Expand Down Expand Up @@ -130,7 +130,7 @@ colCounts <- function(x, rows=NULL, cols=NULL, value=TRUE, na.rm=FALSE, dim.=dim
if (is.numeric(x) || is.logical(x)) {
na.rm <- as.logical(na.rm)
hasNAs <- TRUE
counts <- .Call("colCounts", x, dim., rows, cols, value, 2L, na.rm, hasNAs, PACKAGE="matrixStats")
counts <- .Call("colCounts", x, dim., rows, cols, value, 2L, na.rm, hasNAs, mc.cores, PACKAGE="matrixStats")
} else {
if (is.vector(x)) dim(x) <- dim.

Expand Down Expand Up @@ -193,7 +193,7 @@ rowAlls <- function(x, rows=NULL, cols=NULL, value=TRUE, na.rm=FALSE, dim.=dim(x
if (is.numeric(x) || is.logical(x)) {
na.rm <- as.logical(na.rm)
hasNAs <- TRUE
counts <- .Call("rowCounts", x, dim., rows, cols, value, 0L, na.rm, hasNAs, PACKAGE="matrixStats")
counts <- .Call("rowCounts", x, dim., rows, cols, value, 0L, na.rm, hasNAs, mc.cores, PACKAGE="matrixStats")
as.logical(counts)
} else {
if (is.vector(x)) dim(x) <- dim.
Expand All @@ -216,7 +216,7 @@ colAlls <- function(x, rows=NULL, cols=NULL, value=TRUE, na.rm=FALSE, dim.=dim(x
if (is.numeric(x) || is.logical(x)) {
na.rm <- as.logical(na.rm)
hasNAs <- TRUE
counts <- .Call("colCounts", x, dim., rows, cols, value, 0L, na.rm, hasNAs, PACKAGE="matrixStats")
counts <- .Call("colCounts", x, dim., rows, cols, value, 0L, na.rm, hasNAs, mc.cores, PACKAGE="matrixStats")
as.logical(counts)
} else {
if (is.vector(x)) dim(x) <- dim.
Expand Down Expand Up @@ -260,7 +260,7 @@ rowAnys <- function(x, rows=NULL, cols=NULL, value=TRUE, na.rm=FALSE, dim.=dim(x
if (is.numeric(x) || is.logical(x)) {
na.rm <- as.logical(na.rm)
hasNAs <- TRUE
counts <- .Call("rowCounts", x, dim., rows, cols, value, 1L, na.rm, hasNAs, PACKAGE="matrixStats")
counts <- .Call("rowCounts", x, dim., rows, cols, value, 1L, na.rm, hasNAs, mc.cores, PACKAGE="matrixStats")
as.logical(counts)
} else {
if (is.vector(x)) dim(x) <- dim.
Expand All @@ -283,7 +283,7 @@ colAnys <- function(x, rows=NULL, cols=NULL, value=TRUE, na.rm=FALSE, dim.=dim(x
if (is.numeric(x) || is.logical(x)) {
na.rm <- as.logical(na.rm)
hasNAs <- TRUE
counts <- .Call("colCounts", x, dim., rows, cols, value, 1L, na.rm, hasNAs, PACKAGE="matrixStats")
counts <- .Call("colCounts", x, dim., rows, cols, value, 1L, na.rm, hasNAs, mc.cores, PACKAGE="matrixStats")
as.logical(counts)
} else {
if (is.vector(x)) dim(x) <- dim.
Expand Down
16 changes: 8 additions & 8 deletions R/rowCumsums.R
Expand Up @@ -56,44 +56,44 @@
#*/###########################################################################
rowCumsums <- function(x, rows=NULL, cols=NULL, dim.=dim(x), mc.cores=1L, ...) {
dim <- as.integer(dim.);
.Call("rowCumsums", x, dim, rows, cols, TRUE, PACKAGE="matrixStats")
.Call("rowCumsums", x, dim, rows, cols, TRUE, mc.cores, PACKAGE="matrixStats")
}

colCumsums <- function(x, rows=NULL, cols=NULL, dim.=dim(x), mc.cores=1L, ...) {
dim <- as.integer(dim.);
.Call("rowCumsums", x, dim, rows, cols, FALSE, PACKAGE="matrixStats")
.Call("rowCumsums", x, dim, rows, cols, FALSE, mc.cores, PACKAGE="matrixStats")
}


rowCumprods <- function(x, rows=NULL, cols=NULL, dim.=dim(x), mc.cores=1L, ...) {
dim <- as.integer(dim.);
.Call("rowCumprods", x, dim, rows, cols, TRUE, PACKAGE="matrixStats")
.Call("rowCumprods", x, dim, rows, cols, TRUE, mc.cores, PACKAGE="matrixStats")
}

colCumprods <- function(x, rows=NULL, cols=NULL, dim.=dim(x), mc.cores=1L, ...) {
dim <- as.integer(dim.);
.Call("rowCumprods", x, dim, rows, cols, FALSE, PACKAGE="matrixStats")
.Call("rowCumprods", x, dim, rows, cols, FALSE, mc.cores, PACKAGE="matrixStats")
}


rowCummins <- function(x, rows=NULL, cols=NULL, dim.=dim(x), mc.cores=1L, ...) {
dim <- as.integer(dim.);
.Call("rowCummins", x, dim, rows, cols, TRUE, PACKAGE="matrixStats")
.Call("rowCummins", x, dim, rows, cols, TRUE, mc.cores, PACKAGE="matrixStats")
}

colCummins <- function(x, rows=NULL, cols=NULL, dim.=dim(x), mc.cores=1L, ...) {
dim <- as.integer(dim.);
.Call("rowCummins", x, dim, rows, cols, FALSE, PACKAGE="matrixStats")
.Call("rowCummins", x, dim, rows, cols, FALSE, mc.cores, PACKAGE="matrixStats")
}

rowCummaxs <- function(x, rows=NULL, cols=NULL, dim.=dim(x), mc.cores=1L, ...) {
dim <- as.integer(dim.);
.Call("rowCummaxs", x, dim, rows, cols, TRUE, PACKAGE="matrixStats")
.Call("rowCummaxs", x, dim, rows, cols, TRUE, mc.cores, PACKAGE="matrixStats")
}

colCummaxs <- function(x, rows=NULL, cols=NULL, dim.=dim(x), mc.cores=1L, ...) {
dim <- as.integer(dim.);
.Call("rowCummaxs", x, dim, rows, cols, FALSE, PACKAGE="matrixStats")
.Call("rowCummaxs", x, dim, rows, cols, FALSE, mc.cores, PACKAGE="matrixStats")
}


Expand Down
4 changes: 2 additions & 2 deletions R/rowDiffs.R
Expand Up @@ -42,11 +42,11 @@
# @keyword univar
#*/###########################################################################
rowDiffs <- function(x, rows=NULL, cols=NULL, lag=1L, differences=1L, mc.cores=1L, ...) {
.Call("rowDiffs", x, dim(x), rows, cols, as.integer(lag), as.integer(differences), TRUE, PACKAGE="matrixStats")
.Call("rowDiffs", x, dim(x), rows, cols, as.integer(lag), as.integer(differences), TRUE, mc.cores, PACKAGE="matrixStats")
}

colDiffs <- function(x, rows=NULL, cols=NULL, lag=1L, differences=1L, mc.cores=1L, ...) {
.Call("rowDiffs", x, dim(x), rows, cols, as.integer(lag), as.integer(differences), FALSE, PACKAGE="matrixStats")
.Call("rowDiffs", x, dim(x), rows, cols, as.integer(lag), as.integer(differences), FALSE, mc.cores, PACKAGE="matrixStats")
}


Expand Down
4 changes: 2 additions & 2 deletions R/rowLogSumExps.R
Expand Up @@ -53,7 +53,7 @@ rowLogSumExps <- function(lx, rows=NULL, cols=NULL, na.rm=FALSE, dim.=dim(lx), m
hasNA <- TRUE;
res <- .Call("rowLogSumExps",
lx, dim., rows, cols,
as.logical(na.rm), as.logical(hasNA), TRUE,
as.logical(na.rm), as.logical(hasNA), TRUE, mc.cores,
PACKAGE="matrixStats");

# Preserve names
Expand All @@ -71,7 +71,7 @@ colLogSumExps <- function(lx, rows=NULL, cols=NULL, na.rm=FALSE, dim.=dim(lx), m
hasNA <- TRUE;
res <- .Call("rowLogSumExps",
lx, dim., rows, cols,
as.logical(na.rm), as.logical(hasNA), FALSE,
as.logical(na.rm), as.logical(hasNA), FALSE, mc.cores,
PACKAGE="matrixStats");

# Preserve names
Expand Down
8 changes: 4 additions & 4 deletions R/rowMads.R
Expand Up @@ -12,7 +12,7 @@ rowMads <- function(x, rows=NULL, cols=NULL, center=NULL, constant=1.4826, na.rm
na.rm <- as.logical(na.rm)
constant = as.numeric(constant)
hasNAs <- TRUE
x <- .Call("rowMads", x, dim., rows, cols, constant, na.rm, hasNAs, TRUE, PACKAGE="matrixStats")
x <- .Call("rowMads", x, dim., rows, cols, constant, na.rm, hasNAs, TRUE, mc.cores, PACKAGE="matrixStats")
} else {
# Apply subset on 'x'
if (is.vector(x)) dim(x) <- dim.
Expand All @@ -27,7 +27,7 @@ rowMads <- function(x, rows=NULL, cols=NULL, center=NULL, constant=1.4826, na.rm
x <- x - center
if (is.null(dim(x))) dim(x) <- dim. # prevent from dim dropping
x <- abs(x)
x <- rowMedians(x, na.rm=na.rm, ...)
x <- rowMedians(x, na.rm=na.rm, mc.cores=mc.cores, ...)
x <- constant*x
}
x
Expand All @@ -48,7 +48,7 @@ colMads <- function(x, rows=NULL, cols=NULL, center=NULL, constant=1.4826, na.rm
na.rm <- as.logical(na.rm)
constant = as.numeric(constant)
hasNAs <- TRUE
x <- .Call("rowMads", x, dim., rows, cols, constant, na.rm, hasNAs, FALSE, PACKAGE="matrixStats")
x <- .Call("rowMads", x, dim., rows, cols, constant, na.rm, hasNAs, FALSE, mc.cores, PACKAGE="matrixStats")
} else {
# Apply subset on 'x'
if (is.vector(x)) dim(x) <- dim.
Expand All @@ -67,7 +67,7 @@ colMads <- function(x, rows=NULL, cols=NULL, center=NULL, constant=1.4826, na.rm
## FAST:
x <- t_tx_OP_y(x, center, OP="-", na.rm=FALSE)
x <- abs(x)
x <- colMedians(x, na.rm=na.rm, ...)
x <- colMedians(x, na.rm=na.rm, mc.cores=mc.cores, ...)
x <- constant*x
}
x
Expand Down
4 changes: 2 additions & 2 deletions R/rowMedians.S4.R
Expand Up @@ -63,7 +63,7 @@ setMethod("rowMedians", signature(x="matrix"), function(x, rows=NULL, cols=NULL,
na.rm <- as.logical(na.rm);
hasNAs <- TRUE; # Add as an argument? /2007-08-24

.Call("rowMedians", x, dim., rows, cols, na.rm, hasNAs, TRUE, PACKAGE="matrixStats");
.Call("rowMedians", x, dim., rows, cols, na.rm, hasNAs, TRUE, mc.cores, PACKAGE="matrixStats");
})


Expand All @@ -76,7 +76,7 @@ setMethod("colMedians", signature(x="matrix"), function(x, rows=NULL, cols=NULL,
na.rm <- as.logical(na.rm);
hasNAs <- TRUE; # Add as an argument? /2007-08-24

.Call("rowMedians", x, dim., rows, cols, na.rm, hasNAs, FALSE, PACKAGE="matrixStats");
.Call("rowMedians", x, dim., rows, cols, na.rm, hasNAs, FALSE, mc.cores, PACKAGE="matrixStats");
})


Expand Down
4 changes: 2 additions & 2 deletions R/rowOrderStats.R
Expand Up @@ -67,7 +67,7 @@ rowOrderStats <- function(x, rows=NULL, cols=NULL, which, dim.=dim(x), mc.cores=
}

which <- as.integer(which)
.Call("rowOrderStats", x, dim., rows, cols, which, PACKAGE="matrixStats");
.Call("rowOrderStats", x, dim., rows, cols, which, mc.cores, PACKAGE="matrixStats");
}


Expand All @@ -80,7 +80,7 @@ colOrderStats <- function(x, rows=NULL, cols=NULL, which, dim.=dim(x), mc.cores=
}

which <- as.integer(which)
.Call("colOrderStats", x, dim., rows, cols, which, PACKAGE="matrixStats");
.Call("colOrderStats", x, dim., rows, cols, which, mc.cores, PACKAGE="matrixStats");
}


Expand Down
12 changes: 6 additions & 6 deletions R/rowRanges.R
Expand Up @@ -57,38 +57,38 @@
rowRanges <- function(x, rows=NULL, cols=NULL, na.rm=FALSE, dim.=dim(x), mc.cores=1L, ...) {
dim. <- as.integer(dim.)
na.rm <- as.logical(na.rm)
.Call("rowRanges", x, dim., rows, cols, 2L, na.rm, TRUE, PACKAGE="matrixStats")
.Call("rowRanges", x, dim., rows, cols, 2L, na.rm, TRUE, mc.cores, PACKAGE="matrixStats")
}

rowMins <- function(x, rows=NULL, cols=NULL, na.rm=FALSE, dim.=dim(x), mc.cores=1L, ...) {
dim. <- as.integer(dim.)
na.rm <- as.logical(na.rm)
.Call("rowRanges", x, dim., rows, cols, 0L, na.rm, TRUE, PACKAGE="matrixStats")
.Call("rowRanges", x, dim., rows, cols, 0L, na.rm, TRUE, mc.cores, PACKAGE="matrixStats")
}

rowMaxs <- function(x, rows=NULL, cols=NULL, na.rm=FALSE, dim.=dim(x), mc.cores=1L, ...) {
dim. <- as.integer(dim.)
na.rm <- as.logical(na.rm)
.Call("rowRanges", x, dim., rows, cols, 1L, na.rm, TRUE, PACKAGE="matrixStats")
.Call("rowRanges", x, dim., rows, cols, 1L, na.rm, TRUE, mc.cores, PACKAGE="matrixStats")
}


colRanges <- function(x, rows=NULL, cols=NULL, na.rm=FALSE, dim.=dim(x), mc.cores=1L, ...) {
dim. <- as.integer(dim.)
na.rm <- as.logical(na.rm)
.Call("colRanges", x, dim., rows, cols, 2L, na.rm, TRUE, PACKAGE="matrixStats")
.Call("colRanges", x, dim., rows, cols, 2L, na.rm, TRUE, mc.cores, PACKAGE="matrixStats")
}

colMins <- function(x, rows=NULL, cols=NULL, na.rm=FALSE, dim.=dim(x), mc.cores=1L, ...) {
dim. <- as.integer(dim.)
na.rm <- as.logical(na.rm)
.Call("colRanges", x, dim., rows, cols, 0L, na.rm, TRUE, PACKAGE="matrixStats")
.Call("colRanges", x, dim., rows, cols, 0L, na.rm, TRUE, mc.cores, PACKAGE="matrixStats")
}

colMaxs <- function(x, rows=NULL, cols=NULL, na.rm=FALSE, dim.=dim(x), mc.cores=1L, ...) {
dim. <- as.integer(dim.)
na.rm <- as.logical(na.rm)
.Call("colRanges", x, dim., rows, cols, 1L, na.rm, TRUE, PACKAGE="matrixStats")
.Call("colRanges", x, dim., rows, cols, 1L, na.rm, TRUE, mc.cores, PACKAGE="matrixStats")
}


Expand Down
4 changes: 2 additions & 2 deletions R/rowRanks.R
Expand Up @@ -111,7 +111,7 @@ rowRanks <- function(x, rows=NULL, cols=NULL, ties.method=c("max", "average", "m

dim. <- as.integer(dim.)
# byrow=TRUE
.Call("rowRanksWithTies", x, dim., rows, cols, tiesMethod, TRUE, PACKAGE="matrixStats")
.Call("rowRanksWithTies", x, dim., rows, cols, tiesMethod, TRUE, mc.cores, PACKAGE="matrixStats")
}


Expand All @@ -133,7 +133,7 @@ colRanks <- function(x, rows=NULL, cols=NULL, ties.method=c("max", "average", "m

dim. <- as.integer(dim.)
# byrow=FALSE
y <- .Call("rowRanksWithTies", x, dim., rows, cols, tiesMethod, FALSE, PACKAGE="matrixStats")
y <- .Call("rowRanksWithTies", x, dim., rows, cols, tiesMethod, FALSE, mc.cores, PACKAGE="matrixStats")
if (!preserveShape) y <- t(y)
y
}
Expand Down
4 changes: 2 additions & 2 deletions R/rowVars.R
Expand Up @@ -53,7 +53,7 @@ rowVars <- function(x, rows=NULL, cols=NULL, na.rm=FALSE, center=NULL, dim.=dim(
if (is.null(center)) {
na.rm <- as.logical(na.rm)
hasNAs <- TRUE
sigma2 <- .Call("rowVars", x, dim., rows, cols, na.rm, hasNAs, TRUE, PACKAGE="matrixStats");
sigma2 <- .Call("rowVars", x, dim., rows, cols, na.rm, hasNAs, TRUE, mc.cores, PACKAGE="matrixStats");
return(sigma2)
}

Expand Down Expand Up @@ -112,7 +112,7 @@ colVars <- function(x, rows=NULL, cols=NULL, na.rm=FALSE, center=NULL, dim.=dim(
dim. <- as.integer(dim.)
na.rm <- as.logical(na.rm)
hasNAs <- TRUE
sigma2 <- .Call("rowVars", x, dim., rows, cols, na.rm, hasNAs, FALSE, PACKAGE="matrixStats");
sigma2 <- .Call("rowVars", x, dim., rows, cols, na.rm, hasNAs, FALSE, mc.cores, PACKAGE="matrixStats");
return(sigma2)
}

Expand Down
2 changes: 1 addition & 1 deletion inst/benchmarking/colRowCummins_parallel.md.rsp
Expand Up @@ -23,7 +23,7 @@ This report benchmark the performance of <%=colname%>() and <%=rowname%>() on mu
```r
<%=withCapture({
<%@include file="R/random-matrices.R"%>
data <- rmatrices(mode=mode)
data <- rmatrices(mode=mode, scale=20)
})%>
```

Expand Down
2 changes: 1 addition & 1 deletion inst/benchmarking/colRowCumprods_parallel.md.rsp
Expand Up @@ -23,7 +23,7 @@ This report benchmark the performance of <%=colname%>() and <%=rowname%>() on mu
```r
<%=withCapture({
<%@include file="R/random-matrices.R"%>
data <- rmatrices(mode=mode, range=c(-1,1))
data <- rmatrices(mode=mode, range=c(-1,1), scale=20)
})%>
```

Expand Down
2 changes: 1 addition & 1 deletion inst/benchmarking/colRowCumsums_parallel.md.rsp
Expand Up @@ -23,7 +23,7 @@ This report benchmark the performance of <%=colname%>() and <%=rowname%>() on mu
```r
<%=withCapture({
<%@include file="R/random-matrices.R"%>
data <- rmatrices(mode=mode)
data <- rmatrices(mode=mode, scale=20)
})%>
```

Expand Down
2 changes: 2 additions & 0 deletions src/Makevars
@@ -0,0 +1,2 @@
PKG_CFLAGS=-pthread
PKG_LIBS=-pthread

0 comments on commit f332a7c

Please sign in to comment.