From: unbewusst.sein@... (=?ISO-8859-1?Q?Une_B=E9v?= =?ISO-8859-1?Q?ue?=) Date: 2007-11-23T04:40:04+09:00 Subject: Re: eigenvector discrepency was (Re: [Matrix] eigenvalues, eigenvectors in Ruby ???) Axel Etzold wrote: > What is the problem that you are actually trying to solve ? I've two molecules described with a matrix : a = Mol.new( [ [ 0, 1, 1, 0 ], [ 1, 0, 1, 0 ], [ 1, 1, 0, 1 ], [ 0, 0, 1, 0 ] ] ) b = Mol.new( [ [ 0, 1, 1, 1 ], [ 1, 0, 0, 0 ], [ 1, 0, 0, 1 ], [ 1, 0, 1, 0 ] ] ) for example the first one in the first row of a says the carbon numbered 1 is connected to the carbon number 0. i know, from construction a and b differs by a permuation p such that : p * a * p^(-1) = b only the numbered of carbon atoms is different in that case. to state that a === b (within a permutation) it is suffciant to have : eigenvalues of a === eigenvalues of b without respect to the order however to find p i need the eigenvectors as given by the article : http://en.wikipedia.org/wiki/Permutation_matrix in the aboove case: p = [ [ 0, 0, 1, 0 ], [ 0, 0, 0, 1 ], [ 1, 0, 0, 0 ], [ 0, 1, 0, 0 ] ] and computing : p * a * p^( -1 ) = [ [ 0, 1, 1, 1 ], [ 1, 0, 0, 0 ], [ 1, 0, 0, 1 ], [ 1, 0, 1, 0 ] ] gives b or computing : p^( -1 ) * b * p = [ [ 0, 1, 1, 0 ], [ 1, 0, 1, 0 ], [ 1, 1, 0, 1 ], [ 0, 0, 1, 0 ] ] i do have a first version of a script using GSL, working as expected. however with ExtendedMatrix i'm unable to find p from eigenvectors. using GSL or ExtendedMatrix i get the same eigenvalues : GSL: a.eigval = [ 2.170e+00 3.111e-01 -1.000e+00 -1.481e+00 ] b.eigval = [ 2.170e+00 -1.481e+00 3.111e-01 -1.000e+00 ] ExtendedMatrix a.eigval = Vector[-1.0, 2.17008648662603, -1.48119430409202, 0.311107817465982] b.eigval = Vector[-1.48119430409202, 0.311107817465982, -1.0, 2.17008648662603] with GSL, if i compare the eigenvectors : a.eigvec = [ 5.227e-01 3.682e-01 -7.071e-01 3.020e-01 5.227e-01 3.682e-01 7.071e-01 3.020e-01 6.116e-01 -2.536e-01 0.0 -7.494e-01 2.818e-01 -8.152e-01 0.0 5.059e-01 ] b.eigvec = [ 6.116e-01 7.494e-01 2.536e-01 0.0 2.818e-01 -5.059e-01 8.152e-01 0.0 5.227e-01 -3.020e-01 -3.682e-01 -7.071e-01 5.227e-01 -3.020e-01 -3.682e-01 7.071e-01 ] ( i've rounded to 0.0 the values below e-15) from column 0 it's easy to see what aa to be permuted (all the values are the same but in a different order) the first 5.227e-01 in a.eigvec column 0 is found in the third row of b.eigvec column 0 then p[0, 2] = 1 the second 5.227e-01 in a.eigvec column 0 is found in the last row of b.eigvec column 0 then p[1, 3] = 1 the 6.116e-01 (row 2) in a.eigvec column 0 is found in the first row of b.eigvec column 0 then p[2, 1] = 1 the 2.818e-01 (row 3) in a.eigvec column 0 is found in the second row of b.eigvec column 0 then p[3, 1] = 1 giving : [ [ 0, 0, 1, 0 ], [ 0, 0, 0, 1 ], [ 1, 0, 0, 0 ], [ 0, 1, 0, 0 ] ] unfortunately i don't have any theoretical suggestification of this procedure... -- Une B�vue