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


C++ Offsets::off方法代码示例

本文整理汇总了C++中Offsets::off方法的典型用法代码示例。如果您正苦于以下问题:C++ Offsets::off方法的具体用法?C++ Offsets::off怎么用?C++ Offsets::off使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Offsets的用法示例。


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

示例1: if

int 
varcmp_offsets(const void *i1, const void *i2)
{
  if (offsets.off(*((Ident *) i1)) < offsets.off(*((Ident *) i2)))
    return -1;
  else if (offsets.off(*((Ident *) i1)) > offsets.off(*((Ident *) i2)))
    return 1;
  else
    return 0;
}
开发者ID:SRI-CSL,项目名称:PVS,代码行数:10,代码来源:ident.cpp

示例2: qsort

void
Signature::make(IdentList &idents)
{
  size = idents.size();
  int *tab1 = new int[size];
  int *tab2 = new int[size];
  IdentList::iterator i;
  unsigned int x,y,s;
  
  for (i = idents.begin(), x = 0; 
       i != idents.end(); i++, x++)
    tab1[x] = tab2[x] = offsets.off(*i);
  
  qsort((int *) tab2, size, sizeof(int), sortcmp);
  
  sign = new int[size];
  hashvalue = 0;

  for (x = 0; x < size; x++) {
    for (y = 0, s = 0; tab2[y] != tab1[x]; y++)
      if (y < size && tab2[y] != tab2[y+1])
	s++;
    sign[x] = s;
    hashvalue = hashvalue*x+sign[x];
  }

  delete[] tab1;
  delete[] tab2;
}
开发者ID:Lanozavr,项目名称:pvs,代码行数:29,代码来源:signature.cpp

示例3: invariant

void 
st_dfa_replace_indices(DFA *a, IdentList *newvars, IdentList *oldvars,
		       bool offnew, bool offold)
{
  if (newvars && oldvars && newvars != oldvars) {
    invariant(newvars->size() == oldvars->size());
  
    int *indexmap = new int[offsets.maxOffset()];
    
    IdentList::iterator i, j;
    bool dif = false;

    for(i = newvars->begin(), j = oldvars->begin();
	j != oldvars->end(); i++, j++) {
      int theold = offold ? offsets.off(*j) : *j;
      int thenew = offnew ? offsets.off(*i) : *i;
      indexmap[theold] = thenew;
      if (theold != thenew)
	dif = true;
    }

    if (dif) {
      Timer temp;

      if (options.time) {
	timer_replace_indices.start();
	if (options.statistics)
	  temp.start();
      }

      if (options.statistics)
	cout << "Replacing indices\n";

      dfaReplaceIndices(a, indexmap);
      num_replaces++;

      if (options.time) {
	timer_replace_indices.stop();
	if (options.statistics) {
	  temp.stop();
	  cout << "  Time: ";
	  temp.print();
	}
      }
    }    

    delete[] indexmap;

    if (options.intermediate)
      dfaPrintVerbose(a);
  }

  /*#warning  update_largest(a);*/
}
开发者ID:JPLaska,项目名称:nlp-tree,代码行数:54,代码来源:st_dfa.cpp

示例4: invariant

void
st_gta_replace_indices(GTA *g, IdentList *newvars, IdentList *oldvars,
		       bool offnew, bool offold)
{
  if (newvars && oldvars && newvars != oldvars) {
    invariant(newvars->size() == oldvars->size());
  
    unsigned *indexmap = new unsigned[offsets.maxOffset()];
    
    IdentList::iterator i, j;
    bool dif = false;

    for(i = newvars->begin(), j = oldvars->begin();
        j != oldvars->end(); i++, j++) {
      int theold = offold ? offsets.off(*j) : *j;
      int thenew = offnew ? offsets.off(*i) : *i;
      indexmap[theold] = thenew;
      if (theold != thenew)
	dif = true;
    }

    if (dif) {
      Timer temp;

      if (options.time) {
	timer_replace_indices.start();
	if (options.statistics)
	  temp.start();
      }

      if (options.statistics) 
        cout << "Replacing indices\n";

      gtaReplaceIndices(g, indexmap);
      num_replaces++;

      if (options.time) {
	timer_replace_indices.stop();
	if (options.statistics) {
	  temp.stop();
	  cout << "  Time: ";
	  temp.print();
	}
      }
    }    

    delete[] indexmap;
  }

  update_largest(g);
}
开发者ID:SRI-CSL,项目名称:PVS,代码行数:51,代码来源:st_gta.cpp

示例5: dfaAllPos

DFA*
st_dfa_allpos(DFA *dfa, Ident i)
{
  DFA *t1, *t2;

  t1 = st_dfa_minimization(st_dfa_product(dfa, 
					  dfaAllPos(offsets.off(i)),
					  dfaAND,
					  dummyPos));
  t2 = st_dfa_minimization(st_dfa_project(t1, 
					  i,
					  dummyPos, false));
  /*#warning  update_largest(t2);*/
  return t2;
}
开发者ID:JPLaska,项目名称:nlp-tree,代码行数:15,代码来源:st_dfa.cpp

示例6: stateSpaces

GTA *
st_gta_allpos(GTA *gta, Ident i)
{
  GTA *t1, *t2;
  IdentList *u = symbolTable.allRealUnivs();
  SSSet set = stateSpaces(u);
  delete u;
  t1 = st_gta_minimization(st_gta_product(gta,
					  gtaAllPos(offsets.off(i), set),
					  gtaAND,
					  dummyPos));
  t2 = st_gta_minimization(st_gta_project(t1,
					  i,
					  dummyPos, false));
  update_largest(t2);
  return t2;
}
开发者ID:SRI-CSL,项目名称:PVS,代码行数:17,代码来源:st_gta.cpp

