I am looking for a source discussing the efficient tensor operations for so complex calculations. For example, in my last couple of projects we had to build n-dimensional tensors where each dimension is calculated based on complex operations. Something similar to:

For each dimension:

calculate complex equation

append result as a row in new tensor

Any reference would be appreciated since these operations cause very inefficient code and slow down processing.