# Section 10: at a critical point U of the 1-norm on the unitary group U_N, with phase matrix S and with X = S^*U positive, we compare the # Hessian of L(U) = ||U||_1 on U_N, of dimension N^2, with the Hessian of M(S) = Tr|S| on the torus of the matrices with entries of # modulus 1, of dimension N^2 too. We print the inertias (negative, zero, positive), for the plain design matrices, the matrices K_N, # Fourier matrices, a matrix of the Fourier family of order 4, and the exact saddle of order 4 from the paper of Chat, Grok and Teo. Usage: python3 inertia.py import numpy as np from designs import SETS, matrices def hessL(U): # in an orthonormal basis of the self-adjoint matrices n = len(U); S = U/np.abs(U); X = S.conj().T @ U; basis = [np.diag(np.eye(n)[j]).astype(complex) for j in range(n)] for j in range(n): for k in range(j + 1, n): E = np.zeros((n, n), complex); E[j, k] = E[k, j] = 1/np.sqrt(2); basis.append(E) E = np.zeros((n, n), complex); E[j, k] = 1j/np.sqrt(2); E[k, j] = -1j/np.sqrt(2); basis.append(E) R = [((U @ B)*S.conj()).real/np.sqrt(np.abs(U)) for B in basis] # second variation along U exp(itB), polarized return np.array([[(a*b).sum() - np.trace(X @ (B @ C + C @ B)).real/2 for b, C in zip(R, basis)] for a, B in zip(R, basis)]) def hessM(U): n = len(U); S = U/np.abs(U); X = S.conj().T @ U; s, v = np.linalg.eigh(X); w = 1/(s[:, None] + s[None, :]); Ys = [] for i in range(n): for j in range(n): E = np.zeros((n, n), complex); E[i, j] = 1j*S[i, j]; Y = v.conj().T @ U.conj().T @ E @ v; Ys.append(Y - Y.conj().T) return np.array([[0.5*(A.conj()*B*w).sum().real for B in Ys] for A in Ys]) - np.diag(np.abs(U).flatten()) def inertia(H, eps=1e-8): e = np.linalg.eigvalsh(H); return (int((e < -eps).sum()), int((abs(e) <= eps).sum()), int((e > eps).sum())) if __name__ == "__main__": a, b = np.cos(np.pi/8)/np.sqrt(2), np.sin(np.pi/8)/np.sqrt(2) items = [("Fourier, order 3", np.exp(2j*np.pi*np.outer(range(3), range(3))/3)/np.sqrt(3)), ("Fourier, order 5", np.exp(2j*np.pi*np.outer(range(5), range(5))/5)/np.sqrt(5)), ("Fourier family, order 4", np.array([[1, 1, 1, 1], [1, np.exp(1j), -1, -np.exp(1j)], [1, -1, 1, -1], [1, -np.exp(1j), -1, np.exp(1j)]])/2), ("saddle of order 4", np.array([[a, b, a, b], [a, -b, -b, -a], [b, a, -a, b], [b, -a, -b, a]]))] items += [("K_%d" % n, 2*np.ones((n, n))/n - np.eye(n)) for n in (3, 4, 5, 6, 7)] items += [(name, matrices(v, D)[0]) for name, (v, D) in SETS.items() if v <= 15] for name, U in items: U = U.astype(complex); S = U/np.abs(U); X = S.conj().T @ U print("%-26s smallest eigenvalue of X %.4f, inertia of the Hessian of L %s, of the Hessian of M %s" % (name, np.linalg.eigvalsh((X + X.conj().T)/2).min(), inertia(hessL(U)), inertia(hessM(U))), flush=True)