src/main/java/org/apache/datasketches/characterization/kll/KllDoublesSketchWeightedRankGaussianAccuracyProfile.java [70:140]:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  private int numSteps;
  private int stepSize;
  private int streamLen;
  private long adjRank;

  //The array of Gaussian quantiles for +/- StdDev error analysis
  private double[] gRanks;
  //The tracking array for true values,
  private QuantilesAccuracyStats[] qStatsArr;

  @Override
  public void start(final Job job) {
    this.job = job;
    this.props = job.getProperties();
    extractProperties();
    configureQuantilesAccuracyStatsArray();
    gRanks = createGaussianQuantilesArray();
    configureSketch();
    doTrials();
  }

  private void extractProperties() {
    final int lgStepSize = Integer.parseInt(props.mustGet("LgStepSize"));
    stepSize = 1 << lgStepSize;
    final int lgNumSteps = Integer.parseInt(props.mustGet("LgNumSteps"));
    numSteps = 1 << lgNumSteps;
    streamLen = 1 << (lgStepSize + lgNumSteps);

    //numTrials & error quantiles sketch config
    numTrials = 1 << Integer.parseInt(props.mustGet("LgTrials"));
    errorSkLgK = Integer.parseInt(props.mustGet("ErrSkLgK"));
    adjRank = (criteria == EXCLUSIVE) ? 1L : 0;

    //Target sketch config
    k = Integer.parseInt(props.mustGet("K"));
    criteria = props.mustGet("Criteria").equalsIgnoreCase("INCLUSIVE") ? INCLUSIVE : EXCLUSIVE;
    //useGetRanks = Boolean.parseBoolean(props.mustGet("UseGetRanks"));
    direct = Boolean.parseBoolean(props.mustGet("Direct"));
    weightedUpdate = Boolean.parseBoolean(props.mustGet("WeightedUpdate"));

    final String dataType = props.mustGet("dataType");
    if ( dataType.equalsIgnoreCase("double")) { sketchType = SketchType.DOUBLES_SKETCH; }
    else if (dataType.equalsIgnoreCase("float")) { sketchType = SketchType.FLOATS_SKETCH; }
    //else { sketchType = SketchType.ITEMS_SKETCH; }
    else { throw new IllegalArgumentException("Unknown data type."); }
  }

  void configureQuantilesAccuracyStatsArray() { //initially monotonic
    qStatsArr = new QuantilesAccuracyStats[numSteps];
    for (int i = 0; i < numSteps; i++) {
      final double trueQuantile = stepSize * (i + 1);
      qStatsArr[i] = new QuantilesAccuracyStats(errorSkLgK, i, trueQuantile);
      final long naturalRank = (long)trueQuantile;//only true for monotonic, non-random
      qStatsArr[i].naturalRank = naturalRank;
      qStatsArr[i].normRank = (naturalRank - adjRank) / (double) streamLen;
    }
  }

  //create the array of gaussian quantiles corresponding to +/- 1,2,3 standard deviations
  double[] createGaussianQuantilesArray() {
    final double[] gR = new double[GAUSSIANS_3SD.length - 2]; //omit 0.0 and 1.0
    for (int i = 1; i < GAUSSIANS_3SD.length - 1; i++) {
      gR[i - 1] = GAUSSIANS_3SD[i];
    }
    return gR;
  }

  void configureSketch() {
    if (direct) {
      final int memBytes = KllSketch.getMaxSerializedSizeBytes(k, streamLen, sketchType, true);
      final WritableMemory wmem = WritableMemory.allocate(memBytes);
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -



src/main/java/org/apache/datasketches/characterization/kll/KllFloatsSketchWeightedRankGaussianAccuracyProfile.java [70:140]:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  private int numSteps;
  private int stepSize;
  private int streamLen;
  private long adjRank;

  //The array of Gaussian quantiles for +/- StdDev error analysis
  private double[] gRanks;
  //The tracking array for true values,
  private QuantilesAccuracyStats[] qStatsArr;

  @Override
  public void start(final Job job) {
    this.job = job;
    this.props = job.getProperties();
    extractProperties();
    configureQuantilesAccuracyStatsArray();
    gRanks = createGaussianQuantilesArray();
    configureSketch();
    doTrials();
  }

  private void extractProperties() {
    final int lgStepSize = Integer.parseInt(props.mustGet("LgStepSize"));
    stepSize = 1 << lgStepSize;
    final int lgNumSteps = Integer.parseInt(props.mustGet("LgNumSteps"));
    numSteps = 1 << lgNumSteps;
    streamLen = 1 << (lgStepSize + lgNumSteps);

    //numTrials & error quantiles sketch config
    numTrials = 1 << Integer.parseInt(props.mustGet("LgTrials"));
    errorSkLgK = Integer.parseInt(props.mustGet("ErrSkLgK"));
    adjRank = (criteria == EXCLUSIVE) ? 1L : 0;

    //Target sketch config
    k = Integer.parseInt(props.mustGet("K"));
    criteria = props.mustGet("Criteria").equalsIgnoreCase("INCLUSIVE") ? INCLUSIVE : EXCLUSIVE;
    //useGetRanks = Boolean.parseBoolean(props.mustGet("UseGetRanks"));
    direct = Boolean.parseBoolean(props.mustGet("Direct"));
    weightedUpdate = Boolean.parseBoolean(props.mustGet("WeightedUpdate"));

    final String dataType = props.mustGet("dataType");
    if ( dataType.equalsIgnoreCase("double")) { sketchType = SketchType.DOUBLES_SKETCH; }
    else if (dataType.equalsIgnoreCase("float")) { sketchType = SketchType.FLOATS_SKETCH; }
    //else { sketchType = SketchType.ITEMS_SKETCH; }
    else { throw new IllegalArgumentException("Unknown data type."); }
  }

  void configureQuantilesAccuracyStatsArray() { //initially monotonic
    qStatsArr = new QuantilesAccuracyStats[numSteps];
    for (int i = 0; i < numSteps; i++) {
      final double trueQuantile = stepSize * (i + 1);
      qStatsArr[i] = new QuantilesAccuracyStats(errorSkLgK, i, trueQuantile);
      final long naturalRank = (long)trueQuantile;//only true for monotonic, non-random
      qStatsArr[i].naturalRank = naturalRank;
      qStatsArr[i].normRank = (naturalRank - adjRank) / (double) streamLen;
    }
  }

  //create the array of gaussian quantiles corresponding to +/- 1,2,3 standard deviations
  double[] createGaussianQuantilesArray() {
    final double[] gR = new double[GAUSSIANS_3SD.length - 2]; //omit 0.0 and 1.0
    for (int i = 1; i < GAUSSIANS_3SD.length - 1; i++) {
      gR[i - 1] = GAUSSIANS_3SD[i];
    }
    return gR;
  }

  void configureSketch() {
    if (direct) {
      final int memBytes = KllSketch.getMaxSerializedSizeBytes(k, streamLen, sketchType, true);
      final WritableMemory wmem = WritableMemory.allocate(memBytes);
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -



