Helper function to take sums over variable arrays.
rsum(var, ...)
var | The indexed variable to be summed. |
---|---|
... | The indicies to iterate through. |
#> Error in mget(plabels[hasSubclass], env): invalid first argumentm$var(y[1:2, 1:2] >= 0) rsum(y[i,j], i = 1:2, j = 1:2) # y[1,1] + y[1,2] + y[2,1] + y[2,2]#> Error in rsum(y[i, j], i = 1:2, j = 1:2): Index i already exists. Use a different index, or remove that variable by calling rm(i).v <- c(1,2,3) rsum(v[i]*x[i], i = 1:3) # 1*x[1] + 2*x[2] + 3*x[3]#> Error in rsum(v[i] * x[i], i = 1:3): Index i already exists. Use a different index, or remove that variable by calling rm(i).