Calculate the resistances of all the possible connections inside a N-terminals black box based on measurements between terminals
Consider \$N = 3\$. The resistance \$R_{12}\$ would be $$ R_{12} = X_{12} || (X_{13} + X_{23}) = \frac{X_{12} (X_{13} + X_{23})}{X_{12} + X_{23} + X_{13}} $$ This is a problem - your matrix multiplication can only make terms that look like $$ R_{ij} = a X_{12} + b X_{13} + c X_{23} $$ where \$a\$, \$b\$, and \$c\$ are constants, so you can't write the first equation in matrix form. That means the method you've suggested won't work - you'll need to do this without linear algebra.
There might be a method that skips this matrix multiplication (something closer to star-mesh transforms), but I'm not seeing it...