Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix clang compiler bug for CRAN submission #75

Merged
merged 8 commits into from
Jan 28, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions .github/workflows/r.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,9 @@ jobs:
- {os: macOS-latest, r: 'devel', http-user-agent: 'release'}
- {os: windows-latest, r: 'devel', http-user-agent: 'release'}
# se older ubuntu to maximise backward compatibility
- {os: ubuntu-latest, r: 'devel', http-user-agent: 'release'}
- {os: ubuntu-latest, r: 'release'}
- {os: ubuntu-latest, r: 'oldrel'}
- {os: ubuntu-latest, r: 'devel', http-user-agent: 'release'}
- {os: ubuntu-latest, r: 'release'}
- {os: ubuntu-latest, r: 'oldrel'}

env:
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
Expand Down Expand Up @@ -65,7 +65,7 @@ jobs:
error-on: '"warning"'

- uses: r-lib/actions/check-r-package@v2
if: ${{ matrix.config.os != 'ubuntu-latest' || matrix.config.r != 're;ease' }}
if: ${{ matrix.config.os != 'ubuntu-latest' || matrix.config.r != 'release' }}
with:
upload-snapshots: false
upload-results: false
Expand Down
3 changes: 2 additions & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
Package: epiworldR
Type: Package
Title: Fast Agent-Based Epi Models
Version: 0.6.0.0
Version: 0.6.1.0
Depends: R (>= 4.1.0)
Authors@R: c(
person(given="George", family="Vega Yon", role=c("aut"),
email="[email protected]", comment = c(ORCID = "0000-0002-3171-0844")),
Expand Down
11 changes: 7 additions & 4 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
# epiworldR 0.6.0.0
# epiworldR 0.6.1.0

* Updates to reflect changes in the `epiworld` C++ library (mostly bug fixes)

* Package now requires R version >=4.1.0, because it uses the pipe `|>`

## New features

# epiworldR 0.6.0.0

* The package now includes the `LFMCMC` module that implements
the likelihood-free Markov Chain Monte Carlo algorithm. This
Expand All @@ -15,8 +20,6 @@
* The function `today()` returns the current day (step) of the
simulation.

## Misc

* We changed the versioning system. To allow the R package to increase
version number while preserving epiworld (C++) versioning, we added a fourth
number that indicates R-only patches (similar to RcppArmadillo).
Expand Down
2 changes: 1 addition & 1 deletion inst/CITATION
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
year <- 2024
year <- 2025
note <- sprintf("R package version %s", meta$Version)

bibentry(
Expand Down
2 changes: 1 addition & 1 deletion inst/include/epiworld/epiworld.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
/* Versioning */
#define EPIWORLD_VERSION_MAJOR 0
#define EPIWORLD_VERSION_MINOR 6
#define EPIWORLD_VERSION_PATCH 0
#define EPIWORLD_VERSION_PATCH 1

static const int epiworld_version_major = EPIWORLD_VERSION_MAJOR;
static const int epiworld_version_minor = EPIWORLD_VERSION_MINOR;
Expand Down
21 changes: 19 additions & 2 deletions inst/include/epiworld/math/lfmcmc/lfmcmc-meat-print.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,16 @@ inline void LFMCMC<TData>::print(size_t burnin) const
for (auto & n : summ_params)
{

int tmp_nchar = std::floor(std::log10(std::abs(n)));
int tmp_nchar;

if (std::abs(n) < 1) {
// std::log10(<1) will return negative number
// std::log10(0) will return -inf and throw a runtime error
tmp_nchar = 0;
} else {
tmp_nchar = std::floor(std::log10(std::abs(n)));
}

if (nchar_par_num < tmp_nchar)
nchar_par_num = tmp_nchar;
}
Expand Down Expand Up @@ -161,7 +170,15 @@ inline void LFMCMC<TData>::print(size_t burnin) const
int nchar = 0;
for (auto & s : summ_stats)
{
int tmp_nchar = std::floor(std::log10(std::abs(s)));
int tmp_nchar;
if (std::abs(s) < 1) {
// std::log10(<1) will return negative number
// std::log10(0) will return -inf and throw a runtime error
tmp_nchar = 0;
} else {
tmp_nchar = std::floor(std::log10(std::abs(s)));
}

if (nchar < tmp_nchar)
nchar = tmp_nchar;
}
Expand Down
Loading