From: Alessandro Barracco Date: 2011-01-26T04:26:04+09:00 Subject: matrix: exchange rows + exchange columns Hi all, I wrote two new method for exchange 2 row (2 columns) in a matrix: class Matrix def exchange_rows(i,j) a = Matrix.rows(@rows) # matrice originale b = a.clone() # matrice di servizio for k in 0...a.column_size a[i,k] = b[j,k] a[j,k] = b[i,k] end return a end def exchange_columns(i,j) a = Matrix.rows(@rows) # matrice originale b = a.clone() # matrice di servizio for k in 0...a.row_size a[k,i] = b[k,j] a[k,j] = b[k,i] end return a end I hope it is usefull to you.... -- Posted via http://www.ruby-forum.com/.