Package gnu.trove.map

Examples of gnu.trove.map.TDoubleDoubleMap


    @Override
    public boolean equals( Object other ) {
        if ( ! ( other instanceof TDoubleDoubleMap ) ) {
            return false;
        }
        TDoubleDoubleMap that = ( TDoubleDoubleMap ) other;
        if ( that.size() != this.size() ) {
            return false;
        }
        double[] values = _values;
        byte[] states = _states;
        double this_no_entry_value = getNoEntryValue();
        double that_no_entry_value = that.getNoEntryValue();
        for ( int i = values.length; i-- > 0; ) {
            if ( states[i] == FULL ) {
                double key = _set[i];
                double that_value = that.get( key );
                double this_value = values[i];
                if ( ( this_value != that_value ) &&
                     ( this_value != this_no_entry_value ) &&
                     ( that_value != that_no_entry_value ) ) {
                    return false;
View Full Code Here


   */
  public static double tValue(double alpha, int n) {
    if(n > 30) {
      n = 31;
    }
    TDoubleDoubleMap map = tValues.get(n);
    if(map == null) {
      throw new IllegalArgumentException("t-values for n=" + n + " not yet tabularized!");
    }

    Double value = map.get(alpha);
    if(value == null) {
      throw new IllegalArgumentException("t-values for alpha=" + alpha + " not tabularized!");
    }

    return value;
View Full Code Here

   *
   * @param n the degree of freedom
   * @param values the t-values
   */
  private static void put(int n, double[] values) {
    TDoubleDoubleMap map = new TDoubleDoubleHashMap();
    map.put(_6000, values[0]);
    map.put(_8000, values[1]);
    map.put(_9000, values[2]);
    map.put(_9500, values[3]);
    map.put(_9750, values[4]);
    map.put(_9900, values[5]);
    map.put(_9950, values[6]);
    map.put(_9990, values[7]);
    map.put(_9995, values[8]);

    map.put(_4000, -values[0]);
    map.put(_2000, -values[1]);
    map.put(_1000, -values[2]);
    map.put(_0500, -values[3]);
    map.put(_0250, -values[4]);
    map.put(_0100, -values[5]);
    map.put(_0050, -values[6]);
    map.put(_0010, -values[7]);
    map.put(_0005, -values[8]);
    tValues.put(n, map);
  }
View Full Code Here

  CanFindThresholdApproximation gaussianThresholdEstimator() {
    return new GaussianThresholdEstimator<PWM, BackgroundModel>(pwm, background);
  }

  protected TDoubleDoubleMap initialCountDistribution() {
    TDoubleDoubleMap scores = new TDoubleDoubleHashMap();
    scores.put(0.0, 1.0);
    return scores;
  }
View Full Code Here

    return scores;
  }

  @Override
  protected ScoreDistributionTop score_distribution_above_threshold(double threshold) throws HashOverflowException {
    TDoubleDoubleMap scores = initialCountDistribution();
    for (int pos = 0; pos < pwm.length(); ++pos) {
      scores = recalc_score_hash(scores, pwm.matrix[pos], threshold - pwm.best_suffix(pos + 1));
      if (exceedHashSizeLimit(scores)) {
        throw new HashOverflowException("Hash overflow in PWM::ThresholdByPvalue#score_distribution_above_threshold");
      }
View Full Code Here

    result.setBestScore(pwm.best_score());
    return result;
  }

  private TDoubleDoubleMap recalc_score_hash(TDoubleDoubleMap scores, double[] column, double least_sufficient) {
    TDoubleDoubleMap new_scores = new TDoubleDoubleHashMap(scores.size());
    TDoubleDoubleIterator iterator = scores.iterator();
    while(iterator.hasNext()) {
      iterator.advance();
      double score = iterator.key();
      double count = iterator.value();
      for (int letter = 0; letter < 4; ++letter) {
        double new_score = score + column[letter];
        if (new_score >= least_sufficient) {
          double add = count * background.count(letter);
          new_scores.adjustOrPutValue(new_score, add, add);
        }
      }
    }
    return new_scores;
  }
View Full Code Here

    return new PvalueInfo(non_upscaled_threshold, pvalue);
  }

  @Override
  public PvalueInfo[] pvaluesByThresholds(double[] thresholds) throws HashOverflowException {
    TDoubleDoubleMap counts = discretedScoringModel().counts_above_thresholds(discretizer.upscale(thresholds));

    PvalueInfo[] infos = new PvalueInfo[thresholds.length];
    for (int i = 0; i < thresholds.length; ++i) {
      infos[i] = infos_by_count(counts, thresholds[i]);
    }
View Full Code Here

      if (exceedHashSizeLimit(scores)) {
        throw new HashOverflowException("Hash overflow in DiPWM::ThresholdByPvalue#score_distribution_above_threshold");
      }
    }

    TDoubleDoubleMap score_count_hash = combine_scores(scores);
    ScoreDistributionTop result = new ScoreDistributionTop(score_count_hash, vocabularyVolume(), threshold);
    result.setWorstScore(dipwm.worst_score());
    result.setBestScore(dipwm.best_score());
    return result;
  }
View Full Code Here

    }
    return new_scores;
  }

  TDoubleDoubleMap combine_scores(TDoubleDoubleMap[] scores) {
    TDoubleDoubleMap combined_scores = new TDoubleDoubleHashMap();
    for (int i = 0; i < 4; ++i) {
      TDoubleDoubleIterator iterator = scores[i].iterator();
      while(iterator.hasNext()) {
        iterator.advance();
        double score = iterator.key();
        double count = iterator.value();
        combined_scores.adjustOrPutValue(score, count, count);
      }
    }
    return combined_scores;
  }
View Full Code Here

    this.left_score_boundary = left_score_boundary;
  }

  // returns map threshold --> count
  public TDoubleDoubleMap counts_above_thresholds(double[] thresholds) throws NotRepresentativeDistribution {
    TDoubleDoubleMap result = new TDoubleDoubleHashMap();
    for (double threshold : thresholds) {
      result.put(threshold, count_above_threshold(threshold));
    }
    return result;
  }
View Full Code Here

TOP

Related Classes of gnu.trove.map.TDoubleDoubleMap

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.