From: unbewusst.sein@... (=?ISO-8859-1?Q?Une_B=E9v?= =?ISO-8859-1?Q?ue?=) Date: 2007-11-21T18:04:59+09:00 Subject: Re: [Matrix] eigenvalues, eigenvectors in Ruby ??? Axel Etzold wrote: > Have a look at the example on the Wikipedia article. > http://en.wikipedia.org/wiki/Permutation_matrix#Examples YES, that's the one i've followed... > > A permutation matrix has exactly one 1 entry in every row, at the > place that the permutation vector indicates (note that Ruby starts > counting at 0, so the permutation vector given in the Wikipedia article > should actually be (0 3 1 4 2)), the remaining entries are 0. > The reason to associate a vector and a matrix like this is that > due to the way multiplication of matrices is defined, multiplying > > permutation_matrix*matrix > > gives you the column vectors of 'matrix' shuffled as the permutation > vector indicates, i.e. > the matrix (inner arrays=rows) > > [[1,1,1,1,1],[2,2,2,2,2],[3,3,3,3,3],[4,4,4,4,4],[5,5,5,5,5]] > > would be mapped to > > [[1,1,1,1,1],[4,4,4,4,4],[2,2,2,2,2],[5,5,5,5,5],[3,3,3,3,3]] i see, now why permutation isn't a matrix like that : 0 0 1 0 0 0 0 1 1 0 0 0 0 1 0 0 but rather a vector indicating the permutations to be done... thanks a lot ! -- Une B�vue