From b3649861ba00807f8572388ad1ef4e9218e2b7fb Mon Sep 17 00:00:00 2001 From: Dirk Eddelbuettel Date: Mon, 21 Jul 2025 06:48:50 -0500 Subject: [PATCH 1/2] Sync with Armadillo 14.6.1 --- inst/include/armadillo_bits/Cube_meat.hpp | 12 ++++++------ inst/include/armadillo_bits/Mat_meat.hpp | 12 ++++++------ inst/include/armadillo_bits/arma_config.hpp | 7 +++++++ inst/include/armadillo_bits/arma_version.hpp | 2 +- .../include/armadillo_bits/compiler_setup.hpp | 13 ------------- inst/include/armadillo_bits/config.hpp | 19 ++++++++++++++----- inst/include/armadillo_bits/debug.hpp | 1 + inst/include/armadillo_bits/fn_accu.hpp | 8 ++++---- inst/include/armadillo_bits/fn_conv_to.hpp | 10 +++++----- inst/include/armadillo_bits/op_mean_meat.hpp | 8 ++------ inst/include/armadillo_bits/op_sum_meat.hpp | 4 ++-- .../include/armadillo_bits/sp_auxlib_meat.hpp | 1 + 12 files changed, 49 insertions(+), 48 deletions(-) diff --git a/inst/include/armadillo_bits/Cube_meat.hpp b/inst/include/armadillo_bits/Cube_meat.hpp index 41c6b30a..e9de1e22 100644 --- a/inst/include/armadillo_bits/Cube_meat.hpp +++ b/inst/include/armadillo_bits/Cube_meat.hpp @@ -2872,7 +2872,7 @@ Cube::Cube(const eOpCube& X) init_cold(); - if(is_same_type::value) + if(arma_config::optimise_powexpr && is_same_type::value) { constexpr bool eT_non_int = is_non_integral::value; @@ -2902,7 +2902,7 @@ Cube::operator=(const eOpCube& X) init_warm(X.get_n_rows(), X.get_n_cols(), X.get_n_slices()); - if(is_same_type::value) + if(arma_config::optimise_powexpr && is_same_type::value) { constexpr bool eT_non_int = is_non_integral::value; @@ -2932,7 +2932,7 @@ Cube::operator+=(const eOpCube& X) if(bad_alias) { const Cube tmp(X); return (*this).operator+=(tmp); } - if(is_same_type::value) + if(arma_config::optimise_powexpr && is_same_type::value) { constexpr bool eT_non_int = is_non_integral::value; @@ -2962,7 +2962,7 @@ Cube::operator-=(const eOpCube& X) if(bad_alias) { const Cube tmp(X); return (*this).operator-=(tmp); } - if(is_same_type::value) + if(arma_config::optimise_powexpr && is_same_type::value) { constexpr bool eT_non_int = is_non_integral::value; @@ -2992,7 +2992,7 @@ Cube::operator%=(const eOpCube& X) if(bad_alias) { const Cube tmp(X); return (*this).operator%=(tmp); } - if(is_same_type::value) + if(arma_config::optimise_powexpr && is_same_type::value) { constexpr bool eT_non_int = is_non_integral::value; @@ -3022,7 +3022,7 @@ Cube::operator/=(const eOpCube& X) if(bad_alias) { const Cube tmp(X); return (*this).operator/=(tmp); } - if(is_same_type::value) + if(arma_config::optimise_powexpr && is_same_type::value) { constexpr bool eT_non_int = is_non_integral::value; diff --git a/inst/include/armadillo_bits/Mat_meat.hpp b/inst/include/armadillo_bits/Mat_meat.hpp index 5dc3dbce..e4e0d695 100644 --- a/inst/include/armadillo_bits/Mat_meat.hpp +++ b/inst/include/armadillo_bits/Mat_meat.hpp @@ -5201,7 +5201,7 @@ Mat::Mat(const eOp& X) init_cold(); - if(is_same_type::value) + if(arma_config::optimise_powexpr && is_same_type::value) { constexpr bool eT_non_int = is_non_integral::value; @@ -5231,7 +5231,7 @@ Mat::operator=(const eOp& X) init_warm(X.get_n_rows(), X.get_n_cols()); - if(is_same_type::value) + if(arma_config::optimise_powexpr && is_same_type::value) { constexpr bool eT_non_int = is_non_integral::value; @@ -5260,7 +5260,7 @@ Mat::operator+=(const eOp& X) if(bad_alias) { const Mat tmp(X); return (*this).operator+=(tmp); } - if(is_same_type::value) + if(arma_config::optimise_powexpr && is_same_type::value) { constexpr bool eT_non_int = is_non_integral::value; @@ -5289,7 +5289,7 @@ Mat::operator-=(const eOp& X) if(bad_alias) { const Mat tmp(X); return (*this).operator-=(tmp); } - if(is_same_type::value) + if(arma_config::optimise_powexpr && is_same_type::value) { constexpr bool eT_non_int = is_non_integral::value; @@ -5335,7 +5335,7 @@ Mat::operator%=(const eOp& X) if(bad_alias) { const Mat tmp(X); return (*this).operator%=(tmp); } - if(is_same_type::value) + if(arma_config::optimise_powexpr && is_same_type::value) { constexpr bool eT_non_int = is_non_integral::value; @@ -5364,7 +5364,7 @@ Mat::operator/=(const eOp& X) if(bad_alias) { const Mat tmp(X); return (*this).operator/=(tmp); } - if(is_same_type::value) + if(arma_config::optimise_powexpr && is_same_type::value) { constexpr bool eT_non_int = is_non_integral::value; diff --git a/inst/include/armadillo_bits/arma_config.hpp b/inst/include/armadillo_bits/arma_config.hpp index 892b21ff..a1732edd 100644 --- a/inst/include/armadillo_bits/arma_config.hpp +++ b/inst/include/armadillo_bits/arma_config.hpp @@ -65,6 +65,13 @@ struct arma_config #endif + #if defined(ARMA_OPTIMISE_POWEXPR) + static constexpr bool optimise_powexpr = true; + #else + static constexpr bool optimise_powexpr = false; + #endif + + #if defined(ARMA_CHECK_CONFORMANCE) static constexpr bool check_conform = true; #else diff --git a/inst/include/armadillo_bits/arma_version.hpp b/inst/include/armadillo_bits/arma_version.hpp index 75c7e99c..bbf9b23b 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 14 #define ARMA_VERSION_MINOR 6 -#define ARMA_VERSION_PATCH 0 +#define ARMA_VERSION_PATCH 1 #define ARMA_VERSION_NAME "Caffe Mocha" diff --git a/inst/include/armadillo_bits/compiler_setup.hpp b/inst/include/armadillo_bits/compiler_setup.hpp index 71bdb25a..0cdc3dd2 100644 --- a/inst/include/armadillo_bits/compiler_setup.hpp +++ b/inst/include/armadillo_bits/compiler_setup.hpp @@ -172,10 +172,6 @@ #pragma message("INFO: support for GCC versions older than 8.1 is deprecated") #endif - #if (ARMA_GCC_VERSION >= 170000) - #undef ARMA_IGNORE_DEPRECATED_MARKER - #endif - #define ARMA_GOOD_COMPILER #undef arma_hot @@ -233,12 +229,6 @@ // #pragma message ("using Clang extensions") - #if defined(__clang_major__) && !defined(__apple_build_version__) - #if (__clang_major__ >= 24) - #undef ARMA_IGNORE_DEPRECATED_MARKER - #endif - #endif - #define ARMA_GOOD_COMPILER #if !defined(__has_attribute) @@ -487,9 +477,6 @@ #undef major -// WARNING: option 'ARMA_IGNORE_DEPRECATED_MARKER' is not supported when compiling with gcc 17+ or clang 24+ -// WARNING: disabling deprecation messages is counter-productive - #if defined(ARMA_IGNORE_DEPRECATED_MARKER) #undef arma_deprecated #define arma_deprecated diff --git a/inst/include/armadillo_bits/config.hpp b/inst/include/armadillo_bits/config.hpp index 955dbc13..55de685d 100644 --- a/inst/include/armadillo_bits/config.hpp +++ b/inst/include/armadillo_bits/config.hpp @@ -166,6 +166,11 @@ //// of inv() and inv_sympd() within compound expressions #endif +#if !defined(ARMA_OPTIMISE_POWEXPR) + #define ARMA_OPTIMISE_POWEXPR + //// Comment out the above line to disable optimised handling of pow() +#endif + #if !defined(ARMA_CHECK_CONFORMANCE) #define ARMA_CHECK_CONFORMANCE //// Comment out the above line to disable conformance checks for bounds and size. @@ -211,7 +216,7 @@ #if defined(ARMA_DEFAULT_OSTREAM) - #pragma message ("WARNING: support for ARMA_DEFAULT_OSTREAM is deprecated and will be removed;") + #pragma message ("WARNING: option ARMA_DEFAULT_OSTREAM is deprecated and will be removed;") #pragma message ("WARNING: use ARMA_COUT_STREAM and ARMA_CERR_STREAM instead") #endif @@ -290,7 +295,7 @@ // for compatibility with earlier versions of Armadillo #if defined(ARMA_DONT_USE_CXX11_MUTEX) - #pragma message ("WARNING: support for ARMA_DONT_USE_CXX11_MUTEX is deprecated and will be removed;") + #pragma message ("WARNING: option ARMA_DONT_USE_CXX11_MUTEX is deprecated and will be removed;") #pragma message ("WARNING: use ARMA_DONT_USE_STD_MUTEX instead") #undef ARMA_USE_STD_MUTEX #endif @@ -333,6 +338,10 @@ #undef ARMA_OPTIMISE_INVEXPR #endif +#if defined(ARMA_DONT_OPTIMISE_POWEXPR) + #undef ARMA_OPTIMISE_POWEXPR +#endif + #if defined(ARMA_DONT_CHECK_CONFORMANCE) #if defined(ARMA_CHECK_CONFORMANCE) && (ARMA_WARN_LEVEL >= 2) #pragma message ("WARNING: conformance checks disabled") @@ -378,12 +387,12 @@ #undef ARMA_CRIPPLED_LAPACK #endif -// WARNING: option ARMA_IGNORE_DEPRECATED_MARKER will be removed -// WARNING: option ARMA_CRIPPLED_LAPACK will be removed +// WARNING: option ARMA_IGNORE_DEPRECATED_MARKER is deprecated and will be removed +// WARNING: option ARMA_CRIPPLED_LAPACK is deprecated and will be removed #if defined(ARMA_CRIPPLED_LAPACK) #if (!defined(ARMA_IGNORE_DEPRECATED_MARKER)) - #pragma message ("option ARMA_CRIPPLED_LAPACK is deprecated and will be removed") + #pragma message ("WARNING: option ARMA_CRIPPLED_LAPACK is deprecated and will be removed") #endif #endif diff --git a/inst/include/armadillo_bits/debug.hpp b/inst/include/armadillo_bits/debug.hpp index e2a51731..0986585f 100644 --- a/inst/include/armadillo_bits/debug.hpp +++ b/inst/include/armadillo_bits/debug.hpp @@ -1441,6 +1441,7 @@ inline void arma_debug_check(bool state, const char* msg) { arma_conform_check( out << "\n@ arma_config::optimise_band = " << arma_config::optimise_band; out << "\n@ arma_config::optimise_sym = " << arma_config::optimise_sym; out << "\n@ arma_config::optimise_invexpr = " << arma_config::optimise_invexpr; + out << "\n@ arma_config::optimise_powexpr = " << arma_config::optimise_powexpr; out << "\n@ arma_config::check_conform = " << arma_config::check_conform; out << "\n@ arma_config::check_nonfinite = " << arma_config::check_nonfinite; out << "\n@ arma_config::fast_math = " << arma_config::fast_math; diff --git a/inst/include/armadillo_bits/fn_accu.hpp b/inst/include/armadillo_bits/fn_accu.hpp index 250f2785..46dfa02f 100644 --- a/inst/include/armadillo_bits/fn_accu.hpp +++ b/inst/include/armadillo_bits/fn_accu.hpp @@ -407,14 +407,14 @@ accu(const eOp& expr) typedef eOp expr_type; - if(expr.aux == eT(2)) + if(arma_config::optimise_powexpr && (expr.aux == eT(2))) { typedef eOp modified_expr_type; return accu( reinterpret_cast< const modified_expr_type& >(expr) ); } - if((expr.aux == eT(0.5)) && is_non_integral::value) + if(arma_config::optimise_powexpr && (expr.aux == eT(0.5)) && is_non_integral::value) { typedef eOp modified_expr_type; @@ -1048,14 +1048,14 @@ accu(const eOpCube& expr) typedef eOpCube expr_type; - if(expr.aux == eT(2)) + if(arma_config::optimise_powexpr && (expr.aux == eT(2))) { typedef eOpCube modified_expr_type; return accu( reinterpret_cast< const modified_expr_type& >(expr) ); } - if((expr.aux == eT(0.5)) && is_non_integral::value) + if(arma_config::optimise_powexpr && (expr.aux == eT(0.5)) && is_non_integral::value) { typedef eOpCube modified_expr_type; diff --git a/inst/include/armadillo_bits/fn_conv_to.hpp b/inst/include/armadillo_bits/fn_conv_to.hpp index 15985121..41d99ba7 100644 --- a/inst/include/armadillo_bits/fn_conv_to.hpp +++ b/inst/include/armadillo_bits/fn_conv_to.hpp @@ -29,19 +29,19 @@ class conv_to public: template - arma_frown("use as_scalar() instead") inline static out_eT from(const in_eT& in, const typename arma_scalar_only::result* junk = nullptr); + arma_frown("replace conv_to<...>::from(X) with as_scalar(X)") inline static out_eT from(const in_eT& in, const typename arma_scalar_only::result* junk = nullptr); template - arma_frown("use as_scalar() instead") inline static out_eT from(const Base& in, const typename arma_not_cx::result* junk = nullptr); + arma_frown("replace conv_to<...>::from(X) with as_scalar(X)") inline static out_eT from(const Base& in, const typename arma_not_cx::result* junk = nullptr); template - arma_frown("use as_scalar() instead") inline static out_eT from(const Base& in, const typename arma_cx_only::result* junk = nullptr); + arma_frown("replace conv_to<...>::from(X) with as_scalar(X)") inline static out_eT from(const Base& in, const typename arma_cx_only::result* junk = nullptr); template - arma_frown("use as_scalar() instead") inline static out_eT from(const BaseCube& in, const typename arma_not_cx::result* junk = nullptr); + arma_frown("replace conv_to<...>::from(X) with as_scalar(X)") inline static out_eT from(const BaseCube& in, const typename arma_not_cx::result* junk = nullptr); template - arma_frown("use as_scalar() instead") inline static out_eT from(const BaseCube& in, const typename arma_cx_only::result* junk = nullptr); + arma_frown("replace conv_to<...>::from(X) with as_scalar(X)") inline static out_eT from(const BaseCube& in, const typename arma_cx_only::result* junk = nullptr); }; diff --git a/inst/include/armadillo_bits/op_mean_meat.hpp b/inst/include/armadillo_bits/op_mean_meat.hpp index 354ffc73..6f7937a2 100644 --- a/inst/include/armadillo_bits/op_mean_meat.hpp +++ b/inst/include/armadillo_bits/op_mean_meat.hpp @@ -88,9 +88,7 @@ op_mean::apply_noalias(Mat& out, const Mat& X, const uword dim) for(uword col=0; col < X_n_cols; ++col) { - const eT* col_mem = X.colptr(col); - - for(uword row=0; row < X_n_rows; ++row) { out_mem[row] += col_mem[row]; } + arrayops::inplace_plus(out_mem, X.colptr(col), X_n_rows); } out /= T(X_n_cols); @@ -193,9 +191,7 @@ op_mean::apply_noalias(Cube& out, const Cube& X, const uword dim) for(uword col=0; col < X_n_cols; ++col) { - const eT* col_mem = X.slice_colptr(slice,col); - - for(uword row=0; row < X_n_rows; ++row) { out_mem[row] += col_mem[row]; } + arrayops::inplace_plus(out_mem, X.slice_colptr(slice,col), X_n_rows); } for(uword row=0; row < X_n_rows; ++row) { out_mem[row] /= T(X_n_cols); } diff --git a/inst/include/armadillo_bits/op_sum_meat.hpp b/inst/include/armadillo_bits/op_sum_meat.hpp index d2f1eb8a..7eb044d5 100644 --- a/inst/include/armadillo_bits/op_sum_meat.hpp +++ b/inst/include/armadillo_bits/op_sum_meat.hpp @@ -154,7 +154,7 @@ op_sum::apply(Mat& out, const Op< eOp, op_su typedef typename T1::elem_type eT; - if(in.m.aux == eT(2)) + if(arma_config::optimise_powexpr && (in.m.aux == eT(2))) { typedef Op< eOp, op_sum > modified_whole_expr_type; @@ -163,7 +163,7 @@ op_sum::apply(Mat& out, const Op< eOp, op_su return; } - if((in.m.aux == eT(0.5)) && is_non_integral::value) + if(arma_config::optimise_powexpr && (in.m.aux == eT(0.5)) && is_non_integral::value) { typedef Op< eOp, op_sum > modified_whole_expr_type; diff --git a/inst/include/armadillo_bits/sp_auxlib_meat.hpp b/inst/include/armadillo_bits/sp_auxlib_meat.hpp index 81aacce0..585c9f33 100644 --- a/inst/include/armadillo_bits/sp_auxlib_meat.hpp +++ b/inst/include/armadillo_bits/sp_auxlib_meat.hpp @@ -2028,6 +2028,7 @@ sp_auxlib::run_aupd_plain arma_ignore(n_eigvals); arma_ignore(which); arma_ignore(X); + arma_ignore(Xst); arma_ignore(sym); arma_ignore(n); arma_ignore(tol); From 3c6e8de49a9d1ddaaaee94a9226fdbb6e21565f0 Mon Sep 17 00:00:00 2001 From: Dirk Eddelbuettel Date: Mon, 21 Jul 2025 06:53:10 -0500 Subject: [PATCH 2/2] RcppArmadillo 14.6.1-1 --- ChangeLog | 9 +++++++++ DESCRIPTION | 4 ++-- configure | 18 +++++++++--------- configure.ac | 2 +- inst/NEWS.Rd | 11 +++++++++++ 5 files changed, 32 insertions(+), 12 deletions(-) diff --git a/ChangeLog b/ChangeLog index d73006e9..1cb37655 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,12 @@ +2025-07-21 Dirk Eddelbuettel + + * DESCRIPTION (Version, Date): RcppArmadillo 14.6.1-1 + * inst/NEWS.Rd: Idem + * configure.ac: Idem + * configure: Idem + + * inst/include/armadillo_bits/: Armadillo 14.6.1 + 2025-07-02 Dirk Eddelbuettel * DESCRIPTION (Version, Date): RcppArmadillo 14.6.0-1 diff --git a/DESCRIPTION b/DESCRIPTION index 5cd56ea7..24e03154 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,8 +1,8 @@ Package: RcppArmadillo Type: Package Title: 'Rcpp' Integration for the 'Armadillo' Templated Linear Algebra Library -Version: 14.6.0-1 -Date: 2025-07-02 +Version: 14.6.1-1 +Date: 2025-07-21 Authors@R: c(person("Dirk", "Eddelbuettel", role = c("aut", "cre"), email = "edd@debian.org", comment = c(ORCID = "0000-0001-6419-907X")), person("Romain", "Francois", role = "aut", diff --git a/configure b/configure index a0061227..9a656589 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.72 for RcppArmadillo 14.6.0-1. +# Generated by GNU Autoconf 2.72 for RcppArmadillo 14.6.1-1. # # Report bugs to . # @@ -603,8 +603,8 @@ MAKEFLAGS= # Identity of this package. PACKAGE_NAME='RcppArmadillo' PACKAGE_TARNAME='rcpparmadillo' -PACKAGE_VERSION='14.6.0-1' -PACKAGE_STRING='RcppArmadillo 14.6.0-1' +PACKAGE_VERSION='14.6.1-1' +PACKAGE_STRING='RcppArmadillo 14.6.1-1' PACKAGE_BUGREPORT='edd@debian.org' PACKAGE_URL='' @@ -1222,7 +1222,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 14.6.0-1 to adapt to many kinds of systems. +'configure' configures RcppArmadillo 14.6.1-1 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -1284,7 +1284,7 @@ fi if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of RcppArmadillo 14.6.0-1:";; + short | recursive ) echo "Configuration of RcppArmadillo 14.6.1-1:";; esac cat <<\_ACEOF @@ -1365,7 +1365,7 @@ fi test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF -RcppArmadillo configure 14.6.0-1 +RcppArmadillo configure 14.6.1-1 generated by GNU Autoconf 2.72 Copyright (C) 2023 Free Software Foundation, Inc. @@ -1481,7 +1481,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 14.6.0-1, which was +It was created by RcppArmadillo $as_me 14.6.1-1, which was generated by GNU Autoconf 2.72. Invocation command line was $ $0$ac_configure_args_raw @@ -3980,7 +3980,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 14.6.0-1, which was +This file was extended by RcppArmadillo $as_me 14.6.1-1, which was generated by GNU Autoconf 2.72. Invocation command line was CONFIG_FILES = $CONFIG_FILES @@ -4035,7 +4035,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 14.6.0-1 +RcppArmadillo config.status 14.6.1-1 configured by $0, generated by GNU Autoconf 2.72, with options \\"\$ac_cs_config\\" diff --git a/configure.ac b/configure.ac index 9776afcf..340c7bc0 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],[14.6.0-1],[edd@debian.org]) +AC_INIT([RcppArmadillo],[14.6.1-1],[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 03014978..09edc625 100644 --- a/inst/NEWS.Rd +++ b/inst/NEWS.Rd @@ -3,6 +3,17 @@ \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 14.6.1-1 (2025-07-21) (GitHub Only)}{ + \itemize{ + \item Upgraded to Armadillo release 14.6.1 (Caffe Mocha) + \itemize{ + \item Fix for speed regression in \code{mean()} + \item Fix for detection of compiler configuration + \item Use of \code{pow} optimization now optional + } + } +} + \section{Changes in RcppArmadillo version 14.6.0-1 (2025-07-02)}{ \itemize{ \item Upgraded to Armadillo release 14.6.0 (Caffe Mocha)