当前位置: 首页>>代码示例>>Java>>正文


Java TObjectDoubleIterator类代码示例

本文整理汇总了Java中gnu.trove.iterator.TObjectDoubleIterator的典型用法代码示例。如果您正苦于以下问题:Java TObjectDoubleIterator类的具体用法?Java TObjectDoubleIterator怎么用?Java TObjectDoubleIterator使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


TObjectDoubleIterator类属于gnu.trove.iterator包,在下文中一共展示了TObjectDoubleIterator类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: iterator

import gnu.trove.iterator.TObjectDoubleIterator; //导入依赖的package包/类
@Override
public Iterator<Pair<KeyArgs, Double>> iterator() {
	return new Iterator<Pair<KeyArgs, Double>>() {
		private final TObjectDoubleIterator<KeyArgs>	innerIterator	= values.iterator();

		@Override
		public boolean hasNext() {
			return innerIterator.hasNext();
		}

		@Override
		public Pair<KeyArgs, Double> next() {
			if (innerIterator.hasNext()) {
				innerIterator.advance();
				return Pair.of(innerIterator.key(), innerIterator.value());
			} else {
				return null;
			}
		}

		@Override
		public void remove() {
			innerIterator.remove();
		}
	};
}
 
开发者ID:clic-lab,项目名称:spf,代码行数:27,代码来源:TroveHashVector.java

示例2: iterator

import gnu.trove.iterator.TObjectDoubleIterator; //导入依赖的package包/类
@Override
public Iterator<ObjectDoubleEntry<KEY>> iterator() {
	return new Iterator<ObjectDoubleEntry<KEY>>() {
		TObjectDoubleIterator<KEY> iter = paramsMap.iterator();
		ObjectDoubleEntry<KEY> entry = new ObjectDoubleEntry<KEY>();

		@Override
		public boolean hasNext() {
			return iter.hasNext();
		}

		@Override
		public ObjectDoubleEntry<KEY> next() {
			iter.advance();
			entry.key = iter.key();
			entry.value = iter.value();
			return entry;
		}

		@Override
		public void remove() {
			throw new UnsupportedOperationException("Not supported");
		}
	};
}
 
开发者ID:openimaj,项目名称:openimaj,代码行数:26,代码来源:KeyedParameters.java

示例3: dot

import gnu.trove.iterator.TObjectDoubleIterator; //导入依赖的package包/类
/**
 * compute the inner product between this and vec.
 */
public double dot(StringKeyedVector vec) {
    if (vec instanceof LazyVector) {
        return vec.dot(this);
    }
    ByteArrayDoubleHashMap vec_small = this.size() > vec.size() ? vec.vector
            : this.vector;
    ByteArrayDoubleHashMap vec_big = this.size() > vec.size() ? this.vector
            : vec.vector;
    double res = 0.0;
    for (TObjectDoubleIterator<byte[]> it = vec_small.troveIterator(); it
            .hasNext();) {
        it.advance();
        if (vec_big.containsKey(it.key())) {
            res += it.value() * vec_big.getPrimitive(it.key());
        }
    }
    return res;
}
 
开发者ID:etsy,项目名称:Conjecture,代码行数:22,代码来源:StringKeyedVector.java

示例4: iterator

import gnu.trove.iterator.TObjectDoubleIterator; //导入依赖的package包/类
public Iterator<Map.Entry<String, Double>> iterator() {
    return new Iterator<Map.Entry<String, Double>>() {
        private TObjectDoubleIterator<byte[]> iter = troveIterator();

        public boolean hasNext() {
            return iter.hasNext();
        }

        public void remove() {
            iter.remove();
        }

        public Map.Entry<String, Double> next() {
            iter.advance();
            return new AbstractMap.SimpleImmutableEntry<String, Double>(
                    byteArrayToString(iter.key()), iter.value());
        }
    };
}
 
开发者ID:etsy,项目名称:Conjecture,代码行数:20,代码来源:ByteArrayDoubleHashMap.java

示例5: equals

import gnu.trove.iterator.TObjectDoubleIterator; //导入依赖的package包/类
/**
 * Compares this map with another map for equality of their stored
 * entries.
 *
 * @param other an <code>Object</code> value
 * @return a <code>boolean</code> value
 */
public boolean equals( Object other ) {
    if ( ! ( other instanceof TObjectDoubleMap ) ) {
        return false;
    }
    TObjectDoubleMap that = ( TObjectDoubleMap ) other;
    if ( that.size() != this.size() ) {
        return false;
    }
    try {
        TObjectDoubleIterator iter = this.iterator();
        while ( iter.hasNext() ) {
            iter.advance();
            Object key = iter.key();
            double value = iter.value();
            if ( value == no_entry_value ) {
                if ( !( that.get( key ) == that.getNoEntryValue() &&
                 that.containsKey( key ) ) ) {

                    return false;
                }
            } else {
                if ( value != that.get( key ) ) {
                    return false;
                }
            }
        }
    } catch ( ClassCastException ex ) {
        // unused.
    }
    return true;
}
 
