On Thursday, May 19, 2016 at 10:20:22 PM UTC-4, vav...@uwaterloo.ca wrote: > > Dear Yichao, > > Thanks very much for the prompt response. This question arises regarding > a code for finite element stiffness matrix assembly. This computation > involves an outer loop over elements (possibly millions of them). Inside > this loop is a sequence of operations on 'small' vectors and matrices (say > 3-by-3 matrices). These inner operations are mostly gaxpy and indirect > addressing. The code would be much more readable if all of these > small-vector operations are written without explicit loops for i=1:3, but > it seems that replacing loops with [:] causes major heap allocation. Is > there a macro package or other solution applicable to this form of > computation? >
copy!(dest, src) shouldn't allocate memory. See also https://github.com/JuliaLang/julia/issues/16302