Commit c73c50d7 authored by Andreas Tille's avatar Andreas Tille

New upstream version 0.54.0

parent 0a4cd21a
Package: matrixStats
Version: 0.53.1
Version: 0.54.0
Depends: R (>= 2.12.0)
Suggests: base64enc, ggplot2, knitr, microbenchmark, R.devices, R.rsp
VignetteBuilder: R.rsp
Date: 2018-02-10
Date: 2018-07-23
Title: Functions that Apply to Rows and Columns of Matrices (and to
Vectors)
Authors@R: c(
......@@ -33,6 +33,6 @@ ByteCompile: TRUE
URL: https://github.com/HenrikBengtsson/matrixStats
BugReports: https://github.com/HenrikBengtsson/matrixStats/issues
RoxygenNote: 6.0.1
Packaged: 2018-02-10 18:37:02 UTC; hb
Packaged: 2018-07-23 15:25:55 UTC; hb
Repository: CRAN
Date/Publication: 2018-02-11 14:13:37 UTC
Date/Publication: 2018-07-23 20:40:03 UTC
dc66357a7430e06583e99e8c7ea4a2f4 *DESCRIPTION
d394495d98b35ca53b138b09a95d0054 *DESCRIPTION
0860c5907218fd3eaaac3596f889e9fc *NAMESPACE
56721099f2eaef026c164b2a51978ead *NEWS
ac1b86eeb0d1bd350df927646e637578 *NEWS
bb69907c26b811fcf67fddc0e9cd5b77 *R/999.package.R
296714ec26d22f17205463b167513f57 *R/allocMatrix.R
3f3bfbff10973a98681c2d5334247d9e *R/anyMissing.R
......@@ -8,19 +8,19 @@ bb69907c26b811fcf67fddc0e9cd5b77 *R/999.package.R
8366f88bc87c53275c02800bcc0d1aed *R/binCounts.R
be19b8d621dbc4aebce9bef90067bc8b *R/binMeans.R
afb42867c388669ecfc39176c85ab892 *R/diff2.R
943215e43792a896063d5d81e45a9b03 *R/indexByRow.R
f6501f9da9cc748ad855962101e70838 *R/indexByRow.R
f806d6fb67d3c09166ffc1f3e7c70718 *R/logSumExp.R
e81adc26f01ce1e1eed2ed130ee87860 *R/mean2.R
53451895bb9b2462bc6f658234faa87f *R/product.R
9da47eff39df6e33896014f79961fd5c *R/psortKM.R
c85ad3b36eee48b65bf517b9ce465518 *R/rowAlls.R
55064e17042560097b9edc3335da8a57 *R/rowAvgsPerColSet.R
2ef2d139fc847362782e40618b2f3586 *R/rowAvgsPerColSet.R
361e6909f7f29b3fde8060fa7606559e *R/rowCollapse.R
082523b162d40015719d309ad609bcde *R/rowCounts.R
28fabe529a791811487b652730308b30 *R/rowCumsums.R
95709136f527104e4d1fb4b7b98855f8 *R/rowDiffs.R
82011349711cab2880b651e3ee2b75cb *R/rowIQRs.R
21f9f5c0bae8d4f27d8faeec3f5d6063 *R/rowLogSumExps.R
a60d4bd44a865ec6fc962cdff6cfd567 *R/rowLogSumExps.R
31649f495bef8ba79ccee806f0957067 *R/rowMads.R
4c82ea7c96b03cac38f337dc36328b13 *R/rowMeans2.R
a9a8e7f6d5d122d375f645a4a29d3399 *R/rowMedians.R
......@@ -39,13 +39,13 @@ c84c74a047a3cf68afca42115b53fa29 *R/rowOrderStats.R
e5a8f3cd52495e2bd8408c89f9aec26d *R/sum2.R
ede21e545df3630a5060a50834c771b9 *R/validateIndices.R
488df0d43d67541e76dce16ab582b01a *R/varDiff.R
ff531f9d6b666d2b7b254a338b0d6de8 *R/weightedMad.R
56a042c706f2b232f91574de88019f22 *R/weightedMad.R
2e40f98c029a2763107ffcb525227529 *R/weightedMean.R
390243eb36dfe25b177ac81706904ba8 *R/weightedMedian.R
03fb6331d3df904131ea21d1bf068422 *R/weightedVar.R
053575f62c3d90e4687e560704e1503c *R/x_OP_y.R
160766a2b16a35e66266243ff5d377b7 *R/x_OP_y.R
2cd96f266da6085b411ef32fd98c1f3c *R/zzz.R
53a00839ced39e5411d2ac7fe7ad77ab *build/vignette.rds
c0e158f737394b2ff5ee45d0818cd83c *build/vignette.rds
ca773a01fc2df607bef2bf6ee72f01fb *inst/benchmarking/R/random-matrices.R
68d9d75e6b36f6bd61569553be4cb133 *inst/benchmarking/R/random-vectors.R
e00cf911d14b0c6bc13bb17b3dd62f1e *inst/benchmarking/allocMatrix.md.rsp
......@@ -132,7 +132,7 @@ e8c65eec84796fa104ebd81eaf06baee *inst/benchmarking/varDiff.md.rsp
fa6e9a4a08145bce053c6e4d774e81a0 *inst/benchmarking/weightedMedian_subset.md.rsp
e68f83709396b851d7c53e36561ed6de *inst/benchmarking/x_OP_y.md.rsp
2dd5fa9d134fc7d05ded89f7d458b1eb *inst/benchmarking/x_OP_y_subset.md.rsp
65d13df58155193bb0a41f81425548ad *inst/doc/matrixStats-methods.html
51b7228986983b8185514d8c1131b5cc *inst/doc/matrixStats-methods.html
d25f82a3b8a66d1f375186fdd85e4850 *inst/doc/matrixStats-methods.md.rsp
e40a52ef7ac5f8e61a5e474786e5b01c *man/allocMatrix.Rd
5896d31d7eddfcbc1edda46e6e89bce4 *man/anyMissing.Rd
......@@ -144,7 +144,7 @@ e40a52ef7ac5f8e61a5e474786e5b01c *man/allocMatrix.Rd
d43c64f9b7c712624975ec95c1f35da8 *man/matrixStats-package.Rd
f486a8cac7eae60e97d30ff59bed0ae7 *man/mean2.Rd
400a1e00af2244a1d57c843c961f75fb *man/rowAlls.Rd
b5bcebc5399f3607dad7bc23dfca4d8c *man/rowAvgsPerColSet.Rd
1a8a3f2108698a13aaae51c058cab94e *man/rowAvgsPerColSet.Rd
c4476f9b8a39f4a436df9f5aad6b87c7 *man/rowCollapse.Rd
24ad887edb3a7471d48917a25a55d188 *man/rowCounts.Rd
3a20c97c5e66ffe5a00227cbf5023394 *man/rowCumsums.Rd
......@@ -184,7 +184,7 @@ e2b8d03a0e4cf42fc466359edfe4bf99 *src/000.templates-types.h
1fe96f23b52c292f78943b4980eb0f33 *src/000.types.h
7b8dc4193e3116e4428c16652b6341e0 *src/000.utils.h
4a1670c8cdf053e2aa559aac01864474 *src/allocMatrix2.c
feaf7b52dd205961cdc11947499b97d4 *src/anyMissing.c
462c441b412cdf20ba9182e99d014e07 *src/anyMissing.c
4eb9ab0b4af9231d3de551ca465fc6b4 *src/anyMissing_lowlevel.h
5b43b1f7fe64490e3cf90cdc167b5fdd *src/anyMissing_lowlevel_template.h
ec1fbc1b0025fafa1689bf21ed262ecd *src/binCounts.c
......@@ -205,7 +205,7 @@ e5ffd3aa0456ba7ac35be017df6c1960 *src/colOrderStats.c
36578c07bc7fb2697b0b5b37a15d9edc *src/diff2.c
fb3691e79f19c6b0f2c7dcd3cb24adf5 *src/diff2_lowlevel.h
0972de162530a040555498b86fcd6df4 *src/diff2_lowlevel_template.h
4cac5ca1479c8a1d9c92c4bc1470a056 *src/indexByRow.c
4783c46060dfdb4fab065a1c9128e6cb *src/indexByRow.c
5aa728b09ce4fbf00a5b54f723d0fb4b *src/logSumExp.c
fd9f1169008b8115b7901b8cf44ffe81 *src/logSumExp_lowlevel.h
dd32ebb1098c476c9ac62974cd79fd29 *src/logSumExp_lowlevel_template.h
......@@ -263,9 +263,9 @@ e65baec883f6e898f0fd157ad6c5039b *src/rowVars_lowlevel_template.h
2f8d156e3f352b59db5d7c00fc2a6ea0 *src/signTabulate.c
da58ad2d03e917231e5060319c0b392c *src/signTabulate_lowlevel.h
4845618a2ddf46bf74fe066c6a475339 *src/signTabulate_lowlevel_template.h
a67a993b145787e5e80aa0a6602a51c9 *src/sum2.c
5deaa6c94bce18eddbcd336abc5e8d5e *src/sum2_lowlevel.h
8805f536183ae344eb05f0286631f531 *src/sum2_lowlevel_template.h
b3f9c52c2a3fb4454409aea3a18f1e5b *src/sum2.c
f11094d4af3942c7b82111516f48f19a *src/sum2_lowlevel.h
640f30823f53a570f4fd3a5688fb4bb3 *src/sum2_lowlevel_template.h
06c93480c72b701559f8621771a257a6 *src/validateIndices.c
be32addec5f914e6e88fdb01414b9659 *src/validateIndices_lowlevel.h
48d14b9aea19af04b23b9a436bc2194a *src/validateIndices_lowlevel_template.h
......@@ -275,7 +275,7 @@ a12bb18df07b05587cad3e8131a31e24 *src/weightedMean_lowlevel_template.h
05677d6b26c4de2aabd9bac2f5a2424f *src/weightedMedian.c
11e34736452f92775d24719094659ae4 *src/weightedMedian_lowlevel.h
a9478242c639d869a6c98b7b03b7f3f8 *src/weightedMedian_lowlevel_template.h
536a4eddd5d389a2f37cac3702381be7 *src/x_OP_y.c
6b1e17dd42b58e353ed32143315b77bb *src/x_OP_y.c
5227137bc874290ef86b5d1b7e2878c2 *src/x_OP_y_lowlevel.h
ded428cafc1ea29e648f78a70297e459 *src/x_OP_y_lowlevel_template.h
8a7346f77a61c642a27791fa78ff9bb8 *tests/allocArray.R
......@@ -292,7 +292,7 @@ e0b1c88a59eaf59571a6af74d26b55d8 *tests/binMeans,binCounts_subset.R
880706ea6c5cfc1d213df9ee5b758211 *tests/count_subset.R
5ed1b8bee9180c536393aa76f41d6914 *tests/diff2.R
1e614439e55c47e345637000600b32e3 *tests/diff2_subset.R
7d4506bef090c4863347a44b74314e3b *tests/indexByRow.R
f72b9b724562ba65190b70d54902677e *tests/indexByRow.R
3367c853594ca5ff2cb145a7b4ba9670 *tests/logSumExp.R
4c911012825f2d15f5d8abd1abc411fb *tests/logSumExp_subset.R
fce01b3f6f8df6a752cf878a26d8a276 *tests/mean2.R
......
Package: matrixStats
====================
Version: 0.54.0 [2018-07-23]
PERFORMANCE:
o SPEEDUP: No longer using stopifnot() for internal validation, because
it comes with a great overhead. This was only used in weightedMad(),
col-, and rowWeightedMads(), as well as col- and rowAvgsPerColSet().
BUG FIXES:
o Despite being an unlikely use case, colLogSumExps(lx) / rowLogSumExps(lx)
now also accepts integer 'lx' values.
o The error produced when using indexByRow(dim) with prod(dim) >= 2^31 would
report garbage dimensions instead of 'dim'.
DEPRECATED AND DEFUNCT:
o Calling indexByRow(x) where 'x' is a matrix is deprecated. Use
indexByRow(dim(x)) instead.
Version: 0.53.1 [2018-02-10]
CODE REFACTORING:
......
......@@ -28,8 +28,7 @@
#' @export
indexByRow <- function(dim, idxs = NULL, ...) {
if (is.matrix(dim)) {
# BACKWARD COMPATIBILITY: Keep for a while, but deprecate
# in the future.
.Deprecated(msg = "indexByRow(x) where 'x' is a matrix is deprecated. Use indexByRow(dim(x)) instead.")
dim <- dim(dim)
} else {
dim <- as.integer(dim)
......
......@@ -7,7 +7,7 @@
#'
#' If argument \code{S} is a single column vector with indices \code{1:N}, then
#' \code{rowAvgsPerColSet(X, S = S, FUN = rowMeans)} gives the same result as
#' \code{rowMeans(X)}. Analogously, for \code{rowAvgsPerColSet()}.
#' \code{rowMeans(X)}. Analogously, for \code{colAvgsPerRowSet()}.
#'
#' @param X A \code{\link[base]{numeric}} NxM \code{\link[base]{matrix}}.
#'
......@@ -122,7 +122,7 @@ rowAvgsPerColSet <- function(X, W = NULL, rows = NULL, S,
}
# Sanity check
stopifnot(length(Zjj) == dimX[1L])
if (length(Zjj) != dimX[1L]) stop("Internal error: length(Zjj) != dimX[1L]")
# Return set average
Zjj
......@@ -131,12 +131,13 @@ rowAvgsPerColSet <- function(X, W = NULL, rows = NULL, S,
# apply() drops 2nd dimension if nrow(X) <= 1 (and FUN returns a vector of
# length nrow(X) as it should), cf. ?apply
if (!is.matrix(Z)) {
stopifnot(dimX[1] <= 1L)
if (dimX[1] > 1L) stop("Internal error: dimX[1] > 1L")
dim(Z) <- c(length(Z), nbrOfSets)
}
# Sanity check
stopifnot(dim(Z) == c(dimX[1L], nbrOfSets))
if (any(dim(Z) != c(dimX[1L], nbrOfSets)))
stop("Internal error: dim(Z) != c(dimX[1L], nbrOfSets)")
# Set names
rownames(Z) <- rownamesX
......
......@@ -40,7 +40,8 @@ rowLogSumExps <- function(lx, rows = NULL, cols = NULL, na.rm = FALSE,
dim. <- as.integer(dim.)
has_na <- TRUE
res <- .Call(C_rowLogSumExps,
lx, dim., rows, cols, as.logical(na.rm), has_na, TRUE)
as.numeric(lx),
dim., rows, cols, as.logical(na.rm), has_na, TRUE)
# Preserve names
names <- rownames(lx)
......@@ -62,7 +63,8 @@ colLogSumExps <- function(lx, rows = NULL, cols = NULL, na.rm = FALSE,
dim. <- as.integer(dim.)
has_na <- TRUE
res <- .Call(C_rowLogSumExps,
lx, dim., rows, cols, as.logical(na.rm), has_na, FALSE)
as.numeric(lx),
dim., rows, cols, as.logical(na.rm), has_na, FALSE)
# Preserve names
names <- colnames(lx)
......
......@@ -64,10 +64,12 @@ weightedMad <- function(x, w = NULL, idxs = NULL, na.rm = FALSE,
}
# Argument 'constant':
stopifnot(length(constant) == 1L, is.numeric(constant))
if (length(constant) != 1L || !is.numeric(constant))
stop("Argument 'constant' must be a numeric scalar")
# Argument 'center':
stopifnot(length(center) <= 1L)
if (length(center) > 1L)
stop("Argument 'center' must be a scalar or NULL")
# Apply subset on x
......@@ -148,10 +150,12 @@ rowWeightedMads <- function(x, w = NULL, rows = NULL, cols = NULL,
na.rm = FALSE,
constant = 1.4826, center = NULL, ...) {
# Argument 'constant':
stopifnot(length(constant) == 1L, is.numeric(constant))
if (length(constant) != 1L || !is.numeric(constant))
stop("Argument 'constant' must be a numeric scalar")
# Argument 'center':
stopifnot(length(center) <= 1L)
if (length(center) > 1L)
stop("Argument 'center' must be a scalar or NULL")
# Apply subset on x
if (!is.null(rows) && !is.null(cols)) x <- x[rows, cols, drop = FALSE]
......@@ -172,10 +176,12 @@ colWeightedMads <- function(x, w = NULL, rows = NULL, cols = NULL,
na.rm = FALSE,
constant = 1.4826, center = NULL, ...) {
# Argument 'constant':
stopifnot(length(constant) == 1L, is.numeric(constant))
if (length(constant) != 1L || !is.numeric(constant))
stop("Argument 'constant' must be a numeric scalar")
# Argument 'center':
stopifnot(length(center) <= 1L)
if (length(center) > 1L)
stop("Argument 'center' must be a scalar or NULL")
# Apply subset on x
if (!is.null(rows) && !is.null(cols)) x <- x[rows, cols, drop = FALSE]
......
......@@ -47,8 +47,12 @@ x_OP_y <- function(x, y, OP, xrows = NULL, xcols = NULL, yidxs = NULL,
commute = FALSE, na.rm = FALSE) {
commute <- as.logical(commute)
na.rm <- as.logical(na.rm)
op <- charmatch(OP, c("+", "-", "*", "/"), nomatch = 0L)
stopifnot(op > 0L)
if (is.character(OP)) {
op <- charmatch(OP, c("+", "-", "*", "/"), nomatch = 0L)
if (op == 0L) stop("Unknown value on argument 'OP': ", sQuote(OP))
} else {
op <- as.integer(OP)
}
.Call(C_x_OP_y, x, y, dim(x), op, xrows, xcols, yidxs,
commute, na.rm, TRUE, FALSE)
}
......@@ -60,8 +64,12 @@ t_tx_OP_y <- function(x, y, OP, xrows = NULL, xcols = NULL, yidxs = NULL,
commute = FALSE, na.rm = FALSE) {
commute <- as.logical(commute)
na.rm <- as.logical(na.rm)
op <- charmatch(OP, c("+", "-", "*", "/"), nomatch = 0L)
stopifnot(op > 0L)
if (is.character(OP)) {
op <- charmatch(OP, c("+", "-", "*", "/"), nomatch = 0L)
if (op == 0L) stop("Unknown value on argument 'OP': ", sQuote(OP))
} else {
op <- as.integer(OP)
}
.Call(C_x_OP_y, x, y, dim(x), op, xrows, xcols, yidxs,
commute, na.rm, TRUE, TRUE)
}
No preview for this file type
......@@ -166,7 +166,7 @@ hr {
<body>
<h1>matrixStats: Summary of functions</h1>
<p>Henrik Bengtsson on February 10, 2018</p>
<p>Henrik Bengtsson on July 23, 2018</p>
<h2>Location and scale estimators</h2>
......@@ -390,7 +390,7 @@ hr {
<hr/>
<p>matrixStats v0.53.1. Release: <a href="https://cran.r-project.org/package=matrixStats">CRAN</a>, Development: <a href="https://github.com/HenrikBengtsson/matrixStats">GitHub</a>.</p>
<p>matrixStats v0.54.0. Release: <a href="https://cran.r-project.org/package=matrixStats">CRAN</a>, Development: <a href="https://github.com/HenrikBengtsson/matrixStats">GitHub</a>.</p>
</body>
......
......@@ -53,7 +53,7 @@ the others.
\details{
If argument \code{S} is a single column vector with indices \code{1:N}, then
\code{rowAvgsPerColSet(X, S = S, FUN = rowMeans)} gives the same result as
\code{rowMeans(X)}. Analogously, for \code{rowAvgsPerColSet()}.
\code{rowMeans(X)}. Analogously, for \code{colAvgsPerRowSet()}.
}
\examples{
X <- matrix(rnorm(20 * 6), nrow = 20, ncol = 6)
......
......@@ -18,26 +18,22 @@ SEXP anyMissing(SEXP x, SEXP idxs) {
nx = xlength(x);
/* anyMissing() on zero-length objects should always return FALSE,
just like any(double(0)). */
if (nx == 0) return(ScalarLogical(FALSE));
/* Argument 'idxs': */
R_xlen_t nidxs;
int idxsType;
void *cidxs = validateIndices(idxs, nx, 1, &nidxs, &idxsType);
if (nidxs == 0) return(ScalarLogical(FALSE));
PROTECT(ans = allocVector(LGLSXP, 1));
LOGICAL(ans)[0] = 0;
/* anyMissing() on zero-length objects should always return FALSE,
just like any(double(0)). */
if (nidxs == 0) {
UNPROTECT(1);
return(ans);
if (anyMissing_internal[idxsType](x, cidxs, nidxs)) {
return(ScalarLogical(TRUE));
}
LOGICAL(ans)[0] = anyMissing_internal[idxsType](x, cidxs, nidxs);
UNPROTECT(1); /* ans */
return(ans);
return(ScalarLogical(FALSE));
} // anyMissing()
......
......@@ -62,11 +62,11 @@ SEXP indexByRow(SEXP dim, SEXP idxs) {
n_max *= d;
#ifndef LONG_VECTOR_SUPPORT
if (n_max > R_INT_MAX) {
error("Argument 'dim' (%d,%d) specifies a matrix that has more than 2^31-1 elements: %d", INTEGER(dim)[1], INTEGER(dim)[2], n_max);
error("Argument 'dim' (%d,%d) specifies a matrix that has more than 2^31-1 elements: %d", INTEGER(dim)[0], INTEGER(dim)[1], n_max);
}
#endif
if (n_max > R_INT_MAX) {
error("Argument 'dim' (%d,%d) specifies a matrix that has more than 2^31-1 elements: %d", INTEGER(dim)[1], INTEGER(dim)[2], n_max);
error("Argument 'dim' (%d,%d) specifies a matrix that has more than 2^31-1 elements: %d", INTEGER(dim)[0], INTEGER(dim)[1], n_max);
}
}
......
......@@ -35,9 +35,9 @@ SEXP sum2(SEXP x, SEXP idxs, SEXP naRm, SEXP mode) {
/* Dispatch to low-level C function */
if (isReal(x)) {
sum = sum2_dbl[idxsType](REAL(x), nx, cidxs, nidxs, narm, mode2);
sum = sum2_dbl[idxsType](REAL(x), nx, cidxs, nidxs, narm);
} else if (isInteger(x) || isLogical(x)) {
sum = sum2_int[idxsType](INTEGER(x), nx, cidxs, nidxs, narm, mode2);
sum = sum2_int[idxsType](INTEGER(x), nx, cidxs, nidxs, narm);
}
......
......@@ -6,17 +6,17 @@
/*
Native API (dynamically generated via macros):
double sum2_int_aidxs(int *x, R_xlen_t nx, int *idxs, R_xlen_t nidxs, int narm, int mode)
double sum2_int_iidxs(int *x, R_xlen_t nx, int *idxs, R_xlen_t nidxs, int narm, int mode)
double sum2_int_didxs(int *x, R_xlen_t nx, int *idxs, R_xlen_t nidxs, int narm, int mode)
double sum2_dbl_aidxs(double *x, R_xlen_t nx, int *idxs, R_xlen_t nidxs, int narm, int mode)
double sum2_dbl_iidxs(double *x, R_xlen_t nx, int *idxs, R_xlen_t nidxs, int narm, int mode)
double sum2_dbl_didxs(double *x, R_xlen_t nx, int *idxs, R_xlen_t nidxs, int narm, int mode)
double sum2_int_aidxs(int *x, R_xlen_t nx, int *idxs, R_xlen_t nidxs, int narm)
double sum2_int_iidxs(int *x, R_xlen_t nx, int *idxs, R_xlen_t nidxs, int narm)
double sum2_int_didxs(int *x, R_xlen_t nx, int *idxs, R_xlen_t nidxs, int narm)
double sum2_dbl_aidxs(double *x, R_xlen_t nx, int *idxs, R_xlen_t nidxs, int narm)
double sum2_dbl_iidxs(double *x, R_xlen_t nx, int *idxs, R_xlen_t nidxs, int narm)
double sum2_dbl_didxs(double *x, R_xlen_t nx, int *idxs, R_xlen_t nidxs, int narm)
*/
#define METHOD sum2
#define RETURN_TYPE double
#define ARGUMENTS_LIST X_C_TYPE *x, R_xlen_t nx, int *idxs, R_xlen_t nidxs, int narm, int mode
#define ARGUMENTS_LIST X_C_TYPE *x, R_xlen_t nx, int *idxs, R_xlen_t nidxs, int narm
#define X_TYPE 'i'
#include "000.templates-gen-vector.h"
......
......@@ -3,7 +3,7 @@
double sum2_<int|dbl>[idxsType](ARGUMENTS_LIST)
ARGUMENTS_LIST:
X_C_TYPE *x, R_xlen_t nx, int *idxs, R_xlen_t nidxs, int narm, int mode
X_C_TYPE *x, R_xlen_t nx, int *idxs, R_xlen_t nidxs, int narm
Arguments:
The following macros ("arguments") should be defined for the
......@@ -12,7 +12,7 @@
- METHOD_NAME: the name of the resulting function
- X_TYPE: 'i' or 'r'
Copyright: Henrik Bengtsson, 2014-2017
Copyright: Henrik Bengtsson, 2014-2018
***********************************************************************/
#include "000.types.h"
......
......@@ -61,7 +61,7 @@ SEXP x_OP_y(SEXP x, SEXP y, SEXP dim, SEXP operator, SEXP xrows, SEXP xcols, SEX
INTEGER(x), nrow, ncol, INTEGER(y), ny, cxrows, nxrows, cxcols, nxcols, cyidxs, nyidxs, byrow, commute2, narm, hasna, INTEGER(ans), xlength(ans));
UNPROTECT(1);
}
} if (op == 2) {
} else if (op == 2) {
/* Subtraction */
if (isReal(x) || isReal(y)) {
PROTECT(ans = allocMatrix(REALSXP, nxrows, nxcols));
......@@ -120,6 +120,8 @@ SEXP x_OP_y(SEXP x, SEXP y, SEXP dim, SEXP operator, SEXP xrows, SEXP xcols, SEX
INTEGER(x), nrow, ncol, INTEGER(y), ny, cxrows, nxrows, cxcols, nxcols, cyidxs, nyidxs, byrow, commute2, narm, hasna, REAL(ans), xlength(ans));
}
UNPROTECT(1);
} else {
error("Unknown value on argument 'OP': %dL", op);
}
return(ans);
......
......@@ -68,6 +68,10 @@ stopifnot(all(idxs_R2 == idxs_by_rows))
idxs0 <- indexByRow(dim)
idxs1 <- indexByRow(x)
stopifnot(identical(idxs1, idxs0))
res <- tryCatch({
idxs1 <- indexByRow(x)
}, warning = identity)
stopifnot(inherits(res, "warning"))
## Exceptions:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment