drhagen / tensora

Sparse/dense tensor library for Python
http://tensora.drhagen.com/
MIT License
9 stars 2 forks source link

Partially fuse loops in addition #56

Open drhagen opened 8 months ago

drhagen commented 8 months ago

Right now, loops inside a Sum node are supposed to be fused if they start with same index. However, this only happens if they are adjacent. If a loop with a different index is placed between two fusable loops in the Sum, they are not fused. This is both inefficient and causes a crash (because the variables are redeclared).

Fused:

tensora 'a(i) = b(i) + c(i) + d(j,i)'

Not fused:

tensora 'a(i) = b(i) + c(j,i) + d(i)'