Skip to content
Snippets Groups Projects
Commit a7de87f9 authored by oliver.sander_at_tu-dresden.de's avatar oliver.sander_at_tu-dresden.de
Browse files

Merge branch 'feature/interval-multiplication' into 'master'

Interval: scalar multiplication

See merge request !49
parents 994f9aca 6497c08a
Branches
No related tags found
1 merge request!49Interval: scalar multiplication
Pipeline #31868 passed
......@@ -57,6 +57,15 @@ public:
return *this;
}
/** \brief Scalar multiplication
*/
Interval& operator*=(const field_type& c)
{
data_[0] *= c;
data_[1] *= c;
return *this;
}
/** \brief Project a scalar onto the interval
*/
field_type projectIn(const field_type& x) const
......@@ -97,6 +106,22 @@ private:
std::array<field_type,2> data_;
};
//! Scalar multiplication from the left
template <class field_type>
Interval<field_type> operator*(const field_type& c, const Interval<field_type>& i)
{
auto ret = i;
return ret *= c;
}
//! Scalar multiplication from the right
template <class field_type>
Interval<field_type> operator*(const Interval<field_type>& i, const field_type& c)
{
return c * i;
}
//! Output operator for Interval
template <class field_type>
inline std::ostream& operator<< (std::ostream& s, const Interval<field_type>& interval)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment