• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C++ IMIN函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: ec_laplace_encode

void ec_laplace_encode(ec_enc * enc, int *value, unsigned fs, int decay)
{
	unsigned fl;
	int val = *value;
	fl = 0;
	if (val) {
		int s;
		int i;
		s = -(val < 0);
		val = (val + s) ^ s;
		fl = fs;
		fs = ec_laplace_get_freq1(fs, decay);
		/* Search the decaying part of the PDF. */
		for (i = 1; fs > 0 && i < val; i++) {
			fs *= 2;
			fl += fs + 2 * LAPLACE_MINP;
			fs = (fs * (int32_t) decay) >> 15;
		}
		/* Everything beyond that has probability LAPLACE_MINP. */
		if (!fs) {
			int di;
			int ndi_max;
			ndi_max =
			    (32768 - fl + LAPLACE_MINP - 1) >> LAPLACE_LOG_MINP;
			ndi_max = (ndi_max - s) >> 1;
			di = IMIN(val - i, ndi_max - 1);
			fl += (2 * di + 1 + s) * LAPLACE_MINP;
			fs = IMIN(LAPLACE_MINP, 32768 - fl);
			*value = (i + di + s) ^ s;
		} else {
开发者ID:CEPBEP,项目名称:onion-phone,代码行数:30,代码来源:laplace.c


示例2: GMRFLib_ged_remove

/**
  \brief Add a node or an edge from an editable graph-object

  \param[in,out] ged The editable graph-object.
  \param[in] node First node
  \param[in] nnode Second node

  If \a node is different from \a nnode, then add the edge between \a node and \a nnode, and create node \a node and node \a
  nnode if they do not exists.  If \a node equals \a nnode, then add node \a node itself.

  \sa GMRFLib_ged_remove(), GMRFLib_ged_append_node(), GMRFLib_ged_append_graph()

*/
int GMRFLib_ged_add(GMRFLib_ged_tp * ged, int node, int nnode)
{
	/*
	 * add edge between node and nnode. add 'node' or 'nnode' to the set if not already present 
	 */
	if (node == nnode) {
		spmatrix_set(&(ged->Q), node, node, 1.0);
		/*
		 * workaround for internal ``bug'' in hash.c 
		 */
		spmatrix_value(&(ged->Q), node, node);
	} else {
		spmatrix_set(&(ged->Q), IMIN(node, nnode), IMAX(node, nnode), 1.0);
		spmatrix_set(&(ged->Q), node, node, 1.0);
		spmatrix_set(&(ged->Q), nnode, nnode, 1.0);
		/*
		 * workaround for internal ``bug'' in hash.c 
		 */
		spmatrix_value(&(ged->Q), IMIN(node, nnode), IMAX(node, nnode));
		spmatrix_value(&(ged->Q), node, node);
		spmatrix_value(&(ged->Q), nnode, nnode);
	}
	ged->max_node = IMAX(ged->max_node, IMAX(node, nnode));

	return GMRFLib_SUCCESS;
}
开发者ID:ccowingzitron,项目名称:inla,代码行数:39,代码来源:graph-edit.c


示例3: run_analysis

void run_analysis(TonalityAnalysisState *analysis, const CELTMode *celt_mode, const void *analysis_pcm,
                 int analysis_frame_size, int frame_size, int c1, int c2, int C, opus_int32 Fs,
                 int lsb_depth, downmix_func downmix, AnalysisInfo *analysis_info)
{
   int offset;
   int pcm_len;

   if (analysis_pcm != NULL)
   {
      /* Avoid overflow/wrap-around of the analysis buffer */
      analysis_frame_size = IMIN((DETECT_SIZE-5)*Fs/100, analysis_frame_size);

      pcm_len = analysis_frame_size - analysis->analysis_offset;
      offset = analysis->analysis_offset;
      do {
         tonality_analysis(analysis, NULL, celt_mode, analysis_pcm, IMIN(480, pcm_len), offset, c1, c2, C, lsb_depth, downmix);
         offset += 480;
         pcm_len -= 480;
      } while (pcm_len>0);
      analysis->analysis_offset = analysis_frame_size;

      analysis->analysis_offset -= frame_size;
   }

   analysis_info->valid = 0;
   tonality_get_info(analysis, analysis_info, frame_size);
}
开发者ID:0culus,项目名称:ioq3,代码行数:27,代码来源:analysis.c


示例4: smooth

void smooth (float **in, float **out, long naxes[], float sigma, float radius)
{
    int i, j, k, l, xmin, ymin, xmax, ymax;
    float sumwt, sumflux, wt, rad;

    for (j=1; j <= naxes[2]; j++) {
	for (i=1; i <= naxes[1]; i++) {
	    xmin = IMAX (1, i - NINT(radius));
	    xmax = IMIN (i+NINT(radius), naxes[1]);
	    ymin = IMAX (1, j - NINT(radius));
	    ymax = IMIN (j+NINT(radius), naxes[2]);
	    sumwt = 0.;
	    sumflux = 0.;
	    for (l=ymin; l <= ymax; l++) {
		for (k=xmin; k <= xmax; k++) {
		    rad = sqrt((k-i)*(k-i)+(l-j)*(l-j));
		    if (rad <= radius) {
		        wt = exp (-rad*rad/2/sigma/sigma);
			sumwt += wt;
			sumflux += in[l][k] * wt;
		    };
		};	    
	    };
	    out[j][i] = sumflux / sumwt;
	};
    };
}
开发者ID:vvinuv,项目名称:pymorph,代码行数:27,代码来源:smooth.c


示例5: grab_pointer_position

void grab_pointer_position(int *src_x, int *src_y, int *width, int *height)
{
	int dest_x, dest_y;
	createWindow();
	removeTile();
	show_forever();
	show_toplevel();
	changeCursor(dpy, win);
	showWindow();
	window_main_loop(src_x, src_y, &dest_x, &dest_y);
	*width = IMAX(*src_x, dest_x) - IMIN(*src_x, dest_x);
	*height = IMAX(*src_y, dest_y) - IMIN(*src_y, dest_y);
}
开发者ID:ahqmhjk,项目名称:XScreenShot,代码行数:13,代码来源:shot.c


示例6: fs_init

static void
fs_init (VisualFX * _this, PluginInfo * info)
{

  FSData *data;

  data = (FSData *) malloc (sizeof (FSData));

  data->fx_mode = FIREWORKS_FX;
  data->maxStars = 4096;
  data->stars = (Star *) malloc (data->maxStars * sizeof (Star));
  data->nbStars = 0;

  data->max_age_p = secure_i_param ("Fireworks Smallest Bombs");
  IVAL (data->max_age_p) = 80;
  IMIN (data->max_age_p) = 0;
  IMAX (data->max_age_p) = 100;
  ISTEP (data->max_age_p) = 1;

  data->min_age_p = secure_i_param ("Fireworks Largest Bombs");
  IVAL (data->min_age_p) = 99;
  IMIN (data->min_age_p) = 0;
  IMAX (data->min_age_p) = 100;
  ISTEP (data->min_age_p) = 1;

  data->nbStars_limit_p = secure_i_param ("Max Number of Particules");
  IVAL (data->nbStars_limit_p) = 512;
  IMIN (data->nbStars_limit_p) = 0;
  IMAX (data->nbStars_limit_p) = data->maxStars;
  ISTEP (data->nbStars_limit_p) = 64;

  data->fx_mode_p = secure_i_param ("FX Mode");
  IVAL (data->fx_mode_p) = data->fx_mode;
  IMIN (data->fx_mode_p) = 1;
  IMAX (data->fx_mode_p) = 3;
  ISTEP (data->fx_mode_p) = 1;

  data->nbStars_p = secure_f_feedback ("Number of Particules (% of Max)");

  data->params = plugin_parameters ("Particule System", 7);
  data->params.params[0] = &data->fx_mode_p;
  data->params.params[1] = &data->nbStars_limit_p;
  data->params.params[2] = 0;
  data->params.params[3] = &data->min_age_p;
  data->params.params[4] = &data->max_age_p;
  data->params.params[5] = 0;
  data->params.params[6] = &data->nbStars_p;

  _this->params = &data->params;
  _this->fx_data = (void *) data;
}
开发者ID:JJCG,项目名称:gst-plugins-good,代码行数:51,代码来源:flying_stars_fx.c


示例7: mpsqrt

void mpsqrt(unsigned char w[], unsigned char u[], unsigned char v[], int n,
	int m)
{
	void mplsh(unsigned char u[], int n);
	void mpmov(unsigned char u[], unsigned char v[], int n);
	void mpmul(unsigned char w[], unsigned char u[], unsigned char v[], int n,
		int m);
	void mpneg(unsigned char u[], int n);
	void mpsdv(unsigned char w[], unsigned char u[], int n, int iv, int *ir);
	int i,ir,j,mm;
	float fu,fv;
	unsigned char *r,*s;

	r=cvector(1,n<<1);
	s=cvector(1,n<<1);
	mm=IMIN(m,MF);
	fv=(float) v[mm];
	for (j=mm-1;j>=1;j--) {
		fv *= BI;
		fv += v[j];
	}
	fu=1.0/sqrt(fv);
	for (j=1;j<=n;j++) {
		i=(int) fu;
		u[j]=(unsigned char) i;
		fu=256.0*(fu-i);
	}
	for (;;) {
		mpmul(r,u,u,n,n);
		mplsh(r,n);
		mpmul(s,r,v,n,IMIN(m,n));
		mplsh(s,n);
		mpneg(s,n);
		s[1] -= 253;
		mpsdv(s,s,n,2,&ir);
		for (j=2;j<n;j++) {
			if (s[j]) {
				mpmul(r,s,u,n,n);
				mpmov(u,&r[1],n);
				break;
			}
		}
		if (j<n) continue;
		mpmul(r,u,v,n,IMIN(m,n));
		mpmov(w,&r[1],n);
		free_cvector(s,1,n<<1);
		free_cvector(r,1,n<<1);
		return;
	}
}
开发者ID:contentsciences,项目名称:githubapitest,代码行数:50,代码来源:mpsqrt.c


示例8: arith_evaluate

/* PUBLIC */
int arith_evaluate(Term t, BOOL *evaluated)
{
  if (!arith_term(t)) {
    *evaluated = FALSE;
    return 0;
  }

  if (VARIABLE(t))
    return VARNUM(t);
  else {
    int sn = SYMNUM(t);

    if (sn == Div_sn || sn == Mod_sn) {
      int d = arith_evaluate(ARG(t,1), evaluated);
      if (d == 0) {
	*evaluated = FALSE;
	return 0;
      }
      else if (sn == Div_sn)
	return arith_evaluate(ARG(t,0), evaluated) / d;
      else
	return modulo(arith_evaluate(ARG(t,0), evaluated), d);
    }

    else if (sn == Sum_sn)
      return arith_evaluate(ARG(t,0), evaluated) + arith_evaluate(ARG(t,1), evaluated);
    else if (sn == Prod_sn)
      return arith_evaluate(ARG(t,0), evaluated) * arith_evaluate(ARG(t,1), evaluated);
    else if (sn == Neg_sn)
      return -arith_evaluate(ARG(t,0), evaluated);
    else if (sn == Abs_sn)
      return abs(arith_evaluate(ARG(t,0), evaluated));
    else if (sn == Domain_size_sn)
      return Domain_size;
    else if (sn == Min_sn) {
      int a0 = arith_evaluate(ARG(t,0), evaluated);
      int a1 = arith_evaluate(ARG(t,1), evaluated);
      return IMIN(a0,a1);
    }
    else if (sn == Max_sn) {
      int a0 = arith_evaluate(ARG(t,0), evaluated);
      int a1 = arith_evaluate(ARG(t,1), evaluated);
      return IMAX(a0,a1);
    }
    else if (sn == Lt_sn)
      return arith_evaluate(ARG(t,0), evaluated) <  arith_evaluate(ARG(t,1), evaluated);
    else if (sn == Le_sn)
      return arith_evaluate(ARG(t,0), evaluated) <= arith_evaluate(ARG(t,1), evaluated);
    else if (sn == Gt_sn)
      return arith_evaluate(ARG(t,0), evaluated) >  arith_evaluate(ARG(t,1), evaluated);
    else if (sn == Ge_sn)
      return arith_evaluate(ARG(t,0), evaluated) >= arith_evaluate(ARG(t,1), evaluated);
    else if (sn == Eq_sn)
      return arith_evaluate(ARG(t,0), evaluated) == arith_evaluate(ARG(t,1), evaluated);
    else {
      fatal_error("arith_evaluate, operation not handled");
      return INT_MIN;
    }
  }
}  /* arith_evaluate */
开发者ID:axelrod9,项目名称:ladr,代码行数:61,代码来源:arithmetic.c


示例9: getm

void  getm (int ci,struct edgemiginfo *edgem,struct edgemiginfo *sisem, struct edgemiginfo *oldedgem,struct edgemiginfo *oldsisem)
{
  int lastmigperiod;
//  int i, ii;

/*for (ii = 0;ii<2;ii++)
for (i=0;i<5;i++)
{
  checkptype[ii][i] = -100;
  checkrr[ii][i] = 0;
}  //8_30_10 */

  lastmigperiod = IMIN(edgem->e,lastperiodnumber-1);
  if ( sisem->edgeid == -1  /* sisem->mtall <= 0*/)  // no sister edge, or sister edge not in a period where migration can occur
  {
    assert(sisem->mtimeavail[0] == 0);
    edgem->mpall = mwork_single_edge (ci, edgem,oldedgem, lastmigperiod); 
  }
  else
  {
    assert (edgem->e == sisem->e);
    if (edgem->mtall <= 0)   // edge has no length in a period with migration,  so just do sister edge
    {
      assert(edgem->mtimeavail[0] == 0);
      sisem->mpall = mwork_single_edge (ci, sisem,oldsisem, lastmigperiod);
    }
    else
    {  // both edge and sis have length in periods with migration
      mwork_two_edges(ci, edgem, sisem,oldedgem, oldsisem, lastmigperiod, &edgem->mpall, &sisem->mpall);

    }
  }
}  //getm
开发者ID:goshng,项目名称:Peach,代码行数:33,代码来源:update_gtree.c


示例10: get_score

/* ==========================================================================
   get_score 
   ========================================================================== */
float get_score(int w_x[],int w_y[],int nwhisker_points,TMatrix2D I_Conv)
{
  float **conv_dat;
  float score = 0;
  int min_x,max_x;
  int *yy, x;
  int ncols, nrows;

  conv_dat = Mat2D_getDataFloat(I_Conv);
  ncols = Mat2D_getnCols(I_Conv);
  nrows = Mat2D_getnRows(I_Conv);
  
  min_x = IMAX(w_x[0],0);
  max_x = IMIN(w_x[nwhisker_points-1],nrows-1);

  get_spline(w_x,w_y,nwhisker_points,min_x, max_x, &yy);
  
  for (x=min_x;x<=max_x;x++)
    if (yy[x]>=0 && yy[x]<ncols)
      score += conv_dat[x][yy[x]];
  
  free_ivector(yy,min_x,max_x);

  return(score);
}
开发者ID:pmknutsen,项目名称:whiskertracker,代码行数:28,代码来源:find_next_whisker.c


示例11: SetMode

/******************************************************************************
 *  Function        : SetMode
 *  Description     : Set ECB/CBC mode for encryption/decryption
 *  Input           : N/A
 *  Return          : N/A
 *  Note            : N/A
 *  Globals Changed : N/A
 ******************************************************************************
 */
void SetMode(void)
{
  BYTE key;
  BYTE kbdbuf[18];
  
  memset(kbdbuf, 0, sizeof(kbdbuf));
  DispLineMW("ENC/DEC Mode:", MW_LINE1, MW_CLRDISP|MW_BIGFONT);
  DispLineMW("[ENTER] - ECB", MW_LINE3, MW_BIGFONT);
  DispLineMW("[CLEAR] - CBC", MW_LINE5, MW_BIGFONT);
  switch (key=APM_WaitKey(9000, 0)) {
    case MWKEY_ENTER:
      KDLL_SetOpMode(MODE_ECB, kbdbuf);
      AcceptBeep();
      break;
    case MWKEY_CLR:
      DispLineMW("Init Vector:", MW_LINE1, MW_CLRDISP|MW_BIGFONT);
      if (!APM_GetKbd(HEX_INPUT+ECHO+MW_LINE3+RIGHT_JUST, IMIN(16)+IMAX(16), kbdbuf))
        return;
      compress(&kbdbuf[1], &kbdbuf[1], 8);
      KDLL_SetOpMode(MODE_CBC, &kbdbuf[1]);
      AcceptBeep();
      break;
    default:
      break;
  }
}
开发者ID:dJacomeWposs,项目名称:repoPrueba,代码行数:35,代码来源:keytrans.c


示例12: opus_decode

int opus_decode(OpusDecoder *st, const unsigned char *data,
                opus_int32 len, opus_int16 *pcm, int frame_size, int decode_fec)
{
    VARDECL(float, out);
    int ret, i;
    int nb_samples;
    ALLOC_STACK;

    if(frame_size<=0)
    {
        RESTORE_STACK;
        return OPUS_BAD_ARG;
    }

    if (data != NULL && len > 0 && !decode_fec)
    {
        nb_samples = opus_decoder_get_nb_samples(st, data, len);
        if (nb_samples>0)
            frame_size = IMIN(frame_size, nb_samples);
        else
            return OPUS_INVALID_PACKET;
    }
    ALLOC(out, frame_size*st->channels, float);

    ret = opus_decode_native(st, data, len, out, frame_size, decode_fec, 0, NULL, 1);
    if (ret > 0)
    {
        for (i=0; i<ret*st->channels; i++)
            pcm[i] = FLOAT2INT16(out[i]);
    }
    RESTORE_STACK;
    return ret;
}
开发者ID:biddyweb,项目名称:azfone-ios,代码行数:33,代码来源:opus_decoder.c


示例13: sm_init

OpusSM* sm_init(int samplerate, int channels)
{
	OpusSM* sm = (OpusSM*)malloc(sizeof(OpusSM));
	sm->error = SM_OK;
	if (samplerate != SM_SUPPORTED_SAMPLERATE) {
		sm->error = SM_ERR_UNSUPPORTED_SAMPLERATE;
		sm->opus_enc = NULL;
		return sm;
	}
	/* application can be: (see opus_encoder_init() in src/opus_encoder.c)
	     OPUS_APPLICATION_VOIP
	     OPUS_APPLICATION_AUDIO
	     OPUS_APPLICATION_RESTRICTED_LOWDELAY */
	int error;
	sm->opus_enc = opus_encoder_create(samplerate, channels, OPUS_APPLICATION_VOIP, &error);
	if (error != 0) {
		sm->error = SM_ERR_OPUS_ENC_CREATE_FAILED;
		return sm;
	}

	sm->celt_enc = (CELTEncoder*)((char*)sm->opus_enc + sm->opus_enc->celt_enc_offset);
	celt_encoder_ctl(sm->celt_enc, CELT_GET_MODE(&sm->celt_mode));
	sm->lsb_depth = IMIN(16, sm->opus_enc->lsb_depth);
	sm->delay_compensation = 0;
	if (sm->opus_enc->application != OPUS_APPLICATION_RESTRICTED_LOWDELAY) sm->delay_compensation = sm->opus_enc->delay_compensation;
	return sm;
}
开发者ID:jzombi,项目名称:opus_sm,代码行数:27,代码来源:opus_sm.c


示例14: savgol

 void savgol(double *c, int np, int nl, int nr, int ld, int m)  {
/*-------------------------------------------------------------------------------------------
 USES lubksb,ludcmp given below.
 Returns in c(np), in wrap-around order (see reference) consistent with the argument respns
 in routine convlv, a set of Savitzky-Golay filter coefficients. nl is the number of leftward
 (past) data points used, while nr is the number of rightward (future) data points, making
 the total number of data points used nl+nr+1. ld is the order of the derivative desired
 (e.g., ld = 0 for smoothed function). m is the order of the smoothing polynomial, also
 equal to the highest conserved moment; usual values are m = 2 or m = 4.
-------------------------------------------------------------------------------------------*/
int imj,ipj,j,k,kk,mm;
double d,fac,sum,**a,*b;

if (np < nl+nr+1 || nl < 0 || nr < 0 || ld > m || nl+nr < m)
	nrerror("bad args in savgol");

int *indx= intvector(1,m+1);
a=matrix(1,m+1,1,m+1);
b=vector(1,m+1);
for (ipj=0;ipj<=(m << 1);ipj++)
	{//Set up the normal equations of the desired least-squares fit
	sum=(ipj ? 0.0 : 1.0);
	for (k=1;k<=nr;k++)
		sum += pow((double)k,(double)ipj);
	for (k=1;k<=nl;k++)
		sum += pow((double)-k,(double)ipj);
	mm=IMIN(ipj,2*m-ipj);
	for (imj = -mm;imj<=mm;imj+=2)
		a[1+(ipj+imj)/2][1+(ipj-imj)/2]=sum;
	}

ludcmp(a, m+1, indx, &d); //Solve them: LU decomposition.

for (j=1;j<=m+1;j++)
	b[j]=0.0;

b[ld+1]=1.0; //Right-hand side vector is unit vector, depending on which derivative we want.

lubksb(a,m+1,indx,b); //Get one row of the inverse matrix.

for (kk=1;kk<=np;kk++)
	c[kk]=0.0; //Zero the output array (it may be bigger than number of coefficients).

for (k = -nl;k<=nr;k++)
	{
	sum=b[1];   //Each Savitzky-Golay coefficient is the dot product
				//of powers of an integer with the inverse matrix row.
	fac=1.0;
	for (mm=1;mm<=m;mm++)
		sum += b[mm+1]*(fac *= k);

	kk=((np-k) % np)+1; //Store in wrap-around order.
	c[kk]=sum;
	}

free_vector(b,1,m+1);
free_matrix(a,1,m+1,1,m+1);
free_intvector(indx,1,m+1);
}
开发者ID:BackupTheBerlios,项目名称:qtiplot-svn,代码行数:59,代码来源:nrutil.cpp


示例15: IMIN_VECTOR

int IMIN_VECTOR(int v[], unsigned long l)
/* Find smallest value in v */
{
 unsigned long i;
 int m=v[0];
 for (i=1;i<l;i++) m=IMIN(m,v[i]);
 return(m);
}
开发者ID:KathleenLabrie,项目名称:KLlibc,代码行数:8,代码来源:myutil.c


示例16: procesoConsultaSaldoImp

BOOLEAN procesoConsultaSaldoImp(void){
	int costServ = 0;
	BYTE kbdbuff[10];
	BYTE tmpPan[20 + 1];
	//BYTE aux[10];

	memset(kbdbuff, 0x00, sizeof(kbdbuff));
	memset(tmpPan,  0x00, sizeof(tmpPan));
	//memset(aux, 0x00, sizeof(aux));

	costServ = RSP_DATA.dd_amount;
	DispClrBelowMW(MW_LINE2);
	DispLineMW( "Costo Servicio:", MW_LINE3, MW_LEFT|MW_SPFONT );
	//split(aux, gToken_80.costoServicio, 2);
	//costServ = atoi(aux);
	DispAmnt( costServ, MW_LINE3, MW_SPFONT );
	if( SiNo() != 2 ) {  // 2 = Press Enter
		return FALSE;
	}
	DispLineMW( "DESLICE LA TARJETA", MW_LINE4, MW_SMFONT|MW_CENTER|MW_CLRDISP );

	if( GetCard( FALSE, FALSE ) == FALSE ){
		LongBeep();
		DispLineMW( "CONSULTA DE SALDO", MW_LINE1, MW_CENTER|MW_REVERSE|MW_SMFONT|MW_CLRDISP );
		DispLineMW( "TRANSACCION CANCELADA", MW_LINE3, MW_CENTER );
		APM_WaitKey(200, 0);
		return FALSE;
	}
	do
	{
		DispLineMW( "CONSULTA DE SALDO", MW_LINE1, MW_CENTER|MW_REVERSE|MW_CLRDISP|MW_SMFONT );
		DispLineMW( "INGRESE LOS ULTIMOS", MW_LINE3, MW_CENTER|MW_SPFONT );
		DispLineMW( "CUATRO DIGITOS", MW_LINE4, MW_CENTER|MW_SPFONT );
		DispLineMW( "DE LA TARJETA", MW_LINE5, MW_CENTER|MW_SPFONT );

		memset(kbdbuff, 0x00, sizeof(kbdbuff));
		APM_SetCol(7); // Set Columna for TextBox
		if (!APM_GetKbd(NUMERIC_INPUT + MW_SMFONT + MW_LINE7, IMIN(4) + IMAX(4), kbdbuff)){
			return FALSE;
		}
		// Compara los ultimo 4 digitos del Pan
		memset( tmpPan, 0x00, sizeof(tmpPan) );
		split( tmpPan, INPUT.sb_pan, 10 );
		RTrim( tmpPan, 'F');
	} while (memcmp(&kbdbuff[1], &tmpPan[strlen(tmpPan) - 4], 4) != 0);

	DispLineMW( "CONSULTA DE SALDO", MW_LINE1, MW_CENTER|MW_REVERSE|MW_SMFONT|MW_CLRDISP );
	DispLineMW( "Costo Servicio:", MW_LINE3, MW_LEFT|MW_SPFONT );
	DispAmnt(costServ, MW_LINE3, MW_SPFONT);

	if( !getPinblock() )
		return FALSE;

	INPUT.dd_amount = costServ;	// El costo del servicio debe viajar en el campo 4 en la proxima transaccion
	sprintf(gAmount, "%012d", INPUT.dd_amount);

	return TRUE;
}
开发者ID:dJacomeWposs,项目名称:repoPrueba,代码行数:58,代码来源:Func.c


示例17: GMRFLib_ged_add

/**
  \brief Remove a node or an edge from an editable graph-object

  \param[in,out] ged The editable graph-object.
  \param[in] node First node
  \param[in] nnode Second node

  If \a node is different from \a nnode, then remove the edge between \a node and \a nnode. If \a node equals \a nnode, then
  remove node \a node itself. Note that if node \a node is removed, then so are all edges where \a node is a part of. 

  \sa GMRFLib_ged_add(), GMRFLib_ged_append_graph(), GMRFLib_ged_append_node()

*/
int GMRFLib_ged_remove(GMRFLib_ged_tp * ged, int node, int nnode)
{
	/*
	 * mark the edge between node and nnode as 'removed', or the node itself if they're equal 
	 */
	spmatrix_set(&(ged->Q), IMIN(node, nnode), IMAX(node, nnode), 0.0);

	return GMRFLib_SUCCESS;
}
开发者ID:ccowingzitron,项目名称:inla,代码行数:22,代码来源:graph-edit.c


示例18: mexFunction

void mexFunction(int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[]) {

	/* Check number of input arguments */
	if (nrhs != 4) {
		ERROR("Two input arguments are required.");
	}

	/* Check number of output arguments */
	if (nlhs > 2) {
		ERROR("Too many output arguments.");
    }

	DOUBLE *X = (DOUBLE*) mxGetData(prhs[0]);
	DOUBLE *rp = (DOUBLE*) mxGetData(prhs[1]);
	INT M = (INT) * (DOUBLE *) mxGetData(prhs[2]);
	INT N = (INT) * (DOUBLE *) mxGetData(prhs[3]);
//  INT M = (INT) mxGetM(prhs[0]);
//	INT N = (INT) mxGetN(prhs[0]);

	plhs[0] = mxCreateNumericMatrix(1, 1, MXPRECISION_CLASS, mxREAL);
	DOUBLE *obj = (DOUBLE *) mxGetData(plhs[0]);
	DOUBLE *deriv;
	INT derivFlag;

	if (nlhs == 2) {
		plhs[1] = mxCreateNumericMatrix(M * N, 1, MXPRECISION_CLASS, mxREAL);
		deriv = (DOUBLE *) mxGetData(plhs[1]);
		derivFlag = 1;
	} else {
		deriv = NULL;
		derivFlag = 0;
	}

	INT MN = IMIN(M, N);
	DOUBLE *svdVec = (DOUBLE *) MALLOC(1 * MN * sizeof(DOUBLE));
	DOUBLE *dataBuffer = (DOUBLE *) MALLOC(M * N * sizeof(DOUBLE));
	DOUBLE *derivVec = NULL;
	DOUBLE *vtMat = NULL;
	if (derivFlag == 1) {
		derivVec = (DOUBLE *) MALLOC(1 * MN * sizeof(DOUBLE));
		vtMat = (DOUBLE *) MALLOC(MN * N * sizeof(DOUBLE));
	}

	nuclear_approx_obj_grad(obj, deriv, X, rp, M, N, derivFlag, svdVec, vtMat, \
						dataBuffer, derivVec, NULL, 0);

	FREE(svdVec);
	FREE(dataBuffer);
	if (derivFlag == 1) {
		FREE(derivVec);
		FREE(vtMat);
	}
}
开发者ID:pfShawn,项目名称:sparse_linear_model,代码行数:53,代码来源:nuclear_approx_obj_grad_mex.cpp


示例19: hxget

// (size < 0) means hxhold: head is left locked on exit.
//  Usual usage is: hxhold(), modify record, hxput().
int
hxget(HXFILE * hp, char *rp, int size)
{
    HXLOCAL	loc, *locp = &loc;
    int		leng, rpos, loops, junk;
    HXBUF       *bufp;
    char        *recp;

    if (!hp || !rp)
	return	HXERR_BAD_REQUEST;
    if (hxdebug > 1) {
        char    buf[25] = {};
        hx_save(hp, rp, size<0 ? -size-1 : size, buf, sizeof buf);
        DEBUG2("%s('%s...')", size < 0 ? "hold" : "get",
                                buf, size);
    }

    ENTER(locp, hp, rp, 1);
    if (size >= 0) {
       locp->mode = F_RDLCK;
        _hxlockset(locp, HEAD_LOCK);    // just lock head
    } else {
        _hxlockset(locp, HIGH_LOCK);    // lock head, +split if > head
        HOLD_HEAD(locp);
    }
    if (IS_MMAP(hp)) _hxremap(locp);

    leng	= 0;
    loops	= HX_MAX_CHAIN;
    bufp	= &locp->buf[0];
    bufp->next	= locp->head;

    do {
        if (!--loops)
    	    LEAVE(locp, HXERR_BAD_FILE);

        _hxload(locp, bufp, bufp->next);
        rpos = _hxfind(locp, bufp, locp->hash, rp, &junk);
    } while (rpos < 0 && bufp->next);

    if (rpos < 0)
    	LEAVE(locp, 0);

    recp = bufp->data + rpos;
    leng = RECLENG(recp);
    memcpy(rp, RECDATA(recp), IMIN(leng, size<0? -size-1 : size));

    LEAVE(locp, leng);
}
开发者ID:rsanaie,项目名称:hx,代码行数:51,代码来源:hxget.c


示例20: procesoConsultaSaldoCNB

BOOLEAN procesoConsultaSaldoCNB(void){
  
  BYTE kbdbuff[10];
  BYTE tmpPan[20 + 1];
  //BYTE aux[10];

  memset(kbdbuff, 0x00, sizeof(kbdbuff));
  memset(tmpPan,  0x00, sizeof(tmpPan));
  //memset(aux, 0x00, sizeof(aux));

  
  DispClrBelowMW(MW_LINE2);
  DispLineMW( "CONSULTA SALDO CNB", MW_LINE1, MW_CENTER|MW_REVERSE|MW_CLRDISP|MW_SMFONT );
  DispLineMW( "DESLICE LA TARJETA", MW_LINE4, MW_SMFONT|MW_CENTER|MW_CLRDISP );

  if( GetCard( FALSE, FALSE ) == FALSE ){
    LongBeep();
    DispLineMW( "CONSULTA SALDO CNB", MW_LINE1, MW_CENTER|MW_REVERSE|MW_SMFONT|MW_CLRDISP );
    DispLineMW( "TRANSACCION CANCELADA", MW_LINE3, MW_CENTER );
    APM_WaitKey(200, 0);
    return FALSE;
  }
  do
  {
    DispLineMW( "CONSULTA SALDO CNB", MW_LINE1, MW_CENTER|MW_REVERSE|MW_CLRDISP|MW_SMFONT );
    DispLineMW( "INGRESE LOS ULTIMOS", MW_LINE3, MW_CENTER|MW_SPFONT );
    DispLineMW( "CUATRO DIGITOS", MW_LINE4, MW_CENTER|MW_SPFONT );
    DispLineMW( "DE LA TARJETA", MW_LINE5, MW_CENTER|MW_SPFONT );

    memset(kbdbuff, 0x00, sizeof(kbdbuff));
    APM_SetCol(7); // Set Columna for TextBox
    if (!APM_GetKbd(NUMERIC_INPUT + MW_SMFONT + MW_LINE7, IMIN(4) + IMAX(4), kbdbuff)){
      return FALSE;
    }
    // Compara los ultimo 4 digitos del Pan
    memset( tmpPan, 0x00, sizeof(tmpPan) );
    split( tmpPan, INPUT.sb_pan, 10 );
    RTrim( tmpPan, 'F');
  } while (memcmp(&kbdbuff[1], &tmpPan[strlen(tmpPan) - 4], 4) != 0);

  DispLineMW( "CONSULTA SALDO CNB", MW_LINE1, MW_CENTER|MW_REVERSE|MW_SMFONT|MW_CLRDISP );
  

  if( !getPinblock() )
    return FALSE;

   return TRUE;
}
开发者ID:dJacomeWposs,项目名称:repoPrueba,代码行数:48,代码来源:Func.c



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ IMMBYTE函数代码示例发布时间:2022-05-30
下一篇:
C++ IMG_REG_WRITE函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap