diff --git a/ChangeLog b/ChangeLog index 4ed4af7b..ab86ac72 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,12 @@ +2025-10-20 Dirk Eddelbuettel + + * DESCRIPTION (Version, Date): RcppArmadillo 15.2.0-0 + * inst/NEWS.Rd: Idem + * configure.ac: Idem + * configure: Idem + + * inst/include/current/: Sync with Armadillo 15.2 + 2025-10-17 Dirk Eddelbuettel * src/RcppArmadillo.cpp (armadillo_version_typed): Added diff --git a/configure b/configure index 706b82c9..4f0e79c6 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 15.1.99-1. +# Generated by GNU Autoconf 2.72 for RcppArmadillo 15.2.0-0. # # Report bugs to . # @@ -603,8 +603,8 @@ MAKEFLAGS= # Identity of this package. PACKAGE_NAME='RcppArmadillo' PACKAGE_TARNAME='rcpparmadillo' -PACKAGE_VERSION='15.1.99-1' -PACKAGE_STRING='RcppArmadillo 15.1.99-1' +PACKAGE_VERSION='15.2.0-0' +PACKAGE_STRING='RcppArmadillo 15.2.0-0' PACKAGE_BUGREPORT='edd@debian.org' PACKAGE_URL='' @@ -1221,7 +1221,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 15.1.99-1 to adapt to many kinds of systems. +'configure' configures RcppArmadillo 15.2.0-0 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -1283,7 +1283,7 @@ fi if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of RcppArmadillo 15.1.99-1:";; + short | recursive ) echo "Configuration of RcppArmadillo 15.2.0-0:";; esac cat <<\_ACEOF @@ -1364,7 +1364,7 @@ fi test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF -RcppArmadillo configure 15.1.99-1 +RcppArmadillo configure 15.2.0-0 generated by GNU Autoconf 2.72 Copyright (C) 2023 Free Software Foundation, Inc. @@ -1480,7 +1480,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 15.1.99-1, which was +It was created by RcppArmadillo $as_me 15.2.0-0, which was generated by GNU Autoconf 2.72. Invocation command line was $ $0$ac_configure_args_raw @@ -3977,7 +3977,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 15.1.99-1, which was +This file was extended by RcppArmadillo $as_me 15.2.0-0, which was generated by GNU Autoconf 2.72. Invocation command line was CONFIG_FILES = $CONFIG_FILES @@ -4032,7 +4032,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 15.1.99-1 +RcppArmadillo config.status 15.2.0-0 configured by $0, generated by GNU Autoconf 2.72, with options \\"\$ac_cs_config\\" diff --git a/configure.ac b/configure.ac index 91357046..9c315336 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],[15.1.99-1],[edd@debian.org]) +AC_INIT([RcppArmadillo],[15.2.0-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 0301b2ac..ccfed639 100644 --- a/inst/NEWS.Rd +++ b/inst/NEWS.Rd @@ -3,9 +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 15.1.99-1 (2025-10-16) (GitHub Only)}{ +\section{Changes in RcppArmadillo version 15.2.0-0 (2025-10-20) (GitHub Only)}{ \itemize{ - \item Upgraded to Armadillo release 15.2.0 (RC1 right now) + \item Upgraded to Armadillo release 15.2.0 (Medium Roast Deluxe) + \itemize{ + \item Added \code{rande()} for generating matrices with elements from + exponential distributions + \item \code{shift()} has been deprecated in favour of + \code{circshift()}, for consistency with Matlab/Octave + \item Reworked detection of aliasing, leading to more efficient + compiled code + } } } diff --git a/inst/include/current/armadillo_bits/Col_meat.hpp b/inst/include/current/armadillo_bits/Col_meat.hpp index 6b318c00..ba41bc41 100644 --- a/inst/include/current/armadillo_bits/Col_meat.hpp +++ b/inst/include/current/armadillo_bits/Col_meat.hpp @@ -1264,6 +1264,13 @@ Col::end_row(const uword row_num) const + + + +// + + + template template arma_inline @@ -1859,6 +1866,10 @@ Col::fixed::ones() +// + + + template inline Col::Col(const arma_fixed_indicator&, const uword in_n_elem, const eT* in_mem) diff --git a/inst/include/current/armadillo_bits/Cube_meat.hpp b/inst/include/current/armadillo_bits/Cube_meat.hpp index 11e31e04..62e2c562 100644 --- a/inst/include/current/armadillo_bits/Cube_meat.hpp +++ b/inst/include/current/armadillo_bits/Cube_meat.hpp @@ -3148,7 +3148,7 @@ Cube::Cube(const GlueCube& X) { arma_debug_sigprint_this(this); - this->operator=(X); + (*this).operator=(X); } diff --git a/inst/include/current/armadillo_bits/Mat_bones.hpp b/inst/include/current/armadillo_bits/Mat_bones.hpp index a0e71c9f..d2839d9a 100644 --- a/inst/include/current/armadillo_bits/Mat_bones.hpp +++ b/inst/include/current/armadillo_bits/Mat_bones.hpp @@ -120,7 +120,7 @@ class Mat : public Base< eT, Mat > template inline explicit Mat(const Base& A, const Base& B, const arma_vec_indicator&, const uhword in_vec_state); template inline explicit Mat(const Base& A, const Base& B); - inline explicit Mat(const subview& X, const bool use_colmem); // only to be used by the quasi_unwrap class + inline explicit Mat(const subview& X, const bool reuse_mem); // only to be used by quasi_unwrap and partial_unwrap inline Mat(const subview& X, const arma_vec_indicator&, const uhword in_vec_state); inline Mat(const subview& X); diff --git a/inst/include/current/armadillo_bits/Mat_meat.hpp b/inst/include/current/armadillo_bits/Mat_meat.hpp index 354eaf70..5b852608 100644 --- a/inst/include/current/armadillo_bits/Mat_meat.hpp +++ b/inst/include/current/armadillo_bits/Mat_meat.hpp @@ -2021,18 +2021,18 @@ Mat::Mat(const Base::pod_type,T1>& A, const Base inline -Mat::Mat(const subview& X, const bool use_colmem) +Mat::Mat(const subview& X, const bool reuse_mem) : n_rows(X.n_rows) , n_cols(X.n_cols) , n_elem(X.n_elem) , n_alloc(0) , vec_state(0) - , mem_state(use_colmem ? 3 : 0) - , mem (use_colmem ? X.colptr(0) : nullptr) + , mem_state(reuse_mem ? 3 : 0 ) + , mem (reuse_mem ? X.colptr(0) : nullptr) { arma_debug_sigprint_this(this); - if(use_colmem) + if(reuse_mem) { arma_debug_print("Mat::Mat(): using existing memory in a submatrix"); } diff --git a/inst/include/current/armadillo_bits/Row_bones.hpp b/inst/include/current/armadillo_bits/Row_bones.hpp index 908e196c..fdb9612f 100644 --- a/inst/include/current/armadillo_bits/Row_bones.hpp +++ b/inst/include/current/armadillo_bits/Row_bones.hpp @@ -85,8 +85,6 @@ class Row : public Mat template inline explicit Row(const Base& A, const Base& B); - inline explicit Row(const subview& X, const bool use_colmem); // only to be used by the quasi_unwrap class - template inline Row(const BaseCube& X); template inline Row& operator=(const BaseCube& X); @@ -171,6 +169,9 @@ class Row : public Mat inline const_row_iterator end_row (const uword row_num) const; + inline explicit Row(const subview& X, const bool reuse_mem); // only to be used by the partial_unwrap class + + template class fixed; diff --git a/inst/include/current/armadillo_bits/Row_meat.hpp b/inst/include/current/armadillo_bits/Row_meat.hpp index 012d85ef..987a0f48 100644 --- a/inst/include/current/armadillo_bits/Row_meat.hpp +++ b/inst/include/current/armadillo_bits/Row_meat.hpp @@ -610,16 +610,6 @@ Row::Row -template -inline -Row::Row(const subview& X, const bool use_colmem) - : Mat(X, use_colmem) - { - arma_debug_sigprint(); - } - - - template template inline @@ -1274,6 +1264,20 @@ Row::end_row(const uword row_num) const +template +inline +Row::Row(const subview& X, const bool reuse_mem) + : Mat(X, reuse_mem) + { + arma_debug_sigprint_this(this); + } + + + +// + + + template template arma_inline @@ -1869,6 +1873,10 @@ Row::fixed::ones() +// + + + template inline Row::Row(const arma_fixed_indicator&, const uword in_n_elem, const eT* in_mem) diff --git a/inst/include/current/armadillo_bits/arma_version.hpp b/inst/include/current/armadillo_bits/arma_version.hpp index 99100dd5..5bedd952 100644 --- a/inst/include/current/armadillo_bits/arma_version.hpp +++ b/inst/include/current/armadillo_bits/arma_version.hpp @@ -22,9 +22,9 @@ #define ARMA_VERSION_MAJOR 15 -#define ARMA_VERSION_MINOR 1 -#define ARMA_VERSION_PATCH 91 -#define ARMA_VERSION_NAME "15.2-RC1" +#define ARMA_VERSION_MINOR 2 +#define ARMA_VERSION_PATCH 0 +#define ARMA_VERSION_NAME "Medium Roast Deluxe" diff --git a/inst/include/current/armadillo_bits/field_meat.hpp b/inst/include/current/armadillo_bits/field_meat.hpp index b726886d..fd26b6ff 100644 --- a/inst/include/current/armadillo_bits/field_meat.hpp +++ b/inst/include/current/armadillo_bits/field_meat.hpp @@ -94,7 +94,7 @@ field::field(const subview_field& X) { arma_debug_sigprint_this(this); - this->operator=(X); + (*this).operator=(X); } diff --git a/inst/include/current/armadillo_bits/op_accu_bones.hpp b/inst/include/current/armadillo_bits/op_accu_bones.hpp index ad99826b..6cbd860f 100644 --- a/inst/include/current/armadillo_bits/op_accu_bones.hpp +++ b/inst/include/current/armadillo_bits/op_accu_bones.hpp @@ -65,6 +65,9 @@ struct op_accu_mat template static inline eT apply(const subview_col& X); + + template + static inline eT apply(const subview_row& X); }; diff --git a/inst/include/current/armadillo_bits/op_accu_meat.hpp b/inst/include/current/armadillo_bits/op_accu_meat.hpp index e3559170..b958c31d 100644 --- a/inst/include/current/armadillo_bits/op_accu_meat.hpp +++ b/inst/include/current/armadillo_bits/op_accu_meat.hpp @@ -121,20 +121,6 @@ op_accu_mat::apply(const T1& X) return arrayops::accumulate(U.M.memptr(), U.M.n_elem); } - if(is_subview_row::value) - { - typedef typename T1::elem_type eT; - - const subview_row& sv = reinterpret_cast< const subview_row& >(X); - - if(sv.m.n_rows == 1) - { - const eT* sv_mem = &(sv.m.at(sv.aux_col1)); - - return arrayops::accumulate(sv_mem, sv.n_elem); - } - } - const Proxy P(X); return (Proxy::use_at) ? op_accu_mat::apply_proxy_at(P) : op_accu_mat::apply_proxy_linear(P); @@ -616,19 +602,7 @@ op_accu_mat::apply(const subview& X) const uword X_n_rows = X.n_rows; const uword X_n_cols = X.n_cols; - if(X_n_rows == 1) - { - const Mat& m = X.m; - - const uword col_offset = X.aux_col1; - const uword row_offset = X.aux_row1; - - eT val = eT(0); - - for(uword i=0; i < X_n_cols; ++i) { val += m.at(row_offset, col_offset + i); } - - return val; - } + if(X_n_rows == 1) { return op_accu_mat::apply( static_cast< const subview_row& >(X) ); } if(X_n_cols == 1) { return arrayops::accumulate( X.colptr(0), X_n_rows ); } @@ -656,6 +630,39 @@ op_accu_mat::apply(const subview_col& X) +template +inline +eT +op_accu_mat::apply(const subview_row& X) + { + arma_debug_sigprint(); + + const uword X_m_n_rows = X.m.n_rows; + const uword X_n_cols = X.n_cols; + + const eT* row_mem = &(X.m.at(X.aux_row1,X.aux_col1)); + + eT val1 = eT(0); + eT val2 = eT(0); + + uword j; + + for(j=1; j < X_n_cols; j+=2) + { + val1 += (*row_mem); row_mem += X_m_n_rows; + val2 += (*row_mem); row_mem += X_m_n_rows; + } + + if((j-1) < X_n_cols) + { + val1 += (*row_mem); + } + + return val1 + val2; + } + + + // diff --git a/inst/include/current/armadillo_bits/subview_bones.hpp b/inst/include/current/armadillo_bits/subview_bones.hpp index a00ecdb7..06cf9a56 100644 --- a/inst/include/current/armadillo_bits/subview_bones.hpp +++ b/inst/include/current/armadillo_bits/subview_bones.hpp @@ -171,8 +171,8 @@ class subview : public Base< eT, subview > inline subview rows(const uword in_row1, const uword in_row2); inline const subview rows(const uword in_row1, const uword in_row2) const; - inline subview cols(const uword in_col1, const uword in_col2); - inline const subview cols(const uword in_col1, const uword in_col2) const; + inline subview cols(const uword in_col1, const uword in_col2); // deliberately not returning subview_cols + inline const subview cols(const uword in_col1, const uword in_col2) const; // deliberately not returning subview_cols inline subview submat(const uword in_row1, const uword in_col1, const uword in_row2, const uword in_col2); inline const subview submat(const uword in_row1, const uword in_col1, const uword in_row2, const uword in_col2) const; diff --git a/inst/include/current/armadillo_bits/unwrap.hpp b/inst/include/current/armadillo_bits/unwrap.hpp index 0026afd0..4d64744a 100644 --- a/inst/include/current/armadillo_bits/unwrap.hpp +++ b/inst/include/current/armadillo_bits/unwrap.hpp @@ -396,7 +396,7 @@ struct quasi_unwrap< subview_row > static constexpr bool has_orig_mem = false; // NOTE: set to false as this is the general case; original memory is only used when the subview is a contiguous chunk template - arma_inline bool is_alias(const Mat& X) const { return (sv.m.n_rows == 1) ? (void_ptr(&X) == void_ptr(&(sv.m))) : false; } + arma_inline bool is_alias(const Mat& X) const { return (is_same_type::yes) && ( (sv.m.n_rows == 1) ? (void_ptr(&X) == void_ptr(&(sv.m))) : false ); } }; @@ -1428,7 +1428,7 @@ struct partial_unwrap< subview_cols > template struct partial_unwrap< subview_row > { - typedef Mat stored_type; + typedef Row stored_type; inline partial_unwrap(const subview_row& A) @@ -1445,10 +1445,10 @@ struct partial_unwrap< subview_row > static constexpr bool do_trans = false; static constexpr bool do_times = false; - static constexpr bool is_fast = true; + static constexpr bool is_fast = false; // can't determine at compile time that memory is reused const subview_row& sv; - const Mat M; + const Row M; };