當前位置: 首頁>>代碼示例>>C++>>正文


C++ Interval::lower方法代碼示例

本文整理匯總了C++中Interval::lower方法的典型用法代碼示例。如果您正苦於以下問題:C++ Interval::lower方法的具體用法?C++ Interval::lower怎麽用?C++ Interval::lower使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Interval的用法示例。


在下文中一共展示了Interval::lower方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C++代碼示例。

示例1: world

Interval operator/ (Interval const& lhs, Interval const& rhs){
    // this may be improved if multiple intervals are used
    if(in(0, lhs) || in(0, rhs)){
        return Interval::world();
    }
    else{
        // [a,b] / [c,d] = [min (a/c, a/d, b/c, b/d), max (a/c, a/d, b/c, b/d)]
        double a = static_cast<double>(lhs.lower());
        double b = static_cast<double>(lhs.upper());
        double c = static_cast<double>(rhs.lower());
        double d = static_cast<double>(rhs.upper());
        
        return Interval(
            (detail::min)(
                (a / c),
                (a / d),
                (b / c),
                (b / d)
            ),
            (detail::max)(
                (a / c),
                (a / d),
                (b / c),
                (b / d)
            )
        );
    }
}
開發者ID:hashier,項目名稱:cbp,代碼行數:28,代碼來源:Intervals.cpp

示例2: mig

//Returns the mignitude of an interval X
Rat mig(const Interval& X)
{
	if(X.lower() > 0)
		return X.lower();
	else if(X.upper() < 0)
		return (-1)*X.upper();
	else
		return 0;
}
開發者ID:kadirsekha,項目名稱:MSc_Project,代碼行數:10,代碼來源:interval.hpp

示例3: Z

Interval operator/(const Interval& X, const Interval& Y)
{
	if(boost::numeric::zero_in(Y) == false)
		return (X * (1/Y));
	else
	{
		if(X.upper() <= 0 && Y.upper() == 0)
		{
			Interval Z(X.upper()/Y.lower(), infinity);
			return Z;
		}
		else if(X.upper() <= 0 && Y.lower() ==0)
		{
			Interval Z(neginfinity, X.upper()/Y.upper());
			return Z;
		}
		else if(X.lower() >= 0 && Y.upper() == 0)
		{
			Interval Z(neginfinity, X.lower()/Y.lower());
			return Z;
		}
		else if(X.lower() >= 0 && Y.lower() == 0)
		{
			Interval Z(X.lower()/Y.upper(), infinity);
			return Z;
		}
		else if(X.lower() <= 0 && 0 <= X.upper())
		{
			Interval Z(neginfinity, infinity);
			return Z;
		}
	}

	return (Interval)0;
}
開發者ID:kadirsekha,項目名稱:MSc_Project,代碼行數:35,代碼來源:interval.hpp

示例4: bounds

Region::Axis::Axis(Interval i, float res)
    : bounds(i)
{
    size_t size = std::max((size_t)1,
                           (size_t)(res * (i.upper() - i.lower())));
    for (unsigned index=0; index < size; ++index)
    {
        const float frac = (index + 0.5) / size;
        values.push_back(i.lower() * (1 - frac) + i.upper() * frac);
    }
}
開發者ID:ervanalb,項目名稱:ao,代碼行數:11,代碼來源:region.cpp

示例5: operator

 std::string operator()(Interval   const & e, bool use_parenthesis = false) const
 {
   std::stringstream ss;
   ss << " [ " << operator()(e.lower()) << "; " << operator()(e.upper()) << " ] ";
   static_cast<int>(use_parenthesis); //to silence unused parameter warnings
   return ss.str();
 }
開發者ID:rollingstone,項目名稱:viennamos-dev,代碼行數:7,代碼來源:latex.hpp

示例6: X

Interval operator/(const int& x, const Interval& Y)
{
	if(boost::numeric::zero_in(Y) == false)
	{
		Interval X(x/Y.upper(), x/Y.lower());
		return X;
	}
	else
	{
		Interval X(x,x);

		if(X.upper() <= 0 && Y.upper() == 0)
		{
			Interval Z(X.upper()/Y.lower(), infinity);
			return Z;
		}
		else if(X.upper() <= 0 && Y.lower() ==0)
		{
			Interval Z(neginfinity, X.upper()/Y.upper());
			return Z;
		}
		else if(X.lower() >= 0 && Y.upper() == 0)
		{
			Interval Z(neginfinity, X.lower()/Y.lower());
			return Z;
		}
		else if(X.lower() >= 0 && Y.lower() == 0)
		{
			Interval Z(X.lower()/Y.upper(), infinity);
			return Z;
		}
		else if(X.lower() <= 0 && 0 <= X.upper())
		{
			Interval Z(neginfinity, infinity);
			return Z;
		}
	}

	return (Interval)0;
}
開發者ID:kadirsekha,項目名稱:MSc_Project,代碼行數:40,代碼來源:interval.hpp

