Removed dependency on DistributionFactory. Added settable gamma distribution field.

git-svn-id: https://svn.apache.org/repos/asf/jakarta/commons/proper/math/trunk@545179 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Brent Worden 2007-06-07 13:44:09 +00:00
parent 52775a6b76
commit de8c2adc64
1 changed files with 21 additions and 8 deletions

View File

@ -37,12 +37,22 @@ public class ChiSquaredDistributionImpl
/** /**
* Create a Chi-Squared distribution with the given degrees of freedom. * Create a Chi-Squared distribution with the given degrees of freedom.
* @param degreesOfFreedom degrees of freedom. * @param df degrees of freedom.
*/ */
public ChiSquaredDistributionImpl(double degreesOfFreedom) { public ChiSquaredDistributionImpl(double df) {
this(df, new GammaDistributionImpl(df / 2.0, 2.0));
}
/**
* Create a Chi-Squared distribution with the given degrees of freedom.
* @param df degrees of freedom.
* @param g the underlying gamma distribution used to compute probabilities.
* @since 1.2
*/
public ChiSquaredDistributionImpl(double df, GammaDistribution g) {
super(); super();
setGamma(DistributionFactory.newInstance().createGammaDistribution( setGamma(g);
degreesOfFreedom / 2.0, 2.0)); setDegreesOfFreedom(df);
} }
/** /**
@ -161,11 +171,14 @@ public class ChiSquaredDistributionImpl
} }
/** /**
* Modify the Gamma distribution. * Modify the underlying gamma distribution. The caller is responsible for
* @param gamma the new distribution. * insuring the gamma distribution has the proper parameter settings.
* @param g the new distribution.
* @since 1.2 made public
*/ */
private void setGamma(GammaDistribution gamma) { public void setGamma(GammaDistribution g) {
this.gamma = gamma; this.gamma = g;
} }
/** /**