From: d on
hi,
Is there's a matlab function that calculates the Perron vector of a matrix ?
(the eigenvector that corresponds to the "Perron root" or the "Perron–Frobenius eigenvalue") ?

thank you,
D
From: d on
just to make it clear - I wish to use it on a non-negative matrix.
(of course, for a strictly positive matrix A, [e,v] = eigs(A,1) would do)

thanks again,
D
From: Matt J on
"d " <dagkatan(a)yahoo.com> wrote in message <htbq5q$3ka$1(a)fred.mathworks.com>...
> hi,
> Is there's a matlab function that calculates the Perron vector of a matrix ?
> (the eigenvector that corresponds to the "Perron root" or the "Perron&#8211;Frobenius eigenvalue") ?
=============

Something like this perhaps:

[V,D]=eig(myMatrix);
[trash,idx]=max(abs(diag(D)));
PerronVector=V(:,idx);
From: Bruno Luong on
"Matt J " <mattjacREMOVE(a)THISieee.spam> wrote in message <htbuco$59a$1(a)fred.mathworks.com>...
> "d " <dagkatan(a)yahoo.com> wrote in message <htbq5q$3ka$1(a)fred.mathworks.com>...
> > hi,
> > Is there's a matlab function that calculates the Perron vector of a matrix ?
> > (the eigenvector that corresponds to the "Perron root" or the "Perron&#8211;Frobenius eigenvalue") ?
> =============
>
> Something like this perhaps:
>
> [V,D]=eig(myMatrix);
> [trash,idx]=max(abs(diag(D)));
> PerronVector=V(:,idx);

Not quite, first we have to note that using max(diag(D)) is correct. But even with that change, I don't believe there is any warranty the above would return Perron vector.

For example let
Q=[0 1 0 0;
1 0 0 0;
0 0 0 1;
0 0 1 0];

We have

V1 = [1; 1; 0; 0]
V2 = [0; 0; 1; 1]

are eigen vectors corresponding to rho(Q)=1, and both are Perron vectors. However there is no thing to prevent Matlab to return

V1 = [1; 1; -1; -1]
V2 = [2; 2; -1; -1]

for example. Both of course are not Perron's vector. That's where the difficulty arises.

Bruno
From: Bruno Luong on
I suggest to use LINPROG (opt toolbox) to eventually "fix" the eigen vector.

[V D]=eig(M);
lambda = diag(D);
rho = max(lambda);
tol = 1e-10; % use some small tolerance
ind = find(lambda>=rho*(1-tol));
V = V(:,ind);

% Use linear programming to find a combination of V that
% has non-negative elements
% Vperron := V*x
% Vperron >= 0 <=> -V*x w= 0
% sum(V*x) = 1 <=> sum(V,1)*x = 1
A = -V;
b = zeros(size(V,1),1);
Aeq = sum(V,1);
beq = 1;
dummy = ones(size(V,2),1);
x = linprog(dummy, A, b, Aeq, beq);
Vperron = V*x

% Bruno