当前位置: 首页>>代码示例>>C++>>正文


C++ BENCH_ASSERT函数代码示例

本文整理汇总了C++中BENCH_ASSERT函数的典型用法代码示例。如果您正苦于以下问题:C++ BENCH_ASSERT函数的具体用法?C++ BENCH_ASSERT怎么用?C++ BENCH_ASSERT使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了BENCH_ASSERT函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: BenchGaussjPrec

void BenchGaussjPrec(INT N,INT M)
{
    GaussjPrec  GP(N,M);

    for (INT y=0; y<N ; y++)
    {
        for (INT x=0; x<N ; x++)
            GP.M()(x,y) = NRrandom3()-0.5 + 2 * N * (x==y);
		{
        for (INT x=0; x<M ; x++)
            GP.b()(x,y) = NRrandom3();
		}
    }

    bool OK = GP.init_rec();
    BENCH_ASSERT(OK);
	{
    for (INT y=0; y<N ; y++)
        for (INT x=0; x<N ; x++)
            GP.M()(x,y) +=  (NRrandom3()-0.5) * N * 5e-2;
	}

    for (INT k=0 ; k<10 ; k++)
    {
      GP.amelior_sol();
    }
    BENCH_ASSERT(GP.ecart()<epsilon);
}
开发者ID:jakexie,项目名称:micmac,代码行数:28,代码来源:b_0_48.cpp

示例2: BENCH_ASSERT

bench_tensor *tensor_compress(const bench_tensor *sz)
{
     int i, rnk;
     bench_tensor *x;

     BENCH_ASSERT(BENCH_FINITE_RNK(sz->rnk));
     for (i = rnk = 0; i < sz->rnk; ++i) {
          BENCH_ASSERT(sz->dims[i].n > 0);
          if (sz->dims[i].n != 1)
               ++rnk;
     }

     x = mktensor(rnk);
     for (i = rnk = 0; i < sz->rnk; ++i) {
          if (sz->dims[i].n != 1)
               x->dims[rnk++] = sz->dims[i];
     }

     if (rnk) {
	  /* God knows how qsort() behaves if n==0 */
	  qsort(x->dims, (size_t)x->rnk, sizeof(bench_iodim),
		(int (*)(const void *, const void *))dimcmp);
     }

     return x;
}
开发者ID:DougBurke,项目名称:sherpa,代码行数:26,代码来源:tensor.c

示例3: bench_filo

void bench_filo()
{
    All_Memo_counter MC_INIT;
    stow_memory_counter(MC_INIT);
    INT nb = 200;

    {
         ElFilo<III> Fi(4);
		 INT i;

         for ( i= 0; i<nb; i++)
             Fi.pushlast(III(i));

         for ( i= 0; i<nb; i++)
             Fi[i].i() *= 2;

         for ( i= 0; i<nb; i++)
             BENCH_ASSERT(Fi[i].i() == 2*i);

         for ( i= 2*(nb-1) ; i>= 2; i-= 2)
             BENCH_ASSERT(Fi.poplast().i() == i);

         BENCH_ASSERT(Fi.nb() == 1);
    }
    verif_memory_state(MC_INIT);
}
开发者ID:jakexie,项目名称:micmac,代码行数:26,代码来源:b_0_36.cpp

示例4: stepDir2

void BenchcDbleGrid
     (
         Pt2dr aP0In,Pt2dr aP1In,
         REAL               aStepDir,
         ElDistortion22_Gen & aDist
     )
{
     //cDbleGrid aDGr(aP0In,aP1In,aStepDir,aDist);
     Pt2dr stepDir2(aStepDir,aStepDir);                // __NEW
     cDbleGrid aDGr(false,aP0In,aP1In,stepDir2,aDist); // __NEW

     for (REAL aX = aP0In.x ; aX<aP1In.x ; aX += aStepDir)
         for (REAL aY = aP0In.y ; aY<aP1In.y ; aY += aStepDir)
         {
             REAL x = aX + NRrandom3() * aStepDir;
             SetInRange(aP0In.x,x,aP1In.x);
             REAL y = aY + NRrandom3() * aStepDir;
             SetInRange(aP0In.y,y,aP1In.y);

	     Pt2dr aP(x,y);
	     Pt2dr aQ0 = aDist.Direct(aP);
	     Pt2dr aQ1 = aDGr.Direct(aP);
	     Pt2dr aR0 = aDist.Inverse(aQ0);
	     Pt2dr aR1 = aDist.Inverse(aQ1);

	     REAL aDQ = euclid(aQ0,aQ1);
	     REAL aDR = euclid(aR0,aP) +  euclid(aR1,aP);
	     aDQ /= ElSquare(aStepDir);
	     aDR /= ElSquare(aStepDir);
	     BENCH_ASSERT(aDQ<0.1);
	     BENCH_ASSERT(aDR<0.1);
         }
}
开发者ID:jakexie,项目名称:micmac,代码行数:33,代码来源:b_0_38.cpp

