Closed BertvanderVeen closed 5 months ago
@perrydv I believe @BertvanderVeen is looking at help(calcNodes)
, which suggests running nimbleFunctionList(calcNodes)
, which of course doesn't work as calcNodes
is a nimbleFunction.
I tried to modify the example code to be:
baseClass <- nimbleFunctionVirtual(run = function() {returnType(double())})
myCalcs <- nimbleFunctionList(baseClass)
myCalcs[[1]] <- calcNodes(model, "beta[1]")
# Error: An element being put in a nimbleFunctionList is not valid. It may not have the right contains (base class)
but that fails because the calcNodes
nimbleFunction does not contain baseClass
.
Can you look and see what you may have had in mind here?
Noting this code dates back to the initial commit of the nimble package (>9 years ago), and hence the code itself actually predates that commit.
This is clearly very old code (and documentation) from an earlier era. I wasn't aware of the calcNodes
nimbleFunction, and it might be a safe guess that the original motivation (and syntax) are long-since out of date (and no longer valid).
Also includes relics such as identityMatrix
:
https://github.com/nimble-dev/nimble/blob/02cffc9fc107a5a1c8f2fd5d938d7558b0c0c184/packages/nimble/R/NF_utils.R#L187
I've removed the non-working example code embedded in the roxygen. One could use calcNodes()
but not as part of a nimbleFunctionList.
When going through the example of creating a
nimbleFunctionList
ofcalcNodes
the function errs. This gives the impression that the documentation forcalcNodes
might not be up to date.For example:
Created on 2023-10-11 with reprex v2.0.2