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


C++ SymbolicVal::toString方法代码示例

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


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

示例1: SplitEquation

bool SplitEquation( CoeffVec& cur, 
                      const SymbolicVal& cut, const BoundVec& bounds, 
                      BoundOp& boundop, CoeffVec& split)
 {
     int dim = cur.size()-1; 
     SymbolicVal leftval = cur[dim]; // obtain the last coefficient, which is right side terms without using loop index variable
     if (leftval != 0) {
       CompareRel r1 = CompareVal(leftval,-cut, &boundop);
       CompareRel r2 = CompareVal(leftval,cut, &boundop);
       bool lt = ((r1 & REL_GT) && (r2 & REL_LT)) || ((r1 & REL_LT) && (r2 & REL_GT)); 
       if (!lt) { // relation of r1 and r2 must be reversed pair, or error
         if (DebugDep())
           std::cerr << "unable to split because " << leftval.toString() << " ? " << cut.toString() << std::endl;
         return false;   
       }
     }

     bool succ = false;
     split.clear();
     int j =0;
     for (; j < dim; ++j) {
        SymbolicVal left = cur[j] / cut;
        if (HasFraction(left))  
            split.push_back(0);
        else {
            split.push_back(left);
            succ = true;
        }
     }  
     split.push_back(0); // right-hand side value
     if (succ) {
        SymbolicVal left = 0;
        for (j = 0; j < dim; ++j) {
           if (split[j]== 0) 
             switch (CompareVal(cur[j],0,&boundop)) {
              case REL_LE:
                 left = left + cur[j] * bounds[j].lb; break;
              case REL_GE:
                 left = left + cur[j] * bounds[j].ub; break;
              default: break;
             }
        }
        if (j == dim && (left == 0 || (CompareVal(left,cut) & REL_LT)))  {
          for (j = 0; j < dim; ++j) {
             if (split[j] != 0)
                cur[j] = 0; // clear some coefficency values
          }
        
          return true;
        }
        else if (DebugDep()) { 
            if (j == dim)
               std::cerr << "unable to decide left " << left.toString() << " ? " << cut.toString() << std::endl;
            else
               std::cerr << "unable to decide cur[" << j << "] ? 0\n";
        }
     }
     split.clear();
     return false;
}
开发者ID:matzke1,项目名称:rose-develop,代码行数:60,代码来源:StmtDepAnal.C

示例2: CompareVal

CompareRel CompareVal(const SymbolicVal &v1, const SymbolicVal &v2, 
                      MapObject<SymbolicVal,SymbolicBound>* f)
   { 
     if ( v1.IsNIL() && v2.IsNIL()) return REL_UNKNOWN;
     if (DebugCompareVal())
         std::cerr << "comparing " << v1.toString() << " with " << v2.toString() << " under " <<  f << std::endl;
     comparetime = 0;
     return CompareValHelp(v1,v2,f);
   }
开发者ID:billhoffman,项目名称:rose-develop,代码行数:9,代码来源:SymbolicOperator.C

示例3: CompareValHelp

CompareRel CompareValHelp(const SymbolicVal &v1, const SymbolicVal &v2, 
                      MapObject<SymbolicVal,SymbolicBound>* f)
{
    CompareRel r = REL_UNKNOWN;
    if (++comparetime < COMPARE_MAX)
        r = ValCompare(f)(v1,v2); 
    if (DebugCompareVal())
         std::cerr << v1.toString() << RelToString(r) << v2.toString() << " under " << f << std::endl;
     return r;
   }
开发者ID:billhoffman,项目名称:rose-develop,代码行数:10,代码来源:SymbolicOperator.C

示例4: BlockSize

LoopTreeNode* LoopBlocking::
ApplyBlocking( const CompSliceDepGraphNode::FullNestInfo& nestInfo, 
              LoopTreeDepComp& comp, DependenceHoisting &op, LoopTreeNode *&top)
{
  const CompSliceNest& slices = *nestInfo.GetNest();
  if (DebugLoop()) {
     std::cerr << "\n Blocking slices: " << slices.toString() << "\n";
  }
  LoopTreeNode *head = 0;
  AstInterface& fa = LoopTransformInterface::getAstInterface();
  for (int j = FirstIndex(); j >= 0; j = NextIndex(j))  {
     top = op.Transform( comp, slices[j], top);
     SymbolicVal b = BlockSize(j);
     if (DebugLoop()) {
        std::cerr << "\n after slice " << j << " : \n";
        //top->DumpTree();
        comp.DumpTree();
        comp.DumpDep();
        std::cerr << "\n blocking size for this loop is " << b.toString() << "\n";
     }
      
     if (!(b == 1)) {
         LoopTreeNode *n = LoopTreeBlockLoop()( top, SymbolicVar(fa.NewVar(fa.GetType("int")), AST_NULL), b);
         if (DebugLoop()) {
            std::cerr << "\n after tiling loop with size " << b.toString() << " : \n";
            //top->DumpTree();
            comp.DumpTree();
            comp.DumpDep();
         }
         if (head == 0)
             head = n;
         else {
           while (n->FirstChild() != head)
              LoopTreeSwapNodePos()( n->Parent(), n);
         }
       }
   }
  return head;
}
开发者ID:matzke1,项目名称:rose-develop,代码行数:39,代码来源:BlockingAnal.C

