TITLE: Generalization of symmetric functions
QUESTION [10 upvotes]: A $n$-variable function $f$ is a symmetric function if
$$f(x_1,x_2, \ldots, x_n) = f(x_{\sigma(1)}, x_{\sigma(2)}, \ldots, x_{\sigma(n)})$$
for every permutation $\sigma \in S_n$.
In particular, if $f$ is a polynomial, then $f$ is a symmetric polynomial.
These objects have been studied extensively.
I wonder if the following generalization has been studied.
A $n^2$-variable function $f$ is an $S_n$-symmetric function if
$$f(x_{11}, x_{12}, \ldots, x_{1n}, \ldots, x_{nn}) = f(x_{\sigma(1)\sigma(1)}, x_{\sigma(1)\sigma(2)}, \ldots, x_{\sigma(1)\sigma(n)}, \ldots, x_{\sigma(n)\sigma(n)})$$
for every permutation $\sigma \in S_n$.
I think such objects must have been studied as they are so natural.
But I don't know the keywords and couldn't find the literature.
I'm very grateful if anyone could provide information on them.
Thanks in advance.

REPLY [9 votes]: Let $w\in S_n$ (the symmetric group) have cycle type
$\lambda =(\lambda_1,\dots, \lambda_\ell)\vdash n$, where
$\ell=\ell(\lambda)$ is the length (number of nonzero parts)
of $\lambda$. Then the induced action of $w$ on $[n]\times
[n]$ (where $[n]=\{1,2,\dots,n\}$) has cycle enumerator
$$ \prod_{i=1}^{\ell(\lambda)} \prod_{j=1}^{\ell(\lambda)}
  z_{\mathrm{lcm}(\lambda_i,\lambda_j)}^{\mathrm{gcd}(\lambda_i,\lambda_j)}. $$
Let $f_n(d)$ be the dimension of the space of complex polynomials in
the variables $x_{ij}$, $1\leq i,j\leq n$, that are
homogeneous of degree $d$ and $G$-invariant. Then by
Molien's theorem,
$$ F_n(x):=\sum_{d\geq 0} f_n(d)x^d $$
$$ \ \ = \frac{1}{n!}\sum_{\lambda\vdash
   n} \frac{n!}{z_\lambda}\prod_{i=1}^{\ell(\lambda)} \prod_{j=1}^{\ell(\lambda)}
  \frac{1}{\left(1-x^{\mathrm{lcm}(\lambda_i,\lambda_j)}\right)^
   {\mathrm{gcd}(\lambda_i,\lambda_j)}}. $$
I am using standard symmetric function notation, so
$n!/z_\lambda$ is the number of permutations in $S_n$ of
cycle type $\lambda$. For instance,
$$ F_1(x) = \frac{1}{1-x} $$
$$ F_2(x) = \frac{1+x^2}{(1-x)^4(1+x)^2} $$
$$ F_3(x) = \frac{1+3x^2+10x^3+16x^4+12x^5+16x^6+10x^7+3x^8+x^{10}}
      {(1-x)^9(1+x)^4(1+x+x^2)^3}. $$
Addendum. The invariant theory of finite groups, such as can be
found here,
can be used to obtain some further information about the ring $R$ of
invariant polynomials. For instance, if $S$ is the subring of all
symmetric functions in the $x_{ij}$'s, then $R$ is a
finitely-generated free $S$-module of rank $n^2!/n!$.