本文整理汇总了C++中simplify函数的典型用法代码示例。如果您正苦于以下问题:C++ simplify函数的具体用法?C++ simplify怎么用?C++ simplify使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了simplify函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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);
}
开发者ID:eigold,项目名称:cbmc,代码行数:12,代码来源:value_set.cpp
示例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++;
}
开发者ID:kmatheussen,项目名称:radium_compressor,代码行数:12,代码来源:myladspa.cpp
示例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;
}
开发者ID:avautour,项目名称:QGIS,代码行数:52,代码来源:qgsfeatureiterator.cpp
示例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;
}
开发者ID:olivo,项目名称:BP,代码行数:52,代码来源:ranking_sat.cpp
示例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);
}
开发者ID:Alpha-Kand,项目名称:qcad,代码行数:17,代码来源:RMath.cpp
示例6: main
int main(void)
{
struct Fraction f;
printf("Fraction Simplifier\n");
printf("===================\n");
enter(&f);
simplify(&f);
display(&f);
return 0;
}
开发者ID:SaadToor,项目名称:Introduction-Programming-C-144,代码行数:13,代码来源:Workshop9.c
示例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) );
}
开发者ID:schiermike,项目名称:algo_puzzles,代码行数:13,代码来源:sudoku.c
示例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);
}
}
}
开发者ID:Conicer,项目名称:pencil,代码行数:39,代码来源:beziercurve.cpp
示例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;
}
开发者ID:ajpaparelli,项目名称:ecucsci,代码行数:38,代码来源:interpreter.c
示例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);
}
开发者ID:Adenilson,项目名称:skia,代码行数:14,代码来源:EdgeWalkerPolygons_Test.cpp
示例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();
}
开发者ID:AnderainLovelace,项目名称:ForumlaZ-WH,代码行数:14,代码来源:abs.cpp
示例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);
}
开发者ID:chiggs,项目名称:nvc,代码行数:14,代码来源:test_bounds.c
示例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;
}
开发者ID:2php,项目名称:cgal,代码行数:50,代码来源:poly2ntl.cpp
示例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() ) );
}
开发者ID:Hardysong,项目名称:Quantum-GIS,代码行数:14,代码来源:qgsmaptoolsimplify.cpp
示例15: separate
Exponent::Exponent(string str)
{
baseIsFrac = false;
baseIsInt = false;
powerIsFrac = false;
powerIsInt = false;
separate(str);
findPowerType();
findBaseType();
simplify();
canSimplifyToFrac();
canSimplifyToInt();
}
开发者ID:Sissinothere,项目名称:Calculator,代码行数:14,代码来源:exponent.cpp
示例16: eval2int
/**
* Eval a block diagram to an int.
*
* Eval a block diagram that represent an integer constant. This function first eval
* a block diagram to its normal form, then check it represent a numerical value (a
* block diagram of type : 0->1) then do a symbolic propagation and try to convert the
* resulting signal to an int.
* @param exp the expression to evaluate
* @param globalDefEnv the global environment
* @param visited list of visited definition to detect recursive definitions
* @param localValEnv the local environment
* @return a block diagram in normal form
*/
static int eval2int (Tree exp, Tree visited, Tree localValEnv)
{
Tree diagram = a2sb(eval(exp, visited, localValEnv)); // pour getBoxType()
int numInputs, numOutputs;
getBoxType(diagram, &numInputs, &numOutputs);
if ( (numInputs > 0) || (numOutputs != 1) ) {
evalerror(yyfilename, yylineno, "not a constant expression of type : (0->1)", exp);
return 1;
} else {
Tree lsignals = boxPropagateSig(gGlobal->nil, diagram , makeSigInputList(numInputs) );
Tree val = simplify(hd(lsignals));
return tree2int(val);
}
}
开发者ID:FlatIO,项目名称:faudiostream,代码行数:27,代码来源:eval.cpp
示例17: show_auths
static int
show_auths(char *username, int print_name)
{
int status = EXIT_OK;
struct passwd *pw;
int i;
cbs_t cbs = { 0, 0, NULL };
if (username == NULL) {
if ((pw = getpwuid(getuid())) == NULL) {
status = EXIT_NON_FATAL;
(void) fprintf(stderr, "%s: ", progname);
(void) fprintf(stderr, gettext("No passwd entry\n"));
return (status);
}
username = pw->pw_name;
} else if (getpwnam(username) == NULL) {
status = EXIT_NON_FATAL;
(void) fprintf(stderr, "%s: %s : ", progname, username);
(void) fprintf(stderr, gettext("No such user\n"));
return (status);
}
(void) _enum_auths(username, add_auth, NULL, &cbs);
if (cbs.auth_cnt == 0)
status = EXIT_NON_FATAL;
if (status == EXIT_NON_FATAL) {
(void) fprintf(stderr, "%s: %s: ", progname, username);
(void) fprintf(stderr, gettext("No authorizations\n"));
} else {
simplify(&cbs);
if (print_name)
(void) printf("%s: ", username);
/* print out the auths */
for (i = 0; i < cbs.auth_cnt - 1; i++)
(void) printf("%s,", cbs.auths[i]);
/* print out the last entry, without the comma */
(void) printf("%s\n", cbs.auths[cbs.auth_cnt - 1]);
/* free memory allocated for authorizations */
free_auths(&cbs);
}
return (status);
}
开发者ID:0xffea,项目名称:illumos-gate,代码行数:50,代码来源:auths.c
示例18: read_data_locale
static int read_data_locale(void) {
int r;
free_data_locale();
r = parse_env_file("/etc/locale.conf", NEWLINE,
"LANG", &data[PROP_LANG],
"LANGUAGE", &data[PROP_LANGUAGE],
"LC_CTYPE", &data[PROP_LC_CTYPE],
"LC_NUMERIC", &data[PROP_LC_NUMERIC],
"LC_TIME", &data[PROP_LC_TIME],
"LC_COLLATE", &data[PROP_LC_COLLATE],
"LC_MONETARY", &data[PROP_LC_MONETARY],
"LC_MESSAGES", &data[PROP_LC_MESSAGES],
"LC_PAPER", &data[PROP_LC_PAPER],
"LC_NAME", &data[PROP_LC_NAME],
"LC_ADDRESS", &data[PROP_LC_ADDRESS],
"LC_TELEPHONE", &data[PROP_LC_TELEPHONE],
"LC_MEASUREMENT", &data[PROP_LC_MEASUREMENT],
"LC_IDENTIFICATION", &data[PROP_LC_IDENTIFICATION],
NULL);
if (r == -ENOENT) {
int p;
/* Fill in what we got passed from systemd. */
for (p = 0; p < _PROP_MAX; p++) {
char *e, *d;
assert(names[p]);
e = getenv(names[p]);
if (e) {
d = strdup(e);
if (!d)
return -ENOMEM;
} else
d = NULL;
free(data[p]);
data[p] = d;
}
r = 0;
}
simplify();
return r;
}
开发者ID:mariux,项目名称:systemd,代码行数:50,代码来源:localed.c
示例19: while
void RangeSet::setRange (std::uint32_t minV, std::uint32_t maxV)
{
while (hasValue (minV))
{
++minV;
if (minV >= maxV)
return;
}
mRanges[minV] = maxV;
simplify ();
}
开发者ID:bachase,项目名称:rippled,代码行数:14,代码来源:RangeSet.cpp
示例20: DEBUG_ASSERT
bool file_specification::make_absolute(const file_specification& rootspec)
{
if (absolute()) return true;
DEBUG_ASSERT(rootspec.absolute());
// now append this's relative path and filename to the root's absolute path
file_specification result = rootspec;
for (unsigned i = 0; i < subpath_size(); i++)
result.add_subpath(subpath_element(i));
result.set_file(file());
// now the rootspec is the absolute path, so transfer it to this
*this = result;
// and simplify to get rid of any unwanted .. or . elements
simplify();
return true;
}
开发者ID:BackupTheBerlios,项目名称:multicrew-svn,代码行数:15,代码来源:file_system.cpp
注:本文中的simplify函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论