Skip to content

Commit 7af1194

Browse files
committed
Updating barry
1 parent 9fc4a62 commit 7af1194

File tree

4 files changed

+237
-118
lines changed

4 files changed

+237
-118
lines changed

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ check:
1111
R CMD check --as-cran defm_*.tar.gz
1212

1313
update:
14-
rsync -avz ../barry/include/barry inst/include
14+
rsync --delete -avz ../barry/include/barry inst/include
1515

1616
debug:
1717
$(MAKE) clean && \

inst/include/barry/models/defm/counters.hpp

Lines changed: 29 additions & 63 deletions
Original file line numberDiff line numberDiff line change
@@ -486,43 +486,41 @@ inline void counter_generic(
486486

487487
}
488488

489-
// Checking if any prior to the event
490-
bool any_before_event = false;
491-
492-
for (size_t i = 0u; i < m_order; ++i)
489+
#ifdef BARRY_WITH_LATEX
490+
name += "$";
491+
#endif
492+
493+
// Generate name by showing each time point separately
494+
// Loop through all time points (0 to m_order)
495+
for (size_t i = 0u; i <= m_order; ++i)
493496
{
497+
// Check if this time point has any variables
498+
bool has_vars = false;
494499
for (size_t j = 0u; j < n_y; ++j)
495500
{
496-
if (motif(i,j) != 0)
501+
if (motif(i, j) != 0)
497502
{
498-
any_before_event = true;
503+
has_vars = true;
499504
break;
500505
}
501-
502506
}
503-
}
504-
505-
#ifdef BARRY_WITH_LATEX
506-
name += "$";
507-
#endif
508507

509-
if (any_before_event)
508+
if (!has_vars)
509+
continue;
510+
511+
// Open bracket for this time point
510512
#ifdef BARRY_WITH_LATEX
511513
name += "(";
512514
#else
513515
name += "{";
514516
#endif
515517

516-
// If order is greater than zero, the starting point of the transtion
517-
for (size_t i = 0u; i < m_order; ++i)
518-
{
519-
518+
// Add variables for this time point
520519
bool row_start = true;
521520
for (size_t j = 0u; j < n_y; ++j)
522521
{
523-
524522
// Is it included?
525-
if (motif(i,j) == 0)
523+
if (motif(i, j) == 0)
526524
continue;
527525

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

539537
#ifdef BARRY_WITH_LATEX
540-
name += (motif(i,j) < 0 ? "^-" : "^+");
538+
name += (motif(i, j) < 0 ? "^-" : "^+");
541539
#else
542-
name += (motif(i,j) < 0 ? "-" : "+");
540+
name += (motif(i, j) < 0 ? "-" : "+");
543541
#endif
544-
545542
}
546543

547-
}
548-
549-
// If it has starting point, then need to close.
550-
if (any_before_event & (m_order > 0u))
551-
#ifdef BARRY_WITH_LATEX
552-
name += ") -> (";
553-
#else
554-
name += std::string("}") + u8"\u21E8" + std::string("{");
555-
#endif
556-
else
557-
#ifdef BARRY_WITH_LATEX
558-
name += "(";
559-
#else
560-
name += "{";
561-
#endif
562-
563-
// Looking onto the transtions
564-
bool row_start = true;
565-
for (size_t j = 0u; j < n_y; ++j)
566-
{
567-
568-
if (motif(m_order, j) == 0)
569-
continue;
570-
571-
if (row_start)
572-
row_start = false;
573-
else
574-
name += ", ";
575-
576-
if (y_names != nullptr)
577-
name += y_names->operator[](j);
578-
else
579-
name += (std::string("y") + std::to_string(j));
580-
544+
// Close bracket for this time point
581545
#ifdef BARRY_WITH_LATEX
582-
name += (motif(m_order, j) < 0 ? "^-" : "^+" );
546+
name += ")";
583547
#else
584-
name += (motif(m_order, j) < 0 ? "-" : "+" );
548+
name += "}";
585549
#endif
586550

587-
551+
// Add arrow if not the last time point
552+
if (i < m_order)
553+
{
554+
name += ">";
555+
}
588556
}
589557

590558
#ifdef BARRY_WITH_LATEX
591-
name += ")$";
592-
#else
593-
name += "}";
559+
name += "$";
594560
#endif
595561

596562
if (covar_index >= 0)
@@ -824,7 +790,7 @@ inline void rule_constrain_support(
824790
support->get_counters()->get_names()[term_index] +
825791
"' within [" + std::to_string(lb) + ", " +
826792
std::to_string(ub) + std::string("]"),
827-
std::string("When the support is ennumerated, only states where the statistic '") +
793+
std::string("When the support is enumerated, only states where the statistic '") +
828794
support->get_counters()->get_names()[term_index] +
829795
std::to_string(term_index) + "' falls within [" + std::to_string(lb) + ", " +
830796
std::to_string(ub) + "] are included."

0 commit comments

Comments
 (0)