示例5: mNbVar

cBenchLeastSquare::cBenchLeastSquare
(
    INT aNbVar,
    INT aNbEq,
    bool SomForm
)  :
   FoncNVarDer<REAL> (aNbVar),
   mNbVar (aNbVar),
   mNbEq  (aNbEq),
   mSys (aNbVar,aNbEq),
   mSol (1),
   mSolEps (aNbVar),  
   mTmpVF  (aNbVar),
   mDataTmpVF (mTmpVF.data())
{
   Im1D_REAL8 aFLin(aNbVar);
   REAL8* aDLin = aFLin.data();

   for (INT iEq = 0 ; iEq < aNbEq ; iEq++)
   {
       for (INT iVar=0 ; iVar<aNbVar ; iVar++)
       {
	    if (SomForm)
	    {
		if (iEq<2*aNbVar)
	           aDLin[iVar] = (iVar==(iEq%mNbVar));
		else
	           aDLin[iVar] = NRrandC() * (NRrandC()>0);
	    }
	    else
	       aDLin[iVar] = NRrandC();
       }
       mSys.PushEquation
       (
           aFLin,
	   NRrandC() * 1e3,
	   0.1 + NRrandom3()
       );
   }

   bool Ok;
   mSol = mSys.L2Solve(&Ok);
   mResidu = mSys.L2SomResiduPond(mSol);
   BENCH_ASSERT(Ok);

   for (INT k=0 ; k< 200 ; k++)
   {
	ELISE_COPY
	(
	    mSolEps.all_pts(),
	    mSol.in() + (frandr()-0.5),
	    mSolEps.out()
	);
	REAL ResEps =  mSys.L2SomResiduPond(mSolEps);
	 // cout << (ResEps-mResidu) << " " << mResidu << "\n";
	BENCH_ASSERT(ResEps>mResidu);
   }
   // getchar();
}
开发者ID:jakexie,项目名称:micmac,代码行数:59,代码来源:b_0_46_2.cpp

示例6: ImCorrFromNrFFT

     void VerifCorrelCNC
          (
               Pt2di aDec,
               bool Pondered,
               Im2D_REAL8 aCPad,
               REAL anEps,
               Im2D_REAL8  aCNC,
               REAL aRatioSurf
          )
     {
	      REAL aS_CorFFT = ImCorrFromNrFFT(aCPad,aDec);

	      REAL aS,aS1,aS2,aS11,aS12,aS22;

              Symb_FNum aP (    Pondered                                ?
                                trans(mPds1.in(0),aDec)*mPds2.in(0)     :
                                trans(mIm1.inside(),aDec)
                           );
              Symb_FNum aF1 (trans(mIm1.in(0),aDec));
              Symb_FNum aF2 (mIm2.in(0));

              ELISE_COPY 
              ( 
                 mIm1.all_pts(), 
                 Virgule
                 (
                   1,aF1,aF2,
                   aF1*aF1,aF1*aF2,aF2*aF2
                 )*aP,
                 Virgule
                 (
                       Virgule(sigma(aS)  ,sigma(aS1) ,sigma(aS2)),
                       Virgule(sigma(aS11),sigma(aS12),sigma(aS22))
                 )
              );
              if (! Pondered)
	          BENCH_ASSERT(std::abs(aS12-aS_CorFFT )<epsilon);

              aS = std::max(aS,anEps);
              aS1 /= aS;
              aS2 /= aS;
              aS11 = aS11/aS - aS1 * aS1 ;
              aS12 = aS12/aS - aS1 * aS2 ;
              aS22 = aS22/aS - aS2 * aS2 ;

              REAL aCor = aS12 / sqrt(std::max(anEps,aS11*aS22));	
              if (aS<aRatioSurf)
              {
                   aCor = -1 + (aCor+1) * (aS/aRatioSurf);
              }


	      REAL aNCCorFFT = ImCorrFromNrFFT(aCNC,aDec);


              BENCH_ASSERT(std::abs(aCor-aNCCorFFT)<epsilon);
      }
开发者ID:jakexie,项目名称:micmac,代码行数:57,代码来源:b_0_53.cpp

示例7: dist_chamfer_cabl

