code: public static void byLength(Matrix m) {
          for (int i = 0; i < m.rows(); ++i) {
              double rowSum = 0;
              for (int j = 0; j < m.columns(); ++j)
                  rowSum += Math.pow(m.get(i,j), 2);
              rowSum = Math.sqrt(rowSum);
  
              // Skip rows whose l2 norm is 0.
              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 the {@code Matrix} to be
  normalized by the l2 norm of each row.
  
  @param m The matrix to normalize.