This method computes orthogonal matrices whose Hadamard square is a given orthostochastic matrix. This is a helper function to detRep, which computes symmetric determinantal representations of real cubic bivariate polynomials.
Given a $n\times n$ orthostochastic matrix $A$, there are $2^{n^2}$ possible matrices whose Hadamard square is $A$ (not all of which will be orthogonal in general though). Let $G\cong (\ZZ/2\ZZ)^n$ be the group of diagonal matrices with diagonal entries equal to ±1. Then $G \times G$ acts (by $(g_1, g_2) O = g_1Og_2$) on the set of orthogonal matrices whose Hadamard square is $A$. This method computes all such orthogonal matrices, modulo the action of $G\times G$. The representative for each orbit is chosen so that the first row and column will have all nonnegative entries, and modulo this restriction on the signs, the algorithm is essentially a brute-force search. Note that for generic choices of the orthostochastic matrix $A$, there will be exactly one $G\times G$-orbit of orthogonal matrices with Hadamard square equal to $A$.
When working over an InexactFieldFamily like RR or CC, the option Tolerance can be used to specify the internal threshold for checking equality (any floating point number below the tolerance is treated as numerically zero).
i1 : O = randomOrthogonal 4 o1 = | .277276 -.291644 .290194 -.868245 | | .939685 .270779 -.000487755 .208973 | | -.0964589 .153934 .954496 .236511 | | .175514 -.904393 .0687354 .38281 | 4 4 o1 : Matrix RR <--- RR 53 53 |
i2 : A = hadamard(O, O) o2 = | .076882 .085056 .0842128 .753849 | | .883009 .0733215 2.37905e-7 .0436696 | | .00930432 .0236956 .911062 .0559377 | | .0308051 .817927 .00472455 .146543 | 4 4 o2 : Matrix RR <--- RR 53 53 |
i3 : orthogonalFromOrthostochastic A o3 = {| .277276 .291644 .290194 .868245 |} | .939685 -.270779 -.000487755 -.208973 | | .0964589 .153934 -.954496 .236511 | | .175514 .904393 .0687354 -.38281 | o3 : List |
The object orthogonalFromOrthostochastic is a method function with options.