Added boost header
This commit is contained in:
82
test/external/boost/accumulators/numeric/functional/complex.hpp
vendored
Normal file
82
test/external/boost/accumulators/numeric/functional/complex.hpp
vendored
Normal file
@@ -0,0 +1,82 @@
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
/// \file complex.hpp
|
||||
///
|
||||
// Copyright 2005 Eric Niebler. Distributed under 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_NUMERIC_FUNCTIONAL_COMPLEX_HPP_EAN_01_17_2006
|
||||
#define BOOST_NUMERIC_FUNCTIONAL_COMPLEX_HPP_EAN_01_17_2006
|
||||
|
||||
#ifdef BOOST_NUMERIC_FUNCTIONAL_HPP_INCLUDED
|
||||
# error Include this file before boost/accumulators/numeric/functional.hpp
|
||||
#endif
|
||||
|
||||
#include <complex>
|
||||
#include <boost/mpl/or.hpp>
|
||||
#include <boost/type_traits/is_same.hpp>
|
||||
#include <boost/utility/enable_if.hpp>
|
||||
#include <boost/typeof/std/complex.hpp>
|
||||
#include <boost/accumulators/numeric/functional_fwd.hpp>
|
||||
|
||||
namespace boost { namespace numeric { namespace operators
|
||||
{
|
||||
// So that the stats compile when Sample type is std::complex
|
||||
template<typename T, typename U>
|
||||
typename
|
||||
disable_if<
|
||||
mpl::or_<is_same<T, U>, is_same<std::complex<T>, U> >
|
||||
, std::complex<T>
|
||||
>::type
|
||||
operator *(std::complex<T> ri, U const &u)
|
||||
{
|
||||
// BUGBUG promote result to typeof(T()*u) ?
|
||||
return ri *= static_cast<T>(u);
|
||||
}
|
||||
|
||||
template<typename T, typename U>
|
||||
typename
|
||||
disable_if<
|
||||
mpl::or_<is_same<T, U>, is_same<std::complex<T>, U> >
|
||||
, std::complex<T>
|
||||
>::type
|
||||
operator /(std::complex<T> ri, U const &u)
|
||||
{
|
||||
// BUGBUG promote result to typeof(T()*u) ?
|
||||
return ri /= static_cast<T>(u);
|
||||
}
|
||||
|
||||
}}} // namespace boost::numeric::operators
|
||||
|
||||
namespace boost { namespace numeric
|
||||
{
|
||||
namespace detail
|
||||
{
|
||||
template<typename T>
|
||||
struct one_complex
|
||||
{
|
||||
static std::complex<T> const value;
|
||||
};
|
||||
|
||||
template<typename T>
|
||||
std::complex<T> const one_complex<T>::value
|
||||
= std::complex<T>(numeric::one<T>::value, numeric::one<T>::value);
|
||||
}
|
||||
|
||||
/// INTERNAL ONLY
|
||||
///
|
||||
template<typename T>
|
||||
struct one<std::complex<T> >
|
||||
: detail::one_complex<T>
|
||||
{
|
||||
typedef one type;
|
||||
typedef std::complex<T> value_type;
|
||||
operator value_type const & () const
|
||||
{
|
||||
return detail::one_complex<T>::value;
|
||||
}
|
||||
};
|
||||
|
||||
}} // namespace boost::numeric
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user