Package gnu.trove.map

Examples of gnu.trove.map.TIntDoubleMap


    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


    @Override
    public boolean equals( Object other ) {
        if ( ! ( other instanceof TIntDoubleMap ) ) {
            return false;
        }
        TIntDoubleMap that = ( TIntDoubleMap ) 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 ) {
                int 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

TOP

Related Classes of gnu.trove.map.TIntDoubleMap

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.