Accelerate pairwise damage computation

To avoid accumulated memory allocations, pre-allocate the vectors str_vec and exp_vec outside the function and reuse the allocated space inside the function as many times as you wish, no new memory will be allocated. Use the version of @tullio without the :=, that’s, just write @tullio exp_vec[k] = ... And yes, what @Oscar_Smith has mentioned is correct, the vectorized exp version from LoopVectorization is much faster.

3 Likes