Skip to content

Commit cdf2405

Browse files
committed
Replace arma::is_finite with std::isfinite in fixprob.h
1 parent f1dcd67 commit cdf2405

File tree

2 files changed

+10
-8
lines changed

2 files changed

+10
-8
lines changed

ChangeLog

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,9 @@
55
* configure.ac: Idem
66
* configure: Idem
77

8+
* inst/include/RcppArmadilloExtensions/fixprob.h: Replace deprecated
9+
arma::is_finite(val) with std::isfinite(val)
10+
811
2025-08-23 Dirk Eddelbuettel <[email protected]>
912

1013
* DESCRIPTION (Description): Rewritten and updated, add mention of

inst/include/RcppArmadilloExtensions/fixprob.h

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
1-
// -*- mode: C++; c-indent-level: 4; c-basic-offset: 4; indent-tabs-mode: nil; -*-
2-
/* :tabSize=4:indentSize=4:noTabs=false:folding=explicit:collapseFolds=1: */
3-
//
4-
// fixprob.h: helper function for Rcpp/Armadillo random number draws, including sample().
1+
2+
// fixprob.h: helper function for Rcpp/Armadillo random number draws, including sample().
53
// Copyright (C) 2012 - 2014 Christian Gunning
64
// Copyright (C) 2013 Romain Francois
5+
// Copyright (C) 2025 Dirk Eddelbuettel
76
//
87
// This file is part of RcppArmadillo.
98
//
@@ -25,17 +24,17 @@
2524
#include <RcppArmadillo.h>
2625
namespace Rcpp{
2726
namespace RcppArmadillo{
28-
27+
2928
void FixProb(arma::vec &prob, const int size, const bool replace) {
30-
// prob is modified in-place.
29+
// prob is modified in-place.
3130
double sum = 0.0;
3231
int ii, nPos = 0;
3332
int nn = prob.size();
3433
for (ii = 0; ii < nn; ii++) {
3534
// pop stack
3635
double prob_value = prob(ii);
37-
38-
if (!arma::is_finite(prob_value)) //does this work??
36+
37+
if (!std::isfinite(prob_value)) //does this work??
3938
throw std::range_error( "NAs not allowed in probability" ) ;
4039
if (prob_value < 0.0)
4140
throw std::range_error( "Negative probabilities not allowed" ) ;

0 commit comments

Comments
 (0)