Boost C++ Libraries Home Libraries People FAQ More

PrevUpHomeNext

Complex Number Algorithm Overloads.

#include <boost/tr1/complex.hpp>

or

#include <complex>

The following function templates have additional overloads: arg, norm, conj, polar, imag, and real.

The additional overloads are sufficient to ensure:

The function template pow has additional overloads sufficient to ensure, for a call with at least one argument of type std::complex<T>:

In the following synopsis, Real is a floating point type, Arithmetic is an integer or floating point type, and PROMOTE(X1 ... XN) is the largest floating point type in the list X1 to XN, after any non-floating point types in the list have been replaced by the type double.

template <class Arithmetic>
PROMOTE(Arithmetic) arg(const Arithmetic& t);

template <class Arithmetic>
PROMOTE(Arithmetic) norm(const Arithmetic& t);

template <class Arithmetic>
complex<PROMOTE(Arithmetic)> conj(const Arithmetic& t);

template <class Arithmetic1, class Arithmetic2>
complex<PROMOTE(Arithmetic1,Arithmetic2)> polar(const Arithmetic1& rho, const Arithmetic2& theta = 0);

template <class Arithmetic>
PROMOTE(Arithmetic) imag(const Arithmetic& );

template <class Arithmetic>
PROMOTE(Arithmetic) real(const Arithmetic& t);

template<class Real1, class Real2>
complex<PROMOTE(Real1, Real2)>
   pow(const complex<Real1>& x, const complex<Real2>& y);

template<class Real, class Arithmetic>
complex<PROMOTE(Real, Arithmetic)>
   pow (const complex<Real>& x, const Arithmetic& y);

template<class Arithmetic, class Real>
complex<PROMOTE(Real, Arithmetic)>
   pow (const Arithmetic& x, const complex<Real>& y);

Configuration: Boost.Config should (automatically) define the macro BOOST_HAS_TR1_COMPLEX_OVERLOADS if your standard library implements the additional overloads for the existing complex arithmetic functions.

Standard Conformity: No known problems.


PrevUpHomeNext