code: public static void byRow(Matrix m) {
          for (int i = 0; i < m.rows(); ++i) {
              double rowSum = 0;
              for (int j = 0; j < m.columns(); ++j)
                  rowSum += m.get(i,j);
  
              // Skip row whose sume is zero.
              if (rowSum == 0) 
                  continue;
              for (int j = 0; j < m.columns(); ++j)
                  m.set(i,j, m.get(i,j) / rowSum);
          }
      }
docs: Normalize the values of each row in {@code Matrix} to be normalized by
  the length of each row.
  
  @param m The matrix to normalize.