本文整理了Java中java.util.Arrays.parallelSetAll()
方法的一些代码示例,展示了Arrays.parallelSetAll()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Arrays.parallelSetAll()
方法的具体详情如下:
包路径:java.util.Arrays
类名称:Arrays
方法名:parallelSetAll
暂无
代码示例来源:origin: RichardWarburton/java-8-lambdas-exercises
public static double[] parallelInitialize(int size) {
double[] values = new double[size];
Arrays.parallelSetAll(values, i -> i);
return values;
}
// END parallelInitialize
代码示例来源:origin: biezhi/learn-java8
public static void main(String[] args) {
long[] arrayOfLong = new long[20000];
Arrays.parallelSetAll(arrayOfLong,
index -> ThreadLocalRandom.current().nextInt(1000000));
Arrays.stream(arrayOfLong).limit(10).forEach(
i -> System.out.print(i + " "));
System.out.println();
Arrays.parallelSort(arrayOfLong);
Arrays.stream(arrayOfLong).limit(10).forEach(
i -> System.out.print(i + " "));
System.out.println();
}
}
代码示例来源:origin: teiid/teiid
@Override
public void clear() {
Arrays.parallelSetAll(elementData, i->null);
size = 0;
}
代码示例来源:origin: org.teiid/teiid-engine
@Override
public void clear() {
Arrays.parallelSetAll(elementData, i->null);
size = 0;
}
代码示例来源:origin: stackoverflow.com
Arrays.parallelSetAll(array, idx -> {
try {
return someFunc(idx/(N*N), (idx/N)%N, idx % N);
}
catch(MyCheckedException ex) {
throw new RuntimeException(ex);
}
});
代码示例来源:origin: BruceEckel/OnJava8-Examples
public static void main(String[] args) {
System.out.println(Summing3.CHECK);
Long[] aL = new Long[Summing3.SZ+1];
Arrays.parallelSetAll(aL, i -> (long)i);
Summing.timeTest("Long Parallel",
Summing3.CHECK, () ->
Arrays.stream(aL)
.parallel()
.reduce(0L,Long::sum));
}
}
代码示例来源:origin: BruceEckel/OnJava8-Examples
@Benchmark
public void parallelSetAll() {
Arrays.parallelSetAll(la, n -> n);
}
}
代码示例来源:origin: BruceEckel/OnJava8-Examples
@Benchmark
public void parallelSetAll() {
Arrays.parallelSetAll(la, n -> n);
}
}
代码示例来源:origin: com.simiacryptus/mindseye
/**
* Set tensor.
*
* @param f the f
* @return the tensor
*/
@Nonnull
public Tensor set(@Nonnull final IntToDoubleFunction f) {
Arrays.parallelSetAll(getData(), f);
return this;
}
代码示例来源:origin: stackoverflow.com
double[] array=new double[n+1];
Arrays.parallelSetAll(array, index -> index==0? 1: x/index);
Arrays.parallelPrefix(array, (a,b) -> a*b);
// we could do the last step as prefix op as well:
//Arrays.parallelPrefix(array, Double::sum);
//double exp=array[n];
// but a straight forward summing is better:
double exp=Arrays.stream(array).parallel().sum();
代码示例来源:origin: com.simiacryptus/mindseye-java
/**
* Sets weights.
*
* @param f the f
* @return the weights
*/
@Nonnull
public FullyConnectedReferenceLayer set(@Nonnull final DoubleSupplier f) {
Arrays.parallelSetAll(weights.getData(), i -> f.getAsDouble());
return this;
}
代码示例来源:origin: com.simiacryptus/mindseye
/**
* Sets weights.
*
* @param f the f
* @return the weights
*/
@Nonnull
public FullyConnectedReferenceLayer set(@Nonnull final DoubleSupplier f) {
Arrays.parallelSetAll(weights.getData(), i -> f.getAsDouble());
return this;
}
代码示例来源:origin: com.simiacryptus/mindseye-java
/**
* Sets weights.
*
* @param f the f
* @return the weights
*/
@Nonnull
public ReLuActivationLayer setWeights(@Nonnull final DoubleSupplier f) {
Arrays.parallelSetAll(weights.getData(), i -> f.getAsDouble());
return this;
}
代码示例来源:origin: com.simiacryptus/mindseye
/**
* Sets weights.
*
* @param f the f
* @return the weights
*/
@Nonnull
public ReLuActivationLayer setWeights(@Nonnull final DoubleSupplier f) {
Arrays.parallelSetAll(weights.getData(), i -> f.getAsDouble());
return this;
}
代码示例来源:origin: BruceEckel/OnJava8-Examples
@Benchmark
public void parallelSetAll() {
Arrays.parallelSetAll(la, n -> f(n));
}
}
代码示例来源:origin: com.simiacryptus/mindseye-cudnn
/**
* Sets weights.
*
* @param f the f
* @return the weights
*/
@Nonnull
public FullyConnectedLayer setWeights(@Nonnull final DoubleSupplier f) {
Arrays.parallelSetAll(getWeights().getData(), i -> f.getAsDouble());
return this;
}
代码示例来源:origin: com.simiacryptus/mindseye
/**
* Sets weights.
*
* @param f the f
* @return the weights
*/
@Nonnull
public FullyConnectedLayer setWeights(@Nonnull final DoubleSupplier f) {
Arrays.parallelSetAll(getWeights().getData(), i -> f.getAsDouble());
return this;
}
代码示例来源:origin: BruceEckel/OnJava8-Examples
static void intArray() {
int[] ia = new int[SIZE];
Arrays.setAll(ia, new Rand.Pint()::get);
Arrays.parallelSetAll(ia, new Rand.Pint()::get);
}
static void longArray() {
代码示例来源:origin: neo4j-contrib/neo4j-graph-algorithms
@Override
public double[] getCentrality() {
final double[] cc = new double[nodeCount];
Arrays.parallelSetAll(cc, i -> centrality(farness.get(i),
component.get(i),
nodeCount,
wassermanFaust));
return cc;
}
代码示例来源:origin: BruceEckel/OnJava8-Examples
static void longArray() {
long[] la = new long[SIZE];
Arrays.setAll(la, new Rand.Plong()::get);
Arrays.parallelSetAll(la, new Rand.Plong()::get);
}
public static void main(String[] args) {
内容来源于网络,如有侵权,请联系作者删除!