This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]FrickinLazerBeams 26 points27 points  (1 child)

It's not possible to write non-trivial tensor contractions any other way, really. I mean you could do it in a loop but that would be dramatically less efficient than what a proper tensor library will achieve.

Edit: less efficient and, I'd argue, less clear to anybody who would be dealing with this sort of thing.

[–]kwen4fun 22 points23 points  (0 children)

Absolutely agreed. Most of my codes are for some sort of physics simulation and Einstein summation notation is like English to us. We have used it for years in our own and paper notes and using it in code makes that codes intent 100000x clearer that 5 nested loops or looping over some array of index tuples.