Skip to content

Support for values_indexed(model, nodes, i) - #72

Merged
perrydv merged 2 commits into
instr-indexingfrom
values-indexed
Nov 5, 2026
Merged

perrydv merged 2 commits into
instr-indexingfrom
values-indexed

Conversation

@perrydv

@perrydv perrydv commented Nov 5, 2026

Copy link
Copy Markdown
Contributor

This provides support for values(model, nodes[i]) in nimble2. Per discussion with @paciorek, we will follow this separation of syntax for now, where nimble and nimble2 essentially support this by syntax sugar, and in nimbleModel we will instead support just the underlying feature needed.

The cases for values() turned out to be complicated. A third argument is added, mode = "raw", "scalar", or "node".

"raw" means the i-th node is exactly the i-th element in nodes (better called "var subsets", which might be character, a list of varRanges, or an instrList). When node is character, mode="raw" (the default) matches nimble, which should provide clean backward compatibility. "scalar" means to treat each scalar element as its own item, all consecutively indexed. This matches a nimble workflow where nodes were expanded into scalar elements, which we don't actually want to do in nimble2.mode = "node" means to create an instrList (based on nodes) from nodes and index index through that. This matches a nimble workflow where nodes were created as actual nodes (e.g., as in initializeModel), all consecutively indexed, which we also don't actually want to do in nimble2.

This branches from and would be merged back into branch instr-indexing, the full set of support for model$calculate(nodes[i]) in nimble2 via model$calculate_indexed(nodes, i) and the related other model methods.

Hence if tests pass, I will merge this, then I will go back to the PR for instr-indexeing.

@perrydv
perrydv merged commit dbc2a2a into instr-indexing Nov 5, 2026
4 of 6 checks passed
@perrydv
perrydv deleted the values-indexed branch November 5, 2026 03:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant