method
transpose
ruby latest stable - Class:
Matrix
transpose()public
Returns the transpose of the matrix.
Matrix [[1,2], [3,4], [5,6]] => 1 2 3 4 5 6 Matrix [[1,2], [3,4], [5,6]].transpose => 1 3 5 2 4 6
# File lib/matrix.rb, line 1278
def transpose
return self.class.empty(column_count, 0) if row_count.zero?
new_matrix @rows.transpose, row_count
end