示例5: if

 void Default0( const SymbolicVal &v1, const SymbolicVal &v2)
 {  
   Default1(v1,v2);
   if (DebugCompareVal())
       std::cerr << " in CompareOperator::Default \n";
   if (result == REL_UNKNOWN) {
     int tmp = comparetime;
     SymbolicVal diff = v1 - v2;
     comparetime = tmp;
     if (diff.GetValType() == VAL_CONST) {
        int diffval = atoi( diff.toString().c_str());
        if (diffval  < 0) 
            result = REL_LT;
        else if (diffval > 0)
            result = REL_GT;
        else 
            result = REL_EQ; 
    }
    else if (func != 0) {
       int tmp = comparetime;
       SymbolicBound b1 = GetValBound(v1,*func), b2 = GetValBound(v2,*func);
       comparetime = tmp;
       CompareRel ge1 = (b1.lb != v1)? CompareValHelp(b1.lb,v2,func) : REL_UNKNOWN;
       CompareRel le2 = (b2.ub != v2)? CompareValHelp(b2.ub,v1,func) : REL_UNKNOWN; 
       CompareRel le1 = (b1.ub != v1)? CompareValHelp(b1.ub,v2,func) : REL_UNKNOWN;
       CompareRel ge2 = (b2.lb != v2)? CompareValHelp(b2.lb,v1,func) : REL_UNKNOWN; 
       if (CountGT(ge1) || CountLT(le2))
            result = REL_GT; 
       else if (CountGE(ge1) || CountLE(le2))
            result = REL_GE; 
       else if (CountLT(le1) || CountGT(ge2))
            result = REL_LT; 
       else if (CountLE(le1) || CountGE(ge2))
            result = REL_LE; 
   }
  }
 }
开发者ID:billhoffman,项目名称:rose-develop,代码行数:37,代码来源:SymbolicOperator.C

示例6: ApplyBinOP

SymbolicVal ApplyBinOP( SymOpType t, const SymbolicVal &v1,
                               const SymbolicVal &v2)
{
  SymbolicVal r;
  switch (t) {
  case SYMOP_PLUS: 
     {
      PlusApplicator op; 
      r = ApplyBinOP(op, v1, v2);
      if (DebugOp())
         std::cerr << v1.toString() << " + " << v2.toString() << " = " << r.toString() << std::endl;  
      return r;
     }
  case SYMOP_MULTIPLY: 
    {
      MultiplyApplicator op; 
      r = ApplyBinOP(op, v1, v2);
      if (DebugOp())
         std::cerr << v1.toString() << " * " << v2.toString() << " = " << r.toString() << std::endl;  
      return r;
    }
  case SYMOP_MIN: 
      r = Min(v1,v2);
      if (DebugOp())
         std::cerr << "Min( " << v1.toString() << " , " << v2.toString() << ") = " << r.toString() << std::endl;  
      return r;
  case SYMOP_MAX: return Max(v1, v2);
      r = Max(v1,v2);
      if (DebugOp())
         std::cerr << "Max( " << v1.toString() << " , " << v2.toString() << ") = " << r.toString() << std::endl;  
      return r;
  case SYMOP_POW: 
     {
      int val2;
      int vu1, vd1;
      if (!v2.isConstInt(val2))
         assert(false);
      if (v1 == 1 || val2 == 1)
         r =  v1;
      else if (val2 == -1 && v1.isConstInt(vu1, vd1)) 
         r = new SymbolicConst(vd1, vu1);
      else   
         r = new SymbolicPow(v1, val2);
      if (DebugOp())
         std::cerr << "Pow( " << v1.toString() << " , " << v2.toString() << ") = " << r.toString() << std::endl;  
      return r;
     }
  default:
    assert(false);
  }
}
开发者ID:billhoffman,项目名称:rose-develop,代码行数:51,代码来源:SymbolicOperator.C


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