Skip to content

Commit bfbe390

Browse files
committed
Armadillo 15.2.6
1 parent 3938c64 commit bfbe390

9 files changed

Lines changed: 62 additions & 14 deletions

File tree

ChangeLog

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
2026-04-19 Dirk Eddelbuettel <edd@debian.org>
2+
3+
* inst/include/armadillo_bits/: Sync with Armadillo 15.2.6
4+
15
2026-04-18 Dirk Eddelbuettel <edd@debian.org>
26

37
* DESCRIPTION (Version, Date): RcppArmadillo 15.2.5-1

inst/include/armadillo_bits/Base_meat.hpp

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -352,7 +352,7 @@ Base<elem_type,derived>::is_symmetric(const typename get_pod_type<elem_type>::re
352352

353353
if(tol == T(0)) { return (*this).is_symmetric(); }
354354

355-
arma_conform_check( ((tol >= T(0)) == false), "is_symmetric(): parameter 'tol' must be >= 0" );
355+
arma_conform_check( ((tol >= T(0)) == false), "is_symmetric(): parameter 'tol' must be > 0" );
356356

357357
const quasi_unwrap<derived> U( (*this).get_ref() );
358358

@@ -365,8 +365,12 @@ Base<elem_type,derived>::is_symmetric(const typename get_pod_type<elem_type>::re
365365

366366
if(norm_A == T(0)) { return true; }
367367

368+
if(arma_isnan(norm_A)) { return false; }
369+
368370
const T norm_A_Ast = as_scalar( arma::max(sum(abs(A - A.st()), 1), 0) );
369371

372+
if(arma_isnan(norm_A_Ast)) { return false; }
373+
370374
return ( (norm_A_Ast / norm_A) <= tol );
371375
}
372376

@@ -435,7 +439,7 @@ Base<elem_type,derived>::is_hermitian(const typename get_pod_type<elem_type>::re
435439

436440
if(tol == T(0)) { return (*this).is_hermitian(); }
437441

438-
arma_conform_check( ((tol >= T(0)) == false), "is_hermitian(): parameter 'tol' must be >= 0" );
442+
arma_conform_check( ((tol >= T(0)) == false), "is_hermitian(): parameter 'tol' must be > 0" );
439443

440444
const quasi_unwrap<derived> U( (*this).get_ref() );
441445

@@ -448,8 +452,12 @@ Base<elem_type,derived>::is_hermitian(const typename get_pod_type<elem_type>::re
448452

449453
if(norm_A == T(0)) { return true; }
450454

455+
if(arma_isnan(norm_A)) { return false; }
456+
451457
const T norm_A_At = as_scalar( arma::max(sum(abs(A - A.t()), 1), 0) );
452458

459+
if(arma_isnan(norm_A_At)) { return false; }
460+
453461
return ( (norm_A_At / norm_A) <= tol );
454462
}
455463

@@ -927,6 +935,8 @@ Base_extra_yes<elem_type,derived>::is_sympd() const
927935
// default value for tol
928936
const T tol = T(100) * std::numeric_limits<T>::epsilon() * norm(X, "fro");
929937

938+
if(arma_isnan(tol)) { return false; }
939+
930940
if(X.is_hermitian(tol) == false) { return false; }
931941

932942
if(X.is_empty()) { return false; }
@@ -947,7 +957,7 @@ Base_extra_yes<elem_type,derived>::is_sympd(typename get_pod_type<elem_type>::re
947957

948958
typedef typename get_pod_type<elem_type>::result T;
949959

950-
arma_conform_check( ((tol >= T(0)) == false), "is_sympd(): parameter 'tol' must be >= 0" );
960+
arma_conform_check( ((tol >= T(0)) == false), "is_sympd(): parameter 'tol' must be > 0" );
951961

952962
Mat<elem_type> X = static_cast<const derived&>(*this);
953963

inst/include/armadillo_bits/SpMat_meat.hpp

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3565,7 +3565,7 @@ SpMat<eT>::is_symmetric(const typename get_pod_type<elem_type>::result tol) cons
35653565

35663566
if(tol == T(0)) { return (*this).is_symmetric(); }
35673567

3568-
arma_conform_check( ((tol >= T(0)) == false), "is_symmetric(): parameter 'tol' must be >= 0" );
3568+
arma_conform_check( ((tol >= T(0)) == false), "is_symmetric(): parameter 'tol' must be > 0" );
35693569

35703570
const SpMat<eT>& A = (*this);
35713571

@@ -3575,8 +3575,12 @@ SpMat<eT>::is_symmetric(const typename get_pod_type<elem_type>::result tol) cons
35753575

35763576
if(norm_A == T(0)) { return true; }
35773577

3578+
if(arma_isnan(norm_A)) { return false; }
3579+
35783580
const T norm_A_Ast = as_scalar( arma::max(sum(abs(A - A.st()), 1), 0) );
35793581

3582+
if(arma_isnan(norm_A_Ast)) { return false; }
3583+
35803584
return ( (norm_A_Ast / norm_A) <= tol );
35813585
}
35823586

@@ -3611,7 +3615,7 @@ SpMat<eT>::is_hermitian(const typename get_pod_type<elem_type>::result tol) cons
36113615

36123616
if(tol == T(0)) { return (*this).is_hermitian(); }
36133617

3614-
arma_conform_check( ((tol >= T(0)) == false), "is_hermitian(): parameter 'tol' must be >= 0" );
3618+
arma_conform_check( ((tol >= T(0)) == false), "is_hermitian(): parameter 'tol' must be > 0" );
36153619

36163620
const SpMat<eT>& A = (*this);
36173621

@@ -3621,8 +3625,12 @@ SpMat<eT>::is_hermitian(const typename get_pod_type<elem_type>::result tol) cons
36213625

36223626
if(norm_A == T(0)) { return true; }
36233627

3628+
if(arma_isnan(norm_A)) { return false; }
3629+
36243630
const T norm_A_At = as_scalar( arma::max(sum(abs(A - A.t()), 1), 0) );
36253631

3632+
if(arma_isnan(norm_A_At)) { return false; }
3633+
36263634
return ( (norm_A_At / norm_A) <= tol );
36273635
}
36283636

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 15
2525
#define ARMA_VERSION_MINOR 2
26-
#define ARMA_VERSION_PATCH 5
26+
#define ARMA_VERSION_PATCH 6
2727
#define ARMA_VERSION_NAME "Medium Roast Deluxe"
2828

2929

inst/include/armadillo_bits/op_orth_null_meat.hpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,8 @@ op_orth::apply_direct(Mat<typename T1::elem_type>& out, const Base<typename T1::
8787
// set tolerance to default if it hasn't been specified
8888
if(tol == T(0)) { tol = (std::max)(A.n_rows, A.n_cols) * s_mem[0] * std::numeric_limits<T>::epsilon(); }
8989

90+
if(arma_isnan(tol)) { return false; }
91+
9092
uword count = 0;
9193

9294
for(uword i=0; i < s_n_elem; ++i) { count += (s_mem[i] > tol) ? uword(1) : uword(0); }
@@ -174,6 +176,8 @@ op_null::apply_direct(Mat<typename T1::elem_type>& out, const Base<typename T1::
174176
// set tolerance to default if it hasn't been specified
175177
if(tol == T(0)) { tol = (std::max)(A.n_rows, A.n_cols) * s_mem[0] * std::numeric_limits<T>::epsilon(); }
176178

179+
if(arma_isnan(tol)) { return false; }
180+
177181
uword count = 0;
178182

179183
for(uword i=0; i < s_n_elem; ++i) { count += (s_mem[i] > tol) ? uword(1) : uword(0); }

inst/include/armadillo_bits/op_pinv_meat.hpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -176,6 +176,8 @@ op_pinv::apply_diag(Mat<eT>& out, const Mat<eT>& A, typename get_pod_type<eT>::r
176176

177177
if(tol == T(0)) { tol = (std::max)(A.n_rows, A.n_cols) * max_abs_Aii * std::numeric_limits<T>::epsilon(); }
178178

179+
if(arma_isnan(tol)) { return false; }
180+
179181
for(uword i=0; i<N; ++i)
180182
{
181183
if(diag_abs_vals[i] >= tol)
@@ -236,6 +238,8 @@ op_pinv::apply_sym(Mat<eT>& out, const Mat<eT>& A, typename get_pod_type<eT>::re
236238
// set tolerance to default if it hasn't been specified
237239
if(tol == T(0)) { tol = (std::max)(A.n_rows, A.n_cols) * abs_eigval[0] * std::numeric_limits<T>::epsilon(); }
238240

241+
if(arma_isnan(tol)) { return false; }
242+
239243
uword count = 0;
240244

241245
for(uword i=0; i < abs_eigval.n_elem; ++i) { count += (abs_eigval[i] >= tol) ? uword(1) : uword(0); }
@@ -310,6 +314,8 @@ op_pinv::apply_gen(Mat<eT>& out, Mat<eT>& A, typename get_pod_type<eT>::result t
310314
// set tolerance to default if it hasn't been specified
311315
if( (tol == T(0)) && (s.n_elem > 0) ) { tol = (std::max)(n_rows, n_cols) * s[0] * std::numeric_limits<T>::epsilon(); }
312316

317+
if(arma_isnan(tol)) { return false; }
318+
313319
uword count = 0;
314320

315321
for(uword i=0; i < s.n_elem; ++i) { count += (s[i] >= tol) ? uword(1) : uword(0); }

inst/include/armadillo_bits/op_rank_meat.hpp

Lines changed: 18 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,8 @@ op_rank::apply_diag(uword& out, Mat<eT>& A, typename get_pod_type<eT>::result to
8787

8888
typedef typename get_pod_type<eT>::result T;
8989

90+
out = uword(0);
91+
9092
const uword N = (std::min)(A.n_rows, A.n_cols);
9193

9294
podarray<T> diag_abs_vals(N);
@@ -98,7 +100,7 @@ op_rank::apply_diag(uword& out, Mat<eT>& A, typename get_pod_type<eT>::result to
98100
const eT Aii = A.at(i,i);
99101
const T abs_Aii = std::abs(Aii);
100102

101-
if(arma_isnan(Aii)) { out = uword(0); return false; }
103+
if(arma_isnan(Aii)) { return false; }
102104

103105
diag_abs_vals[i] = abs_Aii;
104106

@@ -108,6 +110,8 @@ op_rank::apply_diag(uword& out, Mat<eT>& A, typename get_pod_type<eT>::result to
108110
// set tolerance to default if it hasn't been specified
109111
if(tol == T(0)) { tol = (std::max)(A.n_rows, A.n_cols) * max_abs_Aii * std::numeric_limits<T>::epsilon(); }
110112

113+
if(arma_isnan(tol)) { return false; }
114+
111115
uword count = 0;
112116

113117
for(uword i=0; i<N; ++i) { count += (diag_abs_vals[i] > tol) ? uword(1) : uword(0); }
@@ -128,18 +132,20 @@ op_rank::apply_sym(uword& out, Mat<eT>& A, typename get_pod_type<eT>::result tol
128132

129133
typedef typename get_pod_type<eT>::result T;
130134

131-
if(A.is_square() == false) { out = uword(0); return false; }
135+
out = uword(0);
136+
137+
if(A.is_square() == false) { return false; }
132138

133139
Col<T> v;
134140

135141
const bool status = auxlib::eig_sym(v, A);
136142

137-
if(status == false) { out = uword(0); return false; }
143+
if(status == false) { return false; }
138144

139145
const uword v_n_elem = v.n_elem;
140146
T* v_mem = v.memptr();
141147

142-
if(v_n_elem == 0) { out = uword(0); return true; }
148+
if(v_n_elem == 0) { return true; }
143149

144150
T max_abs_v = T(0);
145151

@@ -148,6 +154,8 @@ op_rank::apply_sym(uword& out, Mat<eT>& A, typename get_pod_type<eT>::result tol
148154
// set tolerance to default if it hasn't been specified
149155
if(tol == T(0)) { tol = (std::max)(A.n_rows, A.n_cols) * max_abs_v * std::numeric_limits<T>::epsilon(); }
150156

157+
if(arma_isnan(tol)) { return false; }
158+
151159
uword count = 0;
152160

153161
for(uword i=0; i < v_n_elem; ++i) { count += (v_mem[i] > tol) ? uword(1) : uword(0); }
@@ -168,20 +176,24 @@ op_rank::apply_gen(uword& out, Mat<eT>& A, typename get_pod_type<eT>::result tol
168176

169177
typedef typename get_pod_type<eT>::result T;
170178

179+
out = uword(0);
180+
171181
Col<T> s;
172182

173183
const bool status = auxlib::svd_dc(s, A);
174184

175-
if(status == false) { out = uword(0); return false; }
185+
if(status == false) { return false; }
176186

177187
const uword s_n_elem = s.n_elem;
178188
const T* s_mem = s.memptr();
179189

180-
if(s_n_elem == 0) { out = uword(0); return true; }
190+
if(s_n_elem == 0) { return true; }
181191

182192
// set tolerance to default if it hasn't been specified
183193
if(tol == T(0)) { tol = (std::max)(A.n_rows, A.n_cols) * s_mem[0] * std::numeric_limits<T>::epsilon(); }
184194

195+
if(arma_isnan(tol)) { return false; }
196+
185197
uword count = 0;
186198

187199
for(uword i=0; i < s_n_elem; ++i) { count += (s_mem[i] > tol) ? uword(1) : uword(0); }

inst/include/armadillo_bits/sp_auxlib_meat.hpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -214,6 +214,8 @@ sp_auxlib::eigs_sym_newarp(Col<eT>& eigval, Mat<eT>& eigvec, const SpMat<eT>& X,
214214
if(ncv < (n_eigvals + 1)) { ncv = (n_eigvals + 1); }
215215
if(ncv > n ) { ncv = n; }
216216

217+
if(arma_isnan(opts.tol)) { return false; }
218+
217219
eT tol = (std::max)(eT(opts.tol), std::numeric_limits<eT>::epsilon());
218220

219221
uword maxiter = uword(opts.maxiter);
@@ -347,6 +349,8 @@ sp_auxlib::eigs_sym_newarp(Col<eT>& eigval, Mat<eT>& eigvec, const SpMat<eT>& X,
347349
if(ncv < (n_eigvals + 1)) { ncv = (n_eigvals + 1); }
348350
if(ncv > n ) { ncv = n; }
349351

352+
if(arma_isnan(opts.tol)) { return false; }
353+
350354
eT tol = (std::max)(eT(opts.tol), std::numeric_limits<eT>::epsilon());
351355

352356
uword maxiter = uword(opts.maxiter);
@@ -667,6 +671,8 @@ sp_auxlib::eigs_gen_newarp(Col< std::complex<T> >& eigval, Mat< std::complex<T>
667671
if(ncv < (n_eigvals + 3)) { ncv = (n_eigvals + 3); }
668672
if(ncv > n ) { ncv = n; }
669673

674+
if(arma_isnan(opts.tol)) { return false; }
675+
670676
T tol = (std::max)(T(opts.tol), std::numeric_limits<T>::epsilon());
671677

672678
uword maxiter = uword(opts.maxiter);

inst/include/armadillo_bits/subview_meat.hpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4812,7 +4812,6 @@ subview_row<eT>::is_zero(const typename get_pod_type<eT>::result tol) const
48124812
const T val_real = access::tmp_real(val);
48134813
const T val_imag = access::tmp_imag(val);
48144814

4815-
// convoluted formulation to handle NaNs
48164815
if( (eop_aux::arma_abs(val_real) <= tol) == false ) { return false; }
48174816
if( (eop_aux::arma_abs(val_imag) <= tol) == false ) { return false; }
48184817
}
@@ -4835,7 +4834,6 @@ subview_row<eT>::is_zero(const typename get_pod_type<eT>::result tol) const
48354834
{
48364835
const eT val = (*mem_ptr); mem_ptr += local_m_n_rows;
48374836

4838-
// convoluted formulation to handle NaNs
48394837
if( (eop_aux::arma_abs(val) <= tol) == false ) { return false; }
48404838
}
48414839
}

0 commit comments

Comments
 (0)