Hi
I am trying to simplify a Nimble model with a "greater than one" constraint applied to a set of parameters stored in a 3D array.
The "bulky" version of the code evaluates the constraint inside nested loops and runs fine.
The "lite" version attempts to move this evaluation outside the loops in the hope that this results in fewer nodes, a lower memory demand and slightly faster code execution.
For this I have written a new version of the function min called min3 that finds the minimum of a 3D array. min3 compiles and runs fine by itself. But when trying to build a BUGS model, the function nimbleModel complains about the line that uses min3 and throws the following error.
Error in replaceConstantsRecurse(x, constEnv, constNames) :
Error, hit end
In addition: Warning message:
In replaceConstantsRecurse(x, constEnv, constNames) :
Code Dim was given as known but evaluates to a non-scalar. This is probably not what you want.
What have I missed that's causing the array dimensions "Dim" to throw the error message?
I have attached a simplified script that reproduces this error. I'm using a development version of Nimble from February 1.
David