Skip to content

Commit

Permalink
fix DFS to keep working with ints
Browse files Browse the repository at this point in the history
  • Loading branch information
cbouilla committed Sep 3, 2023
1 parent f8c96af commit 7be2492
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/spasm_reach.c
Original file line number Diff line number Diff line change
Expand Up @@ -63,13 +63,13 @@ int spasm_dfs(int j, const spasm * A, int top, int *xj, int *pstack, int *marks,
if (!marks[j]) {
/* mark node i as seen and initialize pstack. This is done only once. */
marks[j] = 1;
pstack[head] = (inew < 0) ? 0 : Ap[inew];
pstack[head] = (inew < 0) ? -1 : 0;
}
/* index of last entry of row inew */
p2 = (inew < 0) ? 0 : Ap[inew + 1];
/* #entries in row inew */
p2 = (inew < 0) ? -1 : Ap[inew + 1];

/* examine all yet-unseen entries of row i */
for (px = pstack[head]; px < p2; px++) {
for (px = Ap[inew] + pstack[head]; px < p2; px++) {
j = Aj[px];
if (marks[j])
continue;
Expand All @@ -78,7 +78,7 @@ int spasm_dfs(int j, const spasm * A, int top, int *xj, int *pstack, int *marks,
* and deal with column j instead. Save status of row
* inew in the stack.
*/
pstack[head] = px + 1;
pstack[head] += 1;

/*
* push column j onto the recursion stack. This will
Expand Down

0 comments on commit 7be2492

Please sign in to comment.