diff -r 22486c9c7b15 -r 378360dbbdba imgtools/imglib/boostlibrary/boost/tr1/complex.hpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imgtools/imglib/boostlibrary/boost/tr1/complex.hpp Wed Jun 30 11:35:58 2010 +0800 @@ -0,0 +1,244 @@ +// (C) Copyright John Maddock 2005. +// Use, modification and distribution are subject to the +// Boost Software License, Version 1.0. (See accompanying file +// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) + +#ifndef BOOST_TR1_COMPLEX_HPP_INCLUDED +# define BOOST_TR1_COMPLEX_HPP_INCLUDED +# include +# include + +#ifndef BOOST_HAS_TR1_COMPLEX_INVERSE_TRIG + +#include + +namespace std { +namespace tr1 { + +using boost::math::acos; +using boost::math::asin; +using boost::math::atan; +using boost::math::acosh; +using boost::math::asinh; +using boost::math::atanh; +using boost::math::fabs; + +} } + +#else + +# ifdef BOOST_HAS_INCLUDE_NEXT +# include_next BOOST_TR1_HEADER(complex) +# else +# include +# include BOOST_TR1_STD_HEADER(BOOST_TR1_PATH(complex)) +# endif + +#endif + +#ifndef BOOST_HAS_TR1_COMPLEX_OVERLOADS + +#include +#include +#include +#include + +namespace std{ + +#ifdef BOOST_NO_STDC_NAMESPACE + using :: atan2; +#endif + +#ifndef BOOST_NO_FUNCTION_TEMPLATE_ORDERING +template +inline BOOST_TR1_MATH_RETURN(double) arg(const T& t) +{ + return ::std::atan2(0.0, static_cast(t)); +} +#else +inline double arg(const double& t) +{ + return ::std::atan2(0.0, t); +} +#endif +inline long double arg(const long double& t) +{ + return ::std::atan2(0.0L, static_cast(t)); +} +inline float arg(const float& t) +{ + return ::std::atan2(0.0F, static_cast(t)); +} + +#ifndef BOOST_NO_FUNCTION_TEMPLATE_ORDERING +template +inline BOOST_TR1_MATH_RETURN(double) norm(const T& t) +{ + double r = static_cast(t); + return r*r; +} +#else +inline double norm(const double& t) +{ + return t*t; +} +#endif +inline long double norm(const long double& t) +{ + long double l = t; + return l*l; +} +inline float norm(const float& t) +{ + float f = t; + return f*f; +} + +#ifndef BOOST_NO_FUNCTION_TEMPLATE_ORDERING +template +inline BOOST_TR1_MATH_RETURN(std::complex) conj(const T& t) +{ + return ::std::conj(std::complex(static_cast(t))); +} +#else +inline std::complex conj(const double& t) +{ + return ::std::conj(std::complex(t)); +} +#endif +inline std::complex conj(const long double& t) +{ + return ::std::conj(std::complex(t)); +} +inline std::complex conj(const float& t) +{ + std::complex ct(t); + ct = ::std::conj(ct); + return ct; +} + +#if !BOOST_WORKAROUND(__BORLANDC__, <=0x570) && !BOOST_WORKAROUND(BOOST_MSVC, < 1310) +inline complex polar(const char& rho, const char& theta = 0) +{ return ::std::polar(static_cast(rho), static_cast(theta)); } +inline complex polar(const unsigned char& rho, const unsigned char& theta = 0) +{ return ::std::polar(static_cast(rho), static_cast(theta)); } +inline complex polar(const signed char& rho, const signed char& theta = 0) +{ return ::std::polar(static_cast(rho), static_cast(theta)); } +inline complex polar(const short& rho, const short& theta = 0) +{ return ::std::polar(static_cast(rho), static_cast(theta)); } +inline complex polar(const unsigned short& rho, const unsigned short& theta = 0) +{ return ::std::polar(static_cast(rho), static_cast(theta)); } +inline complex polar(const int& rho, const int& theta = 0) +{ return ::std::polar(static_cast(rho), static_cast(theta)); } +inline complex polar(const unsigned int& rho, const unsigned int& theta = 0) +{ return ::std::polar(static_cast(rho), static_cast(theta)); } +inline complex polar(const long& rho, const long& theta = 0) +{ return ::std::polar(static_cast(rho), static_cast(theta)); } +inline complex polar(const unsigned long& rho, const unsigned long& theta = 0) +{ return ::std::polar(static_cast(rho), static_cast(theta)); } +#ifdef BOOST_HAS_LONG_LONG +inline complex polar(const long long& rho, const long long& theta = 0) +{ return ::std::polar(static_cast(rho), static_cast(theta)); } +inline complex polar(const unsigned long long& rho, const unsigned long long& theta = 0) +{ return ::std::polar(static_cast(rho), static_cast(theta)); } +#elif defined(BOOST_HAS_MS_INT64) +inline complex polar(const __int64& rho, const __int64& theta = 0) +{ return ::std::polar(static_cast(rho), static_cast(theta)); } +inline complex polar(const unsigned __int64& rho, const unsigned __int64& theta = 0) +{ return ::std::polar(static_cast(rho), static_cast(theta)); } +#endif + +template +inline complex::type> + polar(const T& rho, const U& theta) +{ + typedef typename boost::tr1_detail::promote_to_real::type real_type; + return std::polar(static_cast(rho), static_cast(theta)); +} +#endif + +#ifndef BOOST_NO_FUNCTION_TEMPLATE_ORDERING +template +inline BOOST_TR1_MATH_RETURN(double) imag(const T& ) +{ + return 0; +} +#else +inline double imag(const double& ) +{ + return 0; +} +#endif +inline long double imag(const long double& ) +{ + return 0; +} +inline float imag(const float& ) +{ + return 0; +} + +#ifndef BOOST_NO_FUNCTION_TEMPLATE_ORDERING +template +inline BOOST_TR1_MATH_RETURN(double) real(const T& t) +{ + return static_cast(t); +} +#else +inline double real(const double& t) +{ + return t; +} +#endif +inline long double real(const long double& t) +{ + return t; +} +inline float real(const float& t) +{ + return t; +} + +template +inline complex::type> + pow(const complex& x, const complex& y) +{ + typedef complex::type> result_type; + typedef typename boost::mpl::if_ >, result_type const&, result_type>::type cast1_type; + typedef typename boost::mpl::if_ >, result_type const&, result_type>::type cast2_type; + cast1_type x1(x); + cast2_type y1(y); + return std::pow(x1, y1); +} +template +inline complex::type> + pow (const complex& x, const U& y) +{ + typedef typename boost::tr1_detail::promote_to_real::type real_type; + typedef complex::type> result_type; + typedef typename boost::mpl::if_ >, result_type const&, result_type>::type cast1_type; + real_type r = y; + cast1_type x1(x); + std::complex y1(r); + return std::pow(x1, y1); +} + +template +inline complex::type> + pow (const T& x, const complex& y) +{ + typedef typename boost::tr1_detail::promote_to_real::type real_type; + typedef complex::type> result_type; + typedef typename boost::mpl::if_ >, result_type const&, result_type>::type cast_type; + real_type r = x; + std::complex x1(r); + cast_type y1(y); + return std::pow(x1, y1); +} + +} + +#endif + +#endif +