本文整理汇总了Java中it.unimi.dsi.fastutil.ints.Int2DoubleOpenHashMap.get方法的典型用法代码示例。如果您正苦于以下问题:Java Int2DoubleOpenHashMap.get方法的具体用法?Java Int2DoubleOpenHashMap.get怎么用?Java Int2DoubleOpenHashMap.get使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类it.unimi.dsi.fastutil.ints.Int2DoubleOpenHashMap
的用法示例。
在下文中一共展示了Int2DoubleOpenHashMap.get方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: dot
import it.unimi.dsi.fastutil.ints.Int2DoubleOpenHashMap; //导入方法依赖的package包/类
private double dot(SparseDoubleVector other) {
double ret = 0.0;
Int2DoubleOpenHashMap smallMap = this.hashMap;
Int2DoubleOpenHashMap largeMap = other.hashMap;
if (smallMap.size() > largeMap.size()) {
smallMap = other.hashMap;
largeMap = this.hashMap;
}
ObjectIterator<Int2DoubleMap.Entry> iter = smallMap.int2DoubleEntrySet().fastIterator();
Int2DoubleMap.Entry entry = null;
while (iter.hasNext()) {
entry = iter.next();
if (largeMap.containsKey(entry.getIntKey())) {
ret += entry.getDoubleValue() * largeMap.get(entry.getIntKey());
}
}
return ret;
}
示例2: newNumberVector
import it.unimi.dsi.fastutil.ints.Int2DoubleOpenHashMap; //导入方法依赖的package包/类
@Override
public SparseFloatVector newNumberVector(Int2DoubleOpenHashMap dvalues, int maxdim) {
int[] indexes = new int[dvalues.size()];
float[] values = new float[dvalues.size()];
// Import and sort the indexes
ObjectIterator<Int2DoubleMap.Entry> iter = dvalues.int2DoubleEntrySet().fastIterator();
for(int i = 0; iter.hasNext(); i++) {
indexes[i] = iter.next().getIntKey();
}
Arrays.sort(indexes);
// Import the values accordingly
for(int i = 0; i < dvalues.size(); i++) {
values[i] = (float) dvalues.get(indexes[i]);
}
return new SparseFloatVector(indexes, values, maxdim);
}
示例3: getVluesofServerSparseDoubleRow
import it.unimi.dsi.fastutil.ints.Int2DoubleOpenHashMap; //导入方法依赖的package包/类
private double[] getVluesofServerSparseDoubleRow(ServerRow row, int[] index) {
Int2DoubleOpenHashMap data = ((ServerSparseDoubleRow) row).getData();
double[] values = new double[index.length];
for (int i = 0; i < index.length; i++) {
values[i] = data.get(index[i]);
}
return values;
}
示例4: SparseByteVector
import it.unimi.dsi.fastutil.ints.Int2DoubleOpenHashMap; //导入方法依赖的package包/类
/**
* Create a SparseByteVector consisting of double values according to the
* specified mapping of indices and values.
*
* @param values the values to be set as values of the real vector
* @param dimensionality the dimensionality of this feature vector
* @throws IllegalArgumentException if the given dimensionality is too small
* to cover the given values (i.e., the maximum index of any value not
* zero is bigger than the given dimensionality)
*/
public SparseByteVector(Int2DoubleOpenHashMap values, int dimensionality) throws IllegalArgumentException {
if(values.size() > dimensionality) {
throw new IllegalArgumentException("values.size() > dimensionality!");
}
this.indexes = new int[values.size()];
this.values = new byte[values.size()];
// Import and sort the indexes
{
ObjectIterator<Int2DoubleMap.Entry> iter = values.int2DoubleEntrySet().fastIterator();
for(int i = 0; iter.hasNext(); i++) {
this.indexes[i] = iter.next().getIntKey();
}
Arrays.sort(this.indexes);
}
// Import the values accordingly
{
for(int i = 0; i < values.size(); i++) {
this.values[i] = (byte) values.get(this.indexes[i]);
}
}
this.dimensionality = dimensionality;
final int maxdim = getMaxDim();
if(maxdim > dimensionality) {
throw new IllegalArgumentException("Given dimensionality " + dimensionality + " is too small w.r.t. the given values (occurring maximum: " + maxdim + ").");
}
}
示例5: SparseShortVector
import it.unimi.dsi.fastutil.ints.Int2DoubleOpenHashMap; //导入方法依赖的package包/类
/**
* Create a SparseShortVector consisting of double values according to the
* specified mapping of indices and values.
*
* @param values the values to be set as values of the real vector
* @param dimensionality the dimensionality of this feature vector
* @throws IllegalArgumentException if the given dimensionality is too small
* to cover the given values (i.e., the maximum index of any value not
* zero is bigger than the given dimensionality)
*/
public SparseShortVector(Int2DoubleOpenHashMap values, int dimensionality) throws IllegalArgumentException {
if(values.size() > dimensionality) {
throw new IllegalArgumentException("values.size() > dimensionality!");
}
this.indexes = new int[values.size()];
this.values = new short[values.size()];
// Import and sort the indexes
{
ObjectIterator<Int2DoubleMap.Entry> iter = values.int2DoubleEntrySet().fastIterator();
for(int i = 0; iter.hasNext(); i++) {
this.indexes[i] = iter.next().getIntKey();
}
Arrays.sort(this.indexes);
}
// Import the values accordingly
{
for(int i = 0; i < values.size(); i++) {
this.values[i] = (short) values.get(this.indexes[i]);
}
}
this.dimensionality = dimensionality;
final int maxdim = getMaxDim();
if(maxdim > dimensionality) {
throw new IllegalArgumentException("Given dimensionality " + dimensionality + " is too small w.r.t. the given values (occurring maximum: " + maxdim + ").");
}
}
示例6: SparseIntegerVector
import it.unimi.dsi.fastutil.ints.Int2DoubleOpenHashMap; //导入方法依赖的package包/类
/**
* Create a SparseIntegerVector consisting of double values according to the
* specified mapping of indices and values.
*
* @param values the values to be set as values of the real vector
* @param dimensionality the dimensionality of this feature vector
* @throws IllegalArgumentException if the given dimensionality is too small
* to cover the given values (i.e., the maximum index of any value not
* zero is bigger than the given dimensionality)
*/
public SparseIntegerVector(Int2DoubleOpenHashMap values, int dimensionality) throws IllegalArgumentException {
if(values.size() > dimensionality) {
throw new IllegalArgumentException("values.size() > dimensionality!");
}
this.indexes = new int[values.size()];
this.values = new int[values.size()];
// Import and sort the indexes
{
ObjectIterator<Int2DoubleMap.Entry> iter = values.int2DoubleEntrySet().fastIterator();
for(int i = 0; iter.hasNext(); i++) {
this.indexes[i] = iter.next().getIntKey();
}
Arrays.sort(this.indexes);
}
// Import the values accordingly
{
for(int i = 0; i < values.size(); i++) {
this.values[i] = (int) values.get(this.indexes[i]);
}
}
this.dimensionality = dimensionality;
final int maxdim = getMaxDim();
if(maxdim > dimensionality) {
throw new IllegalArgumentException("Given dimensionality " + dimensionality + " is too small w.r.t. the given values (occurring maximum: " + maxdim + ").");
}
}
示例7: SparseDoubleVector
import it.unimi.dsi.fastutil.ints.Int2DoubleOpenHashMap; //导入方法依赖的package包/类
/**
* Create a SparseDoubleVector consisting of double values according to the
* specified mapping of indices and values.
*
* @param values the values to be set as values of the real vector
* @param dimensionality the dimensionality of this feature vector
* @throws IllegalArgumentException if the given dimensionality is too small
* to cover the given values (i.e., the maximum index of any value not
* zero is bigger than the given dimensionality)
*/
public SparseDoubleVector(Int2DoubleOpenHashMap values, int dimensionality) throws IllegalArgumentException {
if(values.size() > dimensionality) {
throw new IllegalArgumentException("values.size() > dimensionality!");
}
this.indexes = new int[values.size()];
this.values = new double[values.size()];
// Import and sort the indexes
{
ObjectIterator<Int2DoubleMap.Entry> iter = values.int2DoubleEntrySet().fastIterator();
for(int i = 0; iter.hasNext(); i++) {
this.indexes[i] = iter.next().getIntKey();
}
Arrays.sort(this.indexes);
}
// Import the values accordingly
{
for(int i = 0; i < values.size(); i++) {
this.values[i] = values.get(this.indexes[i]);
}
}
this.dimensionality = dimensionality;
final int maxdim = getMaxDim();
if(maxdim > dimensionality) {
throw new IllegalArgumentException("Given dimensionality " + dimensionality + " is too small w.r.t. the given values (occurring maximum: " + maxdim + ").");
}
}