本文整理汇总了Java中it.unimi.dsi.fastutil.longs.LongArrays类的典型用法代码示例。如果您正苦于以下问题:Java LongArrays类的具体用法?Java LongArrays怎么用?Java LongArrays使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
LongArrays类属于it.unimi.dsi.fastutil.longs包,在下文中一共展示了LongArrays类的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: computeExact
import it.unimi.dsi.fastutil.longs.LongArrays; //导入依赖的package包/类
/** Computes and returns the neighbourhood function of the specified graph by multiple breadth-first visits.
*
* <p>This method returns an array of longs. When some values of the function are near 2<sup>63</sup>, it
* provides an exact value, as opposed to {@link #compute(ImmutableGraph, int, ProgressLogger)}.
*
* @param g a graph.
* @param threads the requested number of threads (0 for {@link Runtime#availableProcessors()}).
* @param pl a progress logger, or <code>null</code>.
* @return the neighbourhood function of the specified graph as an array of longs.
*/
public static long[] computeExact( final ImmutableGraph g, final int threads, final ProgressLogger pl ) {
final int n = g.numNodes();
long count[] = LongArrays.EMPTY_ARRAY;
ParallelBreadthFirstVisit visit = new ParallelBreadthFirstVisit( g, threads, true, null );
if ( pl != null ) {
pl.itemsName = "nodes";
pl.expectedUpdates = n;
pl.start();
}
for( int i = 0; i < n; i++ ) {
visit.clear();
visit.visit( i );
final int maxDistance = visit.maxDistance();
if ( count.length <= maxDistance ) count = LongArrays.grow( count, maxDistance + 1 );
for( int d = maxDistance + 1; d-- != 0; ) count[ d ] += visit.cutPoints.getInt( d + 1 ) - visit.cutPoints.getInt( d );
if ( pl != null ) pl.update();
}
if ( pl != null ) pl.done();
int last;
for( last = count.length; last-- != 0 && count[ last ] == 0; );
last++;
final long[] result = new long[ last ];
result[ 0 ] = count[ 0 ];
for( int i = 1; i < last; i++ ) result[ i ] = result[ i - 1 ] + count[ i ];
return result;
}
开发者ID:lhelwerd,项目名称:WebGraph,代码行数:42,代码来源:NeighbourhoodFunction.java
示例2: init
import it.unimi.dsi.fastutil.longs.LongArrays; //导入依赖的package包/类
/** Initialises the approximator, providing a new seed to the underlying {@link HyperLogLogCounterArray}.
*
* <p>This method must be call before a series of {@linkplain #iterate() iterations}.
* @param seed passed to {@link #clear(long)}.
*/
public void init( final long seed ) {
ensureOpen();
info( "Clearing all registers..." );
clear( seed );
// We load the counter i with node i.
for( int i = numNodes; i-- != 0; ) add( i, i );
iteration = -1;
completed = systolic = local = preLocal = false;
if ( ! external ) for( long[] a: resultBits ) LongArrays.fill( a, 0 );
if ( sumOfDistances != null ) Arrays.fill( sumOfDistances, 0 );
if ( sumOfInverseDistances != null ) Arrays.fill( sumOfInverseDistances, 0 );
for ( int i = 0; i < discountFunction.length; i++ ) Arrays.fill( discountedCentrality[ i ], 0 );
// The initial value (the iteration for this value does not actually happen).
neighbourhoodFunction.add( last = numNodes );
BooleanArrays.fill( modifiedCounter, true ); // Initially, all counters are modified.
if ( pl != null ) {
pl.displayFreeMemory = true;
pl.itemsName = "iterates";
pl.start( "Iterating..." );
}
}
开发者ID:lhelwerd,项目名称:WebGraph,代码行数:34,代码来源:HyperBall.java
示例3: init
import it.unimi.dsi.fastutil.longs.LongArrays; //导入依赖的package包/类
/** Initialises the approximator.
*
* <p>This method must be call before a series of {@linkplain #iterate() iterations}.
*/
public void init() {
if ( pl != null ) {
pl.itemsName = "iterates";
pl.start( "Iterating..." );
}
for( long[] a: bits ) LongArrays.fill( a, 0 );
for( int i = numNodes; i-- != 0; ) add( i, i );
last = numNodes;
}
开发者ID:lhelwerd,项目名称:WebGraph,代码行数:14,代码来源:SequentialHyperBall.java
示例4: sortDescending
import it.unimi.dsi.fastutil.longs.LongArrays; //导入依赖的package包/类
@Override
public void sortDescending() {
LongArrays.parallelQuickSort(data.elements(), ReverseLongComparator.instance());
}
开发者ID:jtablesaw,项目名称:tablesaw,代码行数:5,代码来源:LongColumn.java
示例5: sortDescending
import it.unimi.dsi.fastutil.longs.LongArrays; //导入依赖的package包/类
@Override
public void sortDescending() {
LongArrays.parallelQuickSort(data.elements(), reverseLongComparator);
}
开发者ID:jtablesaw,项目名称:tablesaw,代码行数:5,代码来源:DateTimeColumn.java
示例6: getElements
import it.unimi.dsi.fastutil.longs.LongArrays; //导入依赖的package包/类
/**
* Copies element of this type-specific list into the given array using
* optimized system calls.
*
* @param from
* the start index (inclusive).
* @param a
* the destination array.
* @param offset
* the offset into the destination array where to store the first
* element copied.
* @param length
* the number of elements to be copied.
*/
public void getElements(final int from, final long[] a, final int offset,
final int length) {
LongArrays.ensureOffsetLength(a, offset, length);
System.arraycopy(this.a, from, a, offset, length);
}
开发者ID:jsubercaze,项目名称:simhashdb,代码行数:21,代码来源:MyLongArrayList.java
示例7: addElements
import it.unimi.dsi.fastutil.longs.LongArrays; //导入依赖的package包/类
/**
* Adds elements to this type-specific list using optimized system calls.
*
* @param index
* the index at which to add elements.
* @param a
* the array containing the elements.
* @param offset
* the offset of the first element to add.
* @param length
* the number of elements to add.
*/
public void addElements(final int index, final long a[], final int offset,
final int length) {
LongArrays.ensureOffsetLength(a, offset, length);
grow(size + length);
System.arraycopy(this.a, index, this.a, index + length, size - index);
System.arraycopy(a, offset, this.a, index, length);
size += length;
}
开发者ID:jsubercaze,项目名称:simhashdb,代码行数:23,代码来源:MyLongArrayList.java
注:本文中的it.unimi.dsi.fastutil.longs.LongArrays类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论