[SciPy-user] Proper Use of NumPy's eig()

Rich Shepard rshepard@appl-ecosys....
Tue Feb 27 16:21:25 CST 2007


On Tue, 27 Feb 2007, Robert Kern wrote:

> Without knowing your input, I can't see anything particularly wrong.
> Unless if E were real-symmetric (or complex-Hermitian), you are likely to
> end up with complex eigenvalues.

Robert,

   It's been decades since I last worked a lot with linear algebra. I suspect
that I've mis-handled the calculations between raw input and final
symmectric matrix. It is supposed to be symmetrical. And the values of the
principal eigenvector should add to 1.00 because they should be the relative
weights of input factor.

> I don't think that the notion of a principal eigenvector is well-defined if the
> matrix is not symmetric. But if you do have a symmetric matrix:

> import numpy as np
> from scipy import linalg
>
> eigvals, eigvecs = linalg.eig(E)
> i = np.real_if_close(eigvals).argmax()
> principal_eigvec = eigvecs[:, i]

   This produces:

[  6.24249034e-01+0.j   5.11335982e-01+0.j   3.67333773e-01+0.j
    3.01189122e-01+0.j   2.43449050e-01+0.j   1.82948476e-01+0.j
    1.43655139e-01+0.j   9.91225725e-02+0.j]

   ... and these total approximately 2.472.

   So, it's time to look at the input (which is almost certainly OK) and more
closely at how those input values are extracted, averaged, and reduced to a
symmetrical matrix.

Thanks,

Rich

-- 
Richard B. Shepard, Ph.D.               |    The Environmental Permitting
Applied Ecosystem Services, Inc.        |          Accelerator(TM)
<http://www.appl-ecosys.com>     Voice: 503-667-4517      Fax: 503-667-8863


More information about the SciPy-user mailing list