45 integer :: lmax_LUT = 0
47 integer :: Ntheta_LUT = 0
50 real(s2_dp),
dimension(:,:),
allocatable :: table_LUT
73 integer,
intent(in) :: lmax, ntheta
77 real(s2_dp) :: theta,dtheta
80 lut%Ntheta_LUT = ntheta
82 allocate(lut%table_LUT(1:lmax,0:ntheta-1))
84 dtheta = (pi - 0d0) /
Real(ntheta, s2_dp)
90 theta = theta + dtheta
111 character(len=S2_STRING_LEN),
intent(in) :: filename_lut
115 open(10,file=trim(filename_lut),form=
'unformatted',&
116 status=
'replace',action=
'write')
119 write(10) lut%lmax_LUT
120 write(10) lut%Ntheta_LUT
124 do itheta=0, (lut%Ntheta_LUT - 1)
125 write(10) lut%table_LUT(l,itheta)
149 integer,
intent(in) :: lmax,ntheta
150 character(len=S2_STRING_LEN) :: filename_lut
155 open(10,file=trim(filename_lut),form=
'unformatted',&
156 status=
'old',action=
'read')
158 read(10) lut%lmax_LUT
159 read(10) lut%Ntheta_LUT
160 allocate(lut%table_LUT(1:lmax,0:ntheta-1))
162 if(lmax .ne. lut%lmax_LUT)
then
164 'bianchi2_plm1table_getval')
166 elseif(ntheta .ne. lut%Ntheta_LUT)
then
168 'bianchi2_plm1table_getval')
172 do itheta=0, ntheta-1
173 read(10) lut%table_LUT(l,itheta)
199 integer,
intent(in) :: l, itheta
202 plm1 = lut%table_LUT(l,itheta)
220 if(
allocated(lut%table_LUT))
deallocate(lut%table_LUT)
246 real(s2_dp) :: plgndr, x
249 real(s2_dp) :: fact, pll, pmm, pmmp1, somx2
251 if(m<0 .or. m>l .or. abs(x)>1d0) stop
'bad arguments in plgndr'
255 somx2=sqrt((1.-x)*(1.+x))
270 pll=(x*(2*ll-1)*pmmp1-(ll+m-1)*pmm)/(ll-m)