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

Java LongArrays类代码示例

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

本文整理汇总了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;未经允许,请勿转载。


鲜花

握手

雷人

路过

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

请发表评论

全部评论

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

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

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

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

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