Hello, I am beginning to use Julia and I want to ask for help doing something efficiently.
I am trying to compute a summation in Julia using the following loop.
for (k_j,kk) = enumerate(k)
for (s_j,ss) = enumerate(s), (z_j,zz) = enumerate(z), (w_j,ww) = enumerate(w)
Which is basically calling over specific entries of matrices and adding them up. I’ve tried to make this faster and leaner with a reduce or mapreduce, but haven’t been able to get the code off the ground.
Just to be clear here — the “fast” way to write a for loop is to write the three letters for …. There’s no magic. There’s no need to contort things to vectorize into a mapreduce (or some other) function call. Those functions you call? They just use a Julia for loop spelled with exactly the same three letters you write.