开发者ID:JianpingZeng,项目名称:xcc,代码行数:39,代码来源:TObjectDoubleHashMap.java

示例6: equals

import gnu.trove.iterator.TObjectDoubleIterator; //导入依赖的package包/类
/**
 * Compares this map with another map for equality of their stored
 * entries.
 *
 * @param other an <code>Object</code> value
 * @return a <code>boolean</code> value
 */
public boolean equals(final Object other ) {
    if ( ! ( other instanceof TObjectDoubleMap ) ) {
        return false;
    }
    final TObjectDoubleMap that = ( TObjectDoubleMap ) other;
    if ( that.size() != this.size() ) {
        return false;
    }
    try {
        final TObjectDoubleIterator iter = this.iterator();
        while ( iter.hasNext() ) {
            iter.advance();
            final Object key = iter.key();
            final double value = iter.value();
            if ( value == no_entry_value ) {
                if ( !( that.get( key ) == that.getNoEntryValue() &&
                 that.containsKey( key ) ) ) {

                    return false;
                }
            } else {
                if ( value != that.get( key ) ) {
                    return false;
                }
            }
        }
    } catch ( final ClassCastException ex ) {
        // unused.
    }
    return true;
}
 
开发者ID:digitalheir,项目名称:java-probabilistic-earley-parser,代码行数:39,代码来源:TObjectDoubleHashMap.java

示例7: equals

import gnu.trove.iterator.TObjectDoubleIterator; //导入依赖的package包/类
/**
 * Compares this map with another map for equality of their stored
 * entries.
 *
 * @param other an <code>Object</code> value
 * @return a <code>boolean</code> value
 */
@Override
@SuppressWarnings("rawtypes")
public boolean equals( Object other ) {
    if ( ! ( other instanceof TObjectDoubleMap ) ) {
        return false;
    }
    TObjectDoubleMap that = ( TObjectDoubleMap ) other;
    if ( that.size() != this.size() ) {
        return false;
    }
    try {
        TObjectDoubleIterator iter = this.iterator();
        while ( iter.hasNext() ) {
            iter.advance();
            Object key = iter.key();
            double value = iter.value();
            if ( value == no_entry_value ) {
                if ( !( that.get( key ) == that.getNoEntryValue() &&
                 that.containsKey( key ) ) ) {

                    return false;
                }
            } else {
                if ( value != that.get( key ) ) {
                    return false;
                }
            }
        }
    } catch ( ClassCastException ex ) {
        // unused.
    }
    return true;
}
 
开发者ID:palantir,项目名称:trove-3.0.3,代码行数:41,代码来源:TObjectDoubleHashMap.java

示例8: equals

import gnu.trove.iterator.TObjectDoubleIterator; //导入依赖的package包/类
/**
 * Compares this map with another map for equality of their stored
 * entries.
 *
 * @param other an <code>Object</code> value
 * @return a <code>boolean</code> value
 */
public boolean equals( Object other ) {
    if ( ! ( other instanceof TObjectDoubleMap ) ) {
        return false;
    }
    TObjectDoubleMap that = ( TObjectDoubleMap ) other;
    if ( that.size() != this.size() ) {
        return false;
    }
    try {
        TObjectDoubleIterator iter = this.iterator();
        while ( iter.hasNext() ) {
            iter.advance();
            Object key = iter.key();
            double value = iter.value();
            if ( value == no_entry_value ) {
                if ( !( that.get( key ) == that.getNoEntryValue() && that.containsKey( key ) ) ) {
                    return false;
                }
            } else {
                if ( value != that.get( key ) ) {
                    return false;
                }
            }
        }
    } catch ( ClassCastException ex ) {
        // unused.
    }
    return true;
}
 
开发者ID:major2015,项目名称:easyrec_major,代码行数:37,代码来源:TObjectDoubleHashMap.java

示例9: equals

import gnu.trove.iterator.TObjectDoubleIterator; //导入依赖的package包/类
/**
 * Compares this map with another map for equality of their stored
 * entries.
 *
 * @param other an <code>Object</code> value
 * @return a <code>boolean</code> value
 */
