コード例 #1
0
ファイル: verify-lib.c プロジェクト: 8cH9azbsFifZ/wspr
double linear(dofft_closure *k, int realp,
	      int n, C *inA, C *inB, C *inC, C *outA,
	      C *outB, C *outC, C *tmp, int rounds, double tol)
{
     int j;
     double e = 0.0;

     for (j = 0; j < rounds; ++j) {
	  C alpha, beta;
	  c_re(alpha) = mydrand();
	  c_im(alpha) = realp ? 0.0 : mydrand();
	  c_re(beta) = mydrand();
	  c_im(beta) = realp ? 0.0 : mydrand();
	  arand(inA, n);
	  arand(inB, n);
	  k->apply(k, inA, outA);
	  k->apply(k, inB, outB);

	  ascale(outA, alpha, n);
	  ascale(outB, beta, n);
	  aadd(tmp, outA, outB, n);
	  ascale(inA, alpha, n);
	  ascale(inB, beta, n);
	  aadd(inC, inA, inB, n);
	  k->apply(k, inC, outC);

	  e = dmax(e, acmp(outC, tmp, n, "linear", tol));
     }
     return e;
}
コード例 #2
0
ファイル: getargs.c プロジェクト: GYGit/reactos
int aexpand(char* name, int expand_wildcards)
{
   char* s;
   WIN32_FIND_DATAA fd;
   HANDLE hFile;
   BOOLEAN first = TRUE;
   char buffer[256];
   uintptr_t pos;

   if (expand_wildcards && (s = strpbrk(name, "*?")))
   {
      hFile = FindFirstFileA(name, &fd);
      if (hFile != INVALID_HANDLE_VALUE)
      {
         while(s != name && *s != '/' && *s != '\\')
            s--;
         pos = s - name;
         if (*s == '/' || *s == '\\')
            pos++;
         strncpy(buffer, name, pos);
         do
         {
            if (!(fd.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY))
            {
               strcpy(&buffer[pos], fd.cFileName);
               if (aadd(_strdup(buffer)) < 0)
               {
                  FindClose(hFile);
                  return -1;
               }
               first = FALSE;
            }
         }
         while(FindNextFileA(hFile, &fd));
         FindClose(hFile);
      }
   }
   if (first)
   {
      if (aadd(name) < 0)
         return -1;
   }
   else
      free(name);
   return 0;
}
コード例 #3
0
ファイル: verify.c プロジェクト: AbheekG/chapel
static double verify_linear(fftd_func *dft, 
			  int N,
			  COMPLEX *inA,
			  COMPLEX *inB,
			  COMPLEX *inC,
			  COMPLEX *outA,
			  COMPLEX *outB,
			  COMPLEX *outC,
			  COMPLEX *tmp,
			  int rounds)
{
    int i; double maxerr = 0.0; double e;

    /* test 1: check linearity */
    for (i = 0; i < rounds; ++i) {
	COMPLEX alpha, beta;
	RE(alpha) = double_rand();
	IM(alpha) = double_rand();
	RE(beta) = double_rand();
	IM(beta) = double_rand();
	fill_random(inA, N);
	fill_random(inB, N);
	dft((double *)outA, (double *)inA);
	dft((double *)outB, (double *)inB);

	ascale(outA, alpha, N);
	ascale(outB, beta, N);
	aadd(tmp, outA, outB, N);
	ascale(inA, alpha, N);
	ascale(inB, beta, N);
	aadd(inC, inA, inB, N);
	dft((double *)outC, (double *)inC);

	e = acmp(outC, tmp, N);
	if(e > maxerr) maxerr = e;
    }
    return maxerr;
}
コード例 #4
0
ファイル: verify.c プロジェクト: AbheekG/chapel
static double verify_impulse(fftd_func *dft,
			    int n, int veclen,
			   COMPLEX *inA,
			   COMPLEX *inB,
			   COMPLEX *inC,
			   COMPLEX *outA,
			   COMPLEX *outB,
			   COMPLEX *outC,
			   COMPLEX *tmp,
			   int rounds)
{
     int N = n * veclen;
     COMPLEX impulse;
     int i;
     double e, maxerr = 0.0;

     /* test 2: check that the unit impulse is transformed properly */
     RE(impulse) = 1.0;
     IM(impulse) = 0.0;
     
     for (i = 0; i < N; ++i) {
	  /* impulse */
	  RE(inA[i]) = 0.0;
	  IM(inA[i]) = 0.0;
	  
	  /* transform of the impulse */
	  outA[i] = impulse;
     }
     for (i = 0; i < veclen; ++i)
	  inA[i * n] = impulse;

     /* a simple test first, to help with debugging: */
     dft((double *)outB, (double *)inA);
     e = acmp(outB, outA, N);
     if(e > maxerr) maxerr = e;

     for (i = 0; i < rounds; ++i) {
	  fill_random(inB, N);
	  asub(inC, inA, inB, N);
   	  dft((double *)outB, (double *)inB);
   	  dft((double *)outC, (double *)inC);
	  aadd(tmp, outB, outC, N);
	  e = acmp(tmp, outA, N);
	  if(e > maxerr) maxerr = e;
     }
     return maxerr;
}
コード例 #5
0
ファイル: verify-lib.c プロジェクト: 8cH9azbsFifZ/wspr
static double impulse0(dofft_closure *k,
		       int n, int vecn, 
		       C *inA, C *inB, C *inC,
		       C *outA, C *outB, C *outC,
		       C *tmp, int rounds, double tol)
{
     int N = n * vecn;
     double e = 0.0;
     int j;

     k->apply(k, inA, tmp);
     e = dmax(e, acmp(tmp, outA, N, "impulse 1", tol));

     for (j = 0; j < rounds; ++j) {
	  arand(inB, N);
	  asub(inC, inA, inB, N);
	  k->apply(k, inB, outB);
	  k->apply(k, inC, outC);
	  aadd(tmp, outB, outC, N);
	  e = dmax(e, acmp(tmp, outA, N, "impulse", tol));
     }
     return e;
}
コード例 #6
0
int main()
   {
   Break<aaa> po(10,12);
   Break<bbb> op(21,12);


   Test<aaa> a;
   Test<aaa> b;
   Test<bbb> c;
   Test<ccc> d;
   Test<ddd> e;
   Test<ccc> f;
   Test<aaa> g;

   Node<int> aadd(10);

   auto rr = new Node<int>(10);

   int daaa = add(21,23);
   auto dbbb = add<float>(21.3f, 32.12);

   doStuff<int>(1);
   doStuff<float>(1);
/*
   std::vector<int> ab;
   int r = 20;
   while(r--)
      a.push_back(r);

   auto dd = derp(a, true, 0);

   char str[] = "This is a test";

   auto ca = herp(str);*/

   return 0;
   }