Skip to content

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 derivative
auto [X, N] = mtl::sqrtm_frechet(A, E); // the principal square root
double k1 = mtl::expm_cond(A); // relative condition number, 1-norm
double 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 products

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.

  • expm_frechet and logm_frechet use 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 expm and logm on the 2n × 2n matrix, so the derivative inherits their precision-dependent choice of degree and scaling.
    • Scaling of E: E is first scaled by a power of two to the 1-norm of A, so that the block matrix is not scaled for E’s sake. The result is scaled back. L is linear in E and the scaling is exact, so L(A, 2^k E) = 2^k L(A, E) bit for bit.
    • Cost: the block form costs about eight evaluations of f at size n. Al-Mohy & Higham (2009) compute L_exp(A, E) with fewer operations, by differentiating the Padé and squaring steps. That is a possible optimization, not a change in accuracy.
  • sqrtm_frechet uses the Sylvester equation X L + L X = E, with X = sqrtm(A) (Higham 2008, §6.1). It is solved by sylvester.

  • Errors: each function throws as its f does. logm_frechet and sqrtm_frechet throw std::domain_error for an eigenvalue on the closed negative real axis.

expm_cond, logm_cond and sqrtm_cond estimate the relative condition number in the 1-norm, as Higham (2008, §3.4) does:

  1. The operator. ‖L_f(A)‖ is replaced by ‖K(A)‖₁, where K(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.
  2. The estimate. ‖K(A)‖₁ is estimated by normest1, with one Fréchet derivative per column. K is never formed.
  3. The adjoint. For these three functions f(z̄) = conj f(z), so K(A)ᴴ is the Kronecker form at Aᴴ, and the adjoint products are derivatives at Aᴴ.

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 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 products A X and Aᴴ Y with n × t blocks (t = 2 by default), so A can 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 X and apply_adjoint(Y) → Aᴴ Y. The matrix overload applies A with mult.
  • Reproducible: the random starting columns use a fixed seed.
  • Overflow: when a product A X has an entry that is not finite, the norm is beyond the representable range, and normest1 returns infinity.
  • 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.