# matrix with entries indexed by a set other than $\left\{1,2,\dots,n\right\}$

I want to make an $n\times n$ matrix M[n_] with $(i,j)$-th entry given by a function $f(i,j)$. However $i$ and $j$ don't come from $\left\{1,2,...,n\right\},$ they come from another ordered set $\Phi$ of size $n$. It's difficult to explicitly write down a bijection from $\left\{1,2,\dots,n\right\}$ to $\Phi$, so is there any way to just have the entries of $M$ be indexed by $\Phi$ (and in a specified order)?

(If it makes a difference, $n={k\choose 2}$ and $\Phi$ is the set of pairs $(r,s)$ with $1\leq r<s\leq k$. A bijection from $\Phi$ to $\left\{1,2,\dots,n\right\}$ is given by $(r,s)\mapsto r+{s-1\choose 2}$, but I cant find a nice way to write down the inverse.)

• Could use Table[]: Φ = Subsets[Range[k], {2}]; Table[f[r, s], {r, Φ}, {s, Φ}] – J. M. will be back soon Apr 2 '18 at 0:58
• Thanks! (I dont use mathematica much if you can't tell...) – anon Apr 2 '18 at 2:52