Пример #1
0
TSIL_COMPLEX TSIL_Bp (TSIL_REAL X, TSIL_REAL Y, TSIL_COMPLEX S, TSIL_REAL QQ)
{
  if (X < TSIL_TOL) {
    TSIL_Warn("Bp", "B(x',y) is undefined for x=0.");
    return TSIL_Infinity;
  }

  if (TSIL_CABS(1.0L - S/(X+Y+2.0L*TSIL_SQRT(X*Y))) < TSIL_TOL) {
    TSIL_Warn("Bp", "B(x',y) is undefined at s = (sqrt(x) + sqrt(y))^2.");
    return TSIL_Infinity;
  }

  if (TSIL_CABS(S) < TSIL_TOL) {
    if (TSIL_FABS(1.0L - X/Y) < TSIL_TOL)
      return (-0.5L/X);
    else
      return 1.0L/(Y-X) + Y*TSIL_LOG(X/Y)/((Y-X)*(Y-X));
  }

  if (TSIL_CABS(1.0L - (X + Y - 2.0L*TSIL_SQRT(X*Y))/S) < TSIL_TOL) 
    return (1.0L - TSIL_SQRT(Y/X) +0.5L*TSIL_LOG(Y/X))/(X + Y - 2.0L*TSIL_SQRT(X*Y));
  else
    return ((X-Y-S)*TSIL_B(X,Y,S,QQ) + (X+Y-S)*TSIL_LOG(X/QQ) 
	    -2.0L*TSIL_A(Y,QQ) + 2.0L*(S-X))/TSIL_Delta(S,X,Y);
}
Пример #2
0
TSIL_COMPLEX TSIL_Tx0y (TSIL_REAL X, TSIL_REAL Y, TSIL_COMPLEX S,
                        TSIL_REAL QQ)
{
    TSIL_COMPLEX sqDeltaSXY, tp, tm, log1mtp, log1mtm;
    TSIL_REAL    lnbarX, lnbarY;

    if (X < TSIL_TOL) {
        TSIL_Warn("TSIL_Tx0y", "T(x,0,y) is undefined for x = 0.");
        return TSIL_Infinity;
    }

    if (TSIL_CABS(S) < TSIL_TOL) return -TSIL_I2p(X, 0.0L, Y, QQ);
    if (Y < TSIL_TOL) return TSIL_Tx00(X, S, QQ);

    S = TSIL_AddIeps(S);
    sqDeltaSXY = TSIL_CSQRT(X*X + Y*Y + S*S - 2.0L*X*Y - 2.0L*X*S - 2.0L*Y*S);
    lnbarX = TSIL_LOG(X/QQ);
    lnbarY = TSIL_LOG(Y/QQ);
    tp = (Y - X + S + sqDeltaSXY)/(2.0L * Y);
    tm = (Y - X + S - sqDeltaSXY)/(2.0L * Y);
    log1mtp = TSIL_CLOG(1.0L - tp);
    log1mtm = TSIL_CLOG(1.0L - tm);

    return (-TSIL_Dilog (tp) - TSIL_Dilog (tm) + (1.0L - Y/S)*log1mtp*log1mtm
            + sqDeltaSXY * (log1mtp - log1mtm) / (2.0L * S)
            + lnbarX*lnbarY - 0.5L*(lnbarY + 1.0L)*(lnbarY + 1.0L)
            + (3.0L*S + Y - X) *(lnbarY-lnbarX)/(2.0L * S));
}
Пример #3
0
int TSIL_Tanalytic (TSIL_REAL X,
                    TSIL_REAL Y,
                    TSIL_REAL Z,
                    TSIL_COMPLEX S,
                    TSIL_REAL QQ,
                    TSIL_COMPLEX *result)
{
    TSIL_REAL tmp;
    int success = 1;

    if (Y < Z) {
        tmp = Z;
        Z = Y;
        Y = tmp;
    }

    if (X < TSIL_TOL) {
        TSIL_Warn("Tanalytic", "T(x,y,z) is undefined for x = 0.");
        *result = TSIL_Infinity;
    }
    else if (Z < TSIL_TOL)
        *result = TSIL_Tx0y (X,Y,S,QQ);
    else if (TSIL_CABS(S) < TSIL_TOL)
        *result = TSIL_TAtZero(X, Y, Z, QQ);
    else if (TSIL_CABS(S-X) + TSIL_FABS(Y-Z) < TSIL_TOL)
        *result = TSIL_TxyyAtx(X,Y,QQ);
    else if (TSIL_CABS(S-Z) + TSIL_FABS(Y-X) < TSIL_TOL)
        *result = TSIL_TyyxAtx(Z,Y,QQ);
    else if (TSIL_CABS(S-Y) + TSIL_FABS(Z-X) < TSIL_TOL)
        *result = TSIL_TyyxAtx(Y,X,QQ);
    else success = 0;

    return success;
}
Пример #4
0
TSIL_COMPLEX TSIL_Trilogunitdisk (TSIL_COMPLEX z)
{
  TSIL_COMPLEX result;
  TSIL_REAL rez = TSIL_CREAL (z);
  TSIL_REAL absz = TSIL_CABS (z);
  TSIL_REAL absimz = TSIL_FABS (TSIL_CIMAG (z));

  if (TSIL_CABS(z - 1.0L) < 2.0L * TSIL_TOL)
    result = cZeta3;
  else if (TSIL_CABS(z) < 2.0L * TSIL_TOL)
    result = 0.0L;
  else if (TSIL_CABS(TSIL_CLOG(z)) < trilog_CLZseries_radius)
    result = TSIL_TrilogCLZseries (z);
  else if (absz <= trilog_powerseries_radius)
    result = TSIL_Trilogseries (z);
  else if (rez <= 0.0L)
    result = TSIL_TrilogregionA (z);
  else if (rez <= absimz)
    result = TSIL_TrilogregionB (z);
  else {
    TSIL_Warn("TSIL_Trilogunitdisk", "trilog function yielding undefined result.");
    result = TSIL_Infinity;
  }

  return result;
}
Пример #5
0
TSIL_COMPLEX TSIL_TrilogCLZseries(TSIL_COMPLEX z)
{
  TSIL_COMPLEX logz, logzsquared, logztothek, term;
  TSIL_COMPLEX first6terms, remainingterms, result;
  TSIL_REAL accuracygoal;
  int j;

  logz = TSIL_CLOG(z);
  logzsquared = logz*logz;
  logztothek = logzsquared*logzsquared*logzsquared;

  first6terms = logztothek/86400.0L;
  first6terms += -logzsquared*logzsquared/288.0L;
  first6terms += -logzsquared*logz/12.0L;
  first6terms += (0.75L - 0.5L*TSIL_CLOG(-logz))*logzsquared;
  first6terms += cZeta3 + cZeta2*logz; 
  
  accuracygoal = TSIL_TOL* TSIL_CABS (first6terms);
  remainingterms = 0.0L;

  for (j=0; j< 25; j++)
    {
      logztothek = logztothek*logzsquared;
      term = CLZcoeffs_trilog[j]*logztothek;
      remainingterms += term;
      if (TSIL_CABS (term) < accuracygoal) 
	break;
      if (j == 24)
        TSIL_Warn("TSIL_TrilogCLZseries", "trilog CLZ series converging too slowly.");
    }

  result = remainingterms + first6terms;

  return result;
}
Пример #6
0
TSIL_COMPLEX TSIL_B00 (TSIL_COMPLEX S, TSIL_REAL QQ)
{
  if (TSIL_CABS (S) < TSIL_TOL) {
    TSIL_Warn("TSIL_B00", "B(0,0) is undefined when s=0."); 
    return TSIL_Infinity;
  }

  S = TSIL_AddIeps(S);    
  return (2.0L - TSIL_CLOG(-S/QQ));
}
Пример #7
0
TSIL_COMPLEX TSIL_dBds (TSIL_REAL x,
			TSIL_REAL y,
			TSIL_COMPLEX s,
			TSIL_REAL qq)
{
  TSIL_REAL thxy, psxy, sqrtx, sqrty, alphax, alphay, temp;
  TSIL_COMPLEX Btemp, result;

  if (x < y) {temp = y; y = x; x = temp;}

  if (x + TSIL_CABS(s) < TSIL_TOL) {
    TSIL_Warn("TSIL_dBds", "dBds(0,0) is undefined when s=0.");
    return TSIL_Infinity;
  }

  if (TSIL_CABS(s/x) < TSIL_TOL) return TSIL_BprimeAtZero (x, y, qq);

  thxy = TSIL_Th2 (x, y);
  psxy = TSIL_Ps2 (x, y);
  sqrtx = TSIL_SQRT(x);
  sqrty = TSIL_SQRT(y);
  alphax = TSIL_Alpha(x,qq);
  alphay = TSIL_Alpha(y,qq);
  
  if (TSIL_CABS(1.0L - s/thxy) < TSIL_TOL) {
    TSIL_Warn("TSIL_dBds", "dBds(x,y) is undefined at threshold.");
    return TSIL_Infinity;
  }

  if (TSIL_CABS(1.0L - s/psxy) < TSIL_TOL) {
    return (0.5L * alphax * (1.0L + sqrty/sqrtx) 
	    - 0.5L * alphay * (1.0L + sqrtx/sqrty)
	    + 2.0L * (sqrty - sqrtx) )/TSIL_POW(sqrtx - sqrty,3);
  }

  Btemp = TSIL_B (x, y, s, qq);

  result = (0.5L/s) * (
           (thxy * Btemp - s + (sqrtx + sqrty)*(alphax + alphay))/(s - thxy)
         + (psxy * Btemp - s + (sqrtx - sqrty)*(alphax - alphay))/(s - psxy));
 
  return result;
}
Пример #8
0
TSIL_COMPLEX TSIL_TyyxAtx (TSIL_REAL X, TSIL_REAL Y, TSIL_REAL QQ)
{
    TSIL_REAL lnbarX, lnbarY;

    if (X < TSIL_TOL) return -TSIL_I2p(Y,Y,0,QQ);

    if (Y < TSIL_TOL) {
        TSIL_Warn("TSIL_TyyxAtx", "T(y,y,x) with s = 0 is undefined for x = 0.");
        return TSIL_Infinity;
    }

    lnbarX = TSIL_LOG(X/QQ);
    lnbarY = TSIL_LOG(Y/QQ);
    return -0.5L + (1.0L - Y/X)*(TSIL_Dilog(1.0 -X/Y) -Zeta2)
           + lnbarX - 2.0L*lnbarY + 0.5L*lnbarY*lnbarY;
}
Пример #9
0
TSIL_COMPLEX TSIL_TxyyAtx (TSIL_REAL X, TSIL_REAL Y, TSIL_REAL QQ)
{
    TSIL_REAL lnbarX, lnbarY;

    if (X < TSIL_TOL) {
        TSIL_Warn("TSIL_TxyyAtx", "T(x,y,y) is undefined for s = x = 0.");
        return TSIL_Infinity;
    }

    if (Y < TSIL_TOL) return TSIL_Tx00(X,X,QQ);

    lnbarX = TSIL_LOG(X/QQ);
    lnbarY = TSIL_LOG(Y/QQ);

    return (-0.5L + (Y/X-1.0L)*(TSIL_Dilog(1.0 -X/Y) -Zeta2)
            + lnbarX*(lnbarY - 1.0L) - 0.5L*lnbarY*lnbarY);
}
Пример #10
0
TSIL_COMPLEX TSIL_Tx00 (TSIL_REAL X, TSIL_COMPLEX S, TSIL_REAL QQ)
{
    TSIL_REAL lnbarX;

    if (X < TSIL_TOL) {
        TSIL_Warn("TSIL_Tx00", "T(x,0,0) is undefined for x = 0.");
        return TSIL_Infinity;
    }

    if (TSIL_CABS(S) < TSIL_TOL) return -TSIL_I2p(X, 0.0L, 0.0L, QQ);

    lnbarX = TSIL_LOG(X/QQ);

    if (TSIL_CABS (1.0L - S/X) < 10.0L*TSIL_TOL)
        return 2.0L*Zeta2 -0.5L -lnbarX + 0.5L*lnbarX*lnbarX;

    S = TSIL_AddIeps(S);

    return Zeta2 - 0.5L + (1.0L - X/S)*TSIL_CLOG(1.0L -S/X)
           -lnbarX + 0.5L*lnbarX*lnbarX + TSIL_Dilog (S/X);
}
Пример #11
0
TSIL_COMPLEX TSIL_BepsAtZero (TSIL_REAL x, TSIL_REAL y, TSIL_REAL qq)
{
  TSIL_COMPLEX lnbarx, lnbary;
  TSIL_REAL temp;

  if (x < y) {temp = x; x = y; y = temp;}

  if (x < TSIL_TOL) {
    TSIL_Warn("TSIL_BepsAtZero", "Beps(0,0) is undefined at s = 0.");
    return TSIL_Infinity;
  }

  lnbarx = TSIL_CLOG(x/qq);

  if (y < TSIL_TOL) return 1.0L + Zeta2/2.0L - lnbarx + lnbarx*lnbarx/2.0L;

  if (TSIL_FABS(x-y)/(x+y) < TSIL_TOL) return (Zeta2 + lnbarx*lnbarx)/2.0L;

  lnbary = TSIL_CLOG(y/qq);

  return 1.0L + Zeta2/2.0L + (x*lnbarx*(lnbarx/2.0L - 1.0L) -
			      y*lnbary*(lnbary/2.0L - 1.0L))/(x-y);
}
Пример #12
0
int main (int argc, char *argv[])
{
#include "tsil_names.h"

    TSIL_REAL x, y, z, u, v, s, qq;
    TSIL_COMPLEX val;
    TSIL_DATA result;
    int i, j, k, p, foo, tally[3], nwarn, nfail, npass;
    char c;
    TSIL_COMPLEX Mvalue, Uvalue[4], Vvalue[4], Svalue[2], Tvalue[6], Bvalue[2];
    TSIL_COMPLEX Tbarvalue[6], UUvalue[4][3], VVvalue[4][3], SSvalue[2][3];
    TSIL_COMPLEX TTvalue[6][3];
    TSIL_REAL xx, yy, zz, uu, vv;

    /* gcc complains unless the following are initialized; this may be a
       gcc bug? Fortunately, it doesn't hurt to initialize them. */
    int permU = 0;
    int permS = 0;
    int permT11 = 0;
    int permT12 = 0;
    int permT21 = 0;
    int permT22 = 0;
    int permT31 = 0;
    int permT32 = 0;

    if (argc == 1)
        TSIL_Error ("main", "Must supply test data filename(s)...", 2);

    nwarn = nfail = npass = 0;

    printf("===== TSIL TEST SUITE =====\n");
#if defined (TSIL_TEST_STU)
    printf("** Testing STU Evaluation only!\n");
#elif defined (TSIL_TEST_ST)
    printf("** Testing ST Evaluation only!\n");
#endif

    /* We don't need no stinkin' TSIL_Warnings here. */
    fclose (stderr);

    /* Loop over input files */
    for (i = 1; i < argc; i++)
    {
        if ((fp = fopen(argv[i], "r")) == NULL) {
            TSIL_Warn ("Test program", "Invalid file name");
            continue;
        }

        printf ("\nTest %d: ", i);
        printf ("%s\n", argv[i]);
        fflush (stdout);

        /* Skip any lines starting with '(' (comments): */
        while ((c = fgetc (fp)) == '(')
            SkipLine (fp);

        /* Put back the last character after we find a non-comment line */
        ungetc ((int) c, fp);

        /* Read in parameters */
        xx = x = GetReal ();
        yy = y = GetReal ();
        zz = z = GetReal ();
        uu = u = GetReal ();
        vv = v = GetReal ();
        s  = GetReal ();
        qq = GetReal ();

        /* Calculate everything... */
#if defined(TSIL_TEST_STU)
        TSIL_SetParametersSTU (&result, x, z, u, v, qq);
#elif defined(TSIL_TEST_ST)
        TSIL_SetParametersST (&result, x, u, v, qq);
#else
        TSIL_SetParameters (&result, x, y, z, u, v, qq);
#endif
        TSIL_Evaluate (&result, s);

        for (j = 0; j < 3; j++)
            tally[j] = 0;


        /* ...and test results: */

#if defined(TSIL_TEST_STU)
        val = GetComplex ();
        val = GetComplex ();
        val = GetComplex ();
        /* U */
        for (j = 2; j < 4; j+=2)
        {
            val = GetComplex ();
            Uvalue[j] = result.U[j].value;
            TSIL_Compare (uname[j], val, Uvalue[j], TSIL_PASS, TSIL_WARN, &foo);
            tally[foo]++;
        }
        CheckConsistent (Uvalue[2], TSIL_GetFunction(&result,"Uxzuv"));

        val = GetComplex ();
        val = GetComplex ();
        /* T */
        for (j = 1; j < 6; j+=2)
        {
            val = GetComplex ();
            Tvalue[j] = result.T[j].value;
            TSIL_Compare (tname[j], val, Tvalue[j], TSIL_PASS, TSIL_WARN, &foo);
            tally[foo]++;
            val = GetComplex ();
        }
        CheckConsistent (Tvalue[1], TSIL_GetFunction(&result,"Tuxv"));
        CheckConsistent (Tvalue[3], TSIL_GetFunction(&result,"Txuv"));
        CheckConsistent (Tvalue[5], TSIL_GetFunction(&result,"Tvxu"));

        /* S */
        for (j = 1; j < 2; j+=2)
        {
            val = GetComplex ();
            Svalue[j] = result.S[j].value;
            TSIL_Compare (sname[j], val, Svalue[j], TSIL_PASS, TSIL_WARN, &foo);
            tally[foo]++;
        }
        CheckConsistent (Svalue[1], TSIL_GetFunction(&result,"Suxv"));

        /* B */
        for (j = 0; j < 2; j+=2)
        {
            val = GetComplex ();
            Bvalue[j] = result.B[j].value;
            TSIL_Compare (bname[j], val, Bvalue[j], TSIL_PASS, TSIL_WARN, &foo);
            tally[foo]++;
        }
        CheckConsistent (Bvalue[0], TSIL_GetFunction(&result,"Bxz"));

        val = GetComplex ();
        val = GetComplex ();
        val = GetComplex ();
        /* V */
        for (j = 2; j < 4; j+=2)
        {
            val = GetComplex ();
            Vvalue[j] = result.V[j].value;
            TSIL_Compare (vname[j], val, Vvalue[j], TSIL_PASS_V, TSIL_WARN_V, &foo);
            tally[foo]++;
        }
        CheckConsistent (Vvalue[2], TSIL_GetFunction(&result,"Vxzuv"));
        val = GetComplex ();

        /* Tbar */
        val = GetComplex ();
        for (j = 1; j < 6; j+=2)
        {
            val = GetComplex ();
            Tbarvalue[j] = result.Tbar[j].value;
            TSIL_Compare (tbarname[j], val, Tbarvalue[j], TSIL_PASS, TSIL_WARN, &foo);
            tally[foo]++;
            val = GetComplex ();
        }

        val = GetComplex ();
        val = GetComplex ();
        val = GetComplex ();
        val = GetComplex ();
        val = GetComplex ();
        /* UU */
        for (j = 2; j < 4; j+=2)
        {
            for (k = 0; k < 3; k++)
            {
                val = GetComplex ();
                UUvalue[j][k] = result.U[j].bold[k];
                TSIL_Compare (uuname[j][k], val, UUvalue[j][k], TSIL_PASS, TSIL_WARN, &foo);
                tally[foo]++;
            }
        }

        val = GetComplex ();
        val = GetComplex ();
        val = GetComplex ();
        val = GetComplex ();
        val = GetComplex ();
        val = GetComplex ();
        val = GetComplex ();
        val = GetComplex ();
        val = GetComplex ();
        /* VV */
        for (j = 2; j < 4; j+=2)
        {
            for (k = 0; k < 3; k++)
            {
                val = GetComplex ();
                VVvalue[j][k] = result.V[j].bold[k];
                TSIL_Compare (vvname[j][k], val, VVvalue[j][k], TSIL_PASS_V, TSIL_WARN_V, &foo);
                tally[foo]++;
            }
        }
        val = GetComplex ();
        val = GetComplex ();
        val = GetComplex ();

        val = GetComplex ();
        val = GetComplex ();
        val = GetComplex ();
        /* TT */
        for (j = 1; j < 6; j+=2)
        {
            for (k = 0; k < 3; k++)
            {
                val = GetComplex ();
                TTvalue[j][k] = result.T[j].bold[k];
                TSIL_Compare (ttname[j][k], val, TTvalue[j][k], TSIL_PASS, TSIL_WARN, &foo);
                tally[foo]++;
            }
            val = GetComplex ();
            val = GetComplex ();
            val = GetComplex ();
        }

        /* SS */
        for (j = 1; j < 2; j+=2)
        {
            for (k = 0; k < 3; k++)
            {
                val = GetComplex ();
                SSvalue[j][k] = result.S[j].bold[k];
                TSIL_Compare (ssname[j][k], val, SSvalue[j][k], TSIL_PASS, TSIL_WARN, &foo);
                tally[foo]++;
            }
        }
#elif defined(TSIL_TEST_ST)
        val = GetComplex ();
        val = GetComplex ();
        val = GetComplex ();
        /* U */
        for (j = 2; j < 4; j+=2)
        {
            val = GetComplex ();
        }

        val = GetComplex ();
        val = GetComplex ();
        /* T */
        for (j = 1; j < 6; j+=2)
        {
            val = GetComplex ();
            Tvalue[j] = result.T[j].value;
            TSIL_Compare (tname[j], val, Tvalue[j], TSIL_PASS, TSIL_WARN, &foo);
            tally[foo]++;
            val = GetComplex ();
        }
        CheckConsistent (Tvalue[1], TSIL_GetFunction(&result,"Tuxv"));
        CheckConsistent (Tvalue[3], TSIL_GetFunction(&result,"Txuv"));
        CheckConsistent (Tvalue[5], TSIL_GetFunction(&result,"Tvxu"));

        /* S */
        for (j = 1; j < 2; j+=2)
        {
            val = GetComplex ();
            Svalue[j] = result.S[j].value;
            TSIL_Compare (sname[j], val, Svalue[j], TSIL_PASS, TSIL_WARN, &foo);
            tally[foo]++;
        }
        CheckConsistent (Svalue[1], TSIL_GetFunction(&result,"Suxv"));

        /* B */
        for (j = 0; j < 2; j+=2)
        {
            val = GetComplex ();
        }

        val = GetComplex ();
        val = GetComplex ();
        val = GetComplex ();
        /* V */
        for (j = 2; j < 4; j+=2)
        {
            val = GetComplex ();
        }
        val = GetComplex ();

        /* Tbar */
        val = GetComplex ();
        for (j = 1; j < 6; j+=2)
        {
            val = GetComplex ();
            Tbarvalue[j] = result.Tbar[j].value;
            TSIL_Compare (tbarname[j], val, Tbarvalue[j], TSIL_PASS, TSIL_WARN, &foo);
            tally[foo]++;
            val = GetComplex ();
        }

        val = GetComplex ();
        val = GetComplex ();
        val = GetComplex ();
        val = GetComplex ();
        val = GetComplex ();
        /* UU */
        for (j = 2; j < 4; j+=2)
        {
            for (k = 0; k < 3; k++)
            {
                val = GetComplex ();
            }
        }

        val = GetComplex ();
        val = GetComplex ();
        val = GetComplex ();
        val = GetComplex ();
        val = GetComplex ();
        val = GetComplex ();
        val = GetComplex ();
        val = GetComplex ();
        val = GetComplex ();
        /* VV */
        for (j = 2; j < 4; j+=2)
        {
            for (k = 0; k < 3; k++)
            {
                val = GetComplex ();
            }
        }
        val = GetComplex ();
        val = GetComplex ();
        val = GetComplex ();

        val = GetComplex ();
        val = GetComplex ();
        val = GetComplex ();
        /* TT */
        for (j = 1; j < 6; j+=2)
        {
            for (k = 0; k < 3; k++)
            {
                val = GetComplex ();
                TTvalue[j][k] = result.T[j].bold[k];
                TSIL_Compare (ttname[j][k], val, TTvalue[j][k], TSIL_PASS, TSIL_WARN, &foo);
                tally[foo]++;
            }
            val = GetComplex ();
            val = GetComplex ();
            val = GetComplex ();
        }

        /* SS */
        for (j = 1; j < 2; j+=2)
        {
            for (k = 0; k < 3; k++)
            {
                val = GetComplex ();
                SSvalue[j][k] = result.S[j].bold[k];
                TSIL_Compare (ssname[j][k], val, SSvalue[j][k], TSIL_PASS, TSIL_WARN, &foo);
                tally[foo]++;
            }
        }
#else
        /* M */
        val = GetComplex ();
        Mvalue = result.M.value;
        CheckConsistent (Mvalue, TSIL_GetFunction(&result,"M"));
        TSIL_Compare ("M", val, Mvalue, TSIL_PASS, TSIL_WARN, &foo);
        tally[foo]++;

        /* U */
        for (j = 0; j < 4; j++)
        {
            val = GetComplex ();
            Uvalue[j] = result.U[j].value;
            TSIL_Compare (uname[j], val, Uvalue[j], TSIL_PASS, TSIL_WARN, &foo);
            tally[foo]++;
        }
        CheckConsistent (Uvalue[0], TSIL_GetFunction(&result,"Uzxyv"));
        CheckConsistent (Uvalue[1], TSIL_GetFunction(&result,"Uuyxv"));
        CheckConsistent (Uvalue[2], TSIL_GetFunction(&result,"Uxzuv"));
        CheckConsistent (Uvalue[3], TSIL_GetFunction(&result,"Uyuzv"));

        /* T */
        for (j = 0; j < 6; j++)
        {
            val = GetComplex ();
            Tvalue[j] = result.T[j].value;
            TSIL_Compare (tname[j], val, Tvalue[j], TSIL_PASS, TSIL_WARN, &foo);
            tally[foo]++;
        }
        CheckConsistent (Tvalue[0], TSIL_GetFunction(&result,"Tvyz"));
        CheckConsistent (Tvalue[1], TSIL_GetFunction(&result,"Tuxv"));
        CheckConsistent (Tvalue[2], TSIL_GetFunction(&result,"Tyzv"));
        CheckConsistent (Tvalue[3], TSIL_GetFunction(&result,"Txuv"));
        CheckConsistent (Tvalue[4], TSIL_GetFunction(&result,"Tzyv"));
        CheckConsistent (Tvalue[5], TSIL_GetFunction(&result,"Tvxu"));

        /* S */
        for (j = 0; j < 2; j++)
        {
            val = GetComplex ();
            Svalue[j] = result.S[j].value;
            TSIL_Compare (sname[j], val, Svalue[j], TSIL_PASS, TSIL_WARN, &foo);
            tally[foo]++;
        }
        CheckConsistent (Svalue[0], TSIL_GetFunction(&result,"Svyz"));
        CheckConsistent (Svalue[1], TSIL_GetFunction(&result,"Suxv"));

        /* B */
        for (j = 0; j < 2; j++)
        {
            val = GetComplex ();
            Bvalue[j] = result.B[j].value;
            TSIL_Compare (bname[j], val, Bvalue[j], TSIL_PASS, TSIL_WARN, &foo);
            tally[foo]++;
        }
        CheckConsistent (Bvalue[0], TSIL_GetFunction(&result,"Bxz"));
        CheckConsistent (Bvalue[1], TSIL_GetFunction(&result,"Byu"));

        /* V */
        for (j = 0; j < 4; j++)
        {
            val = GetComplex ();
            Vvalue[j] = result.V[j].value;
            TSIL_Compare (vname[j], val, Vvalue[j], TSIL_PASS_V, TSIL_WARN_V, &foo);
            tally[foo]++;
        }
        CheckConsistent (Vvalue[0], TSIL_GetFunction(&result,"Vzxyv"));
        CheckConsistent (Vvalue[1], TSIL_GetFunction(&result,"Vuyxv"));
        CheckConsistent (Vvalue[2], TSIL_GetFunction(&result,"Vxzuv"));
        CheckConsistent (Vvalue[3], TSIL_GetFunction(&result,"Vyuzv"));

        /* Tbar */
        for (j = 0; j < 6; j++)
        {
            val = GetComplex ();
            Tbarvalue[j] = result.Tbar[j].value;
            TSIL_Compare (tbarname[j], val, Tbarvalue[j], TSIL_PASS, TSIL_WARN, &foo);
            tally[foo]++;
        }

        /* UU */
        for (j = 0; j < 4; j++)
        {
            for (k = 0; k < 3; k++)
            {
                val = GetComplex ();
                UUvalue[j][k] = result.U[j].bold[k];
                TSIL_Compare (uuname[j][k], val, UUvalue[j][k], TSIL_PASS, TSIL_WARN, &foo);
                tally[foo]++;
            }
        }

        /* VV */
        for (j = 0; j < 4; j++)
        {
            for (k = 0; k < 3; k++)
            {
                val = GetComplex ();
                VVvalue[j][k] = result.V[j].bold[k];
                TSIL_Compare (vvname[j][k], val, VVvalue[j][k], TSIL_PASS_V, TSIL_WARN_V, &foo);
                tally[foo]++;
            }
        }

        /* TT */
        for (j = 0; j < 6; j++)
        {
            for (k = 0; k < 3; k++)
            {
                val = GetComplex ();
                TTvalue[j][k] = result.T[j].bold[k];
                TSIL_Compare (ttname[j][k], val, TTvalue[j][k], TSIL_PASS, TSIL_WARN, &foo);
                tally[foo]++;
            }
        }

        /* SS */
        for (j = 0; j < 2; j++)
        {
            for (k = 0; k < 3; k++)
            {
                val = GetComplex ();
                SSvalue[j][k] = result.S[j].bold[k];
                TSIL_Compare (ssname[j][k], val, SSvalue[j][k], TSIL_PASS, TSIL_WARN, &foo);
                tally[foo]++;
            }
        }
#endif

        if (tally[FAIL] > 0)
        {
            nfail++;
            printf ("FAILED FOR INPUT PARAMETERS:\n");
            printf ("x = %.6lf;\n", (double) x);
            printf ("y = %.6lf;\n", (double) y);
            printf ("z = %.6lf;\n", (double) z);
            printf ("u = %.6lf;\n", (double) u);
            printf ("v = %.6lf;\n", (double) v);
            printf ("s = %.6lf;\n", (double) s);
            printf ("qq = %.6lf;\n", (double) qq);
        }
        else if (tally[WARN] > 0)
        {
            printf ("PASS WITH WARNING\n");
            nwarn++;
        }
        else
        {
            printf ("PASS\n");
            npass++;
        }

        if (1 == Doperms)
        {
            for (p = 0; p < 4; p++)
            {
                for (j = 0; j < 3; j++)
                    tally[j] = 0;

                x = xx;
                y = yy;
                z = zz;
                u = uu;
                v = vv;

                if (1 == p)
                {
                    swapR (&x, &y);
                    swapR (&z, &u);
                }

                if (2 == p)
                {
                    swapR (&x, &z);
                    swapR (&y, &u);
                }

                if (3 == p)
                {
                    swapR (&x, &u);
                    swapR (&y, &z);
                }

                /* Calculate everything... */
                TSIL_SetParameters (&result, x, y, z, u, v, qq);
                TSIL_Evaluate (&result, s);

                Permuteresults (&result, p);

                printf ("\nTest %d, permutation %d (", i, p);
                printf ("%s", argv[i]);
                printf ("): ");

                /* ...and check that permuted results agree as they
                       should: */

                /* M */
                val = result.M.value;
                TSIL_Compare ("M", val, Mvalue, TSIL_PASS, TSIL_WARN, &foo);
                tally[foo]++;

                /* U */
                for (j = 0; j < 4; j++)
                {
                    val = result.U[j].value;
                    TSIL_Compare (uname[j], val, Uvalue[j], TSIL_PASS, TSIL_WARN, &foo);
                    tally[foo]++;
                }

                /* T */
                for (j = 0; j < 6; j++)
                {
                    val = result.T[j].value;
                    TSIL_Compare (tname[j], val, Tvalue[j], TSIL_PASS, TSIL_WARN, &foo);
                    tally[foo]++;
                }

                /* S */
                for (j = 0; j < 2; j++)
                {
                    val = result.S[j].value;
                    TSIL_Compare (sname[j], val, Svalue[j], TSIL_PASS, TSIL_WARN, &foo);
                    tally[foo]++;
                }

                /* B */
                for (j = 0; j < 2; j++)
                {
                    val = result.B[j].value;
                    TSIL_Compare (bname[j], val, Bvalue[j], TSIL_PASS, TSIL_WARN, &foo);
                    tally[foo]++;
                }

                /* V */
                for (j = 0; j < 4; j++)
                {
                    val = result.V[j].value;
                    TSIL_Compare (vname[j], val, Vvalue[j], TSIL_PASS_V, TSIL_WARN_V, &foo);
                    tally[foo]++;
                }

                /* Tbar */
                for (j = 0; j < 6; j++)
                {
                    val = result.Tbar[j].value;
                    TSIL_Compare (tbarname[j], val, Tbarvalue[j], TSIL_PASS, TSIL_WARN, &foo);
                    tally[foo]++;
                }

                /* UU */
                for (j = 0; j < 4; j++)
                {
                    for (k = 0; k < 3; k++)
                    {
                        val = result.U[j].bold[k];
                        TSIL_Compare (uuname[j][k], val, UUvalue[j][k], TSIL_PASS, TSIL_WARN, &foo);
                        tally[foo]++;
                    }
                }

                /* VV */
                for (j = 0; j < 4; j++)
                {
                    for (k = 0; k < 3; k++)
                    {
                        val = result.V[j].bold[k];
                        TSIL_Compare (vvname[j][k], val, VVvalue[j][k], TSIL_PASS_V, TSIL_WARN_V, &foo);
                        tally[foo]++;
                    }
                }

                /* TT */
                for (j = 0; j < 6; j++)
                {
                    for (k = 0; k < 3; k++)
                    {
                        val = result.T[j].bold[k];
                        TSIL_Compare (ttname[j][k], val, TTvalue[j][k], TSIL_PASS, TSIL_WARN, &foo);
                        tally[foo]++;
                    }
                }

                /* SS */
                for (j = 0; j < 2; j++)
                {
                    for (k = 0; k < 3; k++)
                    {
                        val = result.S[j].bold[k];
                        TSIL_Compare (ssname[j][k], val, SSvalue[j][k], TSIL_PASS, TSIL_WARN, &foo);
                        tally[foo]++;
                    }
                }

                if (tally[FAIL] > 0)
                {
                    nfail++;
                    printf ("\nFAILED FOR INPUT PARAMETERS:\n");
                    printf ("x = %.3lf;\n", (double) x);
                    printf ("y = %.3lf;\n", (double) y);
                    printf ("z = %.3lf;\n", (double) z);
                    printf ("u = %.3lf;\n", (double) u);
                    printf ("v = %.3lf;\n", (double) v);
                    printf ("s = %.3lf;\n", (double) s);
                    printf ("qq = %.3lf;\n", (double) qq);
                }
                else if (tally[WARN] > 0)
                {
                    nwarn++;
                    printf ("\nPASS WITH WARNING\n");
                }
                else
                {
                    printf ("\nPASS\n");
                    npass++;
                }
            }
        }

        if (1 == Doextraperms)
        {
            for (p = 4; p < 8; p++)
            {
                x = xx;
                y = yy;
                z = zz;
                u = uu;
                v = vv;

                if (p == 4)
                {
                    swapR (&x, &v);
                    permU = 1;
                    permT11 = 1;
                    permT12 = 1;
                    permT21 = 3;
                    permT22 = 5;
                    permT31 = 5;
                    permT32 = 3;
                    permS = 1;
                }
                if (p == 5)
                {
                    swapR (&y, &v);
                    permU = 0;
                    permT11 = 0;
                    permT12 = 2;
                    permT21 = 2;
                    permT22 = 0;
                    permT31 = 4;
                    permT32 = 4;
                    permS = 0;
                }
                if (p == 6)
                {
                    swapR (&z, &v);
                    permU = 3;
                    permT11 = 0;
                    permT12 = 4;
                    permT21 = 4;
                    permT22 = 0;
                    permT31 = 2;
                    permT32 = 2;
                    permS = 0;
                }
                if (p == 7)
                {
                    swapR (&u, &v);
                    permU = 2;
                    permT11 = 1;
                    permT12 = 5;
                    permT21 = 5;
                    permT22 = 1;
                    permT31 = 3;
                    permT32 = 3;
                    permS = 1;
                }

                for (j = 0; j < 3; j++)
                    tally[j] = 0;

                /* Calculate everything... */
                TSIL_SetParameters (&result, x, y, z, u, v, qq);
                TSIL_Evaluate (&result, s);

                printf ("\nTest %d, permutation %d (", i, p);
                printf ("%s", argv[i]);
                printf ("): ");

                /* ...and check results: */

                /* U */
                for (j = 0; j < 4; j++)
                {
                    val = Uvalue[j];
                    if (j == permU)
                    {
                        TSIL_Compare (uname[j], val, result.U[j].value, TSIL_PASS, TSIL_WARN, &foo);
                        tally[foo]++;
                    }
                }

                /* T */
                for (j = 0; j < 6; j++)
                {
                    val = Tvalue[j];
                    if (j == permT11)
                    {
                        TSIL_Compare (tname[j], val, result.T[permT12].value,
                                      TSIL_PASS, TSIL_WARN, &foo);
                        tally[foo]++;
                    }
                    if (j == permT21)
                    {
                        TSIL_Compare (tname[j], val, result.T[permT22].value,
                                      TSIL_PASS, TSIL_WARN, &foo);
                        tally[foo]++;
                    }
                    if (j == permT31)
                    {
                        TSIL_Compare (tname[j], val, result.T[permT32].value,
                                      TSIL_PASS, TSIL_WARN, &foo);
                        tally[foo]++;
                    }
                }

                /* S */
                for (j = 0; j < 2; j++)
                {
                    val = Svalue[j];
                    if (j == permS)
                    {
                        TSIL_Compare (sname[j], val, result.S[j].value,
                                      TSIL_PASS, TSIL_WARN, &foo);
                        tally[foo]++;
                    }
                }

                /* V */
                for (j = 0; j < 4; j++)
                {
                    val = Vvalue[j];
                    if (j == permU)
                    {
                        TSIL_Compare (vname[j], val, result.V[j].value,
                                      TSIL_PASS_V, TSIL_WARN_V, &foo);
                        tally[foo]++;
                    }
                }

                /* Tbar */
                for (j = 0; j < 6; j++)
                {
                    val = Tbarvalue[j];
                    if (j == permT11)
                    {
                        TSIL_Compare (tbarname[j], val, result.Tbar[permT12].value,
                                      TSIL_PASS, TSIL_WARN, &foo);
                        tally[foo]++;
                    }
                    if (j == permT21)
                    {
                        TSIL_Compare (tbarname[j], val, result.Tbar[permT22].value,
                                      TSIL_PASS, TSIL_WARN, &foo);
                        tally[foo]++;
                    }
                    if (j == permT31)
                    {
                        TSIL_Compare (tbarname[j], val, result.Tbar[permT32].value,
                                      TSIL_PASS, TSIL_WARN, &foo);
                        tally[foo]++;
                    }
                }

                /* UU */
                for (j = 0; j < 4; j++)
                {
                    for (k = 0; k < 3; k++)
                    {
                        val = UUvalue[j][k];
                        if (j == permU)
                        {
                            TSIL_Compare (uuname[j][k], val, result.U[j].bold[k],
                                          TSIL_PASS, TSIL_WARN, &foo);
                            tally[foo]++;
                        }
                    }
                }

                /* VV */
                for (j = 0; j < 4; j++)
                {
                    for (k = 0; k < 3; k++)
                    {
                        val = VVvalue[j][k];
                        if (j == permU)
                        {
                            TSIL_Compare (vvname[j][k], val, result.V[j].bold[k],
                                          TSIL_PASS_V, TSIL_WARN_V, &foo);
                            tally[foo]++;
                        }
                    }
                }

                /* TT */
                for (j = 0; j < 6; j++)
                {
                    for (k = 0; k < 3; k++)
                    {
                        val = TTvalue[j][k];
                        if (j == permT11)
                        {
                            TSIL_Compare (ttname[j][k], val,
                                          result.T[permT12].bold[k],
                                          TSIL_PASS, TSIL_WARN, &foo);
                            tally[foo]++;
                        }
                        if (j == permT21)
                        {
                            TSIL_Compare (ttname[j][k], val,
                                          result.T[permT22].bold[k], TSIL_PASS, TSIL_WARN, &foo);
                            tally[foo]++;
                        }
                        if (j == permT31)
                        {
                            TSIL_Compare (ttname[j][k], val,
                                          result.T[permT32].bold[k], TSIL_PASS, TSIL_WARN, &foo);
                            tally[foo]++;
                        }
                    }
                }

                /* SS */
                for (j = 0; j < 2; j++)
                {
                    for (k = 0; k < 3; k++)
                    {
                        val = SSvalue[j][k];
                        if (j == permS)
                        {
                            TSIL_Compare (ssname[j][k], val, result.S[j].bold[k],
                                          TSIL_PASS, TSIL_WARN, &foo);
                            tally[foo]++;
                        }
                    }
                }

                if (tally[FAIL] > 0)
                {
                    nfail++;
                    printf ("\nFAILED FOR INPUT PARAMETERS:\n");
                    printf ("x = %.16lf;\n", (double) x);
                    printf ("y = %.16lf;\n", (double) y);
                    printf ("z = %.16lf;\n", (double) z);
                    printf ("u = %.16lf;\n", (double) u);
                    printf ("v = %.16lf;\n", (double) v);
                    printf ("s = %.16lf;\n", (double) s);
                    printf ("qq = %.16lf;\n", (double) qq);
                }
                else if (tally[WARN] > 0)
                {
                    nwarn++;
                    printf ("\nPASS\n");
                }
                else
                {
                    printf ("\nPASS\n");
                    npass++;
                }
            }
        }

        fclose (fp);

        printf ("\n===== Done with input file ");
        printf ("%s", argv[i]);
        printf (" =====\n");
    }

    printf ("\n== FINAL RESULTS ==\n");
    printf ("Total input files: %d\n", (argc - 1));
    printf ("Total tests performed: %d\n",
            (1 + Doperms * 3 + Doextraperms * 4) * (argc - 1));
    printf ("Pass: %d\n", npass);
    printf ("Warn: %d\n", nwarn);
    printf ("Fail: %d\n", nfail);

    return 0;
}
Пример #13
0
void tsilfevaluate_ (TSIL_REAL_F *x, 
		     TSIL_REAL_F *y,
		     TSIL_REAL_F *z,
		     TSIL_REAL_F *u,
		     TSIL_REAL_F *v,
		     TSIL_REAL_F *qq,
		     TSIL_REAL_F *s)
{
  /* Below is cut and pasted directly from tsil_names.h */
  const char *uname[] = {"Uzxyv","Uuyxv","Uxzuv","Uyuzv"};
  const char *tname[] = {"Tvyz", "Tuxv", "Tyzv", "Txuv", "Tzyv", "Tvxu"};
  const char *sname[] = {"Svyz", "Suxv"};
  const char *bname[] = {"Bxz", "Byu"};
  const char *vname[] = {"Vzxyv","Vuyxv","Vxzuv","Vyuzv"};
  const char *tbarname[] = {"TBARvyz", "TBARuxv", "TBARyzv",
			    "TBARxuv", "TBARzyv", "TBARvxu"};

  TSIL_DATA res;
  int i, j;
  static int compiledSize = TSIL_REAL_SIZE_F;

  if (rsize_.rsize != compiledSize)
    TSIL_Warn ("tsilfevaluate", "Apparent type mismatch between Fortran and C!");

  TSIL_SetParameters (&res,
		      (TSIL_REAL) (*x),
		      (TSIL_REAL) (*y),
		      (TSIL_REAL) (*z), 
		      (TSIL_REAL) (*u),
		      (TSIL_REAL) (*v),
		      (TSIL_REAL) (*qq));

  TSIL_Evaluate (&res, (TSIL_REAL) (*s));

  /* Extract results */
  results_.M = (TSIL_COMPLEX_F) TSIL_GetFunction (&res, "M");

  /* Note non-standard indexing-by-pointer of UU, VV, TT, SS arrays
     for compatibility with Fortran indexing convention. */

  for (i=0; i<NUM_U_FUNCS; i++) {
    results_.U[i] = (TSIL_COMPLEX_F) TSIL_GetFunction (&res, uname[i]);
    results_.V[i] = (TSIL_COMPLEX_F) TSIL_GetFunction (&res, vname[i]);
    for (j=0; j<3; j++) {
      *(&(results_.UU[0][0]) + j * NUM_U_FUNCS + i) = 
        (TSIL_COMPLEX_F) TSIL_GetBoldFunction (&res, uname[i], j);
      *(&(results_.VV[0][0]) + j * NUM_U_FUNCS + i) = 
        (TSIL_COMPLEX_F) TSIL_GetBoldFunction (&res, vname[i], j);
    }
  }

  for (i=0; i<NUM_T_FUNCS; i++) {
    results_.T[i] = (TSIL_COMPLEX_F) TSIL_GetFunction (&res, tname[i]);
    results_.Tbar[i] = (TSIL_COMPLEX_F) TSIL_GetFunction (&res, tbarname[i]);
    for (j=0; j<3; j++)
      *(&(results_.TT[0][0]) + j * NUM_T_FUNCS + i) = 
        (TSIL_COMPLEX_F) TSIL_GetBoldFunction (&res, tname[i], j);
  }
  
  for (i=0; i<NUM_S_FUNCS; i++) {
    results_.S[i] = (TSIL_COMPLEX_F) TSIL_GetFunction (&res, sname[i]);
    for (j=0; j<3; j++)
      *(&(results_.SS[0][0])  + j * NUM_S_FUNCS + i) = 
        (TSIL_COMPLEX_F) TSIL_GetBoldFunction (&res, sname[i], j);
  }

  for (i=0; i<NUM_B_FUNCS; i++)
    results_.B[i] = (TSIL_COMPLEX_F) TSIL_GetFunction (&res, bname[i]);

  return;
}
Пример #14
0
void SUMO_Warn (char *func, char *msg)
{
  TSIL_Warn (func, msg);
}