hep.aida.ref.function
Class AbstractDevModelFunction
- java.lang.Object
-
- hep.aida.ref.function.AbstractDevModelFunction
-
- All Implemented Interfaces:
- IDevFunction, IDevModelFunction, IFunction, IModelFunction
- Direct Known Subclasses:
- ExponentModelFunction, PolynomialModelFunction
public abstract class AbstractDevModelFunction extends java.lang.Object implements IDevModelFunction
-
-
Constructor Summary
Constructors Constructor and Description AbstractDevModelFunction()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method and Description IAnnotationannotation()java.lang.StringcodeletString()String describing the metatype and implementation of the function.abstract intdimension()Dimensionality of the domain space.voidexcludeNormalizationAll()Set empty range in all axes.voidexcludeNormalizationAll(int iAxis)voidexcludeNormalizationRange(double xMin, double xMax, int iAxis)abstract doublefunctionValue(double[] var)double[]gradient(double[] x)Gradient of the function.voidincludeNormalizationAll()Set full range in all axes.voidincludeNormalizationAll(int iAxis)voidincludeNormalizationRange(double xMin, double xMax, int iAxis)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.doublenormalizationAmplitude()doublenormalizationAmplitude(java.util.ArrayList[] xMin, java.util.ArrayList[] xMax)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.abstract intnumberOfParameters()Number of parameters.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.voidsetAnnotation(IAnnotation ptr)voidsetCodeletString(java.lang.String codelet)voidsetDimension(int dim)booleansetNormalization(boolean provides, boolean is_normalized)voidsetNormalizationRange(double rMin, double rMax, int iAxis)voidsetNumberOfParameters(int parnum)voidsetParameter(java.lang.String name, double x)Set parameter's value by name.booleansetParameterNames(java.lang.String[] names)voidsetParameters(double[] params)Set new vector of parameters.voidsetProvidesGradient(boolean yes)voidsetProvidesParameterGradient(boolean yes)voidsetTitle(java.lang.String t)Set the histogram title.booleansetVariableNames(java.lang.String[] names)java.lang.Stringtitle()Get the Function's title.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.
-
-
-
Method Detail
-
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
-
dimension
public abstract int dimension()
Description copied from interface:IFunctionDimensionality of the domain space.
-
numberOfParameters
public abstract int numberOfParameters()
Description copied from interface:IFunctionNumber of parameters.- Specified by:
numberOfParametersin interfaceIFunction
-
functionValue
public abstract 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)
- Specified by:
setCodeletStringin interfaceIDevFunction
-
setDimension
public void setDimension(int dim)
- Specified by:
setDimensionin interfaceIDevFunction
-
setProvidesGradient
public void setProvidesGradient(boolean yes)
- Specified by:
setProvidesGradientin interfaceIDevFunction
-
setVariableNames
public boolean setVariableNames(java.lang.String[] names)
- Specified by:
setVariableNamesin interfaceIDevFunction
-
setNumberOfParameters
public void setNumberOfParameters(int parnum)
- Specified by:
setNumberOfParametersin interfaceIDevFunction
-
setParameterNames
public boolean setParameterNames(java.lang.String[] names)
- Specified by:
setParameterNamesin interfaceIDevFunction
-
setAnnotation
public void setAnnotation(IAnnotation ptr)
- Specified by:
setAnnotationin interfaceIDevFunction
-
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
-
setNormalizationRange
public void setNormalizationRange(double rMin, double rMax, int iAxis)
-
includeNormalizationRange
public void includeNormalizationRange(double xMin, double xMax, int iAxis)
-
excludeNormalizationRange
public void excludeNormalizationRange(double xMin, double xMax, int iAxis)
-
includeNormalizationAll
public void includeNormalizationAll(int iAxis)
-
excludeNormalizationAll
public void excludeNormalizationAll(int iAxis)
-
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
-
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
-
setNormalization
public boolean setNormalization(boolean provides, boolean is_normalized)- Specified by:
setNormalizationin interfaceIDevModelFunction
-
setProvidesParameterGradient
public void setProvidesParameterGradient(boolean yes)
- Specified by:
setProvidesParameterGradientin interfaceIDevModelFunction
-
normalizationAmplitude
public final double normalizationAmplitude()
-
normalizationAmplitude
public double normalizationAmplitude(java.util.ArrayList[] xMin, java.util.ArrayList[] xMax)
-
title
public java.lang.String title()
Description copied from interface:IFunctionGet the Function's title.
-
-
DMelt 3.0 © DataMelt by jWork.ORG