Example #1
0
 /**
   * Unit tests {@code StdStats}.
   * Convert command-line arguments to array of doubles and call various methods.
   *
   * @param args the command-line arguments
   */
  public static void main(String[] args) {
      double[] a = StdArrayIO.readDouble1D();
      StdOut.printf("       min %10.3f\n", min(a));
      StdOut.printf("      mean %10.3f\n", mean(a));
      StdOut.printf("       max %10.3f\n", max(a));
      StdOut.printf("    stddev %10.3f\n", stddev(a));
      StdOut.printf("       var %10.3f\n", var(a));
      StdOut.printf("   stddevp %10.3f\n", stddevp(a));
      StdOut.printf("      varp %10.3f\n", varp(a));
  }
Example #2
0
   /**
     * Unit tests {@code StdArrayIO}.
     *
     * @param args the command-line arguments
     */
    public static void main(String[] args) {

        // read and print an array of doubles
        double[] a = StdArrayIO.readDouble1D();
        StdArrayIO.print(a);
        StdOut.println();

        // read and print a matrix of doubles
        double[][] b = StdArrayIO.readDouble2D();
        StdArrayIO.print(b);
        StdOut.println();

        // read and print a matrix of doubles
        boolean[][] d = StdArrayIO.readBoolean2D();
        StdArrayIO.print(d);
        StdOut.println();
    }