Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting
| if (length(idx_nz) >= 2L) { | ||
| for (a in seq_along(idx_nz)) { | ||
| j <- idx_nz[a] | ||
| if (!kept[a]) next | ||
| mij <- mi_i[j] | ||
| for (b in (a + 1L):length(idx_nz)) { | ||
| k <- idx_nz[b] |
There was a problem hiding this comment.
Iterate neighbor pairs without producing invalid indices
The inner DPI loop iterates for (b in (a + 1L):length(idx_nz)). In R the x:y operator returns a decreasing sequence when x > y, so when a reaches the final neighbor the loop yields indices greater than length(idx_nz) (e.g. 3:2 → 3, 2). Those out‑of‑range b values make kept[b] evaluate to NA, which triggers if (!kept[b]) to error with “missing value where TRUE/FALSE needed” as soon as a node has two or more neighbors. As a result, the default streaming ARACNE path fails on practically all nontrivial datasets. The loop needs to guard against a == length(idx_nz) (e.g. iterate only when a < length(idx_nz) or use seq.int(a + 1L, length(idx_nz)) with a check).
Useful? React with 👍 / 👎.
Summary
Testing
https://chatgpt.com/codex/tasks/task_b_68f2390e87dc8320a8e5e3af4d5d8d3b