### (JEC) 3/11/15 new version of laguerre2bessel. The Jlnp intgral is computed...

`(JEC) 3/11/15 new version of laguerre2bessel. The Jlnp intgral is computed with a Discret Fourier-Bessel Transformation.`
parent d0391358
 ... ... @@ -121,8 +121,8 @@ CXXHDR = \$(SRC)lagsht_exceptions.h \ \$(SRC)lagSphericTransform.h \ \$(SRC)walltimer.h \ \$(SRC)lagsht_bessel.h \ \$(SRC)laguerre2bessel.h \ \$(SRC)quadinteg.h \$(SRC)laguerre2bessel.h # \$(SRC)quadinteg.h CPPFLAGS += \$(BLASYES) \$(SHARPINC) \$(BLASINC) LDFLAGS += \$(SHARPLIBN) \$(BLASLIBN) -lm ... ...
 ... ... @@ -7,6 +7,7 @@ namespace LagSHT { void Bessel::BesselRoots() { // using namespace std; string msg; try { unsigned int n_zeros = nmax_; ... ... @@ -16,6 +17,7 @@ void Bessel::BesselRoots() { r_8 order = (r_8)lcur + 0.5; vector zeros; boost::math::cyl_bessel_j_zero(order,1,n_zeros, back_inserter(zeros)); copy(zeros.begin(),zeros.end(),qln_.begin() + lcur*nmax_); }//l loop ... ...
 ... ... @@ -26,6 +26,7 @@ //STD #include #include #include //Boost ... ... @@ -69,10 +70,15 @@ class Bessel { }//end Init // Sperical Bessel functions static inline r_8 jn(int n, r_8 x) { return boost::math::sph_bessel(n, x); } static inline r_8 jn(int n, r_8 x) { return boost::math::sph_bessel(n, x); } //Helper r_8 operator()(int l, int n) const { return qln_[l*nmax_+n];} //qln(l,n) r_8 operator()(int l, int n) const { if(l>lmax_ || n > nmax_) cout <<" ERROR Besel::Op(l,n) called with ("<
 ... ... @@ -383,51 +383,110 @@ void TestLaguerre2Bessel() { tstack_pop("Compute Alm(rk) from FB coeffs."); cout << "tstack 2 End" < > flmn(Ntot); sphlagtrans.Analysis(fFLijk,flmn); { r_8 err_abs(0.); r_8 err_rel(0.); int imax = -1; for(int i=0;i cdiff = (flmnOrig[i] - flmn[i]) * conj(flmnOrig[i] - flmn[i]); r_16 diff = sqrt(cdiff.real()); if(diff>err_abs){ err_abs = diff; imax = i; } complex foriCAbs = flmnOrig[i]*conj(flmnOrig[i]); r_8 foriAbs = sqrt(foriCAbs.real()); r_8 relatdiff = diff/foriAbs; if((relatdiff)>err_rel) err_rel = relatdiff; } cout << " >>>>>>>>>>>>>>>>>>>>> Fourrier-Laguerre part <<<<<<<<<<<<<<<<<<<<<<<<<<" << endl; cout << "Err. Max. " << err_abs << " [" << imax << "], Err. Rel. " << err_rel << endl; cout << " >>>>>>>>>>>>>>>>>>>>> <<<<<<<<<<<<<<<<<<<<<<<<<<" << endl; } tstack_pop("F-L Analysis verif"); tstack_pop("processing"); {//dump 1 {//Check 1 cout << "Dump FL or FB reconstructed Alm(r_k)" < cdiff = (FLalmk[id] - FBalmk[id])*conj(FLalmk[id] - FBalmk[id]); r_8 diff = sqrt(cdiff.real()); if(diff>err_abs){ err_abs = diff; } complex cref= FLalmk[id]*conj(FLalmk[id]); r_8 ref = sqrt(cref.real()); r_8 relatdiff = diff/ref; if(relatdiff>err_rel) err_rel = relatdiff; } } cout << " >>>>>>>>>>>>>>>>>>>>> Shell["<>>>>>>>>>>>>>>>>>>>> <<<<<<<<<<<<<<<<<<<<<<<<<<" << endl; } ofs.close(); }//dump 1 }//check 1 {//dump 2 {//check 2 std::ofstream ofs; ofs.open ("fijk.txt", std::ofstream::out); cout << "Dump FL or FB reconstructed fijk on each shell k" <err_abs){ err_abs = diff; } r_8 relatdiff = diff/ fFLijk[id]; if(relatdiff>err_rel) err_rel = relatdiff; }//loop on px cout << " >>>>>>>>>>>>>>>>>>>>> Shell["<>>>>>>>>>>>>>>>>>>>> <<<<<<<<<<<<<<<<<<<<<<<<<<" << endl; }//loop on shell ofs.close(); }//dump 2 }//check 2 ... ... @@ -615,7 +674,7 @@ int main(int narg, char *arg[]) { case 5: { if(Pmax modify the value to "<< Pmax << endl;} if(Pmax modify the value to "<< param.Pmax << endl;} tstack_push("TestLaguerre2Bessel"); TestLaguerre2Bessel(); tstack_pop("TestLaguerre2Bessel"); ... ...
 ... ... @@ -7,8 +7,6 @@ #include "walltimer.h" //timing #include //TEST namespace LagSHT { /* Version 0: test de calcul des J_{lnp} via une quadrature de Laguerre ... ... @@ -37,67 +35,92 @@ namespace LagSHT { }//Ctor /*! compute J_{lnp} = J_{ln}(k_{lp} via Clenshaw-Curtis quadrature and local integration strategy */ void Laguerre2Bessel::ComputeJInteg(){ typedef ClenshawCurtisQuadrature Integrator_t; Integrator_t theQuad(20,"./data/ClenshawCurtisRuleData-20.txt",false); //false=do not recompute the weights and nodes of the quadrature r_8 tau = lagTrans_->GetTau(); r_8 tau3sqrt = pow(tau,(r_8)(3./2.)); // cout << "ComputeJlpnInteg: tau " << tau << ", tau^(3/2): " << tau3sqrt << endl; //normalisation factor int alpha = lagTrans_->GetAlpha(); r_8 alphaFact = 1; // alpha! for(int i=1;i<=alpha; i++) alphaFact *= i; alphaFact = sqrt((r_8)alphaFact); //sqrt(alpha!) r_8 invalphaFact = 1.0/alphaFact; // 1/sqrt(alpha)! vector facts(Nmax_); //sqrt(2/pi)*tau^(3/2)*sqrt(n!/(n+alpha)!) en iteratif facts = invalphaFact*tau3sqrt*sqrt(2.0/M_PI); //JEC 7/10/15 add sqrt(2/pi) for(int n=1;ncf. LaguerreFuncQuad k_{lp}*tau = q_{lp}/r_{Nmax-1} Apply a Discrete Spherical transform Lanusse et al A&A 540, A92 (2012) Eq.40 with l'=l Jlnp ~ Kapa_l^(-3) tau^(3/2) Sqrt(2 Pi) Sum_{p'=0}^{PPmax-1} Kn(r_{lp'}) jl(q_{lp'}q_{lp}/q_{l,PPmax-1})/[jl+1(q_{lp})]^2 with r_{lp'} = q_{lp'}/q_{l,PPmax-1}r_{Nmax-1} notice PPmax as nothing to do in principle with Pmax the Fourier-Bessel max value of the 3rd index Kapa_l = q_{l,PPmax-1}/r_{Nmax-1} */ void Laguerre2Bessel::ComputeJInteg(){ r_8 tau = lagTrans_->GetTau(); r_8 tau3sqrt = pow(tau,(r_8)(3./2.)); r_8 R = Rmax_ / tau; // R = r[N-1] voir acces direct = (lagTrans_->GetNodes()).back() int Jstride = Lmax_*Pmax_; // nbre of (l,p) couples Jlnp_.resize(Nmax_*Jstride); int alpha = lagTrans_->GetAlpha(); r_8 alphaFact = 1; // alpha! for(int i=1;i<=alpha; i++) alphaFact *= i; alphaFact = sqrt((r_8)alphaFact); //sqrt(alpha!) r_8 invalphaFact = 1.0/alphaFact; // 1/sqrt(alpha)! vector facts(Nmax_); //sqrt(2/pi)*tau^(3/2)*sqrt(n!/(n+alpha)!) en iteratif facts = invalphaFact; for(int n=1;n::values_t loc_val; for(int p=0; p PMax pour la Synthese car appel a qlp int PPmaxm1 = PPmax -1; jnu_ = new Bessel(Lmax_,PPmax); tstack_push("J Integ compute "); for(int p=0; pValue(rlpp); } Jlnp_[ploff7 + n*Jstride] = (coeff * sum) * (tau3sqrt*facts[n]); delete Ln; }//n }//l }//p tstack_pop("J Integ compute"); tstack_pop("J Integ compute "); cout << "J Integ compute END" << endl; }//ComputeJlpnInteg }//ComputeJlpnInteg /*! FBlmp = FB_{lm}(k_{lp}) = Sqrt[2/Pi] Sum_n FL_{lmn} J_{ln}(k_{lp}) ... ... @@ -158,10 +181,7 @@ void Laguerre2Bessel::Synthesis(const vector< complex >& FBlmp, R_k = tau r_k r_k: k-th nodes of Laguerre of order Nmax as for the Spherical-Laguerre Transform. tau: Rmax/r_{N-1} from Laguerre-Transform 23/9/15 in fact Leistedt & McEwen et al in IEEE Vol 60 Num 12 (Dec 2012) do not use the same convention on Bessel Transform as Lanusse et al. A&A 578, A10 (2015) so in the Sum_{p=0}^{Pmax-1}... the k_{lp} should be squared => k_{lp} R_k = q_{lp} r_k/r_{N-1} Rdeminder: Fourier-Laguerre case where alm^{FL}(R_k) = Sum_{n=0}^{Nmax-1} FLlmn LaguerreFunc_n(r_k) ... ... @@ -172,7 +192,6 @@ void Laguerre2Bessel::Synthesis(const vector< complex >& FBlmp, */ vector vrk = lagTrans_->GetNodes(); //OK cout << "Verif: tau " << lagTrans_->GetTau() << ", Rmax/r[N-1]: " << Rmax_/vrk[Nmax_-1] << endl; r_8 rNm1 = vrk[Nmax_-1]; //pedestrian computation ... ... @@ -183,7 +202,7 @@ void Laguerre2Bessel::Synthesis(const vector< complex >& FBlmp, r_8 rk_red = vrk[k]/rNm1; for(int l=0;l >& FBlmp, for(int p=0;p >& FBlmp, }//loop on k //from Almk to Fijk with libsharp int Ntot3DPix = Npix_*Nmax_; fijk.resize(Ntot3DPix); //Not used for the moment fijk.resize(Ntot3DPix); int off7n, off7k; //perform the synthesis per shell ... ...
 ... ... @@ -33,8 +33,6 @@ #include "lagsht_spheregeom.h" #include "lagsht_bessel.h" #include "quadinteg.h" using namespace std; namespace LagSHT { ... ... @@ -88,19 +86,6 @@ private: */ void ComputeJInteg(); class IntFunc1D : public ClassFunc1D { public: IntFunc1D(int l, r_8 klp,LaguerreFuncQuad* Ln): l_(l),klp_(klp),Ln_(Ln) {} virtual double operator()(double x) const { return (x*x)*(Bessel::jn(l_,x*klp_))*Ln_->Value(x); } virtual ~IntFunc1D() {} private: int l_; r_8 klp_; LaguerreFuncQuad* Ln_; //no ownership };//class IntFunc1D protected: BaseGeometry* sphere_; // Jlnp_; //!< the Bessel-Laguerre scalar product ... ...
 ... ... @@ -208,6 +208,7 @@ void LaguerreTransform::MultiSynthesis(const vector< complex >& fn, #if CBLAS cblas_dgemm (CblasColMajor, CblasNoTrans, CblasTrans, 2*stride, N_, N_, 1., (double*)(&fn), 2*stride, &LnkMtx, N_, 0, (double *)(&fi), 2*stride); #else cout << "CBLAS desactivated................" << endl; vector > vtmp(N_); for (int l=0; l
This diff is collapsed.
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!