當前位置: 首頁>>代碼示例>>Java>>正文


Java Poisson.nextPoisson方法代碼示例

本文整理匯總了Java中dr.math.Poisson.nextPoisson方法的典型用法代碼示例。如果您正苦於以下問題:Java Poisson.nextPoisson方法的具體用法?Java Poisson.nextPoisson怎麽用?Java Poisson.nextPoisson使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在dr.math.Poisson的用法示例。


在下文中一共展示了Poisson.nextPoisson方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: mutate

import dr.math.Poisson; //導入方法依賴的package包/類
public Mutation[] mutate(byte[] sequence, byte[] childSequence) {

		if (genomeLength != sequence.length) {
			genomeLength = sequence.length;
			poissonMean = genomeLength * muRate;
		}

		int mutationCount = Poisson.nextPoisson(poissonMean);
		Mutation[] mutations = new Mutation[mutationCount];

		System.arraycopy(sequence, 0, childSequence, 0, genomeLength);

		byte newState;
		for (int i = 0; i < mutationCount; i++) {
			int pos = MathUtils.nextInt(genomeLength);

			newState = (byte)MathUtils.nextInt(stateSize-1);
			if (newState == sequence[i]) {
				newState = (byte)((newState + 1) % stateSize);
			}

			childSequence[pos] = newState;
			mutations[i] = new Mutation(pos, newState);
		}
		return mutations;
	}
 
開發者ID:beast-dev,項目名稱:beast-mcmc,代碼行數:27,代碼來源:SimpleMutator.java

示例2: mutate

import dr.math.Poisson; //導入方法依賴的package包/類
public Mutation[] mutate(byte[] sequence, byte[] childSequence) {

		if (genomeLength != sequence.length) {
			genomeLength = sequence.length;
			poissonMean = genomeLength * muRate;
		}

		int mutationCount = Poisson.nextPoisson(poissonMean);
		Mutation[] mutations = new Mutation[mutationCount];

		System.arraycopy(sequence, 0, childSequence, 0, genomeLength);

		for (int i = 0; i < mutationCount; i++) {
			int pos = MathUtils.nextInt(genomeLength);
			byte state = (byte)((sequence[pos] + 1) % 2);
			childSequence[pos] = state;
			mutations[i] = new Mutation(pos, state);
		}
		return mutations;
	}
 
開發者ID:beast-dev,項目名稱:beast-mcmc,代碼行數:21,代碼來源:BinaryMutator.java

示例3: generatePartition

import dr.math.Poisson; //導入方法依賴的package包/類
public double[] generatePartition() {
    int lengthDividedByTwo = (getNumberOfPartitionsMinusOne() + 1) / 2;

    int value = 0;

    while (value < 1 || value > lengthDividedByTwo) {
        value = Poisson.nextPoisson(mean);
    }

    int[] x = new int[getNumberOfPartitionsMinusOne() + 1];

    for (int i = 0; i < value; i++) {
        x[i] = 1;
    }

    MathUtils.permute(x);

    if (x[0] == 1) {
        for (int i = 0; i < x.length; i++) {
            if (x[i] == 1) {
                x[i] = 0;
            } else {
                x[i] = 1;
            }
        }
    }

    double[] rValue = new double[x.length];

    for (int i = 0; i < rValue.length; i++) {
        rValue[i] = x[i];
    }

    return rValue;
}
 
開發者ID:beast-dev,項目名稱:beast-mcmc,代碼行數:36,代碼來源:PoissonPartitionLikelihood.java

示例4: smoothPoissonOnly

import dr.math.Poisson; //導入方法依賴的package包/類
private static double[] smoothPoissonOnly(final double[] c, final double[] t, final boolean sample) {
    final double[] smoothed = new double[c.length];

    final double lambda = fitLambda(c, t);

    for (int i = 0; i < c.length; i++) {
        if (sample) {
            smoothed[i] = Poisson.nextPoisson(lambda * t[i]);
        } else {
            smoothed[i] = lambda;
        }
    }

    return smoothed;
}
 
開發者ID:cmccoy,項目名稱:startreerenaissance,代碼行數:16,代碼來源:TLambdaPoissonSmoother.java


注:本文中的dr.math.Poisson.nextPoisson方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。