Skip to content

Commit

Permalink
fix other parallel categorical dists aggregators for #201
Browse files Browse the repository at this point in the history
  • Loading branch information
mpadge committed May 8, 2023
1 parent 8a78c91 commit 2b4fe95
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 19 deletions.
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Package: dodgr
Title: Distances on Directed Graphs
Version: 0.2.20.016
Version: 0.2.20.017
Authors@R: c(
person("Mark", "Padgham", , "mark.padgham@email.com", role = c("aut", "cre")),
person("Andreas", "Petutschnig", role = "aut"),
Expand Down
2 changes: 1 addition & 1 deletion codemeta.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"codeRepository": "https://github.com/ATFutures/dodgr",
"issueTracker": "https://github.com/ATFutures/dodgr/issues",
"license": "https://spdx.org/licenses/GPL-3.0",
"version": "0.2.20.016",
"version": "0.2.20.017",
"programmingLanguage": {
"@type": "ComputerLanguage",
"name": "R",
Expand Down
28 changes: 11 additions & 17 deletions src/run_sp_categorical.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -160,14 +160,11 @@ struct OnePairedCategoricalDist : public RcppParallel::Worker
}
pathfinder->AStarEdgeType (d, w, prev, heuristic, from_i, to_i);

if (w [to_i [0]] < INFINITE_DOUBLE)
for (size_t k = 0; k <= num_edge_types; k++)
{
for (size_t k = 0; k < num_edge_types; k++)
{
const double dto = d [to_i [0] + k * nverts];
if (dto < INFINITE_DOUBLE)
dout (i, k) = dto;
}
const double dto = d [to_i [0] + k * nverts];
if (dto < INFINITE_DOUBLE)
dout (i, k) = dto;
}
}
}
Expand Down Expand Up @@ -236,17 +233,14 @@ struct OneCategory : public RcppParallel::Worker

for (size_t j = 0; j < toi.size (); j++)
{
if (w [toi [j]] < INFINITE_DOUBLE)
for (size_t k = 0; k <= num_edge_types; k++)
{
for (size_t k = 0; k <= num_edge_types; k++)
{
const double dto = d [toi [j] + k * nverts];
if (dto < INFINITE_DOUBLE) {
if (Rcpp::NumericMatrix::is_na (dout (i, k)))
dout (i, k) = dto;
else
dout (i, k) += dto;
}
const double dto = d [toi [j] + k * nverts];
if (dto < INFINITE_DOUBLE) {
if (Rcpp::NumericMatrix::is_na (dout (i, k)))
dout (i, k) = dto;
else
dout (i, k) += dto;
}
}
}
Expand Down

0 comments on commit 2b4fe95

Please sign in to comment.