void dist_chamfer_cabl(Im2D<U_INT1,INT> I,INT v_max)
{
     Im2D<U_INT1,INT> I0(I.tx(),I.ty(),0);

     ELISE_COPY(I0.all_pts(),I.in(),I0.out());
     Chamfer::d32.im_dist(I);

     INT nb_dif;
     ELISE_COPY
     (
          I.all_pts(),
          I0.in()!=(I.in()!=0),
          sigma(nb_dif)
     );
     BENCH_ASSERT(nb_dif == 0);

     INT tx = I.tx();
     INT ty = I.ty();
     U_INT1 ** d = I.data();
     INT     vmax = I.vmax()-1;
     
     for (int x=1; x<tx-1 ; x++)
         for (int y=1; y<ty-1 ; y++)
         {
              
              INT v;
              if (d[y][x])
                 v  = std::min3 
                      (
                          std::min3(d[y+1][x-1]+3,d[y+1][x]+2,d[y+1][x+1]+3),
                          std::min3(d[y][x-1]+2,vmax,d[y][x+1]+2),
                          std::min3(d[y-1][x-1]+3,d[y-1][x]+2,d[y-1][x+1]+3)
                      );
              else
                 v = 0;

              BENCH_ASSERT(v == d[y][x]);
         }

      INT dif;
      ELISE_COPY 
      (
           I.all_pts(),
           Abs
           (
               Min(I.in(),v_max)
             - extinc_32(I0.in(0),v_max)
           ),
           VMax(dif)
      );

      BENCH_ASSERT(dif == 0);
}
开发者ID:jakexie,项目名称:micmac,代码行数:53,代码来源:b_0_23.cpp

示例8: bench_r2d_shading

void bench_r2d_shading()
{
    Pt2di sz(120,50);

    Im2D_REAL8       MNT(sz.x,sz.y,0.0);
    Im2D_REAL8       SHAD1(sz.x,sz.y,0.0);
    Im2D_REAL8       SHAD2(sz.x,sz.y,0.0);


    ELISE_COPY(MNT.all_pts(),frandr(),MNT.out());

    ELISE_COPY
    (
        MNT.all_pts(),
        binary_shading(MNT.in(),1.0),
        SHAD1.out()
    );

    ELISE_COPY
    (
        MNT.lmr_all_pts(Pt2di(1,0)),
        binary_shading(MNT.in(),1.0),
        SHAD2.out()
    );

    REAL dif;

    ELISE_COPY (MNT.all_pts(),Abs(SHAD1.in()-SHAD2.in()),VMax(dif));
    BENCH_ASSERT(dif<epsilon);


    ELISE_COPY
    (
        MNT.all_pts(),
        gray_level_shading(MNT.in()),
        SHAD1.out()
    );

    ELISE_COPY
    (
        MNT.lmr_all_pts(Pt2di(1,0)),
        gray_level_shading(MNT.in()),
        SHAD2.out()
    );


    ELISE_COPY (MNT.all_pts(),Abs(SHAD1.in()-SHAD2.in()),VMax(dif));
    BENCH_ASSERT(dif<epsilon);
}
开发者ID:jakexie,项目名称:micmac,代码行数:49,代码来源:b_0_24.cpp

示例9: tensor_rowmajor_transposedp

static int tensor_rowmajor_transposedp(bench_tensor *t)
{
     bench_iodim *d;
     int i;

     BENCH_ASSERT(FINITE_RNK(t->rnk));
     if (t->rnk < 2)
	  return 0;

     d = t->dims;
     if (d[0].is != d[1].is * d[1].n
	 || d[0].os != d[1].is
	 || d[1].os != d[0].os * d[0].n)
	  return 0;
     if (t->rnk > 2 && d[1].is != d[2].is * d[2].n)
	  return 0;
     for (i = 2; i + 1 < t->rnk; ++i) {
          d = t->dims + i;
          if (d[0].is != d[1].is * d[1].n
	      || d[0].os != d[1].os * d[1].n)
               return 0;
     }

     if (t->rnk > 2 && t->dims[t->rnk-1].is != t->dims[t->rnk-1].os)
	  return 0;
     return 1;
}
开发者ID:dstuck,项目名称:tinker_integrated_PIMC,代码行数:27,代码来源:mpi-bench.c

示例10: bench_dist_InerMat_seg_droite

