gpt4 book ai didi

org.apache.commons.rng.sampling.distribution.ZigguratNormalizedGaussianSampler类的使用及代码示例

转载 作者:知者 更新时间:2024-03-19 12:39:31 26 4
gpt4 key购买 nike

本文整理了Java中org.apache.commons.rng.sampling.distribution.ZigguratNormalizedGaussianSampler类的一些代码示例,展示了ZigguratNormalizedGaussianSampler类的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ZigguratNormalizedGaussianSampler类的具体详情如下:
包路径:org.apache.commons.rng.sampling.distribution.ZigguratNormalizedGaussianSampler
类名称:ZigguratNormalizedGaussianSampler

ZigguratNormalizedGaussianSampler介绍

[英][Marsaglia and Tsang "Ziggurat" method](https://en.wikipedia.org/wiki/Ziggurat_algorithm) for sampling from a Gaussian distribution with mean 0 and standard deviation 1. The algorithm is explained in this paper and this implementation has been adapted from the C code provided therein.
[中][Marsaglia and Tsang "Ziggurat" method](https://en.wikipedia.org/wiki/Ziggurat_algorithm)用于从平均值为0且标准偏差为1的高斯分布进行采样。该算法在{$1$}中进行了解释,该实现已根据其中提供的C代码进行了修改。

代码示例

代码示例来源:origin: io.virtdata/virtdata-lib-curves4

/**
 * @param dimension Space dimension.
 * @param rng Generator for the individual components of the vectors.
 * A shallow copy will be stored in this instance.
 */
public UnitSphereSampler(int dimension,
             UniformRandomProvider rng) {
  this.dimension = dimension;
  sampler = new ZigguratNormalizedGaussianSampler(rng);
}

代码示例来源:origin: io.virtdata/virtdata-lib-curves4

/** {@inheritDoc} */
@Override
public double sample() {
  final long j = rng.nextLong();
  final int i = (int) (j & LAST);
  if (Math.abs(j) < K[i]) {
    return j * W[i];
  } else {
    return fix(j, i);
  }
}

代码示例来源:origin: org.apache.commons/commons-rng-sampling

if (F[iz] + rng.nextDouble() * (F[iz - 1] - F[iz]) < gauss(x)) {
  return x;
} else {
  return sample();

代码示例来源:origin: io.virtdata/virtdata-lib-curves4

} else {
  if (F[iz] + rng.nextDouble() * (F[iz - 1] - F[iz]) < gauss(x)) {
    return x;
  } else {

代码示例来源:origin: org.apache.commons/commons-rng-sampling

/**
 * @param dimension Space dimension.
 * @param rng Generator for the individual components of the vectors.
 * A shallow copy will be stored in this instance.
 */
public UnitSphereSampler(int dimension,
             UniformRandomProvider rng) {
  if (dimension <= 0) {
    throw new IllegalArgumentException("Dimension must be strictly positive");
  }
  this.dimension = dimension;
  sampler = new ZigguratNormalizedGaussianSampler(rng);
}

代码示例来源:origin: org.apache.commons/commons-rng-sampling

/** {@inheritDoc} */
@Override
public double sample() {
  final long j = rng.nextLong();
  final int i = (int) (j & LAST);
  if (Math.abs(j) < K[i]) {
    return j * W[i];
  } else {
    return fix(j, i);
  }
}

代码示例来源:origin: org.apache.commons/commons-rng-sampling

/**
 * @param rng Generator of uniformly distributed random numbers.
 * @param alpha Alpha parameter of the distribution.
 * @param theta Theta parameter of the distribution.
 */
public AhrensDieterMarsagliaTsangGammaSampler(UniformRandomProvider rng,
                       double alpha,
                       double theta) {
  super(null);
  this.rng = rng;
  this.alpha = alpha;
  this.theta = theta;
  gaussian = new ZigguratNormalizedGaussianSampler(rng);
  oneOverTheta = 1 / theta;
  bGSOptim = 1 + theta / Math.E;
  dOptim = theta - ONE_THIRD;
  cOptim = ONE_THIRD / Math.sqrt(dOptim);
}

代码示例来源:origin: io.virtdata/virtdata-lib-curves4

/**
 * @param rng Generator of uniformly distributed random numbers.
 * @param alpha Alpha parameter of the distribution.
 * @param theta Theta parameter of the distribution.
 */
public AhrensDieterMarsagliaTsangGammaSampler(UniformRandomProvider rng,
                       double alpha,
                       double theta) {
  super(null);
  this.rng = rng;
  this.alpha = alpha;
  this.theta = theta;
  gaussian = new ZigguratNormalizedGaussianSampler(rng);
  oneOverTheta = 1 / theta;
  bGSOptim = 1 + theta / Math.E;
  dOptim = theta - ONE_THIRD;
  cOptim = ONE_THIRD / Math.sqrt(dOptim);
}

代码示例来源:origin: org.apache.commons/commons-rng-examples-jpms-lib

/**
 * @param players Number of players.
 * @param rounds Number of rounds.
 * @param mu Mean.
 * @param sigma Standard deviation.
 * @param rng RNG.
 */
public DiceGame(int players,
        int rounds,
        UniformRandomProvider rng,
        double mu,
        double sigma) {
  this.rng = rng;
  this.rounds = rounds;
  this.players = players;
  sampler = new GaussianSampler(new ZigguratNormalizedGaussianSampler(rng), mu, sigma);
}

代码示例来源:origin: io.virtdata/virtdata-lib-curves4

gaussian = new ZigguratNormalizedGaussianSampler(rng);
exponential = new AhrensDieterExponentialSampler(rng, 1);

代码示例来源:origin: org.apache.commons/commons-rng-sampling

gaussian = new ZigguratNormalizedGaussianSampler(rng);
exponential = new AhrensDieterExponentialSampler(rng, 1);

代码示例来源:origin: org.apache.commons/commons-rng-sampling

gaussian = new ZigguratNormalizedGaussianSampler(rng);
exponential = new AhrensDieterExponentialSampler(rng, 1);

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com