本文整理汇总了C++中SymbolicVal::IsNIL方法的典型用法代码示例。如果您正苦于以下问题:C++ SymbolicVal::IsNIL方法的具体用法?C++ SymbolicVal::IsNIL怎么用?C++ SymbolicVal::IsNIL使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SymbolicVal
的用法示例。
在下文中一共展示了SymbolicVal::IsNIL方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Min
SymbolicVal Min( const SymbolicVal &v1, const SymbolicVal &v2,
MapObject<SymbolicVal, SymbolicBound>* f)
{ if (v1.IsNIL())
return v2;
if (v2.IsNIL())
return v1;
switch (CompareVal(v1,v2,f)) {
case REL_NONE:
case REL_UNKNOWN:
case REL_NE:
{
SelectApplicator minOp(-1);
return ApplyBinOP(minOp,v1,v2);
}
case REL_EQ:
case REL_LT:
case REL_LE:
return v1;
case REL_GT:
case REL_GE:
return v2;
default:
assert(0);
}
}
示例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);
}
示例3: if
void Default1( const SymbolicVal &v1, const SymbolicVal &v2)
{
if (v1.IsSame(v2))
result = REL_EQ;
else if (v1.IsNIL() || v2.IsNIL())
result = REL_UNKNOWN;
else if (v1 == v2)
result = REL_EQ;
else
result = REL_UNKNOWN;
}
示例4: operator
virtual SymbolicVal operator()( const SymbolicVal& v)
{
SymbolicVal r;
if (valmap != 0)
r = (*valmap)(v);
if (r.IsNIL()) {
v.Visit(this);
}
return r;
}
示例5: DecomposeAffineExpression
SymbolicVal DecomposeAffineExpression(
const SymbolicVal& exp, const VarVec& vars, CoeffVec& vec, int size)
{
// AstInterface& fa = la;
SymbolicVal val = exp;
// int coeff;
for (int i = 0; i < size; ++i) {
SymbolicVar ivar = vars[i];
SymbolicBound ivarbound;
SymbolicVal coeff = UnwrapVarCond( SymbolicCond( REL_LE, val, 0), ivar, ivarbound);
if (coeff.IsNIL())
return SymbolicVal();
if (!(coeff == 0)) {
if (!ivarbound.ub.IsNIL())
val = -ivarbound.ub;
else {
val = ivarbound.lb;
coeff = -coeff;
}
}
vec.push_back(coeff);
}
return val;
}
示例6: AnalyzeEquation
bool AnalyzeEquation(const CoeffVec& vec, const BoundVec& bounds,
BoundOp& boundop,
Dep& result, const DepRel& rel)
{
int dim = vec.size()- 1;
std::vector<int> signs;
for (int index = 0; index < dim; ++index) {
if (vec[index]==0) {
signs.push_back(0);
continue;
}
SymbolicBound cb = GetValBound(vec[index], boundop);
assert(!cb.lb.IsNIL() && !cb.ub.IsNIL());
const SymbolicBound& b = bounds[index];
assert(!b.lb.IsNIL() && !b.ub.IsNIL());
if (b.lb >= 0) {
if (cb.lb >= 0)
signs.push_back(1);
else if (cb.ub <= 0)
signs.push_back(-1);
else {
if (DebugDep())
std::cerr << "unable to decide sign of coeff when lb >=0 for ivar[" << index << "]\n";
//return false;
signs.push_back(2);
}
}
else if (b.ub <= 0) {
if (cb.lb >= 0)
signs.push_back(-1);
else if (cb.ub <= 0)
signs.push_back(1);
else {
if (DebugDep())
std::cerr << "unable to decide sign of coeff when ub <=0 for ivar[" << index << "]\n";
//return false;
signs.push_back(2);
}
}
else {
if (DebugDep())
std::cerr << "unable to decide sign of ivar[" << index << "]\n";
//return false;
signs.push_back(2);
}
}
if (vec[dim] == 0)
signs.push_back(0);
else {
SymbolicVal leftval = vec[dim];
if (leftval.IsNIL()) {
if (DebugDep())
std::cerr << "unable to decide sign of leftval\n";
return false;
}
SymbolicBound lb = GetValBound(vec[dim], boundop);
if (lb.ub <= 0)
signs.push_back(-1);
else if (lb.lb >= 0)
signs.push_back(1);
else {
if (DebugDep())
std::cerr << "unable to decide sign of leftval\n";
return false;
//signs.push_back(2);
}
}
for (int i = 0; i < dim ; ++i) {
if (signs[i] == 0)
continue;
SymbolicVal coeff = vec[i];
assert(!coeff.IsNIL());
int j = 0;
for ( j = i+1; j < dim; ++j) {
if (signs[j] == 0 || coeff + vec[j] != 0)
continue;
int left = 0, k;
for (k = 0; k < dim ; ++k) {
if (k == i || k == j)
continue;
if (left == 0)
left = signs[k];
else if (signs[k] == 2 || signs[k] * left < 0)
break;
}
if ( k < dim || left == 2 || left * signs[dim] < 0)
continue;
int diff = 0, c = 1;
bool hasdiff = false;
if (left == 0 && vec[dim].isConstInt(diff) &&
(diff == 0 || coeff.isConstInt(c))) {
if (diff != 0 && c != 1) {
int odiff = diff;
diff = diff / c;
if (odiff != diff * c)
{
//DepStats.AddAdhocDV(DepStats.RoseToPlatoDV(DepRel(DEPDIR_NONE)));
result[i][j] = DepRel(DEPDIR_NONE);
return true;
}
//.........这里部分代码省略.........