I’m wondering if there is a way to use vector arguments along specific dimensions during `broadcast()`

.

For example, consider a function `f(x,y,z)`

takeing three arguments corresponding to the 3D Cartesian coordinates. I have the x-, y-, z-coordinates as three separate vectors: `xs::Vector{Float64}`

, `ys::Vector{Float64}`

, `zs::Vector{Float64}`

. I would like to broadcast `f()`

over the 3D grid defined by `xs`

, `ys`

, `zs`

. This can be achieved by

```
Nx, Ny, Nz = length(xs), length(ys), length(zs)
xs2 = reshape(xs, (Nx, 1, 1))
ys2 = reshape(ys, (1, Ny, 1))
zs2 = reshape(zs, (1, 1, Nz))
F = broadcast(f, xs2, ys2, zs2)
```

but `reshape()`

is allocating. So, I’m wondering if there is a way to achieve the above without `reshape()`

, probably something like

```
F = broadcast(f, xs, ys, zs, dims=(1,2,3))
```

where `dims`

specify the dimension along which the three arguments need to be aligned.

Or, is there a way to turn a vector into an arbitrary dimensional linear array without allocation? I tried something like `permutedims()`

, but it didn’t work.