FreeHEP API
Version current

hep.aida.ref.function
Class AbstractIFunction

java.lang.Object
  extended byhep.aida.ref.function.AbstractIFunction
All Implemented Interfaces:
FunctionDispatcher, hep.aida.IFunction, hep.aida.IModelFunction
Direct Known Subclasses:
NonParametricFunction

public abstract class AbstractIFunction
extends Object
implements hep.aida.IModelFunction, FunctionDispatcher

AbstractIFunction is implementation of the IFunction. User has to implement "value" method.

Author:
serbo
Source Code:
AbstractIFunction.java

Field Summary
protected  String codeletString
           
protected  double[] gradient
           
protected  double[] p
           
protected  String[] parameterNames
           
protected  String[] variableNames
           
 
Constructor Summary
AbstractIFunction(String title, int dimension, int numberOfParameters)
          Creates a new instance of AbstractIFunction with default variable names (x0, x1, ...)
AbstractIFunction(String title, String[] variableNames, String[] parameterNames)
          Creates a new instance of AbstractIFunction with specified variable and parameter names
 
Method Summary
 void addFunctionListener(FunctionListener listener)
           
 hep.aida.IAnnotation annotation()
           
 String codeletString()
           
 int dimension()
           
 void excludeNormalizationAll()
           
 double[] gradient(double[] values)
           
 void includeNormalizationAll()
           
 int indexOfParameter(String str)
           
protected  void init(String title)
           
 boolean isEqual(hep.aida.IFunction iFunction)
           
 boolean isNormalized()
           
static void main(String[] args)
           
 String normalizationParameter()
           
 hep.aida.IRangeSet normalizationRange(int iAxis)
           
 void normalize(boolean param)
           
 int numberOfParameters()
           
 double parameter(String str)
           
 double[] parameterGradient(double[] values)
           
 String[] parameterNames()
           
 double[] parameters()
           
 boolean providesGradient()
           
 boolean providesNormalization()
           
 boolean providesParameterGradient()
           
 void removeFunctionListener(FunctionListener listener)
           
 void setCodeletString(String str)
           
 void setParameter(String str, double param)
           
 void setParameters(double[] pars)
           
 void setTitle(String title)
           
 String title()
           
abstract  double value(double[] v)
          Provide value for your function here.
 String variableName(int index)
           
 String[] variableNames()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

variableNames

protected String[] variableNames

parameterNames

protected String[] parameterNames

codeletString

protected String codeletString

p

protected double[] p

gradient

protected double[] gradient
Constructor Detail

AbstractIFunction

public AbstractIFunction(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(String title,
                         String[] variableNames,
                         String[] parameterNames)
Creates a new instance of AbstractIFunction with specified variable and parameter names

Method Detail

init

protected void init(String title)

setCodeletString

public void setCodeletString(String str)

value

public abstract double value(double[] v)
Provide value for your function here. Something like: return p[0]*v[0]*v[0]+p[1]*v[0]+p[3];

Specified by:
value in interface hep.aida.IFunction

providesGradient

public boolean providesGradient()
Specified by:
providesGradient in interface hep.aida.IFunction

gradient

public double[] gradient(double[] values)
Specified by:
gradient in interface hep.aida.IFunction

codeletString

public String codeletString()
Specified by:
codeletString in interface hep.aida.IFunction

annotation

public hep.aida.IAnnotation annotation()
Specified by:
annotation in interface hep.aida.IFunction

dimension

public int dimension()
Specified by:
dimension in interface hep.aida.IFunction

indexOfParameter

public int indexOfParameter(String str)
Specified by:
indexOfParameter in interface hep.aida.IFunction

numberOfParameters

public int numberOfParameters()
Specified by:
numberOfParameters in interface hep.aida.IFunction

parameter

public double parameter(String str)
Specified by:
parameter in interface hep.aida.IFunction

parameterNames

public String[] parameterNames()
Specified by:
parameterNames in interface hep.aida.IFunction

parameters

public double[] parameters()
Specified by:
parameters in interface hep.aida.IFunction

setParameter

public void setParameter(String str,
                         double param)
                  throws IllegalArgumentException
Specified by:
setParameter in interface hep.aida.IFunction
Throws:
IllegalArgumentException

setParameters

public void setParameters(double[] pars)
                   throws IllegalArgumentException
Specified by:
setParameters in interface hep.aida.IFunction
Throws:
IllegalArgumentException

setTitle

public void setTitle(String title)
              throws IllegalArgumentException
Specified by:
setTitle in interface hep.aida.IFunction
Throws:
IllegalArgumentException

title

public String title()
Specified by:
title in interface hep.aida.IFunction

variableName

public String variableName(int index)
Specified by:
variableName in interface hep.aida.IFunction

variableNames

public String[] variableNames()
Specified by:
variableNames in interface hep.aida.IFunction

excludeNormalizationAll

public void excludeNormalizationAll()
Specified by:
excludeNormalizationAll in interface hep.aida.IModelFunction

includeNormalizationAll

public void includeNormalizationAll()
Specified by:
includeNormalizationAll in interface hep.aida.IModelFunction

isNormalized

public boolean isNormalized()
Specified by:
isNormalized in interface hep.aida.IModelFunction

normalizationRange

public hep.aida.IRangeSet normalizationRange(int iAxis)
Specified by:
normalizationRange in interface hep.aida.IModelFunction

normalize

public void normalize(boolean param)
Specified by:
normalize in interface hep.aida.IModelFunction

parameterGradient

public double[] parameterGradient(double[] values)
Specified by:
parameterGradient in interface hep.aida.IModelFunction

providesNormalization

public boolean providesNormalization()
Specified by:
providesNormalization in interface hep.aida.IModelFunction

providesParameterGradient

public boolean providesParameterGradient()
Specified by:
providesParameterGradient in interface hep.aida.IModelFunction

normalizationParameter

public String normalizationParameter()
Specified by:
normalizationParameter in interface hep.aida.IFunction

isEqual

public boolean isEqual(hep.aida.IFunction iFunction)
Specified by:
isEqual in interface hep.aida.IFunction

main

public static void main(String[] args)

addFunctionListener

public void addFunctionListener(FunctionListener listener)
Specified by:
addFunctionListener in interface FunctionDispatcher

removeFunctionListener

public void removeFunctionListener(FunctionListener listener)
Specified by:
removeFunctionListener in interface FunctionDispatcher

FreeHEP API
Version current

Copyright © 2000-2004 FreeHEP, All Rights Reserved.