I’m trying to figure out what are some loop optimizations (in compilers) that can be applied to (linear algebra) vector summation?
Vector sum is defined
for i in range(len(vector1)):
vector_result[i] = vector1[i] + vector2[i]
How can I optimize this?
Some loop optimizations I’m aware of:
- Loop fission
- Loop fusion
- Vectorization
- Tiling But I don’t know how any of these can be applied to the summation of vectors.
If anybody out there know a thing or two about compilers and loop optimizations i will appreciate if you give me an example of the code after a loop optimization is applied. Thanks