void bench_dist_InerMat_seg_droite()
{
    for (int i = 0; i<100 ; i++)
    {
        Pt2dr p1  = Pt2dr((NRrandom3()-0.5)*1e4,(NRrandom3()-0.5)*1e4);
        Pt2dr p2 = p1;

        while (euclid(p1-p2) < 1e2)
              p2  = Pt2dr((NRrandom3()-0.5)*1e4,(NRrandom3()-0.5)*1e4);

        SegComp s(p1,p2);
        int nb = (int)(50 * NRrandom3());
        REAL d0 = 0.0;
        RMat_Inertie m;
        for (int j =0; j<nb ; j++)
        {
             Pt2dr q  = Pt2dr((NRrandom3()-0.5)*1e4,(NRrandom3()-0.5)*1e4);
             REAL pds = NRrandom3();
             m = m.plus_cple(q.x,q.y,pds);
             d0 += pds * s.square_dist_droite(q);
        }
        REAL d1 = square_dist_droite(s,m);

        BENCH_ASSERT(std::abs(d0 -d1) < BIG_epsilon);
    }
}
开发者ID:jakexie,项目名称:micmac,代码行数:26,代码来源:b_0_36.cpp

示例11: if

static const char *parseint(const char *s, int *n)
{
     int sign = 1;

     *n = 0;

     if (*s == '-') { 
	  sign = -1;
	  ++s;
     } else if (*s == '+') { 
	  sign = +1; 
	  ++s; 
     }

     BENCH_ASSERT(isdigit(*s));
     while (isdigit(*s)) {
	  *n = *n * 10 + (*s - '0');
	  ++s;
     }
     
     *n *= sign;

     if (*s == 'k' || *s == 'K') {
	  *n *= 1024;
	  ++s;
     }

     if (*s == 'm' || *s == 'M') {
	  *n *= 1024 * 1024;
	  ++s;
     }

     return s;
}
开发者ID:376473984,项目名称:fftw3,代码行数:34,代码来源:problem.c

示例12: setup

void setup(struct problem *p)
{
     BENCH_ASSERT(can_do(p));

     /* Call FFT once to initialize things before benchmarking: */
     doit(1, p);
}
开发者ID:syntheticpp,项目名称:benchfft,代码行数:7,代码来源:doit.c

示例13: rdwisdom

void rdwisdom(void)
{
     FILE *f;
     double tim;
     int success = 0;

     if (havewisdom) return;

#ifdef HAVE_SMP
     BENCH_ASSERT(FFTW(init_threads)());
     FFTW(plan_with_nthreads)(nthreads);
#endif

     if (!usewisdom) return;

     timer_start(USER_TIMER);
     if ((f = fopen(wisdat, "r"))) {
	  if (!import_wisdom(f))
	       fprintf(stderr, "bench: ERROR reading wisdom\n");
	  else
	       success = 1;
	  fclose(f);
     }
     tim = timer_stop(USER_TIMER);

     if (success) {
	  if (verbose > 1) printf("READ WISDOM (%g seconds): ", tim);
	  
	  if (verbose > 3)
	       export_wisdom(stdout);
	  if (verbose > 1)
	       printf("\n");
     }
     havewisdom = 1;
}
开发者ID:8cH9azbsFifZ,项目名称:wspr,代码行数:35,代码来源:fftw-bench.c

示例14: tensor_real_rowmajorp

/* detect screwy real padded rowmajor... ugh */
int tensor_real_rowmajorp(bench_tensor *t, int sign, int in_place)
{
     int i;

     BENCH_ASSERT(BENCH_FINITE_RNK(t->rnk));

     i = t->rnk - 1;

     if (--i >= 0) {
          bench_iodim *d = t->dims + i;
	  if (sign < 0) {
	       if (d[0].is != d[1].is * (in_place ? 2*(d[1].n/2 + 1) : d[1].n))
		    return 0;
	       if (d[0].os != d[1].os * (d[1].n/2 + 1))
		    return 0;
	  }
	  else {
	       if (d[0].is != d[1].is * (d[1].n/2 + 1))
		    return 0;
	       if (d[0].os != d[1].os * (in_place ? 2*(d[1].n/2 + 1) : d[1].n))
		    return 0;
	  }
     }

     while (--i >= 0) {
          bench_iodim *d = t->dims + i;
          if (d[0].is != d[1].is * d[1].n)
               return 0;
          if (d[0].os != d[1].os * d[1].n)
               return 0;
     }
     return 1;
}
开发者ID:DougBurke,项目名称:sherpa,代码行数:34,代码来源:tensor.c

示例15: bench_dotens2

void bench_dotens2(const bench_tensor *sz0, const bench_tensor *sz1, dotens2_closure *k)
{
     BENCH_ASSERT(sz0->rnk == sz1->rnk);
     if (sz0->rnk == BENCH_RNK_MINFTY)
          return;
     recur(sz0->rnk, sz0->dims, sz1->dims, k, 0, 0, 0, 0);
}
开发者ID:DougBurke,项目名称:sherpa,代码行数:7,代码来源:dotens2.c


注:本文中的BENCH_ASSERT函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。