Home > manopt > tools > dfunm.m

# dfunm

## PURPOSE

Fréchet derivative of matrix functions.

## SYNOPSIS

function D = dfunm(funm, X, H)

## DESCRIPTION

``` Fréchet derivative of matrix functions.

function D = dfunm(funm, X, H)

Computes the directional derivative (the Fréchet derivative) of a matrix
function (such as @logm, @expm, ...) at X along H (square matrices),
according to a very nice trick which appears in this paper:

"Computing the Fréchet derivative of the matrix exponential, with an
application to condition number estimation",
Awad H. Al-Mohy and Nicholas J. Higham, 2009.
http://eprints.ma.man.ac.uk/1218/01/covered/MIMS_ep2008_26.pdf

Thus, D = lim_(t -> 0) (funm(X + tH) - funm(X)) / t.

This code is simple, but may not be the most efficient. In particular, it
requires computing the matrix function on matrices which are four times
as big, and which may have lost important structure (such as symmetry).

## CROSS-REFERENCE INFORMATION

This function calls:
This function is called by:
• dexpm Fréchet derivative of the matrix exponential.
• dlogm Fréchet derivative of the matrix logarithm.
• dsqrtm Fréchet derivative of the matrix square root.

## SOURCE CODE

```0001 function D = dfunm(funm, X, H)
0002 % Fréchet derivative of matrix functions.
0003 %
0004 % function D = dfunm(funm, X, H)
0005 %
0006 % Computes the directional derivative (the Fréchet derivative) of a matrix
0007 % function (such as @logm, @expm, ...) at X along H (square matrices),
0008 % according to a very nice trick which appears in this paper:
0009 %
0010 % "Computing the Fréchet derivative of the matrix exponential, with an
0011 % application to condition number estimation",
0012 % Awad H. Al-Mohy and Nicholas J. Higham, 2009.
0013 % http://eprints.ma.man.ac.uk/1218/01/covered/MIMS_ep2008_26.pdf
0014 %
0015 % Thus, D = lim_(t -> 0) (funm(X + tH) - funm(X)) / t.
0016 %
0017 % This code is simple, but may not be the most efficient. In particular, it
0018 % requires computing the matrix function on matrices which are four times
0019 % as big, and which may have lost important structure (such as symmetry).
0020 %
0022
0023 % This file is part of Manopt: www.manopt.org.
0024 % Original author: Nicolas Boumal, July 3, 2015.
0025 % Contributors:
0026 % Change log:
0027
0028     n = size(X, 1);
0029
0030     assert(length(size(X)) == 2,     'X and H must be square matrices.');
0031     assert(length(size(H)) == 2,     'X and H must be square matrices.');
0032     assert(size(X, 1) == size(X, 2), 'X and H must be square matrices.');
0033     assert(all(size(X) == size(H)),  'X and H must have the same size.');
0034
0035     Z = zeros(n);
0036     A = funm([X, H ; Z, X]);
0037     D = A(1:n, (n+1):end);
0038
0039 end```

Generated on Fri 08-Sep-2017 12:43:19 by m2html © 2005