Mercurial > matrix-functions
view mftoolbox/expm_cond.m @ 8:a587712dcf5f draft default tip
funm_atom.m: rename fun_atom to funm_atom
* funm_atom.m: rename fun_atom to funm_atom.
author | Antonio Pino Robles <data.script93@gmail.com> |
---|---|
date | Fri, 29 May 2015 09:48:36 +0200 |
parents | 8f23314345f4 |
children |
line wrap: on
line source
function [c,K] = expm_cond(A) %EXPM_COND Relative condition number of matrix exponential. % EXPM_COND(A) is the relative condition number in the Frobenius % norm of the matrix exponential at the matrix A. % [C,K] = EXPM_COND(A) returns the condition number C and the Kronecker % matrix form K of the Frechet derivative. n = length(A); N = n^2; K = zeros(N); E = zeros(n); if nargout < 2 && ~isequal(A,triu(A)) % If returning K cannot use Schur form. A = schur(A,'complex'); end for j = 1:N e = zeros(N,1); e(j) = 1; E(:) = e; X = expm_frechet_pade(A,E); K(:,j) = X(:); end c = norm(K) * norm(A,'fro') / norm(expm(A),'fro');