CLHEP
2.4.7.1
C++ Class Library for High Energy Physics
CLHEP
GenericFunctions
AssociatedLegendre.icc
Go to the documentation of this file.
1
// -*- C++ -*-
2
// $Id:
3
#include "
CLHEP/GenericFunctions/Variable.hh
"
4
#include "
CLHEP/GenericFunctions/Power.hh
"
5
#include <gsl/gsl_sf_legendre.h>
6
#include <cmath>
7
#include <signal.h>
8
#include <assert.h>
9
10
11
namespace
Genfun
{
12
13
FUNCTION_OBJECT_IMP
(AssociatedLegendre)
14
15
// This is the product n (n-2) (n-4)...
16
inline
double
dfactorial
(
int
n) {
17
if
(n<=1)
return
1.0;
18
else
return
n*
dfactorial
(n-2);
19
}
20
//
21
inline
22
AssociatedLegendre::AssociatedLegendre
(
unsigned
int
l,
unsigned
int
m):
23
AbsFunction
(),
24
_l(l),
25
_m(m)
26
{
27
assert(m<=
l
);
28
}
29
30
inline
31
AssociatedLegendre::~AssociatedLegendre
() {
32
}
33
34
inline
35
AssociatedLegendre::AssociatedLegendre
(
const
AssociatedLegendre
& right):
36
AbsFunction
(),
37
_l(right._l),
38
_m(right._m)
39
{
40
}
41
42
inline
43
unsigned
int
AssociatedLegendre::l
()
const
{
44
return
_l;
45
}
46
47
inline
48
unsigned
int
AssociatedLegendre::m
()
const
{
49
return
_m;
50
}
51
52
53
inline
54
double
AssociatedLegendre::operator()
(
double
x)
const
{
55
gsl_sf_result result;
56
int
status = gsl_sf_legendre_Plm_e (_l, _m, x, &result);
57
58
if
(status!=0) {
59
std::cerr <<
"Warning, GSL function gsl_sf_bessel_Yn_impl"
60
<<
" return code"
<< status << std::endl;
61
raise(SIGFPE);
62
}
63
return
result.val;
64
}
65
66
}
// end namespace Genfun
FUNCTION_OBJECT_IMP
#define FUNCTION_OBJECT_IMP(classname)
Definition
AbsFunction.hh:149
Power.hh
Variable.hh
Genfun::AbsFunction
Definition
AbsFunction.hh:48
Genfun::AssociatedLegendre
Definition
AssociatedLegendre.hh:20
Genfun::AssociatedLegendre::~AssociatedLegendre
virtual ~AssociatedLegendre()
Definition
AssociatedLegendre.icc:31
Genfun::AssociatedLegendre::AssociatedLegendre
AssociatedLegendre(unsigned int l, unsigned int m)
Definition
AssociatedLegendre.icc:22
Genfun::AssociatedLegendre::operator()
virtual double operator()(double argument) const override
Definition
AssociatedLegendre.icc:54
Genfun::AssociatedLegendre::l
unsigned int l() const
Definition
AssociatedLegendre.icc:43
Genfun::AssociatedLegendre::m
unsigned int m() const
Definition
AssociatedLegendre.icc:48
Genfun
Definition
Abs.hh:14
Genfun::dfactorial
double dfactorial(int n)
Definition
AssociatedLegendre.icc:16
Generated by
1.10.0