@@ -245,6 +245,7 @@ parameterTransform <- nimbleFunction(
245245 # # argument values(model, nodes), return vector on unconstrained scale
246246 transformed <- nimNumeric(tLength )
247247 if (nNodes == 0 ) return (transformed )
248+ iNode <- 1L ; i <- 1L ; j <- 1L ; dd <- 1L ; pp <- 1L # # integer types
248249 for (iNode in 1 : nNodes ) {
249250 theseValues <- nodeValuesFromModel [transformData [iNode ,NIND1 ]: transformData [iNode ,NIND2 ]]
250251 thisType <- transformType [iNode ]
@@ -263,14 +264,14 @@ parameterTransform <- nimbleFunction(
263264 # # DT: there has to be a better way to do this procedure, below,
264265 # # creating the vector of the log-Cholesky transformed values.
265266 theseTransformed <- nimNumeric(transformData [iNode ,DATA2 ])
266- tInd <- 1
267+ tInd <- 1L
267268 for (j in 1 : dd ) {
268269 for (i in 1 : dd ) {
269- if (i == j ) { theseTransformed [tInd ] <- log(U [i ,j ]); tInd <- tInd + 1 }
270- if (i < j ) { theseTransformed [tInd ] <- U [i ,j ]; tInd <- tInd + 1 } } }
270+ if (i == j ) { theseTransformed [tInd ] <- log(U [i ,j ]); tInd <- tInd + 1L }
271+ if (i < j ) { theseTransformed [tInd ] <- U [i ,j ]; tInd <- tInd + 1L } } }
271272 },
272273 { # # 8: multivariate dirichlet
273- dd <- transformData [iNode ,DATA1 ] - 1
274+ dd <- transformData [iNode ,DATA1 ] - 1L
274275 theseTransformed <- nimNumeric(dd )
275276 theseTransformed [1 ] <- logit( theseValues [1 ] )
276277 if (dd > 1 ) {
@@ -287,21 +288,21 @@ parameterTransform <- nimbleFunction(
287288 theseTransformed <- nimNumeric(pp )
288289 theseValuesMatrix <- nimArray(theseValues , dim = c(dd , dd )) # U in matrix form
289290 if (dd > 1 ) {
290- cnt <- 1
291+ cnt <- 1L
291292 # # Length of each column of U is 1.
292293 # # We first produce the canonical partial correlations and then apply atanh()
293294 # # to make the unconstrained parameters..
294295 for (j in 2 : dd ) {
295296 theseTransformed [cnt ] <- atanh(theseValuesMatrix [1 , j ])
296- cnt <- cnt + 1
297+ cnt <- cnt + 1L
297298 if (j > 2 ) {
298299 partialSum <- 1
299300 for (i in 2 : (j - 1 )) {
300301 partialSum <- partialSum - theseValuesMatrix [i - 1 , j ]^ 2
301302 # # Transformed value is atanh of the proportion of the
302303 # # remaining correlation (which is in 'partialSum').
303304 theseTransformed [cnt ] <- atanh(theseValuesMatrix [i , j ] / sqrt(partialSum ))
304- cnt <- cnt + 1
305+ cnt <- cnt + 1L
305306 }
306307 }
307308 }
@@ -470,6 +471,6 @@ parameterTransform <- nimbleFunction(
470471 return (lp )
471472 }
472473 ),
473- buildDerivs = list (inverseTransform = list (),
474+ buildDerivs = list (inverseTransform = list (), transform = list (),
474475 logDetJacobian = list (ignore = c(' iNode' ,' j' ,' dd' ,' ddm1' ,' i' )))
475476)
0 commit comments