Code covered by the BSD License  

Highlights from
Matrix exponential

from Matrix exponential by Stefan Güttel
A rational Chebyshev method to compute the exponential of a symmetric matrix.

test_rcexpmv.m
% TEST_RCEXPMV
% Test driver for RCEXPMV.
%
% This routine can be used to solve u' = A*u, u(0) = v.

% Stefan Guettel, 2010.


randn('state',0);
d = 200;                                % problem size
A = -.01*(d+1)^2*gallery('tridiag',d);  % matrix A (symm. neg.-semidef.)
v = randn(d,3);                         % 3 vectors
tol = 1e-8;                             % error tolerance
tic; exact = expm(full(A))*v; toc       % Matlab's expm(A)*v
tic; [f,m] = rcexpmv(A,v,tol); toc      % rational Chebyshev
norm(f-exact)/norm(v)                   % check error

Contact us