Skip to content

Commit

Permalink
use rcpp interruption
Browse files Browse the repository at this point in the history
  • Loading branch information
elbersb committed Sep 20, 2023
1 parent c00698b commit 7e935ec
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 10 deletions.
9 changes: 0 additions & 9 deletions R/compression.R
Original file line number Diff line number Diff line change
Expand Up @@ -62,9 +62,6 @@ compress <- function(data, group, unit, weight = NULL,
}

iterations <- as.data.table(res)
if (nrow(iterations) == 0) {
stop("user interruption")
}

initial_M <- mutual_total(d, group, unit, weight = "freq")[["est"]][1]
iterations[, pct_M := M / initial_M]
Expand Down Expand Up @@ -343,14 +340,8 @@ midcache.dendrogram <- function(x) {
repeat {
if (!stats::is.leaf(d)) {
k <- length(d)
if (k < 1) {
stop("dendrogram node with non-positive #{branches}")
}
depth <- depth + 1L
kk[depth] <- k
if (storage.mode(jj) != storage.mode(kk)) {
storage.mode(jj) <- storage.mode(kk)
}
dd[[depth]] <- d
d <- d[[jj[depth] <- 1L]]
next
Expand Down
2 changes: 1 addition & 1 deletion src/compression.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,7 @@ List compress_compute_cpp(
while (neighbors.size() > 0)
{
if (Progress::check_abort())
return List::create();
throw Rcpp::exception("user interruption");

// find smallest reduction
double min_reduction = 10000;
Expand Down

0 comments on commit 7e935ec

Please sign in to comment.