code: public Matrix applyEntropyTransformations(Matrix mat) {
          int n = mat.columns();
          int m = mat.rows();
          for (int col_num = 0; col_num < n; col_num++) {
              double col_total = 0.0;
              for (int row_num = 0; row_num < m; row_num++) {
                  col_total += mat.get(row_num,col_num);
              }
              //System.err.println("coltotal: " + col_total);
              if (col_total == 0.0) 
                  continue;
  
              double entropy = 0.0;
              for (int row_num = 0; row_num < m; row_num++) {
                  double p = mat.get(row_num,col_num)/col_total;
                  //System.err.print(p + " ");
                  if (p==0.0)
                      continue;
                  entropy += p * Math.log10(p);
              }
              //System.err.println("entropy: " + entropy);
              entropy *= -1;
              double w = 1 - entropy/Math.log10(m);
              //System.err.println("w: " + w);
              for (int row_num = 0; row_num < m; row_num++) {
                  mat.set(row_num, col_num, w*Math.log10(mat.get(row_num, col_num) + 1.0));
              }
          }
          return mat;
      }
docs: Applies log and entropy transformations to the sparse matrix [Landauer and Dumais, 1997].
  
  @return the sparse Matrix after log and entropy transformations.