Package weka.core.matrix
Class Maths
java.lang.Object
weka.core.matrix.Maths
- All Implemented Interfaces:
- RevisionHandler
Utility class.
 
 Adapted from the JAMA package.
- Version:
- $Revision: 5953 $
- Author:
- The Mathworks and NIST, Fracpete (fracpete at waikato dot ac dot nz)
- 
Field SummaryFieldsModifier and TypeFieldDescriptionstatic final intDistribution type: chi-squaredstatic final doubleThe constant - log( sqrt(2 pi) )static final intDistribution type: noramlstatic final doubleThe constant 1 / sqrt(2 pi)static final intDistribution type: undefined
- 
Constructor SummaryConstructors
- 
Method SummaryModifier and TypeMethodDescriptionstatic doubledchisq(double x) Returns the density of the Chi-squared distribution.static doubledchisq(double x, double ncp) Returns the density of the noncentral Chi-squared distribution.static DoubleVectordchisq(double x, DoubleVector ncp) Returns the density of the noncentral Chi-squared distribution.static doubledchisqLog(double x) Returns the log-density of the noncentral Chi-square distribution.static doubledchisqLog(double x, double ncp) Returns the log-density value of a noncentral Chi-square distribution.static DoubleVectordchisqLog(double x, DoubleVector ncp) Returns the log-density of a set of noncentral Chi-squared distributions.static doublednorm(double x) Returns the density of the standard normal.static doublednorm(double x, double mean, double sd) Returns the density value of a standard normal.static DoubleVectordnorm(double x, DoubleVector mean, double sd) Returns the density values of a set of normal distributions with different means.static doublednormLog(double x) Returns the log-density of the standard normal.static doublednormLog(double x, double mean, double sd) Returns the log-density value of a standard normal.static DoubleVectordnormLog(double x, DoubleVector mean, double sd) Returns the log-density values of a set of normal distributions with different means.Returns the revision string.static doublehypot(double a, double b) sqrt(a^2 + b^2) without under/overflow.static doublepchisq(double x) Returns the cumulative probability of the Chi-squared distributionstatic doublepchisq(double x, double ncp) Returns the cumulative probability of the noncentral Chi-squared distribution.static DoubleVectorpchisq(double x, DoubleVector ncp) Returns the cumulative probability of a set of noncentral Chi-squared distributions.static doublepnorm(double x) Returns the cumulative probability of the standard normal.static doublepnorm(double x, double mean, double sd) Returns the cumulative probability of a normal distribution.static DoubleVectorpnorm(double x, DoubleVector mean, double sd) Returns the cumulative probability of a set of normal distributions with different means.static DoubleVectorGenerates a sample of a Chi-square distribution.static DoubleVectorGenerates a sample of a normal distribution.static doublesquare(double x) Returns the square of a value
- 
Field Details- 
PSIpublic static final double PSIThe constant 1 / sqrt(2 pi)- See Also:
 
- 
logPSIpublic static final double logPSIThe constant - log( sqrt(2 pi) )- See Also:
 
- 
undefinedDistributionpublic static final int undefinedDistributionDistribution type: undefined- See Also:
 
- 
normalDistributionpublic static final int normalDistributionDistribution type: noraml- See Also:
 
- 
chisqDistributionpublic static final int chisqDistributionDistribution type: chi-squared- See Also:
 
 
- 
- 
Constructor Details- 
Mathspublic Maths()
 
- 
- 
Method Details- 
hypotpublic static double hypot(double a, double b) sqrt(a^2 + b^2) without under/overflow.
- 
squarepublic static double square(double x) Returns the square of a value- Parameters:
- x-
- Returns:
- the square
 
- 
pnormpublic static double pnorm(double x) Returns the cumulative probability of the standard normal.- Parameters:
- x- the quantile
 
- 
pnormpublic static double pnorm(double x, double mean, double sd) Returns the cumulative probability of a normal distribution.- Parameters:
- x- the quantile
- mean- the mean of the normal distribution
- sd- the standard deviation of the normal distribution.
 
- 
pnormReturns the cumulative probability of a set of normal distributions with different means.- Parameters:
- x- the vector of quantiles
- mean- the means of the normal distributions
- sd- the standard deviation of the normal distribution.
- Returns:
- the cumulative probability
 
- 
dnormpublic static double dnorm(double x) Returns the density of the standard normal.- Parameters:
- x- the quantile
- Returns:
- the density
 
- 
dnormpublic static double dnorm(double x, double mean, double sd) Returns the density value of a standard normal.- Parameters:
- x- the quantile
- mean- the mean of the normal distribution
- sd- the standard deviation of the normal distribution.
- Returns:
- the density
 
- 
dnormReturns the density values of a set of normal distributions with different means.- Parameters:
- x- the quantile
- mean- the means of the normal distributions
- sd- the standard deviation of the normal distribution.
- Returns:
- the density
 
- 
dnormLogpublic static double dnormLog(double x) Returns the log-density of the standard normal.- Parameters:
- x- the quantile
- Returns:
- the density
 
- 
dnormLogpublic static double dnormLog(double x, double mean, double sd) Returns the log-density value of a standard normal.- Parameters:
- x- the quantile
- mean- the mean of the normal distribution
- sd- the standard deviation of the normal distribution.
- Returns:
- the density
 
- 
dnormLogReturns the log-density values of a set of normal distributions with different means.- Parameters:
- x- the quantile
- mean- the means of the normal distributions
- sd- the standard deviation of the normal distribution.
- Returns:
- the density
 
- 
rnormGenerates a sample of a normal distribution.- Parameters:
- n- the size of the sample
- mean- the mean of the normal distribution
- sd- the standard deviation of the normal distribution.
- random- the random stream
- Returns:
- the sample
 
- 
pchisqpublic static double pchisq(double x) Returns the cumulative probability of the Chi-squared distribution- Parameters:
- x- the quantile
 
- 
pchisqpublic static double pchisq(double x, double ncp) Returns the cumulative probability of the noncentral Chi-squared distribution.- Parameters:
- x- the quantile
- ncp- the noncentral parameter
 
- 
pchisqReturns the cumulative probability of a set of noncentral Chi-squared distributions.- Parameters:
- x- the quantile
- ncp- the noncentral parameters
 
- 
dchisqpublic static double dchisq(double x) Returns the density of the Chi-squared distribution.- Parameters:
- x- the quantile
- Returns:
- the density
 
- 
dchisqpublic static double dchisq(double x, double ncp) Returns the density of the noncentral Chi-squared distribution.- Parameters:
- x- the quantile
- ncp- the noncentral parameter
 
- 
dchisqReturns the density of the noncentral Chi-squared distribution.- Parameters:
- x- the quantile
- ncp- the noncentral parameters
 
- 
dchisqLogpublic static double dchisqLog(double x) Returns the log-density of the noncentral Chi-square distribution.- Parameters:
- x- the quantile
- Returns:
- the density
 
- 
dchisqLogpublic static double dchisqLog(double x, double ncp) Returns the log-density value of a noncentral Chi-square distribution.- Parameters:
- x- the quantile
- ncp- the noncentral parameter
- Returns:
- the density
 
- 
dchisqLogReturns the log-density of a set of noncentral Chi-squared distributions.- Parameters:
- x- the quantile
- ncp- the noncentral parameters
 
- 
rchisqGenerates a sample of a Chi-square distribution.- Parameters:
- n- the size of the sample
- ncp- the noncentral parameter
- random- the random stream
- Returns:
- the sample
 
- 
getRevisionReturns the revision string.- Specified by:
- getRevisionin interface- RevisionHandler
- Returns:
- the revision
 
 
-