本文整理汇总了C++中IMAX函数的典型用法代码示例。如果您正苦于以下问题:C++ IMAX函数的具体用法?C++ IMAX怎么用?C++ IMAX使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了IMAX函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: stree_remove
static
Stree stree_remove(Stree s, Topform c)
{
if (s == NULL)
fatal_error("stree_remove, clause not found");
else if (c->weight == s->weight) {
clist_remove(c, s->clauses);
if (clist_empty(s->clauses) && s->left == NULL && s->right == NULL) {
clist_free(s->clauses);
free_stree(s);
return NULL;
}
else if (clist_empty(s->clauses))
s->greatest_id = 0;
else
s->greatest_id = s->clauses->last->c->id;
}
else if (c->weight < s->weight)
s->left = stree_remove(s->left, c);
else
s->right = stree_remove(s->right, c);
{
int a = s->left ? s->left->greatest_id : 0;
int b = clist_empty(s->clauses) ? 0 : s->clauses->last->c->id;
int c = s->right ? s->right->greatest_id : 0;
int d = IMAX(b,c);
s->greatest_id = IMAX(a,d);
}
s->n--;
return s;
} /* stree_remove */
示例2: 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;
};
};
}
示例3: 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;
}
示例4: 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);
}
示例5: 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;
}
示例6: greatest_check
static
void greatest_check(Stree s)
{
if (s == NULL)
return;
else {
int a = s->left ? s->left->greatest_id : 0;
int b = clist_empty(s->clauses) ? 0 : s->clauses->last->c->id;
int c = s->right ? s->right->greatest_id : 0;
int d = IMAX(b,c);
int e = IMAX(a,d);
if (e != s->greatest_id)
fatal_error("greatest_check, stree corrupt");
}
} /* greatest_check */
示例7: 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 */
示例8: init_semantics
/* PUBLIC */
void init_semantics(Plist interp_terms, Clock eval_clock,
char *type, int eval_limit, int eval_var_limit)
{
Plist p;
int max_domain_size = 0;
for (p = interp_terms; p; p = p->next) {
Interp a = compile_interp(p->v, FALSE);
max_domain_size = IMAX(max_domain_size, interp_size(a));
Compiled_interps = plist_prepend(Compiled_interps, a);
}
Compiled_interps = reverse_plist(Compiled_interps);
if (str_ident(type, "false_in_all"))
False_in_all = TRUE;
else if (str_ident(type, "false_in_some"))
False_in_all = FALSE;
else
fatal_error("init_semantics, bad type");
if (eval_var_limit == -1)
Eval_limit = eval_limit;
else {
Eval_limit = int_power(max_domain_size, eval_var_limit);
printf("eval_limit reset to %d.\n", Eval_limit);
}
Eval_clock = eval_clock;
} /* init_semantics */
示例9: 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;
}
}
示例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);
}
示例11: get_chunk_info
static void get_chunk_info (int ndata, int *nchunks, int *chunksize)
{
static const int chunksize_min=100;
static const int nchunks_max=10;
*chunksize = IMAX(chunksize_min,(ndata+nchunks_max-1)/nchunks_max);
if ((*chunksize)&1) ++(*chunksize);
*nchunks = (ndata+*chunksize-1) / *chunksize;
}
示例12: IMAX_VECTOR
int IMAX_VECTOR(int v[], unsigned long l)
/* Find largest value in v */
{
unsigned long i;
int m=v[0];
for (i=1;i<l;i++) m=IMAX(m,v[i]);
return(m);
}
示例13: tonality_get_info
void tonality_get_info(TonalityAnalysisState *tonal, AnalysisInfo *info_out, int len)
{
int pos;
int curr_lookahead;
float psum;
int i;
pos = tonal->read_pos;
curr_lookahead = tonal->write_pos-tonal->read_pos;
if (curr_lookahead<0)
curr_lookahead += DETECT_SIZE;
/* On long frames, look at the second analysis window rather than the first. */
if (len > tonal->Fs/50 && pos != tonal->write_pos)
{
pos++;
if (pos==DETECT_SIZE)
pos=0;
}
if (pos == tonal->write_pos)
pos--;
if (pos<0)
pos = DETECT_SIZE-1;
OPUS_COPY(info_out, &tonal->info[pos], 1);
/* If possible, look ahead for a tone to compensate for the delay in the tone detector. */
for (i=0;i<3;i++)
{
pos++;
if (pos==DETECT_SIZE)
pos = 0;
if (pos == tonal->write_pos)
break;
info_out->tonality = MAX32(0, -.03f + MAX32(info_out->tonality, tonal->info[pos].tonality-.05f));
}
tonal->read_subframe += len/(tonal->Fs/400);
while (tonal->read_subframe>=8)
{
tonal->read_subframe -= 8;
tonal->read_pos++;
}
if (tonal->read_pos>=DETECT_SIZE)
tonal->read_pos-=DETECT_SIZE;
/* The -1 is to compensate for the delay in the features themselves. */
curr_lookahead = IMAX(curr_lookahead-1, 0);
psum=0;
/* Summing the probability of transition patterns that involve music at
time (DETECT_SIZE-curr_lookahead-1) */
for (i=0;i<DETECT_SIZE-curr_lookahead;i++)
psum += tonal->pmusic[i];
for (;i<DETECT_SIZE;i++)
psum += tonal->pspeech[i];
psum = psum*tonal->music_confidence + (1-psum)*tonal->speech_confidence;
/*printf("%f %f %f %f %f\n", psum, info_out->music_prob, info_out->vad_prob, info_out->activity_probability, info_out->tonality);*/
info_out->music_prob = psum;
}
示例14: 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;
}
示例15: 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;
}