本文整理匯總了Java中org.apache.commons.math3.random.HaltonSequenceGenerator類的典型用法代碼示例。如果您正苦於以下問題:Java HaltonSequenceGenerator類的具體用法?Java HaltonSequenceGenerator怎麽用?Java HaltonSequenceGenerator使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
HaltonSequenceGenerator類屬於org.apache.commons.math3.random包,在下文中一共展示了HaltonSequenceGenerator類的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: createGenerator
import org.apache.commons.math3.random.HaltonSequenceGenerator; //導入依賴的package包/類
private static RandomVectorGenerator createGenerator(RandomVectorGenerator[] generator, int size)
{
// Create the generator
if (generator == null)
generator = new RandomVectorGenerator[1];
RandomVectorGenerator g = generator[0];
if (g == null || g.nextVector().length != size)
{
generator[0] = g = new HaltonSequenceGenerator(size);
}
return g;
}
示例2: UniformDistribution
import org.apache.commons.math3.random.HaltonSequenceGenerator; //導入依賴的package包/類
/**
* Create a new uniform distribution using a Halton sequence
*
* @param min
* The minimum bounds for the distribution
* @param max
* The maximum bounds for the distribution
* @param seed
* Start at the i-th point in the Halton sequence
*/
public UniformDistribution(double[] min, double[] max, int seed)
{
//HaltonSequenceGenerator randomVectorGenerator = new HaltonSequenceGenerator(3);
// The Halton sequence based on the prime of 2 does not provide great variety in the
// lesser significant digits when simulating a 512x512 pixel image. This is not suitable for
// PSF fitting since we require variation to at least 3 decimal places.
HaltonSequenceGenerator randomVectorGenerator = new HaltonSequenceGenerator(3, new int[] { 3, 5, 7 }, null);
randomVectorGenerator.skipTo(Math.abs(seed));
init(min, max, randomVectorGenerator);
}
示例3: score
import org.apache.commons.math3.random.HaltonSequenceGenerator; //導入依賴的package包/類
/**
* Score random samples from the search space and return the top fraction.
*
* @param <T>
* the type of comparable score
* @param dimensions
* the dimensions
* @param scoreFunction
* the score function
* @param samples
* the samples
* @param fraction
* the fraction
* @param generator
* the generator
* @return the score results
*/
private <T extends Comparable<T>> SearchResult<T>[] score(Dimension[] dimensions,
FullScoreFunction<T> scoreFunction, int samples, double fraction, HaltonSequenceGenerator[] generator)
{
searchSpace = sample(dimensions, samples, generator);
// Score
SearchResult<T>[] scores = scoreFunction.score(searchSpace);
// Get the top fraction
int size = (int) Math.ceil(scores.length * fraction);
return scoreFunction.cut(scores, size);
}