diff options
| author | Luca Coraggio <luca.coraggio@unina.it> | 2021-10-21 12:10:10 +0000 |
|---|---|---|
| committer | cran-robot <csardi.gabor+cran@gmail.com> | 2021-10-21 12:10:10 +0000 |
| commit | 17556182f98e2dc51e236b01aec7eef054e7e2f9 (patch) | |
| tree | 3d897d2e804a00b40856341a023a71e9f470f138 | |
| parent | ca17d57dce048f57e03241f6120d539ec70d785a (diff) | |
version 2.0.1
| -rw-r--r-- | DESCRIPTION | 8 | ||||
| -rw-r--r-- | MD5 | 10 | ||||
| -rwxr-xr-x | NEWS | 6 | ||||
| -rw-r--r-- | R/rmad.R | 2 | ||||
| -rwxr-xr-x | man/rmad.Rd | 18 | ||||
| -rw-r--r-- | src/init.c | 9 |
6 files changed, 32 insertions, 21 deletions
diff --git a/DESCRIPTION b/DESCRIPTION index dcafcfb..93ff38a 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -19,8 +19,8 @@ NeedsCompilation: yes Imports: stats, graphics, Matrix, methods, parallel, foreach, doParallel, utils License: GPL (>= 2) -Version: 2.0 -Date: 2021-10-14 -Packaged: 2021-10-14 14:44:39 UTC; luco +Version: 2.0.1 +Date: 2021-10-21 +Packaged: 2021-10-21 09:41:44 UTC; luco Repository: CRAN -Date/Publication: 2021-10-17 20:00:08 UTC +Date/Publication: 2021-10-21 13:10:10 UTC @@ -1,20 +1,20 @@ -f8d0f0d74876f46c0818b142ffa180aa *DESCRIPTION +1f92959e161df053272c7bd41ee0da95 *DESCRIPTION 9e6c9e63967c10a2dad469679534e3b2 *NAMESPACE -12aa4cb77fcbd1096f7c868a332debac *NEWS +d12cdaf813b043b11ef786424ba55985 *NEWS 852c9f1717e4dbd26ed8c549edc3c588 *R/check_inputs.R 228fb1b443a4c9eaf4fddcdf9c8a31a9 *R/cv_loss.R 8c8c70764c8a9ab72f23ba031e0f330d *R/plot_print_methods.R -720ba075c0b402a232b5528774fa1230 *R/rmad.R +0b8ff21b41422f17ef7822a33ac061da *R/rmad.R 3e98806cb071a0b84028b7e5bb022cc5 *R/rsc.R 98992e4ed337da761f641cb2960f7579 *R/rsc_cv.R cafa1636fd3af0dd260cbfcb27df210e *R/zzz.R 02a06053793e54ce413a378a05ccc3ce *inst/CITATION 1e6af804927098cfa6c235278682578c *man/plot.cv_rsc.Rd -a762f06952b9b9f89cab9826674be146 *man/rmad.Rd +b7a3fee379fb124e3105841679dddd75 *man/rmad.Rd 8cc5c9373c7aa8835e9818d0de274ece *man/rsc.Rd 63d3e58e9bdc0da9969feb6ce69d005f *man/rsc_cv.Rd 95e3011e37d9dde0d75f3a3819b2acd3 *src/Makevars 4aad47542a9a6ce7b9f153dccd1690aa *src/RSCdefines.h 7ef7aff199844c0d42d07684e58e63d1 *src/cormad_ptr.c -b518af5dd0a97f37ab37e4d915dc5303 *src/init.c +30f2dca3621343f95cb27fd42f5d6206 *src/init.c cdb3d966f6db89bf54d3fac4b9314bc6 *src/selection_algos_ptr.c @@ -1,3 +1,9 @@ +## 21/10/2021 at 11:37:00 (CEST)
+* v2.0.1:
+ + fixed include C system headers before R.h
+ + modified behaviour of num.threads (rmad)
+ + updated references for quickselect
+
## 14/10/2021 at 11:51:10 (CEST)
* New version: v2.0.
+ Implemented the low-level routines in C.
@@ -18,6 +18,8 @@ rmad <- function(x, y = NULL, na.rm = FALSE, even.correction = FALSE, num.thread ## set number of threads if (num.threads == "half-max") { num.threads <- 0L + } else if (num.threads == 0) { + num.threads <- 1L } else { storage.mode(num.threads) <- "integer" } diff --git a/man/rmad.Rd b/man/rmad.Rd index 26417a0..40ed6e0 100755 --- a/man/rmad.Rd +++ b/man/rmad.Rd @@ -55,8 +55,8 @@ The software is optimized for large dimensional data sets, the median is approximated as the central observation obtained based on the - \emph{introselect} sorting algorithm of Musser (1997) implemented in - Fortran 95 language. For small samples this may be a crude + \emph{find} algorithm of Hoare (1961) (also known as \emph{quickselect}) + implemented in C language. For small samples this may be a crude approximation, however, it makes the computational cost feasible for high-dimensional data sets. With the option \code{even.correction = TRUE} a correction is applied to reduce the bias for data sets with @@ -79,10 +79,13 @@ thresholding using the \code{\link{rsc_cv}} and \code{\link{rsc}}. \code{rmad} function supports parallel execution. - This is provided via \emph{openmp} (http://www.openmp.org), which must be available; otherwise, falls back to single-core execution. - If \code{num.threads > 0}, function is executed using \code{min(num.threads, max.threads)} threads, where \code{max.threads} is the maximum number of available threads. That is, if positive use the specified number of threads (up to the maximum available). - If \code{num.threads < 0}, function is executed using \code{max(max.threads - num.threads, 1)} threads, i.e. when negative \code{num.threads} indicates the number of threads not to use. - If \code{num.threads == 0} or \code{num.threads == "half-max"}, function is executed using half of the available threads (\code{max(max.threads/2, 1)}). This is the default. + This is provided via \emph{openmp} (http://www.openmp.org), which must be already available on the system at installation time; + otherwise, falls back to single-core execution. + For later installation of openmp, the RSC package needs to be re-installed (re-compiled) to provide multi-threads execution. + If \code{num.threads > 0}, function is executed using \code{min(num.threads, max.threads)} threads, where \code{max.threads} is the maximum number of available threads. That is, if positive the specified number of threads (up to the maximum available) are used. + If \code{num.threads < 0}, function is executed using \code{max(max.threads - num.threads, 1)} threads, i.e. when negative \code{num.threads} indicates the number of threads not to use (at least one thread is used). + If \code{num.threads == 0}, a single thread is used (equivalent to \code{num.threads = 1}). + If \code{num.threads == "half-max"}, function is executed using half of the available threads (\code{max(max.threads/2, 1)}). This is the default. } @@ -101,6 +104,9 @@ \section{References}{ + Hoare, C. A. (1961). Algorithm 65: find. + \emph{Communications of the ACM}, 4(7), 321-322. + Musser, D. R. (1997). Introspective sorting and selection algorithms. \emph{Software: Practice and Experience}, 27(8), 983-993. @@ -1,15 +1,12 @@ #include "RSCdefines.h" -#include <R.h> -#include <R_ext/RS.h> -#include <R_ext/Rdynload.h> -#include <Rdefines.h> -#include <Rinternals.h> -#include <Rmath.h> #include <stdio.h> #include <stdlib.h> #ifdef _OPENMP #include <omp.h> #endif +#include <R.h> +#include <R_ext/Rdynload.h> +#include <Rinternals.h> // Wrapper for C cormad (with pointers) SEXP cormad_C(SEXP R_matrix, SEXP len_rows, SEXP len_cols, SEXP R_evencorrect, |
