If I have the code below is there someway to do this without allocating intermediate arrays? It feels like it should be possible but I cant figure it out. I can do this without allocating if I was indexing with a range, but my problem is such that I index with a random-ish array of integers that is much longer than the size of the vector. Any help would be greatly appreciated!

```
phi = rand(500,500)
N = 10000000; m = 32, n = 51
is = rand(1:500, N); js = rand(1:500, N); vals = rand(N);
phi_n = view(phi:,n); phi_m = view(phi,:,m)
## Specifically this calculation -- allocates on the getindex.()
mcc_val = sum(vals .* getindex.(Ref(phi_n), is) .*
getindex.(Ref(phi_m), js))
```