Generating unitary matrices numerically - "close" to the identity element
EDIT: broke this into two parts - for these were two different questions.
For numerically obtaining the stabilities of a matricial equation, i need to generate an ensemble of matrices that are members of SU(n), and strategies for uniform random generation of those are outlined here. But I also need these unitary matrices to be clustered close to the SU(n) identity operation, at some fixed "distance". Thus my question distills to -
What might be a good metric for SU(n) matrices? EDIT: one option has been provided by @Jim_Belk downstairs (:D) - certainly feel free to add more!
How does one generate SU(n) matrices close to the Identity?
EDIT: are there any alternatives other than computing the generators first and then exponentiating them?
If you find the questions framed improperly or dubious, do tell!
Solution 1:
If you want to generate random elements of $SU(n)$ close to the identity, it seems to me that the most logical approach would be to generate random elements of the Lie algebra $\mathfrak{su}(n)$, and then exponentiate them.
The Lie algebra $\mathfrak{su}(n)$ consists of all $n\times n$ matrices $A$ with trace $0$ satisfying $A^\dagger = -A$. In particular, the diagonal entries of $A$ must be pure imaginary and add up to $0$, and the entries below the diagonal are entirely determined by the entries above the diagonal. Given a matrix $A\in\mathfrak{su}(n)$, the exponential $\exp(tA)$ is a unitary matrix for all $t\in\mathbb{R}$.
There is a standard inner product on $\mathfrak{su}(n)$, namely the negative of the Killing form, which is invariant under the adjoint action. This is given by the formula $$ \langle A, B\rangle = -2n\,\mathrm{tr}(AB) = -2n\sum_{i=1}^n\sum_{j=1}^n a_{ij} b_{ji} $$ We will drop the factor of $2n$. Since $b_{ji} = -b_{ij}^*$, this can also be written $$ \langle A, B\rangle = \sum_{i=1}^n\sum_{j=1}^n a_{ij} b_{ij}^* \;=\; \sum_{i=1}^n \mathrm{Im}(a_{ii})\mathrm{Im}(b_{ii}) + \sum_{i<j} 2 \bigl[\mathrm{Re}(a_{ij})\mathrm{Re}(b_{ij})+\mathrm{Im}(a_{ij})\mathrm{Im}(b_{ij})\bigr] $$ In particular, $$ \langle A,A\rangle \;=\; \sum_{i=1}^n |a_{ii}|^2 + \sum_{i<j} 2|a_{ij}|^2 $$ Presumably the right thing to do is to choose random elements $A$ of $\mathfrak{su}(n)$ having unit norm with respect to this inner product, and then compute $\exp(tA)$ for some fixed small value of $t$. To choose random elements with unit norm, you should start by finding an orthonormal basis for $\mathfrak{su}(n)$ (which should be fairy easy given the above formulas, except for the added complication that the sum of the diagonal entries is $0$, which can be solved with Gram-Schmidt), and then choose coefficients for these basis vectors in the same way that you would choose the coordinates of a random point on the unit sphere in $\mathbb{R}^{n^2-1}$.
Solution 2:
A cheap and cheerful way to get a (special) unitary matrix close to the identity is to use the product of two Householder reflections, where the unit vectors defining them are close. I reckon the Frobenius norm of the difference between the product and the identity is proportional to the absolute value of the sine of the angle between the vectors.