I have a function which takes a list as its argument, and I want to transform it by multiplying by a matrix for each element of a list. To be specific, I want the following transformation: $ $ \hat{f}_i = \sum_p^n A_{ip}f_p, \quad \hat{f}_{ij} =\sum_i^n \sum_j^n A_{ip}A_{jq} f_{pq}, \quad \hat{f}_{ijk} =\sum_i^n \sum_j^n \sum_k^n A_{ip} A_{jq} A_{kr} f_{pqr}$ $ and so on.
I can write some replacement rules to do this explicitly for each size of the list,
n = 4; reps = {f[{i_}] :> Sum[A[i, p] f[p], {p, 1, n}], f[{i_, j_}] :> Sum[A[i, p] A[j, q] f[{p, q}], {p, 1, n}, {q, 1, n}], f[{i_, j_, k_}] :> Sum[A[i, p] A[j, q] A[k, r] f[{p, q, r}], {p,1,n}, {q,1,n}, {r,1,n}]}
Which then can be used e.g. f[{1, 2}] /. reps
, but I figure there must be a better way than explicitly listing them all out.