I have a function that takes a matrix and two scalars. The matrix input is identical for each call, but the scalars change with each call. I would like to broadcast over vectors supplying those scalars. Is it possible to inform Julia that a particular function argument is not broadcasted?
function foo(values, n, m) values .+ n .+ m end vals = [1 2 3; 4 5 6] n = [9, 3] m = [4, 5] foo.(values, n, m)
I can assign a local function:
bfoo(n, m) = foo(vals, n, m) bfoo.(n, m)
Or use map
map(i -> foo(vals, n[i], m[i]), 1:length(n))
It’d be nice to be able to express this more cleanly.