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


C++ COMP函数代码示例

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


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

示例1: C1DTOEDGELIST

Word C1DTOEDGELIST(Word cl, Word cm, Word cr)
{
  Word E,L,i,Ll,Lr,l,a,b,t;

Step1: /* Initialize. */
  E = NIL;

Step2: /* Get adjacencies for (cl,cm) and (cr,cm). */
  L = FIRST(ADJ_2D_PART(cm,cl,cr,P,J));
  i = LAST(LELTI(cm,INDX));
  Ll = NIL; Lr = NIL;
  while(L != NIL) {
    ADV(L,&l,&L);
    FIRST2(l,&a,&b);
    if (FIRST(a) == i) {
      t = a; a = b; b = t; }
    if (FIRST(a) < i)
      Ll = COMP(LIST2(a,b),Ll); 
    else
      Lr = COMP(LIST2(a,b),Lr); }

Step3: /* Get edges from adjacency info. */
  E = CONC(ADJ2DITOEL(Ll,cl,cm),E);
  E = CONC(ADJ2DITOEL(Lr,cr,cm),E);
    
Return: /* Prepare to return. */
  return E;
}
开发者ID:fchapoton,项目名称:qepcad-1,代码行数:28,代码来源:temp.c

示例2: ESPCADCTPILSNC

/* ESPCAD cell triple and polynomial index list of strong necessary conditions. */
Word ESPCADCTPILSNC(Word c1,Word c2, Word c3, Word i, Word j,Word k, Word P)
{
  Word Lt,Lf,C,c,A,tt,tf,L,Lp,Ls;

Step1: /* Classify cells as true or false. */
  C = LIST3(c1,c2,c3);
  for(Lt = NIL, Lf = NIL; C != NIL; C = RED(C)) {
    c = FIRST(C);
    switch(LELTI(c,SC_TMPM)) {
    case TRUE:  Lt = COMP(c,Lt); break;
    case FALSE: Lf = COMP(c,Lf); break;
    default: break; } }

Step2: /* Need a true cell and a false cell to continue. */
  if (Lt == NIL || Lf == NIL) {
    L = NIL;
    goto Return; }

Step3: /* Weed out conditions that are not strong & necessary. */
  Ls = FMAAFPIRN(i,j,k);
  for(L = NIL; Ls != NIL; Ls = RED(Ls)) {
    A = FIRST(Ls);
    for(tt = 1, Lp = Lt; tt && Lp != NIL; Lp = RED(Lp))
      tt = FMACELLEVAL(A,FIRST(Lp),P);
    for(tf = 1, Lp = Lf; tf && Lp != NIL; Lp = RED(Lp))
      tf = FMACELLEVAL(A,FIRST(Lp),P);
    if (tt && !tf)
      L = COMP(A,L); }

Return: /* */
  return L;
}
开发者ID:fchapoton,项目名称:qepcad-1,代码行数:33,代码来源:ESPCADLSNC.c

示例3: memset

void Socket::connect(const std::string& h, const std::string& s) {
	host = h; serv = s;

	int status;
	addrinfo hint, *info;
	memset(&hint, 0, sizeof(hint));
	hint.ai_family = AF_INET;
	hint.ai_socktype = SOCK_STREAM;

	LOG(COMP("Connecting to %1", hostserv()), LOG_MSG)

	ERR(status = getaddrinfo(host.c_str(), serv.c_str(), &hint, &info),
		COMP("getaddrinfo():%1", gai_strerror(status)))

	ERR((fd = socket(info->ai_family, info->ai_socktype,
		info->ai_protocol)) == -1, COMP("socket():%1", strerror(errno)))

	ERR(setsockopt(fd, SOL_SOCKET, SO_REUSEADDR, &(status=1),
		sizeof(status)) == -1, COMP("setsockopt():%1", strerror(errno)))

	ERR(::connect(fd, info->ai_addr, info->ai_addrlen) == -1,
		COMP("connect():%1", strerror(errno)))

	freeaddrinfo(info);
	disconnected = false;
}
开发者ID:Edgeworth,项目名称:chat23,代码行数:26,代码来源:socket.cpp

示例4: MINHITSET

