Package ch.akuhn.util

Examples of ch.akuhn.util.PrintOn


        }
        return terms;
    }

    public void storeOn(Appendable app) {
        PrintOn out = new PrintOn(app);
        int count = -1;
        for (Count<String> each: sortedCounts()) {
            if (each.count != count) out.print(count = each.count).space();
            out.append(each.element).space();
        }
        out.cr();
    }
View Full Code Here


    /** @see http://tedlab.mit.edu/~dr/svdlibc/SVD_F_ST.html */
    public void storeSparseOn(Appendable appendable) {
        // this stores the transposed matrix, but as we will transpose it again
        // when reading it, this can be done without loss of generality.
        PrintOn out = new PrintOn(appendable);
        out.print(this.columnCount()).space();
        out.print(this.rowCount()).space();
        out.print(this.used()).cr();
        for (Vector row: rows()) {
            out.print(row.used()).cr();
            for (Entry each: row.entries()) {
                out.print(each.index).space().print(each.value).space();
            }
            out.cr();
        }
        out.close();
    }
View Full Code Here

        if (each.value < min) min = each.value;
    return min;
  }

  public void storeOn(Appendable appendable) {
    PrintOn p = new PrintOn(appendable);
    p.p("{\"n\":").p(rowCount()).p(",\"m\":").p(columnCount()).p(",\"data\":[");
    for (Vector row: rows()) {
      p.separatedBy(",").p("[");
      PrintOn pp = new PrintOn(p);
      for (Entry each: row.entries()) pp.separatedBy(",").p(each.value);
      p.p("]");
    }
    p.p("]}");
  };
View Full Code Here

    /** @see http://tedlab.mit.edu/~dr/svdlibc/SVD_F_ST.html */
    public void storeSparseOn(Appendable appendable) {
        // this stores the transposed matrix, but as we will transpose it again
        // when reading it, this can be done without loss of generality.
        PrintOn out = new PrintOn(appendable);
        out.print(this.columnCount()).space();
        out.print(this.rowCount()).space();
        out.print(this.used()).cr();
        for (Vector row: rows()) {
            out.print(row.used()).cr();
            for (Entry each: row.entries()) {
                out.print(each.index).space().print(each.value).space();
            }
            out.cr();
        }
        out.close();
    }
View Full Code Here

TOP

Related Classes of ch.akuhn.util.PrintOn

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.