AIDA API
Version 3.3

hep.aida
Interface IFunction

All Known Subinterfaces:
IModelFunction

public interface IFunction

An IFunction is a lowest level function. An IFunction is meant to be plotted or used for fitting. An IFunction does not provide neither the gradient with respect to the parameters, nor the normalization. This means that when used for fitting such quantities will have to be evaluated numerically, reducing the performance of the fit. For higher performance fitting an IModelFunction should be used. All the IFunctions provided by a given implementations should also be IModelFunctions. If a user is to define and implement a function the choice between an IFunction and an IModelFunction should be dictated by its use and desired performance during fitting. An IFunction is a self contained object, which remembers the current value of its parameters which are simple doubles. The standard convention of referring to variables by name: "x[0]" corresponds to variable number 0 etc.

Author:
The AIDA team (http://aida.freehep.org/)

Method Summary
 IAnnotation annotation()
           
 String codeletString()
          String describing the metatype and implementation of the function.
 int dimension()
          Dimensionality of the domain space.
 double[] gradient(double[] x)
          Gradient of the function.
 int indexOfParameter(String name)
          Return -1 if parameter not found (name undefined).
 boolean isEqual(IFunction f)
          Compare if functions are the same.
 String normalizationParameter()
          Returns the name of the normalization parameter if the function has one.
 int numberOfParameters()
          Number of parameters.
 double parameter(String name)
           
 String[] parameterNames()
          Names of paramaters.
 double[] parameters()
          Retrieve current vector of parameters.
 boolean providesGradient()
          Determine whether function is able to compute gradient.
 void setParameter(String name, double x)
          Set parameter's value by name.
 void setParameters(double[] params)
          Set new vector of parameters.
 void setTitle(String title)
          Set the histogram title.
 String title()
          Get the Function's title.
 double value(double[] x)
          Scalar value of the function.
 String variableName(int i)
          Get the symbolic name of i-th variable.
 String[] variableNames()
          Get all the names in a vector.
 

Method Detail

title

public String title()
Get the Function's title.

Returns:
The Function's title.

setTitle

public void setTitle(String title)
              throws IllegalArgumentException
Set the histogram title.

Parameters:
title - The title.
Throws:
IllegalArgumentEception - If title cannot be changed.
IllegalArgumentException

value

public double value(double[] x)
Scalar value of the function.


dimension

public int dimension()
Dimensionality of the domain space.


isEqual

public boolean isEqual(IFunction f)
Compare if functions are the same. PENDING: define exactly what it means ;)


gradient

public double[] gradient(double[] x)
Gradient of the function. The result is valid only if providesGradient()==true. Otherwise the result is some default (empty) vector.


providesGradient

public boolean providesGradient()
Determine whether function is able to compute gradient.


variableName

public String variableName(int i)
Get the symbolic name of i-th variable.


variableNames

public String[] variableNames()
Get all the names in a vector.


setParameters

public void setParameters(double[] params)
                   throws IllegalArgumentException
Set new vector of parameters.

Throws:
IllegalArgumentException

parameters

public double[] parameters()
Retrieve current vector of parameters.


numberOfParameters

public int numberOfParameters()
Number of parameters.


parameterNames

public String[] parameterNames()
Names 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.


setParameter

public void setParameter(String name,
                         double x)
                  throws IllegalArgumentException
Set parameter's value by name.

Parameters:
name - The name of the parameter.
x - The new value of the parameter.
Throws:
IllegalArgumentException - If name does not correspond to a parameter.

parameter

public double parameter(String name)

indexOfParameter

public int indexOfParameter(String name)
Return -1 if parameter not found (name undefined). Leave it because there are use cases - some users prefer to use numbers.


annotation

public IAnnotation annotation()

codeletString

public String codeletString()
String 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); }


normalizationParameter

public String normalizationParameter()
Returns the name of the normalization parameter if the function has one.

Returns:
The name of the normalization parameter.null if no such parameter is available

AIDA API
Version 3.3

Copyright © 2000-2004 AIDA Team, All Rights Reserved.