public boolean equals( Object other ) {
    if ( ! ( other instanceof TObjectDoubleMap ) ) {
        return false;
    }
    TObjectDoubleMap that = ( TObjectDoubleMap ) other;
    if ( that.size() != this.size() ) {
        return false;
    }
    try {
        TObjectDoubleIterator iter = this.iterator();
        while ( iter.hasNext() ) {
            iter.advance();
            Object key = iter.key();
            double value = iter.value();
            if ( value == no_entry_value ) {
                if ( !( that.get( key ) == that.getNoEntryValue() && that.containsKey( key ) ) ) {
                    return false;
                }
            } else {
                if ( value != that.get( key ) ) {
                    return false;
                }
            }
        }
    } catch ( ClassCastException ex ) {
        // unused.
        logger.warn("An error occurred!", ex);
    }
    return true;
}
 
开发者ID:major2015,项目名称:easyrec_major,代码行数:38,代码来源:TObjectDoubleCustomHashMap.java

示例10: delazify

import gnu.trove.iterator.TObjectDoubleIterator; //导入依赖的package包/类
public void delazify() {
    for (TObjectDoubleIterator<byte[]> it = vector.troveIterator(); it
            .hasNext();) {
        it.advance();
        long startIter = (long)iterations.getPrimitive(it.key()); // defaults
                                                                  // to 0.0
        if (startIter < iteration) {
            it.setValue(updater.lazyUpdate(it.key().toString(), it.value(), startIter, iteration));
            iterations.putPrimitive(it.key(), (double)iteration);
        }
    }
    removeZeroCoordinates();
}
 
开发者ID:etsy,项目名称:Conjecture,代码行数:14,代码来源:LazyVector.java

示例11: skipToIteration

import gnu.trove.iterator.TObjectDoubleIterator; //导入依赖的package包/类
public void skipToIteration(long iter) {
    delazify();
    iteration = iter;
    for (TObjectDoubleIterator<byte[]> it = iterations.troveIterator(); it
            .hasNext();) {
        it.advance();
        it.setValue((double)iter);
    }
}
 
开发者ID:etsy,项目名称:Conjecture,代码行数:10,代码来源:LazyVector.java

示例12: removeZeroCoordinates

import gnu.trove.iterator.TObjectDoubleIterator; //导入依赖的package包/类
/**
 * Remove zeros that may have appeared as a result of a transform
 */
public void removeZeroCoordinates() {
    for (TObjectDoubleIterator<byte[]> it = vector.troveIterator(); it
            .hasNext();) {
        it.advance();
        if (Utilities.floatingPointEquals(it.value(), 0d)) {
            iterations.removePrimitive(it.key());
            it.remove();
        }
    }
}
 
开发者ID:etsy,项目名称:Conjecture,代码行数:14,代码来源:LazyVector.java

示例13: dotWithSKV

import gnu.trove.iterator.TObjectDoubleIterator; //导入依赖的package包/类
protected double dotWithSKV(StringKeyedVector vec) {
    // dont figure out which ones bigger etc, since delazifying this to get
    // the size is too slow.
    double res = 0.0;
    for (TObjectDoubleIterator<byte[]> it = vec.vector.troveIterator(); it
            .hasNext();) {
        it.advance();
        res += it.value() * delazifyCoordinate(it.key());
    }
    return res;
}
 
开发者ID:etsy,项目名称:Conjecture,代码行数:12,代码来源:LazyVector.java

示例14: addScaled

import gnu.trove.iterator.TObjectDoubleIterator; //导入依赖的package包/类
/**
 * add a multiple of vec to this.
 */
public void addScaled(StringKeyedVector vec, double scale) {
    if (vec instanceof LazyVector) {
        ((LazyVector)vec).delazify();
    }
    for (TObjectDoubleIterator<byte[]> it = vec.vector.troveIterator(); it
            .hasNext();) {
        it.advance();
        addToCoordinateInternal(it.key(), scale * it.value());
    }
}
 
开发者ID:etsy,项目名称:Conjecture,代码行数:14,代码来源:StringKeyedVector.java

示例15: multiplyPointwise

import gnu.trove.iterator.TObjectDoubleIterator; //导入依赖的package包/类
public StringKeyedVector multiplyPointwise(StringKeyedVector vec) {
    StringKeyedVector res = new StringKeyedVector();
    if (vec instanceof LazyVector) {
        ((LazyVector)vec).delazify();
    }
    for (TObjectDoubleIterator<byte[]> it = vec.vector.troveIterator(); it
            .hasNext();) {
        it.advance();
        res.vector.putPrimitive(it.key(), vector.getPrimitive(it.key())
                * it.value());
    }
    return res;
}
 
开发者ID:etsy,项目名称:Conjecture,代码行数:14,代码来源:StringKeyedVector.java


注:本文中的gnu.trove.iterator.TObjectDoubleIterator类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。