Package gnu.trove.map.hash

Examples of gnu.trove.map.hash.TIntDoubleHashMap


     *
     * @param length the length of this vector
     */
    public SparseHashDoubleVector(int length) {
        maxLength = length;
        vector = new TIntDoubleHashMap();
    }
View Full Code Here


     *
     * @param values the intial values for this vector to have
     */
    public SparseHashDoubleVector(double[] values) {
        maxLength = values.length;
        vector = new TIntDoubleHashMap();
        nonZeroIndices = null;
        magnitude = -1;
        for (int i = 0; i < values.length; ++i) {
            if (values[i] != 0) {
                vector.put(i, values[i]);
View Full Code Here

        maxLength = values.length();
        nonZeroIndices = null;
        magnitude = -1;
        if (values instanceof SparseHashDoubleVector) {
            SparseHashDoubleVector v = (SparseHashDoubleVector)values;
            vector = new TIntDoubleHashMap(v.vector);
        }
        else if (values instanceof SparseVector) {
            int[] nonZeros = ((SparseVector) values).getNonZeroIndices();
            vector = new TIntDoubleHashMap(nonZeros.length);
            for (int index : nonZeros)
                vector.put(index, values.get(index));
        } else {
            vector = new TIntDoubleHashMap();
            for (int index = 0; index < values.length(); ++index) {
                double value = values.get(index);
                if (value != 0d)
                    vector.put(index, value);
            }
View Full Code Here

    static <E extends WeightedEdge> int
                      getMaxClassWeighted(int v, int[] vertexAssignments,
                                          WeightedGraph<E> g) {
        Set<E> edges = g.getAdjacencyList(v);
        TIntDoubleMap classSums = new TIntDoubleHashMap();
        for (WeightedEdge e : edges) {
            int n = (e.to() == v) ? e.from() : e.to();
            int nClass = vertexAssignments[n];
            double weight = e.weight();
            if (classSums.containsKey(nClass)) {
                double curWeight = classSums.get(nClass);
                classSums.put(nClass, weight + curWeight);
            }
            else {
                classSums.put(nClass, weight);
            }
        }

        double maxSum = -1d;
        TIntSet ties = new TIntHashSet();
        TIntDoubleIterator iter = classSums.iterator();
        while (iter.hasNext()) {
            iter.advance();
            double weight = iter.value();
            if (weight > maxSum) {
                maxSum = weight;
View Full Code Here

     * Creates a new {@code SparseWeightedEdgeSet} where all edges in this set
     * must connect to {@code rootVertex}.
     */
    public SparseWeightedEdgeSet(int rootVertex) {
        this.rootVertex = rootVertex;
        edges = new TIntDoubleHashMap();
    }
View Full Code Here

        final TIntDoubleHashMap mAv;
        final int os;  // offset

        private MapVal(int os) {
            this.os = os;
            this.Av = new TIntDoubleHashMap(32, 0.5f, 0, 0);
            this.mAv = new TIntDoubleHashMap(32, 0.5f, 0, 0);
        }
View Full Code Here

  private static final long serialVersionUID = -1808164285864302340L;
  private TIntDoubleHashMap w;

  TrovePrimativeMapLinearVector(int bins) {
    super(bins);
    w = new TIntDoubleHashMap();
  }
View Full Code Here

  }

  @Override
  public void initW(double param) {
    w = new TIntDoubleHashMap();
    if (!VectorUtils.floatingPointEquals(0, param))
      for (int i = 0; i < numRows; i++)
        w.put(i, param);
  }
View Full Code Here

*/
public class TByteShortByteKeyedDoubleHashMap extends TByteShortByteKeyedMap {
  private TIntDoubleHashMap map;

  public TByteShortByteKeyedDoubleHashMap() {
    map = new TIntDoubleHashMap(100);
  }
View Full Code Here

  public TByteShortByteKeyedDoubleHashMap() {
    map = new TIntDoubleHashMap(100);
  }

  public TByteShortByteKeyedDoubleHashMap(int capacity) {
    map = new TIntDoubleHashMap(capacity);
  }
View Full Code Here

TOP

Related Classes of gnu.trove.map.hash.TIntDoubleHashMap

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.