00001 #ifndef __INCLUDE_MISC_CC
00002 #define __INCLUDE_MISC_CC
00003 #include "misc.h"
00004 #include "constants.h"
00005 #include "message.h"
00006
00007 bool Misc::comparestrings(char *s1,char *s2){
00008 int length1,length2,ic;
00009 bool answer;
00010 answer=0;
00011 length1=strlen(s1);
00012 length2=strlen(s2);
00013 if(length1==length2){
00014 answer=1;
00015 for(ic=0;ic<length1;ic++){
00016 if(s1[ic]!=s2[ic]){
00017 answer=0;
00018 return answer;
00019 }
00020 }
00021 }
00022 return answer;
00023 }
00024
00025 double Misc::triangle(double m0,double m1,double m2){
00026 double answer,m0sq,m1sq,m2sq;
00027 if(m0<m1+m2) {
00028 throw MESSAGE << "Disaster with triangle"<<ENDM_SEVERE;
00029 }
00030 m0sq=m0*m0;m1sq=m1*m1;m2sq=m2*m2;
00031 answer=m0sq*m0sq+m1sq*m1sq+m2sq*m2sq;
00032 answer=answer-2.0*(m0sq*m1sq+m0sq*m2sq+m1sq*m2sq);
00033 answer=answer/(4.0*m0sq);
00034 return answer;
00035 }
00036
00037 double Misc::GetRapidity(double *pa){
00038 return 0.5*log((pa[0]+pa[3])/(pa[0]-pa[3]));
00039 }
00040
00041 double Misc::GetDely(double *pa,double *pb){
00042 return GetRapidity(pa)-GetRapidity(pb);
00043 }
00044
00045 double Misc::GetQinv(double *pa, double *pb){
00046 double answer;
00047 answer=0;
00048 answer=pow(pa[1]-pb[1],2)+pow(pa[2]-pb[2],2)+pow(pa[3]-pb[3],2)-pow(pa[0]-pb[0],2);
00049 if(answer<0.0){
00050 throw MESSAGE << "DISASTER with GetQinv, wrong sign, = " <<answer<<ENDM_SEVERE;
00051 }
00052 return sqrt(answer);
00053 }
00054
00055 complex<double> Misc::cexp(complex<double> z){
00056 return exp(real(z))*ceiphi(imag(z));
00057 }
00058
00059 complex<double> Misc::ceiphi(double phi){
00060 return complex<double>(cos(phi),sin(phi));
00061 }
00062
00063 complex<double> Misc::cpow(complex<double> z,complex<double> a){
00064 complex<double> ci(0.0,1.0);
00065 double zr=real(z);
00066 double zi=imag(z);
00067 double phi=atan2(zi,zr);
00068 double zmag=sqrt(zr*zr+zi*zi);
00069 complex<double> alnz=a*(log(zmag)+ci*phi);
00070 return cexp(alnz);
00071 }
00072
00081 void Misc::lorentz(double *u,double *p,double *pprime){
00082 const int n[4]={1,0,0,0};
00083 const int g[4]={1,-1,-1,-1};
00084 int mu;
00085 double udotn=0.0,pdotn=0.0,pdotu=0.0;
00086
00087 for(mu=0;mu<4;mu++){
00088
00089 pdotn=pdotn+p[mu]*n[mu]*g[mu];
00090 pdotu=pdotu+p[mu]*u[mu]*g[mu];
00091 udotn=udotn+u[mu]*n[mu]*g[mu];
00092 }
00093 for(mu=0;mu<4;mu++){
00094 pprime[mu]=-((pdotu+pdotn)/(1.0+udotn))*(n[mu]+u[mu])+2*pdotn*u[mu]+p[mu];
00095 }
00096 }
00097
00098 int Misc::iround(double x){
00099 return int(floor(x+0.5));
00100 }
00101
00102
00103 double Misc::cgc(double j1,double m1,double j2,double m2,double J,double M){
00104 int sign=-1;
00105 if((lrint((M+j1-j2)))%2==0) sign=1;
00106 return sign*sqrt(2.0*J+1)
00107 *gsl_sf_coupling_3j(lrint(2*j1),lrint(2*j2),lrint(2*J),
00108 lrint(2*m1),lrint(2*m2),-lrint(2*M));
00109 }
00110
00111
00112
00113 double Misc::oldcgc(double j1,double m1,double j2,double m2,double j,double m){
00114
00115 if (fabs(m1+m2-m)>0.01) return 0.0;
00116 if (j1+j2<j) return 0.0;
00117 if (j+j1<j2) return 0.0;
00118 double p1,p2,p3,p4,p5,thesum = 0,ans;
00119 double z=0;
00120 if(m1 + m2 == m && m<=j && -j <=m){
00121 p1=(2*j+1)*cgc_fractorial((j1+j2-j),(j1+j2+j+1));
00122 p2=cgc_fractorial((j1-m1),(j1-j2+j));
00123 p3=cgc_fractorial((j2-m2),(j2-j1+j));
00124 p4=cgc_fractorial((j+m),(j1+m1));
00125 p5=cgc_fractorial((j-m),(j2+m2));
00126 for(z=0;z<=2*(j1+j2)+j;z++){
00127 if(j1-m1-z >=0 && j-m-z >=0 && j2-j+m1+z >=0 ){
00128 thesum = thesum +
00129 pow(-1,z+j1-m1)*cgc_fractorial(j1+m1+z,j1-m1-z)
00130 *cgc_fractorial(j2+j-m1-z,j-m-z)
00131 /(cgc_factorial(z)*cgc_factorial(j2-j+m1+z));
00132 }
00133 }
00134 ans = sqrt(p1*p2*p3*p4*p5) * thesum;
00135 return ans;
00136 }
00137 else return 0;
00138 }
00139
00140
00141 double Misc::cgc_factorial(double n){
00142 double i,j=1;
00143 for (i=1;i<=n;i++) j=j*i;
00144 return j;
00145 }
00146
00147 double Misc::cgc_fractorial(double n,double m){
00148 double i,j=1;
00149 if(n>m){
00150 for(i=m+1;i<n+1;i++){j=j*i;}
00151 return j;
00152 }
00153 if(n<m){
00154 for(i=n+1;i<m+1;i++){j=j*i;}
00155 return 1/j;
00156 }
00157 return 1;
00158 }
00159
00160 int Misc::cgc_delta (int x, int y) {if (x==y) return 1; else return 0;}
00161
00162 void Misc::outsidelong(double *pa,double *pb, double &qinv, double &qout, double &qside, double &qlong){
00163 double vs,gamma,ptot[4],q[4],qtemp,ptot_perp;
00164 int alpha;
00165 for(alpha=0;alpha<4;alpha++){
00166 q[alpha]=0.5*(pa[alpha]-pb[alpha]);
00167 ptot[alpha]=pa[alpha]+pb[alpha];
00168 }
00169
00170
00171 vs=ptot[3]/ptot[0];
00172 gamma=1.0/sqrt(1.0-vs*vs);
00173 ptot[0]=gamma*(ptot[0]-vs*ptot[3]);
00174 ptot[3]=0.0;
00175 qtemp=q[3];
00176 q[3]=gamma*(q[3]-vs*q[0]);
00177 q[0]=gamma*(q[0]-vs*qtemp);
00178
00179 ptot_perp=sqrt(ptot[1]*ptot[1]+ptot[2]*ptot[2]);
00180 qout=(q[1]*ptot[1]+q[2]*ptot[2])/ptot_perp;
00181 qside=sqrt(q[2]*ptot[1]-q[1]*ptot[2])/ptot_perp;
00182 qlong=q[3];
00183
00184 vs=ptot_perp/ptot[0];
00185 gamma=1.0/sqrt(1.0-vs*vs);
00186 qout=gamma*(qout-vs*q[0]);
00187
00188 }
00189
00190 void Misc::Pause(){
00191 double pausedummy;
00192 printf("PAUSED, enter anything to continue: ");
00193 scanf("%lf",&pausedummy);
00194 }
00195
00196 void Misc::Pause(int seconds){
00197
00198 clock_t endwait;
00199 endwait = clock () + seconds * CLOCKS_PER_SEC ;
00200 while (clock() < endwait) {}
00201 }
00202
00203 double Misc::CalcDelta_FromSqWells(int ell,double mu,int nwells,double q,double *V0,double *r){
00204 int iwell;
00205 double norm,dd;
00206 double *qq,*A,*B;
00207 bool *realcheck;
00208 A=new double[nwells+1];
00209 B=new double[nwells+1];
00210 qq=new double[nwells+1];
00211 realcheck=new bool[nwells+1];
00212 double c,cprime,qr,jl,jlprime,nl,nlprime,ek;
00213
00214 A[0]=1.0; B[0]=0.0;
00215
00216 qq[nwells]=q;
00217 realcheck[nwells]=1;
00218 for(iwell=0;iwell<nwells;iwell++){
00219 realcheck[iwell]=1;
00220 ek=q*q-2.0*mu*V0[iwell];
00221 qq[iwell]=sqrt(fabs(ek));
00222 if(ek<0.0) realcheck[iwell]=0;
00223
00224 }
00225 for(iwell=1;iwell<=nwells;iwell++){
00226
00227 qr=qq[iwell-1]*r[iwell-1]/HBARC;
00228 if(realcheck[iwell-1]==1) Bessel::CalcJN_real(ell,qr,jl,nl,jlprime,nlprime);
00229 else Bessel::CalcJN_imag(ell,qr,jl,nl,jlprime,nlprime);
00230 c=A[iwell-1]*jl+B[iwell-1]*nl;
00231 cprime=qq[iwell-1]*(A[iwell-1]*jlprime+B[iwell-1]*nlprime);
00232
00233 cprime=cprime/qq[iwell];
00234 qr=qq[iwell]*r[iwell-1]/HBARC;
00235 if(realcheck[iwell]==1) Bessel::CalcJN_real(ell,qr,jl,nl,jlprime,nlprime);
00236 else Bessel::CalcJN_imag(ell,qr,jl,nl,jlprime,nlprime);
00237 A[iwell]=(cprime*nl-c*nlprime)/(jlprime*nl-jl*nlprime);
00238 B[iwell]=(c*jlprime-cprime*jl)/(jlprime*nl-jl*nlprime);
00239 }
00240
00241 norm=1.0/sqrt(A[nwells]*A[nwells]+B[nwells]*B[nwells]);
00242 for(iwell=0;iwell<=nwells;iwell++){
00243 A[iwell]*=norm;
00244 B[iwell]*=norm;
00245
00246 }
00247 dd=atan2(B[nwells],A[nwells]);
00248 if(q<20) printf("A=%g, B=%g\n",A[nwells],B[nwells]);
00249 dd-=2.0*PI*rint(dd/(2.0*PI));
00250 if(dd<0.0) dd+=PI;
00251
00252 delete [] A;
00253 delete [] B;
00254 delete [] qq;
00255 delete [] realcheck;
00256 return dd;
00257
00258 }
00259
00260 void Misc::Cubic(double a0,double a1,double a2,double a3,
00261 complex<double>& z1, complex<double>& z2,complex<double>& z3){
00262 complex<double> ci(0.0,1.0);
00263 complex<double> x,w,check,dZdz,dz,z[3];
00264 double Q,R,p,q,arg;
00265 int i,ncheck=0;
00266 a0=a0/a3;
00267 a1=a1/a3;
00268 a2=a2/a3;
00269 p=a1-(a2*a2/3.0);
00270 q=(a1*a2/3.0)-a0-2.0*a2*a2*a2/27.0;
00271 Q=p/3.0;
00272 R=0.5*q;
00273 arg=R*R+Q*Q*Q;
00274
00275 if(arg>0.0){
00276 w=pow(fabs(R+sqrt(arg)),1.0/3.0);
00277 if(R+sqrt(arg)<0.0) w=-w;
00278 x=w-p/(3.0*w);
00279
00280 z1=x-a2/3.0;
00281 w=w*exp(2.0*ci*PI/3.0);
00282 x=w-p/(3.0*w);
00283 z2=x-a2/3.0;
00284 w=w*exp(2.0*ci*PI/3.0);
00285 x=w-p/(3.0*w);
00286 z3=x-a2/3.0;
00287 }
00288 else{
00289 w=pow(R+ci*sqrt(-arg),1.0/3.0);
00290 x=w-p/(3.0*w);
00291 z1=x-a2/3.0;
00292 w=w*exp(2.0*ci*PI/3.0);
00293 x=w-p/(3.0*w);
00294 z2=x-a2/3.0;
00295 w=w*exp(2.0*ci*PI/3.0);
00296 x=w-p/(3.0*w);
00297 z3=x-a2/3.0;
00298 }
00299 z[0]=z1;
00300 z[1]=z2;
00301 z[2]=z3;
00302
00303 for(i=0;i<3;i++){
00304 check=(pow(z[i],3)+a2*pow(z[i],2)+a1*z[i]+a0)
00305 /(abs(pow(z[i],3))+abs(a2*pow(z[i],2))+abs(a1*z[i]+a0));
00306 ncheck=0;
00307 while(abs(check)>1.0E-12){
00308 if(ncheck>10){
00309 printf("FAILURE IN CUBIC SOLVER: check=(%g,%g) =? 0\n",real(check),imag(check));
00310 exit(1);
00311 }
00312 dZdz=3.0*pow(z[i],2)+2.0*a2*z[i]+a1;
00313 dz=-(pow(z[i],3)+a2*pow(z[i],2)+a1*z[i]+a0)/dZdz;
00314 z[i]+=dz;
00315 check=(pow(z[i],3)+a2*pow(z[i],2)+a1*z[i]+a0)
00316 /(abs(pow(z[i],3))+abs(a2*pow(z[i],2))+abs(a1*z[i]+a0));
00317 ncheck+=1;
00318 }
00319 }
00320 z1=z[0]; z2=z[1]; z3=z[2];
00321 }
00322
00323
00324 #include <iostream>
00325 #include <cmath>
00326 #include <complex>
00327
00328 using namespace std;
00329
00330 double Misc::signswitch(double a, double b) {
00331 if (b>=0.0) return fabs(a);
00332 return -fabs(a);
00333 }
00334
00335 void Misc::Quartic(double a0,double a1,double a2,double a3,double a4,complex<double> &z1, complex<double> &z2,complex<double> &z3,complex<double> &z4){
00336 complex<double> z[4];
00337 if(a4==0.0){
00338 printf("Leading coefficient zero in cern_quartic_real_coeff::solve_rc().\n");
00339 exit(-1);
00340 }
00341 Quartic(a0,a1,a2,a3,a4,z);
00342 z1=z[0]; z2=z[1]; z3=z[2]; z4=z[3];
00343 }
00344
00345
00346
00347
00348
00349
00350 void Misc::Quartic(double a0,double a1,double a2,double a3,double a4,complex<double> *z){
00351 double dc;
00352 int mt;
00353 double a=a3/a4,b=a2/a4,c=a1/a4,d=a0/a4;
00354
00355 complex<double> i(0.0,1.0), z0[5];
00356 complex<double> w1(0.0,0.0), w2(0.0,0.0), w3;
00357 double r4=1.0/4.0, r12=1.0/12.0;
00358 double q2=1.0/2.0, q4=1.0/4.0, q8=1.0/8.0;
00359 double q1=3.0/8.0, q3=3.0/16.0;
00360 double u[3], v[4], v1, v2;
00361 int j, k1=0, k2=0;
00362
00363
00364 if (b==0 && c==0) {
00365 if (d==0) {
00366 mt=1;
00367 z[0]=-a;
00368 z[1]=0;
00369 z[2]=0;
00370 z[3]=0;
00371 dc=0;
00372 return;
00373 }
00374 else if (a==0) {
00375 if (d>0) {
00376 mt=2;
00377 z[0]=sqrt(i*sqrt(d));
00378 z[1]=-z[0];
00379 z[3]=sqrt(-z[0]*z[0]);
00380 z[2]=-z[3];
00381 }
00382 else {
00383 mt=3;
00384 z[0]=sqrt(sqrt(-d));
00385 z[1]=-z[0];
00386 z[2]=sqrt(-z[0]*z[0]);
00387 z[3]=-z[2];
00388 }
00389 dc=-r12*d*r12*d*r12*d;
00390 return;
00391 }
00392 }
00393
00394
00395 double aa=a*a;
00396 double pp=b-q1*aa;
00397 double qq=c-q2*a*(b-q4*aa);
00398 double rr=d-q4*(a*c-q4*aa*(b-q3*aa));
00399 double rc=q2*pp;
00400 double sc=q4*(q4*pp*pp-rr);
00401 double tc=-(q8*qq*q8*qq);
00402
00403
00404 Misc::CubicResolvant(rc,sc,tc,u,dc);
00405
00406 double q=qq;
00407 double h=r4*a;
00408 if (dc==0) u[2]=u[1];
00409 if (dc<=0) {
00410 mt=2;
00411 v[1]=fabs(u[0]);
00412 v[2]=fabs(u[1]);
00413 v[3]=fabs(u[2]);
00414 v1=max(max(v[1],v[2]),v[3]);
00415 if (v1==v[1]) {
00416 k1=0;
00417 v2=max(v[2],v[3]);
00418 } else if (v1==v[2]) {
00419 k1=1;
00420 v2=max(v[1],v[3]);
00421 } else {
00422 k1=2;
00423 v2=max(v[1],v[2]);
00424 }
00425 if (v2==v[1]) {
00426 k2=0;
00427 } else if (v2==v[2]) {
00428 k2=1;
00429 } else {
00430 k2=2;
00431 }
00432 w1=sqrt(((complex<double>)(u[k1])));
00433 w2=sqrt(((complex<double>)(u[k2])));
00434 } else {
00435 mt=3;
00436 w1=sqrt(u[1]+i*u[2]);
00437 w2=sqrt(u[1]-i*u[2]);
00438 }
00439 w3=0;
00440 if (w1*w2!=0.0) w3=-q/(8.0*w1*w2);
00441 z0[1]=w1+w2+w3-h;
00442 z0[2]=-w1-w2+w3-h;
00443 z0[3]=-w1+w2-w3-h;
00444 z0[4]=w1-w2-w3-h;
00445 if (mt==2) {
00446 if (u[k1]>=0 && u[k2]>=0) {
00447 mt=1;
00448 for(j=1;j<=4;j++) {
00449 z[j-1]=z0[j].real();
00450 }
00451 } else if (u[k1]>=0 && u[k2]<0) {
00452 z[0]=z0[1];
00453 z[1]=z0[4];
00454 z[2]=z0[3];
00455 z[3]=z0[2];
00456 } else if (u[k1]<0 && u[k2]>=0) {
00457 z[0]=z0[1];
00458 z[1]=z0[3];
00459 z[2]=z0[4];
00460 z[3]=z0[2];
00461 } else if (u[k1]<0 && u[k2]<0) {
00462 z[0]=z0[1];
00463 z[1]=z0[2];
00464 z[2]=z0[4];
00465 z[3]=z0[3];
00466 }
00467 } else if (mt==3) {
00468 for(j=1;j<=2;j++) {
00469 z[j-1]=z0[j].real();
00470 }
00471 z[2]=z0[4];
00472 z[3]=z0[3];
00473 }
00474 }
00475
00476
00477
00478
00479
00480
00481
00482
00483
00484
00485
00486 void Misc::CubicResolvant(double r,double s,double t,double x[],double &d){
00487 double eps=1.0e-6, delta=1.0e-15;
00488 double r1=2.0/27.0, r2=0.5, r3=1.0/3.0;
00489 double w3=sqrt(3.0), r4=w3/2.0;
00490 double q1=2.0/27.0, q2=0.5, q3=1.0/3.0;
00491 double y[3];
00492 complex<double> z[3], i(0.0,1.0);
00493 double h2, h3;
00494 int j,k;
00495
00496 if (s==0.0 && t==0.0) {
00497 x[0]=-r;
00498 x[1]=0.0;
00499 x[2]=0.0;
00500 d=0;
00501 return;
00502 }
00503 double p=s-r3*r*r;
00504 double q=(r1*r*r-r3*s)*r+t;
00505 d=r2*r2*q*q+r3*p*r3*p*r3*p;
00506 if (fabs(d)<=eps) {
00507 double pp=s-q3*r*r;
00508 double qq=(q1*r*r-q3*s)*r+t;
00509 d=q2*q2*qq*qq+q3*pp*q3*pp*q3*pp;
00510 p=pp;
00511 q=qq;
00512 }
00513 double h=r3*r;
00514 double h1=r2*q;
00515 double u,v,d_new;
00516
00517
00518
00519
00520 if (true) {
00521 double da=r2*r2*q*q;
00522 double db=r3*p*r3*p*r3*p;
00523 if (db==0.0) {
00524 delta=0.0;
00525 d_new=da;
00526 } else if (db>0.0) {
00527 d_new=da/db+1.0;
00528 } else {
00529 d_new=-da/db-1.0;
00530 }
00531 } else {
00532 d_new=d;
00533 }
00534 if (d_new>delta) {
00535 h2=sqrt(d);
00536 double u0=-h1+h2;
00537 double v0=-h1-h2;
00538 if (fabs(u0)==0.0) u=Misc::signswitch(0.0,u0);
00539 else u=Misc::signswitch(pow(fabs(u0),r3),u0);
00540 if (fabs(v0)==0.0) v=Misc::signswitch(0.0,v0);
00541 else v=Misc::signswitch(pow(fabs(v0),r3),v0);
00542 x[0]=u+v-h;
00543 x[1]=-r2*(u+v)-h;
00544 x[2]=r4*fabs(u-v);
00545 if (fabs(u0)<=eps || fabs(v0)<=eps) {
00546 y[0]=x[0];
00547 for(k=0;k<=1;k++) {
00548 y[k+1]=y[k]-(((y[k]+r)*y[k]+s)*y[k]+t)/((3.0*y[k]+2.0*r)*y[k]+s);
00549 }
00550 x[0]=y[2];
00551 z[0]=x[1]+i*x[2];
00552 for(k=0;k<=1;k++) {
00553 z[k+1]=z[k]-(((z[k]+r)*z[k]+s)*z[k]+t)/((3.0*z[k]+2.0*r)*z[k]+s);
00554 }
00555 x[1]=z[2].real();
00556 x[2]=z[2].imag();
00557 }
00558 } else if (fabs(d_new)<=delta) {
00559 d=0.0;
00560 if (fabs(h1)==0.0) u=Misc::signswitch(0.0,-h1);
00561 else u=Misc::signswitch(pow(fabs(h1),r3),-h1);
00562 x[0]=u+u-h;
00563 x[1]=-u-h;
00564 x[2]=x[1];
00565 if (fabs(h1)<=eps) {
00566 y[0]=x[0];
00567 for(k=0;k<=1;k++) {
00568 h1=(3.0*y[k]+2.0*r)*y[k]+s;
00569 if (fabs(h1)>delta) {
00570 y[k+1]=y[k]-(((y[k]+r)*y[k]+s)*y[k]+t)/h1;
00571 } else {
00572 x[0]=-r3*r;
00573 x[1]=x[0];
00574 x[2]=x[0];
00575 return;
00576 }
00577 }
00578 x[0]=y[2];
00579 x[1]=-r2*(r+x[0]);
00580 x[2]=x[1];
00581 }
00582 }
00583 else {
00584 h3=fabs(r3*p);
00585 h3=sqrt(h3*h3*h3);
00586 h2=r3*acos(-h1/h3);
00587 if (h3==0.0) h1=0.0;
00588 else h1=pow(h3,r3);
00589 u=h1*cos(h2);
00590 v=w3*h1*sin(h2);
00591 x[0]=u+u-h;
00592 x[1]=-u-v-h;
00593 x[2]=-u+v-h;
00594 if (h3<=eps || x[0]<=eps || x[1]<=eps || x[2]<=eps) {
00595 for(j=0;j<3;j++) {
00596 y[0]=x[j];
00597 for(k=0;k<=1;k++) {
00598 y[k+1]=y[k]-(((y[k]+r)*y[k]+s)*y[k]+t)/((3.0*y[k]+2.0*r)*y[k]+s);
00599 }
00600 x[j]=y[2];
00601 }
00602 }
00603 }
00604 }
00605
00606
00607
00608
00609
00610
00611
00612
00613
00614
00615
00616
00617
00618
00619
00620
00621
00622
00623
00624
00625
00626
00627
00628
00629
00630
00631
00632
00633
00634
00635
00636
00637
00638
00639
00640
00641
00642
00643
00644
00645 int Misc::CubicReal(double a0,double a1,double a2,double a3,double *x){
00646 a0=a0/a3; a1=a1/a3; a2=a2/a3;
00647 int nrealroots=gsl_poly_solve_cubic(a2,a1,a0,&x[0],&x[1],&x[2]);
00648 return nrealroots;
00649 }
00650
00651 void Misc::CubicComplex(double a0,double a1,double a2,double a3,complex<double> &z1,complex<double> &z2,complex<double> &z3){
00652 a0=a0/a3; a1=a1/a3; a2=a2/a3;
00653 gsl_complex gslz1,gslz2,gslz3;
00654 gsl_poly_complex_solve_cubic(a2,a1,a0,&gslz1,&gslz2,&gslz3);
00655 complex<double> ci(0.0,1.0);
00656 z1=GSL_REAL(gslz1)+ci*GSL_IMAG(gslz1);
00657 z2=GSL_REAL(gslz2)+ci*GSL_IMAG(gslz2);
00658 z3=GSL_REAL(gslz3)+ci*GSL_IMAG(gslz3);
00659 }
00660
00661
00662 #endif