本文整理汇总了C++中simplify函数的典型用法代码示例。如果您正苦于以下问题:C++ simplify函数的具体用法?C++ simplify怎么用?C++ simplify使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了simplify函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: tmp
void value_sett::get_value_set(
const exprt &expr,
object_mapt &dest,
const namespacet &ns,
bool is_simplified) const
{
exprt tmp(expr);
if(!is_simplified)
simplify(tmp, ns);
get_value_set_rec(tmp, dest, "", tmp.type(), ns);
}
示例2: addPortDescr
void addPortDescr(int type, const char* label, int hint, float min=0.0, float max=0.0)
{
string fullname = simplify(fPrefix.top() + "-" + label);
char * str = strdup(fullname.c_str());
fPortDescs[fInsCount + fOutsCount + fCtrlCount] = type;
fPortNames[fInsCount + fOutsCount + fCtrlCount] = str;
fPortHints[fInsCount + fOutsCount + fCtrlCount].HintDescriptor = hint;
fPortHints[fInsCount + fOutsCount + fCtrlCount].LowerBound = min;
fPortHints[fInsCount + fOutsCount + fCtrlCount].UpperBound = max;
fCtrlCount++;
}
示例3: switch
bool QgsAbstractFeatureIterator::nextFeature( QgsFeature& f )
{
bool dataOk = false;
if ( mRequest.limit() >= 0 && mFetchedCount >= mRequest.limit() )
{
return false;
}
if ( mUseCachedFeatures )
{
if ( mFeatureIterator != mCachedFeatures.constEnd() )
{
f = mFeatureIterator->mFeature;
++mFeatureIterator;
dataOk = true;
}
else
{
dataOk = false;
// even the zombie dies at this point...
mZombie = false;
}
}
else
{
switch ( mRequest.filterType() )
{
case QgsFeatureRequest::FilterExpression:
dataOk = nextFeatureFilterExpression( f );
break;
case QgsFeatureRequest::FilterFids:
dataOk = nextFeatureFilterFids( f );
break;
default:
dataOk = fetchFeature( f );
break;
}
}
// simplify the geometry using the simplifier configured
if ( dataOk && mLocalSimplification )
{
if ( f.constGeometry() )
simplify( f );
}
if ( dataOk )
mFetchedCount++;
return dataOk;
}
示例4: instantiate
bool ranking_synthesis_satt::generate_functions(void)
{
exprt templ = instantiate();
if(body.variable_map.size()==0 || templ.is_false())
return false;
// some coefficient values
c_valuest c_values;
debug("Template:" + from_expr(ns, "", templ));
satcheckt::resultt result=satcheckt::P_SATISFIABLE;
while(result==satcheckt::P_SATISFIABLE)
{
if(c_values.size()==0)
initialize_coefficients(c_values);
else
{
if(increase_coefficients(c_values))
break;
}
result=check_for_counterexample(templ, c_values,
conversion_time, solver_time);
}
if(result==satcheckt::P_ERROR)
throw ("Solver error.");
else if(result==satcheckt::P_UNSATISFIABLE) // no counter-example
{
debug("Found ranking functions");
// put the coefficient values in the rank relation
replace_mapt replace_map;
for(c_valuest::const_iterator it=c_values.begin();
it!=c_values.end();
it++)
{
replace_map[it->first] = from_integer(it->second, it->first.type());
}
replace_expr(replace_map, rank_relation);
simplify(rank_relation, ns);
return true;
}
else
return false;
}
示例5: simplify
/**
* \return Representation of the given number as fraction (number numerator/denominator).
* Rounding occurs to satisfy the use of maxDenominator as maximum value for denominator.
*/
void RMath::toFraction(double v, int maxDenominator, int& number, int& numerator, int& denominator) {
int in = (int)v;
number = in;
if (in==v) {
number = in;
numerator = 0;
denominator = 1;
return;
}
simplify(abs(mround((v-in)*maxDenominator)), maxDenominator, numerator, denominator);
}
示例6: main
int main(void)
{
struct Fraction f;
printf("Fraction Simplifier\n");
printf("===================\n");
enter(&f);
simplify(&f);
display(&f);
return 0;
}
示例7: solve
void solve(unsigned short* sudoku, int recursionLevel)
{
do
{
boolean couldSimplify = simplify(sudoku, recursionLevel);
// if(recursionLevel > 0 && !couldSimplify)
// return;
if(isSolved(sudoku))
return;
}
while( guess(sudoku, recursionLevel+1) );
}
示例8: sqrt
void BezierCurve::simplify(double tol, QList<QPointF> &inputList, int j, int k, QList<bool> &markList)
{
// -- Douglas-Peucker simplification algorithm
// from http://geometryalgorithms.com/Archive/algorithm_0205/
if (k <= j+1) { //there is nothing to simplify
// return immediately
} else {
// test distance of intermediate vertices from segment Vj to Vk
double maxd = 0.0; //is the distance of farthest vertex from segment jk
int maxi = j; //is the index of the vertex farthest from segement jk
for(int i=j+1; i<k-1;i++) { // each intermediate vertex Vi
QPointF Vij = inputList.at(i)-inputList.at(j);
QPointF Vjk = inputList.at(j)-inputList.at(k);
double Vijx = Vij.x();
double Vijy = Vij.y();
double Vjkx = Vjk.x();
double Vjky = Vjk.y();
double dv = (Vjkx*Vjkx+Vjky*Vjky);
if( dv != 0.0) {
dv = sqrt( Vijx*Vijx+Vijy*Vijy - pow(Vijx*Vjkx+Vijy*Vjky,2)/dv );
}
//qDebug() << "distance = "+QString::number(dv);
if (dv < maxd) {
//Vi is not farther away, so continue to the next vertex
} else { //Vi is a new max vertex
maxd = dv;
maxi = i; //to remember the farthest vertex
}
}
if (maxd >= tol) { //a vertex is farther than tol from Sjk
// split the polyline at the farthest vertex
//Mark Vmaxi as part of the simplified polyline
markList.replace(maxi, true);
//and recursively simplify the two subpolylines
simplify(tol, inputList, j, maxi, markList);
simplify(tol, inputList, maxi, k, markList);
}
}
}
示例9: runInterpreter
int runInterpreter(void)
{
AST M = getTree("main");
if(M != NULL)
{
AST R = simplify(M);
if((R->kind == ACTION_NK) ||
((R->kind == BASIC_FUNC_NK) &&
((R->extra == PRILST_FK) ||
(R->extra == PRINT_FK) ||
(R->extra == PROD_FK) ||
(R->extra == READI_FK) ||
(R->extra == READC_FK))))
{
AST ret = performAction(R);
if(ret->kind != EMPTYLIST)
{
if(ret->kind == CONS_NK)
displayList(ret);
else
displayAST(ret);
}
}
else
{
AST S = simplify(R);
if(S->kind != EMPTYLIST)
{
if(S->kind == CONS_NK)
displayList(S);
else
displayAST(R);
}
}
printf("\n");
}
return 0;
}
示例10: testSimplifySkinnyTriangle3
static void testSimplifySkinnyTriangle3() {
SkPath path, out;
path.moveTo(591, 627.534851f);
path.lineTo(541, 560.707642f);
path.lineTo(491, 493.880310f);
path.lineTo(441, 427.053101f);
path.close();
path.moveTo(317, 592.013306f);
path.lineTo(366, 542.986572f);
path.lineTo(416, 486.978577f);
path.lineTo(465, 430.970581f);
path.close();
simplify(__FUNCTION__, path, true, out);
}
示例11: absval_tensor
void
absval_tensor(void)
{
if (p1->u.tensor->ndim != 1)
stop("abs(tensor) with tensor rank > 1");
push(p1);
push(p1);
conjugate();
inner();
push_rational(1, 2);
power();
simplify();
eval();
}
示例12: START_TEST
END_TEST
START_TEST(test_issue200)
{
input_from_file(TESTDIR "/bounds/issue200.vhd");
tree_t a = parse_and_check(T_ENTITY, T_ARCH);
fail_unless(sem_errors() == 0);
simplify(a);
bounds_check(a);
fail_unless(bounds_errors() == 0);
}
示例13: g
Integer prs_resultant_ufd< Integer >(Poly_1 A, Poly_1 B) {
#ifdef CGAL_ACK_BENCHMARK_RES
res_tm.start();
#endif
// implemented using the subresultant algorithm for resultant computation
// see [Cohen, 1993], algorithm 3.3.7
typedef Integer NT;
if (A.is_zero() || B.is_zero()) return NT(0);
int signflip;
if (A.degree() <123 B.degree()) {
Polynomial<NT> T = A; A = B; B = T;
signflip = (A.degree() & B.degree() & 1);
} else {
signflip = 0;
}
NT a = A.content(), b = B.content();
NT g(1), h(1), t = CGAL::ipower(a, B.degree()) * CGAL::ipower(b, A.degree());
Polynomial<NT> Q, R; NT d;
int delta;
A /= a; B /= b;
do {
signflip ^= (A.degree() & B.degree() & 1);
Polynomial<NT>::pseudo_division(A, B, Q, R, d);
delta = A.degree() - B.degree();
typedef CGAL::Algebraic_structure_traits<NT>::Is_exact
Is_exact;
A = B;
B = R / (g * CGAL::ipower(h, delta));
g = A.lcoeff();
// h = h^(1-delta) * g^delta
CGALi::hgdelta_update(h, g, delta);
} while (B.degree() > 0);
// h = h^(1-deg(A)) * lcoeff(B)^deg(A)
delta = A.degree();
g = B.lcoeff();
CGALi::hgdelta_update(h, g, delta);
h = signflip ? -(t*h) : t*h;
Algebraic_structure_traits<NT>::Simplify simplify;
simplify(h);
return h;
}
示例14: QDialog
QgsSimplifyDialog::QgsSimplifyDialog( QWidget* parent )
: QDialog( parent )
{
setupUi( this );
connect( horizontalSlider, SIGNAL( valueChanged( int ) ),
this, SLOT( valueChanged( int ) ) );
connect( horizontalSlider, SIGNAL( valueChanged( int ) ),
spinBox, SLOT( setValue( int ) ) );
connect( spinBox, SIGNAL( valueChanged( int ) ),
horizontalSlider, SLOT( setValue( int ) ) );
connect( okButton, SIGNAL( clicked() ),
this, SLOT( simplify() ) );
}
示例15: separate
Exponent::Exponent(string str)
{
baseIsFrac = false;
baseIsInt = false;
powerIsFrac = false;
powerIsInt = false;
separate(str);
findPowerType();
findBaseType();
simplify();
canSimplifyToFrac();
canSimplifyToInt();
}