Skip to content

row- vs. column-major ordering of nodes and char representations of nodes #20

@paciorek

Description

@paciorek

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]"

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions