imgtools/imglib/boostlibrary/boost/tr1/complex.hpp
author wbernard
Sun, 10 Oct 2010 15:22:15 +0300
changeset 645 b8d81fa19e7d
parent 600 6d08f4a05d93
permissions -rw-r--r--
helium_12.0.0-63b64366f9cf
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
600
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
     1
//  (C) Copyright John Maddock 2005.
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
     2
//  Use, modification and distribution are subject to the
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
     3
//  Boost Software License, Version 1.0. (See accompanying file
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
     4
//  LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
     5
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
     6
#ifndef BOOST_TR1_COMPLEX_HPP_INCLUDED
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
     7
#  define BOOST_TR1_COMPLEX_HPP_INCLUDED
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
     8
#  include <boost/tr1/detail/config.hpp>
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
     9
#  include <complex>
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    10
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    11
#ifndef BOOST_HAS_TR1_COMPLEX_INVERSE_TRIG
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    12
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    13
#include <boost/math/complex.hpp>
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    14
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    15
namespace std {
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    16
namespace tr1 {
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    17
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    18
using boost::math::acos;
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    19
using boost::math::asin;
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    20
using boost::math::atan;
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    21
using boost::math::acosh;
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    22
using boost::math::asinh;
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    23
using boost::math::atanh;
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    24
using boost::math::fabs;
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    25
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    26
} }
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    27
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    28
#else
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    29
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    30
#  ifdef BOOST_HAS_INCLUDE_NEXT
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    31
#     include_next BOOST_TR1_HEADER(complex)
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    32
#  else
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    33
#     include <boost/tr1/detail/config_all.hpp>
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    34
#     include BOOST_TR1_STD_HEADER(BOOST_TR1_PATH(complex))
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    35
#  endif
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    36
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    37
#endif
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    38
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    39
#ifndef BOOST_HAS_TR1_COMPLEX_OVERLOADS
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    40
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    41
#include <boost/tr1/detail/math_overloads.hpp>
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    42
#include <boost/assert.hpp>
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    43
#include <boost/detail/workaround.hpp>
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    44
#include <boost/config/no_tr1/cmath.hpp>
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    45
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    46
namespace std{ 
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    47
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    48
#ifdef BOOST_NO_STDC_NAMESPACE
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    49
   using :: atan2;
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    50
#endif
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    51
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    52
#ifndef BOOST_NO_FUNCTION_TEMPLATE_ORDERING
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    53
template <class T>
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    54
inline BOOST_TR1_MATH_RETURN(double) arg(const T& t)
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    55
{
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    56
   return ::std::atan2(0.0, static_cast<double>(t));
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    57
}
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    58
#else
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    59
inline double arg(const double& t)
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    60
{
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    61
   return ::std::atan2(0.0, t);
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    62
}
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    63
#endif
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    64
inline long double arg(const long double& t)
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    65
{
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    66
   return ::std::atan2(0.0L, static_cast<long double>(t));
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    67
}
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    68
inline float arg(const float& t)
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    69
{
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    70
   return ::std::atan2(0.0F, static_cast<float>(t));
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    71
}
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    72
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    73
#ifndef BOOST_NO_FUNCTION_TEMPLATE_ORDERING
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    74
template <class T>
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    75
inline BOOST_TR1_MATH_RETURN(double) norm(const T& t)
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    76
{
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    77
   double r = static_cast<double>(t);
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    78
   return r*r;
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    79
}
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    80
#else
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    81
inline double norm(const double& t)
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    82
{
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    83
   return t*t;
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    84
}
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    85
#endif
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    86
inline long double norm(const long double& t)
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    87
{
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    88
   long double l = t;
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    89
   return l*l;
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    90
}
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    91
inline float norm(const float& t)
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    92
{
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    93
   float f = t;
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    94
   return f*f;
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    95
}
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    96
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    97
#ifndef BOOST_NO_FUNCTION_TEMPLATE_ORDERING
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    98
template <class T>
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    99
inline BOOST_TR1_MATH_RETURN(std::complex<double>) conj(const T& t)
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   100
{
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   101
   return ::std::conj(std::complex<double>(static_cast<double>(t)));
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   102
}
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   103
#else
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   104
inline std::complex<double> conj(const double& t)
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   105
{
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   106
   return ::std::conj(std::complex<double>(t));
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   107
}
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   108
#endif
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   109
inline std::complex<long double> conj(const long double& t)
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   110
{
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   111
   return ::std::conj(std::complex<long double>(t));
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   112
}
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   113
inline std::complex<float> conj(const float& t)
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   114
{
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   115
   std::complex<float> ct(t);
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   116
   ct = ::std::conj(ct);
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   117
   return ct;
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   118
}
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   119
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   120
#if !BOOST_WORKAROUND(__BORLANDC__, <=0x570) && !BOOST_WORKAROUND(BOOST_MSVC, < 1310)
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   121
inline complex<double> polar(const char& rho, const char& theta = 0)
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   122
{ return ::std::polar(static_cast<double>(rho), static_cast<double>(theta)); }
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   123
inline complex<double> polar(const unsigned char& rho, const unsigned char& theta = 0)
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   124
{ return ::std::polar(static_cast<double>(rho), static_cast<double>(theta)); }
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   125
inline complex<double> polar(const signed char& rho, const signed char& theta = 0)
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   126
{ return ::std::polar(static_cast<double>(rho), static_cast<double>(theta)); }
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   127
inline complex<double> polar(const short& rho, const short& theta = 0)
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   128
{ return ::std::polar(static_cast<double>(rho), static_cast<double>(theta)); }
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   129
inline complex<double> polar(const unsigned short& rho, const unsigned short& theta = 0)
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   130
{ return ::std::polar(static_cast<double>(rho), static_cast<double>(theta)); }
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   131
inline complex<double> polar(const int& rho, const int& theta = 0)
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   132
{ return ::std::polar(static_cast<double>(rho), static_cast<double>(theta)); }
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   133
inline complex<double> polar(const unsigned int& rho, const unsigned int& theta = 0)
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   134
{ return ::std::polar(static_cast<double>(rho), static_cast<double>(theta)); }
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   135
inline complex<double> polar(const long& rho, const long& theta = 0)
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   136
{ return ::std::polar(static_cast<double>(rho), static_cast<double>(theta)); }
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   137
inline complex<double> polar(const unsigned long& rho, const unsigned long& theta = 0)
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   138
{ return ::std::polar(static_cast<double>(rho), static_cast<double>(theta)); }
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   139
#ifdef BOOST_HAS_LONG_LONG
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   140
inline complex<double> polar(const long long& rho, const long long& theta = 0)
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   141
{ return ::std::polar(static_cast<double>(rho), static_cast<double>(theta)); }
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   142
inline complex<double> polar(const unsigned long long& rho, const unsigned long long& theta = 0)
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   143
{ return ::std::polar(static_cast<double>(rho), static_cast<double>(theta)); }
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   144
#elif defined(BOOST_HAS_MS_INT64)
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   145
inline complex<double> polar(const __int64& rho, const __int64& theta = 0)
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   146
{ return ::std::polar(static_cast<double>(rho), static_cast<double>(theta)); }
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   147
inline complex<double> polar(const unsigned __int64& rho, const unsigned __int64& theta = 0)
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   148
{ return ::std::polar(static_cast<double>(rho), static_cast<double>(theta)); }
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   149
#endif
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   150
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   151
template<class T, class U> 
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   152
inline complex<typename boost::tr1_detail::promote_to_real<T, U>::type> 
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   153
   polar(const T& rho, const U& theta)
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   154
{
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   155
   typedef typename boost::tr1_detail::promote_to_real<T, U>::type real_type;
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   156
   return std::polar(static_cast<real_type>(rho), static_cast<real_type>(theta));
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   157
}
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   158
#endif
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   159
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   160
#ifndef BOOST_NO_FUNCTION_TEMPLATE_ORDERING
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   161
template <class T>
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   162
inline BOOST_TR1_MATH_RETURN(double) imag(const T& )
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   163
{
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   164
   return 0;
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   165
}
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   166
#else
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   167
inline double imag(const double& )
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   168
{
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   169
   return 0;
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   170
}
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   171
#endif
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   172
inline long double imag(const long double& )
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   173
{
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   174
   return 0;
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   175
}
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   176
inline float imag(const float& )
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   177
{
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   178
   return 0;
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   179
}
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   180
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   181
#ifndef BOOST_NO_FUNCTION_TEMPLATE_ORDERING
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   182
template <class T>
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   183
inline BOOST_TR1_MATH_RETURN(double) real(const T& t)
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   184
{
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   185
   return static_cast<double>(t);
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   186
}
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   187
#else
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   188
inline double real(const double& t)
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   189
{
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   190
   return t;
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   191
}
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   192
#endif
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   193
inline long double real(const long double& t)
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   194
{
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   195
   return t;
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   196
}
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   197
inline float real(const float& t)
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   198
{
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   199
   return t;
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   200
}
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   201
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   202
template<class T, class U>
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   203
inline complex<typename boost::tr1_detail::largest_real<T, U>::type>
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   204
   pow(const complex<T>& x, const complex<U>& y)
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   205
{
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   206
   typedef complex<typename boost::tr1_detail::largest_real<T, U>::type> result_type;
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   207
   typedef typename boost::mpl::if_<boost::is_same<result_type, complex<T> >, result_type const&, result_type>::type cast1_type;
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   208
   typedef typename boost::mpl::if_<boost::is_same<result_type, complex<U> >, result_type const&, result_type>::type cast2_type;
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   209
   cast1_type x1(x);
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   210
   cast2_type y1(y);
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   211
   return std::pow(x1, y1);
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   212
}
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   213
template<class T, class U> 
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   214
inline complex<typename boost::tr1_detail::promote_to_real<T, U>::type>
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   215
   pow (const complex<T>& x, const U& y)
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   216
{
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   217
   typedef typename boost::tr1_detail::promote_to_real<T, U>::type real_type;
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   218
   typedef complex<typename boost::tr1_detail::promote_to_real<T, U>::type> result_type;
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   219
   typedef typename boost::mpl::if_<boost::is_same<result_type, complex<T> >, result_type const&, result_type>::type cast1_type;
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   220
   real_type r = y;
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   221
   cast1_type x1(x);
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   222
   std::complex<real_type> y1(r);
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   223
   return std::pow(x1, y1);
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   224
}
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   225
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   226
template<class T, class U> 
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   227
inline complex<typename boost::tr1_detail::promote_to_real<T, U>::type>
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   228
   pow (const T& x, const complex<U>& y)
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   229
{
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   230
   typedef typename boost::tr1_detail::promote_to_real<T, U>::type real_type;
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   231
   typedef complex<typename boost::tr1_detail::promote_to_real<T, U>::type> result_type;
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   232
   typedef typename boost::mpl::if_<boost::is_same<result_type, complex<U> >, result_type const&, result_type>::type cast_type;
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   233
   real_type r = x;
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   234
   std::complex<real_type> x1(r);
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   235
   cast_type y1(y);
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   236
   return std::pow(x1, y1);
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   237
}
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   238
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   239
}
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   240
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   241
#endif
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   242
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   243
#endif
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   244