mirror of
https://github.com/kuhyx/WUT_Computer_Science.git
synced 2026-07-06 13:23:14 +02:00
12 lines
383 B
Matlab
12 lines
383 B
Matlab
function [eigenvalues, iteration] = eigenvaluesWithoutShifts(A, tol, maxIterations)
|
|
iteration = 0;
|
|
while iteration < maxIterations && max(max(A-diag(diag(A)))) > tol
|
|
[Q, R] = qrGramSchmidt(A);
|
|
A = R * Q;
|
|
iteration = iteration + 1;
|
|
end
|
|
if iteration > maxIterations
|
|
error('More iterations needed');
|
|
end
|
|
eigenvalues = diag(A);
|
|
end |