Changeset 3533 in Sophya for trunk/SophyaLib/Samba/lambdaBuilder.cc
- Timestamp:
- Oct 12, 2008, 7:11:59 PM (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/SophyaLib/Samba/lambdaBuilder.cc
r2966 r3533 6 6 /*! 7 7 \class SOPHYA::Legendre 8 generate Legendre polynomials : use in two steps : 9 10 a) instanciate Legendre(\f$x\f$, \f$lmax\f$) ; \f$x\f$ is the value for wich Legendre polynomials will be required (usually equal to \f$\cos \theta\f$) and \f$lmax\f$ is the MAXIMUM value of the order of polynomials wich will be required in the following code (all polynomials, from \f$l=0 to lmax\f$, are computed once for all by an iterative formula). 11 12 b) get the value of Legendre polynomial for a particular value of \f$l\f$ by calling the method getPl. 13 14 */ 15 16 8 \ingroup Samba 9 10 Generate Legendre polynomials. The class usage can be summarized in two steps as follows: 11 12 a) instanciate Legendre(\f$x\f$, \f$lmax\f$) ; \f$x\f$ is the value for wich Legendre 13 polynomials will be required (usually equal to \f$\cos \theta\f$) and \f$lmax\f$ is 14 the MAXIMUM value of the order of polynomials wich will be required. 15 (All polynomials, from \f$l=0 to lmax\f$, are computed once for all by an recursive formula). 16 17 b) get the value of Legendre polynomial for a particular value of \f$l\f$ by calling the 18 method getPl. 19 20 */ 21 22 /*! Constructor, with specification of \b lmax and the \b x value for the polynomials */ 17 23 Legendre::Legendre(r_8 x, int_4 lmax) 18 24 { 19 if (fabs(x) > 1. ) 20 { 21 throw RangeCheckError("variable for Legendre polynomials must have modules inferior to 1" ); 22 } 25 if (fabs(x) > 1. ) { 26 throw RangeCheckError("Legendre::Legendre(x,lmax) invalid x argument, fabs(x) > 1 !" ); 27 } 23 28 x_ = x; 24 29 array_init(lmax); 25 30 } 26 31 27 /*! \fn void SOPHYA::Legendre::array_init(int_4 lmax) 28 29 compute all \f$P_l(x,l_{max})\f$ for \f$l=1,l_{max}\f$ 30 */ 32 /*! Private method which computes all \f$P_l(x,l_{max})\f$ for \f$l=1,l_{max}\f$ */ 31 33 void Legendre::array_init(int_4 lmax) 32 34 { … … 35 37 Pl_(0)=1.; 36 38 if (lmax>0) Pl_(1)=x_; 37 for (int k=2; k<Pl_.NElts(); k++) 38 { 39 for (int k=2; k<Pl_.NElts(); k++) { 39 40 Pl_(k) = ( (2.*k-1)*x_*Pl_(k-1)-(k-1)*Pl_(k-2) )/k; 40 41 } 41 42 } 42 43
Note:
See TracChangeset
for help on using the changeset viewer.