Open in the MATLAB editor: f08ut_example
function f08ut_example fprintf('f08ut example results\n\n'); % Sove Az = lambda Bz % A and B are the Hermitian banded positive definite matrices: n = 4; ka = int64(2); a = [ -1.13+0.00i 1.94-2.10i -1.40+0.25i 0.00+0.00i; 1.94+2.10i -1.91+0.00i -0.82-0.89i -0.67+0.34i; -1.40-0.25i -0.82+0.89i -1.87+0.00i -1.10-0.16i; 0.00+0.00i -0.67-0.34i -1.10+0.16i 0.50+0.00i]; kb = int64(1); b = [ 9.89+0.00i 1.08-1.73i 0.00+0.00i 0.00+0.00i; 1.08+1.73i 1.69+0.00i -0.04+0.29i 0.00+0.00i; 0.00+0.00i -0.04-0.29i 2.65+0.00i -0.33+2.24i; 0.00+0.00i 0.00+0.00i -0.33-2.24i 2.17+0.00i]; % Convert to general banded format ... [~, ab, ifail] = f01zd( ... 'P', ka, ka, a, complex(zeros(ka+ka+1,n))); [~, bb, ifail] = f01zd( ... 'P', kb, kb, b, complex(zeros(kb+kb+1,n))); % ... and chop to give 'Upper' Hermitian banded format ab = ab(1:ka+1,1:n); bb = bb(1:kb+1,1:n); % Factorize B uplo = 'Upper'; [bbfac, info] = f08ut( ... uplo, kb, bb); % Reduce problem to standard form Cy = lambda*y vect = 'N'; [cb, x, info] = f08us( ... vect, uplo, ka, kb, ab, bbfac); % Find eigenvalues lambda jobz = 'No Vectors'; [~, w, ~, info] = f08hn( ... jobz, uplo, ka, cb); disp('Eigenvalues:'); disp(w');
f08ut example results Eigenvalues: -6.6089 -2.0416 0.1603 1.7712