Q:

Transformation between latin squares

Let $L\in R^{k\times k}$ a Latin square matrix. 
Which is the most general form of $A\in R^{k\times k}$ such that
$$
A^TLA=L'
$$
with $L'$ another Latin square?
Thanks!
Fabio  

A:

I doubt that there's a very nice characterization in general.
Let $L$ be any $k \times k$ Latin square matrix (whose entries are $k$ distinct reals).  Let $M$ be a $k \times k$ Latin square with symbolic entries.  For $B = A^T L A$ to be a Latin square with the same pattern as 
$M$, what we need is $B_{i.j} = B_{i'.j'}$ if and only if $M_{i.j} = M_{i',j'}$.
We might start by solving a set of $k(k-1)$ quadratic equations (e.g. taking one $(i',j')$ for each symbol) in the $k^2$ unknowns $a_{ij}$.  We might hope that for a generic solution the entries of $B$ that are not required to be equal will not be equal.  Of course, restricting to real solutions is an additional complication.  In some cases, symmetry dictates there is no solution: if one of $L$ and $M$ is symmetric, the other must also be symmetric.
For example, I tried the case $k=3$ with $L = \pmatrix{1 & 2 & 0\cr 2 & 0 & 1\cr 0 & 1 & 2}$ and $M = \pmatrix{a & b & c\cr b & c & a\cr c & a & b\cr}$ (both symmetric).
We get a set of $3$ equations in $9$ unknowns, which turns out to have Hilbert dimension $6$.  One family of solutions is
$$ A = \pmatrix{a_{1,1} & a_{1,1} & a_{1,1}\cr
                a_{2,1} & a_{2,1} & a_{2,1}\cr
                -2 a_{1,1} & -2 a_{1,1} & -2 a_{1,1}\cr} $$
but this doesn't work as $A^T L A$ has all entries equal.
One $5$-parameter family that does work is
$$ \pmatrix{a_{1,1} & a_{1,2} & a_{1,3}\cr
     u/d & v/d & w/d\cr
   -2 a_{1,1} & a_{3,2} & a_{3,3}\cr} $$
where 
$$ \eqalign{u &= 72\,{a_{{1,1}}}^{2}a_{{1,2}}a_{{1,3}}+36\,{a_{{1,1}}}^{2}a_{{1,2}}a_{{
3,3}}+36\,{a_{{1,1}}}^{2}a_{{1,3}}a_{{3,2}}+18\,{a_{{1,1}}}^{2}a_{{3,2
}}a_{{3,3}}-4\,a_{{1,1}}{a_{{1,2}}}^{3}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