At the moment, we have row-major ordering of nodes, regardless of how the index vars are arranged in the declaration
nimble is inconsistent, so that may open the opportunity to decide to use column-major as most natural given how R's behavior.
code <- nimbleCode({
for(i in 1:2)
for(j in 1:3)
y[i,j]~dnorm(0,1)
})
m <- nimbleModel(code)
sapply(m$getNodes(), \(x) x$toNodeChars())
[1,] "y[1, 1]"
[2,] "y[1, 2]"
[3,] "y[1, 3]"
[4,] "y[2, 1]"
[5,] "y[2, 2]"
[6,] "y[2, 3]"
code <- nimbleCode({
for(i in 1:2)
for(j in 1:3)
y[j,i]~dnorm(0,1)
})
m <- nimbleModel(code)
sapply(m$getNodes(), \(x) x$toNodeChars())
[,1]
[1,] "y[1, 1]"
[2,] "y[1, 2]"
[3,] "y[2, 1]"
[4,] "y[2, 2]"
[5,] "y[3, 1]"
[6,] "y[3, 2]"
At the moment, we have row-major ordering of nodes, regardless of how the index vars are arranged in the declaration
nimbleis inconsistent, so that may open the opportunity to decide to use column-major as most natural given how R's behavior.