{"id":377,"date":"2017-09-14T12:01:57","date_gmt":"2017-09-14T15:01:57","guid":{"rendered":"http:\/\/www.professores.uff.br\/diomarcesarlobao\/?page_id=377"},"modified":"2017-09-14T12:01:57","modified_gmt":"2017-09-14T15:01:57","slug":"eigval-m","status":"publish","type":"page","link":"https:\/\/www.professores.uff.br\/diomarcesarlobao\/eigval-m\/","title":{"rendered":"eigval.m"},"content":{"rendered":"<pre>function [evalues, repeats] = eigval(A)\r\n\r\n% eigval  Eigenvalues and their algebraic multiplicity.\r\n%\r\n% evalues = eigval(A) returns the distinct eigenvalues of A,\r\n% with duplicates removed and sorted in decreasing order.\r\n%\r\n% [evalues, repeats] = eigval(A) also returns the row vector\r\n% repeats that gives the multiplicity of each eigenvalue.\r\n% The sum of the multiplicities is n.\r\n%\r\n% Examples: Let A = eye(n) and B = diag([3 4]).\r\n% For A, evalues is 1 and repeats is n.\r\n% For B, evalues is [4; 3]  and repeats is [1 1].\r\n\r\ntol = sqrt(eps);\r\nlambda = sort(eig(A));\r\nlambda = round(lambda\/tol) * tol;\r\n%\r\n% lambda gives all n eigenvalues (repetitions included).\r\n%\r\nevalues = unique(lambda);\r\nevalues = flipud(evalues);\r\nn = length(lambda);\r\nd = length(evalues);\r\nA = ones(n, 1) * evalues';\r\nB = lambda * ones(1, d);\r\nMATCH = abs(A-B) &lt;= tol;\r\n%\r\n% MATCH is an n by d zero matrix except\r\n% MATCH(i,j) = 1 when lambda(i) = evalues(j).\r\n% Summing the columns gives the row vector repeats.\r\n%\r\nrepeats = sum(MATCH);<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>function [evalues, repeats] = eigval(A) % eigval Eigenvalues and their algebraic multiplicity. % % evalues = eigval(A) returns the distinct eigenvalues of A, % with duplicates removed and sorted in decreasing order. % % [evalues, repeats] = eigval(A) also returns the row vector % repeats that gives the multiplicity of each eigenvalue. % The sum [&hellip;]<\/p>\n","protected":false},"author":22,"featured_media":0,"parent":0,"menu_order":0,"comment_status":"closed","ping_status":"closed","template":"","meta":{"_exactmetrics_skip_tracking":false,"_exactmetrics_sitenote_active":false,"_exactmetrics_sitenote_note":"","_exactmetrics_sitenote_category":0,"footnotes":""},"categories":[],"tags":[],"class_list":["post-377","page","type-page","status-publish","hentry"],"_links":{"self":[{"href":"https:\/\/www.professores.uff.br\/diomarcesarlobao\/wp-json\/wp\/v2\/pages\/377","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.professores.uff.br\/diomarcesarlobao\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/www.professores.uff.br\/diomarcesarlobao\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/www.professores.uff.br\/diomarcesarlobao\/wp-json\/wp\/v2\/users\/22"}],"replies":[{"embeddable":true,"href":"https:\/\/www.professores.uff.br\/diomarcesarlobao\/wp-json\/wp\/v2\/comments?post=377"}],"version-history":[{"count":1,"href":"https:\/\/www.professores.uff.br\/diomarcesarlobao\/wp-json\/wp\/v2\/pages\/377\/revisions"}],"predecessor-version":[{"id":378,"href":"https:\/\/www.professores.uff.br\/diomarcesarlobao\/wp-json\/wp\/v2\/pages\/377\/revisions\/378"}],"wp:attachment":[{"href":"https:\/\/www.professores.uff.br\/diomarcesarlobao\/wp-json\/wp\/v2\/media?parent=377"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.professores.uff.br\/diomarcesarlobao\/wp-json\/wp\/v2\/categories?post=377"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.professores.uff.br\/diomarcesarlobao\/wp-json\/wp\/v2\/tags?post=377"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}