The second column of matrix output is wrong. The problem occurs only when using a recycling-rule function (the fairly new pow_int for pow_int(r, 2) in this case) with a matrix input, compounded with another operation (r+ in this case), when both operations have as their arguments variables which are function arguments (r and r in this example).
The following two cases do not display this problem:
testNimble <- nimbleFunction(
run = function(r = double(2)) {
returnType(double(2))
a <- 2 # by assigning 2 to a variable, pow instead of pow_int is used on the next line; no bug
return( r + r^a )
})
cTestNimble <- compileNimble(testNimble)
testNimble <- nimbleFunction(
run = function(r = double(2)) {
returnType(double(2))
t <- r # by making a local copy, different Eigen handling is invoked; no bug
ans <- t+ t^2
return( ans )
})
cTestNimble <- compileNimble(testNimble)
This issue came from a user on nimble-users on 1/11/24.
The second column of matrix output is wrong. The problem occurs only when using a recycling-rule function (the fairly new
pow_int
forpow_int(r, 2)
in this case) with a matrix input, compounded with another operation (r+
in this case), when both operations have as their arguments variables which are function arguments (r
andr
in this example).The following two cases do not display this problem: