## Represent loop nests as multiple summations? [closed]

This may be trivial but I would appreciate if someone could point me in the right direction here.. I am trying to express the number of instances in a loop nest in a general form. As a mathematical expression I would think this would be a multiple summation.

Example, loop nest:

for k in f_k(N):
for j in f_j(k):
for i in f_i(k,j):
do something


Where $f_n(x)$ is a function that generates a set of indices for loop $n$ given input $x$. I would say that each loop nest function can take as input any of the outer indices (or not -- it could be completely static/independent).. not quite sure if I've expressed that right.

From that I have: $\sum_{k}^{f_{k}(N)}\sum_{j}^{f_{j}(k)}|f_{i}(k,j)|$

Assuming this is correct, which it may not be!, how would one make this more generic to handle any number of loops say in the form with loop $l=1,...,N$?

-
 You question seems to be off-topic for this web site. You may want to look at Stack Overflow, or math.stackexchange.com – S. Carnahan♦ Mar 27 2012 at 3:24