Skip to content

Commit 779d353

Browse files
authored
Merge pull request #426 from RcppCore/feature/arma_12.6.6
RcppArmadillo 0.12.6.6.0 with Armadillo 12.6.6
2 parents 5a81f8f + 8aac39c commit 779d353

File tree

8 files changed

+151
-19
lines changed

8 files changed

+151
-19
lines changed

ChangeLog

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,12 @@
1+
2023-10-31 Dirk Eddelbuettel <[email protected]>
2+
3+
* DESCRIPTION (Version, Date): RcppArmadillo 0.12.6.6.0
4+
* inst/NEWS.Rd: Idem
5+
* configure.ac: Idem
6+
* configure: Idem
7+
8+
* inst/include/armadillo_bits/: Armadillo 12.6.6
9+
110
2023-10-29 Dirk Eddelbuettel <[email protected]>
211

312
* src/RcppArmadillo.cpp (armadillo_get_number_of_omp_threads)

DESCRIPTION

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
Package: RcppArmadillo
22
Type: Package
33
Title: 'Rcpp' Integration for the 'Armadillo' Templated Linear Algebra Library
4-
Version: 0.12.6.5.0
5-
Date: 2023-10-14
4+
Version: 0.12.6.6.0
5+
Date: 2023-10-31
66
Author: Dirk Eddelbuettel, Romain Francois, Doug Bates, Binxiang Ni, and Conrad Sanderson
77
Maintainer: Dirk Eddelbuettel <[email protected]>
88
Description: 'Armadillo' is a templated C++ linear algebra library (by Conrad

configure

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#! /bin/sh
22
# Guess values for system-dependent variables and create Makefiles.
3-
# Generated by GNU Autoconf 2.71 for RcppArmadillo 0.12.6.5.0.
3+
# Generated by GNU Autoconf 2.71 for RcppArmadillo 0.12.6.6.0.
44
#
55
# Report bugs to <[email protected]>.
66
#
@@ -610,8 +610,8 @@ MAKEFLAGS=
610610
# Identity of this package.
611611
PACKAGE_NAME='RcppArmadillo'
612612
PACKAGE_TARNAME='rcpparmadillo'
613-
PACKAGE_VERSION='0.12.6.5.0'
614-
PACKAGE_STRING='RcppArmadillo 0.12.6.5.0'
613+
PACKAGE_VERSION='0.12.6.6.0'
614+
PACKAGE_STRING='RcppArmadillo 0.12.6.6.0'
615615
PACKAGE_BUGREPORT='[email protected]'
616616
PACKAGE_URL=''
617617

@@ -1229,7 +1229,7 @@ if test "$ac_init_help" = "long"; then
12291229
# Omit some internal or obsolete options to make the list less imposing.
12301230
# This message is too long to be a string in the A/UX 3.1 sh.
12311231
cat <<_ACEOF
1232-
\`configure' configures RcppArmadillo 0.12.6.5.0 to adapt to many kinds of systems.
1232+
\`configure' configures RcppArmadillo 0.12.6.6.0 to adapt to many kinds of systems.
12331233
12341234
Usage: $0 [OPTION]... [VAR=VALUE]...
12351235
@@ -1291,7 +1291,7 @@ fi
12911291

12921292
if test -n "$ac_init_help"; then
12931293
case $ac_init_help in
1294-
short | recursive ) echo "Configuration of RcppArmadillo 0.12.6.5.0:";;
1294+
short | recursive ) echo "Configuration of RcppArmadillo 0.12.6.6.0:";;
12951295
esac
12961296
cat <<\_ACEOF
12971297
@@ -1372,7 +1372,7 @@ fi
13721372
test -n "$ac_init_help" && exit $ac_status
13731373
if $ac_init_version; then
13741374
cat <<\_ACEOF
1375-
RcppArmadillo configure 0.12.6.5.0
1375+
RcppArmadillo configure 0.12.6.6.0
13761376
generated by GNU Autoconf 2.71
13771377
13781378
Copyright (C) 2021 Free Software Foundation, Inc.
@@ -1486,7 +1486,7 @@ cat >config.log <<_ACEOF
14861486
This file contains any messages produced by compilers while
14871487
running configure, to aid debugging if configure makes a mistake.
14881488
1489-
It was created by RcppArmadillo $as_me 0.12.6.5.0, which was
1489+
It was created by RcppArmadillo $as_me 0.12.6.6.0, which was
14901490
generated by GNU Autoconf 2.71. Invocation command line was
14911491
14921492
$ $0$ac_configure_args_raw
@@ -3944,7 +3944,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
39443944
# report actual input values of CONFIG_FILES etc. instead of their
39453945
# values after options handling.
39463946
ac_log="
3947-
This file was extended by RcppArmadillo $as_me 0.12.6.5.0, which was
3947+
This file was extended by RcppArmadillo $as_me 0.12.6.6.0, which was
39483948
generated by GNU Autoconf 2.71. Invocation command line was
39493949
39503950
CONFIG_FILES = $CONFIG_FILES
@@ -3999,7 +3999,7 @@ ac_cs_config_escaped=`printf "%s\n" "$ac_cs_config" | sed "s/^ //; s/'/'\\\\\\\\
39993999
cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
40004000
ac_cs_config='$ac_cs_config_escaped'
40014001
ac_cs_version="\\
4002-
RcppArmadillo config.status 0.12.6.5.0
4002+
RcppArmadillo config.status 0.12.6.6.0
40034003
configured by $0, generated by GNU Autoconf 2.71,
40044004
with options \\"\$ac_cs_config\\"
40054005

configure.ac

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
AC_PREREQ([2.69])
1212

1313
## Process this file with autoconf to produce a configure script.
14-
AC_INIT([RcppArmadillo],[0.12.6.5.0],[[email protected]])
14+
AC_INIT([RcppArmadillo],[0.12.6.6.0],[[email protected]])
1515

1616
## Set R_HOME, respecting an environment variable if one is set
1717
: ${R_HOME=$(R RHOME)}

inst/NEWS.Rd

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,19 @@
33
\newcommand{\ghpr}{\href{https://github.com/RcppCore/RcppArmadillo/pull/#1}{##1}}
44
\newcommand{\ghit}{\href{https://github.com/RcppCore/RcppArmadillo/issues/#1}{##1}}
55

6+
\section{Changes in RcppArmadillo version 0.12.6.6.0 (2023-10-31)}{
7+
\itemize{
8+
\item Upgraded to Armadillo release 12.6.6 (Cortisol Retox)
9+
\itemize{
10+
\item Fix \code{eigs_sym()}, \code{eigs_gen()} and \code{svds()} to
11+
generate deterministic results in ARPACK mode
12+
}
13+
\item Add helper functions to set and get the number of OpenMP threads
14+
\item Store initial thread count at package load and use in
15+
thread-throttling helper (and resetter) suitable for CRAN constraints
16+
}
17+
}
18+
619
\section{Changes in RcppArmadillo version 0.12.6.5.0 (2023-10-14)}{
720
\itemize{
821
\item Upgraded to Armadillo release 12.6.5 (Cortisol Retox)
@@ -219,7 +232,7 @@
219232
\item Accomodate upcoming \pkg{Matrix} 1.4-2 deprecation for
220233
conversion (Dirk in \ghpr{387})
221234
\item CRAN release with small upstream changes in Armadillo
222-
11.2.{1,2,3} made since the last CRAN release 0.11.2.0.0
235+
11.2.(1,2,3) made since the last CRAN release 0.11.2.0.0
223236
(Dirk in \ghpr{383}, \ghpr{384} and \ghpr{386})
224237
\item Undefine \code{arma_deprecated} warning as it affects a number
225238
of CRAN packages which will likely need a small transition
@@ -921,7 +934,7 @@
921934
\item smarter use of the element cache in sparse matrices
922935
}
923936
\item Aligned OpenMP flags in the RcppArmadillo.package.skeleton
924-
used Makevars{,.win} to not use one C and C++ flag.
937+
used Makevars(,.win) to not use one C and C++ flag.
925938
}
926939
}
927940

inst/include/armadillo_bits/arma_version.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323

2424
#define ARMA_VERSION_MAJOR 12
2525
#define ARMA_VERSION_MINOR 6
26-
#define ARMA_VERSION_PATCH 5
26+
#define ARMA_VERSION_PATCH 6
2727
#define ARMA_VERSION_NAME "Cortisol Retox"
2828

2929

inst/include/armadillo_bits/sp_auxlib_bones.hpp

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -158,6 +158,31 @@ class sp_auxlib
158158

159159

160160

161+
template<typename eT>
162+
struct eigs_randu_filler
163+
{
164+
std::mt19937_64 local_engine;
165+
std::uniform_real_distribution<eT> local_u_distr;
166+
167+
inline eigs_randu_filler();
168+
169+
inline void fill(podarray<eT>& X, const uword N);
170+
};
171+
172+
173+
template<typename T>
174+
struct eigs_randu_filler< std::complex<T> >
175+
{
176+
std::mt19937_64 local_engine;
177+
std::uniform_real_distribution<T> local_u_distr;
178+
179+
inline eigs_randu_filler();
180+
181+
inline void fill(podarray< std::complex<T> >& X, const uword N);
182+
};
183+
184+
185+
161186
#if defined(ARMA_USE_SUPERLU)
162187

163188
class superlu_supermatrix_wrangler

inst/include/armadillo_bits/sp_auxlib_meat.hpp

Lines changed: 89 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1921,7 +1921,9 @@ sp_auxlib::run_aupd_plain
19211921
n = X.n_rows; // The size of the matrix (should already be set outside).
19221922
blas_int nev = n_eigvals;
19231923

1924-
resid.zeros(n);
1924+
// resid.zeros(n);
1925+
eigs_randu_filler<T> randu_filler;
1926+
randu_filler.fill(resid, n); // use deterministic starting point
19251927

19261928
// Two contraints on NCV: (NCV > NEV) for sym problems or
19271929
// (NCV > NEV + 2) for gen problems and (NCV <= N)
@@ -1956,7 +1958,8 @@ sp_auxlib::run_aupd_plain
19561958
// Real work array of length lworkl.
19571959
workl.zeros(lworkl);
19581960

1959-
info = 0; // Set to 0 initially to use random initial vector.
1961+
// info = 0; // resid to be filled with random values by ARPACK (non-deterministic)
1962+
info = 1; // resid is already filled with random values (deterministic)
19601963

19611964
// All the parameters have been set or created. Time to loop a lot.
19621965
while(ido != 99)
@@ -2109,7 +2112,9 @@ sp_auxlib::run_aupd_shiftinvert
21092112
n = X.n_rows; // The size of the matrix (should already be set outside).
21102113
blas_int nev = n_eigvals;
21112114

2112-
resid.zeros(n);
2115+
// resid.zeros(n);
2116+
eigs_randu_filler<T> randu_filler;
2117+
randu_filler.fill(resid, n); // use deterministic starting point
21132118

21142119
// Two contraints on NCV: (NCV > NEV) for sym problems or
21152120
// (NCV > NEV + 2) for gen problems and (NCV <= N)
@@ -2147,7 +2152,8 @@ sp_auxlib::run_aupd_shiftinvert
21472152
// Real work array of length lworkl.
21482153
workl.zeros(lworkl);
21492154

2150-
info = 0; // Set to 0 initially to use random initial vector.
2155+
// info = 0; // resid to be filled with random values by ARPACK (non-deterministic)
2156+
info = 1; // resid is already filled with random values (deterministic)
21512157

21522158
superlu_opts superlu_opts_default;
21532159
superlu::superlu_options_t options;
@@ -2439,6 +2445,85 @@ sp_auxlib::rudimentary_sym_check(const SpMat< std::complex<T> >& X)
24392445

24402446

24412447

2448+
//
2449+
2450+
2451+
2452+
template<typename eT>
2453+
inline
2454+
eigs_randu_filler<eT>::eigs_randu_filler()
2455+
{
2456+
arma_extra_debug_sigprint();
2457+
2458+
typedef typename std::mt19937_64::result_type local_seed_type;
2459+
2460+
local_engine.seed(local_seed_type(123));
2461+
2462+
typedef typename std::uniform_real_distribution<eT>::param_type local_param_type;
2463+
2464+
local_u_distr.param(local_param_type(-1.0, +1.0));
2465+
}
2466+
2467+
2468+
template<typename eT>
2469+
inline
2470+
void
2471+
eigs_randu_filler<eT>::fill(podarray<eT>& X, const uword N)
2472+
{
2473+
arma_extra_debug_sigprint();
2474+
2475+
X.set_size(N);
2476+
2477+
eT* X_mem = X.memptr();
2478+
2479+
for(uword i=0; i<N; ++i) { X_mem[i] = eT( local_u_distr(local_engine) ); }
2480+
}
2481+
2482+
2483+
template<typename T>
2484+
inline
2485+
eigs_randu_filler< std::complex<T> >::eigs_randu_filler()
2486+
{
2487+
arma_extra_debug_sigprint();
2488+
2489+
typedef typename std::mt19937_64::result_type local_seed_type;
2490+
2491+
local_engine.seed(local_seed_type(123));
2492+
2493+
typedef typename std::uniform_real_distribution<T>::param_type local_param_type;
2494+
2495+
local_u_distr.param(local_param_type(-1.0, +1.0));
2496+
}
2497+
2498+
2499+
template<typename T>
2500+
inline
2501+
void
2502+
eigs_randu_filler< std::complex<T> >::fill(podarray< std::complex<T> >& X, const uword N)
2503+
{
2504+
arma_extra_debug_sigprint();
2505+
2506+
typedef typename std::complex<T> eT;
2507+
2508+
X.set_size(N);
2509+
2510+
eT* X_mem = X.memptr();
2511+
2512+
for(uword i=0; i<N; ++i)
2513+
{
2514+
eT& X_mem_i = X_mem[i];
2515+
2516+
X_mem_i.real( T(local_u_distr(local_engine)) );
2517+
X_mem_i.imag( T(local_u_distr(local_engine)) );
2518+
}
2519+
}
2520+
2521+
2522+
2523+
//
2524+
2525+
2526+
24422527
#if defined(ARMA_USE_SUPERLU)
24432528

24442529
inline

0 commit comments

Comments
 (0)