Method: Matrix#transpose

Defined in:
lib/matrix.rb

#transposeObject Also known as: t

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


1341
1342
1343
1344
# File 'lib/matrix.rb', line 1341

def transpose
  return self.class.empty(column_count, 0) if row_count.zero?
  new_matrix @rows.transpose, row_count
end