#include #include #include #include #include #include "include.h" #include "interact.h" #include "spectrum.h" #include "extrapolate.h" /* This file was formerly a part of "extralaso.c" The following performs all of the necessary extrapolations in K and particle truncation. */ /* convert kt into real number. */ #define K_FLOAT(K) (GLUE_PERIODIC?0.5*(element) K:(element) K) #define PRINTMMA 0 /*Print eigenvalues in extrapolation routines in a Mathematica compatable format */ #define PRINTEXTRAP 0 /* flag for extrapolation routines to print fit*/ /* coefficients, associated value for the last sector, and sometimes goodness of fit */ /* The following subroutine is for extrapolating in K and p-truncation For the case of GLUE_PERIODIC, we give up and use 1/K since the convergence is so poor. */ void kpweights(element *w, integer *th, int nsects, specify_calculation *s, element linc){ int i; for(i=0; i1){ for(i=0; i1 || GLUE_PERIODIC)?1.0:0.5); (*th)++; } if(nsects>2 && (s[0].type==TYPE_GLUE || s[0].type==TYPE_SOURCE)){ for(i=0; i3){ for(i=0; i1 || GLUE_PERIODIC)?2.0:1.0); (*th)++; } #endif #if 0 /* We could get fancier and fancier, but we don't*/ if(nsects>4){ (*th)++; for(i=0; i -0.25){ fprintf(stderr,__FILE__": Bad value of *pextrap in extrapolate\n" " setting *pextrap=-0.25\n"); *pextrap=-0.25; } /* calculate weights used in extrapolation */ w=malloc(ns*ns*sizeof(doublereal)); kpweights(w,th,ns,s,*pextrap); *tval=realloc(*tval,*th*nval*sizeof(doublereal)); for(i=0; i< *th*nval; i++)(*tval)[i]=0.0; PSEUDOINVERSE(w,th,&ns); #if 1==0 /* debugging print */ printf(" extrapolate; beta=%f, c_p=%f weights =\n", beta,*pextrap); for(t=0; t2||(++k)%2==0)printf("\n "); } else printf("};\n"); #endif for(i=0; i3){ for(i=0; i1 || GLUE_PERIODIC)?1:0.5); w[i+2*nsects]=exp(linc*(element) s[i].nptrunc); /* for the new tau interactions, leading convergence is */ /* 1/kmax^5. */ w[i+3*nsects]=1.0/pow(kmax[i],5); } *th+=3; } if(nsects>4){ for(i=0; i1 || GLUE_PERIODIC)?2:1); (*th)++; } } /* fitting functions for transverse and longitudinal string tension Since these can later be used for other values of n or L, the form of the fit function must remain fixed. */ void wweights(element *w, integer *th, int nsects, int (*n)[HINDEX]){ int i; for(i=0; i4||wa1[0]>0.1){ fprintf(stderr,__FILE__": Error in pextrapolate lmdif info=%li\n",info); fprintf(stderr,__FILE__": c=%e\n",x[0]); if(wa1[0]>0.1){ fprintf(stderr,__FILE__": Bad fit in pextrapolate, RMS=%e," " setting c=-1\n",*wa1); return -1; } } #if PRINTEXTRAP printf(" pextrapolate %li sectors using %li parameter fit.\n x=(", ns,npar); for(i=0; i5)th=4; else if(*m>2)th=2; else{ fprintf(stderr,__FILE__": error in fcn2\n"); *iflag=-1; return SUBRETURN; } for(i=0; i<*m; i++){ w[i]=ww[i]=1.0; w[*m+i]=ww[*m+i]=exp(x[0]*ptrunc[i]); if(th==4){ w[*m*2+i]=ww[*m*2+i]=1.0/pkt[i]; w[*m*3+i]=ww[*m*3+i]=w[*m+i]*w[*m*2+i]; } } PSEUDOINVERSE(w,&th,m); for(j=0; j -0.25){ fprintf(stderr,__FILE__": Bad value of *pextrap in lextrapolate\n" " setting *pextrap=-0.25\n"); *pextrap=-0.25; } w=malloc(ns*ns*sizeof(doublereal)); kmaxweights(w,th,ns,s,kmaxlist,*pextrap); #if 0 /* debugging print */ printf("input matrix: "); for(t=0; t<*th * ns; t++){ if(t%(*th)==0)printf("\n "); printf(" %g",w[t]); } #endif PSEUDOINVERSE(w,th,&ns); *tval=realloc(*tval,*th*nval*sizeof(doublereal)); for(i=0; i< *th*nval;i++)(*tval)[i]=0.0; #if 0 /*debugging print */ printf(" lextrapolate exponential factor = %f weights =\n", *pextrap); for(t=0; t2||(++k)%2==0)printf("\n "); } else printf("};\n"); #endif for(j=0; j< *th; j++) for(i=0; i