code: public Matrix createSparseMatrix() {
  
          Matrix m = Matrices.create(matrix_row_map.size(), matrix_column_map.size(), false);
          for (int row_num = 0; row_num < matrix_row_map.size(); row_num++) { // for each pattern
              String p = matrix_row_map.get(new Integer(row_num));
              String[] p_sp = p.split(":");
              String a = p_sp[0];
              String b = p_sp[1];
              for (int col_num = 0; col_num < matrix_column_map.size(); col_num++) { // for each phrase
                  InterveningWordsPattern col_pattern = matrix_column_map.get(new Integer(col_num));
                  String pattern = col_pattern.getPattern();
                  String comb_patterns;
                  if (col_pattern.getReverse()) { //if the column is a reverse pattern...word2 P word1
                      comb_patterns = ".*\\s" + b + pattern + a + "\\s.*";
                  } else {
                      comb_patterns = ".*\\s" + a + pattern + b + "\\s.*";
                  }
                  try {
                      m.set(row_num, col_num, (double)countWildcardPhraseFrequencies(new File(DATA_DIR), comb_patterns));
                  } catch (Exception e) {
                      System.err.println("could not perform wildcard search");
                  }
              }
          }
          System.err.println("\nCompleted matrix generation.");
          //System.err.println("Number of rows: " + m.rows());
          //System.err.println("Number of cols: " + m.columns());
          return m;
      }
docs: Creates the sparse matrix.  Should be called after {@link
  #findPatterns()}, {@link #mapRows()}, and {@link #mapColumns()}.  The
  returned {@code Matrix} should be used in the SVD process.
  
  @return the sparse Matrix.