Top Description Inners Fields Constructors Methods
org.apache.commons.math3.analysis.function

public Class Gaussian

extends Object
implements UnivariateDifferentiableFunction, DifferentiableUnivariateFunction
Class Inheritance
All Implemented Interfaces
org.apache.commons.math3.analysis.DifferentiableUnivariateFunction, org.apache.commons.math3.analysis.UnivariateFunction, org.apache.commons.math3.analysis.differentiation.UnivariateDifferentiableFunction
Imports
java.util.Arrays, org.apache.commons.math3.analysis.FunctionUtils, .UnivariateFunction, .DifferentiableUnivariateFunction, .ParametricUnivariateFunction, org.apache.commons.math3.analysis.differentiation.DerivativeStructure, .UnivariateDifferentiableFunction, org.apache.commons.math3.exception.NotStrictlyPositiveException, .NullArgumentException, .DimensionMismatchException, org.apache.commons.math3.util.FastMath, .Precision

Deprecated

as a consequence of DifferentiableUnivariateFunction being deprecated. See corresponding docs for further information.

Gaussian function.
Since
3.0

Nested and Inner Type Summary

Modifier and TypeClass and Description
public static class
Gaussian.Parametric

Parametric function where the input array contains the parameters of the Gaussian, ordered as follows:

  • Norm
  • Mean
  • Standard deviation

Field Summary

Modifier and TypeField and Description
private final double
i2s2

Inverse of twice the square of the standard deviation.

private final double
is

Inverse of the standard deviation.

private final double
mean

Mean.

private final double
norm

Normalization factor.

Constructor Summary

AccessConstructor and Description
public
Gaussian(double
Normalization factor.
norm
,
double
Mean.
mean
,
double
Standard deviation.
sigma
)

Gaussian with given normalization factor, mean and standard deviation.

public
Gaussian(double
Mean.
mean
,
double
Standard deviation.
sigma
)

Normalized gaussian with given mean and standard deviation.

public
Gaussian()

Normalized gaussian with zero mean and unit standard deviation.

Method Summary

Modifier and TypeMethod and Description
public UnivariateFunction
derivative()

Implements org.apache.commons.math3.analysis.DifferentiableUnivariateFunction.derivative.

Deprecated as of 3.1, replaced by value(DerivativeStructure)

Returns the derivative of the function

public double
value(double
Point at which the function value should be computed.
x
)

Implements org.apache.commons.math3.analysis.UnivariateFunction.value.

Compute the value of the function.

private static double

Returns:

the value of the Gaussian at x.
value
(double
x - mean.
xMinusMean
,
double
Normalization factor.
norm
,
double
Inverse of twice the square of the standard deviation.
i2s2
)

public DerivativeStructure
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

i2s2back to summary
private final double i2s2

Inverse of twice the square of the standard deviation.

isback to summary
private final double is

Inverse of the standard deviation.

meanback to summary
private final double mean

Mean.

normback to summary
private final double norm

Normalization factor.

Constructor Detail

Gaussianback to summary
public Gaussian(double norm, double mean, double sigma) throws NotStrictlyPositiveException

Gaussian with given normalization factor, mean and standard deviation.

Parameters
norm:double

Normalization factor.

mean:double

Mean.

sigma:double

Standard deviation.

Exceptions
NotStrictlyPositiveException:
if sigma <= 0.
Gaussianback to summary
public Gaussian(double mean, double sigma) throws NotStrictlyPositiveException

Normalized gaussian with given mean and standard deviation.

Parameters
mean:double

Mean.

sigma:double

Standard deviation.

Exceptions
NotStrictlyPositiveException:
if sigma <= 0.
Gaussianback to summary
public Gaussian()

Normalized gaussian with zero mean and unit standard deviation.

Method Detail

derivativeback to summary
public UnivariateFunction derivative()

Implements org.apache.commons.math3.analysis.DifferentiableUnivariateFunction.derivative.

Doc from org.apache.commons.math3.analysis.DifferentiableUnivariateFunction.derivative.

Deprecated

as of 3.1, replaced by value(DerivativeStructure)

Returns the derivative of the function

Returns:UnivariateFunction

the derivative function

Annotations
@Deprecated
valueback to summary
public double value(double x)

