本文整理匯總了C++中Interval::inf方法的典型用法代碼示例。如果您正苦於以下問題:C++ Interval::inf方法的具體用法?C++ Interval::inf怎麽用?C++ Interval::inf使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Interval
的用法示例。
在下文中一共展示了Interval::inf方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C++代碼示例。
示例1: is_small
static bool is_small(Interval r) {
return r.sup()- r.inf() < .001;
}
示例2: operator
Interval LDB::operator ()(const LDB::ipolynomial_type *poly_ptr,
const LDB::additional_var_data *data_ptr ) const
{
unsigned int data_size = data_ptr->size();
/*
Abspalten der linearen Terme. Die Konstante wird den hoeheren Termen zugerechnet.
Gleichzeitig werden die hoeheren Terme eingeschlossen.
*/
Interval rest(0.0);
std::vector<Interval> arguments( data_ptr->size() );
for(unsigned int i = 0; i < data_size; i++)
if( (*data_ptr)[ i ].operator ->() != 0 )
arguments[ i ] = ((*data_ptr)[ i ])->domain_ - ((*data_ptr)[ i ])->devel_point_;
std::vector<Interval> linear_coeffs(data_size, Interval(0.0));
std::vector<unsigned int> var_codes; var_codes.reserve(data_size); //Codes of Vars with linear term.
LDB::ipolynomial_type::const_iterator
curr = poly_ptr->begin(),
last = poly_ptr->end();
while( curr != last )
{
if( curr->key().expnt_sum() == 0 ) //Konstanter Term.
{
rest += curr->value();
}
else if( curr->key().expnt_sum() == 1 ) //Linearer Term.
{
unsigned int i = curr->key().min_var_code();
var_codes.push_back(i-1);
linear_coeffs[i-1] = curr->value();
}
else //Nonlinear term.
{
Interval prod(1.0);
//Evaluate the current monomial.
for(unsigned int i = curr->key().min_var_code(); i <= curr->key().max_var_code(); i++)
{
unsigned int e = curr->key().expnt_of_var(i);
if( e != 0 )
{
prod *= power( arguments[i-1], e );
}
}
//Multiply with coefficient.
prod *= curr->value();
//Add enclosure to bound interval.
rest += prod;
}
++curr;
}
if( var_codes.size() == 0 ) return rest; //No linear terms in polynomial. So return with enclosure of
//higher order terms.
/*
Lokale Kopien der 'Domains' anlegen, da diese im weiteren Verlauf unter Umstaenden
veraendert werden.
*/
std::vector<Interval> domain_of_max(data_size,Interval(0.0));
std::vector<Interval> domain_of_min(data_size,Interval(0.0));
for(unsigned int i = 0; i < data_size; i++)
{
if( (*data_ptr)[i].operator ->() ) //There is information.
{
domain_of_max[i] = domain_of_min[i] = ((*data_ptr)[i])->domain_;
}
}
/*
Jetzt beginnt der Algorithmus des LDB range bounders.
*/
Interval idelta(rest.diam());
for(unsigned int i = 0; i < var_codes.size(); i++)
{
unsigned int k = var_codes[i];
Interval b = linear_coeffs[k];
idelta += b.diam() * abs( ((*data_ptr)[k])->domain_ - ((*data_ptr)[k])->devel_point_ );
}
double delta = idelta.sup();
bool resizing = false;
for(unsigned int i = 0; i < var_codes.size(); i++)
{
unsigned int k = var_codes[i];
double mid_b = linear_coeffs[k].mid();
Interval abs_b = Interval( std::abs(mid_b) );
Interval domain = ((*data_ptr)[k])->domain_;
Interval upper = abs_b * domain.diam();
//.........這裏部分代碼省略.........
示例3: is_unknown_sign
static bool is_unknown_sign(Interval rv) {
return rv.inf() <=0 && rv.sup() >=0;
}