traits.hpp
来自「CGAL is a collaborative effort of severa」· HPP 代码 · 共 1,465 行 · 第 1/4 页
HPP
1,465 行
static BOOST_UBLAS_INLINE real_type norm_inf (const_reference t) { return (std::max) (type_traits<real_type>::abs (self_type::real (t)), type_traits<real_type>::abs (self_type::imag (t))); } static BOOST_UBLAS_INLINE bool equals (const_reference t1, const_reference t2) { return self_type::norm_inf (t1 - t2) < BOOST_UBLAS_TYPE_CHECK_EPSILON * (std::max) ((std::max) (self_type::norm_inf (t1), self_type::norm_inf (t2)), BOOST_UBLAS_TYPE_CHECK_MIN); } }; template<> struct type_traits<std::complex<double> > { typedef type_traits<std::complex<double> > self_type; typedef std::complex<double> value_type; typedef const value_type &const_reference; typedef value_type &reference; typedef double real_type;#ifndef BOOST_UBLAS_NO_LONG_DOUBLE typedef std::complex<long double> precision_type;#else typedef value_type precision_type;#endif BOOST_STATIC_CONSTANT (unsigned, plus_complexity = 2); BOOST_STATIC_CONSTANT (unsigned, multiplies_complexity = 6); static BOOST_UBLAS_INLINE real_type real (const_reference t) { return std::real (t); } static BOOST_UBLAS_INLINE real_type imag (const_reference t) { return std::imag (t); } static BOOST_UBLAS_INLINE value_type conj (const_reference t) { return std::conj (t); } static BOOST_UBLAS_INLINE real_type abs (const_reference t) { return std::abs (t); } static BOOST_UBLAS_INLINE value_type sqrt (const_reference t) { return std::sqrt (t); } static BOOST_UBLAS_INLINE real_type norm_1 (const_reference t) { return type_traits<real_type>::abs (self_type::real (t)) + type_traits<real_type>::abs (self_type::imag (t)); } static BOOST_UBLAS_INLINE real_type norm_2 (const_reference t) { return self_type::abs (t); } static BOOST_UBLAS_INLINE real_type norm_inf (const_reference t) { return (std::max) (type_traits<real_type>::abs (self_type::real (t)), type_traits<real_type>::abs (self_type::imag (t))); } static BOOST_UBLAS_INLINE bool equals (const_reference t1, const_reference t2) { return self_type::norm_inf (t1 - t2) < BOOST_UBLAS_TYPE_CHECK_EPSILON * (std::max) ((std::max) (self_type::norm_inf (t1), self_type::norm_inf (t2)), BOOST_UBLAS_TYPE_CHECK_MIN); } };#ifndef BOOST_UBLAS_NO_LONG_DOUBLE template<> struct type_traits<std::complex<long double> > { typedef type_traits<std::complex<long double> > self_type; typedef std::complex<long double> value_type; typedef const value_type &const_reference; typedef value_type &reference; typedef long double real_type; typedef value_type precision_type; BOOST_STATIC_CONSTANT (unsigned, plus_complexity = 2); BOOST_STATIC_CONSTANT (unsigned, multiplies_complexity = 6); static BOOST_UBLAS_INLINE real_type real (const_reference t) { return std::real (t); } static BOOST_UBLAS_INLINE real_type imag (const_reference t) { return std::imag (t); } static BOOST_UBLAS_INLINE value_type conj (const_reference t) { return std::conj (t); } static BOOST_UBLAS_INLINE real_type abs (const_reference t) { return std::abs (t); } static BOOST_UBLAS_INLINE value_type sqrt (const_reference t) { return std::sqrt (t); } static BOOST_UBLAS_INLINE real_type norm_1 (const_reference t) { return type_traits<real_type>::abs (self_type::real (t)) + type_traits<real_type>::abs (self_type::imag (t)); } static BOOST_UBLAS_INLINE real_type norm_2 (const_reference t) { return self_type::abs (t); } static BOOST_UBLAS_INLINE real_type norm_inf (const_reference t) { return (std::max) (type_traits<real_type>::abs (self_type::real (t)), type_traits<real_type>::abs (self_type::imag (t))); } static BOOST_UBLAS_INLINE bool equals (const_reference t1, const_reference t2) { return self_type::norm_inf (t1 - t2) < BOOST_UBLAS_TYPE_CHECK_EPSILON * (std::max) ((std::max) (self_type::norm_inf (t1), self_type::norm_inf (t2)), BOOST_UBLAS_TYPE_CHECK_MIN); } };#endif#ifdef BOOST_UBLAS_USE_INTERVAL template<> struct type_traits<boost::numeric::interval<float> > { typedef type_traits<boost::numeric::interval<float> > self_type; typedef boost::numeric::interval<float> value_type; typedef const value_type &const_reference; typedef value_type &reference; typedef value_type real_type; typedef boost::numeric::interval<double> precision_type; BOOST_STATIC_CONSTANT (unsigned, plus_complexity = 1); BOOST_STATIC_CONSTANT (unsigned, multiplies_complexity = 1); static BOOST_UBLAS_INLINE real_type real (const_reference t) { return t; } static BOOST_UBLAS_INLINE real_type imag (const_reference t) { return 0; } static BOOST_UBLAS_INLINE value_type conj (const_reference t) { return t; } static BOOST_UBLAS_INLINE real_type abs (const_reference t) { return boost::numeric::abs (t); } static BOOST_UBLAS_INLINE value_type sqrt (const_reference t) { return boost::numeric::sqrt (t); } static BOOST_UBLAS_INLINE real_type norm_1 (const_reference t) { return self_type::abs (t); } static BOOST_UBLAS_INLINE real_type norm_2 (const_reference t) { return self_type::abs (t); } static BOOST_UBLAS_INLINE real_type norm_inf (const_reference t) { return self_type::abs (t); } static BOOST_UBLAS_INLINE bool equals (const_reference t1, const_reference t2) { return self_type::norm_inf (t1 - t2) < BOOST_UBLAS_TYPE_CHECK_EPSILON * (std::max) ((std::max) (self_type::norm_inf (t1), self_type::norm_inf (t2)), BOOST_UBLAS_TYPE_CHECK_MIN); } }; template<> struct type_traits<boost::numeric::interval<double> > { typedef type_traits<boost::numeric::interval<double> > self_type; typedef boost::numeric::interval<double> value_type; typedef const value_type &const_reference; typedef value_type &reference; typedef value_type real_type;#ifndef BOOST_UBLAS_NO_LONG_DOUBLE typedef boost::numeric::interval<long double> precision_type;#else typedef value_type precision_type;#endif BOOST_STATIC_CONSTANT (unsigned, plus_complexity = 1); BOOST_STATIC_CONSTANT (unsigned, multiplies_complexity = 1); static BOOST_UBLAS_INLINE real_type real (const_reference t) { return t; } static BOOST_UBLAS_INLINE real_type imag (const_reference t) { return 0; } static BOOST_UBLAS_INLINE value_type conj (const_reference t) { return t; } static BOOST_UBLAS_INLINE real_type abs (const_reference t) { return boost::numeric::abs (t); } static BOOST_UBLAS_INLINE value_type sqrt (const_reference t) { return boost::numeric::sqrt (t); } static BOOST_UBLAS_INLINE real_type norm_1 (const_reference t) { return self_type::abs (t); } static BOOST_UBLAS_INLINE real_type norm_2 (const_reference t) { return self_type::abs (t); } static BOOST_UBLAS_INLINE real_type norm_inf (const_reference t) { return self_type::abs (t); } static BOOST_UBLAS_INLINE bool equals (const_reference t1, const_reference t2) { return self_type::norm_inf (t1 - t2) < BOOST_UBLAS_TYPE_CHECK_EPSILON * (std::max) ((std::max) (self_type::norm_inf (t1), self_type::norm_inf (t2)), BOOST_UBLAS_TYPE_CHECK_MIN); } };#ifndef BOOST_UBLAS_NO_LONG_DOUBLE template<> struct type_traits<boost::numeric::interval<long double> > { typedef type_traits<boost::numeric::interval<long double> > self_type; typedef boost::numeric::interval<long double> value_type; typedef const value_type &const_reference; typedef value_type &reference; typedef value_type real_type; typedef value_type precision_type; BOOST_STATIC_CONSTANT (unsigned, plus_complexity = 1); BOOST_STATIC_CONSTANT (unsigned, multiplies_complexity = 1); static BOOST_UBLAS_INLINE real_type real (const_reference t) { return t; } static BOOST_UBLAS_INLINE real_type imag (const_reference t) { return 0; } static BOOST_UBLAS_INLINE value_type conj (const_reference t) { return t; } static BOOST_UBLAS_INLINE real_type abs (const_reference t) { return boost::numeric::abs (t); } static BOOST_UBLAS_INLINE value_type sqrt (const_reference t) { return boost::numeric::sqrt (t); } static BOOST_UBLAS_INLINE real_type norm_1 (const_reference t) { return self_type::abs (t); } static BOOST_UBLAS_INLINE real_type norm_2 (const_reference t) { return self_type::abs (t); } static BOOST_UBLAS_INLINE real_type norm_inf (const_reference t) { return self_type::abs (t); } static BOOST_UBLAS_INLINE bool equals (const_reference t1, const_reference t2) { return self_type::norm_inf (t1 - t2) < BOOST_UBLAS_TYPE_CHECK_EPSILON * (std::max) ((std::max) (self_type::norm_inf (t1), self_type::norm_inf (t2)), BOOST_UBLAS_TYPE_CHECK_MIN); } };#endif#ifdef BOOST_UBLAS_USE_BOOST_COMPLEX template<> struct type_traits<boost::complex<boost::numeric::interval<float> > > { typedef type_traits<boost::complex<boost::numeric::interval<float> > > self_type; typedef boost::complex<boost::numeric::interval<float> > value_type; typedef const value_type &const_reference; typedef value_type &reference; typedef boost::numeric::interval<float> real_type; typedef boost::complex<boost::numeric::interval<double> > precision_type; BOOST_STATIC_CONSTANT (unsigned, plus_complexity = 2); BOOST_STATIC_CONSTANT (unsigned, multiplies_complexity = 6);
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?