Word MINHITSET(Word A, Word B)
{
      Word L,As,C,Cp,p,Ap,T,s;

Step1: /* Quick decisions. */
      if (A == NIL) return (NIL);
      if ((B == 0) || (FIRST(A) == NIL)) return (MC_FAIL);

Step2: /* Initialize loop. */
      L = FIRST(A);
      As = RED(A);
      C = MC_FAIL; 

Step3: /* Loop over the elements of L, looking for a min. hit set of A. */
      while ( (L != NIL) && (B != 0) ) {
	ADV(L,&p,&L);

Step4: /* Eliminate from A all sets hit by p, call this Ap. */
	Ap = NIL; T = As;
	while ( T != NIL) {
	  ADV(T,&s,&T);
	  if (! MEMBER(p,s)) {
	    Ap = COMP(s,Ap); } }
	Ap = INV(Ap);

Step5: /* Recurse: Look for a cover of Ap of at most B-1 columns. */
         Cp = MINHITSET(Ap,B-1);
         if ( Cp != MC_FAIL ) {
           C = COMP(p,Cp);
           B = LENGTH(Cp); } }

Return: /* Loop complete.  Return. */
      return (C);
}
开发者ID:fchapoton,项目名称:qepcad-1,代码行数:34,代码来源:MINHITSET.c

示例5: ADJ_2D1

Word ADJ_2D1(Word c, Word c_l, Word P, Word J)
{
  Word U,V,v_l,Sol,S,A,Ap,a,b;
  /*
init();
sa_send("[");
  */
Step1: /* Initialization. */
  v_l = LDCOEFMASK(c,P,J);
  U = AD2DS_CONS(c_l,P);
  V = AD2DS_CONS(c,P);

Step2: /* Get Adjacencies. */
  /* Sol = ADJ_2D1_SIMPLE(U,V,v_l,FIRST(LELTI(c,INDX))); */
  Sol = ADJ_2D1P1(U,V,v_l,FIRST(LELTI(c,INDX)));

Step3: /* If c_l is to the right of c, reverse order of pairs. */
  if (FIRST(LELTI(c,INDX)) < FIRST(LELTI(c_l,INDX))) {
    for(S = NIL; Sol != NIL; Sol = RED(Sol)) {
      for(A = NIL, Ap = FIRST(Sol); Ap != NIL; Ap = RED(Ap)) {
	FIRST2(FIRST(Ap),&a,&b);
	A = COMP(LIST2(b,a),A); }
      S = COMP(A,S); }
    Sol = S; }

Return: /* Prepare to return. */
  /*
  sa_send("]\n");
  uninit();
  */
  return Sol;
}
开发者ID:fchapoton,项目名称:qepcad-1,代码行数:32,代码来源:ADJ_2D1.c

示例6: insert

struct Interval* insert(struct Interval* intervals, int intervalsSize, struct Interval newInterval, int* returnSize) {
    struct Interval* ns = malloc(sizeof(struct Interval) * (intervalsSize + 1));
    (* returnSize) = 0;
    int i;
    if (intervalsSize == 0 || intervals[0].start > newInterval.start) {
        i = 0;
        ns[(* returnSize)].start = newInterval.start;
        ns[(* returnSize)].end = newInterval.end;
        newInterval.start = newInterval.end = INT_MAX;
    } else if (intervalsSize > 0) {
        i = 1;
        ns[(* returnSize)].start = intervals[0].start;
        ns[(* returnSize)].end = intervals[0].end;
    }
    if (intervalsSize == 0) {
        (* returnSize)++;
        return ns;
    }
    for ( ; i < intervalsSize ; i++) {
        if (newInterval.start < intervals[i].start) {
            COMP(newInterval);
            newInterval.start = newInterval.end = INT_MAX;
            i--;
        } else {
            COMP(intervals[i]);
        }
    }
    if (newInterval.start != INT_MAX) {
        COMP(newInterval);
    }
    (* returnSize)++;
    return ns;
}
开发者ID:komea,项目名称:leetcode,代码行数:33,代码来源:057-Insert+Interval.c

示例7: MBPROD

