[SciPy-user] Need Advice With Arrays and Calculating Eigenvectors

Rich Shepard rshepard@appl-ecosys....
Thu Feb 22 12:17:15 CST 2007


   As a newcomer to python, NumPy, and SciPy I need to learn how to most
efficiently manipulate data. Today's need is reducing a list of tuples to
three smaller lists of tuples, creating a symmetrical matrix from each list,
and calculating the Eigenvector of each of the three symmetrical matrices.

   The starting list contains 9 tuples. Each tuple has 30 items: a category
name, a subcategory name, and 28 floats. These were selected from a
database, and a tuple looks like this one:

(u'soc', u'pro', 1.3196923076923075, 3.8109999999999999, 1.6943846153846154,
2.7393076923076922, 3.825538461538462, 5.0640769230769234,
3.609923076923077, 3.1429999999999998, 1.5936153846153849,
1.4893846153846153, 2.6563076923076929, 2.2156923076923074,
3.7973076923076921, 2.6884615384615387, 2.7008461538461543,
3.4992307692307687, 2.3813846153846154, 3.2199230769230769,
1.7726923076923078, 2.9855384615384613, 2.8829230769230771,
3.7862307692307695, 2.3791538461538462, 4.0949230769230773,
2.8703846153846153, 2.8296923076923073, 3.319230769230769,
1.8083076923076922)

   The three 'soc' subcategories need to have each of the 28 floats averaged
and assigned to another tuple for 'soc'; same with the other two categories.
That produces a list of three tuples, each with 29 items.

   Each of these 28 floats represents the average of a pair-wise comparison
of values (in the non-numeric sense). So the first float above represents
the cell (1,2), the second float represents the value of the cell (1,3) and
so on. The diagonal of the matrix is 1.

   When I have these three symmetrical matrices, I want to call eigen() on
each one to calculate the principal Eignevector.

   I can think of indirect ways of doing all this, but I'm sure that there
are much more efficient approaches known to those who have done this before.
So, I'd like your suggestions and recommendations. Of course, if I've not
clearly explained my needs, please ask.

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