function [INVD] = invdist(P)
%This function computes the invariant distribution
%  of a stochastic matrix P
N = size(P, 2);
B = (P - eye(N));
B(1:N,N) = ones(N, 1);
o = zeros(1, N);
o(N) = 1;
INVD = o*inv(B);
