diff --git a/ChangeLog b/ChangeLog index a7dc95ea..0f950ccf 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,12 @@ +2023-10-31 Dirk Eddelbuettel + + * DESCRIPTION (Version, Date): RcppArmadillo 0.12.6.6.0 + * inst/NEWS.Rd: Idem + * configure.ac: Idem + * configure: Idem + + * inst/include/armadillo_bits/: Armadillo 12.6.6 + 2023-10-29 Dirk Eddelbuettel * src/RcppArmadillo.cpp (armadillo_get_number_of_omp_threads) diff --git a/DESCRIPTION b/DESCRIPTION index ad223a1c..394f94ea 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,8 +1,8 @@ Package: RcppArmadillo Type: Package Title: 'Rcpp' Integration for the 'Armadillo' Templated Linear Algebra Library -Version: 0.12.6.5.0 -Date: 2023-10-14 +Version: 0.12.6.6.0 +Date: 2023-10-31 Author: Dirk Eddelbuettel, Romain Francois, Doug Bates, Binxiang Ni, and Conrad Sanderson Maintainer: Dirk Eddelbuettel Description: 'Armadillo' is a templated C++ linear algebra library (by Conrad diff --git a/configure b/configure index f1dcea94..cc950531 100755 --- a/configure +++ b/configure @@ -1,6 +1,6 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.71 for RcppArmadillo 0.12.6.5.0. +# Generated by GNU Autoconf 2.71 for RcppArmadillo 0.12.6.6.0. # # Report bugs to . # @@ -610,8 +610,8 @@ MAKEFLAGS= # Identity of this package. PACKAGE_NAME='RcppArmadillo' PACKAGE_TARNAME='rcpparmadillo' -PACKAGE_VERSION='0.12.6.5.0' -PACKAGE_STRING='RcppArmadillo 0.12.6.5.0' +PACKAGE_VERSION='0.12.6.6.0' +PACKAGE_STRING='RcppArmadillo 0.12.6.6.0' PACKAGE_BUGREPORT='edd@debian.org' PACKAGE_URL='' @@ -1229,7 +1229,7 @@ if test "$ac_init_help" = "long"; then # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF -\`configure' configures RcppArmadillo 0.12.6.5.0 to adapt to many kinds of systems. +\`configure' configures RcppArmadillo 0.12.6.6.0 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -1291,7 +1291,7 @@ fi if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of RcppArmadillo 0.12.6.5.0:";; + short | recursive ) echo "Configuration of RcppArmadillo 0.12.6.6.0:";; esac cat <<\_ACEOF @@ -1372,7 +1372,7 @@ fi test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF -RcppArmadillo configure 0.12.6.5.0 +RcppArmadillo configure 0.12.6.6.0 generated by GNU Autoconf 2.71 Copyright (C) 2021 Free Software Foundation, Inc. @@ -1486,7 +1486,7 @@ cat >config.log <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. -It was created by RcppArmadillo $as_me 0.12.6.5.0, which was +It was created by RcppArmadillo $as_me 0.12.6.6.0, which was generated by GNU Autoconf 2.71. Invocation command line was $ $0$ac_configure_args_raw @@ -3944,7 +3944,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" -This file was extended by RcppArmadillo $as_me 0.12.6.5.0, which was +This file was extended by RcppArmadillo $as_me 0.12.6.6.0, which was generated by GNU Autoconf 2.71. Invocation command line was CONFIG_FILES = $CONFIG_FILES @@ -3999,7 +3999,7 @@ ac_cs_config_escaped=`printf "%s\n" "$ac_cs_config" | sed "s/^ //; s/'/'\\\\\\\\ cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_config='$ac_cs_config_escaped' ac_cs_version="\\ -RcppArmadillo config.status 0.12.6.5.0 +RcppArmadillo config.status 0.12.6.6.0 configured by $0, generated by GNU Autoconf 2.71, with options \\"\$ac_cs_config\\" diff --git a/configure.ac b/configure.ac index 336b2b6d..1c81d710 100644 --- a/configure.ac +++ b/configure.ac @@ -11,7 +11,7 @@ AC_PREREQ([2.69]) ## Process this file with autoconf to produce a configure script. -AC_INIT([RcppArmadillo],[0.12.6.5.0],[edd@debian.org]) +AC_INIT([RcppArmadillo],[0.12.6.6.0],[edd@debian.org]) ## Set R_HOME, respecting an environment variable if one is set : ${R_HOME=$(R RHOME)} diff --git a/inst/NEWS.Rd b/inst/NEWS.Rd index 930f25ea..5c7b3e81 100644 --- a/inst/NEWS.Rd +++ b/inst/NEWS.Rd @@ -3,6 +3,19 @@ \newcommand{\ghpr}{\href{https://github.com/RcppCore/RcppArmadillo/pull/#1}{##1}} \newcommand{\ghit}{\href{https://github.com/RcppCore/RcppArmadillo/issues/#1}{##1}} +\section{Changes in RcppArmadillo version 0.12.6.6.0 (2023-10-31)}{ + \itemize{ + \item Upgraded to Armadillo release 12.6.6 (Cortisol Retox) + \itemize{ + \item Fix \code{eigs_sym()}, \code{eigs_gen()} and \code{svds()} to + generate deterministic results in ARPACK mode + } + \item Add helper functions to set and get the number of OpenMP threads + \item Store initial thread count at package load and use in + thread-throttling helper (and resetter) suitable for CRAN constraints + } +} + \section{Changes in RcppArmadillo version 0.12.6.5.0 (2023-10-14)}{ \itemize{ \item Upgraded to Armadillo release 12.6.5 (Cortisol Retox) @@ -219,7 +232,7 @@ \item Accomodate upcoming \pkg{Matrix} 1.4-2 deprecation for conversion (Dirk in \ghpr{387}) \item CRAN release with small upstream changes in Armadillo - 11.2.{1,2,3} made since the last CRAN release 0.11.2.0.0 + 11.2.(1,2,3) made since the last CRAN release 0.11.2.0.0 (Dirk in \ghpr{383}, \ghpr{384} and \ghpr{386}) \item Undefine \code{arma_deprecated} warning as it affects a number of CRAN packages which will likely need a small transition @@ -921,7 +934,7 @@ \item smarter use of the element cache in sparse matrices } \item Aligned OpenMP flags in the RcppArmadillo.package.skeleton - used Makevars{,.win} to not use one C and C++ flag. + used Makevars(,.win) to not use one C and C++ flag. } } diff --git a/inst/include/armadillo_bits/arma_version.hpp b/inst/include/armadillo_bits/arma_version.hpp index 92d22a53..025dec50 100644 --- a/inst/include/armadillo_bits/arma_version.hpp +++ b/inst/include/armadillo_bits/arma_version.hpp @@ -23,7 +23,7 @@ #define ARMA_VERSION_MAJOR 12 #define ARMA_VERSION_MINOR 6 -#define ARMA_VERSION_PATCH 5 +#define ARMA_VERSION_PATCH 6 #define ARMA_VERSION_NAME "Cortisol Retox" diff --git a/inst/include/armadillo_bits/sp_auxlib_bones.hpp b/inst/include/armadillo_bits/sp_auxlib_bones.hpp index 4a06e74e..698265b4 100644 --- a/inst/include/armadillo_bits/sp_auxlib_bones.hpp +++ b/inst/include/armadillo_bits/sp_auxlib_bones.hpp @@ -158,6 +158,31 @@ class sp_auxlib +template +struct eigs_randu_filler + { + std::mt19937_64 local_engine; + std::uniform_real_distribution local_u_distr; + + inline eigs_randu_filler(); + + inline void fill(podarray& X, const uword N); + }; + + +template +struct eigs_randu_filler< std::complex > + { + std::mt19937_64 local_engine; + std::uniform_real_distribution local_u_distr; + + inline eigs_randu_filler(); + + inline void fill(podarray< std::complex >& X, const uword N); + }; + + + #if defined(ARMA_USE_SUPERLU) class superlu_supermatrix_wrangler diff --git a/inst/include/armadillo_bits/sp_auxlib_meat.hpp b/inst/include/armadillo_bits/sp_auxlib_meat.hpp index 31e820ae..dbfdf2d7 100644 --- a/inst/include/armadillo_bits/sp_auxlib_meat.hpp +++ b/inst/include/armadillo_bits/sp_auxlib_meat.hpp @@ -1921,7 +1921,9 @@ sp_auxlib::run_aupd_plain n = X.n_rows; // The size of the matrix (should already be set outside). blas_int nev = n_eigvals; - resid.zeros(n); + // resid.zeros(n); + eigs_randu_filler randu_filler; + randu_filler.fill(resid, n); // use deterministic starting point // Two contraints on NCV: (NCV > NEV) for sym problems or // (NCV > NEV + 2) for gen problems and (NCV <= N) @@ -1956,7 +1958,8 @@ sp_auxlib::run_aupd_plain // Real work array of length lworkl. workl.zeros(lworkl); - info = 0; // Set to 0 initially to use random initial vector. + // info = 0; // resid to be filled with random values by ARPACK (non-deterministic) + info = 1; // resid is already filled with random values (deterministic) // All the parameters have been set or created. Time to loop a lot. while(ido != 99) @@ -2109,7 +2112,9 @@ sp_auxlib::run_aupd_shiftinvert n = X.n_rows; // The size of the matrix (should already be set outside). blas_int nev = n_eigvals; - resid.zeros(n); + // resid.zeros(n); + eigs_randu_filler randu_filler; + randu_filler.fill(resid, n); // use deterministic starting point // Two contraints on NCV: (NCV > NEV) for sym problems or // (NCV > NEV + 2) for gen problems and (NCV <= N) @@ -2147,7 +2152,8 @@ sp_auxlib::run_aupd_shiftinvert // Real work array of length lworkl. workl.zeros(lworkl); - info = 0; // Set to 0 initially to use random initial vector. + // info = 0; // resid to be filled with random values by ARPACK (non-deterministic) + info = 1; // resid is already filled with random values (deterministic) superlu_opts superlu_opts_default; superlu::superlu_options_t options; @@ -2439,6 +2445,85 @@ sp_auxlib::rudimentary_sym_check(const SpMat< std::complex >& X) +// + + + +template +inline +eigs_randu_filler::eigs_randu_filler() + { + arma_extra_debug_sigprint(); + + typedef typename std::mt19937_64::result_type local_seed_type; + + local_engine.seed(local_seed_type(123)); + + typedef typename std::uniform_real_distribution::param_type local_param_type; + + local_u_distr.param(local_param_type(-1.0, +1.0)); + } + + +template +inline +void +eigs_randu_filler::fill(podarray& X, const uword N) + { + arma_extra_debug_sigprint(); + + X.set_size(N); + + eT* X_mem = X.memptr(); + + for(uword i=0; i +inline +eigs_randu_filler< std::complex >::eigs_randu_filler() + { + arma_extra_debug_sigprint(); + + typedef typename std::mt19937_64::result_type local_seed_type; + + local_engine.seed(local_seed_type(123)); + + typedef typename std::uniform_real_distribution::param_type local_param_type; + + local_u_distr.param(local_param_type(-1.0, +1.0)); + } + + +template +inline +void +eigs_randu_filler< std::complex >::fill(podarray< std::complex >& X, const uword N) + { + arma_extra_debug_sigprint(); + + typedef typename std::complex eT; + + X.set_size(N); + + eT* X_mem = X.memptr(); + + for(uword i=0; i