• 如果您觉得本站非常有看点,那么赶紧使用Ctrl+D 收藏吧

Java NormalGen类的典型用法和代码示例

java 1次浏览

本文整理汇总了Java中umontreal.iro.lecuyer.randvar.NormalGen的典型用法代码示例。如果您正苦于以下问题:Java NormalGen类的具体用法?Java NormalGen怎么用?Java NormalGen使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。

NormalGen类属于umontreal.iro.lecuyer.randvar包,在下文中一共展示了NormalGen类的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: init

点赞 2

import umontreal.iro.lecuyer.randvar.NormalGen; //导入依赖的package包/类
/**
 * This method initiates the KDE, i.e. sort values in ascending order,
 * compute an empirical distribution out of it, makes use of a NormalGen to
 * generate random variates from the normal distribution, and then use these
 * variates to generate a kernel density generator of the empirical
 * distribution.
 *
 * @param data the data
 */
private void init(double[] data) {
    datasetSize = (double) data.length;
    Arrays.sort(data);
    empiricalDist = new EmpiricalDist(data);
    // new Stream to randomly generate numbers
    // combined multiple recursive generator (CMRG)
    RandomStream stream = new MRG31k3p();
    NormalGen normalKernelDensityGen = new NormalGen(stream);
    kernelDensityGen = new KernelDensityGen(stream, empiricalDist, normalKernelDensityGen);
}
 

开发者ID:compomics,
项目名称:compomics-utilities,
代码行数:20,
代码来源:NormalKernelDensityEstimator.java

示例2: generateMultiNormal

点赞 2

import umontreal.iro.lecuyer.randvar.NormalGen; //导入依赖的package包/类
/**
 * Used for NORTA
 * @param p
 * @param n
 * @return
 */
public static double[][] generateMultiNormal(double p, int n)
{
	MRG32k3a prng = new MRG32k3a();
	NormalGen ng = new NormalGen(prng);
	MultinormalCholeskyGen dist = new MultinormalCholeskyGen(ng, new double[] {0, 0}, new double[][] { {1, p},{p, 1}});
	
	double [][] result = new double[n][2];
	for(int i = 0; i < n; i++)
	{
		dist.nextPoint(result[i]);
	}
	return result;
}
 

开发者ID:in3rtial,
项目名称:ift6561_simulation_stochastique,
代码行数:20,
代码来源:Exercise6.java

示例3: simulate

点赞 2

import umontreal.iro.lecuyer.randvar.NormalGen; //导入依赖的package包/类
public double[] simulate(RandomStream rng) {
    double[] answer = new double[N];
    NormalGen ngen = new NormalGen(rng, new NormalDist());
    for (int i = 0; i < N; i++) {
        answer[i] = a + b * ngen.nextDouble();
    }
    return answer;
}
 

开发者ID:mnip91,
项目名称:proactive-component-monitoring,
代码行数:9,
代码来源:VasisekModelInterestRates.java

示例4: simulate

点赞 2

import umontreal.iro.lecuyer.randvar.NormalGen; //导入依赖的package包/类
public double[] simulate(RandomStream rng) {
    double[] answer = new double[N];
    NormalGen ngen = new NormalGen(rng, new NormalDist());
    for (int i = 0; i < N; i++) {
        answer[i] = alpha *
            Math.exp((Y - 0.5 * sigma * sigma) * T + sigma * Math.sqrt(T) * ngen.nextDouble());
    }
    return answer;
}
 

开发者ID:mnip91,
项目名称:proactive-component-monitoring,
代码行数:10,
代码来源:GeometricBrownianMotionMultipleCashDividends.java

示例5: simulate

点赞 2

import umontreal.iro.lecuyer.randvar.NormalGen; //导入依赖的package包/类
public double[] simulate(RandomStream rng) {
    double[] answer = new double[N];
    NormalGen ngen = new NormalGen(rng, new NormalDist());
    for (int i = 0; i < N; i++) {
        answer[i] = s0 *
            Math.exp((mu - 0.5 * sigma * sigma) * t + sigma * Math.sqrt(t) * ngen.nextDouble());
    }
    return answer;
}
 

开发者ID:mnip91,
项目名称:proactive-component-monitoring,
代码行数:10,
代码来源:GeometricBrownianMotion.java

示例6: simulate

点赞 2

import umontreal.iro.lecuyer.randvar.NormalGen; //导入依赖的package包/类
/**
 * The Brownian Bridge is used to generate new samples between two known samples of a Brownian motion path.
 * i.e generate sample at time t using sample at time 0 and at T, with 0<t<T
 */
public double[] simulate(RandomStream rng) {
    final double[] answer = new double[1];
    NormalGen ngen = new NormalGen(rng, new NormalDist());
    answer[0] = w0 + (t / T) * (wT - w0) + Math.sqrt(t * (T - t) / T) * ngen.nextDouble();
    return answer;
}
 

开发者ID:mnip91,
项目名称:proactive-component-monitoring,
代码行数:11,
代码来源:BrownianBridge.java

示例7: simulate

点赞 2

import umontreal.iro.lecuyer.randvar.NormalGen; //导入依赖的package包/类
public double[] simulate(RandomStream rng) {
    double[] answer = new double[N];
    NormalGen ngen = new NormalGen(rng, new NormalDist());
    for (int i = 0; i < N; i++) {
        answer[i] = (s0 / (1 + D)) *
            Math.exp((Y - 0.5 * sigma * sigma) * T + sigma * Math.sqrt(T) * ngen.nextDouble());
    }
    return answer;
}
 

开发者ID:mnip91,
项目名称:proactive-component-monitoring,
代码行数:10,
代码来源:GeometricBrownianMotionStockDividend.java

示例8: simulate

点赞 2

import umontreal.iro.lecuyer.randvar.NormalGen; //导入依赖的package包/类
public double[] simulate(RandomStream rng) {
    double[] answer = new double[N];
    NormalGen ngen = new NormalGen(rng, new NormalDist());
    for (int i = 0; i < N; i++) {
        answer[i] = (s0 - Dt * Math.exp(-r * t)) *
            Math.exp((Y - 0.5 * sigma * sigma) * T + sigma * Math.sqrt(T) * ngen.nextDouble());
    }
    return answer;
}
 

开发者ID:mnip91,
项目名称:proactive-component-monitoring,
代码行数:10,
代码来源:GeometricBrownianMotionCashDividend.java

示例9: simulate

点赞 2

import umontreal.iro.lecuyer.randvar.NormalGen; //导入依赖的package包/类
public double[] simulate(RandomStream rng) {
    double[] answer = new double[N];
    NormalGen ngen = new NormalGen(rng, new NormalDist());
    for (int i = 0; i < N; i++) {
        answer[i] = base + factor * ngen.nextDouble();
    }

    return answer;
}
 

开发者ID:mnip91,
项目名称:proactive-component-monitoring,
代码行数:10,
代码来源:OrnsteinUhlenbeckProcess.java


版权声明:本文转自网络文章,转载此文章仅为分享知识,如有侵权,请联系管理员进行删除。
喜欢 (0)