transpose method

Matrix2d transpose()

Implementation

Matrix2d transpose() {
  Matrix2d result = Matrix2d(_cols, _rows);
  for (int i = 0; i < _rows; i++) {
    for (int j = 0; j < _cols; j++) {
      result.data!.values[j * _rows + i] = at(i, j);
    }
  }
  return result;
}