Changeset 3533 in Sophya
- Timestamp:
- Oct 12, 2008, 7:11:59 PM (17 years ago)
- Location:
- trunk/SophyaLib/Samba
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/SophyaLib/Samba/bruit.cc
r3205 r3533 10 10 // #include "rancern.h" 11 11 // #include "hbook.h" 12 #ifdef OS_MACOSX12 #ifdef Darwin 13 13 #include <limits.h> 14 14 #endif -
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 -
trunk/SophyaLib/Samba/lambdaBuilder.h
r2958 r3533 6 6 #include "tvector.h" 7 7 #include "alm.h" 8 #include "pexceptions.h" 8 9 9 10 10 11 namespace SOPHYA { 11 12 12 /*! class e pour les polynomes de legendre*/13 /*! class of Legendre polynomials */ 13 14 class Legendre { 15 public : 16 Legendre(r_8 x, int_4 lmax); 14 17 15 public : 16 Legendre(r_8 x, int_4 lmax); 18 inline r_8 getPl(int_4 l) const 19 { 20 if (l>lmax_) { 21 throw RangeCheckError("Legendre::getPl(l) l>lmax -> Instanciate class with greater lmax ..."); 22 } 23 return Pl_(l); 24 } 17 25 18 inline r_8 getPl(int_4 l) const 19 { 20 if (l>lmax_) 21 { 22 throw (" illegal call of Legendre::getPl with index greater than lmax, which Legendre Class was instanciated with : instanciate Legendre with a greater lmax... "); 23 } 24 return Pl_(l); 25 } 26 private : 27 Legendre() {;} // this is forbidden 26 28 27 28 private : 29 30 Legendre() {;} 31 32 void array_init(int_4 lmax); 29 void array_init(int_4 lmax); 33 30 34 31 r_8 x_; … … 39 36 40 37 41 38 class LambdaLMBuilder { 42 39 43 40 public: 44 41 45 42 LambdaLMBuilder() {} … … 103 100 104 101 105 106 102 class LambdaWXBuilder : public LambdaLMBuilder 107 103 { 108 104 public: 109 105 110 106
Note:
See TracChangeset
for help on using the changeset viewer.