Consider the following two equivalent operations:
A, B, C are large N x N matrices.
# Version 1:
@devec C[:,:] = A .* A + exp(B.*B.*A)
# Version 2:
@devec C[:] = A[:] .* A[:] + exp(B[:].*B[:].*A[:])
Version 2 is consistently 10% faster than Version 1. Not a fabulous
speed-up but free. Could @devec automate something like this?
Similarly, I would really prefer to write
@devec C = A .* A + exp(B .* B .* A)
but still ensure it is "in-place". Could this also be achieved?
(I didn't want to post this as an "issue" for the Devectorize package,
before getting feedback here.)
Thanks,
Christoph