示例7: gtaQuotientAndProject

GTA * 
st_gta_project(GTA *g, Ident i, Pos &p, bool quotient) 
{
  Timer temp;

  if (options.time) {
    timer_project.start();
    if (options.statistics)
      temp.start();
  }
  
  if (options.statistics) {
    cout << "Right-quotient\n" << "Projecting #" << i;
    p.printsource();
    cout << "\n  ";
    print_stat(g);
    cout << " -> ";
    cout.flush();
  }
  
  codeTable->begin();
  GTA *result = gtaQuotientAndProject(g, offsets.off(i), quotient);
  codeTable->done();
  
  num_projections++;
  num_right_quotients++;

  if (options.statistics) {
    print_stat(result);
    cout << "\n";
  }
  
  if (options.time) {
    timer_project.stop();
    if (options.statistics) {
      temp.stop();
      cout << "  Time: ";
      temp.print();
    }
  }

  gtaFree(g);

  update_largest(result);
  return result;
}
开发者ID:SRI-CSL,项目名称:PVS,代码行数:46,代码来源:st_gta.cpp

示例8: if


//.........这里部分代码省略.........
    assertionCode = andList(assertionCode, getRestriction(*i, NULL));

  // Restrict assertion if not trivial
  if (assertionCode.code->kind != cTrue)
    assertionCode = codeTable->insert
      (new Code_Restrict(assertionCode, assertionCode.code->pos));

  // Add assertion to main formula and to all verify formulas
  for (Deque<VarCode>::iterator i = verifyCode.begin(); 
       i != verifyCode.end(); i++) {
    assertionCode.code->refs++;
    *i = andList(*i, VarCode(copy(assertionCode.vars), assertionCode.code));
  }
  formulaCode = andList(formulaCode, assertionCode);

  timer_gencode.stop();
  if (options.printProgress) {
    codeTable->print_statistics();
    /* if (options.dump && options.statistics)
      codeTable->print_sizes(); */
    cout << "Time: ";
    timer_gencode.print();
  }
  
  ///////// REORDER BDD OFFSETS ////////////////////////////////////////////

  if (options.reorder >= 1) {
    Timer timer_reorder;
    timer_reorder.start();
    if (options.printProgress)
      cout << "\nREORDERING\n";

    // reorder using heuristics
    offsets.reorder();
    
    // regenerate DAG in new codetable
    CodeTable *oldCodeTable = codeTable, *newCodeTable = new CodeTable;
    IdentList emptylist;
    codeTable = newCodeTable;
    regenerate = true; // force making new nodes
    VarCode newcode = formulaCode.substCopy(&emptylist, &emptylist);
    Deque<VarCode> newverifycode;
    for (Deque<VarCode>::iterator i = verifyCode.begin(); 
	 i != verifyCode.end(); i++)
      newverifycode.push_back((*i).substCopy(&emptylist, &emptylist));
    codeTable->clearSCTable();
    regenerate = false;
    codeTable = oldCodeTable;
    formulaCode.remove();
    for (Deque<VarCode>::iterator i = verifyCode.begin(); 
	 i != verifyCode.end(); i++)
      (*i).remove();
    formulaCode = newcode;
    verifyCode.reset();
    for (Deque<VarCode>::iterator i = newverifycode.begin(); 
	 i != newverifycode.end(); i++)
      verifyCode.push_back(*i);
    delete oldCodeTable;
    codeTable = newCodeTable;

    if (options.printProgress) {
      codeTable->print_statistics2();
      cout << "Time: ";
      timer_reorder.print();
    }
  }
开发者ID:ondrik,项目名称:mona-vata,代码行数:67,代码来源:mona.cpp

示例9: dfaRightQuotient

DFA* 
st_dfa_project(DFA *a, Ident i, Pos &p, bool quotient) 
{
  Timer temp1, temp2;

  int a_ns = a->ns;
  
  if (options.time) {
    timer_right_quotient.start();
    if (options.statistics)
      temp1.start();
  }

  if (options.statistics)
    cout << "Right-quotient\n";

  if (quotient) {
    codeTable->begin();
    dfaRightQuotient(a, offsets.off(i));
    codeTable->done();
    num_right_quotients++;
  }

  if (options.time) {
    timer_right_quotient.stop();
    if (options.statistics) {
      temp1.stop();
      cout << "  Time: ";
      temp1.print();
    }
  }
 
  if (options.time) {
    timer_project.start();
    if (options.statistics)
      temp2.start();
  }

  if (options.statistics) {
    cout << "Projecting #" << i;
    p.printsource();
    cout << "\n  (" << a_ns << "," << bdd_size(a->bddm) << ") -> ";
    cout.flush();
  }

  codeTable->begin();
  DFA *result = dfaProject(a, offsets.off(i));
  codeTable->done();
  num_projections++;

  if (options.statistics)
    cout << "("  << result->ns << "," << bdd_size(result->bddm) << ")\n";

  if (options.time) {
    timer_project.stop();
    if (options.statistics) {
      temp2.stop();
      cout << "  Time: ";
      temp2.print();
    }
  }

  dfaFree(a);

  /*#warning  update_largest(result);*/
  return result;
}
开发者ID:JPLaska,项目名称:nlp-tree,代码行数:67,代码来源:st_dfa.cpp


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