/usr/include/CLHEP/GenericFunctions/AbsFunction.hh is in libclhep-dev 2.1.2.3-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 | // -*- C++ -*-
// $Id: AbsFunction.hh,v 1.3 2007/01/21 20:20:40 boudreau Exp $
//------------------------AbsFunction-----------------------------------//
// //
// AbsFunction, base class for function objects //
// Joe Boudreau, Petar Maksimovic //
// Nov 1999 //
// //
//----------------------------------------------------------------------//
#ifndef AbsFunction_h
#define AbsFunction_h 1
#include "CLHEP/GenericFunctions/Argument.hh"
namespace Genfun {
class AbsParameter;
//-----------------------------------------------------------------------//
// Exact return type of arithmentic operations. To the user, the return //
// type is GENFUNCTION, or const AbsFunction &. //
//-----------------------------------------------------------------------//
class FunctionProduct;
class FunctionSum;
class FunctionDifference;
class FunctionQuotient;
class FunctionNegation;
class FunctionConvolution;
class FunctionDirectProduct;
class FunctionComposition;
class ConstPlusFunction;
class ConstTimesFunction;
class ConstMinusFunction;
class ConstOverFunction;
class FunctionPlusParameter;
class FunctionTimesParameter;
class FunctionNumDeriv;
class Variable;
class FunctionNoop;
class ParameterComposition;
typedef FunctionNoop Derivative;
/**
* @author
* @ingroup genfun
*/
class AbsFunction {
public:
// Default Constructor
AbsFunction();
// Copy Constructor:
AbsFunction(const AbsFunction &right);
// Destructor
virtual ~AbsFunction();
// Function value: N-dimensional functions must override these:
virtual unsigned int dimensionality() const ; // returns 1;
// Function value
virtual double operator() (double argument) const=0;
virtual double operator() (const Argument &argument) const=0;
// Every function must override this:
virtual AbsFunction * clone() const=0;
// Function composition. Do not attempt to override:
virtual FunctionComposition operator () (const AbsFunction &f) const;
// Parameter composition. Do not attempt to override:
virtual ParameterComposition operator() ( const AbsParameter &p) const;
// Derivative, (All functions) (do not override)
Derivative derivative(const Variable &v) const;
// Derivative (1D functions only) (do not override)
Derivative prime() const;
// Does this function have an analytic derivative?
virtual bool hasAnalyticDerivative() const {return false;}
// Derivative. Overriders may be provided, numerical method by default!
virtual Derivative partial(unsigned int) const;
private:
// It is illegal to assign a function.
const AbsFunction & operator=(const AbsFunction &right);
};
FunctionProduct operator * (const AbsFunction &op1, const AbsFunction &op2);
FunctionSum operator + (const AbsFunction &op1, const AbsFunction &op2);
FunctionDifference operator - (const AbsFunction &op1, const AbsFunction &op2);
FunctionQuotient operator / (const AbsFunction &op1, const AbsFunction &op2);
FunctionNegation operator - (const AbsFunction &op1);
ConstTimesFunction operator * (double c, const AbsFunction &op2);
ConstPlusFunction operator + (double c, const AbsFunction &op2);
ConstMinusFunction operator - (double c, const AbsFunction &op2);
ConstOverFunction operator / (double c, const AbsFunction &op2);
ConstTimesFunction operator * (const AbsFunction &op2, double c);
ConstPlusFunction operator + (const AbsFunction &op2, double c);
ConstPlusFunction operator - (const AbsFunction &op2, double c);
ConstTimesFunction operator / (const AbsFunction &op2, double c);
FunctionTimesParameter operator * (const AbsFunction &op1, const AbsParameter &op2);
FunctionPlusParameter operator + (const AbsFunction &op1, const AbsParameter &op2);
FunctionPlusParameter operator - (const AbsFunction &op1, const AbsParameter &op2);
FunctionTimesParameter operator / (const AbsFunction &op1, const AbsParameter &op2);
FunctionTimesParameter operator * (const AbsParameter &op1, const AbsFunction &op2);
FunctionPlusParameter operator + (const AbsParameter &op1, const AbsFunction &op2);
FunctionPlusParameter operator - (const AbsParameter &op1, const AbsFunction &op2);
FunctionTimesParameter operator / (const AbsParameter &op1, const AbsFunction &op2);
FunctionConvolution convolve (const AbsFunction &op1, const AbsFunction &op2, double x0, double x1);
FunctionDirectProduct operator % (const AbsFunction &op1, const AbsFunction &op2);
typedef const AbsFunction & GENFUNCTION;
} // namespace Genfun
//----------------------------------------------------------------------------
//
// This macro does all the ugly boilerplate. For reference I will lis what
// it is doing:
//
// 1). It uses the base class function composition operator. It would be
// nice to just use the
//
// using AbsFunction::operator();
//
// directive but unfortunately this is compiler-dependent!
//
#define FUNCTION_OBJECT_DEF(classname) \
public: \
virtual FunctionComposition operator()(const AbsFunction &function) const; \
virtual ParameterComposition operator()(const AbsParameter &p) const; \
virtual classname *clone() const; \
private:
//----------------------------------------------------------------------------
//
// This macro implements the ugly boilerplate
//
#define FUNCTION_OBJECT_IMP(classname) \
inline FunctionComposition classname::operator()(const AbsFunction & function) const\
{ \
return AbsFunction::operator() (function); \
} \
inline ParameterComposition classname::operator()(const AbsParameter & p) const\
{ \
return AbsFunction::operator() (p); \
} \
inline classname *classname::clone() const \
{ \
return new classname(*this); \
}
//----------------------------------------------------------------------------
#include "CLHEP/GenericFunctions/FunctionProduct.hh"
#include "CLHEP/GenericFunctions/FunctionSum.hh"
#include "CLHEP/GenericFunctions/FunctionDifference.hh"
#include "CLHEP/GenericFunctions/FunctionQuotient.hh"
#include "CLHEP/GenericFunctions/FunctionConvolution.hh"
#include "CLHEP/GenericFunctions/FunctionNegation.hh"
#include "CLHEP/GenericFunctions/FunctionDirectProduct.hh"
#include "CLHEP/GenericFunctions/FunctionComposition.hh"
#include "CLHEP/GenericFunctions/ConstPlusFunction.hh"
#include "CLHEP/GenericFunctions/ConstTimesFunction.hh"
#include "CLHEP/GenericFunctions/ConstMinusFunction.hh"
#include "CLHEP/GenericFunctions/ConstOverFunction.hh"
#include "CLHEP/GenericFunctions/FunctionPlusParameter.hh"
#include "CLHEP/GenericFunctions/FunctionTimesParameter.hh"
#include "CLHEP/GenericFunctions/FunctionNoop.hh"
#include "CLHEP/GenericFunctions/ParameterComposition.hh"
#endif
|