Closed AnthonyMikh closed 5 years ago
Thanks but it's still a copy. The comment should remain.
Well, at least it avoids allocating a Vec
in loop.
That isn't avoided either, because empty vec's don't allocate. But I'll merge it because it saves a line.
@est31 @AnthonyMikh
Could copy_from_slice solve the problem?
Something like this:
let vec_at_ch = &vectors[resid_vec_len * ch .. resid_vec_len * (ch + 1)];
residue_vectors[j].copy_from_slice(vec_at_ch);
copy_from_slice
would still do a copy. You'd also have to 0-initialize the vec meaning an additional step, which makes extend_from_slice
better.
copy_from_slice
would still do a copy. You'd also have to 0-initialize the vec meaning an additional step, which makesextend_from_slice
better.
Oh, just looked at the entire code and seen that residue_vectors
isn't allocated, I thought it was. Disregard my comment then :)
Fixes a TODO in code