Skip to content

Commit

Permalink
Merge pull request #426 from RcppCore/feature/arma_12.6.6
Browse files Browse the repository at this point in the history
RcppArmadillo 0.12.6.6.0 with Armadillo 12.6.6
  • Loading branch information
eddelbuettel authored Nov 1, 2023
2 parents 5a81f8f + 8aac39c commit 779d353
Show file tree
Hide file tree
Showing 8 changed files with 151 additions and 19 deletions.
9 changes: 9 additions & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
@@ -1,3 +1,12 @@
2023-10-31 Dirk Eddelbuettel <[email protected]>

* 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 <[email protected]>

* src/RcppArmadillo.cpp (armadillo_get_number_of_omp_threads)
Expand Down
4 changes: 2 additions & 2 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -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 <[email protected]>
Description: 'Armadillo' is a templated C++ linear algebra library (by Conrad
Expand Down
18 changes: 9 additions & 9 deletions configure
Original file line number Diff line number Diff line change
@@ -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 <[email protected]>.
#
Expand Down Expand Up @@ -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='[email protected]'
PACKAGE_URL=''

Expand Down Expand Up @@ -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]...
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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.
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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\\"
Expand Down
2 changes: 1 addition & 1 deletion configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -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],[[email protected]])
AC_INIT([RcppArmadillo],[0.12.6.6.0],[[email protected]])

## Set R_HOME, respecting an environment variable if one is set
: ${R_HOME=$(R RHOME)}
Expand Down
17 changes: 15 additions & 2 deletions inst/NEWS.Rd
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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.
}
}

Expand Down
2 changes: 1 addition & 1 deletion inst/include/armadillo_bits/arma_version.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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"


Expand Down
25 changes: 25 additions & 0 deletions inst/include/armadillo_bits/sp_auxlib_bones.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,31 @@ class sp_auxlib



template<typename eT>
struct eigs_randu_filler
{
std::mt19937_64 local_engine;
std::uniform_real_distribution<eT> local_u_distr;

inline eigs_randu_filler();

inline void fill(podarray<eT>& X, const uword N);
};


template<typename T>
struct eigs_randu_filler< std::complex<T> >
{
std::mt19937_64 local_engine;
std::uniform_real_distribution<T> local_u_distr;

inline eigs_randu_filler();

inline void fill(podarray< std::complex<T> >& X, const uword N);
};



#if defined(ARMA_USE_SUPERLU)

class superlu_supermatrix_wrangler
Expand Down
93 changes: 89 additions & 4 deletions inst/include/armadillo_bits/sp_auxlib_meat.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<T> 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)
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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<T> 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)
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -2439,6 +2445,85 @@ sp_auxlib::rudimentary_sym_check(const SpMat< std::complex<T> >& X)



//



template<typename eT>
inline
eigs_randu_filler<eT>::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<eT>::param_type local_param_type;

local_u_distr.param(local_param_type(-1.0, +1.0));
}


template<typename eT>
inline
void
eigs_randu_filler<eT>::fill(podarray<eT>& X, const uword N)
{
arma_extra_debug_sigprint();

X.set_size(N);

eT* X_mem = X.memptr();

for(uword i=0; i<N; ++i) { X_mem[i] = eT( local_u_distr(local_engine) ); }
}


template<typename T>
inline
eigs_randu_filler< std::complex<T> >::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<T>::param_type local_param_type;

local_u_distr.param(local_param_type(-1.0, +1.0));
}


template<typename T>
inline
void
eigs_randu_filler< std::complex<T> >::fill(podarray< std::complex<T> >& X, const uword N)
{
arma_extra_debug_sigprint();

typedef typename std::complex<T> eT;

X.set_size(N);

eT* X_mem = X.memptr();

for(uword i=0; i<N; ++i)
{
eT& X_mem_i = X_mem[i];

X_mem_i.real( T(local_u_distr(local_engine)) );
X_mem_i.imag( T(local_u_distr(local_engine)) );
}
}



//



#if defined(ARMA_USE_SUPERLU)

inline
Expand Down

0 comments on commit 779d353

Please sign in to comment.