Word MBPROD(Word A, Word B)
{
       Word A1,A11,Ap,Ap1,B1,B11,Bp,Bs,C,C1,C11,i,j,k,p,q,qp,r;
       /* hide C11,i,j,k,p,q,qp,r; */

Step1: /* Get the sizes of $A$ and $B$. */
        p = LENGTH(A); if (p == 0) q = 0; else q = LENGTH(FIRST(A));
        qp = LENGTH(B); if (qp == 0) r = 0; else r = LENGTH(FIRST(B));

Step2: /* Multiply. */
        C = NIL; Ap = A;
        for (i = 1; i <= p; i++)
           {
           C1 = NIL; ADV(Ap,&A1,&Ap); Bp = B;
           for (j = 1; j <= r; j++)
              {
              C11 = 0; Bs = NIL; Ap1 = A1;
              for (k = 1; k <= q; k++)
                 {
                 ADV(Ap1,&A11,&Ap1);
                 ADV(Bp,&B1,&Bp); ADV(B1,&B11,&B1);
                 C11 = C11 + A11 * B11;
                 Bs = COMP(B1,Bs);
                 }
              Bp = INV(Bs); C1 = COMP(C11,C1);
              }
           C1 = INV(C1); C = COMP(C1,C);
           }
        C = INV(C);
        goto Return;

Return: /* Prepare for return. */
       return(C);
}
开发者ID:fchapoton,项目名称:qepcad-1,代码行数:34,代码来源:MBPROD.c

示例8: for

Word QepcadCls::IPFZT(Word r, Word A)
{
       Word A1,Ap,As,P,Ths,i,s,t;
       /* hide Ap,Ths,i,s,t; */

Step1: /* Initialize. */
                                /*Int*/ if (PCIPFZT == 'n') return(0);
                                /*Int*/ Ths = ACLOCK();
        t = 1; P = NIL; for (i = r; i >= 1; i--)
        P = COMP(i,P); i = 1;

Step2: /* Test for finitely many distinct x sub i - coordinates among
     the common zeros. */ Ap = A; As = NIL; do
        { ADV(Ap,&A1,&Ap);
        if (i > 1) A1 = PPERMV(r,A1,P); s = PUNT(r,A1);
        if (s == 2) goto Step4; else if (s == 1) goto Step3;
        As = COMP(A1,As); } while (!(Ap == NIL)); As = INV(As);
        if (!IPFZT1(r,As)) { t = 0; goto Step4; }

Step3: /* Check for completion. */ i = i + 1; if (i > r) goto Step4;
        P = PERMCY(P); goto Step2;

Step4: /* Return. */
                               /*Int*/ Ths = ACLOCK() - Ths;
                               /*Int*/ TMIPFZT[r] = TMIPFZT[r] + Ths;
        goto Return;

Return: /* Prepare for return. */
       return(t);
}
开发者ID:fchapoton,项目名称:qepcad-1,代码行数:30,代码来源:IPFZT.c

示例9: PCADCSV

Word PCADCSV(Word cs, Word Ps)
{
      Word c,l,S,s,I,V,Vs;

Step1: /* */
      c = LELTI(cs,SC_REP);
      l = LELTI(c,LEVEL);
      if (l == 0) {
	Vs = NIL; goto Return; }
      S = LELTI(Ps,l);

      for(I = NIL; S != NIL; S = RED(S)) {
	s = FIRST(S);
	I = COMP(THIRD(LELTI(s,PO_LABEL)),I); }

      LBIBMS(I);
      I = CINV(I);

      V = FIRST(LELTI(c,SIGNPF));
      for(Vs = NIL;I != NIL; I = RED(I))
	Vs = COMP(LELTI(V,FIRST(I)),Vs);      

Return: /* Prepare to return. */
      return (Vs);
}
开发者ID:fchapoton,项目名称:qepcad-1,代码行数:25,代码来源:PCADCSV.c

示例10: testSIimplOI

