Hi, thanks for your reply. The Wikipedia article states that:

"the Perron–Frobenius theorem ... asserts that a real square matrix with positive entries has a unique largest real eigenvalue and that the corresponding eigenvector has strictly positive components."

My program finds the largest eigenvalue (I have checked this value to verify it is the largest), and then finds the associated eigenvector, which it prints out. So according to the theory, these should all be positive values. Or are you saying that a vector with all negative values is identical to a vector with the same values, but all positive?

I have been playing around with the code, and I've noticed two strange behaviours:
1. If N <= 10, then the leading eigenvector has all positive values, as expected. But if N > 10, then all the values are negative.
2. If I add a very small value to each element in M, then the leading eigenvector has all positive values, as expected. ie. The matrix assignment becomes: gsl_matrix_set(M, i, j, 0.0001 + i * j);

Thanks for any help.