joptima.functions
Class Gaussian
- java.lang.Object
-
- joptima.functions.ConstrainableFunction
-
- joptima.functions.Gaussian
-
- All Implemented Interfaces:
- Function
public class Gaussian extends ConstrainableFunction
Function norm / (sigma * sqrt(2pi)) * exp(- (x - mean)^2 / (2 * sigma^2)). A concrete implementation of joptima.Function that calculates a Gaussian.
-
-
Field Summary
Fields Modifier and Type Field and Description doublem_meandoublem_normdoublem_sigma
-
Constructor Summary
Constructors Constructor and Description Gaussian()Default constructor: norm = 1, mean = 0, sigma = 1.Gaussian(double norm, double mean, double sigma)Constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method and Description doublecalculate(double x)Calculates the value of the function at the given point using the preset parameters.voidconstrain(java.lang.String parametername)Removes the given parameter from the parameter list.doublegetMean()java.lang.StringgetName()Gets the (user-settable) name of this function.doublegetNorm()Parameter[]getParameters()Lists all the mutable parameters to this function.doublegetSigma()voidsetMean(double mean)voidsetName(java.lang.String newname)Overrides the default function name.voidsetNorm(double norm)voidsetSigma(double sigma)-
Methods inherited from class joptima.functions.ConstrainableFunction
constrain, constrain
-
-
-
-
Constructor Detail
-
Gaussian
public Gaussian()
Default constructor: norm = 1, mean = 0, sigma = 1.
-
Gaussian
public Gaussian(double norm, double mean, double sigma)Constructor.
-
-
Method Detail
-
getParameters
public Parameter[] getParameters()
Description copied from interface:FunctionLists all the mutable parameters to this function.- Returns:
- a
Parameter[] of delegates that access the proper member variables.
-
constrain
public void constrain(java.lang.String parametername)
Description copied from class:ConstrainableFunctionRemoves the given parameter from the parameter list. This constraint is mandatory to implement.- Specified by:
constrainin classConstrainableFunction
-
getName
public java.lang.String getName()
Description copied from interface:FunctionGets the (user-settable) name of this function.- Returns:
- the name of the function
-
setName
public void setName(java.lang.String newname)
Description copied from interface:FunctionOverrides the default function name.- Parameters:
newname- the new name for the function
-
calculate
public double calculate(double x)
Description copied from interface:FunctionCalculates the value of the function at the given point using the preset parameters.- Parameters:
x- the x coordinate to calculate the function at- Returns:
- the value of the function at the given coordinate
-
getNorm
public double getNorm()
-
setNorm
public void setNorm(double norm)
-
getMean
public double getMean()
-
setMean
public void setMean(double mean)
-
getSigma
public double getSigma()
-
setSigma
public void setSigma(double sigma)
-
-
DMelt 3.0 © DataMelt by jWork.ORG