[Numpy-discussion] sort bug

Anton Sherwood bronto@pobox....
Sun Apr 29 04:05:45 CDT 2007


> Anton Sherwood wrote:
>     I refined it slightly:
> 
>     val,vec = numpy.linalg.eig(adj)
>     indx = val.argsort()[-4:-1]
>     val = val.take(indx)
>     vec = vec.take(indx, axis=1)
>     master = zip(val, vec.T)

Charles R Harris wrote:
> But that won't get the 4  largest, and will ignore the last eigenvalue, 
> whatever it is.  . . .

Are you making two points here or only one?

I'm using eigenvectors of a graph's adjacency matrix as "topological" 
coordinates of the graph's vertices as embedded in 3space (something I 
learned about just recently).  Whenever I've done this with a graph that 
*does* have a good 3d embedding, using the first eigenvector results in 
a flat model: apparently the first is not independent, at least in such 
cases.  So, yeah, I really did intend to throw away the largest and use 
the next three.  Are you saying this code doesn't give me that?  The 
output of my first few test cases looks good.

-- 
Anton Sherwood, http://www.ogre.nu/
"How'd ya like to climb this high *without* no mountain?" --Porky Pine


More information about the Numpy-discussion mailing list