Skip to content

Commit 66dcdb5

Browse files
authored
Merge pull request #467 from RcppCore/feature/14.4.3
Release 14.4.3
2 parents aba93fb + 769a34d commit 66dcdb5

17 files changed

+142
-171
lines changed

ChangeLog

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,12 @@
1+
2025-05-21 Dirk Eddelbuettel <[email protected]>
2+
3+
* DESCRIPTION (Version, Date): RcppArmadillo 14.4.3-1
4+
* inst/NEWS.Rd: Idem
5+
* configure.ac: Idem
6+
* configure: Idem
7+
8+
* inst/include/armadillo_bits/: Sync with Armadillo 14.4.3
9+
110
2025-04-25 Dirk Eddelbuettel <[email protected]>
211

312
* DESCRIPTION (Version, Date): RcppArmadillo 14.4.2-1

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: 14.4.2-1
5-
Date: 2025-04-25
4+
Version: 14.4.3-1
5+
Date: 2025-05-21
66
Authors@R: c(person("Dirk", "Eddelbuettel", role = c("aut", "cre"), email = "[email protected]",
77
comment = c(ORCID = "0000-0001-6419-907X")),
88
person("Romain", "Francois", role = "aut",

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.72 for RcppArmadillo 14.4.2-1.
3+
# Generated by GNU Autoconf 2.72 for RcppArmadillo 14.4.3-1.
44
#
55
# Report bugs to <[email protected]>.
66
#
@@ -603,8 +603,8 @@ MAKEFLAGS=
603603
# Identity of this package.
604604
PACKAGE_NAME='RcppArmadillo'
605605
PACKAGE_TARNAME='rcpparmadillo'
606-
PACKAGE_VERSION='14.4.2-1'
607-
PACKAGE_STRING='RcppArmadillo 14.4.2-1'
606+
PACKAGE_VERSION='14.4.3-1'
607+
PACKAGE_STRING='RcppArmadillo 14.4.3-1'
608608
PACKAGE_BUGREPORT='[email protected]'
609609
PACKAGE_URL=''
610610

@@ -1222,7 +1222,7 @@ if test "$ac_init_help" = "long"; then
12221222
# Omit some internal or obsolete options to make the list less imposing.
12231223
# This message is too long to be a string in the A/UX 3.1 sh.
12241224
cat <<_ACEOF
1225-
'configure' configures RcppArmadillo 14.4.2-1 to adapt to many kinds of systems.
1225+
'configure' configures RcppArmadillo 14.4.3-1 to adapt to many kinds of systems.
12261226
12271227
Usage: $0 [OPTION]... [VAR=VALUE]...
12281228
@@ -1284,7 +1284,7 @@ fi
12841284

12851285
if test -n "$ac_init_help"; then
12861286
case $ac_init_help in
1287-
short | recursive ) echo "Configuration of RcppArmadillo 14.4.2-1:";;
1287+
short | recursive ) echo "Configuration of RcppArmadillo 14.4.3-1:";;
12881288
esac
12891289
cat <<\_ACEOF
12901290
@@ -1365,7 +1365,7 @@ fi
13651365
test -n "$ac_init_help" && exit $ac_status
13661366
if $ac_init_version; then
13671367
cat <<\_ACEOF
1368-
RcppArmadillo configure 14.4.2-1
1368+
RcppArmadillo configure 14.4.3-1
13691369
generated by GNU Autoconf 2.72
13701370
13711371
Copyright (C) 2023 Free Software Foundation, Inc.
@@ -1481,7 +1481,7 @@ cat >config.log <<_ACEOF
14811481
This file contains any messages produced by compilers while
14821482
running configure, to aid debugging if configure makes a mistake.
14831483
1484-
It was created by RcppArmadillo $as_me 14.4.2-1, which was
1484+
It was created by RcppArmadillo $as_me 14.4.3-1, which was
14851485
generated by GNU Autoconf 2.72. Invocation command line was
14861486
14871487
$ $0$ac_configure_args_raw
@@ -3980,7 +3980,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
39803980
# report actual input values of CONFIG_FILES etc. instead of their
39813981
# values after options handling.
39823982
ac_log="
3983-
This file was extended by RcppArmadillo $as_me 14.4.2-1, which was
3983+
This file was extended by RcppArmadillo $as_me 14.4.3-1, which was
39843984
generated by GNU Autoconf 2.72. Invocation command line was
39853985
39863986
CONFIG_FILES = $CONFIG_FILES
@@ -4035,7 +4035,7 @@ ac_cs_config_escaped=`printf "%s\n" "$ac_cs_config" | sed "s/^ //; s/'/'\\\\\\\\
40354035
cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
40364036
ac_cs_config='$ac_cs_config_escaped'
40374037
ac_cs_version="\\
4038-
RcppArmadillo config.status 14.4.2-1
4038+
RcppArmadillo config.status 14.4.3-1
40394039
configured by $0, generated by GNU Autoconf 2.72,
40404040
with options \\"\$ac_cs_config\\"
40414041

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],[14.4.2-1],[[email protected]])
14+
AC_INIT([RcppArmadillo],[14.4.3-1],[[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: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,16 @@
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 14.4.3-1 (2025-05-21)}{
7+
\itemize{
8+
\item Upgraded to Armadillo release 14.4.3 (Filtered Espresso)
9+
\itemize{
10+
\item Fix for several corner cases involving handling of non-finite
11+
elements by sparse matrices
12+
}
13+
}
14+
}
15+
616
\section{Changes in RcppArmadillo version 14.4.2-1 (2025-04-25)}{
717
\itemize{
818
\item Upgraded to Armadillo release 14.4.2 (Filtered Espresso)

inst/include/armadillo_bits/MapMat_meat.hpp

Lines changed: 31 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -970,18 +970,17 @@ MapMat_val<eT>::operator*=(const eT in_val)
970970

971971
if(it != it_end)
972972
{
973-
if(in_val != eT(0))
974-
{
975-
eT& val = (*it).second;
976-
977-
val *= in_val;
978-
979-
if(val == eT(0)) { map_ref.erase(it); }
980-
}
981-
else
982-
{
983-
map_ref.erase(it);
984-
}
973+
eT& val = (*it).second;
974+
975+
val *= in_val;
976+
977+
if(val == eT(0)) { map_ref.erase(it); }
978+
}
979+
else
980+
{
981+
const eT val = eT(0) * in_val; // in case in_val is inf or nan
982+
983+
if(val != eT(0)) { parent.set_val(index, val); }
985984
}
986985
}
987986

@@ -1009,9 +1008,7 @@ MapMat_val<eT>::operator/=(const eT in_val)
10091008
}
10101009
else
10111010
{
1012-
// silly operation, but included for completeness
1013-
1014-
const eT val = eT(0) / in_val;
1011+
const eT val = eT(0) / in_val; // in case in_val is zero or nan
10151012

10161013
if(val != eT(0)) { parent.set_val(index, val); }
10171014
}
@@ -1481,38 +1478,27 @@ SpMat_MapMat_val<eT>::mul(const eT in_val)
14811478

14821479
if(it != it_end)
14831480
{
1484-
if(in_val != eT(0))
1485-
{
1486-
eT& val = (*it).second;
1487-
1488-
val *= in_val;
1489-
1490-
if(val == eT(0)) { map_ref.erase(it); }
1491-
}
1492-
else
1493-
{
1494-
map_ref.erase(it);
1495-
}
1481+
eT& val = (*it).second;
1482+
1483+
val *= in_val;
1484+
1485+
if(val == eT(0)) { map_ref.erase(it); }
14961486

14971487
s_parent.sync_state = 1;
14981488

14991489
access::rw(s_parent.n_nonzero) = m_parent.get_n_nonzero();
15001490
}
15011491
else
15021492
{
1503-
// element not found, ie. it's zero; zero multiplied by anything is zero, except for nan and inf
1504-
if(arma_isfinite(in_val) == false)
1493+
const eT result = eT(0) * in_val; // in case in_val is inf or nan
1494+
1495+
if(result != eT(0))
15051496
{
1506-
const eT result = eT(0) * in_val;
1497+
m_parent.set_val(index, result);
1498+
1499+
s_parent.sync_state = 1;
15071500

1508-
if(result != eT(0)) // paranoia, in case compiling with -ffast-math
1509-
{
1510-
m_parent.set_val(index, result);
1511-
1512-
s_parent.sync_state = 1;
1513-
1514-
access::rw(s_parent.n_nonzero) = m_parent.get_n_nonzero();
1515-
}
1501+
access::rw(s_parent.n_nonzero) = m_parent.get_n_nonzero();
15161502
}
15171503
}
15181504
}
@@ -1554,19 +1540,15 @@ SpMat_MapMat_val<eT>::div(const eT in_val)
15541540
}
15551541
else
15561542
{
1557-
// element not found, ie. it's zero; zero divided by anything is zero, except for zero and nan
1558-
if( (in_val == eT(0)) || (arma_isnan(in_val)) )
1543+
const eT result = eT(0) / in_val; // in case in_val is zero or nan
1544+
1545+
if(result != eT(0))
15591546
{
1560-
const eT result = eT(0) / in_val;
1547+
m_parent.set_val(index, result);
1548+
1549+
s_parent.sync_state = 1;
15611550

1562-
if(result != eT(0)) // paranoia, in case compiling with -ffast-math
1563-
{
1564-
m_parent.set_val(index, result);
1565-
1566-
s_parent.sync_state = 1;
1567-
1568-
access::rw(s_parent.n_nonzero) = m_parent.get_n_nonzero();
1569-
}
1551+
access::rw(s_parent.n_nonzero) = m_parent.get_n_nonzero();
15701552
}
15711553
}
15721554
}

inst/include/armadillo_bits/SpMat_meat.hpp

Lines changed: 15 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -612,33 +612,26 @@ SpMat<eT>::operator*=(const eT val)
612612
{
613613
arma_debug_sigprint();
614614

615-
if(val != eT(0))
615+
sync_csc();
616+
invalidate_cache();
617+
618+
const uword n_nz = n_nonzero;
619+
620+
eT* vals = access::rwp(values);
621+
622+
bool has_zero = false;
623+
624+
for(uword i=0; i<n_nz; ++i)
616625
{
617-
sync_csc();
618-
invalidate_cache();
619-
620-
const uword n_nz = n_nonzero;
621-
622-
eT* vals = access::rwp(values);
623-
624-
bool has_zero = false;
626+
eT& vals_i = vals[i];
625627

626-
for(uword i=0; i<n_nz; ++i)
627-
{
628-
eT& vals_i = vals[i];
629-
630-
vals_i *= val;
631-
632-
if(vals_i == eT(0)) { has_zero = true; }
633-
}
628+
vals_i *= val;
634629

635-
if(has_zero) { remove_zeros(); }
636-
}
637-
else
638-
{
639-
(*this).zeros();
630+
if(vals_i == eT(0)) { has_zero = true; }
640631
}
641632

633+
if(has_zero) { remove_zeros(); }
634+
642635
return *this;
643636
}
644637

inst/include/armadillo_bits/SpSubview_col_list_meat.hpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -253,8 +253,6 @@ SpSubview_col_list<eT,T1>::operator*= (const eT val)
253253
{
254254
arma_debug_sigprint();
255255

256-
if(val == eT(0)) { (*this).zeros(); return; }
257-
258256
SpMat<eT>& m_local = const_cast< SpMat<eT>& >(m);
259257

260258
const umat& ci = U_ci.M;

inst/include/armadillo_bits/SpSubview_meat.hpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -157,8 +157,6 @@ SpSubview<eT>::operator*=(const eT val)
157157
{
158158
arma_debug_sigprint();
159159

160-
if(val == eT(0)) { (*this).zeros(); return *this; }
161-
162160
if((n_elem == 0) || (n_nonzero == 0)) { return *this; }
163161

164162
m.sync_csc();

inst/include/armadillo_bits/SpValProxy_meat.hpp

Lines changed: 14 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -148,24 +148,17 @@ inline
148148
SpValProxy<T1>&
149149
SpValProxy<T1>::operator*=(const eT rhs)
150150
{
151-
if(rhs != eT(0))
151+
if(val_ptr)
152152
{
153-
if(val_ptr)
154-
{
155-
// The value already exists and merely needs to be updated.
156-
*val_ptr *= rhs;
157-
parent.invalidate_cache();
158-
check_zero();
159-
}
153+
*val_ptr *= rhs;
154+
parent.invalidate_cache();
155+
check_zero();
160156
}
161157
else
162158
{
163-
if(val_ptr)
164-
{
165-
// Since we are multiplying by zero, the value can be deleted.
166-
parent.delete_element(row, col);
167-
val_ptr = nullptr;
168-
}
159+
const eT val = eT(0) * rhs; // in case rhs is inf or nan
160+
161+
if(val != eT(0)) { val_ptr = &parent.insert_element(row, col, val); }
169162
}
170163

171164
return *this;
@@ -178,37 +171,17 @@ inline
178171
SpValProxy<T1>&
179172
SpValProxy<T1>::operator/=(const eT rhs)
180173
{
181-
if(rhs != eT(0)) // I hope this is true!
174+
if(val_ptr)
182175
{
183-
if(val_ptr)
184-
{
185-
*val_ptr /= rhs;
186-
parent.invalidate_cache();
187-
check_zero();
188-
}
176+
*val_ptr /= rhs;
177+
parent.invalidate_cache();
178+
check_zero();
189179
}
190180
else
191181
{
192-
if(val_ptr)
193-
{
194-
*val_ptr /= rhs; // That is where it gets ugly.
195-
// Now check if it's 0.
196-
if(*val_ptr == eT(0))
197-
{
198-
parent.delete_element(row, col);
199-
val_ptr = nullptr;
200-
}
201-
}
202-
else
203-
{
204-
eT val = eT(0) / rhs; // This may vary depending on type and implementation.
205-
206-
if(val != eT(0))
207-
{
208-
// Ok, now we have to insert it.
209-
val_ptr = &parent.insert_element(row, col, val);
210-
}
211-
}
182+
const eT val = eT(0) / rhs; // in case rhs is zero or nan
183+
184+
if(val != eT(0)) { val_ptr = &parent.insert_element(row, col, val); }
212185
}
213186

214187
return *this;

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 14
2525
#define ARMA_VERSION_MINOR 4
26-
#define ARMA_VERSION_PATCH 2
26+
#define ARMA_VERSION_PATCH 3
2727
#define ARMA_VERSION_NAME "Filtered Espresso"
2828

2929

0 commit comments

Comments
 (0)