def _flip_horizontally(matrix): m = Matrix(matrix.num_rows(), matrix.num_columns()) for i in xrange(m.num_rows()): for j in xrange(m.num_columns()): m[i][j] = matrix[m.num_rows() - i - 1][j] return m
def to_matrix(matrix_as_lists): result = Matrix(len(matrix_as_lists), len(matrix_as_lists[0])) for i in xrange(result.num_rows()): for j in xrange(result.num_columns()): result[i][j] = matrix_as_lists[i][j] return result