Implements org.apache.commons.math3.analysis.UnivariateFunction.value.

Doc from org.apache.commons.math3.analysis.UnivariateFunction.value.

Compute the value of the function.

Parameters
x:double

Point at which the function value should be computed.

Returns:double

the value of the function.

valueback to summary
private static double value(double xMinusMean, double norm, double i2s2)
Parameters
xMinusMean:double

x - mean.

norm:double

Normalization factor.

i2s2:double

Inverse of twice the square of the standard deviation.

Returns:double

the value of the Gaussian at x.

valueback to summary
public DerivativeStructure value(final DerivativeStructure t) throws DimensionMismatchException

Implements org.apache.commons.math3.analysis.differentiation.UnivariateDifferentiableFunction.value.

Doc from org.apache.commons.math3.analysis.differentiation.UnivariateDifferentiableFunction.value.

Simple mathematical function.

UnivariateDifferentiableFunction classes compute both the value and the first derivative of the function.

Parameters
t:DerivativeStructure

function input value

Returns:DerivativeStructure

function result

Exceptions
DimensionMismatchException:
if t is inconsistent with the function's free parameters or order
Since
3.1
org.apache.commons.math3.analysis.function back to summary

public Class Gaussian.Parametric

extends Object
implements ParametricUnivariateFunction
Class Inheritance
  • java.lang.Object
  • org.apache.commons.math3.analysis.function.Gaussian.Parametric
All Implemented Interfaces
org.apache.commons.math3.analysis.ParametricUnivariateFunction

Parametric function where the input array contains the parameters of the Gaussian, ordered as follows:

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public double[]

Returns:

the gradient vector at x.
gradient
(double
Value at which the gradient must be computed.
x
,
double...
Values of norm, mean and standard deviation.
param
)

Implements org.apache.commons.math3.analysis.ParametricUnivariateFunction.gradient.

Computes the value of the gradient at x.

private void
validateParameters(double[]
Values of norm, mean and standard deviation.
param
)

Validates parameters to ensure they are appropriate for the evaluation of the value(double, double[]) and gradient(double, double[]) methods.

public double

Returns:

the value of the function.
value
(double
Value for which the function must be computed.
x
,
double...
Values of norm, mean and standard deviation.
param
)

Implements org.apache.commons.math3.analysis.ParametricUnivariateFunction.value.

Computes the value of the Gaussian at x.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Constructor Detail

Parametricback to summary
public Parametric()

Method Detail

gradientback to summary
public double[] gradient(double x, double... param) throws NullArgumentException, DimensionMismatchException, NotStrictlyPositiveException

Implements org.apache.commons.math3.analysis.ParametricUnivariateFunction.gradient.

Computes the value of the gradient at x. The components of the gradient vector are the partial derivatives of the function with respect to each of the parameters (norm, mean and standard deviation).

Parameters
x:double

Value at which the gradient must be computed.

param:double[]

Values of norm, mean and standard deviation.

Returns:double[]

the gradient vector at x.

Exceptions
NullArgumentException:
if param is null.
DimensionMismatchException:
if the size of param is not 3.
NotStrictlyPositiveException:
if param[2] is negative.
validateParametersback to summary
private void validateParameters(double[] param) throws NullArgumentException, DimensionMismatchException, NotStrictlyPositiveException

Validates parameters to ensure they are appropriate for the evaluation of the value(double, double[]) and gradient(double, double[]) methods.

Parameters
param:double[]

Values of norm, mean and standard deviation.

Exceptions
NullArgumentException:
if param is null.
DimensionMismatchException:
if the size of param is not 3.
NotStrictlyPositiveException:
if param[2] is negative.
valueback to summary
public double value(double x, double... param) throws NullArgumentException, DimensionMismatchException, NotStrictlyPositiveException

Implements org.apache.commons.math3.analysis.ParametricUnivariateFunction.value.

Computes the value of the Gaussian at x.

Parameters
x:double

Value for which the function must be computed.

param:double[]

Values of norm, mean and standard deviation.

Returns:double

the value of the function.

Exceptions
NullArgumentException:
if param is null.
DimensionMismatchException:
if the size of param is not 3.
NotStrictlyPositiveException:
if param[2] is negative.