Commit 4eaf1e05 authored by Lynn Garren's avatar Lynn Garren

more fixes for -Wshadow in GenericFunctions

parent 232a76ee
2012-08-15 Lynn Garren <garren@fnal.gov>
* GenericFunctions: latest changes from Joe Boudreau
* GenericFunctions: change the names of internal variables so -Wshadow does not complain
2012-08-14 Lynn Garren <garren@fnal.gov>
* cmake/Modules: use OUTPUT_STRIP_TRAILING_WHITESPACE with execute_process commands
......
2012-08-15 Lynn Garren <garren@fnal.gov>
* latest changes from Joe Boudreau
* change the names of internal variables so -Wshadow does not complain
==============================
09.07.12 Release CLHEP-2.1.2.4
==============================
......
namespace Genfun {
ButcherTableau::ButcherTableau(const std::string &name, unsigned int order):_name(name),_order(order){
ButcherTableau::ButcherTableau(const std::string &xname, unsigned int xorder):_name(xname),_order(xorder){
}
......
......@@ -5,6 +5,7 @@ set( pkginclude_HEADERS
Abs.hh
AbsParameter.hh
ACos.hh
AdaptiveRKStepper.hh
Airy.hh
Airy.icc
AnalyticConvolution.hh
......@@ -20,6 +21,8 @@ set( pkginclude_HEADERS
Bessel.icc
BetaDistribution.hh
BivariateGaussian.hh
ButcherTableau.hh
ButcherTableau.icc
ClassicalSolver.hh
ClebschGordanCoefficientSet.hh
ConstMinusFunction.hh
......@@ -40,9 +43,12 @@ set( pkginclude_HEADERS
EfficiencyFunctional.hh
EllipticIntegral.hh
EllipticIntegral.icc
EmbeddedRKStepper.hh
Erf.hh
Exp.hh
Exponential.hh
ExtendedButcherTableau.hh
ExtendedButcherTableau.icc
FixedConstant.hh
FloatingConstant.hh
FourierFit.hh
......@@ -59,8 +65,8 @@ set( pkginclude_HEADERS
FunctionQuotient.hh
FunctionSum.hh
FunctionTimesParameter.hh
Gamma.hh
GammaDistribution.hh
Gamma.hh
Gaussian.hh
GenericFunctions.hh
IncompleteGamma.hh
......@@ -104,19 +110,21 @@ set( pkginclude_HEADERS
RKIntegrator.hh
RungeKuttaClassicalSolver.hh
Sigma.hh
SimpleRKStepper.hh
Sin.hh
SphericalBessel.hh
SphericalBessel.icc
SphericalHarmonicFit.hh
SphericalHarmonicFit.icc
SphericalHarmonicExpansion.hh
SphericalHarmonicExpansion.icc
SphericalHarmonicCoefficientSet.hh
SphericalHarmonicCoefficientSet.icc
SphericalHarmonicExpansion.hh
SphericalHarmonicExpansion.icc
SphericalHarmonicFit.hh
SphericalHarmonicFit.icc
SphericalNeumann.hh
SphericalNeumann.icc
Sqrt.hh
Square.hh
StepDoublingRKStepper.hh
SymToArgAdaptor.hh
SymToArgAdaptor.icc
Tan.hh
......
......@@ -18,8 +18,8 @@ namespace Genfun {
public:
inline Key(unsigned int l1, unsigned int l2, int m1, int m2, unsigned int L):
l1(l1),l2(l2),m1(m1),m2(m2),L(L) {}
inline Key(unsigned int xl1, unsigned int xl2, int xm1, int xm2, unsigned int xL):
l1(xl1),l2(xl2),m1(xm1),m2(xm2),L(xL) {}
inline bool operator < (const Key & o) const {
if ( l1!=o.l1) return l1<o.l1;
......
namespace Genfun {
ExtendedButcherTableau::ExtendedButcherTableau(const std::string &name,
unsigned int order,
unsigned int orderHat):_name(name),
_order(order),
_orderHat(orderHat){
ExtendedButcherTableau::ExtendedButcherTableau(const std::string &mname,
unsigned int xorder,
unsigned int xorderHat):_name(mname),
_order(xorder),
_orderHat(xorderHat){
}
......
......@@ -34,7 +34,7 @@ namespace Genfun {
// Retreive function value
virtual double operator ()(double argument) const;
virtual double operator ()(const Argument & a) const {return operator() (a[0]);}
virtual double operator ()(const Argument & arg) const {return operator() (arg[0]);}
// Get the paramter a
Parameter & a();
......
......@@ -34,7 +34,7 @@ namespace Genfun {
// Retreive function value
virtual double operator ()(double argument) const;
virtual double operator ()(const Argument & a) const {return operator() (a[0]);}
virtual double operator ()(const Argument & arg) const {return operator() (arg[0]);}
// Get the starting value of the LogisticFunction
Parameter & x0();
......
......@@ -9,139 +9,139 @@ tempincludedir = $(TEMPDIR)/CLHEP/@PACKAGE@
COPY_P = @COPY_P@
pkginclude_HEADERS = \
AbsFunctional.hh \
AbsFunction.hh \
Abs.hh \
AbsParameter.hh \
ACos.hh \
AbsFunctional.hh \
AbsFunction.hh \
Abs.hh \
AbsParameter.hh \
ACos.hh \
AdaptiveRKStepper.hh \
Airy.hh \
Airy.icc \
AnalyticConvolution.hh \
Argument.hh \
ArgumentList.hh \
ArrayFunction.hh \
ASin.hh \
AssociatedLaguerre.hh \
AssociatedLegendre.hh \
AssociatedLegendre.icc \
ATan.hh \
Bessel.hh \
Bessel.icc \
Airy.hh \
Airy.icc \
AnalyticConvolution.hh \
Argument.hh \
ArgumentList.hh \
ArrayFunction.hh \
ASin.hh \
AssociatedLaguerre.hh \
AssociatedLegendre.hh \
AssociatedLegendre.icc \
ATan.hh \
Bessel.hh \
Bessel.icc \
BetaDistribution.hh \
BivariateGaussian.hh \
BivariateGaussian.hh \
ButcherTableau.hh \
ButcherTableau.icc \
ClassicalSolver.hh \
ClebschGordanCoefficientSet.hh \
ConstMinusFunction.hh \
ConstMinusParameter.hh \
ConstOverFunction.hh \
ConstOverParameter.hh \
ConstPlusFunction.hh \
ConstPlusParameter.hh \
ConstTimesFunction.hh \
ConstTimesParameter.hh \
Cos.hh \
CumulativeChiSquare.hh \
CutBase.hh \
CutBase.icc \
DefiniteIntegral.hh \
DoubleParamToArgAdaptor.hh \
DoubleParamToArgAdaptor.icc \
ConstMinusFunction.hh \
ConstMinusParameter.hh \
ConstOverFunction.hh \
ConstOverParameter.hh \
ConstPlusFunction.hh \
ConstPlusParameter.hh \
ConstTimesFunction.hh \
ConstTimesParameter.hh \
Cos.hh \
CumulativeChiSquare.hh \
CutBase.hh \
CutBase.icc \
DefiniteIntegral.hh \
DoubleParamToArgAdaptor.hh \
DoubleParamToArgAdaptor.icc \
EfficiencyFunctional.hh \
EllipticIntegral.hh \
EllipticIntegral.icc \
EllipticIntegral.hh \
EllipticIntegral.icc \
EmbeddedRKStepper.hh \
Erf.hh \
Exp.hh \
Exponential.hh \
Erf.hh \
Exp.hh \
Exponential.hh \
ExtendedButcherTableau.hh \
ExtendedButcherTableau.icc \
FixedConstant.hh \
FloatingConstant.hh \
FixedConstant.hh \
FloatingConstant.hh \
FourierFit.hh \
FourierFit.icc \
FunctionComposition.hh \
FunctionConvolution.hh \
FunctionDifference.hh \
FunctionDirectProduct.hh \
FunctionNegation.hh \
FunctionNoop.hh \
FunctionNumDeriv.hh \
FunctionPlusParameter.hh \
FunctionProduct.hh \
FunctionQuotient.hh \
FunctionSum.hh \
FunctionTimesParameter.hh \
Gaussian.hh \
Gamma.hh \
GammaDistribution.hh \
GenericFunctions.hh \
IncompleteGamma.hh \
InterpolatingPolynomial.hh \
Landau.hh \
FunctionComposition.hh \
FunctionConvolution.hh \
FunctionDifference.hh \
FunctionDirectProduct.hh \
FunctionNegation.hh \
FunctionNoop.hh \
FunctionNumDeriv.hh \
FunctionPlusParameter.hh \
FunctionProduct.hh \
FunctionQuotient.hh \
FunctionSum.hh \
FunctionTimesParameter.hh \
GammaDistribution.hh \
Gamma.hh \
Gaussian.hh \
GenericFunctions.hh \
IncompleteGamma.hh \
InterpolatingPolynomial.hh \
KroneckerDelta.hh \
Landau.hh \
LegendreCoefficientSet.hh \
LegendreCoefficientSet.icc \
LegendreExpansion.hh \
LegendreExpansion.icc \
LegendreFit.hh \
LegendreFit.icc \
KroneckerDelta.hh \
Legendre.hh \
Legendre.icc \
LikelihoodFunctional.hh \
Ln.hh \
LogGamma.hh \
LogisticFunction.hh \
Mod.hh \
NonrelativisticBW.hh \
ParameterComposition.hh \
ParameterDifference.hh \
Parameter.hh \
ParameterNegation.hh \
ParameterProduct.hh \
ParameterQuotient.hh \
ParameterSum.hh \
ParamToArgAdaptor.hh \
ParamToArgAdaptor.icc \
PeriodicRectangular.hh \
PhaseSpace.hh \
Power.hh \
Psi2Hydrogen.hh \
Psi2Hydrogen.icc \
PtRelFcn.hh \
Legendre.hh \
Legendre.icc \
LikelihoodFunctional.hh \
Ln.hh \
LogGamma.hh \
LogisticFunction.hh \
Mod.hh \
NonrelativisticBW.hh \
ParameterComposition.hh \
ParameterDifference.hh \
Parameter.hh \
ParameterNegation.hh \
ParameterProduct.hh \
ParameterQuotient.hh \
ParameterSum.hh \
ParamToArgAdaptor.hh \
ParamToArgAdaptor.icc \
PeriodicRectangular.hh \
PhaseSpace.hh \
Power.hh \
Psi2Hydrogen.hh \
Psi2Hydrogen.icc \
PtRelFcn.hh \
PuncturedSmearedExp.hh \
RCBase.hh \
Rectangular.hh \
RelativisticBW.hh \
ReverseExponential.hh \
RKIntegrator.hh \
RCBase.hh \
Rectangular.hh \
RelativisticBW.hh \
ReverseExponential.hh \
RKIntegrator.hh \
RungeKuttaClassicalSolver.hh \
Sigma.hh \
Sigma.hh \
SimpleRKStepper.hh \
Sin.hh \
SphericalBessel.hh \
SphericalBessel.icc \
SphericalNeumann.hh \
SphericalNeumann.icc \
SphericalHarmonicFit.hh \
SphericalHarmonicFit.icc \
SphericalHarmonicExpansion.hh \
SphericalHarmonicExpansion.icc \
Sin.hh \
SphericalBessel.hh \
SphericalBessel.icc \
SphericalHarmonicCoefficientSet.hh \
SphericalHarmonicCoefficientSet.icc \
Sqrt.hh \
Square.hh \
SphericalHarmonicExpansion.hh \
SphericalHarmonicExpansion.icc \
SphericalHarmonicFit.hh \
SphericalHarmonicFit.icc \
SphericalNeumann.hh \
SphericalNeumann.icc \
Sqrt.hh \
Square.hh \
StepDoublingRKStepper.hh \
SymToArgAdaptor.hh \
SymToArgAdaptor.icc \
Tan.hh \
Theta.hh \
TrivariateGaussian.hh \
Variable.hh \
VoigtProfile.hh \
X.hh \
Tan.hh \
Theta.hh \
TrivariateGaussian.hh \
Variable.hh \
VoigtProfile.hh \
X.hh \
defs.h
# Identify generated file(s) to be removed when 'make clean' is requested:
......
......@@ -34,7 +34,7 @@ namespace Genfun {
// Retreive function value
virtual double operator ()(double argument) const;
virtual double operator ()(const Argument & a) const {return operator() (a[0]);}
virtual double operator ()(const Argument & arg) const {return operator() (arg[0]);}
// Get the position of the first discontinuity
Parameter & a();
......
......@@ -65,18 +65,18 @@ const Parameter & AnalyticConvolution::offset() const {
double AnalyticConvolution::operator() (double argument) const {
// Fetch the paramters. This operator does not convolve numerically.
static const double sqrtTwo = sqrt(2.0);
double sigma = _sigma.getValue();
double xsigma = _sigma.getValue();
double tau = _lifetime.getValue();
double offset = _offset.getValue();
double x = argument-offset;
double xoffset = _offset.getValue();
double x = argument-xoffset;
double freq = _frequency.getValue();
// smeared exponential an its asymmetry.
double expG=0.0, asymm=0.0;
if (_type==SMEARED_NEG_EXP) {
expG = exp((sigma*sigma +2*tau*(/*offset*/x))/(2.0*tau*tau)) *
erfc((sigma*sigma+tau*(/*offset*/x))/(sqrtTwo*sigma*tau))/(2.0*tau);
expG = exp((xsigma*xsigma +2*tau*(/*xoffset*/x))/(2.0*tau*tau)) *
erfc((xsigma*xsigma+tau*(/*xoffset*/x))/(sqrtTwo*xsigma*tau))/(2.0*tau);
#if (defined _WIN32)
if (!_finite(expG)) {
expG=0.0;
......@@ -89,8 +89,8 @@ double AnalyticConvolution::operator() (double argument) const {
return expG;
}
else {
expG = exp((sigma*sigma +2*tau*(/*offset*/-x))/(2.0*tau*tau)) *
erfc((sigma*sigma+tau*(/*offset*/-x))/(sqrtTwo*sigma*tau))/(2.0*tau);
expG = exp((xsigma*xsigma +2*tau*(/*xoffset*/-x))/(2.0*tau*tau)) *
erfc((xsigma*xsigma+tau*(/*xoffset*/-x))/(sqrtTwo*xsigma*tau))/(2.0*tau);
}
// Both sign distribution=> return smeared exponential:
......@@ -113,10 +113,10 @@ double AnalyticConvolution::operator() (double argument) const {
// First, if the mixing frequency is too high compared with the lifetime, we
// cannot see this oscillation. We abandon the complicated approach and just do
// this instead:
if (sigma>6.0*tau) {
if (xsigma>6.0*tau) {
asymm = expG*(1/(1+tau*tau*freq*freq));
}
else if (sigma==0.0) {
else if (xsigma==0.0) {
if (_type==SMEARED_COS_EXP|| _type==MIXED || _type==UNMIXED ) {
if (x>=0) asymm= (expG*cos(freq*x));
}
......@@ -125,23 +125,23 @@ double AnalyticConvolution::operator() (double argument) const {
}
}
else {
std::complex<double> z(freq*sigma/sqrtTwo, (sigma/tau-x/sigma)/sqrtTwo);
std::complex<double> z(freq*xsigma/sqrtTwo, (xsigma/tau-x/xsigma)/sqrtTwo);
if (x<0) {
if (_type==SMEARED_COS_EXP|| _type==MIXED || _type==UNMIXED ) {
asymm= 2.0*nwwerf(z).real()/tau/4.0*exp(-x*x/2.0/sigma/sigma);
asymm= 2.0*nwwerf(z).real()/tau/4.0*exp(-x*x/2.0/xsigma/xsigma);
}
else if (_type==SMEARED_SIN_EXP) {
asymm= 2.0*nwwerf(z).imag()/tau/4.0*exp(-x*x/2.0/sigma/sigma);
asymm= 2.0*nwwerf(z).imag()/tau/4.0*exp(-x*x/2.0/xsigma/xsigma);
}
}
else {
if (_type==SMEARED_COS_EXP||_type==MIXED || _type==UNMIXED) {
asymm= -2.0*nwwerf(std::conj(z)).real()/tau/4*exp(-x*x/2.0/sigma/sigma) +
exp(sigma*sigma/2 *(1/tau/tau - freq*freq) - x/tau)*(1./tau)*cos(freq*x - freq/tau*sigma*sigma);
asymm= -2.0*nwwerf(std::conj(z)).real()/tau/4*exp(-x*x/2.0/xsigma/xsigma) +
exp(xsigma*xsigma/2 *(1/tau/tau - freq*freq) - x/tau)*(1./tau)*cos(freq*x - freq/tau*xsigma*xsigma);
}
else if (_type==SMEARED_SIN_EXP) {
asymm= +2.0*nwwerf(std::conj(z)).imag()/tau/4*exp(-x*x/2.0/sigma/sigma) +
exp(sigma*sigma/2 *(1/tau/tau - freq*freq) - x/tau)*(1./tau)*sin(freq*x - freq/tau*sigma*sigma);
asymm= +2.0*nwwerf(std::conj(z)).imag()/tau/4*exp(-x*x/2.0/xsigma/xsigma) +
exp(xsigma*xsigma/2 *(1/tau/tau - freq*freq) - x/tau)*(1./tau)*sin(freq*x - freq/tau*xsigma*xsigma);
}
}
}
......@@ -155,7 +155,7 @@ double AnalyticConvolution::operator() (double argument) const {
<< std::endl;
if (retVal<0)
std::cerr
<< sigma << ' ' << tau << ' ' << offset << ' '
<< xsigma << ' ' << tau << ' ' << xoffset << ' '
<< freq << ' '<< argument
<< std::endl;
if (retVal<0)
......@@ -170,7 +170,7 @@ double AnalyticConvolution::operator() (double argument) const {
<< std::endl;
if (retVal<0)
std::cerr
<< sigma << ' ' << tau << ' ' << offset << ' '
<< xsigma << ' ' << tau << ' ' << xoffset << ' '
<< freq << ' ' << argument
<< std::endl;
if (retVal<0)
......
......@@ -13,9 +13,9 @@ inline double factorial (int n) {
else return n*factorial(n-1);
}
AssociatedLaguerre::AssociatedLaguerre(unsigned int n, unsigned int k):
_n(n),
_k(k)
AssociatedLaguerre::AssociatedLaguerre(unsigned int xn, unsigned int xk):
_n(xn),
_k(xk)
{
create();
}
......
......@@ -4,6 +4,7 @@ set( GenericFunctions_source
AbsFunction.cc
AbsParameter.cc
ACos.cc
AdaptiveRKStepper.cc
AnalyticConvolution.cc
ArrayFunction.cc
ASin.cc
......@@ -25,6 +26,7 @@ set( GenericFunctions_source
CumulativeChiSquare.cc
DefiniteIntegral.cc
EfficiencyFunctional.cc
EmbeddedRKStepper.cc
Erf.cc
Exp.cc
Exponential.cc
......@@ -74,9 +76,11 @@ set( GenericFunctions_source
RKIntegrator.cc
RungeKuttaClassicalSolver.cc
Sigma.cc
SimpleRKStepper.cc
Sin.cc
Sqrt.cc
Square.cc
StepDoublingRKStepper.cc
Tan.cc
Theta.cc
TrivariateGaussian.cc
......
......@@ -8,8 +8,8 @@ namespace Genfun {
FUNCTION_OBJECT_IMP(EnergyFunction)
EnergyFunction::EnergyFunction(const Classical::Solver & solver):
solver(solver)
EnergyFunction::EnergyFunction(const Classical::Solver & xsolver):
solver(xsolver)
{}
EnergyFunction::~EnergyFunction() {
......
......@@ -10,19 +10,19 @@ inline double factorial (int N) {
namespace Genfun {
double ClebschGordanCoefficientSet::calcCoefficient(int l1, int l2, int L, int m1, int m2, int M) {
double ClebschGordanCoefficientSet::calcCoefficient(int l1, int l2, int L, int xm1, int xm2, int M) {
if (m1+m2!=M) return 0;
if (xm1+xm2!=M) return 0;
double F1=sqrt((2*L+1)*factorial(L+l1-l2)*factorial(L-l1+l2)*factorial(l1+l2-L)/factorial(l1+l2+L+1));
double F2=sqrt(factorial(L+M)*factorial(L-M)*factorial(l1-m1)*factorial(l1+m1)*factorial(l2-m2)
*factorial(l2+m2));
double F2=sqrt(factorial(L+M)*factorial(L-M)*factorial(l1-xm1)*factorial(l1+xm1)*factorial(l2-xm2)
*factorial(l2+xm2));
double F3=0.0;
int max=0;
max = std::max(max,l2+m2);
max = std::max(max,l1-m1);
max = std::max(max,l2+xm2);
max = std::max(max,l1-xm1);
max = std::max(max,l1+l2-L);
// max = std::max(max,l2-L-m1);
// max = std::max(max,l1+m2-L);
// max = std::max(max,l2-L-xm1);
// max = std::max(max,l1+xm2-L);
for (int k=0;k<=max;k++) {
double term = factorial(k);
bool skipTerm=false;
......@@ -32,22 +32,22 @@ namespace Genfun {
}
if (!skipTerm)
{
int T=l1-m1-k;
int T=l1-xm1-k;
if (T>=0) term *= factorial(T); else skipTerm=true;
}
if (!skipTerm)
{
int T=l2+m2-k;
int T=l2+xm2-k;
if (T>=0) term *= factorial(T); else skipTerm=true;
}
if (!skipTerm)
{
int T=L-l2+m1+k;
int T=L-l2+xm1+k;
if (T>=0) term *= factorial(T); else skipTerm=true;
}
if (!skipTerm)
{
int T=L-l1-m2+k;
int T=L-l1-xm2+k;