Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

inconsistent uncompiled model handling of initialization #1446

Open
paciorek opened this issue May 22, 2024 · 1 comment
Open

inconsistent uncompiled model handling of initialization #1446

paciorek opened this issue May 22, 2024 · 1 comment

Comments

@paciorek
Copy link
Contributor

Depending on whether project is provided, we can get an R error related to whether project is an array (resulting in a nonconformable array error or not (in which case uncompiled behavior is fine).

## here `m$project` is an array
code<- nimbleCode({
        p3[1:3,1:2] <- project[1:3]  + yday[1:3,1:2]
})
m <- nimbleModel(code)
# Error in model$project[1:3] + model$yday[1:3, 1:2] : 
#  non-conformable arrays

## here `m$project` is numeric
code<- nimbleCode({
        p3[1:3,1:2] <- project[1:3]  + yday[1:3,1:2]
})
m <- nimbleModel(code, inits = list(project = rnorm(3)))

I think this has to do with the fact that we initialize variables as arrays with a given dimension when no inits/data/constants info is provided.

@paciorek
Copy link
Contributor Author

Note that after compilation, these result in run-time size errors (also seen in issue #1425), so this may to some degree by subsumed by that issue.

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

No branches or pull requests

1 participant