void testSIimplOI(BDigit r, Word P, Word ZL, Word NZ, Word A)
{
  /* Compute generators A and all its 1st order partials */
  Word L = LIST1(A);
  for(int i = 1; i <= r; ++i)
  {
    Word D = IPDER(r,A,i);
    if (D != 0)
      L = COMP(D,L);
  } 
  L = CCONC(L,ZL);

  /* Compute a variable list for output purposes. */
  Word V = NIL;
  for(int i = r; i > 0; i--)
  {
    char s[2];
      s[0] = 'a' - 1 + i;
      s[1] = '\0';
      V = COMP(LFS(s),V);
  }

  /* Go through assumptions and find non-vanishing conditions. */
  Word M = NZ;
  SWRITE("Test si ==> oi: ");
  IPDWRITE(r,A,V);
  SWRITE("\n");
  GBTest(r,L,V);
}
开发者ID:fchapoton,项目名称:qepcad-1,代码行数:29,代码来源:SIIOIQ.c

示例11: process_request_line

static ret_t
process_request_line (cherokee_handler_admin_t *hdl, cherokee_buffer_t *line)
{
#define COMP(str,sub) (strncmp(str, sub, sizeof(sub)-1) == 0)

    if (COMP (line->buf, "get server.ports")) {
        return cherokee_admin_server_reply_get_ports (HANDLER(hdl), &hdl->dwriter);
    } else if (COMP (line->buf, "get server.traffic")) {
        return cherokee_admin_server_reply_get_traffic (HANDLER(hdl), &hdl->dwriter);
    } else if (COMP (line->buf, "get server.thread_num")) {
        return cherokee_admin_server_reply_get_thread_num (HANDLER(hdl), &hdl->dwriter);

    } else if (COMP (line->buf, "get server.trace")) {
        return cherokee_admin_server_reply_get_trace (HANDLER(hdl), &hdl->dwriter);
    } else if (COMP (line->buf, "set server.trace")) {
        return cherokee_admin_server_reply_set_trace (HANDLER(hdl), &hdl->dwriter, line);

    } else if (COMP (line->buf, "get server.sources")) {
        return cherokee_admin_server_reply_get_sources (HANDLER(hdl), &hdl->dwriter);
    } else if (COMP (line->buf, "kill server.source")) {
        return cherokee_admin_server_reply_kill_source (HANDLER(hdl), &hdl->dwriter, line);

    } else if (COMP (line->buf, "set server.backup_mode")) {
        return cherokee_admin_server_reply_set_backup_mode (HANDLER(hdl), &hdl->dwriter, line);

    } else if (COMP (line->buf, "get server.connections")) {
        return cherokee_admin_server_reply_get_conns (HANDLER(hdl), &hdl->dwriter);
    } else if (COMP (line->buf, "close server.connection")) {
        return cherokee_admin_server_reply_close_conn (HANDLER(hdl), &hdl->dwriter, line);

    }

    SHOULDNT_HAPPEN;
    return ret_error;
}
开发者ID:chetan,项目名称:cherokee,代码行数:35,代码来源:handler_admin.c

示例12: CADFPCAD

Word CADFPCAD(Word D, Word P, Word S, Word I, Word Pb)
{
      Word Db,Is,N,Sb,Pb_N,Ts,L,p,i,is,Q,Ms,C,Cs,Ds,Ss;
      Word Mb,mb;

Step1: /* Is D the root cell? */
      Db = LELTI(D,SC_REP);
      if (LELTI(D,SC_PAR) == NIL) {
	Is = NIL;
	Ss = NIL;
	Ms = NIL; }

      else {
Step2: /* D is not the root cell. */
	Is = CINV(COMP(LELTI(D,SC_INX),CINV(I)));
	N = LENGTH(Is);

Step3: /* Signiture & multiplicity information. */
	Sb = FIRST(LELTI(Db,SIGNPF));
	Pb_N = LELTI(Pb,N);
	Ts = NIL; Ms = NIL; is = 0;

 /* Loop over each level N polynomial in P. */
	for(L = CINV(LELTI(P,N)); L != NIL; L = RED(L)) {
	  p = FIRST(L); i = 1; is++;

 /* Set i so that p is the ith level N pol in Pb. */
	  i = PFPIPFL(p,Pb_N);
	  if (i == 0) { SWRITE("CAPFPCAD: Can't find the polynomial!\n"); }
	  Ts = COMP(LELTI(Sb,i),Ts);

 /* Set the multiplicity list if necessary */
	  for (Mb = LELTI(Db,MULSUB); Mb != NIL; Mb = RED(Mb)) {
	    mb = FIRST(Mb);
	    if (FIRST(mb) == THIRD(LELTI(p,PO_LABEL))) {
	      Ms = COMP(mb,Ms); } } }
	/*	Ms = CINV(Ms); */
	Ss = COMP(Ts,S); }

Step4: /* Children. */
	C = LELTI(D,SC_CDTV);
	if ( ISATOM(C) ) {
	  Cs = NIL; }
	else {
	  for(Cs = NIL; C != NIL; C = RED(C)) {
	    Cs = COMP(CADFPCAD(FIRST(C),P,Ss,Is,Pb),Cs); }
	  Cs = CINV(Cs); }

Step5: /*  */
	Ds = LCOPY(Db);
	SLELTI(Ds,CHILD,Cs);
	SLELTI(Ds,INDX,Is);
	SLELTI(Ds,SIGNPF,Ss);
	SLELTI(Ds,HOWTV,NOTDET); /* Might want to change. */
	SLELTI(Ds,MULSUB,Ms);

Return: /* Prepare to return. */
	return (Ds);
}
开发者ID:fchapoton,项目名称:qepcad-1,代码行数:59,代码来源:CADFPCAD.c

