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 Summary
Modifier and TypeFieldDescriptionstatic final int
Distribution type: chi-squaredstatic final double
The constant - log( sqrt(2 pi) )static final int
Distribution type: noramlstatic final double
The constant 1 / sqrt(2 pi)static final int
Distribution type: undefined -
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic double
dchisq
(double x) Returns the density of the Chi-squared distribution.static double
dchisq
(double x, double ncp) Returns the density of the noncentral Chi-squared distribution.static DoubleVector
dchisq
(double x, DoubleVector ncp) Returns the density of the noncentral Chi-squared distribution.static double
dchisqLog
(double x) Returns the log-density of the noncentral Chi-square distribution.static double
dchisqLog
(double x, double ncp) Returns the log-density value of a noncentral Chi-square distribution.static DoubleVector
dchisqLog
(double x, DoubleVector ncp) Returns the log-density of a set of noncentral Chi-squared distributions.static double
dnorm
(double x) Returns the density of the standard normal.static double
dnorm
(double x, double mean, double sd) Returns the density value of a standard normal.static DoubleVector
dnorm
(double x, DoubleVector mean, double sd) Returns the density values of a set of normal distributions with different means.static double
dnormLog
(double x) Returns the log-density of the standard normal.static double
dnormLog
(double x, double mean, double sd) Returns the log-density value of a standard normal.static DoubleVector
dnormLog
(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 double
hypot
(double a, double b) sqrt(a^2 + b^2) without under/overflow.static double
pchisq
(double x) Returns the cumulative probability of the Chi-squared distributionstatic double
pchisq
(double x, double ncp) Returns the cumulative probability of the noncentral Chi-squared distribution.static DoubleVector
pchisq
(double x, DoubleVector ncp) Returns the cumulative probability of a set of noncentral Chi-squared distributions.static double
pnorm
(double x) Returns the cumulative probability of the standard normal.static double
pnorm
(double x, double mean, double sd) Returns the cumulative probability of a normal distribution.static DoubleVector
pnorm
(double x, DoubleVector mean, double sd) Returns the cumulative probability of a set of normal distributions with different means.static DoubleVector
Generates a sample of a Chi-square distribution.static DoubleVector
Generates a sample of a normal distribution.static double
square
(double x) Returns the square of a value
-
Field Details
-
PSI
public static final double PSIThe constant 1 / sqrt(2 pi)- See Also:
-
logPSI
public static final double logPSIThe constant - log( sqrt(2 pi) )- See Also:
-
undefinedDistribution
public static final int undefinedDistributionDistribution type: undefined- See Also:
-
normalDistribution
public static final int normalDistributionDistribution type: noraml- See Also:
-
chisqDistribution
public static final int chisqDistributionDistribution type: chi-squared- See Also:
-
-
Constructor Details
-
Maths
public Maths()
-
-
Method Details
-
hypot
public static double hypot(double a, double b) sqrt(a^2 + b^2) without under/overflow. -
square
public static double square(double x) Returns the square of a value- Parameters:
x
-- Returns:
- the square
-
pnorm
public static double pnorm(double x) Returns the cumulative probability of the standard normal.- Parameters:
x
- the quantile
-
pnorm
public static double pnorm(double x, double mean, double sd) Returns the cumulative probability of a normal distribution.- Parameters:
x
- the quantilemean
- the mean of the normal distributionsd
- the standard deviation of the normal distribution.
-
pnorm
Returns the cumulative probability of a set of normal distributions with different means.- Parameters:
x
- the vector of quantilesmean
- the means of the normal distributionssd
- the standard deviation of the normal distribution.- Returns:
- the cumulative probability
-
dnorm
public static double dnorm(double x) Returns the density of the standard normal.- Parameters:
x
- the quantile- Returns:
- the density
-
dnorm
public static double dnorm(double x, double mean, double sd) Returns the density value of a standard normal.- Parameters:
x
- the quantilemean
- the mean of the normal distributionsd
- the standard deviation of the normal distribution.- Returns:
- the density
-
dnorm
Returns the density values of a set of normal distributions with different means.- Parameters:
x
- the quantilemean
- the means of the normal distributionssd
- the standard deviation of the normal distribution.- Returns:
- the density
-
dnormLog
public static double dnormLog(double x) Returns the log-density of the standard normal.- Parameters:
x
- the quantile- Returns:
- the density
-
dnormLog
public static double dnormLog(double x, double mean, double sd) Returns the log-density value of a standard normal.- Parameters:
x
- the quantilemean
- the mean of the normal distributionsd
- the standard deviation of the normal distribution.- Returns:
- the density
-
dnormLog
Returns the log-density values of a set of normal distributions with different means.- Parameters:
x
- the quantilemean
- the means of the normal distributionssd
- the standard deviation of the normal distribution.- Returns:
- the density
-
rnorm
Generates a sample of a normal distribution.- Parameters:
n
- the size of the samplemean
- the mean of the normal distributionsd
- the standard deviation of the normal distribution.random
- the random stream- Returns:
- the sample
-
pchisq
public static double pchisq(double x) Returns the cumulative probability of the Chi-squared distribution- Parameters:
x
- the quantile
-
pchisq
public static double pchisq(double x, double ncp) Returns the cumulative probability of the noncentral Chi-squared distribution.- Parameters:
x
- the quantilencp
- the noncentral parameter
-
pchisq
Returns the cumulative probability of a set of noncentral Chi-squared distributions.- Parameters:
x
- the quantilencp
- the noncentral parameters
-
dchisq
public static double dchisq(double x) Returns the density of the Chi-squared distribution.- Parameters:
x
- the quantile- Returns:
- the density
-
dchisq
public static double dchisq(double x, double ncp) Returns the density of the noncentral Chi-squared distribution.- Parameters:
x
- the quantilencp
- the noncentral parameter
-
dchisq
Returns the density of the noncentral Chi-squared distribution.- Parameters:
x
- the quantilencp
- the noncentral parameters
-
dchisqLog
public static double dchisqLog(double x) Returns the log-density of the noncentral Chi-square distribution.- Parameters:
x
- the quantile- Returns:
- the density
-
dchisqLog
public static double dchisqLog(double x, double ncp) Returns the log-density value of a noncentral Chi-square distribution.- Parameters:
x
- the quantilencp
- the noncentral parameter- Returns:
- the density
-
dchisqLog
Returns the log-density of a set of noncentral Chi-squared distributions.- Parameters:
x
- the quantilencp
- the noncentral parameters
-
rchisq
Generates a sample of a Chi-square distribution.- Parameters:
n
- the size of the samplencp
- the noncentral parameterrandom
- the random stream- Returns:
- the sample
-
getRevision
Returns the revision string.- Specified by:
getRevision
in interfaceRevisionHandler
- Returns:
- the revision
-