• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java TObjectDoubleIterator类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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


示例16: projectOntoNonZeroCoordinates

import gnu.trove.iterator.TObjectDoubleIterator; //导入依赖的package包/类
public StringKeyedVector projectOntoNonZeroCoordinates(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.addToCoordinateInternal(it.key(), vector.getPrimitive(it.key()));
    }
    return res;
}
 
开发者ID:etsy,项目名称:Conjecture,代码行数:13,代码来源:StringKeyedVector.java


示例17: removeZeroCoordinates

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


示例18: writeObject

import gnu.trove.iterator.TObjectDoubleIterator; //导入依赖的package包/类
private void writeObject(ObjectOutputStream output) throws IOException {
    output.writeObject(keyEncoding);
    output.writeFloat(loadFactor);
    output.writeDouble(defaultValue);
    output.writeInt(map.size());
    for (TObjectDoubleIterator<byte[]> it = map.iterator(); it.hasNext();) {
        it.advance();
        byte[] key = it.key();
        output.writeInt(key.length);
        for (int i = 0; i < key.length; i++) {
            output.writeByte(key[i]);
        }
        output.writeDouble(it.value());
    }
}
 
开发者ID:etsy,项目名称:Conjecture,代码行数:16,代码来源:ByteArrayDoubleHashMap.java


示例19: write

import gnu.trove.iterator.TObjectDoubleIterator; //导入依赖的package包/类
public void write(Kryo kryo, Output output) {
    output.writeString(keyEncoding);
    output.writeFloat(loadFactor);
    output.writeDouble(defaultValue);
    output.writeInt(map.size());
    for (TObjectDoubleIterator<byte[]> it = map.iterator(); it.hasNext();) {
        it.advance();
        byte[] key = it.key();
        output.writeInt(key.length);
        for (int i = 0; i < key.length; i++) {
            output.writeByte(key[i]);
        }
        output.writeDouble(it.value());
    }
}
 
开发者ID:etsy,项目名称:Conjecture,代码行数:16,代码来源:ByteArrayDoubleHashMap.java


示例20: calculateTotalEquilibriumSurplus

import gnu.trove.iterator.TObjectDoubleIterator; //导入依赖的package包/类
public double calculateTotalEquilibriumSurplus() {
	double totalSurplus = 0;
	TObjectDoubleIterator<AbstractTradingAgent> i = surplusTable.iterator();
	while (i.hasNext()) {
		i.advance();
		@SuppressWarnings("unused")
		AbstractTradingAgent agent = i.key();
		totalSurplus += i.value();
	}
	return totalSurplus;
}
 
开发者ID:phelps-sg,项目名称:jasa,代码行数:12,代码来源:DynamicSurplusReport.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java MessagePackFactory类代码示例发布时间:2022-05-21
下一篇:
Java Core类代码示例发布时间:2022-05-21
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap