it.unimi.dsi.fastutil.ints.Int2ObjectOpenHashMap Java Examples
The following examples show how to use
it.unimi.dsi.fastutil.ints.Int2ObjectOpenHashMap.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: TextureUtil.java From FastAsyncWorldedit with GNU General Public License v3.0 | 6 votes |
protected void calculateLayerArrays() { Int2ObjectOpenHashMap<char[]> colorLayerMap = new Int2ObjectOpenHashMap<>(); for (int i = 0; i < validBlockIds.length; i++) { int color = validColors[i]; int combined = validBlockIds[i]; if (hasAlpha(color)) { for (int j = 0; j < validBlockIds.length; j++) { int colorOther = validColors[j]; if (!hasAlpha(colorOther)) { int combinedOther = validBlockIds[j]; int combinedColor = combineTransparency(color, colorOther); colorLayerMap.put(combinedColor, new char[]{(char) combined, (char) combinedOther}); } } } } this.validLayerColors = new int[colorLayerMap.size()]; this.validLayerBlocks = new char[colorLayerMap.size()][]; int index = 0; for (Int2ObjectMap.Entry<char[]> entry : colorLayerMap.int2ObjectEntrySet()) { validLayerColors[index] = entry.getIntKey(); validLayerBlocks[index++] = entry.getValue(); } }
Example #2
Source File: SPIDER.java From metanome-algorithms with Apache License 2.0 | 6 votes |
private void output() throws CouldNotReceiveResultException, ColumnNameMismatchException { // Read the discovered INDs from the attributes Int2ObjectOpenHashMap<IntList> dep2ref = new Int2ObjectOpenHashMap<IntList>(this.numColumns); for (Attribute spiderAttribute : this.attributeId2attributeObject.values()) if (!spiderAttribute.getReferenced().isEmpty()) dep2ref.put(spiderAttribute.getAttributeId(), new IntArrayList(spiderAttribute.getReferenced())); // Write the result to the resultReceiver for (int dep : dep2ref.keySet()) { String depTableName = this.getTableNameFor(dep, this.tableColumnStartIndexes); String depColumnName = this.columnNames.get(dep); for (int ref : dep2ref.get(dep)) { String refTableName = this.getTableNameFor(ref, this.tableColumnStartIndexes); String refColumnName = this.columnNames.get(ref); this.resultReceiver.receiveResult(new InclusionDependency(new ColumnPermutation(new ColumnIdentifier(depTableName, depColumnName)), new ColumnPermutation(new ColumnIdentifier(refTableName, refColumnName)))); this.numUnaryINDs++; } } }
Example #3
Source File: SPIDER.java From metanome-algorithms with Apache License 2.0 | 6 votes |
protected void initializeAttributes() throws AlgorithmExecutionException { this.numColumns = this.columnNames.size(); this.attributeId2attributeObject = new Int2ObjectOpenHashMap<Attribute>(this.numColumns); this.attributeObjectQueue = new PriorityQueue<Attribute>(this.numColumns); for (int table = 0; table < this.tableNames.length; table++) { int firstAttribute = this.tableColumnStartIndexes[table]; int lastAttribute = (table == this.tableNames.length - 1) ? this.numColumns : this.tableColumnStartIndexes[table + 1]; for (int attribute = firstAttribute; attribute < lastAttribute; attribute++) { Attribute spiderAttribute; if (this.databaseConnectionGenerator != null) spiderAttribute = new Attribute(attribute, this.columnTypes, this.databaseConnectionGenerator, this.inputRowLimit, this.dao, this.tableNames[table], this.columnNames.get(attribute), this.tempFolder); else spiderAttribute = new Attribute(attribute, this.columnTypes, this.fileInputGenerator[table], this.inputRowLimit, attribute - firstAttribute, this.tempFolder, this.maxMemoryUsage, this.memoryCheckFrequency); this.attributeId2attributeObject.put(attribute, spiderAttribute); if (!spiderAttribute.hasFinished()) this.attributeObjectQueue.add(spiderAttribute); } } }
Example #4
Source File: FDTree.java From metanome-algorithms with Apache License 2.0 | 6 votes |
public void generalize() { int maxLevel = this.numAttributes; // Build an index level->nodes for the top-down, level-wise traversal Int2ObjectOpenHashMap<ArrayList<ElementLhsPair>> level2elements = new Int2ObjectOpenHashMap<>(maxLevel); for (int level = 0; level < maxLevel; level++) level2elements.put(level, new ArrayList<ElementLhsPair>()); this.addToIndex(level2elements, 0, new BitSet(this.numAttributes)); // Traverse the levels top-down and add all direct generalizations for (int level = maxLevel - 1; level >= 0; level--) { for (ElementLhsPair pair : level2elements.get(level)) { // Remove isFDs, because we will mark valid FDs later on pair.element.removeAllFds(); // Generate and add generalizations for (int lhsAttr = pair.lhs.nextSetBit(0); lhsAttr >= 0; lhsAttr = pair.lhs.nextSetBit(lhsAttr + 1)) { pair.lhs.clear(lhsAttr); FDTreeElement generalization = this.addGeneralization(pair.lhs, pair.element.getRhsAttributes()); if (generalization != null) level2elements.get(level - 1).add(new ElementLhsPair(generalization, (BitSet) pair.lhs.clone())); pair.lhs.set(lhsAttr); } } } }
Example #5
Source File: DPartitionBatchFinalReceiver.java From twister2 with Apache License 2.0 | 6 votes |
public void init(Config cfg, DataFlowOperation op, Map<Integer, List<Integer>> expectedIds) { long maxBytesInMemory = CommunicationContext.getShuffleMaxBytesInMemory(cfg); long maxRecordsInMemory = CommunicationContext.getShuffleMaxRecordsInMemory(cfg); long maxFileSize = CommunicationContext.getShuffleFileSize(cfg); int parallelIOAllowance = CommunicationContext.getParallelIOAllowance(cfg); expIds = expectedIds; thisWorker = op.getLogicalPlan().getThisWorker(); finishedSources = new Int2ObjectOpenHashMap<>(); partition = op; keyed = partition.getKeyType() != null; targets = new HashSet<>(expectedIds.keySet()); initMergers(maxBytesInMemory, maxRecordsInMemory, maxFileSize, parallelIOAllowance); this.bulkReceiver.init(cfg, expectedIds.keySet()); int index = 0; targetsArray = new int[expectedIds.keySet().size()]; for (Integer target : expectedIds.keySet()) { targetStates.put(target, ReceiverState.INIT); targetsArray[index++] = target; } }
Example #6
Source File: FDTree.java From winter with Apache License 2.0 | 6 votes |
public void generalize() { int maxLevel = this.numAttributes; // Build an index level->nodes for the top-down, level-wise traversal Int2ObjectOpenHashMap<ArrayList<ElementLhsPair>> level2elements = new Int2ObjectOpenHashMap<>(maxLevel); for (int level = 0; level < maxLevel; level++) level2elements.put(level, new ArrayList<ElementLhsPair>()); this.addToIndex(level2elements, 0, new OpenBitSet(this.numAttributes)); // Traverse the levels top-down and add all direct generalizations for (int level = maxLevel - 1; level >= 0; level--) { for (ElementLhsPair pair : level2elements.get(level)) { // Remove isFDs, because we will mark valid FDs later on pair.element.removeAllFds(); // Generate and add generalizations for (int lhsAttr = pair.lhs.nextSetBit(0); lhsAttr >= 0; lhsAttr = pair.lhs.nextSetBit(lhsAttr + 1)) { pair.lhs.clear(lhsAttr); FDTreeElement generalization = this.addGeneralization(pair.lhs, pair.element.getRhsAttributes()); if (generalization != null) level2elements.get(level - 1).add(new ElementLhsPair(generalization, pair.lhs.clone())); pair.lhs.set(lhsAttr); } } } }
Example #7
Source File: BaseFullChunk.java From Nukkit with GNU General Public License v3.0 | 6 votes |
@Override public void addBlockEntity(BlockEntity blockEntity) { if (this.tiles == null) { this.tiles = new Long2ObjectOpenHashMap<>(); this.tileList = new Int2ObjectOpenHashMap<>(); } this.tiles.put(blockEntity.getId(), blockEntity); int index = ((blockEntity.getFloorZ() & 0x0f) << 12) | ((blockEntity.getFloorX() & 0x0f) << 8) | (blockEntity.getFloorY() & 0xff); if (this.tileList.containsKey(index) && !this.tileList.get(index).equals(blockEntity)) { BlockEntity entity = this.tileList.get(index); this.tiles.remove(entity.getId()); entity.close(); } this.tileList.put(index, blockEntity); if (this.isInit) { this.setChanged(); } }
Example #8
Source File: FDTree.java From metanome-algorithms with Apache License 2.0 | 6 votes |
public void generalize() { int maxLevel = this.numAttributes; // Build an index level->nodes for the top-down, level-wise traversal Int2ObjectOpenHashMap<ArrayList<ElementLhsPair>> level2elements = new Int2ObjectOpenHashMap<>(maxLevel); for (int level = 0; level < maxLevel; level++) level2elements.put(level, new ArrayList<ElementLhsPair>()); this.addToIndex(level2elements, 0, new BitSet(this.numAttributes)); // Traverse the levels top-down and add all direct generalizations for (int level = maxLevel - 1; level >= 0; level--) { for (ElementLhsPair pair : level2elements.get(level)) { // Remove isFDs, because we will mark valid FDs later on pair.element.removeAllFds(); // Generate and add generalizations for (int lhsAttr = pair.lhs.nextSetBit(0); lhsAttr >= 0; lhsAttr = pair.lhs.nextSetBit(lhsAttr + 1)) { pair.lhs.clear(lhsAttr); de.metanome.algorithms.cfdfinder.structures.FDTreeElement generalization = this.addGeneralization(pair.lhs, pair.element.getRhsAttributes()); if (generalization != null) level2elements.get(level - 1).add(new ElementLhsPair(generalization, (BitSet) pair.lhs.clone())); pair.lhs.set(lhsAttr); } } } }
Example #9
Source File: SlimUDTF.java From incubator-hivemall with Apache License 2.0 | 6 votes |
@Nonnull private static Int2ObjectMap<Int2FloatMap> kNNentries(@Nonnull final Object kNNiObj, @Nonnull final MapObjectInspector knnItemsOI, @Nonnull final PrimitiveObjectInspector knnItemsKeyOI, @Nonnull final MapObjectInspector knnItemsValueOI, @Nonnull final PrimitiveObjectInspector knnItemsValueKeyOI, @Nonnull final PrimitiveObjectInspector knnItemsValueValueOI, @Nullable Int2ObjectMap<Int2FloatMap> knnItems, @Nonnull final MutableInt nnzKNNi) { if (knnItems == null) { knnItems = new Int2ObjectOpenHashMap<>(1024); } else { knnItems.clear(); } int numElementOfKNNItems = 0; for (Map.Entry<?, ?> entry : knnItemsOI.getMap(kNNiObj).entrySet()) { int user = PrimitiveObjectInspectorUtils.getInt(entry.getKey(), knnItemsKeyOI); Int2FloatMap ru = int2floatMap(knnItemsValueOI.getMap(entry.getValue()), knnItemsValueKeyOI, knnItemsValueValueOI); knnItems.put(user, ru); numElementOfKNNItems += ru.size(); } nnzKNNi.setValue(numElementOfKNNItems); return knnItems; }
Example #10
Source File: SlimUDTF.java From incubator-hivemall with Apache License 2.0 | 6 votes |
private void replayTrain(@Nonnull final ByteBuffer buf) { final int itemI = buf.getInt(); final int knnSize = buf.getInt(); final Int2ObjectMap<Int2FloatMap> knnItems = new Int2ObjectOpenHashMap<>(1024); final IntSet pairItems = new IntOpenHashSet(); for (int i = 0; i < knnSize; i++) { int user = buf.getInt(); int ruSize = buf.getInt(); Int2FloatMap ru = new Int2FloatOpenHashMap(ruSize); ru.defaultReturnValue(0.f); for (int j = 0; j < ruSize; j++) { int itemK = buf.getInt(); pairItems.add(itemK); float ruk = buf.getFloat(); ru.put(itemK, ruk); } knnItems.put(user, ru); } for (int itemJ : pairItems) { train(itemI, knnItems, itemJ); } }
Example #11
Source File: ItemStackComplexRemapperRegistry.java From ProtocolSupport with GNU Affero General Public License v3.0 | 6 votes |
protected static NetworkItemStack remapComplex( Int2ObjectOpenHashMap<EnumMap<ProtocolVersion, List<ItemStackComplexRemapper>>> registry, ProtocolVersion version, String locale, NetworkItemStack itemstack ) { EnumMap<ProtocolVersion, List<ItemStackComplexRemapper>> map = registry.get(itemstack.getTypeId()); if (map != null) { List<ItemStackComplexRemapper> transformers = map.get(version); if (transformers != null) { for (ItemStackComplexRemapper transformer : transformers) { itemstack = transformer.remap(version, locale, itemstack); } } } return itemstack; }
Example #12
Source File: MapTrieCounter.java From SLP-Core with MIT License | 6 votes |
@Override public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException { this.counts = new int[2 + COUNT_OF_COUNTS_CUTOFF]; this.counts[0] = in.readInt(); this.counts[1] = in.readInt(); int successors = in.readInt(); this.map = new Int2ObjectOpenHashMap<>(successors, 0.9f); int pos = 0; for (; pos < successors; pos++) { int key = in.readInt(); int code = in.readInt(); Object value; if (code < 0) { if (code < -1) value = new ArrayTrieCounter(); else value = new MapTrieCounter(); ((AbstractTrie) value).readExternal(in); this.counts[1 + Math.min(((AbstractTrie) value).getCount(), COUNT_OF_COUNTS_CUTOFF)]++; } else { value = new int[code]; for (int j = 0; j < code; j++) ((int[]) value)[j] = in.readInt(); this.counts[1 + Math.min(((int[]) value)[0], COUNT_OF_COUNTS_CUTOFF)]++; } this.putSuccessor(key, value); } }
Example #13
Source File: FixedLifespanScheduler.java From presto with Apache License 2.0 | 6 votes |
public FixedLifespanScheduler(BucketNodeMap bucketNodeMap, List<ConnectorPartitionHandle> partitionHandles, OptionalInt concurrentLifespansPerTask) { checkArgument(!partitionHandles.equals(ImmutableList.of(NOT_PARTITIONED))); checkArgument(partitionHandles.size() == bucketNodeMap.getBucketCount()); Map<InternalNode, IntList> nodeToDriverGroupMap = new HashMap<>(); Int2ObjectMap<InternalNode> driverGroupToNodeMap = new Int2ObjectOpenHashMap<>(); for (int bucket = 0; bucket < bucketNodeMap.getBucketCount(); bucket++) { InternalNode node = bucketNodeMap.getAssignedNode(bucket).get(); nodeToDriverGroupMap.computeIfAbsent(node, key -> new IntArrayList()).add(bucket); driverGroupToNodeMap.put(bucket, node); } this.driverGroupToNodeMap = driverGroupToNodeMap; this.nodeToDriverGroupsMap = nodeToDriverGroupMap.entrySet().stream() .collect(toImmutableMap(Map.Entry::getKey, entry -> entry.getValue().iterator())); this.partitionHandles = requireNonNull(partitionHandles, "partitionHandles is null"); if (concurrentLifespansPerTask.isPresent()) { checkArgument(concurrentLifespansPerTask.getAsInt() >= 1, "concurrentLifespansPerTask must be great or equal to 1 if present"); } this.concurrentLifespansPerTask = requireNonNull(concurrentLifespansPerTask, "concurrentLifespansPerTask is null"); }
Example #14
Source File: CachedTextureUtil.java From FastAsyncWorldedit with GNU General Public License v3.0 | 5 votes |
public CachedTextureUtil(TextureUtil parent) throws FileNotFoundException { super(parent); this.parent = parent; this.colorBlockMap = new Int2ObjectOpenHashMap<>(); this.colorLayerMap = new Int2ObjectOpenHashMap<>(); this.colorBiomeMap = new Int2ObjectOpenHashMap<>(); }
Example #15
Source File: RamNodes.java From dexter with Apache License 2.0 | 5 votes |
protected RamNodes(File serializedFile) { this.serializedFile = serializedFile; if (serializedFile.exists()) { logger.info("loading {} ", serializedFile); load(); } else { logger.warn("cannot find {}, using empty ram nodes", serializedFile.getAbsolutePath()); map = new Int2ObjectOpenHashMap<int[]>(5000000); } }
Example #16
Source File: ItemStackComplexRemapperRegistry.java From ProtocolSupport with GNU Affero General Public License v3.0 | 5 votes |
protected static void register( Int2ObjectOpenHashMap<EnumMap<ProtocolVersion, List<ItemStackComplexRemapper>>> registry, Material material, ItemStackComplexRemapper transformer, ProtocolVersion... versions ) { if (!material.isItem()) { throw new IllegalArgumentException(material + " is not an item"); } EnumMap<ProtocolVersion, List<ItemStackComplexRemapper>> map = registry.computeIfAbsent(ItemMaterialLookup.getRuntimeId(material), k -> new EnumMap<>(ProtocolVersion.class)); Arrays.stream(versions).forEach(version -> map.computeIfAbsent(version, k -> new ArrayList<>()).add(transformer)); }
Example #17
Source File: MinHashSearch.java From MHAP with Apache License 2.0 | 5 votes |
public MinHashSearch(SequenceSketchStreamer data, int numHashes, int numMinMatches, int numThreads, boolean storeResults, int minStoreLength, double maxShift, double acceptScore, boolean doReverseCompliment) throws IOException { super(numThreads, storeResults); this.minStoreLength = minStoreLength; this.numMinMatches = numMinMatches; this.maxShift = maxShift; this.acceptScore = acceptScore; this.numberSequencesHit = new AtomicLong(); this.numberSequencesFullyCompared = new AtomicLong(); this.numberSequencesMinHashed = new AtomicLong(); this.numberElementsProcessed = new AtomicLong(); this.minhashSearchTime = new AtomicLong(); this.sortMergeSearchTime = new AtomicLong(); // enqueue full file, since have to know full size data.enqueueFullFile(false, this.numThreads); //this.sequenceVectorsHash = new HashMap<>(data.getNumberProcessed()); this.sequenceVectorsHash = new Object2ObjectOpenHashMap<>(data.getNumberProcessed()); this.hashes = new ArrayList<>(numHashes); for (int iter = 0; iter < numHashes; iter++) { //Map<Integer,ArrayList<SequenceId>> map = new HashMap<Integer, ArrayList<SequenceId>>(data.getNumberProcessed()); Map<Integer,ArrayList<SequenceId>> map = new Int2ObjectOpenHashMap<ArrayList<SequenceId>>(data.getNumberProcessed()); this.hashes.add(map); } //store both forward andd reverse addData(data, doReverseCompliment); System.err.println("Stored "+this.sequenceVectorsHash.size()+" sequences in the index."); }
Example #18
Source File: FastUtilIntObjectMapTest.java From hashmapTest with The Unlicense | 5 votes |
@Override public int test() { final Int2ObjectOpenHashMap<Integer> m_map = new Int2ObjectOpenHashMap<>( m_keys.length, m_fillFactor ); for ( int i = 0; i < m_keys.length; ++i ) m_map.put( m_keys[ i ], null ); for ( int i = 0; i < m_keys.length; ++i ) m_map.put( m_keys[ i ], null ); return m_map.size(); }
Example #19
Source File: DemonTest.java From Neo4jSNA with Apache License 2.0 | 5 votes |
protected void initGraph() { this.nodes = new Int2ObjectOpenHashMap<>(); RelationshipType knows = CommonsRelationshipTypes.KNOWS; IntStream.range(0, 6).forEach(n -> nodes.put(n, this.createNode(n))); nodes.get(0).createRelationshipTo(nodes.get(1), knows); nodes.get(0).createRelationshipTo(nodes.get(2), knows); nodes.get(0).createRelationshipTo(nodes.get(3), knows); nodes.get(0).createRelationshipTo(nodes.get(4), knows); nodes.get(0).createRelationshipTo(nodes.get(5), knows); nodes.get(1).createRelationshipTo(nodes.get(2), knows); nodes.get(3).createRelationshipTo(nodes.get(4), knows); IntStream.range(6, 11).forEach(n -> nodes.put(n, this.createNode(n))); nodes.get(3).createRelationshipTo(nodes.get(6), knows); nodes.get(4).createRelationshipTo(nodes.get(7), knows); nodes.get(5).createRelationshipTo(nodes.get(8), knows); nodes.get(4).createRelationshipTo(nodes.get(9), knows); nodes.get(4).createRelationshipTo(nodes.get(10), knows); nodes.get(9).createRelationshipTo(nodes.get(10), knows); }
Example #20
Source File: LouvainTest.java From Neo4jSNA with Apache License 2.0 | 5 votes |
@Override protected void initGraph() { Int2ObjectMap<Node> nodes = new Int2ObjectOpenHashMap<>(); for (int i = 0; i < 9; i++) { Node n = db.createNode(); n.setProperty("id", i); nodes.put(i, n); } for (int i = 0; i < 9; i++) { Node src = nodes.get(i); Node dst = (i + 1) % 3 != 0 ? nodes.get(i + 1) : nodes.get(i - 2); src.createRelationshipTo(dst, CommonsRelationshipTypes.KNOWS); // dst.createRelationshipTo(src, CommonsRelationshipTypes.KNOWS); } nodes.get(0).createRelationshipTo(nodes.get(3), CommonsRelationshipTypes.KNOWS); nodes.get(3).createRelationshipTo(nodes.get(6), CommonsRelationshipTypes.KNOWS); nodes.get(6).createRelationshipTo(nodes.get(0), CommonsRelationshipTypes.KNOWS); // for (int i = 0; i < 9; i += 3) { // Node src = nodes.get(i); // Node dst1 = nodes.get((i + 3) % 9); // Node dst2 = nodes.get((i + 6) % 9); // src.createRelationshipTo(dst1, CommonsRelationshipTypes.KNOWS); // // dst1.createRelationshipTo(src, CommonsRelationshipTypes.KNOWS); // src.createRelationshipTo(dst2, CommonsRelationshipTypes.KNOWS); // // dst2.createRelationshipTo(src, CommonsRelationshipTypes.KNOWS); // } }
Example #21
Source File: FastUtilIntObjectMapTest.java From hashmapTest with The Unlicense | 5 votes |
@Override public int test() { final Int2ObjectOpenHashMap<Integer> m_map = new Int2ObjectOpenHashMap<>( m_keys.length / 2 + 1, m_fillFactor ); final Integer value = 1; int add = 0, remove = 0; while ( add < m_keys.length ) { m_map.put( m_keys[ add ], value ); ++add; m_map.put( m_keys[ add ], value ); ++add; m_map.remove( m_keys[ remove++ ] ); } return m_map.size(); }
Example #22
Source File: FMIntFeatureMapModel.java From incubator-hivemall with Apache License 2.0 | 5 votes |
public FMIntFeatureMapModel(@Nonnull FMHyperParameters params) { super(params); this._w0 = 0.f; this._w = new Int2FloatOpenHashMap(DEFAULT_MAPSIZE); _w.defaultReturnValue(0.f); this._V = new Int2ObjectOpenHashMap<float[]>(DEFAULT_MAPSIZE); this._minIndex = 0; this._maxIndex = 0; }
Example #23
Source File: NodeMetadataLeftIndexedPowerLawMultiSegmentBipartiteGraph.java From GraphJet with Apache License 2.0 | 5 votes |
@Override ReusableNodeLongIterator initializeLeftNodeEdgesLongIterator() { return new NodeMetadataMultiSegmentIterator( this, new LeftSegmentEdgeAccessor<NodeMetadataLeftIndexedBipartiteGraphSegment>( getReaderAccessibleInfo(), new Int2ObjectOpenHashMap<ReusableNodeIntIterator>(getMaxNumSegments()), new Int2ObjectOpenHashMap<ReusableInternalIdToLongIterator>(getMaxNumSegments()) ) ); }
Example #24
Source File: MultiSegmentReaderAccessibleInfoProvider.java From GraphJet with Apache License 2.0 | 5 votes |
/** * The constructor tries to reserve most of the memory that is needed for the graph. * * @param maxNumSegments is the maximum number of segments to store * @param maxNumEdgesPerSegment is the maximum number of edges a segment will store */ public MultiSegmentReaderAccessibleInfoProvider(int maxNumSegments, int maxNumEdgesPerSegment) { // this is going to swapped out right away in the addNewSegment call this.multiSegmentReaderAccessibleInfo = new MultiSegmentReaderAccessibleInfo<T>( new Int2ObjectOpenHashMap<T>(maxNumSegments), 0, -1); this.maxNumSegments = maxNumSegments; this.maxNumEdgesPerSegment = maxNumEdgesPerSegment; }
Example #25
Source File: MultiSegmentPowerLawBipartiteGraph.java From GraphJet with Apache License 2.0 | 5 votes |
@Override ReusableNodeRandomLongIterator initializeRightNodeEdgesRandomLongIterator() { return new MultiSegmentRandomIterator<BipartiteGraphSegment>( this, new RightSegmentRandomEdgeAccessor( getReaderAccessibleInfo(), new Int2ObjectOpenHashMap<ReusableInternalIdToLongIterator>( getMaxNumSegments()), new Int2ObjectOpenHashMap<ReusableNodeRandomIntIterator>( getMaxNumSegments()) ) ); }
Example #26
Source File: MultiSegmentPowerLawBipartiteGraph.java From GraphJet with Apache License 2.0 | 5 votes |
@Override ReusableNodeLongIterator initializeRightNodeEdgesLongIterator() { return new ChronologicalMultiSegmentIterator<BipartiteGraphSegment>( this, new RightSegmentEdgeAccessor( getReaderAccessibleInfo(), new Int2ObjectOpenHashMap<ReusableNodeIntIterator>( getMaxNumSegments()), new Int2ObjectOpenHashMap<ReusableInternalIdToLongIterator>( getMaxNumSegments()) ) ); }
Example #27
Source File: MultiSegmentPowerLawBipartiteGraph.java From GraphJet with Apache License 2.0 | 5 votes |
@Override ReusableNodeRandomLongIterator initializeLeftNodeEdgesRandomLongIterator() { return new MultiSegmentRandomIterator<BipartiteGraphSegment>( this, new LeftSegmentRandomEdgeAccessor<BipartiteGraphSegment>( getReaderAccessibleInfo(), new Int2ObjectOpenHashMap<ReusableInternalIdToLongIterator>( getMaxNumSegments()), new Int2ObjectOpenHashMap<ReusableNodeRandomIntIterator>( getMaxNumSegments()) ) ); }
Example #28
Source File: MultiSegmentPowerLawBipartiteGraph.java From GraphJet with Apache License 2.0 | 5 votes |
@Override ReusableNodeLongIterator initializeLeftNodeEdgesLongIterator() { return new ChronologicalMultiSegmentIterator<BipartiteGraphSegment>( this, new LeftSegmentEdgeAccessor<BipartiteGraphSegment>( getReaderAccessibleInfo(), new Int2ObjectOpenHashMap<ReusableNodeIntIterator>( getMaxNumSegments()), new Int2ObjectOpenHashMap<ReusableInternalIdToLongIterator>( getMaxNumSegments()) ) ); }
Example #29
Source File: AbstractPredictionModel.java From incubator-hivemall with Apache License 2.0 | 5 votes |
@Override public void configureMix(@Nonnull ModelUpdateHandler handler, boolean cancelMixRequest) { this.handler = handler; this.cancelMixRequest = cancelMixRequest; if (cancelMixRequest) { if (isDenseModel()) { this.mixedRequests_i = new Int2ObjectOpenHashMap<MixedWeight>(327680); } else { this.mixedRequests_o = new Object2ObjectOpenHashMap<Object, MixedWeight>(327680); } } }
Example #30
Source File: FactorizedModel.java From incubator-hivemall with Apache License 2.0 | 5 votes |
public FactorizedModel(@Nonnull RatingInitializer ratingInitializer, @Nonnegative int factor, float meanRating, @Nonnull RankInitScheme initScheme, int expectedSize) { this.ratingInitializer = ratingInitializer; this.factor = factor; this.initScheme = initScheme; this.minIndex = 0; this.maxIndex = 0; this.meanRating = ratingInitializer.newRating(meanRating); this.users = new Int2ObjectOpenHashMap<Rating[]>(expectedSize); this.items = new Int2ObjectOpenHashMap<Rating[]>(expectedSize); this.userBias = new Int2ObjectOpenHashMap<Rating>(expectedSize); this.itemBias = new Int2ObjectOpenHashMap<Rating>(expectedSize); this.randU = newRandoms(factor, 31L); this.randI = newRandoms(factor, 41L); }