3 %>@brief Returns eigenvectors of matrix ordered in descending order of eigenvalue.
5 %> @sa MATLAB
's <code>eig()</code> function
7 %> @param varargin see MATLAB's <code>eig()</code>
function
8 %> @return <em>[vectors, lambdas]</em>
12 % [vv, dd] = eigs(A, r); % eigenvectors, eigenvalues
13 [vv, dd] = eig(varargin{:}); % eigenvectors, eigenvalues
15 % the eig() function gives eigenvalues in ascending order, however I have
16 % experienced the opposite with a low-rank matrix.
18 % Also this time I am not taking into account the presence of NaN eigenvalues.
20 % This creates an index vector at column 2 of the 'lambdas' variable
22 lambdas(:, 2) = (1:numel(lambdas))';
23 lambdas = sortrows(lambdas);
25 % However, the index vector is in ascending order and we want the opposite
26 indexes = lambdas(end:-1:1, 2);
30 ll = lambdas(end:-1:1, 1)';
function eig_ordered(in varargin)