示例13: COMP

bool TrailID::operator<( const TrailID &rhs ) const
{
#define COMP(a) if(a<rhs.a) return true; if(a>rhs.a) return false;
	COMP(st);
	COMP(cd);
#undef COMP
	return false;
}
开发者ID:Highlogic,项目名称:stepmania-event,代码行数:8,代码来源:TrailUtil.cpp

示例14: bstree_copy_sort

static void bstree_copy_sort( bstree bst, unsigned int node,
			      bstree_node *array, unsigned int *index){
static int bstree_shrink( bstree bst);


static int bstree_node_find( const bstree bst, const unsigned int *node,
			     KEYTYPE key, VALUETYPE *value){
  if( key == bst->array[*node].key ){
    *value = bst->array[*node].value;
    return BSTREE_SUCCESS;
  }
  if( COMP(key, bst->array[*node].key) < 0 ){
    if( bst->array[*node].left != NODE_NULL ){
      return bstree_node_find( bst, &(bst->array[node].left), key, value);
    }
  }else{
    if( bst->array[node].right != NODE_NULL ){
      return bstree_node_find( bst, &(bst->array[node].right), key, value);
    }
  }
  return BSTREE_FAILURE;
}

static int bstree_node_insert( bstree bst, unsigned int *node,
			       KEYTYPE key, VALUETYPE value){
  int status;

  if( *node == NODE_NULL){
    if( bst->max_pos == bst->array_size ){
      if( bstree_grow( bst) == BSTREE_MEM_ERROR ){
	return BSTREE_MEM_ERROR;
      }
    }
    *node = bstree->max_pos;
    bst->array[*node].left = NODE_NULL;
    bst->array[*node].right = NODE_NULL;
    bst->array[*node].key = key;
    bst->array[*node].value = value;
    bst->array[*node].level = 1;
    (bst->max_pos)++;
    (bst->size)++;
    return BSTREE_SUCCESS;
  }
  if( key == bst->array[*node].key ){
    bst->array[*node].value += value;
    return BSTREE_SUCCESS;
  }
  if( COMP( key, bst->array[*node].key) < 0 ){
    status = bstree_node_insert( bst, &(bst->array[node].left), key, value);
  }else{
    status = bstree_node_insert( bst, &(bst->array[node].right), key, value);
  }
  
  skew( bst, node);
  split( bst, node);
  return status;
}
开发者ID:jefwagner,项目名称:c_containers,代码行数:57,代码来源:bstree2.c

示例15: ERR

void Socket::send(const std::string& msg) {
	int sent = 0;
	for (int i = 0; i < msg.size(); i += sent) {
		ERR((sent = ::send(fd, &msg[i], msg.size()-i, 0)) == -1,
			COMP("send():%1", strerror(errno)))
	}
	LOG(COMP("Sent %1B to %2:\n'%3'",
		msg.size(), hostserv(), Glib::strescape(msg)), LOG_DEBUG)
}
开发者ID:Edgeworth,项目名称:chat23,代码行数:9,代码来源:socket.cpp


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