File tree Expand file tree Collapse file tree 2 files changed +10
-8
lines changed
inst/include/RcppArmadilloExtensions Expand file tree Collapse file tree 2 files changed +10
-8
lines changed Original file line number Diff line number Diff line change 5
5
* configure.ac: Idem
6
6
* configure: Idem
7
7
8
+ * inst/include/RcppArmadilloExtensions/fixprob.h: Replace deprecated
9
+ arma::is_finite(val) with std::isfinite(val)
10
+
8
11
2025-08-23 Dirk Eddelbuettel <
[email protected] >
9
12
10
13
* DESCRIPTION (Description): Rewritten and updated, add mention of
Original file line number Diff line number Diff line change 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().
5
3
// Copyright (C) 2012 - 2014 Christian Gunning
6
4
// Copyright (C) 2013 Romain Francois
5
+ // Copyright (C) 2025 Dirk Eddelbuettel
7
6
//
8
7
// This file is part of RcppArmadillo.
9
8
//
25
24
#include < RcppArmadillo.h>
26
25
namespace Rcpp {
27
26
namespace RcppArmadillo {
28
-
27
+
29
28
void FixProb (arma::vec &prob, const int size, const bool replace) {
30
- // prob is modified in-place.
29
+ // prob is modified in-place.
31
30
double sum = 0.0 ;
32
31
int ii, nPos = 0 ;
33
32
int nn = prob.size ();
34
33
for (ii = 0 ; ii < nn; ii++) {
35
34
// pop stack
36
35
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??
39
38
throw std::range_error ( " NAs not allowed in probability" ) ;
40
39
if (prob_value < 0.0 )
41
40
throw std::range_error ( " Negative probabilities not allowed" ) ;
You can’t perform that action at this time.
0 commit comments