hep.aida.ref.function
Class BaseModelFunction
- java.lang.Object
-
- hep.aida.ref.event.AIDAObservable
-
- hep.aida.ref.ManagedObject
-
- hep.aida.ref.function.BaseModelFunction
-
- All Implemented Interfaces:
- IDevManagedObject, IFunction, IManagedObject, IModelFunction, Connectable, FunctionDispatcher
- Direct Known Subclasses:
- JELBaseModelFunction
public class BaseModelFunction extends ManagedObject implements IModelFunction, FunctionDispatcher
-
-
Constructor Summary
Constructors Constructor and Description BaseModelFunction(java.lang.String name, java.lang.String title, FunctionCore notNorm, FunctionCore norm)BaseModelFunction(java.lang.String name, java.lang.String tit, IFunction func)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method and Description voidaddFunctionListener(FunctionListener listener)IAnnotationannotation()voidcalculateNormalizationAmplitude()java.lang.StringcodeletString()String describing the metatype and implementation of the function.FunctionCorecore()intdimension()Dimensionality of the domain space.voidexcludeNormalizationAll()Set empty range in all axes.doublefunctionValue(double[] var)doublegetNormalizationAmplitude()RangeSet[]getRangeSet()double[]gradient(double[] x)Gradient of the function.voidincludeNormalizationAll()Set full range in all axes.intindexOfParameter(java.lang.String name)Return -1 if parameter not found (name undefined).booleanisEqual(IFunction f)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 on)Normalize by internally adjusting some of the parameters.intnumberOfParameters()Number of parameters.double[]numericGradient(double[] x)double[]numericParameterGradient(double[] x)doubleparameter(java.lang.String name)double[]parameterGradient(double[] x)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 codelet)voidsetParameter(java.lang.String name, double x)Set parameter's value by name.booleansetParameterNames(java.lang.String[] params)voidsetParameters(double[] params)Set new vector of parameters.voidsetTitle(java.lang.String t)Set the histogram title.java.lang.Stringtitle()Get the Function's title.java.lang.StringtoString()doublevalue(double[] var)Scalar value of the function.java.lang.StringvariableName(int i)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, wait, wait, wait
-
Methods inherited from interface hep.aida.ref.event.Connectable
isConnected, setConnected
-
-
-
-
Constructor Detail
-
BaseModelFunction
public BaseModelFunction(java.lang.String name, java.lang.String tit, IFunction func)
-
BaseModelFunction
public BaseModelFunction(java.lang.String name, java.lang.String title, FunctionCore notNorm, FunctionCore norm)
-
-
Method Detail
-
core
public FunctionCore core()
-
dimension
public int dimension()
Description copied from interface:IFunctionDimensionality of the domain space.
-
numberOfParameters
public int numberOfParameters()
Description copied from interface:IFunctionNumber of parameters.- Specified by:
numberOfParametersin interfaceIFunction
-
functionValue
public double functionValue(double[] var)
-
value
public final double value(double[] var)
Description copied from interface:IFunctionScalar value of the function.
-
annotation
public IAnnotation annotation()
- Specified by:
annotationin interfaceIFunction
-
variableName
public java.lang.String variableName(int i)
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
-
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
-
indexOfParameter
public int indexOfParameter(java.lang.String name)
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
-
setParameters
public void setParameters(double[] params)
Description copied from interface:IFunctionSet new vector of parameters.- Specified by:
setParametersin interfaceIFunction
-
setParameter
public void setParameter(java.lang.String name, double x) throws java.lang.IllegalArgumentExceptionDescription copied from interface:IFunctionSet parameter's value by name.- Specified by:
setParameterin interfaceIFunction- Parameters:
name- The name of the parameter.x- The new value of the parameter.- Throws:
java.lang.IllegalArgumentException- If name does not correspond to a parameter.
-
parameters
public double[] parameters()
Description copied from interface:IFunctionRetrieve current vector of parameters.- Specified by:
parametersin interfaceIFunction
-
parameter
public double parameter(java.lang.String name)
-
isEqual
public boolean isEqual(IFunction f)
Description copied from interface:IFunctionCompare if functions are the same. PENDING: define exactly what it means ;)
-
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[] x)
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
-
setCodeletString
public void setCodeletString(java.lang.String codelet)
-
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
-
providesNormalization
public boolean providesNormalization()
- Specified by:
providesNormalizationin interfaceIModelFunction
-
normalize
public void normalize(boolean on)
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
-
isNormalized
public boolean isNormalized()
Description copied from interface:IModelFunctionReturn true if normalization is currently switched on.- Specified by:
isNormalizedin interfaceIModelFunction
-
parameterGradient
public double[] parameterGradient(double[] x)
Description copied from interface:IModelFunctionCompute gradient with respect to parameters.- Specified by:
parameterGradientin interfaceIModelFunction
-
providesParameterGradient
public boolean providesParameterGradient()
Description copied from interface:IModelFunctionReturn true if provides parameter gradient.- Specified by:
providesParameterGradientin 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
-
includeNormalizationAll
public void includeNormalizationAll()
Description copied from interface:IModelFunctionSet full range in all axes.- Specified by:
includeNormalizationAllin interfaceIModelFunction
-
excludeNormalizationAll
public void excludeNormalizationAll()
Description copied from interface:IModelFunctionSet empty range in all axes.- Specified by:
excludeNormalizationAllin interfaceIModelFunction
-
getNormalizationAmplitude
public double getNormalizationAmplitude()
-
calculateNormalizationAmplitude
public void calculateNormalizationAmplitude()
-
title
public java.lang.String title()
Description copied from interface:IFunctionGet the Function's title.
-
setTitle
public void setTitle(java.lang.String t)
Description copied from interface:IFunctionSet the histogram title.
-
setParameterNames
public boolean setParameterNames(java.lang.String[] params)
-
numericGradient
public double[] numericGradient(double[] x)
-
numericParameterGradient
public double[] numericParameterGradient(double[] x)
-
getRangeSet
public RangeSet[] getRangeSet()
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
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