I'm surprised this hasn't come up (perhaps it has).
getDependencies and getNodeNames use row-major ordering while expandNodeNames uses column-major.
code <- nimbleCode({
for(i in 1:2)
for(j in 1:3)
y[i,j]~dnorm(mu,1)
mu ~ dnorm(0,1)
})
m <- nimbleModel(code)
m$getNodeNames()
m$expandNodeNames('y')
m$getDependencies('mu')
[1] "mu" "y[1, 1]" "y[1, 2]" "y[1, 3]" "y[2, 1]" "y[2, 2]" "y[2, 3]"
[1] "y[1, 1]" "y[2, 1]" "y[1, 2]" "y[2, 2]" "y[1, 3]" "y[2, 3]"
[1] "mu" "y[1, 1]" "y[1, 2]" "y[1, 3]" "y[2, 1]" "y[2, 2]" "y[2, 3]"
Given nimble 2.0, I think this is mainly a curiosity at this point.
I'm surprised this hasn't come up (perhaps it has).
getDependenciesandgetNodeNamesuse row-major ordering whileexpandNodeNamesuses column-major.Given nimble 2.0, I think this is mainly a curiosity at this point.