44 subroutine calctensorfr(TF,TFuv,TFerr,MomVec,MomInv,masses2,rmax)
46 integer,
intent(in) :: rmax
47 double complex,
intent(in) :: MomVec(0:3,5), masses2(0:5), MomInv(15)
48 double complex,
intent(out) :: TF(0:rmax,0:rmax,0:rmax,0:rmax)
49 double complex,
intent(out) :: TFuv(0:rmax,0:rmax,0:rmax,0:rmax)
50 double precision,
intent(out) :: TFerr(0:rmax)
51 double complex :: CFuv(0:rmax/2,0:rmax,0:rmax,0:rmax,0:rmax,0:rmax)
52 double complex,
allocatable :: TFaux(:,:,:,:), CFuvaux(:,:,:,:,:,:)
53 double precision,
allocatable :: TFerraux(:)
54 double complex :: x(41)
55 double complex,
allocatable :: fct(:)
56 integer :: r,n0,n1,n2,n3,n4,n5,i,rank,bino,cnt
57 logical :: nocalc,wrica
60 if (tenred_cll.gt.6)
then
61 if (erroutlev_cll.ge.1)
then
62 write(nerrout_cll,*)
'inconsistent call of CalcTensorFr'
67 if (use_cache_system)
then
68 if ((ncache.gt.0).and.(ncache.le.ncache_max))
then
73 x(22+(i-1)*4:21+i*4) = momvec(0:3,i)
78 allocate(fct(rts(rmax)+ncoefs(rmax-8,6)+rmax+1))
79 call readcache(fct,rts(rmax)+ncoefs(rmax-8,6)+rmax+1,x,41,10+mode_cll,0,6,rank,nocalc,wrica)
81 allocate(fct(rts(rmax)+rmax+1))
82 call readcache(fct,rts(rmax)+rmax+1,x,41,10+mode_cll,0,6,rank,nocalc,wrica)
93 tf(n0,n1,n2,n3) = fct(cnt)
102 do n4=0,r-2*n0-n1-n2-n3
103 n5 = r-2*n0-n1-n2-n3-n4
105 cfuv(n0,n1,n2,n3,n4,n5) = fct(cnt)
113 tferr(r) = real(fct(cnt))
123 if(rank.eq.rmax)
then
136 fct(cnt) = tf(n0,n1,n2,n3)
145 do n4=0,r-2*n0-n1-n2-n3
146 n5 = r-2*n0-n1-n2-n3-n4
149 fct(cnt) = cfuv(n0,n1,n2,n3,n4,n5)
161 call writecache(fct,rts(rank)+ncoefs(rank-8,6)+rank+1,0,6,rank)
163 call writecache(fct,rts(rank)+rank+1,0,6,rank)
169 if (rmax.ge.8)
call calctensorfuv(tfuv,cfuv(0:rmax/2,0:rmax,0:rmax,0:rmax,0:rmax,0:rmax),momvec,rmax)
174 allocate(tfaux(0:rank,0:rank,0:rank,0:rank))
175 allocate(cfuvaux(0:rank/2,0:rank,0:rank,0:rank,0:rank,0:rank))
176 allocate(tferraux(0:rank))
178 call calctensorfrred(tfaux,cfuvaux,tferraux,momvec,mominv,masses2,rank)
184 allocate(fct(rts(rank)+ncoefs(rank-8,6)+rank+1))
186 allocate(fct(rts(rank)+rank+1))
195 fct(cnt) = tfaux(n0,n1,n2,n3)
204 do n4=0,r-2*n0-n1-n2-n3
205 n5 = r-2*n0-n1-n2-n3-n4
208 fct(cnt) = cfuvaux(n0,n1,n2,n3,n4,n5)
216 fct(cnt) = tferraux(r)
220 call writecache(fct,rts(rank)+ncoefs(rank-8,6)+rank+1,0,6,rank)
222 call writecache(fct,rts(rank)+rank+1,0,6,rank)
227 tf = tfaux(0:rmax,0:rmax,0:rmax,0:rmax)
229 if (rmax.ge.8)
call calctensorfuv(tfuv,cfuvaux(0:rmax/2,0:rmax,0:rmax,0:rmax,0:rmax,0:rmax),momvec,rmax)
230 tferr = tferraux(0:rmax)
239 allocate(cfuvaux(0:rmax/2,0:rmax,0:rmax,0:rmax,0:rmax,0:rmax))
261 integer,
intent(in) :: rmax
262 double complex,
intent(in) :: MomVec(0:3,5), masses2(0:5), MomInv(15)
263 double complex,
intent(out) :: TF(0:rmax,0:rmax,0:rmax,0:rmax)
264 double precision,
intent(out) :: TFerr(0:rmax)
265 double complex,
intent(out) :: CFuv(0:rmax/2,0:rmax,0:rmax,0:rmax,0:rmax,0:rmax)
266 double complex,
allocatable :: TE(:,:,:,:,:), TE_0aux(:,:,:,:)
267 double complex,
allocatable :: TEuv(:,:,:,:,:), TEuv_0aux(:,:,:,:)
268 double precision,
allocatable :: TEerr(:,:)
269 double precision :: p1max
270 double complex,
allocatable :: CE(:,:,:,:,:), CEuv(:,:,:,:,:), CE0uv(:,:,:,:,:,:)
271 double precision,
allocatable :: CEerr(:)
272 double complex :: MomVecE(0:3,4), masses2E(0:4), MomInvE(10)
273 double complex :: q10,q21,q32,q43,q54,q50,q20,q31,q42,q53,q40
274 double complex :: q51,q30,q41,q52,mm02,mm12,mm22,mm32,mm42,mm52,ff(5)
275 double complex :: mx(0:5,0:5), mxinv(0:5,0:5),mx0k(5,5),mx0kinv(5,5),mxinvP(5,0:3)
276 double complex :: mxinvs,mxinvPs(0:3)
277 double complex :: det,newdet
278 double complex :: Smod, Faux(5), elimminf2_coli,chdet,P1ten
279 integer :: r,n0,n1,n2,n3,n4,n5,np0,np1,np2,np3,k,i,j,kbest,rmaxE,mu,combi,nid(0:4),bin
283 mm02 = elimminf2_coli(masses2(0))
284 mm12 = elimminf2_coli(masses2(1))
285 mm22 = elimminf2_coli(masses2(2))
286 mm32 = elimminf2_coli(masses2(3))
287 mm42 = elimminf2_coli(masses2(4))
288 mm52 = elimminf2_coli(masses2(5))
289 q10 = elimminf2_coli(mominv(1))
290 q21 = elimminf2_coli(mominv(2))
291 q32 = elimminf2_coli(mominv(3))
292 q43 = elimminf2_coli(mominv(4))
293 q54 = elimminf2_coli(mominv(5))
294 q50 = elimminf2_coli(mominv(6))
295 q20 = elimminf2_coli(mominv(7))
296 q31 = elimminf2_coli(mominv(8))
297 q42 = elimminf2_coli(mominv(9))
298 q53 = elimminf2_coli(mominv(10))
299 q40 = elimminf2_coli(mominv(11))
300 q51 = elimminf2_coli(mominv(12))
301 q30 = elimminf2_coli(mominv(13))
302 q41 = elimminf2_coli(mominv(14))
303 q52 = elimminf2_coli(mominv(15))
305 ff(1) = q10+mm02-mm12
306 ff(2) = q20+mm02-mm22
307 ff(3) = q30+mm02-mm32
308 ff(4) = q40+mm02-mm42
309 ff(5) = q50+mm02-mm52
313 mx(1,0) = q10 - mm12 + mm02
314 mx(2,0) = q20 - mm22 + mm02
315 mx(3,0) = q30 - mm32 + mm02
316 mx(4,0) = q40 - mm42 + mm02
317 mx(5,0) = q50 - mm52 + mm02
320 mx(2,1) = q10+q20-q21
321 mx(3,1) = q10+q30-q31
322 mx(4,1) = q10+q40-q41
323 mx(5,1) = q10+q50-q51
327 mx(3,2) = q20+q30-q32
328 mx(4,2) = q20+q40-q42
329 mx(5,2) = q20+q50-q52
334 mx(4,3) = q30+q40-q43
335 mx(5,3) = q30+q50-q53
341 mx(5,4) = q40+q50-q54
349 call chinv(6,mx,mxinv)
355 mx0k(i,j) = mx(i,j-1)
367 newdet = chdet(5,mx0k)
368 if (abs(newdet).gt.abs(det))
then
377 mx0k(i,kbest) = mx(i,0)
380 call chinv(5,mx0k,mx0kinv)
382 mx0kinv(kbest,i) = 0d0
385 mxinvs = sum(mxinv(0:5,0))
388 rmaxe = max(rmax-1,0)
389 allocate(ce0uv(0:rmaxe/2,0:rmaxe,0:rmaxe,0:rmaxe,0:rmaxe,0:rmaxe))
390 allocate(ce(0:rmaxe/2,0:rmaxe,0:rmaxe,0:rmaxe,0:rmaxe))
391 allocate(ceuv(0:rmaxe/2,0:rmaxe,0:rmaxe,0:rmaxe,0:rmaxe))
392 allocate(ceerr(0:rmaxe))
393 allocate(te(0:rmaxe,0:rmaxe,0:rmaxe,0:rmaxe,0:5))
394 allocate(te_0aux(0:rmaxe,0:rmaxe,0:rmaxe,0:rmaxe))
395 allocate(teuv(0:rmaxe,0:rmaxe,0:rmaxe,0:rmaxe,0:5))
396 allocate(teuv_0aux(0:rmaxe,0:rmaxe,0:rmaxe,0:rmaxe))
397 allocate(teerr(0:5,0:rmaxe))
401 call e_main_cll(ce(:,:,:,:,:),ce0uv(:,0,:,:,:,:), &
402 mominve(1),mominve(2),mominve(3),mominve(4),mominve(5),mominve(6), &
403 mominve(7),mominve(8),mominve(9),mominve(10),masses2e(0),masses2e(1), &
404 masses2e(2),masses2e(3),masses2e(4),rmaxe,eerr2=ceerr,id_in=1)
405 call calctensore(te_0aux(:,:,:,:),teuv_0aux(:,:,:,:),teerr(0,0:), &
406 ce(:,:,:,:,:),ce0uv(:,0,:,:,:,:),ceerr,submomvec(6,0,momvec),rmaxe)
416 do np3=0,r-np0-np1-np2
418 p1ten = (-momvec(0,1))**np0*(-momvec(1,1))**np1* &
419 (-momvec(2,1))**np2*(-momvec(3,1))**np3
421 do n0=0,r-np0-np1-np2-np3
422 do n1=0,r-np0-np1-np2-np3-n0
423 do n2=0,r-np0-np1-np2-np3-n0-n1
424 n3 = r-np0-np1-np2-np3-n0-n1-n2
426 combi = binomtable(n0,n0+np0)*binomtable(n1,n1+np1)* &
427 binomtable(n2,n2+np2)*binomtable(n3,n3+np3)
429 te(np0+n0,np1+n1,np2+n2,np3+n3,0) = te(np0+n0,np1+n1,np2+n2,np3+n3,0) &
430 + combi*te_0aux(n0,n1,n2,n3)*p1ten
446 do n3=0,rmaxe-n1-n2-6
447 do n4=0,rmaxe-n1-n2-n3-6
448 do n5=0,rmaxe-n1-n2-n3-n4-6
449 n0 = (rmaxe-n1-n2-n3-n4-n5)/2
450 ce0uv(0:n0,n1,n2,n3,n4,n5) = -ce0uv(0:n0,n1-1,n2,n3,n4,n5)-ce0uv(0:n0,n1-1,n2+1,n3,n4,n5) &
451 -ce0uv(0:n0,n1-1,n2,n3+1,n4,n5)-ce0uv(0:n0,n1-1,n2,n3,n4+1,n5) &
452 -ce0uv(0:n0,n1-1,n2,n3,n4,n5+1)
460 p1max = maxval(abs(momvec(0:3,1)))
463 teerr(0,r) = max(teerr(0,i),teerr(0,r-i)*p1max**i)
471 call e_main_cll(ce,ceuv,mominve(1),mominve(2),mominve(3),mominve(4),mominve(5),mominve(6), &
472 mominve(7),mominve(8),mominve(9),mominve(10),masses2e(0),masses2e(1), &
473 masses2e(2),masses2e(3),masses2e(4),rmaxe,eerr2=ceerr,id_in=2**i)
474 call calctensore(te(:,:,:,:,i),teuv(:,:,:,:,i),teerr(i,0:), &
475 ce,ceuv,ceerr,submomvec(6,i,momvec),rmaxe)
481 cfuv(0:min(rmax/2,3),:,:,:,:,:) = 0d0
488 do n4=0,r-2*n0-n1-n2-n3
489 n5 = r-2*n0-n1-n2-n3-n4
491 cfuv(n0,n1,n2,n3,n4,n5) = (ce0uv(n0-1,n1,n2,n3,n4,n5) &
492 + 2*masses2(0)*cfuv(n0-1,n1,n2,n3,n4,n5) &
493 + ff(1)*cfuv(n0-1,n1+1,n2,n3,n4,n5) &
494 + ff(2)*cfuv(n0-1,n1,n2+1,n3,n4,n5) &
495 + ff(3)*cfuv(n0-1,n1,n2,n3+1,n4,n5) &
496 + ff(4)*cfuv(n0-1,n1,n2,n3,n4+1,n5) &
497 + ff(5)*cfuv(n0-1,n1,n2,n3,n4,n5+1))/ (2*(r-3))
508 tf(0,0,0,0) = -mxinv(0,0)*te(0,0,0,0,0)
510 tf(0,0,0,0) = tf(0,0,0,0) + mxinv(i,0)*(te(0,0,0,0,i)-te(0,0,0,0,0))
512 tferr(0) = max( abs(mxinvs)*teerr(0,0), &
513 abs(mxinv(1,0))*teerr(1,0) , &
514 abs(mxinv(2,0))*teerr(2,0) , &
515 abs(mxinv(3,0))*teerr(3,0) , &
516 abs(mxinv(4,0))*teerr(4,0) , &
517 abs(mxinv(5,0))*teerr(5,0) )
523 mxinvp(i,mu) = mxinvp(i,mu) + mx0kinv(j,i)*momvec(mu,j)
526 mxinvps(mu) = sum(mxinvp(1:5,mu))
540 smod = te(n0-1,n1,n2,n3,i) - te(n0-1,n1,n2,n3,0)
541 tf(n0,n1,n2,n3) = tf(n0,n1,n2,n3) + mxinvp(i,0)*smod
543 else if (n1.ge.1)
then
545 smod = te(n0,n1-1,n2,n3,i) - te(n0,n1-1,n2,n3,0)
546 tf(n0,n1,n2,n3) = tf(n0,n1,n2,n3) + mxinvp(i,1)*smod
548 else if (n2.ge.1)
then
550 smod = te(n0,n1,n2-1,n3,i) - te(n0,n1,n2-1,n3,0)
551 tf(n0,n1,n2,n3) = tf(n0,n1,n2,n3) + mxinvp(i,2)*smod
555 smod = te(n0,n1,n2,n3-1,i) - te(n0,n1,n2,n3-1,0)
556 tf(n0,n1,n2,n3) = tf(n0,n1,n2,n3) + mxinvp(i,3)*smod
564 tferr(r) = max(maxval(abs(mxinvps(0:3)))*teerr(0,r-1), &
565 maxval(abs(mxinvp(1,0:3)))*teerr(1,r-1), &
566 maxval(abs(mxinvp(2,0:3)))*teerr(2,r-1), &
567 maxval(abs(mxinvp(3,0:3)))*teerr(3,r-1))
585 integer,
intent(in) :: rmax
586 double complex,
intent(in) :: MomVec(0:3,5), masses2(0:5), MomInv(15)
587 double complex,
intent(out) :: TF(RtS(rmax)), TFuv(RtS(rmax))
588 double precision,
intent(out) :: TFerr(0:rmax)
589 double complex :: TF_aux(0:rmax,0:rmax,0:rmax,0:rmax)
590 double complex :: TFuv_aux(0:rmax,0:rmax,0:rmax,0:rmax)
593 call calctensorfr(tf_aux,tfuv_aux,tferr,momvec,mominv,masses2,rmax)
596 tf(mu) = tf_aux(lorindtab(0,mu),lorindtab(1,mu),lorindtab(2,mu),lorindtab(3,mu))
601 tfuv(mu) = tfuv_aux(lorindtab(0,mu),lorindtab(1,mu),lorindtab(2,mu),lorindtab(3,mu))
616 recursive subroutine calctensortnr(TN,TNuv,TNerr,MomVec,MomInv,masses2,N,rmax,id,CNuv)
618 integer,
intent(in) :: n,rmax,id
619 double complex,
intent(in) :: momvec(0:3,n-1), masses2(0:n-1)
620 double complex,
intent(in) :: mominv(binomtable(2,n))
621 double complex,
intent(out) :: tn(0:rmax,0:rmax,0:rmax,0:rmax)
622 double complex,
intent(out) :: tnuv(0:rmax,0:rmax,0:rmax,0:rmax)
623 double complex,
intent(out),
optional :: cnuv(binomtable(rmax-2*n+4,max(rmax-n+2,0)),n-2:rmax/2,2*n-4:rmax)
624 double complex :: cnuvaux0(binomtable(max(rmax-2*n+4,0),max(rmax-n+2,0)),n-2:max(rmax/2,n-2),2*n-4:max(rmax,2*n-4))
625 double precision,
intent(out) :: tnerr(0:rmax)
626 double complex,
allocatable :: tnaux(:,:,:,:),tnuvaux(:,:,:,:)
627 double precision,
allocatable :: tnerraux(:),cnerr(:)
628 double complex :: x(binomtable(2,n)+n+4*(n-1))
629 double complex,
allocatable :: fct(:),cn(:),cnuvaux1(:),cnuvaux2(:,:,:)
630 integer :: r,n0,n1,n2,n3,n4,i,rank,bino,cnt,cntc
631 logical :: nocalc,wrica
633 if ((use_cache_system).and.(n.ge.tencache))
then
634 if ((ncache.gt.0).and.(ncache.le.ncache_max))
then
637 x((i-1)*4+1:i*4) = momvec(0:3,i)
639 bino = binomtable(2,n)
640 x(4*n-3:bino+4*n-4) = mominv
641 x(4*n-3+bino:bino+5*n-4) = masses2
644 if (rmax.ge.2*n-4)
then
645 allocate(fct(rts(rmax)+ncoefs(rmax-2*n+4,n)+rmax+1))
646 call readcache(fct,rts(rmax)+ncoefs(rmax-2*n+4,n)+rmax+1,x,bino+5*n-4,mode_cll+10,id,n,rank,nocalc,wrica)
648 allocate(fct(rts(rmax)+rmax+1))
649 call readcache(fct,rts(rmax)+rmax+1,x,bino+5*n-4,mode_cll+10,id,n,rank,nocalc,wrica)
660 tn(n0,n1,n2,n3) = fct(cnt)
667 do i=1,binomtable(r-2*n0,max(n+r-2*n0-2,0))
668 cnuvaux0(i,n0,r) = fct(cnt)
674 do i=1,binomtable(r-2*n0,max(n+r-2*n0-2,0))
675 cnuv(i,n0,r) = fct(cnt)
680 tnerr(r) = real(fct(cnt))
685 if(rmax.ge.2*n-4)
then
687 n-2:rmax/2,2*n-4:rmax),momvec,n,rmax)
696 if(rank.eq.rmax)
then
698 if (n.eq.tenred_cll-1)
then
699 allocate(cn(ncoefs(rank,n)))
700 allocate(cnuvaux1(ncoefs(rank,n)))
701 allocate(cnerr(0:rank))
702 allocate(tnuvaux(0:rank,0:rank,0:rank,0:rank))
703 call tn_cll(cn,cnuvaux1,mominv,masses2,n,rank,tnerr2=cnerr,id_in=id)
704 call calctensortn(tn,tnuv,tnerr,cn,cnuvaux1,cnerr,momvec,n,rank)
705 if((id.ne.0).and.(rmax.ge.2*n-4))
then
707 cnt = ncoefs(r-1,n)+1
709 do i=1,binomtable(r-2*n0,max(n+r-2*n0-2,0))
710 cnuv(i,n0,r) = cnuvaux1(cnt)
717 if(rank.ge.2*n-4)
then
738 fct(cnt) = tn(n0,n1,n2,n3)
743 if(n.eq.tenred_cll-1)
then
744 do i=ncoefs(r-2*n+3,n)+1,ncoefs(r-2*n+4,n)
746 fct(cnt) = cnuvaux1(i)
751 do i=1,binomtable(r-2*n0,max(n+r-2*n0-2,0))
753 fct(cnt) = cnuvaux0(i,n0,r)
758 do i=1,binomtable(r-2*n0,max(n+r-2*n0-2,0))
760 fct(cnt) = cnuv(i,n0,r)
773 if(rank.ge.2*n-4)
then
774 call writecache(fct,rts(rank)+ncoefs(rank-2*n+4,n)+rank+1,id,n,rank)
776 call writecache(fct,rts(rank)+rank+1,id,n,rank)
784 allocate(tnaux(0:rank,0:rank,0:rank,0:rank))
785 allocate(tnerraux(0:rank))
787 if (n.eq.tenred_cll-1)
then
788 allocate(cn(ncoefs(rank,n)))
789 allocate(cnuvaux1(ncoefs(rank,n)))
790 allocate(cnerr(0:rank))
791 allocate(tnuvaux(0:rank,0:rank,0:rank,0:rank))
792 call tn_cll(cn,cnuvaux1,mominv,masses2,n,rank,tnerr2=cnerr,id_in=id)
793 call calctensortn(tnaux,tnuvaux,tnerraux,cn,cnuvaux1,cnerr,momvec,n,rank)
795 tnuv = tnuvaux(0:rmax,0:rmax,0:rmax,0:rmax)
796 else if(rmax.ge.2*n-4)
then
798 cnt = ncoefs(r-1,n)+1
800 do i=1,binomtable(r-2*n0,max(n+r-2*n0-2,0))
801 cnuv(i,n0,r) = cnuvaux1(cnt)
808 if(rank.ge.2*n-4)
then
809 allocate(cnuvaux2(binomtable(rank-2*n+4,max(rank-n+2,0)),n-2:rank/2,2*n-4:rank))
810 call calctensortnrred(tnaux,tnerraux,momvec,mominv,masses2,n,rank,id,cnuvaux2)
814 n-2:rmax/2,2*n-4:rmax),momvec,n,rmax)
816 cnuv(1:binomtable(rmax-2*n+4,max(rmax-n+2,0)),n-2:rmax/2,2*n-4:rmax) = &
817 cnuvaux2(1:binomtable(rmax-2*n+4,max(rmax-n+2,0)),n-2:rmax/2,2*n-4:rmax)
829 if(rank.ge.2*n-4)
then
830 allocate(fct(rts(rank)+ncoefs(rank-2*n+4,n)+rank+1))
832 allocate(fct(rts(rank)+rank+1))
840 fct(cnt) = tnaux(n0,n1,n2,n3)
845 if(n.eq.tenred_cll-1)
then
846 do i=ncoefs(r-2*n+3,n)+1,ncoefs(r-2*n+4,n)
848 fct(cnt) = cnuvaux1(i)
852 do i=1,binomtable(r-2*n0,max(n+r-2*n0-2,0))
854 fct(cnt) = cnuvaux2(i,n0,r)
861 fct(cnt) = tnerraux(r)
865 if(rank.ge.2*n-4)
then
866 call writecache(fct,rts(rank)+ncoefs(rank-2*n+4,n)+rank+1,id,n,rank)
868 call writecache(fct,rts(rank)+rank+1,id,n,rank)
873 tn = tnaux(0:rmax,0:rmax,0:rmax,0:rmax)
874 tnerr = tnerraux(0:rmax)
883 if (n.le.tenred_cll-1)
then
884 allocate(cn(ncoefs(rmax,n)))
885 allocate(cnuvaux1(ncoefs(rmax,n)))
886 allocate(cnerr(0:rmax))
887 call tn_cll(cn,cnuvaux1,mominv,masses2,n,rmax,tnerr2=cnerr,id_in=id)
888 call calctensortn(tn,tnuv,tnerr,cn,cnuvaux1,cnerr,momvec,n,rmax)
889 if((id.ne.0).and.(rmax.ge.2*n-4))
then
891 cnt = ncoefs(r-1,n)+1
893 do i=1,binomtable(r-2*n0,max(n+r-2*n0-2,0))
894 cnuv(i,n0,r) = cnuvaux1(cnt)
901 if(rmax.ge.2*n-4)
then
926 recursive subroutine calctensortnrred(TN,TNerr,MomVec,MomInv,masses2,N,rmax,id,CNuv)
928 integer,
intent(in) :: n,rmax,id
929 double complex,
intent(in) :: momvec(0:3,n-1), masses2(0:n-1)
930 double complex,
intent(in) :: mominv(binomtable(2,n))
931 double complex,
intent(out) :: tn(0:rmax,0:rmax,0:rmax,0:rmax)
932 double complex,
intent(out),
optional :: cnuv(binomtable(rmax-2*n+4,max(rmax-n+2,0)),n-2:rmax/2,2*n-4:rmax)
933 double precision,
intent(out) :: tnerr(0:rmax)
934 double complex,
allocatable :: tnm1(:,:,:,:,:),tnm1_0aux(:,:,:,:)
935 double complex,
allocatable :: tnm1uv_0aux(:,:,:,:)
936 double complex,
allocatable :: cnm1uv_0(:,:,:),cnm1uv_0aux(:,:,:),cnm1uv_i(:,:,:)
937 double precision,
allocatable :: tnm1err(:,:)
938 double precision :: p1max
939 double complex :: q10,q21,q32,q43,q54,q50,q20,q31,q42,q53,q40
940 double complex :: q51,q30,q41,q52,mm02,mm12,mm22,mm32,mm42,mm52
941 double complex :: mx(0:5,0:5), mxinv(0:5,0:5),mx0k(5,5),mx0kinv(5,5)
942 double complex :: det,newdet,ff(n-1)
943 double complex :: smod, elimminf2_coli,chdet,p1ten,mxinvp(5,0:3)
944 double complex :: mxinvs,mxinvps(0:3)
945 integer :: r,n0,n1,n2,n3,n4,n5,np0,np1,np2,np3,k,i,j,kbest,rmax_m1,combi,mu,cnt
946 integer :: bin,nid(0:5),r0,rbcd,mia,bino_0,bino_i,cind,mia1,mia2,mia3
950 mm02 = elimminf2_coli(masses2(0))
951 mm12 = elimminf2_coli(masses2(1))
952 mm22 = elimminf2_coli(masses2(2))
953 mm32 = elimminf2_coli(masses2(3))
954 mm42 = elimminf2_coli(masses2(4))
955 mm52 = elimminf2_coli(masses2(5))
956 q10 = elimminf2_coli(mominv(1))
957 q21 = elimminf2_coli(mominv(2))
958 q32 = elimminf2_coli(mominv(3))
959 q43 = elimminf2_coli(mominv(4))
960 q54 = elimminf2_coli(mominv(5))
962 q50 = elimminf2_coli(mominv((n-6)*n+6))
964 q50 = elimminf2_coli(mominv(4*n+1))
966 q20 = elimminf2_coli(mominv(n+1))
967 q31 = elimminf2_coli(mominv(n+2))
968 q42 = elimminf2_coli(mominv(n+3))
969 q53 = elimminf2_coli(mominv(n+4))
971 q40 = elimminf2_coli(mominv((n-5)*n+5))
972 q51 = elimminf2_coli(mominv((n-5)*n+6))
974 q40 = elimminf2_coli(mominv(3*n+1))
975 q51 = elimminf2_coli(mominv(3*n+2))
977 q30 = elimminf2_coli(mominv(2*n+1))
978 q41 = elimminf2_coli(mominv(2*n+2))
979 q52 = elimminf2_coli(mominv(2*n+3))
983 ff(i) = elimminf2_coli(mominv(cnt)) + mm02 &
984 - elimminf2_coli(masses2(i))
989 mx(1,0) = q10 - mm12 + mm02
990 mx(2,0) = q20 - mm22 + mm02
991 mx(3,0) = q30 - mm32 + mm02
992 mx(4,0) = q40 - mm42 + mm02
993 mx(5,0) = q50 - mm52 + mm02
996 mx(2,1) = q10+q20-q21
997 mx(3,1) = q10+q30-q31
998 mx(4,1) = q10+q40-q41
999 mx(5,1) = q10+q50-q51
1003 mx(3,2) = q20+q30-q32
1004 mx(4,2) = q20+q40-q42
1005 mx(5,2) = q20+q50-q52
1010 mx(4,3) = q30+q40-q43
1011 mx(5,3) = q30+q50-q53
1017 mx(5,4) = q40+q50-q54
1025 call chinv(6,mx,mxinv)
1030 mx0k(i,j) = mx(i,j-1)
1042 newdet = chdet(5,mx0k)
1043 if (abs(newdet).gt.abs(det))
then
1052 mx0k(i,kbest) = mx(i,0)
1055 call chinv(5,mx0k,mx0kinv)
1057 mx0kinv(kbest,i) = 0d0
1060 mxinvs = sum(mxinv(0:5,0))
1066 if (mod(id/bin,2).eq.0)
then
1074 rmax_m1 = max(rmax-1,0)
1075 bino_0 = binomtable(rmax_m1,n+rmax_m1-2)
1076 bino_i = binomtable(rmax_m1,n+rmax_m1-3)
1077 allocate(tnm1(0:rmax_m1,0:rmax_m1,0:rmax_m1,0:rmax_m1,0:5))
1078 allocate(tnm1_0aux(0:rmax_m1,0:rmax_m1,0:rmax_m1,0:rmax_m1))
1079 allocate(tnm1uv_0aux(0:rmax_m1,0:rmax_m1,0:rmax_m1,0:rmax_m1))
1080 allocate(tnm1err(0:5,0:rmax_m1))
1082 if(rmax_m1.ge.2*n-6)
then
1083 allocate(cnm1uv_0(bino_0,n-3:rmax/2,2*n-6:rmax))
1084 allocate(cnm1uv_0aux(bino_i,n-3:rmax_m1/2,2*n-6:rmax_m1))
1085 allocate(cnm1uv_i(bino_i,0:rmax_m1/2,0:rmax_m1))
1086 call calctensortnr(tnm1_0aux(:,:,:,:),tnm1uv_0aux,tnm1err(0,0:rmax_m1),submomvec(n,0,momvec),
submominv(n,0,mominv), &
1087 submasses(n,0,masses2),n-1,rmax_m1,nid(0),cnm1uv_0aux)
1089 call calctensortnr(tnm1(:,:,:,:,i),tnm1uv_0aux,tnm1err(i,0:rmax_m1),submomvec(n,i,momvec),
submominv(n,i,mominv), &
1090 submasses(n,i,masses2),n-1,rmax_m1,nid(i),cnm1uv_i)
1093 call calctensortnr(tnm1_0aux(:,:,:,:),tnm1uv_0aux,tnm1err(0,0:rmax_m1),submomvec(n,0,momvec), &
1096 call calctensortnr(tnm1(:,:,:,:,i),tnm1uv_0aux,tnm1err(i,0:rmax_m1),submomvec(n,i,momvec), &
1102 tnm1(:,:,:,:,0) = 0d0
1109 do np3=0,r-np0-np1-np2
1111 p1ten = (-momvec(0,1))**np0*(-momvec(1,1))**np1* &
1112 (-momvec(2,1))**np2*(-momvec(3,1))**np3
1114 do n0=0,r-np0-np1-np2-np3
1115 do n1=0,r-np0-np1-np2-np3-n0
1116 do n2=0,r-np0-np1-np2-np3-n0-n1
1117 n3 = r-np0-np1-np2-np3-n0-n1-n2
1119 combi = binomtable(n0,n0+np0)*binomtable(n1,n1+np1)* &
1120 binomtable(n2,n2+np2)*binomtable(n3,n3+np3)
1122 tnm1(np0+n0,np1+n1,np2+n2,np3+n3,0) = tnm1(np0+n0,np1+n1,np2+n2,np3+n3,0) &
1123 + combi*tnm1_0aux(n0,n1,n2,n3)*p1ten
1136 p1max = maxval(abs(momvec(0:3,1)))
1139 tnm1err(0,r) = max(tnm1err(0,i),tnm1err(0,r-i)*p1max**i)
1144 tn(0,0,0,0) = -mxinv(0,0)*tnm1(0,0,0,0,0)
1146 tn(0,0,0,0) = tn(0,0,0,0) + mxinv(i,0)*(tnm1(0,0,0,0,i)-tnm1(0,0,0,0,0))
1148 tnerr(0) = max( abs(mxinvs)*tnm1err(0,0), &
1149 abs(mxinv(1,0))*tnm1err(1,0) , &
1150 abs(mxinv(2,0))*tnm1err(2,0) , &
1151 abs(mxinv(3,0))*tnm1err(3,0) , &
1152 abs(mxinv(4,0))*tnm1err(4,0) , &
1153 abs(mxinv(5,0))*tnm1err(5,0) )
1159 mxinvp(i,mu) = mxinvp(i,mu) + mx0kinv(j,i)*momvec(mu,j)
1162 mxinvps(mu) = sum(mxinvp(1:5,mu))
1170 if(rmax.ge.2*n-4)
then
1173 cnm1uv_0(1,n0,2*n0) = cnm1uv_0aux(1,n0,2*n0)
1175 mia1 = binomtable(r-1,n+r-3)+1
1176 mia2 = binomtable(r,n+r-3)
1177 mia3 = binomtable(r,n+r-2)
1178 cnm1uv_0(mia1:mia3,n0,r+2*n0) = cnm1uv_0aux(1:mia2,n0,r+2*n0)
1183 do i=binomtable(r-2*n0-1,n+r-2*n0-3),1,-1
1184 cnm1uv_0(i,n0,r) = -cnm1uv_0(i,n0,r-1)
1186 cnm1uv_0(i,n0,r) = cnm1uv_0(i,n0,r) &
1187 - cnm1uv_0(addtocind(j,i,r-2*n0-1,n-1),n0,r)
1195 do cind=1,binomtable(r-2*n0,n+r-2*n0-2)
1197 cnuv(cind,n0,r) = cnm1uv_0(cind,n0-1,r-2)
1199 cnuv(cind,n0,r) = cnuv(cind,n0,r) + 2*mm02*cnuv(cind,n0-1,r-2)
1201 cnuv(cind,n0,r) = cnuv(cind,n0,r) &
1202 + ff(i)*cnuv(addtocind(i,cind,r-2*n0,n-1),n0-1,r-1)
1205 cnuv(cind,n0,r) = cnuv(cind,n0,r)/(2*(r+3-n))
1220 smod = tnm1(n0-1,n1,n2,n3,i) - tnm1(n0-1,n1,n2,n3,0)
1221 tn(n0,n1,n2,n3) = tn(n0,n1,n2,n3) + mxinvp(i,0)*smod
1223 else if (n1.ge.1)
then
1225 smod = tnm1(n0,n1-1,n2,n3,i) - tnm1(n0,n1-1,n2,n3,0)
1226 tn(n0,n1,n2,n3) = tn(n0,n1,n2,n3) + mxinvp(i,1)*smod
1228 else if (n2.ge.1)
then
1230 smod = tnm1(n0,n1,n2-1,n3,i) - tnm1(n0,n1,n2-1,n3,0)
1231 tn(n0,n1,n2,n3) = tn(n0,n1,n2,n3) + mxinvp(i,2)*smod
1235 smod = tnm1(n0,n1,n2,n3-1,i) - tnm1(n0,n1,n2,n3-1,0)
1236 tn(n0,n1,n2,n3) = tn(n0,n1,n2,n3) + mxinvp(i,3)*smod
1244 tnerr(r) = max(maxval(abs(mxinvps(0:3)))*tnm1err(0,r-1), &
1245 maxval(abs(mxinvp(1,0:3)))*tnm1err(1,r-1), &
1246 maxval(abs(mxinvp(2,0:3)))*tnm1err(2,r-1), &
1247 maxval(abs(mxinvp(3,0:3)))*tnm1err(3,r-1))
1265 integer,
intent(in) :: N,rmax
1266 double complex,
intent(in) :: MomVec(0:3,N-1), masses2(0:N-1)
1267 double complex,
intent(in) :: MomInv(BinomTable(2,N))
1268 double complex,
intent(out) :: TN(RtS(rmax)),TNuv(RtS(rmax))
1269 double precision,
intent(out) :: TNerr(0:rmax)
1270 double complex :: TN_aux(0:rmax,0:rmax,0:rmax,0:rmax)
1271 double complex :: TNuv_aux(0:rmax,0:rmax,0:rmax,0:rmax)
1274 call calctensortnr(tn_aux,tnuv_aux,tnerr,momvec,mominv,masses2,n,rmax,0)
1277 tn(mu) = tn_aux(lorindtab(0,mu),lorindtab(1,mu),lorindtab(2,mu),lorindtab(3,mu))
1280 if (calcuv_cll)
then
1282 tnuv(mu) = tnuv_aux(lorindtab(0,mu),lorindtab(1,mu),lorindtab(2,mu),lorindtab(3,mu))
1297 subroutine checktensors(TN,MomVec,MomInv,masses2,N,rmax,writeout,acc)
1299 integer,
intent(in) :: N,rmax,writeout
1300 double precision,
intent(in) :: acc
1301 double complex,
intent(in) :: TN(0:rmax,0:rmax,0:rmax,0:rmax)
1302 double complex,
intent(in) :: MomVec(0:3,N-1), MomInv(BinomTable(2,N)), masses2(0:N-1)
1303 double complex :: CoefsN(BinomTable(rmax,N+rmax-2),0:rmax/2,0:rmax)
1304 double complex :: CoefsNuv(BinomTable(rmax,N+rmax-2),0:rmax/2,0:rmax)
1305 double complex :: check1, check2, fac, Gram(N-1,N-1)
1306 integer,
allocatable :: pinds(:),loinds(:)
1307 integer :: struc1(0:N-1), struc2(0:N-1)
1308 integer :: r,n0,i,j,mu,mu0,sgn,tinds(0:3),cnt,nn0,ii
1309 double precision :: TNerr(0:rmax),TNerr2(0:rmax)
1311 call calctn(coefsn,coefsnuv,mominv,masses2,n,rmax,0,tnerr,tnerr2)
1317 gram(i,i) = mominv(cnt)
1324 gram(i,j) = (gram(i,i)+gram(j,j)-mominv(cnt))/2d0
1325 gram(j,i) = gram(i,j)
1334 if (
allocated(loinds))
then
1341 if (
allocated(pinds))
then
1344 allocate(pinds(r-2*n0))
1346 do i=1,binomtable(r-2*n0,r-2*n0+n-2)
1348 pinds = indcombiseq(1:r-2*n0,i,r-2*n0,n-1)
1351 struc1(1:n-1) = calccindarr(n-1,r-2*n0,i)
1362 loinds(j) = mod(mu0,4)
1363 tinds(loinds(j)) = tinds(loinds(j))+1
1368 sgn=(-1)**(r-tinds(0))
1370 select case (loinds(2*j)-loinds(2*j-1))
1372 if (loinds(2*j).ne.0)
then
1384 fac = fac*momvec(loinds(2*n0+j),pinds(j))
1387 check1 = check1 + sgn*fac*tn(tinds(0),tinds(1),tinds(2),tinds(3))
1399 struc1(1:n-1) = calccindarr(n-1,r-2*n0,i)
1402 do ii=1,binomtable(r-2*nn0,r-2*nn0+n-2)
1405 struc2(1:n-1) = calccindarr(n-1,r-2*nn0,ii)
1407 check2 = check2 + coefsn(ii,nn0,r)* &
1408 contractlostruc(n-1,struc1,struc2,gram)
1413 select case (writeout)
1416 if (abs(check1-check2)/abs(check2).gt.acc)
then
1417 write(ninfout_cll,*) struc1
1418 write(ninfout_cll,*)
'check1:', check1
1419 write(ninfout_cll,*)
'check2:', check2
1423 write(ninfout_cll,*) struc1
1424 write(ninfout_cll,*)
'check1:', check1
1425 write(ninfout_cll,*)
'check2:', check2
1556 integer,
intent(in) :: rmax, writeout
1557 double complex,
intent(in) :: T1(0:rmax,0:rmax,0:rmax,0:rmax)
1558 double complex,
intent(in) :: T2(0:rmax,0:rmax,0:rmax,0:rmax)
1559 double precision,
intent(in) :: acc
1560 integer :: r,n0,n1,n2,n3
1568 if (writeout.eq.1)
then
1569 if (abs(t1(n0,n1,n2,n3)-t2(n0,n1,n2,n3)).gt. &
1570 acc*abs(t1(n0,n1,n2,n3)+t2(n0,n1,n2,n3)))
then
1571 write(ninfout_cll,*) n0,n1,n2,n3
1572 write(ninfout_cll,*) t1(n0,n1,n2,n3), t2(n0,n1,n2,n3)