hep.aida.ref.function
Class AbstractIFunction
- java.lang.Object
-
- hep.aida.ref.event.AIDAObservable
-
- hep.aida.ref.ManagedObject
-
- hep.aida.ref.function.AbstractIFunction
-
- All Implemented Interfaces:
- IDevManagedObject, IFunction, IManagedObject, IModelFunction, Connectable, FunctionDispatcher, java.lang.Cloneable
- Direct Known Subclasses:
- BreitWigner, Exponent, FNon, Gauss, Landau, NegativeBinomial, NonParametricFunction, P0, P1, P2, P3, P4, P5, P6, Poisson, Pow, PowModified, UserFunction
public abstract class AbstractIFunction extends ManagedObject implements IModelFunction, java.lang.Cloneable, FunctionDispatcher
AbstractIFunction is implementation of the IFunction. User has to implement "value" method.
-
-
Constructor Summary
Constructors Constructor and Description AbstractIFunction()No-argument constructor to be used for cloning.AbstractIFunction(java.lang.String[] variableNames, java.lang.String[] parameterNames)Creates a new instance of AbstractIFunction with specified variable and parameter names.AbstractIFunction(java.lang.String title, int dimension, int numberOfParameters)Creates a new instance of AbstractIFunction with default variable names (x0, x1, ...) and default parameter names (p0, p1, ...)AbstractIFunction(java.lang.String title, java.lang.String[] variableNames, java.lang.String[] parameterNames)
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method and Description voidaddFunctionListener(FunctionListener listener)IAnnotationannotation()java.lang.Objectclone()java.lang.StringcodeletString()String describing the metatype and implementation of the function.intdimension()Dimensionality of the domain space.voidexcludeNormalizationAll()Set empty range in all axes.double[]gradient(double[] values)Gradient of the function.voidincludeNormalizationAll()Set full range in all axes.intindexOfParameter(java.lang.String str)Return -1 if parameter not found (name undefined).booleanisEqual(IFunction iFunction)Compare if functions are the same.booleanisNormalized()Return true if normalization is currently switched on.java.lang.StringnormalizationParameter()Returns the name of the normalization parameter if the function has one.IRangeSetnormalizationRange(int iAxis)Set the normalization range from -inf to +inf in the i-th axis (dimension).voidnormalize(boolean param)Normalize by internally adjusting some of the parameters.intnumberOfParameters()Number of parameters.doubleparameter(java.lang.String str)double[]parameterGradient(double[] values)Compute gradient with respect to parameters.java.lang.String[]parameterNames()Names of paramaters.double[]parameters()Retrieve current vector of parameters.booleanprovidesGradient()Determine whether function is able to compute gradient.booleanprovidesNormalization()booleanprovidesParameterGradient()Return true if provides parameter gradient.voidremoveFunctionListener(FunctionListener listener)voidsetCodeletString(java.lang.String str)voidsetParameter(java.lang.String str, double param)Set parameter's value by name.voidsetParameters(double[] pars)Set new vector of parameters.voidsetTitle(java.lang.String title)Set the histogram title.java.lang.Stringtitle()Get the Function's title.abstract doublevalue(double[] v)Provide value for your function here.java.lang.StringvariableName(int index)Get the symbolic name of i-th variable.java.lang.String[]variableNames()Get all the names in a vector.-
Methods inherited from class hep.aida.ref.ManagedObject
isFillable, name, setFillable, setName, type, typeForClass
-
Methods inherited from class hep.aida.ref.event.AIDAObservable
addListener, isConnected, removeAllListeners, removeListener, setConnected, setValid, setValidForAll
-
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface hep.aida.ref.event.Connectable
isConnected, setConnected
-
-
-
-
Constructor Detail
-
AbstractIFunction
public AbstractIFunction()
No-argument constructor to be used for cloning. Created function can not be used directly
-
AbstractIFunction
public AbstractIFunction(java.lang.String title, int dimension, int numberOfParameters)Creates a new instance of AbstractIFunction with default variable names (x0, x1, ...) and default parameter names (p0, p1, ...)
-
AbstractIFunction
public AbstractIFunction(java.lang.String[] variableNames, java.lang.String[] parameterNames)Creates a new instance of AbstractIFunction with specified variable and parameter names. This constructor must be implemented by all subclasses in order for codelet-based creation to work properly
-
AbstractIFunction
public AbstractIFunction(java.lang.String title, java.lang.String[] variableNames, java.lang.String[] parameterNames)
-
-
Method Detail
-
clone
public java.lang.Object clone()
- Overrides:
clonein classjava.lang.Object
-
setCodeletString
public void setCodeletString(java.lang.String str)
-
value
public abstract double value(double[] v)
Provide value for your function here. Something like: return p[0]+p[1]*v[0]+p[2]*v[0]*v[0];
-
providesGradient
public boolean providesGradient()
Description copied from interface:IFunctionDetermine whether function is able to compute gradient.- Specified by:
providesGradientin interfaceIFunction
-
gradient
public double[] gradient(double[] values)
Description copied from interface:IFunctionGradient of the function. The result is valid only if providesGradient()==true. Otherwise the result is some default (empty) vector.
-
codeletString
public java.lang.String codeletString()
Description copied from interface:IFunctionString describing the metatype and implementation of the function. Generic format of the string: codelet:TYPE:LOCATION TYPE part contains only a 'typename' string which is a metatype identifier (used in plugins and catalogues) LOCATION may be: 'file', 'verbatim', or 'catalogue' Detailed description: codelet:typename - no location specified (using 'catalogue') codelet:typename:file:/filename.cpp - a c++ source file codelet:typename:file:/filename.py - a python source file codelet:typename:file:/filename.so - a shared library codelet:typename:catalogue - entry in a catalogue repository codelet:typename:verbatim:cpp \n - c++ source file included verbatim after \n codelet:typename:verbatim:py \n - python source file included verbatim aftern \n Comments: file:/filename is a relative path to $AIDA_FUNCTION_DEFAULT_DIR file://filename is an absolute path Examples: codelet:G:catalogue codelet:userSinus:verbatim:cpp \n { return sin(x); }- Specified by:
codeletStringin interfaceIFunction
-
annotation
public IAnnotation annotation()
- Specified by:
annotationin interfaceIFunction
-
dimension
public int dimension()
Description copied from interface:IFunctionDimensionality of the domain space.
-
indexOfParameter
public int indexOfParameter(java.lang.String str)
Description copied from interface:IFunctionReturn -1 if parameter not found (name undefined). Leave it because there are use cases - some users prefer to use numbers.- Specified by:
indexOfParameterin interfaceIFunction
-
numberOfParameters
public int numberOfParameters()
Description copied from interface:IFunctionNumber of parameters.- Specified by:
numberOfParametersin interfaceIFunction
-
parameter
public double parameter(java.lang.String str)
-
parameterNames
public java.lang.String[] parameterNames()
Description copied from interface:IFunctionNames of paramaters. Names should be unique. Case-insensitive for comparison. Case-sensitive for storage and output. All or several names may be left blank "" if the implementation does not want to provide them.- Specified by:
parameterNamesin interfaceIFunction
-
parameters
public double[] parameters()
Description copied from interface:IFunctionRetrieve current vector of parameters.- Specified by:
parametersin interfaceIFunction
-
setParameter
public void setParameter(java.lang.String str, double param) throws java.lang.IllegalArgumentExceptionDescription copied from interface:IFunctionSet parameter's value by name.- Specified by:
setParameterin interfaceIFunction- Parameters:
str- The name of the parameter.param- The new value of the parameter.- Throws:
java.lang.IllegalArgumentException- If name does not correspond to a parameter.
-
setParameters
public void setParameters(double[] pars) throws java.lang.IllegalArgumentExceptionDescription copied from interface:IFunctionSet new vector of parameters.- Specified by:
setParametersin interfaceIFunction- Throws:
java.lang.IllegalArgumentException
-
setTitle
public void setTitle(java.lang.String title) throws java.lang.IllegalArgumentExceptionDescription copied from interface:IFunctionSet the histogram title.
-
title
public java.lang.String title()
Description copied from interface:IFunctionGet the Function's title.
-
variableName
public java.lang.String variableName(int index)
Description copied from interface:IFunctionGet the symbolic name of i-th variable.- Specified by:
variableNamein interfaceIFunction
-
variableNames
public java.lang.String[] variableNames()
Description copied from interface:IFunctionGet all the names in a vector.- Specified by:
variableNamesin interfaceIFunction
-
excludeNormalizationAll
public void excludeNormalizationAll()
Description copied from interface:IModelFunctionSet empty range in all axes.- Specified by:
excludeNormalizationAllin interfaceIModelFunction
-
includeNormalizationAll
public void includeNormalizationAll()
Description copied from interface:IModelFunctionSet full range in all axes.- Specified by:
includeNormalizationAllin interfaceIModelFunction
-
isNormalized
public boolean isNormalized()
Description copied from interface:IModelFunctionReturn true if normalization is currently switched on.- Specified by:
isNormalizedin interfaceIModelFunction
-
normalizationRange
public IRangeSet normalizationRange(int iAxis)
Description copied from interface:IModelFunctionSet the normalization range from -inf to +inf in the i-th axis (dimension). Full range is the default if not set otherwise. It is still possible to evaluate function outside of the normalization range. PENDING: no methods to retrieve current range!- Specified by:
normalizationRangein interfaceIModelFunction
-
normalize
public void normalize(boolean param)
Description copied from interface:IModelFunctionNormalize by internally adjusting some of the parameters. When normalization is on then integral of the function in the normalization range equals to 1.- Specified by:
normalizein interfaceIModelFunction
-
parameterGradient
public double[] parameterGradient(double[] values)
Description copied from interface:IModelFunctionCompute gradient with respect to parameters.- Specified by:
parameterGradientin interfaceIModelFunction
-
providesNormalization
public boolean providesNormalization()
- Specified by:
providesNormalizationin interfaceIModelFunction
-
providesParameterGradient
public boolean providesParameterGradient()
Description copied from interface:IModelFunctionReturn true if provides parameter gradient.- Specified by:
providesParameterGradientin interfaceIModelFunction
-
normalizationParameter
public java.lang.String normalizationParameter()
Description copied from interface:IFunctionReturns the name of the normalization parameter if the function has one.- Specified by:
normalizationParameterin interfaceIFunction- Returns:
- The name of the normalization parameter.null if no such parameter is available
-
isEqual
public boolean isEqual(IFunction iFunction)
Description copied from interface:IFunctionCompare if functions are the same. PENDING: define exactly what it means ;)
-
addFunctionListener
public void addFunctionListener(FunctionListener listener)
- Specified by:
addFunctionListenerin interfaceFunctionDispatcher
-
removeFunctionListener
public void removeFunctionListener(FunctionListener listener)
- Specified by:
removeFunctionListenerin interfaceFunctionDispatcher
-
-
DMelt 3.0 © DataMelt by jWork.ORG