Fréchet Derivatives and Condition Numbers of Matrix Functions
#include <mtl/operation/frechet.hpp>
auto [F, L] = mtl::expm_frechet(A, E); // F = exp(A), L = L_exp(A, E)auto [G, M] = mtl::logm_frechet(A, E); // log, and its derivativeauto [X, N] = mtl::sqrtm_frechet(A, E); // the principal square root
double k1 = mtl::expm_cond(A); // relative condition number, 1-normdouble k2 = mtl::logm_cond(A);double k3 = mtl::sqrtm_cond(A);
#include <mtl/operation/normest1.hpp>double est = mtl::normest1(A); // an estimate of ||A||_1 from productsWhat they measure
Section titled “What they measure”The Fréchet derivative of a matrix function f at A is the linear map
L_f(A, ·) with
f(A + E) = f(A) + L_f(A, E) + o(‖E‖).It is the first-order response of f(A) to a perturbation E. Its norm
‖L_f(A)‖ = max_E ‖L_f(A, E)‖ / ‖E‖ gives the relative condition number
cond(f, A) = ‖L_f(A)‖ ‖A‖ / ‖f(A)‖,the factor by which a relative change in A can be amplified in f(A)
(Higham 2008, chapter 3). A computed f(A) with a relative backward error of
order u is accurate to about cond(f, A) · u.
The derivatives have their own uses: sensitivity analysis, Newton’s method for matrix equations, and the Jacobians of the exponential and logarithm maps of a matrix Lie group, which an estimator or optimizer on SO(3) or SE(3) needs.
How they are computed
Section titled “How they are computed”-
expm_frechetandlogm_frechetuse the block identity (Mathias 1996; Higham 2008, §3.2)f([A E; 0 A]) = [f(A) L_f(A, E); 0 f(A)],- Evaluation: with MTL5’s own
expmandlogmon the 2n × 2n matrix, so the derivative inherits their precision-dependent choice of degree and scaling. - Scaling of
E:Eis first scaled by a power of two to the 1-norm ofA, so that the block matrix is not scaled forE’s sake. The result is scaled back.Lis linear inEand the scaling is exact, soL(A, 2^k E) = 2^k L(A, E)bit for bit. - Cost: the block form costs about eight evaluations of
fat size n. Al-Mohy & Higham (2009) computeL_exp(A, E)with fewer operations, by differentiating the Padé and squaring steps. That is a possible optimization, not a change in accuracy.
- Evaluation: with MTL5’s own
-
sqrtm_frechetuses the Sylvester equationX L + L X = E, withX = sqrtm(A)(Higham 2008, §6.1). It is solved bysylvester. -
Errors: each function throws as its
fdoes.logm_frechetandsqrtm_frechetthrowstd::domain_errorfor an eigenvalue on the closed negative real axis.
Condition numbers
Section titled “Condition numbers”expm_cond, logm_cond and sqrtm_cond estimate the relative condition
number in the 1-norm, as Higham (2008, §3.4) does:
- The operator.
‖L_f(A)‖is replaced by‖K(A)‖₁, whereK(A)is the n² × n² Kronecker form,K vec(E) = vec(L_f(A, E)). The two are within a factor n of each other. - The estimate.
‖K(A)‖₁is estimated bynormest1, with one Fréchet derivative per column.Kis never formed. - The adjoint. For these three functions
f(z̄) = conj f(z), soK(A)ᴴis the Kronecker form atAᴴ, and the adjoint products are derivatives atAᴴ.
Each estimate costs about 10–20 Fréchet derivatives. The tests compare each
estimate with ‖K(A)‖₁ formed exactly, column by column. It is a lower bound,
and within a factor 3.
normest1
Section titled “normest1”normest1 is Higham & Tisseur’s (2000) block 1-norm estimator, the algorithm
of MATLAB’s normest1 and SciPy’s onenormest:
- How it works: it estimates
‖A‖₁from productsA XandAᴴ Ywith n × t blocks (t = 2 by default), soAcan be an operator. - What it returns: a lower bound, in practice within a factor 3, and often exact. It was exact for 22 of 35 random dense matrices in the tests, which have nearly equal column sums and so are the hard case. It is exact for a matrix with a dominant column.
- The operator overload takes the size and two callables,
apply(X) → A Xandapply_adjoint(Y) → Aᴴ Y. The matrix overload appliesAwithmult. - Reproducible: the random starting columns use a fixed seed.
- Overflow: when a product
A Xhas an entry that is not finite, the norm is beyond the representable range, andnormest1returns infinity.
References
Section titled “References”- R. Mathias, “A chain rule for matrix functions and applications”, SIAM J. Matrix Anal. Appl. 17(3), 610–620, 1996.
- N. J. Higham and F. Tisseur, “A block algorithm for matrix 1-norm estimation, with an application to 1-norm pseudospectra”, SIAM J. Matrix Anal. Appl. 21(4), 1185–1201, 2000.
- A. H. Al-Mohy and N. J. Higham, “Computing the Fréchet derivative of the matrix exponential, with an application to condition number estimation”, SIAM J. Matrix Anal. Appl. 30(4), 1639–1657, 2009.
- N. J. Higham, Functions of Matrices: Theory and Computation, SIAM, 2008, chapter 3.