Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Perron eigenvector

221 views
Skip to first unread message

d

unread,
May 23, 2010, 1:55:06 PM5/23/10
to
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

d

unread,
May 23, 2010, 2:21:04 PM5/23/10
to
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

Matt J

unread,
May 23, 2010, 3:07:04 PM5/23/10
to
"d " <dagk...@yahoo.com> wrote in message <htbq5q$3ka$1...@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);

Bruno Luong

unread,
May 23, 2010, 3:56:05 PM5/23/10
to
"Matt J " <mattja...@THISieee.spam> wrote in message <htbuco$59a$1...@fred.mathworks.com>...

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

Bruno Luong

unread,
May 23, 2010, 4:39:04 PM5/23/10
to
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

d

unread,
May 23, 2010, 4:49:03 PM5/23/10
to
"Bruno Luong" <b.l...@fogale.findmycountry> wrote in message
...

> > 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. Both of course are not Perron's vector. That's where the difficulty arises.
>
> Bruno

thank you for responding.

I would like to add that I only need the vector corresponding to the largest (absolute) eigenvalue, therefore I would rather not compute all eigenvalues+eigenvectors. I'm dealing with quite large, somewhat sparse, matrices (~700x700).

D

Bruno Luong

unread,
May 23, 2010, 5:05:04 PM5/23/10
to
"d " <dagk...@yahoo.com> wrote in message <htc4bv$so6$1...@fred.mathworks.com>...

>
>
> I would like to add that I only need the vector corresponding to the largest (absolute) eigenvalue, therefore I would rather not compute all eigenvalues+eigenvectors. I'm dealing with quite large, somewhat sparse, matrices (~700x700).
>

Do you have an example where

[V D]=eigs(A,1,'lm')

fails?

Bruno

d

unread,
May 23, 2010, 5:06:04 PM5/23/10
to
"Bruno Luong" <b.l...@fogale.findmycountry> wrote in message <htc3p7$l8f$1...@fred.mathworks.com>...

> I suggest to use LINPROG (opt toolbox) to eventually "fix" the eigen vector.
>
> [V D]=eig(M);
> lambda = diag(D);
.
.
.

> x = linprog(dummy, A, b, Aeq, beq);
> Vperron = V*x
>
> % Bruno


hi Bruno, just saw your suggestion now.
it actually had no problem with the size of the matrix, and was even faster then another code I found:
http://www.mathworks.de/matlabcentral/fileexchange/22763-perron-root-computation

the two methods gave similar results, which I think is a good sign.
thank you very much

D

Bruno Luong

unread,
May 23, 2010, 5:17:03 PM5/23/10
to
"d " <dagk...@yahoo.com> wrote in message <htc5bs$3ln$1...@fred.mathworks.com>...

>
> hi Bruno, just saw your suggestion now.
> it actually had no problem with the size of the matrix, and was even faster then another code I found:
> http://www.mathworks.de/matlabcentral/fileexchange/22763-perron-root-computation
>
> the two methods gave similar results, which I think is a good sign.
> thank you very much

It looks like this code is from people who know about this kind of problem, so you should perhaps use their.

Bruno

chintu gurbani

unread,
Aug 17, 2017, 6:46:18 AM8/17/17
to
"d" wrote in message <htbq5q$3ka$1...@fred.mathworks.com>...
I have designed an estimator that can give perron vector of a matrix. gama represent the perron vector. D_matrix generates a row stochastic matrix, the function code of which is mentioned below.

clc
clear all

n=4;
I=eye(n,n);
gama(:,:,1)=I;
P(:,:,1)=D_Matrix( n)
for i=1:2
P(:,:,i+1)=D_Matrix( n)*P(:,:,i);
for j=1:20
gama(:,:,j+1)=P(:,:,i+1)*gama(:,:,j);
end


end
[RV1, EV1, LV1]=eig(P(:,:,1));
[RV, EV, LV]=eig(P(:,:,i+1));

function [ D ] = D_Matrix( n)
for i=1:n
for j=1:n
D(i,j)=floor(n*rand);
end
D(i,:)=D(i,:)/sum(D(i,:));
end

end

Reference: Cooperative control with distributed gain adaptation and
connectivity estimation for directed networks‡

0 new messages