示例7: populateChildren

void Octree::populateChildren(Evaluator* e, const Subregion& r,
                              uint32_t flags)
{
    // The cell is a LEAF cell until proven otherwise
    type = LEAF;

    // If we can recurse, then it may become a BRANCH cell
    if (r.canSplit())
    {
        // First, do interval evaluation to see if the cell should be checked
        Interval out = e->eval(r.X.bounds, r.Y.bounds, r.Z.bounds);
        if (out.upper() < 0)
        {
            type = FULL;
        }
        else if (out.lower() >= 0)
        {
            type = EMPTY;
        }
        else
        {   // If the cell wasn't empty or filled, recurse
            e->push();
            auto rs = r.octsect();
            for (uint8_t i=0; i < 8; ++i)
            {
                children[i].reset(new Octree(e, rs[i], flags));
            }
            type = BRANCH;
            e->pop();
        }
    }

    // Otherwise, calculate corner values
    if (type != BRANCH)
    {
        for (uint8_t i=0; i < 8; ++i)
        {
            auto c = pos(i);
            e->set(c.x, c.y, c.z, i);
        }
        const float* fs = e->values(8);
        for (uint8_t i=0; i < 8; ++i)
        {
            corners[i] = fs[i] < 0;
        }
    }
}
開發者ID:ervanalb,項目名稱:ao,代碼行數:47,代碼來源:octree.cpp

示例8: zero_division_solve

Union_of_Intervals zero_division_solve(Interval X, Interval Y)
{
	if(X.upper() < 0 && Y.lower() < 0 && Y.upper() > 0)
	{
		Union_of_Intervals Z(neginfinity, X.upper()/Y.upper(), X.upper()/Y.lower(), infinity);
		return Z;
	}
	else if(X.lower() > 0 && Y.lower() < 0 && Y.upper() > 0)
	{
		Union_of_Intervals Z(neginfinity, X.lower()/Y.lower(), X.lower()/Y.upper(), infinity);
		return Z;
	}
	else
	{
		Union_of_Intervals Z(0,0,0,0);
		return Z;
	}
}
開發者ID:kadirsekha,項目名稱:MSc_Project,代碼行數:18,代碼來源:interval.hpp

示例9: Interval

Interval operator* (Interval const& lhs, Interval const& rhs){
    // [a,b] * [c,d] = [min (ac, ad, bc, bd), max (ac, ad, bc, bd)]
    return Interval(
        (detail::min)(
            lhs.lower() * rhs.lower(),
            lhs.lower() * rhs.upper(),
            lhs.upper() * rhs.lower(),
            lhs.upper() * rhs.upper()
        ),
        (detail::max)(
            lhs.lower() * rhs.lower(),
            lhs.lower() * rhs.upper(),
            lhs.upper() * rhs.lower(),
            lhs.upper() * rhs.upper()
        )
    );
}
開發者ID:hashier,項目名稱:cbp,代碼行數:17,代碼來源:Intervals.cpp

示例10: make_pair

std::pair<double, double> IntervalBoundsCheck::calc_bounds(const Sym& sym) const {

    Interval bounds = eval(sym, pimpl->bounds);
    return make_pair(bounds.lower(), bounds.upper());
}
開發者ID:AdeleH,項目名稱:paradiseo,代碼行數:5,代碼來源:BoundsCheck.cpp

示例11: lower

 static T lower(const Interval<T>& interval)
 {
   return interval.lower();
 }
開發者ID:dhardy92,項目名稱:mesos,代碼行數:4,代碼來源:interval.hpp

示例12: restrictLeft

// A ∩ (B ∪ [-∞,c]) = [a,min(b,d)]
Interval restrictLeft(Interval const& lhs, Interval const& rhs){
    return Interval(lhs.lower(), (std::min)(lhs.upper(), rhs.upper()));
}
開發者ID:hashier,項目名稱:cbp,代碼行數:4,代碼來源:Intervals.cpp

示例13: in

//// set operations ////
bool in(Interval::Integer x, Interval const& i){
    return x >= i.lower() && x <= i.upper();
}
開發者ID:hashier,項目名稱:cbp,代碼行數:4,代碼來源:Intervals.cpp

示例14: restrictRight

// A ∩ (B ∪ [d,+∞]) = [max(a,c),b]
Interval restrictRight(Interval const& lhs, Interval const& rhs){
    return Interval((std::max)(lhs.lower(), rhs.lower()), lhs.upper());
}
開發者ID:hashier,項目名稱:cbp,代碼行數:4,代碼來源:Intervals.cpp

示例15: lower

bool Interval::operator==(Interval const& rhs) const {
    return lower() == rhs.lower() && upper() == rhs.upper();
}
開發者ID:hashier,項目名稱:cbp,代碼行數:3,代碼來源:Intervals.cpp


注:本文中的Interval::lower方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。