View Javadoc
1 /* 2 * Beta.java 3 * 4 * Created on March 8, 2005, 1:48 PM 5 */ 6 7 package org.mrd.random; 8 9 /*** 10 * 11 * @author administrator 12 */ 13 public class LimitedGamma extends cern.jet.random.Gamma{ 14 15 /*** Creates a new instance of Gamma */ 16 public LimitedGamma(double alpha, double lambda, edu.cornell.lassp.houle.RngPack.RandomElement random) { 17 super(alpha,lambda,random); 18 } 19 /*** Creates a new instance of Gamma */ 20 public LimitedGamma(double arg0, double arg1, edu.cornell.lassp.houle.RngPack.RandomElement random, boolean byMean, boolean limitVariance) { 21 super(1,1,random); 22 23 if(arg0 <= 0){ 24 arg0 = 1.00e-14; 25 } 26 27 if(arg1 <= 0){ 28 arg1 = 1.00e-14; 29 } 30 31 this.setState( 32 /* setting either alpha or mean */ 33 (byMean) ? 34 /* setting by mean {alpha = variance^2 / mean} */ 35 (arg1*arg1)/arg0 36 : 37 /* setting by alpha */ 38 arg0, 39 /* setting either std or beta */ 40 (byMean) ? 41 /* setting std { lambda = (mean/variance)^2 }*/ 42 Math.pow( arg0 / arg1, 2) 43 : 44 /* setting beta */ 45 arg1 46 ); 47 48 49 50 51 52 } 53 54 /*** Getter for property alpha. 55 * @return Value of property alpha. 56 */ 57 public double getAlpha() { 58 return alpha; 59 } 60 61 /*** Getter for property beta. 62 * @return Value of property beta. 63 */ 64 public double getLambda() { 65 return lambda; 66 } 67 68 /*** Getter for property mean. 69 * @return Value of property mean. 70 */ 71 public double getMean() { 72 return alpha * lambda; 73 } 74 75 /*** Getter for property std. 76 * @return Value of property std. 77 */ 78 public double getStd() { 79 return Math.sqrt(getVariance()); 80 } 81 82 /*** Getter for property variance. 83 * @return Value of property variance. 84 */ 85 public double getVariance() { 86 return lambda * lambda * alpha; 87 } 88 }

This page was automatically generated by Maven