The method
We are given input vectors as the columns of $X$ and output vectors as the columns of $Y$, with $Y \approx g_\ast X$ for an unknown $g_\ast$ in a group $G$. The least squares matrix $g_0 = YX^{+}$ fits the data, but it is generally not in $G$. A Lorentz transformation fitted this way does not preserve the Minkowski metric, and an accelerator one-turn map fitted this way is not symplectic.
The Lie algebra method takes the principal logarithm of $g_0$, projects it orthogonally onto the Lie algebra $\mathfrak g$, and exponentiates. The result is always in $G$. For the classical groups the projection has a closed form. If the group preserves a form $M$, so that $g^{\star} M g = M$, then
The estimate can then be refined by a few Gauss-Newton steps on the group, which minimize $\|gX - Y\|_F$ over $g \in G$.
| Group | Projection | Example in physics |
|---|---|---|
| $SO(n)$ | $\tfrac12(L - L^{\mathsf T})$ | Rigid rotations |
| $SL(n)$ | $L - \tfrac{\operatorname{tr} L}{n} I$ | Volume preserving maps |
| $SO(3,1)$ | $\tfrac12(L - \eta L^{\mathsf T}\eta)$, $\eta=\operatorname{diag}(-1,1,1,1)$ | Lorentz transformations |
| $Sp(2k)$ | $\tfrac12(L + J L^{\mathsf T} J)$ | Accelerator one-turn maps |
| $U(n)$ | $\tfrac12(L - L^{\dagger})$ | Quantum gates |
| $SE(3)$ | skew block, keep translation | Point cloud registration |
Two observers measuring the same particles
Suppose two detectors, or two observers moving relative to each other, record the four-momenta $(E, p_x, p_y, p_z)$ of the same set of particles, measured in GeV. Special relativity tells us that the two sets of measurements are related by a Lorentz transformation $\Lambda$, which is a $4\times4$ matrix satisfying $\Lambda^{\mathsf T}\eta\Lambda = \eta$ with $\eta = \operatorname{diag}(-1,1,1,1)$. This condition is what keeps the mass of every particle, $m^2 = E^2 - |\mathbf p|^2$, the same in both frames. Here the particles are electrons, muons, pions, kaons and protons with momenta of about 1 GeV, and each component of each measurement has a small Gaussian error.
Once we have an estimate of $\Lambda$, we can use it to predict what the second observer would see for a new particle. If the estimate is not a Lorentz transformation, then it changes the mass of that particle, and the change grows with the particle's momentum. The plot shows this for a proton.
Superimposing two copies of a molecule
In structural chemistry and biology we often have two sets of atomic coordinates for the same molecule, for example from two crystal structures or two frames of a simulation, and we want the rigid motion that best superimposes one on the other. A rigid motion is a rotation followed by a translation. Written in homogeneous coordinates, where a point $\mathbf x$ becomes $(\mathbf x, 1)$, it is a $4\times4$ matrix in the special Euclidean group $SE(3)$. The noise here plays the part of thermal motion of the atoms, in ångströms. Both estimates below are exact rigid motions, so neither can stretch or shear the molecule. We compare the Lie algebra estimate with the best rigid motion, found by Gauss-Newton. For a round molecule such as C₆₀ the atoms are spread evenly in every direction and the two agree closely, while for a long, thin α-helix they differ, because the input vectors are then far from isotropic. (The paper proves the agreement for isotropic data in the rotation and unitary groups; for rigid motions it is an observation.) Drag the view to rotate it.
Bonds are drawn between neighbouring atoms. The differences between each estimate and the true positions are magnified by the factor on the slider, so that small errors in the rotation can be seen.
One-turn map of a storage ring
Beam position monitors record a particle's transverse coordinates $(x, y, p_x, p_y)$ on every turn. Consecutive turns give $X$ and $Y$, and the one-turn map, which is symplectic, follows from $Y \approx MX$. A fitted map that is not symplectic has eigenvalues off the unit circle, so tracking with it makes the beam grow or decay. The symplectic Lie algebra estimate tracks indefinitely.
Identifying a quantum gate
A two-qubit gate is a $4\times4$ unitary matrix $U$. We prepare $m$ random probe states, apply the gate, and measure the output amplitudes with noise. The least squares fit is not unitary, so it does not describe a physical gate. The Lie algebra estimate projects onto $\mathfrak u(4)$, the skew-Hermitian matrices, and is unitary by construction. Each cell shows a matrix entry, with its size as the brightness and its complex phase as the hue. The CNOT gate has an eigenvalue at $-1$, where the principal logarithm is not defined (Section 3.3 of the paper). The noise moves this eigenvalue slightly off the negative axis, the logarithm picks whichever branch is nearest, and the exponential undoes that choice, so the estimate of $U$ is still accurate at moderate noise. At the largest noise setting the Lie algebra estimate of CNOT can be several times worse than Gauss-Newton, which is the ill-conditioning of the logarithm near $-1$ described in Section 4.1 of the paper.
GPU Monte Carlo
Each GPU thread draws its own $g_\ast$ and data, computes the Lie algebra estimate, and then refines it with four Gauss-Newton steps, all in single precision. Only three numbers per trial leave the GPU. The same experiment also runs in WebAssembly, in double precision, for comparison. The histograms show the relative error $\|\hat g - g_\ast\|_F / \|g_\ast\|_F$ on a log scale, and the ratio column is the median error of the Lie algebra estimate divided by that of Gauss-Newton. For $SO(3)$ the ratio is about 1.1, close to one, as Corollary 4.3 of the paper predicts for the rotation group with nearly isotropic data. For noncompact groups, such as $Sp(4)$, it is about 2: there the Lie algebra estimate differs from the least squares solution over the group already at first order, and the logarithm and the exponential can amplify the noise when $g_\ast$ is far from the identity (Section 4 of the paper).
Tests
Each test below checks one property of the method or of its building blocks, and most of them correspond to a result in the paper. Unless stated otherwise, a test runs over the eight groups $SO(3)$, $SL(3)$, $SO(3,1)$, $Sp(4)$, $SE(3)$, $SO(6)$, $Sp(6)$ and $U(4)$. The tests run in the browser on random data, so pressing the button again gives a fresh set of draws. A test marked as an expected failure checks that the method fails where the theory says it should.
Code
All of the numerics on this page are in the two files below. The C file has no dependencies, not even the C library, and implements its own logarithm, exponential and random numbers. The Python file is the reference implementation used in the paper.
# the whole method, in Python
g0 = Y @ np.linalg.pinv(X) # least squares fit
L = scipy.linalg.logm(g0).real # principal logarithm
g = scipy.linalg.expm(proj(L)) # project onto the Lie algebra, map back to G
Loading…
Rebuild the WebAssembly module with src/build.sh, which needs clang with the wasm32 target and wasm-ld.