Skip to content
Merged
Show file tree
Hide file tree
Changes from 5 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
12 changes: 11 additions & 1 deletion .github/workflows/r.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
R-CMD-check:
runs-on: ${{ matrix.config.os }}

name: ${{ matrix.config.os }} (${{ matrix.config.r }})
name: ${{ matrix.config.os }} (${{ matrix.config.r }}) ${{ matrix.config.valgrind != true && 'check' || 'valgrind check' }}

strategy:
fail-fast: false
Expand All @@ -31,6 +31,7 @@ jobs:
# Use older ubuntu to maximise backward compatibility
- {os: ubuntu-latest, r: 'devel', http-user-agent: 'release'}
- {os: ubuntu-latest, r: 'release'}
- {os: ubuntu-latest, r: 'release', valgrind: true}
- {os: ubuntu-latest, r: 'oldrel'}

env:
Expand All @@ -54,6 +55,15 @@ jobs:
needs: check

- uses: r-lib/actions/check-r-package@v2
if: ${{ matrix.config.valgrind != true }}
with:
upload-snapshots: true

- name: valgrind check
if: ${{ matrix.config.valgrind == true }}
run: |
sudo apt-get update && \
sudo apt-get install -y --no-install-recommends valgrind
R CMD build .
R CMD check --use-valgrind *.tar.gz

2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ check:
R CMD check --as-cran defm_*.tar.gz

update:
rsync -avz ../barry/include/barry inst/include
rsync --delete -avz ../barry/include/barry inst/include

debug:
$(MAKE) clean && \
Expand Down
92 changes: 29 additions & 63 deletions inst/include/barry/models/defm/counters.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -486,43 +486,41 @@ inline void counter_generic(

}

// Checking if any prior to the event
bool any_before_event = false;

for (size_t i = 0u; i < m_order; ++i)
#ifdef BARRY_WITH_LATEX
name += "$";
#endif

// Generate name by showing each time point separately
// Loop through all time points (0 to m_order)
for (size_t i = 0u; i <= m_order; ++i)
{
// Check if this time point has any variables
bool has_vars = false;
for (size_t j = 0u; j < n_y; ++j)
{
if (motif(i,j) != 0)
if (motif(i, j) != 0)
{
any_before_event = true;
has_vars = true;
break;
}

}
}

#ifdef BARRY_WITH_LATEX
name += "$";
#endif

if (any_before_event)
if (!has_vars)
continue;

// Open bracket for this time point
#ifdef BARRY_WITH_LATEX
name += "(";
#else
name += "{";
#endif

// If order is greater than zero, the starting point of the transtion
for (size_t i = 0u; i < m_order; ++i)
{

// Add variables for this time point
bool row_start = true;
for (size_t j = 0u; j < n_y; ++j)
{

// Is it included?
if (motif(i,j) == 0)
if (motif(i, j) == 0)
continue;

// Is not the first?
Expand All @@ -537,60 +535,28 @@ inline void counter_generic(
name += (std::string("y") + std::to_string(j));

#ifdef BARRY_WITH_LATEX
name += (motif(i,j) < 0 ? "^-" : "^+");
name += (motif(i, j) < 0 ? "^-" : "^+");
#else
name += (motif(i,j) < 0 ? "-" : "+");
name += (motif(i, j) < 0 ? "-" : "+");
#endif

}

}

// If it has starting point, then need to close.
if (any_before_event & (m_order > 0u))
#ifdef BARRY_WITH_LATEX
name += ") -> (";
#else
name += std::string("}") + u8"\u21E8" + std::string("{");
#endif
else
#ifdef BARRY_WITH_LATEX
name += "(";
#else
name += "{";
#endif

// Looking onto the transtions
bool row_start = true;
for (size_t j = 0u; j < n_y; ++j)
{

if (motif(m_order, j) == 0)
continue;

if (row_start)
row_start = false;
else
name += ", ";

if (y_names != nullptr)
name += y_names->operator[](j);
else
name += (std::string("y") + std::to_string(j));

// Close bracket for this time point
#ifdef BARRY_WITH_LATEX
name += (motif(m_order, j) < 0 ? "^-" : "^+" );
name += ")";
#else
name += (motif(m_order, j) < 0 ? "-" : "+" );
name += "}";
#endif


// Add arrow if not the last time point
if (i < m_order)
{
name += ">";
}
}

#ifdef BARRY_WITH_LATEX
name += ")$";
#else
name += "}";
name += "$";
#endif

if (covar_index >= 0)
Expand Down Expand Up @@ -824,7 +790,7 @@ inline void rule_constrain_support(
support->get_counters()->get_names()[term_index] +
"' within [" + std::to_string(lb) + ", " +
std::to_string(ub) + std::string("]"),
std::string("When the support is ennumerated, only states where the statistic '") +
std::string("When the support is enumerated, only states where the statistic '") +
support->get_counters()->get_names()[term_index] +
std::to_string(term_index) + "' falls within [" + std::to_string(lb) + ", " +
std::to_string(ub) + "] are included."
Expand Down
Loading
Loading