Initial Commit
This commit is contained in:
@@ -0,0 +1,143 @@
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// Copyright 2013 Nikhar Agrawal
|
||||
// Copyright 2013 Christopher Kormanyos
|
||||
// Copyright 2013 John Maddock
|
||||
// Copyright 2013 Paul Bristow
|
||||
// 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_BERNOULLI_B2N_2013_05_30_HPP_
|
||||
#define _BOOST_BERNOULLI_B2N_2013_05_30_HPP_
|
||||
|
||||
#include <boost/math/special_functions/math_fwd.hpp>
|
||||
#include <boost/math/special_functions/detail/unchecked_bernoulli.hpp>
|
||||
#include <boost/math/special_functions/detail/bernoulli_details.hpp>
|
||||
|
||||
namespace boost { namespace math {
|
||||
|
||||
namespace detail {
|
||||
|
||||
template <class T, class OutputIterator, class Policy, int N>
|
||||
OutputIterator bernoulli_number_imp(OutputIterator out, std::size_t start, std::size_t n, const Policy& pol, const mpl::int_<N>& tag)
|
||||
{
|
||||
for(std::size_t i = start; (i <= max_bernoulli_b2n<T>::value) && (i < start + n); ++i)
|
||||
{
|
||||
*out = unchecked_bernoulli_imp<T>(i, tag);
|
||||
++out;
|
||||
}
|
||||
|
||||
for(std::size_t i = (std::max)(static_cast<std::size_t>(max_bernoulli_b2n<T>::value + 1), start); i < start + n; ++i)
|
||||
{
|
||||
// We must overflow:
|
||||
*out = (i & 1 ? 1 : -1) * policies::raise_overflow_error<T>("boost::math::bernoulli_b2n<%1%>(n)", 0, T(i), pol);
|
||||
++out;
|
||||
}
|
||||
return out;
|
||||
}
|
||||
|
||||
template <class T, class OutputIterator, class Policy>
|
||||
OutputIterator bernoulli_number_imp(OutputIterator out, std::size_t start, std::size_t n, const Policy& pol, const mpl::int_<0>& tag)
|
||||
{
|
||||
for(std::size_t i = start; (i <= max_bernoulli_b2n<T>::value) && (i < start + n); ++i)
|
||||
{
|
||||
*out = unchecked_bernoulli_imp<T>(i, tag);
|
||||
++out;
|
||||
}
|
||||
//
|
||||
// Short circuit return so we don't grab the mutex below unless we have to:
|
||||
//
|
||||
if(start + n <= max_bernoulli_b2n<T>::value)
|
||||
return out;
|
||||
|
||||
return get_bernoulli_numbers_cache<T, Policy>().copy_bernoulli_numbers(out, start, n, pol);
|
||||
}
|
||||
|
||||
} // namespace detail
|
||||
|
||||
template <class T, class Policy>
|
||||
inline T bernoulli_b2n(const int i, const Policy &pol)
|
||||
{
|
||||
typedef mpl::int_<detail::bernoulli_imp_variant<T>::value> tag_type;
|
||||
if(i < 0)
|
||||
return policies::raise_domain_error<T>("boost::math::bernoulli_b2n<%1%>", "Index should be >= 0 but got %1%", T(i), pol);
|
||||
|
||||
T result = static_cast<T>(0); // The = 0 is just to silence compiler warnings :-(
|
||||
boost::math::detail::bernoulli_number_imp<T>(&result, static_cast<std::size_t>(i), 1u, pol, tag_type());
|
||||
return result;
|
||||
}
|
||||
|
||||
template <class T>
|
||||
inline T bernoulli_b2n(const int i)
|
||||
{
|
||||
return boost::math::bernoulli_b2n<T>(i, policies::policy<>());
|
||||
}
|
||||
|
||||
template <class T, class OutputIterator, class Policy>
|
||||
inline OutputIterator bernoulli_b2n(const int start_index,
|
||||
const unsigned number_of_bernoullis_b2n,
|
||||
OutputIterator out_it,
|
||||
const Policy& pol)
|
||||
{
|
||||
typedef mpl::int_<detail::bernoulli_imp_variant<T>::value> tag_type;
|
||||
if(start_index < 0)
|
||||
{
|
||||
*out_it = policies::raise_domain_error<T>("boost::math::bernoulli_b2n<%1%>", "Index should be >= 0 but got %1%", T(start_index), pol);
|
||||
return ++out_it;
|
||||
}
|
||||
|
||||
return boost::math::detail::bernoulli_number_imp<T>(out_it, start_index, number_of_bernoullis_b2n, pol, tag_type());
|
||||
}
|
||||
|
||||
template <class T, class OutputIterator>
|
||||
inline OutputIterator bernoulli_b2n(const int start_index,
|
||||
const unsigned number_of_bernoullis_b2n,
|
||||
OutputIterator out_it)
|
||||
{
|
||||
return boost::math::bernoulli_b2n<T, OutputIterator>(start_index, number_of_bernoullis_b2n, out_it, policies::policy<>());
|
||||
}
|
||||
|
||||
template <class T, class Policy>
|
||||
inline T tangent_t2n(const int i, const Policy &pol)
|
||||
{
|
||||
if(i < 0)
|
||||
return policies::raise_domain_error<T>("boost::math::tangent_t2n<%1%>", "Index should be >= 0 but got %1%", T(i), pol);
|
||||
|
||||
T result;
|
||||
boost::math::detail::get_bernoulli_numbers_cache<T, Policy>().copy_tangent_numbers(&result, i, 1, pol);
|
||||
return result;
|
||||
}
|
||||
|
||||
template <class T>
|
||||
inline T tangent_t2n(const int i)
|
||||
{
|
||||
return boost::math::tangent_t2n<T>(i, policies::policy<>());
|
||||
}
|
||||
|
||||
template <class T, class OutputIterator, class Policy>
|
||||
inline OutputIterator tangent_t2n(const int start_index,
|
||||
const unsigned number_of_tangent_t2n,
|
||||
OutputIterator out_it,
|
||||
const Policy& pol)
|
||||
{
|
||||
if(start_index < 0)
|
||||
{
|
||||
*out_it = policies::raise_domain_error<T>("boost::math::tangent_t2n<%1%>", "Index should be >= 0 but got %1%", T(start_index), pol);
|
||||
return ++out_it;
|
||||
}
|
||||
|
||||
return boost::math::detail::get_bernoulli_numbers_cache<T, Policy>().copy_tangent_numbers(out_it, start_index, number_of_tangent_t2n, pol);
|
||||
}
|
||||
|
||||
template <class T, class OutputIterator>
|
||||
inline OutputIterator tangent_t2n(const int start_index,
|
||||
const unsigned number_of_tangent_t2n,
|
||||
OutputIterator out_it)
|
||||
{
|
||||
return boost::math::tangent_t2n<T, OutputIterator>(start_index, number_of_tangent_t2n, out_it, policies::policy<>());
|
||||
}
|
||||
|
||||
} } // namespace boost::math
|
||||
|
||||
#endif // _BOOST_BERNOULLI_B2N_2013_05_30_HPP_
|
||||
@@ -0,0 +1,165 @@
|
||||
|
||||
#if !defined(BOOST_PHOENIX_DONT_USE_PREPROCESSED_FILES)
|
||||
#ifndef BOOST_PHOENIX_STATEMENT_DETAIL_SWITCH_HPP
|
||||
#define BOOST_PHOENIX_STATEMENT_DETAIL_SWITCH_HPP
|
||||
|
||||
#include <boost/phoenix/support/iterate.hpp>
|
||||
|
||||
#include <boost/phoenix/statement/detail/preprocessed/switch.hpp>
|
||||
|
||||
#endif
|
||||
#else
|
||||
|
||||
#if !BOOST_PHOENIX_IS_ITERATING
|
||||
|
||||
#ifndef BOOST_PHOENIX_STATEMENT_DETAIL_SWITCH_HPP
|
||||
#define BOOST_PHOENIX_STATEMENT_DETAIL_SWITCH_HPP
|
||||
|
||||
#include <boost/phoenix/support/iterate.hpp>
|
||||
|
||||
#if defined(__WAVE__) && defined(BOOST_PHOENIX_CREATE_PREPROCESSED_FILES)
|
||||
#pragma wave option(preserve: 2, line: 0, output: "preprocessed/switch_" BOOST_PHOENIX_LIMIT_STR ".hpp")
|
||||
#endif
|
||||
|
||||
/*==============================================================================
|
||||
Copyright (c) 2005-2010 Joel de Guzman
|
||||
Copyright (c) 2010 Thomas Heller
|
||||
|
||||
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)
|
||||
==============================================================================*/
|
||||
|
||||
#if defined(__WAVE__) && defined(BOOST_PHOENIX_CREATE_PREPROCESSED_FILES)
|
||||
#pragma wave option(preserve: 1)
|
||||
#endif
|
||||
|
||||
#define BOOST_PHOENIX_SWITCH_EVAL_TYPEDEF_R(Z, N, DATA) \
|
||||
typedef \
|
||||
typename fusion::result_of::deref< \
|
||||
typename fusion::result_of::advance_c< \
|
||||
flat_view_begin \
|
||||
, N \
|
||||
>::type \
|
||||
>::type \
|
||||
BOOST_PP_CAT(case, N); \
|
||||
typedef \
|
||||
typename proto::detail::uncvref< \
|
||||
typename proto::result_of::value< \
|
||||
typename proto::result_of::child_c< \
|
||||
BOOST_PP_CAT(case, N) \
|
||||
, 0 \
|
||||
>::type \
|
||||
>::type \
|
||||
>::type \
|
||||
BOOST_PP_CAT(case_label, N); \
|
||||
/**/
|
||||
|
||||
#define BOOST_PHOENIX_SWITCH_EVAL_R(Z, N, DATA) \
|
||||
case BOOST_PP_CAT(case_label, N)::value : \
|
||||
boost::phoenix::eval( \
|
||||
proto::child_c<1>( \
|
||||
fusion::deref( \
|
||||
fusion::advance_c<N>(fusion::begin(flat_view)) \
|
||||
) \
|
||||
) \
|
||||
, ctx \
|
||||
); \
|
||||
break; \
|
||||
/**/
|
||||
|
||||
#define BOOST_PHOENIX_ITERATION_PARAMS \
|
||||
(3, (2, BOOST_PHOENIX_LIMIT, \
|
||||
<boost/phoenix/statement/detail/switch.hpp>))
|
||||
#include BOOST_PHOENIX_ITERATE()
|
||||
|
||||
#undef BOOST_PHOENIX_SWITCH_EVAL_R
|
||||
#undef BOOST_PHOENIX_SWITCH_EVAL_TYPEDEF
|
||||
|
||||
#if defined(__WAVE__) && defined(BOOST_PHOENIX_CREATE_PREPROCESSED_FILES)
|
||||
#pragma wave option(output: null)
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
#else
|
||||
template <typename Context, typename Cond, typename Cases>
|
||||
result_type
|
||||
evaluate(
|
||||
Context const & ctx
|
||||
, Cond const & cond
|
||||
, Cases const & cases
|
||||
, mpl::int_<BOOST_PHOENIX_ITERATION>
|
||||
, mpl::false_
|
||||
) const
|
||||
{
|
||||
typedef
|
||||
typename proto::result_of::flatten<Cases const&>::type
|
||||
flat_view_type;
|
||||
|
||||
typedef
|
||||
typename fusion::result_of::begin<flat_view_type>::type
|
||||
flat_view_begin;
|
||||
|
||||
flat_view_type flat_view(proto::flatten(cases));
|
||||
|
||||
BOOST_PP_REPEAT(
|
||||
BOOST_PHOENIX_ITERATION
|
||||
, BOOST_PHOENIX_SWITCH_EVAL_TYPEDEF_R
|
||||
, BOOST_PHOENIX_ITERATION
|
||||
)
|
||||
|
||||
switch(boost::phoenix::eval(cond, ctx))
|
||||
{
|
||||
BOOST_PP_REPEAT(BOOST_PHOENIX_ITERATION, BOOST_PHOENIX_SWITCH_EVAL_R, _)
|
||||
}
|
||||
}
|
||||
|
||||
template <typename Context, typename Cond, typename Cases>
|
||||
result_type
|
||||
evaluate(
|
||||
Context const & ctx
|
||||
, Cond const & cond
|
||||
, Cases const & cases
|
||||
, mpl::int_<BOOST_PHOENIX_ITERATION>
|
||||
, mpl::true_
|
||||
) const
|
||||
{
|
||||
typedef
|
||||
typename proto::result_of::flatten<Cases const&>::type
|
||||
flat_view_type;
|
||||
|
||||
typedef
|
||||
typename fusion::result_of::begin<flat_view_type>::type
|
||||
flat_view_begin;
|
||||
|
||||
flat_view_type flat_view(proto::flatten(cases));
|
||||
|
||||
BOOST_PP_REPEAT(
|
||||
BOOST_PP_DEC(BOOST_PHOENIX_ITERATION)
|
||||
, BOOST_PHOENIX_SWITCH_EVAL_TYPEDEF_R
|
||||
, BOOST_PHOENIX_ITERATION
|
||||
)
|
||||
|
||||
switch(boost::phoenix::eval(cond, ctx))
|
||||
{
|
||||
BOOST_PP_REPEAT(
|
||||
BOOST_PP_DEC(BOOST_PHOENIX_ITERATION)
|
||||
, BOOST_PHOENIX_SWITCH_EVAL_R, _
|
||||
)
|
||||
default:
|
||||
boost::phoenix::eval(
|
||||
proto::child_c<0>(
|
||||
fusion::deref(
|
||||
fusion::advance_c<
|
||||
BOOST_PP_DEC(BOOST_PHOENIX_ITERATION)
|
||||
>(fusion::begin(flat_view))
|
||||
)
|
||||
)
|
||||
, ctx
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
#endif // BOOST_PHOENIX_DONT_USE_PREPROCESSED_FILES
|
||||
@@ -0,0 +1,42 @@
|
||||
/* ALLOC.C - Routine to allocate memory and complain if it doesn't work. */
|
||||
|
||||
/* Copyright (c) 1995-2012 by Radford M. Neal.
|
||||
*
|
||||
* Permission is granted for anyone to copy, use, modify, and distribute
|
||||
* these programs and accompanying documents for any purpose, provided
|
||||
* this copyright notice is retained and prominently displayed, and note
|
||||
* is made of any changes made to these programs. These programs and
|
||||
* documents are distributed without any warranty, express or implied.
|
||||
* As the programs were written for research purposes only, they have not
|
||||
* been tested to the degree that would be advisable in any important
|
||||
* application. All use of these programs is entirely at the user's own
|
||||
* risk.
|
||||
*/
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#include "alloc.h"
|
||||
|
||||
|
||||
/* ALLOCATE SPACE AND CHECK FOR ERROR. Calls 'calloc' to allocate space,
|
||||
and then displays an error message and exits if the space couldn't be
|
||||
found. */
|
||||
|
||||
void *chk_alloc
|
||||
( unsigned n, /* Number of elements */
|
||||
unsigned size /* Size of each element */
|
||||
)
|
||||
{
|
||||
void *p;
|
||||
|
||||
p = calloc(n,size);
|
||||
|
||||
if (p==0)
|
||||
{ fprintf(stderr,"Ran out of memory (while trying to allocate %d bytes)\n",
|
||||
n*size);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
return p;
|
||||
}
|
||||
@@ -0,0 +1,166 @@
|
||||
#ifdef BOOST_MSVC
|
||||
#pragma warning(push)
|
||||
#pragma warning(disable: 4512) // assignment operator could not be generated
|
||||
#pragma warning(disable: 4510) // default constructor could not be generated
|
||||
#pragma warning(disable: 4610) // can never be instantiated - user defined constructor required
|
||||
#endif
|
||||
#if !defined(BOOST_PHOENIX_DONT_USE_PREPROCESSED_FILES)
|
||||
|
||||
#ifndef BOOST_PHOENIX_SUPPORT_VECTOR_HPP
|
||||
#define BOOST_PHOENIX_SUPPORT_VECTOR_HPP
|
||||
|
||||
#include <boost/phoenix/core/limits.hpp>
|
||||
#include <boost/phoenix/support/iterate.hpp>
|
||||
#include <boost/preprocessor/repetition/enum_shifted_params.hpp>
|
||||
#include <boost/fusion/adapted/struct/adapt_struct.hpp>
|
||||
|
||||
#define BOOST_FUSION_ADAPT_TPL_STRUCT_NO_PARTIAL BOOST_FUSION_ADAPT_TPL_STRUCT
|
||||
|
||||
#include <boost/phoenix/support/preprocessed/vector.hpp>
|
||||
|
||||
#endif
|
||||
|
||||
#else
|
||||
|
||||
#if !BOOST_PHOENIX_IS_ITERATING
|
||||
|
||||
#ifndef BOOST_PHOENIX_SUPPORT_VECTOR_HPP
|
||||
#define BOOST_PHOENIX_SUPPORT_VECTOR_HPP
|
||||
|
||||
#include <boost/phoenix/core/limits.hpp>
|
||||
#include <boost/phoenix/support/iterate.hpp>
|
||||
#include <boost/preprocessor/repetition/enum_shifted_params.hpp>
|
||||
#include <boost/fusion/adapted/struct/adapt_struct.hpp>
|
||||
|
||||
#define BOOST_FUSION_ADAPT_TPL_STRUCT_NO_PARTIAL BOOST_FUSION_ADAPT_TPL_STRUCT
|
||||
|
||||
#if defined(__WAVE__) && defined(BOOST_PHOENIX_CREATE_PREPROCESSED_FILES)
|
||||
#pragma wave option(preserve: 2, line: 0, output: "preprocessed/vector_" BOOST_PHOENIX_LIMIT_STR ".hpp")
|
||||
#endif
|
||||
/*==============================================================================
|
||||
Copyright (c) 2005-2010 Joel de Guzman
|
||||
Copyright (c) 2010 Thomas Heller
|
||||
|
||||
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)
|
||||
==============================================================================*/
|
||||
#if defined(__WAVE__) && defined(BOOST_PHOENIX_CREATE_PREPROCESSED_FILES)
|
||||
#pragma wave option(preserve: 1)
|
||||
#endif
|
||||
|
||||
#define M0(Z, N, D) \
|
||||
typedef BOOST_PP_CAT(A, N) BOOST_PP_CAT(member_type, N); \
|
||||
BOOST_PP_CAT(A, N) BOOST_PP_CAT(a, N); \
|
||||
/**/
|
||||
#define M1(Z, N, D) \
|
||||
(BOOST_PP_CAT(A, N)) \
|
||||
/**/
|
||||
#define M2(Z, N, D) \
|
||||
(BOOST_PP_CAT(T, N)) \
|
||||
/**/
|
||||
#define M3(Z, N, D) \
|
||||
(BOOST_PP_CAT(A, N), BOOST_PP_CAT(a, N)) \
|
||||
/**/
|
||||
|
||||
namespace boost { namespace phoenix
|
||||
{
|
||||
template <typename Dummy = void>
|
||||
struct vector0
|
||||
{
|
||||
typedef mpl::int_<0> size_type;
|
||||
static const int size_value = 0;
|
||||
};
|
||||
|
||||
template <int> struct vector_chooser;
|
||||
|
||||
template <>
|
||||
struct vector_chooser<0>
|
||||
{
|
||||
template <typename Dummy = void>
|
||||
struct apply
|
||||
{
|
||||
typedef vector0<> type;
|
||||
};
|
||||
};
|
||||
}}
|
||||
|
||||
|
||||
#define BOOST_PHOENIX_ITERATION_PARAMS \
|
||||
(3, (1, BOOST_PP_INC(BOOST_PHOENIX_LIMIT), \
|
||||
<boost/phoenix/support/vector.hpp>))
|
||||
#include BOOST_PHOENIX_ITERATE()
|
||||
|
||||
#undef M0
|
||||
#undef M1
|
||||
#undef M2
|
||||
#undef M3
|
||||
|
||||
#if defined(__WAVE__) && defined(BOOST_PHOENIX_CREATE_PREPROCESSED_FILES)
|
||||
#pragma wave option(output: null)
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
#else
|
||||
|
||||
namespace boost { namespace phoenix
|
||||
{
|
||||
template <BOOST_PHOENIX_typename_A>
|
||||
struct BOOST_PP_CAT(vector, BOOST_PHOENIX_ITERATION)
|
||||
{
|
||||
BOOST_PP_REPEAT(BOOST_PHOENIX_ITERATION, M0, _)
|
||||
|
||||
typedef mpl::int_<BOOST_PHOENIX_ITERATION> size_type;
|
||||
static const int size_value = BOOST_PHOENIX_ITERATION;
|
||||
|
||||
typedef
|
||||
BOOST_PP_CAT(vector, BOOST_PP_DEC(BOOST_PHOENIX_ITERATION))<BOOST_PP_ENUM_SHIFTED_PARAMS(BOOST_PHOENIX_ITERATION, A)>
|
||||
args_type;
|
||||
|
||||
args_type args() const
|
||||
{
|
||||
args_type r = {BOOST_PP_ENUM_SHIFTED_PARAMS(BOOST_PHOENIX_ITERATION, a)};
|
||||
return r;
|
||||
}
|
||||
};
|
||||
|
||||
template <>
|
||||
struct vector_chooser<BOOST_PHOENIX_ITERATION>
|
||||
{
|
||||
template <BOOST_PHOENIX_typename_A>
|
||||
struct apply
|
||||
{
|
||||
typedef BOOST_PP_CAT(vector, BOOST_PHOENIX_ITERATION)<BOOST_PHOENIX_A> type;
|
||||
};
|
||||
};
|
||||
}}
|
||||
|
||||
#define BOOST_PHOENIX_SUPPORT_VECTOR_ADAT_PARAM0 \
|
||||
BOOST_PP_REPEAT(BOOST_PHOENIX_ITERATION, M1, _) \
|
||||
/**/
|
||||
#define BOOST_PHOENIX_SUPPORT_VECTOR_ADAT_PARAM1 \
|
||||
( \
|
||||
BOOST_PP_CAT( \
|
||||
boost::phoenix::vector \
|
||||
, BOOST_PHOENIX_ITERATION \
|
||||
) \
|
||||
) \
|
||||
BOOST_PP_REPEAT(BOOST_PHOENIX_ITERATION, M1, _) \
|
||||
/**/
|
||||
#define BOOST_PHOENIX_SUPPORT_VECTOR_ADAT_PARAM2 \
|
||||
BOOST_PP_REPEAT(BOOST_PHOENIX_ITERATION, M3, _) \
|
||||
/**/
|
||||
|
||||
BOOST_FUSION_ADAPT_TPL_STRUCT_NO_PARTIAL(
|
||||
BOOST_PHOENIX_SUPPORT_VECTOR_ADAT_PARAM0
|
||||
, BOOST_PHOENIX_SUPPORT_VECTOR_ADAT_PARAM1
|
||||
, BOOST_PHOENIX_SUPPORT_VECTOR_ADAT_PARAM2
|
||||
)
|
||||
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
#ifdef BOOST_MSVC
|
||||
#pragma warning(pop)
|
||||
#endif
|
||||
@@ -0,0 +1,44 @@
|
||||
//---------------------------------------------------------------------------//
|
||||
// Copyright (c) 2013 Kyle Lutz <kyle.r.lutz@gmail.com>
|
||||
//
|
||||
// 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
|
||||
//
|
||||
// See http://boostorg.github.com/compute for more information.
|
||||
//---------------------------------------------------------------------------//
|
||||
|
||||
#ifndef BOOST_COMPUTE_ALGORITHM_LOWER_BOUND_HPP
|
||||
#define BOOST_COMPUTE_ALGORITHM_LOWER_BOUND_HPP
|
||||
|
||||
#include <boost/compute/lambda.hpp>
|
||||
#include <boost/compute/system.hpp>
|
||||
#include <boost/compute/command_queue.hpp>
|
||||
#include <boost/compute/algorithm/detail/binary_find.hpp>
|
||||
|
||||
namespace boost {
|
||||
namespace compute {
|
||||
|
||||
/// Returns an iterator pointing to the first element in the sorted
|
||||
/// range [\p first, \p last) that is not less than \p value.
|
||||
///
|
||||
/// \see upper_bound()
|
||||
template<class InputIterator, class T>
|
||||
inline InputIterator
|
||||
lower_bound(InputIterator first,
|
||||
InputIterator last,
|
||||
const T &value,
|
||||
command_queue &queue = system::default_queue())
|
||||
{
|
||||
using ::boost::compute::_1;
|
||||
|
||||
InputIterator position =
|
||||
detail::binary_find(first, last, _1 >= value, queue);
|
||||
|
||||
return position;
|
||||
}
|
||||
|
||||
} // end compute namespace
|
||||
} // end boost namespace
|
||||
|
||||
#endif // BOOST_COMPUTE_ALGORITHM_LOWER_BOUND_HPP
|
||||
@@ -0,0 +1,509 @@
|
||||
// (C) Copyright Jeremy Siek 2002.
|
||||
// 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_ITERATOR_ARCHETYPES_HPP
|
||||
#define BOOST_ITERATOR_ARCHETYPES_HPP
|
||||
|
||||
#include <boost/iterator/iterator_categories.hpp>
|
||||
#include <boost/operators.hpp>
|
||||
#include <boost/static_assert.hpp>
|
||||
#include <boost/iterator.hpp>
|
||||
|
||||
#include <boost/iterator/detail/facade_iterator_category.hpp>
|
||||
|
||||
#include <boost/type_traits/is_const.hpp>
|
||||
#include <boost/type_traits/add_const.hpp>
|
||||
#include <boost/type_traits/remove_const.hpp>
|
||||
#include <boost/type_traits/remove_cv.hpp>
|
||||
|
||||
#include <boost/concept_archetype.hpp>
|
||||
|
||||
#include <boost/mpl/bitand.hpp>
|
||||
#include <boost/mpl/int.hpp>
|
||||
#include <boost/mpl/equal_to.hpp>
|
||||
#include <boost/mpl/if.hpp>
|
||||
#include <boost/mpl/eval_if.hpp>
|
||||
#include <boost/mpl/and.hpp>
|
||||
#include <boost/mpl/identity.hpp>
|
||||
|
||||
#include <cstddef>
|
||||
|
||||
namespace boost {
|
||||
namespace iterators {
|
||||
|
||||
template <class Value, class AccessCategory>
|
||||
struct access_archetype;
|
||||
|
||||
template <class Derived, class Value, class AccessCategory, class TraversalCategory>
|
||||
struct traversal_archetype;
|
||||
|
||||
namespace archetypes
|
||||
{
|
||||
enum {
|
||||
readable_iterator_bit = 1
|
||||
, writable_iterator_bit = 2
|
||||
, swappable_iterator_bit = 4
|
||||
, lvalue_iterator_bit = 8
|
||||
};
|
||||
|
||||
// Not quite tags, since dispatching wouldn't work.
|
||||
typedef mpl::int_<readable_iterator_bit>::type readable_iterator_t;
|
||||
typedef mpl::int_<writable_iterator_bit>::type writable_iterator_t;
|
||||
|
||||
typedef mpl::int_<
|
||||
(readable_iterator_bit|writable_iterator_bit)
|
||||
>::type readable_writable_iterator_t;
|
||||
|
||||
typedef mpl::int_<
|
||||
(readable_iterator_bit|lvalue_iterator_bit)
|
||||
>::type readable_lvalue_iterator_t;
|
||||
|
||||
typedef mpl::int_<
|
||||
(lvalue_iterator_bit|writable_iterator_bit)
|
||||
>::type writable_lvalue_iterator_t;
|
||||
|
||||
typedef mpl::int_<swappable_iterator_bit>::type swappable_iterator_t;
|
||||
typedef mpl::int_<lvalue_iterator_bit>::type lvalue_iterator_t;
|
||||
|
||||
template <class Derived, class Base>
|
||||
struct has_access
|
||||
: mpl::equal_to<
|
||||
mpl::bitand_<Derived,Base>
|
||||
, Base
|
||||
>
|
||||
{};
|
||||
}
|
||||
|
||||
namespace detail
|
||||
{
|
||||
template <class T>
|
||||
struct assign_proxy
|
||||
{
|
||||
assign_proxy& operator=(T) { return *this; }
|
||||
};
|
||||
|
||||
template <class T>
|
||||
struct read_proxy
|
||||
{
|
||||
operator T() { return static_object<T>::get(); }
|
||||
};
|
||||
|
||||
template <class T>
|
||||
struct read_write_proxy
|
||||
: read_proxy<T> // Use to inherit from assign_proxy, but that doesn't work. -JGS
|
||||
{
|
||||
read_write_proxy& operator=(T) { return *this; }
|
||||
};
|
||||
|
||||
template <class T>
|
||||
struct arrow_proxy
|
||||
{
|
||||
T const* operator->() const { return 0; }
|
||||
};
|
||||
|
||||
struct no_operator_brackets {};
|
||||
|
||||
template <class ValueType>
|
||||
struct readable_operator_brackets
|
||||
{
|
||||
read_proxy<ValueType> operator[](std::ptrdiff_t n) const { return read_proxy<ValueType>(); }
|
||||
};
|
||||
|
||||
template <class ValueType>
|
||||
struct writable_operator_brackets
|
||||
{
|
||||
read_write_proxy<ValueType> operator[](std::ptrdiff_t n) const { return read_write_proxy<ValueType>(); }
|
||||
};
|
||||
|
||||
template <class Value, class AccessCategory, class TraversalCategory>
|
||||
struct operator_brackets
|
||||
: mpl::eval_if<
|
||||
is_convertible<TraversalCategory, random_access_traversal_tag>
|
||||
, mpl::eval_if<
|
||||
archetypes::has_access<
|
||||
AccessCategory
|
||||
, archetypes::writable_iterator_t
|
||||
>
|
||||
, mpl::identity<writable_operator_brackets<Value> >
|
||||
, mpl::if_<
|
||||
archetypes::has_access<
|
||||
AccessCategory
|
||||
, archetypes::readable_iterator_t
|
||||
>
|
||||
, readable_operator_brackets<Value>
|
||||
, no_operator_brackets
|
||||
>
|
||||
>
|
||||
, mpl::identity<no_operator_brackets>
|
||||
>::type
|
||||
{};
|
||||
|
||||
template <class TraversalCategory>
|
||||
struct traversal_archetype_impl
|
||||
{
|
||||
template <class Derived,class Value> struct archetype;
|
||||
};
|
||||
|
||||
// Constructor argument for those iterators that
|
||||
// are not default constructible
|
||||
struct ctor_arg {};
|
||||
|
||||
template <class Derived, class Value, class TraversalCategory>
|
||||
struct traversal_archetype_
|
||||
: traversal_archetype_impl<TraversalCategory>::template archetype<Derived,Value>
|
||||
{
|
||||
typedef typename
|
||||
traversal_archetype_impl<TraversalCategory>::template archetype<Derived,Value>
|
||||
base;
|
||||
|
||||
traversal_archetype_() {}
|
||||
|
||||
traversal_archetype_(ctor_arg arg)
|
||||
: base(arg)
|
||||
{}
|
||||
};
|
||||
|
||||
template <>
|
||||
struct traversal_archetype_impl<incrementable_traversal_tag>
|
||||
{
|
||||
template<class Derived, class Value>
|
||||
struct archetype
|
||||
{
|
||||
explicit archetype(ctor_arg) {}
|
||||
|
||||
struct bogus { }; // This use to be void, but that causes trouble for iterator_facade. Need more research. -JGS
|
||||
typedef bogus difference_type;
|
||||
|
||||
Derived& operator++() { return (Derived&)static_object<Derived>::get(); }
|
||||
Derived operator++(int) const { return (Derived&)static_object<Derived>::get(); }
|
||||
};
|
||||
};
|
||||
|
||||
template <>
|
||||
struct traversal_archetype_impl<single_pass_traversal_tag>
|
||||
{
|
||||
template<class Derived, class Value>
|
||||
struct archetype
|
||||
: public equality_comparable< traversal_archetype_<Derived, Value, single_pass_traversal_tag> >,
|
||||
public traversal_archetype_<Derived, Value, incrementable_traversal_tag>
|
||||
{
|
||||
explicit archetype(ctor_arg arg)
|
||||
: traversal_archetype_<Derived, Value, incrementable_traversal_tag>(arg)
|
||||
{}
|
||||
|
||||
typedef std::ptrdiff_t difference_type;
|
||||
};
|
||||
};
|
||||
|
||||
template <class Derived, class Value>
|
||||
bool operator==(traversal_archetype_<Derived, Value, single_pass_traversal_tag> const&,
|
||||
traversal_archetype_<Derived, Value, single_pass_traversal_tag> const&) { return true; }
|
||||
|
||||
template <>
|
||||
struct traversal_archetype_impl<forward_traversal_tag>
|
||||
{
|
||||
template<class Derived, class Value>
|
||||
struct archetype
|
||||
: public traversal_archetype_<Derived, Value, single_pass_traversal_tag>
|
||||
{
|
||||
archetype()
|
||||
: traversal_archetype_<Derived, Value, single_pass_traversal_tag>(ctor_arg())
|
||||
{}
|
||||
};
|
||||
};
|
||||
|
||||
template <>
|
||||
struct traversal_archetype_impl<bidirectional_traversal_tag>
|
||||
{
|
||||
template<class Derived, class Value>
|
||||
struct archetype
|
||||
: public traversal_archetype_<Derived, Value, forward_traversal_tag>
|
||||
{
|
||||
Derived& operator--() { return static_object<Derived>::get(); }
|
||||
Derived operator--(int) const { return static_object<Derived>::get(); }
|
||||
};
|
||||
};
|
||||
|
||||
template <>
|
||||
struct traversal_archetype_impl<random_access_traversal_tag>
|
||||
{
|
||||
template<class Derived, class Value>
|
||||
struct archetype
|
||||
: public traversal_archetype_<Derived, Value, bidirectional_traversal_tag>
|
||||
{
|
||||
Derived& operator+=(std::ptrdiff_t) { return static_object<Derived>::get(); }
|
||||
Derived& operator-=(std::ptrdiff_t) { return static_object<Derived>::get(); }
|
||||
};
|
||||
};
|
||||
|
||||
template <class Derived, class Value>
|
||||
Derived& operator+(traversal_archetype_<Derived, Value, random_access_traversal_tag> const&,
|
||||
std::ptrdiff_t) { return static_object<Derived>::get(); }
|
||||
|
||||
template <class Derived, class Value>
|
||||
Derived& operator+(std::ptrdiff_t,
|
||||
traversal_archetype_<Derived, Value, random_access_traversal_tag> const&)
|
||||
{ return static_object<Derived>::get(); }
|
||||
|
||||
template <class Derived, class Value>
|
||||
Derived& operator-(traversal_archetype_<Derived, Value, random_access_traversal_tag> const&,
|
||||
std::ptrdiff_t)
|
||||
{ return static_object<Derived>::get(); }
|
||||
|
||||
template <class Derived, class Value>
|
||||
std::ptrdiff_t operator-(traversal_archetype_<Derived, Value, random_access_traversal_tag> const&,
|
||||
traversal_archetype_<Derived, Value, random_access_traversal_tag> const&)
|
||||
{ return 0; }
|
||||
|
||||
template <class Derived, class Value>
|
||||
bool operator<(traversal_archetype_<Derived, Value, random_access_traversal_tag> const&,
|
||||
traversal_archetype_<Derived, Value, random_access_traversal_tag> const&)
|
||||
{ return true; }
|
||||
|
||||
template <class Derived, class Value>
|
||||
bool operator>(traversal_archetype_<Derived, Value, random_access_traversal_tag> const&,
|
||||
traversal_archetype_<Derived, Value, random_access_traversal_tag> const&)
|
||||
{ return true; }
|
||||
|
||||
template <class Derived, class Value>
|
||||
bool operator<=(traversal_archetype_<Derived, Value, random_access_traversal_tag> const&,
|
||||
traversal_archetype_<Derived, Value, random_access_traversal_tag> const&)
|
||||
{ return true; }
|
||||
|
||||
template <class Derived, class Value>
|
||||
bool operator>=(traversal_archetype_<Derived, Value, random_access_traversal_tag> const&,
|
||||
traversal_archetype_<Derived, Value, random_access_traversal_tag> const&)
|
||||
{ return true; }
|
||||
|
||||
struct bogus_type;
|
||||
|
||||
template <class Value>
|
||||
struct convertible_type
|
||||
: mpl::if_< is_const<Value>,
|
||||
typename remove_const<Value>::type,
|
||||
bogus_type >
|
||||
{};
|
||||
|
||||
} // namespace detail
|
||||
|
||||
|
||||
template <class> struct undefined;
|
||||
|
||||
template <class AccessCategory>
|
||||
struct iterator_access_archetype_impl
|
||||
{
|
||||
template <class Value> struct archetype;
|
||||
};
|
||||
|
||||
template <class Value, class AccessCategory>
|
||||
struct iterator_access_archetype
|
||||
: iterator_access_archetype_impl<
|
||||
AccessCategory
|
||||
>::template archetype<Value>
|
||||
{
|
||||
};
|
||||
|
||||
template <>
|
||||
struct iterator_access_archetype_impl<
|
||||
archetypes::readable_iterator_t
|
||||
>
|
||||
{
|
||||
template <class Value>
|
||||
struct archetype
|
||||
{
|
||||
typedef typename remove_cv<Value>::type value_type;
|
||||
typedef Value reference;
|
||||
typedef Value* pointer;
|
||||
|
||||
value_type operator*() const { return static_object<value_type>::get(); }
|
||||
|
||||
detail::arrow_proxy<Value> operator->() const { return detail::arrow_proxy<Value>(); }
|
||||
};
|
||||
};
|
||||
|
||||
template <>
|
||||
struct iterator_access_archetype_impl<
|
||||
archetypes::writable_iterator_t
|
||||
>
|
||||
{
|
||||
template <class Value>
|
||||
struct archetype
|
||||
{
|
||||
BOOST_STATIC_ASSERT(!is_const<Value>::value);
|
||||
typedef void value_type;
|
||||
typedef void reference;
|
||||
typedef void pointer;
|
||||
|
||||
detail::assign_proxy<Value> operator*() const { return detail::assign_proxy<Value>(); }
|
||||
};
|
||||
};
|
||||
|
||||
template <>
|
||||
struct iterator_access_archetype_impl<
|
||||
archetypes::readable_writable_iterator_t
|
||||
>
|
||||
{
|
||||
template <class Value>
|
||||
struct archetype
|
||||
: public virtual iterator_access_archetype<
|
||||
Value, archetypes::readable_iterator_t
|
||||
>
|
||||
{
|
||||
typedef detail::read_write_proxy<Value> reference;
|
||||
|
||||
detail::read_write_proxy<Value> operator*() const { return detail::read_write_proxy<Value>(); }
|
||||
};
|
||||
};
|
||||
|
||||
template <>
|
||||
struct iterator_access_archetype_impl<archetypes::readable_lvalue_iterator_t>
|
||||
{
|
||||
template <class Value>
|
||||
struct archetype
|
||||
: public virtual iterator_access_archetype<
|
||||
Value, archetypes::readable_iterator_t
|
||||
>
|
||||
{
|
||||
typedef Value& reference;
|
||||
|
||||
Value& operator*() const { return static_object<Value>::get(); }
|
||||
Value* operator->() const { return 0; }
|
||||
};
|
||||
};
|
||||
|
||||
template <>
|
||||
struct iterator_access_archetype_impl<archetypes::writable_lvalue_iterator_t>
|
||||
{
|
||||
template <class Value>
|
||||
struct archetype
|
||||
: public virtual iterator_access_archetype<
|
||||
Value, archetypes::readable_lvalue_iterator_t
|
||||
>
|
||||
{
|
||||
BOOST_STATIC_ASSERT((!is_const<Value>::value));
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
template <class Value, class AccessCategory, class TraversalCategory>
|
||||
struct iterator_archetype;
|
||||
|
||||
template <class Value, class AccessCategory, class TraversalCategory>
|
||||
struct traversal_archetype_base
|
||||
: detail::operator_brackets<
|
||||
typename remove_cv<Value>::type
|
||||
, AccessCategory
|
||||
, TraversalCategory
|
||||
>
|
||||
, detail::traversal_archetype_<
|
||||
iterator_archetype<Value, AccessCategory, TraversalCategory>
|
||||
, Value
|
||||
, TraversalCategory
|
||||
>
|
||||
{
|
||||
};
|
||||
|
||||
namespace detail
|
||||
{
|
||||
template <class Value, class AccessCategory, class TraversalCategory>
|
||||
struct iterator_archetype_base
|
||||
: iterator_access_archetype<Value, AccessCategory>
|
||||
, traversal_archetype_base<Value, AccessCategory, TraversalCategory>
|
||||
{
|
||||
typedef iterator_access_archetype<Value, AccessCategory> access;
|
||||
|
||||
typedef typename detail::facade_iterator_category<
|
||||
TraversalCategory
|
||||
, typename mpl::eval_if<
|
||||
archetypes::has_access<
|
||||
AccessCategory, archetypes::writable_iterator_t
|
||||
>
|
||||
, remove_const<Value>
|
||||
, add_const<Value>
|
||||
>::type
|
||||
, typename access::reference
|
||||
>::type iterator_category;
|
||||
|
||||
// Needed for some broken libraries (see below)
|
||||
typedef boost::iterator<
|
||||
iterator_category
|
||||
, Value
|
||||
, typename traversal_archetype_base<
|
||||
Value, AccessCategory, TraversalCategory
|
||||
>::difference_type
|
||||
, typename access::pointer
|
||||
, typename access::reference
|
||||
> workaround_iterator_base;
|
||||
};
|
||||
}
|
||||
|
||||
template <class Value, class AccessCategory, class TraversalCategory>
|
||||
struct iterator_archetype
|
||||
: public detail::iterator_archetype_base<Value, AccessCategory, TraversalCategory>
|
||||
|
||||
// These broken libraries require derivation from std::iterator
|
||||
// (or related magic) in order to handle iter_swap and other
|
||||
// iterator operations
|
||||
# if BOOST_WORKAROUND(BOOST_DINKUMWARE_STDLIB, < 310) \
|
||||
|| BOOST_WORKAROUND(_RWSTD_VER, BOOST_TESTED_AT(0x20101))
|
||||
, public detail::iterator_archetype_base<
|
||||
Value, AccessCategory, TraversalCategory
|
||||
>::workaround_iterator_base
|
||||
# endif
|
||||
{
|
||||
// Derivation from std::iterator above caused references to nested
|
||||
// types to be ambiguous, so now we have to redeclare them all
|
||||
// here.
|
||||
# if BOOST_WORKAROUND(BOOST_DINKUMWARE_STDLIB, < 310) \
|
||||
|| BOOST_WORKAROUND(_RWSTD_VER, BOOST_TESTED_AT(0x20101))
|
||||
|
||||
typedef detail::iterator_archetype_base<
|
||||
Value,AccessCategory,TraversalCategory
|
||||
> base;
|
||||
|
||||
typedef typename base::value_type value_type;
|
||||
typedef typename base::reference reference;
|
||||
typedef typename base::pointer pointer;
|
||||
typedef typename base::difference_type difference_type;
|
||||
typedef typename base::iterator_category iterator_category;
|
||||
# endif
|
||||
|
||||
iterator_archetype() { }
|
||||
iterator_archetype(iterator_archetype const& x)
|
||||
: detail::iterator_archetype_base<
|
||||
Value
|
||||
, AccessCategory
|
||||
, TraversalCategory
|
||||
>(x)
|
||||
{}
|
||||
|
||||
iterator_archetype& operator=(iterator_archetype const&)
|
||||
{ return *this; }
|
||||
|
||||
# if 0
|
||||
// Optional conversion from mutable
|
||||
iterator_archetype(
|
||||
iterator_archetype<
|
||||
typename detail::convertible_type<Value>::type
|
||||
, AccessCategory
|
||||
, TraversalCategory> const&
|
||||
);
|
||||
# endif
|
||||
};
|
||||
|
||||
} // namespace iterators
|
||||
|
||||
// Backward compatibility names
|
||||
namespace iterator_archetypes = iterators::archetypes;
|
||||
using iterators::access_archetype;
|
||||
using iterators::traversal_archetype;
|
||||
using iterators::iterator_archetype;
|
||||
using iterators::undefined;
|
||||
using iterators::iterator_access_archetype_impl;
|
||||
using iterators::traversal_archetype_base;
|
||||
|
||||
} // namespace boost
|
||||
|
||||
#endif // BOOST_ITERATOR_ARCHETYPES_HPP
|
||||
@@ -0,0 +1,56 @@
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
/// \file null.hpp
|
||||
/// Definintion of null_context\<\>, an evaluation context for
|
||||
/// proto::eval() that simply evaluates each child expression, doesn't
|
||||
/// combine the results at all, and returns void.
|
||||
//
|
||||
// Copyright 2008 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_PROTO_CONTEXT_NULL_HPP_EAN_06_24_2007
|
||||
#define BOOST_PROTO_CONTEXT_NULL_HPP_EAN_06_24_2007
|
||||
|
||||
#include <boost/preprocessor/iteration/iterate.hpp>
|
||||
#include <boost/preprocessor/repetition/repeat.hpp>
|
||||
#include <boost/proto/proto_fwd.hpp>
|
||||
#include <boost/proto/eval.hpp>
|
||||
#include <boost/proto/traits.hpp>
|
||||
|
||||
namespace boost { namespace proto { namespace context
|
||||
{
|
||||
|
||||
template<
|
||||
typename Expr
|
||||
, typename Context
|
||||
, long Arity // = Expr::proto_arity_c
|
||||
>
|
||||
struct null_eval
|
||||
{};
|
||||
|
||||
template<typename Expr, typename Context>
|
||||
struct null_eval<Expr, Context, 0>
|
||||
{
|
||||
typedef void result_type;
|
||||
void operator()(Expr &, Context &) const
|
||||
{}
|
||||
};
|
||||
|
||||
// Additional specializations generated by the preprocessor
|
||||
#include <boost/proto/context/detail/null_eval.hpp>
|
||||
|
||||
/// null_context
|
||||
///
|
||||
struct null_context
|
||||
{
|
||||
/// null_context::eval
|
||||
///
|
||||
template<typename Expr, typename ThisContext = null_context const>
|
||||
struct eval
|
||||
: null_eval<Expr, ThisContext>
|
||||
{};
|
||||
};
|
||||
|
||||
}}}
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,71 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2001-2011 Joel de Guzman
|
||||
Copyright (c) 2006 Dan Marsden
|
||||
|
||||
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)
|
||||
==============================================================================*/
|
||||
#if !defined(FUSION_VALUE_OF_IMPL_20060124_2147)
|
||||
#define FUSION_VALUE_OF_IMPL_20060124_2147
|
||||
|
||||
#include <boost/fusion/support/config.hpp>
|
||||
#include <boost/fusion/container/vector/convert.hpp>
|
||||
#include <boost/fusion/algorithm/transformation/transform.hpp>
|
||||
#include <boost/fusion/iterator/value_of.hpp>
|
||||
#include <boost/mpl/placeholders.hpp>
|
||||
#include <boost/fusion/support/unused.hpp>
|
||||
#include <boost/mpl/eval_if.hpp>
|
||||
#include <boost/mpl/identity.hpp>
|
||||
#include <boost/type_traits/is_same.hpp>
|
||||
#include <boost/config.hpp>
|
||||
|
||||
namespace boost { namespace fusion
|
||||
{
|
||||
struct zip_view_iterator_tag;
|
||||
|
||||
namespace detail
|
||||
{
|
||||
struct poly_value_of
|
||||
{
|
||||
template<typename T>
|
||||
struct result;
|
||||
|
||||
template<typename It>
|
||||
struct result<poly_value_of(It)>
|
||||
: mpl::eval_if<is_same<It, unused_type>,
|
||||
mpl::identity<unused_type>,
|
||||
result_of::value_of<It> >
|
||||
{};
|
||||
|
||||
// never called, but needed for decltype-based result_of (C++0x)
|
||||
#ifndef BOOST_NO_CXX11_RVALUE_REFERENCES
|
||||
template<typename It>
|
||||
BOOST_FUSION_GPU_ENABLED
|
||||
typename result<poly_value_of(It)>::type
|
||||
operator()(It&&) const;
|
||||
#endif
|
||||
};
|
||||
}
|
||||
|
||||
namespace extension
|
||||
{
|
||||
template<typename Tag>
|
||||
struct value_of_impl;
|
||||
|
||||
template<>
|
||||
struct value_of_impl<zip_view_iterator_tag>
|
||||
{
|
||||
template<typename Iterator>
|
||||
struct apply
|
||||
{
|
||||
typedef typename result_of::transform<
|
||||
typename Iterator::iterators,
|
||||
detail::poly_value_of>::type values;
|
||||
|
||||
typedef typename result_of::as_vector<values>::type type;
|
||||
};
|
||||
};
|
||||
}
|
||||
}}
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,86 @@
|
||||
// Copyright (C) 2005 Douglas Gregor.
|
||||
|
||||
// Use, modification and distribution is 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)
|
||||
|
||||
// Compute parents, children, levels, etc. to effect a parallel
|
||||
// computation tree.
|
||||
#ifndef BOOST_MPI_COMPUTATION_TREE_HPP
|
||||
#define BOOST_MPI_COMPUTATION_TREE_HPP
|
||||
|
||||
namespace boost { namespace mpi { namespace detail {
|
||||
|
||||
/**
|
||||
* @brief Aids tree-based parallel collective algorithms.
|
||||
*
|
||||
* Objects of this type
|
||||
*/
|
||||
class computation_tree
|
||||
{
|
||||
public:
|
||||
computation_tree(int rank, int size, int root, int branching_factor = -1);
|
||||
|
||||
/// Returns the branching factor of the tree.
|
||||
int branching_factor() const { return branching_factor_; }
|
||||
|
||||
/// Returns the level in the tree on which this process resides.
|
||||
int level() const { return level_; }
|
||||
|
||||
/**
|
||||
* Returns the index corresponding to the n^th level of the tree.
|
||||
*
|
||||
* @param n The level in the tree whose index will be returned.
|
||||
*/
|
||||
int level_index(int n) const;
|
||||
|
||||
/**
|
||||
* @brief Returns the parent of this process.
|
||||
*
|
||||
* @returns If this process is the root, returns itself. Otherwise,
|
||||
* returns the process number that is the parent in the computation
|
||||
* tree.
|
||||
*/
|
||||
int parent() const;
|
||||
|
||||
/// Returns the index for the first child of this process.
|
||||
int child_begin() const;
|
||||
|
||||
/**
|
||||
* @brief The default branching factor within the computation tree.
|
||||
*
|
||||
* This is the default branching factor for the computation tree, to
|
||||
* be used by any computation tree that does not fix the branching
|
||||
* factor itself. The default is initialized to 3, but may be
|
||||
* changed by the application so long as all processes have the same
|
||||
* branching factor.
|
||||
*/
|
||||
static int default_branching_factor;
|
||||
|
||||
protected:
|
||||
/// The rank of this process in the computation tree.
|
||||
int rank;
|
||||
|
||||
/// The number of processes participating in the computation tree.
|
||||
int size;
|
||||
|
||||
/// The process number that is acting as the root in the computation
|
||||
/// tree.
|
||||
int root;
|
||||
|
||||
/**
|
||||
* @brief The branching factor within the computation tree.
|
||||
*
|
||||
* This is the default number of children that each node in a
|
||||
* computation tree will have. This value will be used for
|
||||
* collective operations that use tree-based algorithms.
|
||||
*/
|
||||
int branching_factor_;
|
||||
|
||||
/// The level in the tree at which this process resides.
|
||||
int level_;
|
||||
};
|
||||
|
||||
} } } // end namespace boost::mpi::detail
|
||||
|
||||
#endif // BOOST_MPI_COMPUTATION_TREE_HPP
|
||||
@@ -0,0 +1,25 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2011 Hartmut Kaiser
|
||||
|
||||
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)
|
||||
==============================================================================*/
|
||||
|
||||
#if !defined(BOOST_PHOENIX_PREPROCESSED_SCOPE_LAMBDA_HPP)
|
||||
#define BOOST_PHOENIX_PREPROCESSED_SCOPE_LAMBDA_HPP
|
||||
|
||||
#if BOOST_PHOENIX_LIMIT <= 10
|
||||
#include <boost/phoenix/scope/detail/cpp03/preprocessed/lambda_10.hpp>
|
||||
#elif BOOST_PHOENIX_LIMIT <= 20
|
||||
#include <boost/phoenix/scope/detail/cpp03/preprocessed/lambda_20.hpp>
|
||||
#elif BOOST_PHOENIX_LIMIT <= 30
|
||||
#include <boost/phoenix/scope/detail/cpp03/preprocessed/lambda_30.hpp>
|
||||
#elif BOOST_PHOENIX_LIMIT <= 40
|
||||
#include <boost/phoenix/scope/detail/cpp03/preprocessed/lambda_40.hpp>
|
||||
#elif BOOST_PHOENIX_LIMIT <= 50
|
||||
#include <boost/phoenix/scope/detail/cpp03/preprocessed/lambda_50.hpp>
|
||||
#else
|
||||
#error "BOOST_PHOENIX_LIMIT out of bounds for preprocessed headers"
|
||||
#endif
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,356 @@
|
||||
//=======================================================================
|
||||
// Copyright 1997, 1998, 1999, 2000 University of Notre Dame.
|
||||
// Authors: Andrew Lumsdaine, Lie-Quan Lee, Jeremy G. Siek
|
||||
//
|
||||
// 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_GRAPH_PROPERTIES_HPP
|
||||
#define BOOST_GRAPH_PROPERTIES_HPP
|
||||
|
||||
#include <boost/config.hpp>
|
||||
#include <boost/assert.hpp>
|
||||
#include <boost/pending/property.hpp>
|
||||
#include <boost/detail/workaround.hpp>
|
||||
|
||||
// Include the property map library and extensions in the BGL.
|
||||
#include <boost/property_map/property_map.hpp>
|
||||
#include <boost/graph/property_maps/constant_property_map.hpp>
|
||||
#include <boost/graph/property_maps/null_property_map.hpp>
|
||||
|
||||
#include <boost/graph/graph_traits.hpp>
|
||||
#include <boost/type_traits.hpp>
|
||||
#include <boost/limits.hpp>
|
||||
#include <boost/mpl/and.hpp>
|
||||
#include <boost/mpl/not.hpp>
|
||||
#include <boost/mpl/if.hpp>
|
||||
|
||||
namespace boost {
|
||||
|
||||
enum default_color_type { white_color, gray_color, green_color, red_color, black_color };
|
||||
|
||||
template <class ColorValue>
|
||||
struct color_traits {
|
||||
static default_color_type white() { return white_color; }
|
||||
static default_color_type gray() { return gray_color; }
|
||||
static default_color_type green() { return green_color; }
|
||||
static default_color_type red() { return red_color; }
|
||||
static default_color_type black() { return black_color; }
|
||||
};
|
||||
|
||||
// These functions are now obsolete, replaced by color_traits.
|
||||
inline default_color_type white(default_color_type) { return white_color; }
|
||||
inline default_color_type gray(default_color_type) { return gray_color; }
|
||||
inline default_color_type green(default_color_type) { return green_color; }
|
||||
inline default_color_type red(default_color_type) { return red_color; }
|
||||
inline default_color_type black(default_color_type) { return black_color; }
|
||||
|
||||
|
||||
struct graph_property_tag { };
|
||||
struct vertex_property_tag { };
|
||||
struct edge_property_tag { };
|
||||
|
||||
// See examples/edge_property.cpp for how to use this.
|
||||
#define BOOST_INSTALL_PROPERTY(KIND, NAME) \
|
||||
template <> struct property_kind<KIND##_##NAME##_t> { \
|
||||
typedef KIND##_property_tag type; \
|
||||
}
|
||||
|
||||
#define BOOST_DEF_PROPERTY(KIND, NAME) \
|
||||
enum KIND##_##NAME##_t { KIND##_##NAME }; \
|
||||
BOOST_INSTALL_PROPERTY(KIND, NAME)
|
||||
|
||||
// These three are defined in boost/pending/property.hpp
|
||||
BOOST_INSTALL_PROPERTY(vertex, all);
|
||||
BOOST_INSTALL_PROPERTY(edge, all);
|
||||
BOOST_INSTALL_PROPERTY(graph, all);
|
||||
BOOST_DEF_PROPERTY(vertex, index);
|
||||
BOOST_DEF_PROPERTY(vertex, index1);
|
||||
BOOST_DEF_PROPERTY(vertex, index2);
|
||||
BOOST_DEF_PROPERTY(vertex, root);
|
||||
BOOST_DEF_PROPERTY(edge, index);
|
||||
BOOST_DEF_PROPERTY(edge, name);
|
||||
BOOST_DEF_PROPERTY(edge, weight);
|
||||
BOOST_DEF_PROPERTY(edge, weight2);
|
||||
BOOST_DEF_PROPERTY(edge, color);
|
||||
BOOST_DEF_PROPERTY(vertex, name);
|
||||
BOOST_DEF_PROPERTY(graph, name);
|
||||
BOOST_DEF_PROPERTY(vertex, distance);
|
||||
BOOST_DEF_PROPERTY(vertex, distance2);
|
||||
BOOST_DEF_PROPERTY(vertex, color);
|
||||
BOOST_DEF_PROPERTY(vertex, degree);
|
||||
BOOST_DEF_PROPERTY(vertex, in_degree);
|
||||
BOOST_DEF_PROPERTY(vertex, out_degree);
|
||||
BOOST_DEF_PROPERTY(vertex, current_degree);
|
||||
BOOST_DEF_PROPERTY(vertex, priority);
|
||||
BOOST_DEF_PROPERTY(vertex, discover_time);
|
||||
BOOST_DEF_PROPERTY(vertex, finish_time);
|
||||
BOOST_DEF_PROPERTY(vertex, predecessor);
|
||||
BOOST_DEF_PROPERTY(vertex, rank);
|
||||
BOOST_DEF_PROPERTY(vertex, centrality);
|
||||
BOOST_DEF_PROPERTY(vertex, lowpoint);
|
||||
BOOST_DEF_PROPERTY(vertex, potential);
|
||||
BOOST_DEF_PROPERTY(vertex, update);
|
||||
BOOST_DEF_PROPERTY(vertex, underlying);
|
||||
BOOST_DEF_PROPERTY(edge, reverse);
|
||||
BOOST_DEF_PROPERTY(edge, capacity);
|
||||
BOOST_DEF_PROPERTY(edge, flow);
|
||||
BOOST_DEF_PROPERTY(edge, residual_capacity);
|
||||
BOOST_DEF_PROPERTY(edge, centrality);
|
||||
BOOST_DEF_PROPERTY(edge, discover_time);
|
||||
BOOST_DEF_PROPERTY(edge, update);
|
||||
BOOST_DEF_PROPERTY(edge, finished);
|
||||
BOOST_DEF_PROPERTY(edge, underlying);
|
||||
BOOST_DEF_PROPERTY(graph, visitor);
|
||||
|
||||
// These tags are used for property bundles
|
||||
// These three are defined in boost/pending/property.hpp
|
||||
BOOST_INSTALL_PROPERTY(graph, bundle);
|
||||
BOOST_INSTALL_PROPERTY(vertex, bundle);
|
||||
BOOST_INSTALL_PROPERTY(edge, bundle);
|
||||
|
||||
// These tags are used to denote the owners and local descriptors
|
||||
// for the vertices and edges of a distributed graph.
|
||||
BOOST_DEF_PROPERTY(vertex, global);
|
||||
BOOST_DEF_PROPERTY(vertex, owner);
|
||||
BOOST_DEF_PROPERTY(vertex, local);
|
||||
BOOST_DEF_PROPERTY(edge, global);
|
||||
BOOST_DEF_PROPERTY(edge, owner);
|
||||
BOOST_DEF_PROPERTY(edge, local);
|
||||
BOOST_DEF_PROPERTY(vertex, local_index);
|
||||
BOOST_DEF_PROPERTY(edge, local_index);
|
||||
|
||||
#undef BOOST_DEF_PROPERTY
|
||||
|
||||
namespace detail {
|
||||
|
||||
template <typename G, typename Tag>
|
||||
struct property_kind_from_graph: property_kind<Tag> {};
|
||||
|
||||
#ifndef BOOST_GRAPH_NO_BUNDLED_PROPERTIES
|
||||
template <typename G, typename R, typename T>
|
||||
struct property_kind_from_graph<G, R T::*> {
|
||||
typedef typename boost::mpl::if_<
|
||||
boost::is_base_of<T, typename vertex_bundle_type<G>::type>,
|
||||
vertex_property_tag,
|
||||
typename boost::mpl::if_<
|
||||
boost::is_base_of<T, typename edge_bundle_type<G>::type>,
|
||||
edge_property_tag,
|
||||
typename boost::mpl::if_<
|
||||
boost::is_base_of<T, typename graph_bundle_type<G>::type>,
|
||||
graph_property_tag,
|
||||
void>::type>::type>::type type;
|
||||
};
|
||||
#endif
|
||||
|
||||
struct dummy_edge_property_selector {
|
||||
template <class Graph, class Property, class Tag>
|
||||
struct bind_ {
|
||||
typedef identity_property_map type;
|
||||
typedef identity_property_map const_type;
|
||||
};
|
||||
};
|
||||
struct dummy_vertex_property_selector {
|
||||
template <class Graph, class Property, class Tag>
|
||||
struct bind_ {
|
||||
typedef identity_property_map type;
|
||||
typedef identity_property_map const_type;
|
||||
};
|
||||
};
|
||||
|
||||
} // namespace detail
|
||||
|
||||
// Graph classes can either partially specialize property_map
|
||||
// or they can specialize these two selector classes.
|
||||
template <class GraphTag>
|
||||
struct edge_property_selector {
|
||||
typedef detail::dummy_edge_property_selector type;
|
||||
};
|
||||
|
||||
template <class GraphTag>
|
||||
struct vertex_property_selector {
|
||||
typedef detail::dummy_vertex_property_selector type;
|
||||
};
|
||||
|
||||
namespace detail {
|
||||
|
||||
template <typename A> struct return_void {typedef void type;};
|
||||
|
||||
template <typename Graph, typename Enable = void>
|
||||
struct graph_tag_or_void {
|
||||
typedef void type;
|
||||
};
|
||||
|
||||
template <typename Graph>
|
||||
struct graph_tag_or_void<Graph, typename return_void<typename Graph::graph_tag>::type> {
|
||||
typedef typename Graph::graph_tag type;
|
||||
};
|
||||
|
||||
template <class Graph, class PropertyTag>
|
||||
struct edge_property_map
|
||||
: edge_property_selector<
|
||||
typename graph_tag_or_void<Graph>::type
|
||||
>::type::template bind_<
|
||||
Graph,
|
||||
typename edge_property_type<Graph>::type,
|
||||
PropertyTag>
|
||||
{};
|
||||
template <class Graph, class PropertyTag>
|
||||
struct vertex_property_map
|
||||
: vertex_property_selector<
|
||||
typename graph_tag_or_void<Graph>::type
|
||||
>::type::template bind_<
|
||||
Graph,
|
||||
typename vertex_property_type<Graph>::type,
|
||||
PropertyTag>
|
||||
{};
|
||||
} // namespace detail
|
||||
|
||||
template <class Graph, class Property, class Enable = void>
|
||||
struct property_map:
|
||||
mpl::if_<
|
||||
is_same<typename detail::property_kind_from_graph<Graph, Property>::type, edge_property_tag>,
|
||||
detail::edge_property_map<Graph, Property>,
|
||||
detail::vertex_property_map<Graph, Property> >::type
|
||||
{};
|
||||
|
||||
// shortcut for accessing the value type of the property map
|
||||
template <class Graph, class Property>
|
||||
class property_map_value {
|
||||
typedef typename property_map<Graph, Property>::const_type PMap;
|
||||
public:
|
||||
typedef typename property_traits<PMap>::value_type type;
|
||||
};
|
||||
|
||||
template <class Graph, class Property>
|
||||
class graph_property {
|
||||
public:
|
||||
typedef typename property_value<
|
||||
typename boost::graph_property_type<Graph>::type, Property
|
||||
>::type type;
|
||||
};
|
||||
|
||||
template <typename Graph> struct vertex_property: vertex_property_type<Graph> {};
|
||||
template <typename Graph> struct edge_property: edge_property_type<Graph> {};
|
||||
|
||||
template <typename Graph>
|
||||
class degree_property_map
|
||||
: public put_get_helper<typename graph_traits<Graph>::degree_size_type,
|
||||
degree_property_map<Graph> >
|
||||
{
|
||||
public:
|
||||
typedef typename graph_traits<Graph>::vertex_descriptor key_type;
|
||||
typedef typename graph_traits<Graph>::degree_size_type value_type;
|
||||
typedef value_type reference;
|
||||
typedef readable_property_map_tag category;
|
||||
degree_property_map(const Graph& g) : m_g(g) { }
|
||||
value_type operator[](const key_type& v) const {
|
||||
return degree(v, m_g);
|
||||
}
|
||||
private:
|
||||
const Graph& m_g;
|
||||
};
|
||||
template <typename Graph>
|
||||
inline degree_property_map<Graph>
|
||||
make_degree_map(const Graph& g) {
|
||||
return degree_property_map<Graph>(g);
|
||||
}
|
||||
|
||||
//========================================================================
|
||||
// Iterator Property Map Generating Functions contributed by
|
||||
// Kevin Vanhorn. (see also the property map generating functions
|
||||
// in boost/property_map/property_map.hpp)
|
||||
|
||||
#if !defined(BOOST_NO_STD_ITERATOR_TRAITS)
|
||||
// A helper function for creating a vertex property map out of a
|
||||
// random access iterator and the internal vertex index map from a
|
||||
// graph.
|
||||
template <class PropertyGraph, class RandomAccessIterator>
|
||||
inline
|
||||
iterator_property_map<
|
||||
RandomAccessIterator,
|
||||
typename property_map<PropertyGraph, vertex_index_t>::type,
|
||||
typename std::iterator_traits<RandomAccessIterator>::value_type,
|
||||
typename std::iterator_traits<RandomAccessIterator>::reference
|
||||
>
|
||||
make_iterator_vertex_map(RandomAccessIterator iter, const PropertyGraph& g)
|
||||
{
|
||||
return make_iterator_property_map(iter, get(vertex_index, g));
|
||||
}
|
||||
|
||||
// Use this next function when vertex_descriptor is known to be an
|
||||
// integer type, with values ranging from 0 to num_vertices(g).
|
||||
//
|
||||
template <class RandomAccessIterator>
|
||||
inline
|
||||
iterator_property_map<
|
||||
RandomAccessIterator,
|
||||
identity_property_map,
|
||||
typename std::iterator_traits<RandomAccessIterator>::value_type,
|
||||
typename std::iterator_traits<RandomAccessIterator>::reference
|
||||
>
|
||||
make_iterator_vertex_map(RandomAccessIterator iter)
|
||||
{
|
||||
return make_iterator_property_map(iter, identity_property_map());
|
||||
}
|
||||
#endif
|
||||
|
||||
template <class PropertyGraph, class RandomAccessContainer>
|
||||
inline
|
||||
iterator_property_map<
|
||||
typename RandomAccessContainer::iterator,
|
||||
typename property_map<PropertyGraph, vertex_index_t>::type,
|
||||
typename RandomAccessContainer::value_type,
|
||||
typename RandomAccessContainer::reference
|
||||
>
|
||||
make_container_vertex_map(RandomAccessContainer& c, const PropertyGraph& g)
|
||||
{
|
||||
BOOST_ASSERT(c.size() >= num_vertices(g));
|
||||
return make_iterator_vertex_map(c.begin(), g);
|
||||
}
|
||||
|
||||
template <class RandomAccessContainer> inline
|
||||
iterator_property_map<
|
||||
typename RandomAccessContainer::iterator,
|
||||
identity_property_map,
|
||||
typename RandomAccessContainer::value_type,
|
||||
typename RandomAccessContainer::reference
|
||||
>
|
||||
make_container_vertex_map(RandomAccessContainer& c)
|
||||
{
|
||||
return make_iterator_vertex_map(c.begin());
|
||||
}
|
||||
|
||||
|
||||
// NOTE: These functions are declared, but never defined since they need to
|
||||
// be overloaded by graph implementations. However, we need them to be
|
||||
// declared for the functions below.
|
||||
template<typename Graph, typename Tag>
|
||||
typename graph_property<Graph, graph_bundle_t>::type&
|
||||
get_property(Graph& g, Tag);
|
||||
|
||||
template<typename Graph, typename Tag>
|
||||
typename graph_property<Graph, graph_bundle_t>::type const&
|
||||
get_property(Graph const& g, Tag);
|
||||
|
||||
#ifndef BOOST_GRAPH_NO_BUNDLED_PROPERTIES
|
||||
// NOTE: This operation is a simple adaptor over the overloaded get_property
|
||||
// operations.
|
||||
template<typename Graph>
|
||||
inline typename graph_property<Graph, graph_bundle_t>::type&
|
||||
get_property(Graph& g) {
|
||||
return get_property(g, graph_bundle);
|
||||
}
|
||||
|
||||
template<typename Graph>
|
||||
inline typename graph_property<Graph, graph_bundle_t>::type const&
|
||||
get_property(const Graph& g) {
|
||||
return get_property(g, graph_bundle);
|
||||
}
|
||||
#endif
|
||||
|
||||
} // namespace boost
|
||||
|
||||
#endif /* BOOST_GRAPH_PROPERTIES_HPP */
|
||||
@@ -0,0 +1,38 @@
|
||||
# /* Copyright (C) 2001
|
||||
# * Housemarque Oy
|
||||
# * http://www.housemarque.com
|
||||
# *
|
||||
# * 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)
|
||||
# */
|
||||
#
|
||||
# /* Revised by Paul Mensonides (2002) */
|
||||
#
|
||||
# /* See http://www.boost.org for most recent version. */
|
||||
#
|
||||
# ifndef BOOST_PREPROCESSOR_COMPARISON_GREATER_EQUAL_HPP
|
||||
# define BOOST_PREPROCESSOR_COMPARISON_GREATER_EQUAL_HPP
|
||||
#
|
||||
# include <boost/preprocessor/comparison/less_equal.hpp>
|
||||
# include <boost/preprocessor/config/config.hpp>
|
||||
#
|
||||
# /* BOOST_PP_GREATER_EQUAL */
|
||||
#
|
||||
# if ~BOOST_PP_CONFIG_FLAGS() & BOOST_PP_CONFIG_EDG()
|
||||
# define BOOST_PP_GREATER_EQUAL(x, y) BOOST_PP_LESS_EQUAL(y, x)
|
||||
# else
|
||||
# define BOOST_PP_GREATER_EQUAL(x, y) BOOST_PP_GREATER_EQUAL_I(x, y)
|
||||
# define BOOST_PP_GREATER_EQUAL_I(x, y) BOOST_PP_LESS_EQUAL(y, x)
|
||||
# endif
|
||||
#
|
||||
# /* BOOST_PP_GREATER_EQUAL_D */
|
||||
#
|
||||
# if ~BOOST_PP_CONFIG_FLAGS() & BOOST_PP_CONFIG_EDG()
|
||||
# define BOOST_PP_GREATER_EQUAL_D(d, x, y) BOOST_PP_LESS_EQUAL_D(d, y, x)
|
||||
# else
|
||||
# define BOOST_PP_GREATER_EQUAL_D(d, x, y) BOOST_PP_GREATER_EQUAL_D_I(d, x, y)
|
||||
# define BOOST_PP_GREATER_EQUAL_D_I(d, x, y) BOOST_PP_LESS_EQUAL_D(d, y, x)
|
||||
# endif
|
||||
#
|
||||
# endif
|
||||
@@ -0,0 +1,640 @@
|
||||
// Copyright John Maddock 2005-2008.
|
||||
// Copyright (c) 2006-2008 Johan Rade
|
||||
// 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_MATH_FPCLASSIFY_HPP
|
||||
#define BOOST_MATH_FPCLASSIFY_HPP
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#pragma once
|
||||
#endif
|
||||
|
||||
#include <math.h>
|
||||
#include <boost/config/no_tr1/cmath.hpp>
|
||||
#include <boost/limits.hpp>
|
||||
#include <boost/math/tools/real_cast.hpp>
|
||||
#include <boost/type_traits/is_floating_point.hpp>
|
||||
#include <boost/math/special_functions/math_fwd.hpp>
|
||||
#include <boost/math/special_functions/detail/fp_traits.hpp>
|
||||
/*!
|
||||
\file fpclassify.hpp
|
||||
\brief Classify floating-point value as normal, subnormal, zero, infinite, or NaN.
|
||||
\version 1.0
|
||||
\author John Maddock
|
||||
*/
|
||||
|
||||
/*
|
||||
|
||||
1. If the platform is C99 compliant, then the native floating point
|
||||
classification functions are used. However, note that we must only
|
||||
define the functions which call std::fpclassify etc if that function
|
||||
really does exist: otherwise a compiler may reject the code even though
|
||||
the template is never instantiated.
|
||||
|
||||
2. If the platform is not C99 compliant, and the binary format for
|
||||
a floating point type (float, double or long double) can be determined
|
||||
at compile time, then the following algorithm is used:
|
||||
|
||||
If all exponent bits, the flag bit (if there is one),
|
||||
and all significand bits are 0, then the number is zero.
|
||||
|
||||
If all exponent bits and the flag bit (if there is one) are 0,
|
||||
and at least one significand bit is 1, then the number is subnormal.
|
||||
|
||||
If all exponent bits are 1 and all significand bits are 0,
|
||||
then the number is infinity.
|
||||
|
||||
If all exponent bits are 1 and at least one significand bit is 1,
|
||||
then the number is a not-a-number.
|
||||
|
||||
Otherwise the number is normal.
|
||||
|
||||
This algorithm works for the IEEE 754 representation,
|
||||
and also for several non IEEE 754 formats.
|
||||
|
||||
Most formats have the structure
|
||||
sign bit + exponent bits + significand bits.
|
||||
|
||||
A few have the structure
|
||||
sign bit + exponent bits + flag bit + significand bits.
|
||||
The flag bit is 0 for zero and subnormal numbers,
|
||||
and 1 for normal numbers and NaN.
|
||||
It is 0 (Motorola 68K) or 1 (Intel) for infinity.
|
||||
|
||||
To get the bits, the four or eight most significant bytes are copied
|
||||
into an uint32_t or uint64_t and bit masks are applied.
|
||||
This covers all the exponent bits and the flag bit (if there is one),
|
||||
but not always all the significand bits.
|
||||
Some of the functions below have two implementations,
|
||||
depending on whether all the significand bits are copied or not.
|
||||
|
||||
3. If the platform is not C99 compliant, and the binary format for
|
||||
a floating point type (float, double or long double) can not be determined
|
||||
at compile time, then comparison with std::numeric_limits values
|
||||
is used.
|
||||
|
||||
*/
|
||||
|
||||
#if defined(_MSC_VER) || defined(__BORLANDC__)
|
||||
#include <float.h>
|
||||
#endif
|
||||
#ifdef BOOST_MATH_USE_FLOAT128
|
||||
#ifdef __has_include
|
||||
#if __has_include("quadmath.h")
|
||||
#include "quadmath.h"
|
||||
#define BOOST_MATH_HAS_QUADMATH_H
|
||||
#endif
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef BOOST_NO_STDC_NAMESPACE
|
||||
namespace std{ using ::abs; using ::fabs; }
|
||||
#endif
|
||||
|
||||
namespace boost{
|
||||
|
||||
//
|
||||
// This must not be located in any namespace under boost::math
|
||||
// otherwise we can get into an infinite loop if isnan is
|
||||
// a #define for "isnan" !
|
||||
//
|
||||
namespace math_detail{
|
||||
|
||||
#ifdef BOOST_MSVC
|
||||
#pragma warning(push)
|
||||
#pragma warning(disable:4800)
|
||||
#endif
|
||||
|
||||
template <class T>
|
||||
inline bool is_nan_helper(T t, const boost::true_type&)
|
||||
{
|
||||
#ifdef isnan
|
||||
return isnan(t);
|
||||
#elif defined(BOOST_MATH_DISABLE_STD_FPCLASSIFY) || !defined(BOOST_HAS_FPCLASSIFY)
|
||||
(void)t;
|
||||
return false;
|
||||
#else // BOOST_HAS_FPCLASSIFY
|
||||
return (BOOST_FPCLASSIFY_PREFIX fpclassify(t) == (int)FP_NAN);
|
||||
#endif
|
||||
}
|
||||
|
||||
#ifdef BOOST_MSVC
|
||||
#pragma warning(pop)
|
||||
#endif
|
||||
|
||||
template <class T>
|
||||
inline bool is_nan_helper(T, const boost::false_type&)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
#if defined(BOOST_MATH_USE_FLOAT128)
|
||||
#if defined(BOOST_MATH_HAS_QUADMATH_H)
|
||||
inline bool is_nan_helper(__float128 f, const boost::true_type&) { return ::isnanq(f); }
|
||||
inline bool is_nan_helper(__float128 f, const boost::false_type&) { return ::isnanq(f); }
|
||||
#elif defined(BOOST_GNU_STDLIB) && BOOST_GNU_STDLIB && \
|
||||
_GLIBCXX_USE_C99_MATH && !_GLIBCXX_USE_C99_FP_MACROS_DYNAMIC
|
||||
inline bool is_nan_helper(__float128 f, const boost::true_type&) { return std::isnan(static_cast<double>(f)); }
|
||||
inline bool is_nan_helper(__float128 f, const boost::false_type&) { return std::isnan(static_cast<double>(f)); }
|
||||
#else
|
||||
inline bool is_nan_helper(__float128 f, const boost::true_type&) { return ::isnan(static_cast<double>(f)); }
|
||||
inline bool is_nan_helper(__float128 f, const boost::false_type&) { return ::isnan(static_cast<double>(f)); }
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
|
||||
namespace math{
|
||||
|
||||
namespace detail{
|
||||
|
||||
#ifdef BOOST_MATH_USE_STD_FPCLASSIFY
|
||||
template <class T>
|
||||
inline int fpclassify_imp BOOST_NO_MACRO_EXPAND(T t, const native_tag&)
|
||||
{
|
||||
return (std::fpclassify)(t);
|
||||
}
|
||||
#endif
|
||||
|
||||
template <class T>
|
||||
inline int fpclassify_imp BOOST_NO_MACRO_EXPAND(T t, const generic_tag<true>&)
|
||||
{
|
||||
BOOST_MATH_INSTRUMENT_VARIABLE(t);
|
||||
|
||||
// whenever possible check for Nan's first:
|
||||
#if defined(BOOST_HAS_FPCLASSIFY) && !defined(BOOST_MATH_DISABLE_STD_FPCLASSIFY)
|
||||
if(::boost::math_detail::is_nan_helper(t, ::boost::is_floating_point<T>()))
|
||||
return FP_NAN;
|
||||
#elif defined(isnan)
|
||||
if(boost::math_detail::is_nan_helper(t, ::boost::is_floating_point<T>()))
|
||||
return FP_NAN;
|
||||
#elif defined(_MSC_VER) || defined(__BORLANDC__)
|
||||
if(::_isnan(boost::math::tools::real_cast<double>(t)))
|
||||
return FP_NAN;
|
||||
#endif
|
||||
// std::fabs broken on a few systems especially for long long!!!!
|
||||
T at = (t < T(0)) ? -t : t;
|
||||
|
||||
// Use a process of exclusion to figure out
|
||||
// what kind of type we have, this relies on
|
||||
// IEEE conforming reals that will treat
|
||||
// Nan's as unordered. Some compilers
|
||||
// don't do this once optimisations are
|
||||
// turned on, hence the check for nan's above.
|
||||
if(at <= (std::numeric_limits<T>::max)())
|
||||
{
|
||||
if(at >= (std::numeric_limits<T>::min)())
|
||||
return FP_NORMAL;
|
||||
return (at != 0) ? FP_SUBNORMAL : FP_ZERO;
|
||||
}
|
||||
else if(at > (std::numeric_limits<T>::max)())
|
||||
return FP_INFINITE;
|
||||
return FP_NAN;
|
||||
}
|
||||
|
||||
template <class T>
|
||||
inline int fpclassify_imp BOOST_NO_MACRO_EXPAND(T t, const generic_tag<false>&)
|
||||
{
|
||||
#ifdef BOOST_NO_LIMITS_COMPILE_TIME_CONSTANTS
|
||||
if(std::numeric_limits<T>::is_specialized)
|
||||
return fpclassify_imp(t, generic_tag<true>());
|
||||
#endif
|
||||
//
|
||||
// An unknown type with no numeric_limits support,
|
||||
// so what are we supposed to do we do here?
|
||||
//
|
||||
BOOST_MATH_INSTRUMENT_VARIABLE(t);
|
||||
|
||||
return t == 0 ? FP_ZERO : FP_NORMAL;
|
||||
}
|
||||
|
||||
template<class T>
|
||||
int fpclassify_imp BOOST_NO_MACRO_EXPAND(T x, ieee_copy_all_bits_tag)
|
||||
{
|
||||
typedef BOOST_DEDUCED_TYPENAME fp_traits<T>::type traits;
|
||||
|
||||
BOOST_MATH_INSTRUMENT_VARIABLE(x);
|
||||
|
||||
BOOST_DEDUCED_TYPENAME traits::bits a;
|
||||
traits::get_bits(x,a);
|
||||
BOOST_MATH_INSTRUMENT_VARIABLE(a);
|
||||
a &= traits::exponent | traits::flag | traits::significand;
|
||||
BOOST_MATH_INSTRUMENT_VARIABLE((traits::exponent | traits::flag | traits::significand));
|
||||
BOOST_MATH_INSTRUMENT_VARIABLE(a);
|
||||
|
||||
if(a <= traits::significand) {
|
||||
if(a == 0)
|
||||
return FP_ZERO;
|
||||
else
|
||||
return FP_SUBNORMAL;
|
||||
}
|
||||
|
||||
if(a < traits::exponent) return FP_NORMAL;
|
||||
|
||||
a &= traits::significand;
|
||||
if(a == 0) return FP_INFINITE;
|
||||
|
||||
return FP_NAN;
|
||||
}
|
||||
|
||||
template<class T>
|
||||
int fpclassify_imp BOOST_NO_MACRO_EXPAND(T x, ieee_copy_leading_bits_tag)
|
||||
{
|
||||
typedef BOOST_DEDUCED_TYPENAME fp_traits<T>::type traits;
|
||||
|
||||
BOOST_MATH_INSTRUMENT_VARIABLE(x);
|
||||
|
||||
BOOST_DEDUCED_TYPENAME traits::bits a;
|
||||
traits::get_bits(x,a);
|
||||
a &= traits::exponent | traits::flag | traits::significand;
|
||||
|
||||
if(a <= traits::significand) {
|
||||
if(x == 0)
|
||||
return FP_ZERO;
|
||||
else
|
||||
return FP_SUBNORMAL;
|
||||
}
|
||||
|
||||
if(a < traits::exponent) return FP_NORMAL;
|
||||
|
||||
a &= traits::significand;
|
||||
traits::set_bits(x,a);
|
||||
if(x == 0) return FP_INFINITE;
|
||||
|
||||
return FP_NAN;
|
||||
}
|
||||
|
||||
#if defined(BOOST_MATH_USE_STD_FPCLASSIFY) && (defined(BOOST_MATH_NO_NATIVE_LONG_DOUBLE_FP_CLASSIFY) || defined(BOOST_MATH_NO_LONG_DOUBLE_MATH_FUNCTIONS))
|
||||
inline int fpclassify_imp BOOST_NO_MACRO_EXPAND(long double t, const native_tag&)
|
||||
{
|
||||
return boost::math::detail::fpclassify_imp(t, generic_tag<true>());
|
||||
}
|
||||
#endif
|
||||
|
||||
} // namespace detail
|
||||
|
||||
template <class T>
|
||||
inline int fpclassify BOOST_NO_MACRO_EXPAND(T t)
|
||||
{
|
||||
typedef typename detail::fp_traits<T>::type traits;
|
||||
typedef typename traits::method method;
|
||||
typedef typename tools::promote_args_permissive<T>::type value_type;
|
||||
#ifdef BOOST_NO_LIMITS_COMPILE_TIME_CONSTANTS
|
||||
if(std::numeric_limits<T>::is_specialized && detail::is_generic_tag_false(static_cast<method*>(0)))
|
||||
return detail::fpclassify_imp(static_cast<value_type>(t), detail::generic_tag<true>());
|
||||
return detail::fpclassify_imp(static_cast<value_type>(t), method());
|
||||
#else
|
||||
return detail::fpclassify_imp(static_cast<value_type>(t), method());
|
||||
#endif
|
||||
}
|
||||
|
||||
#ifdef BOOST_MATH_NO_LONG_DOUBLE_MATH_FUNCTIONS
|
||||
template <>
|
||||
inline int fpclassify<long double> BOOST_NO_MACRO_EXPAND(long double t)
|
||||
{
|
||||
typedef detail::fp_traits<long double>::type traits;
|
||||
typedef traits::method method;
|
||||
typedef long double value_type;
|
||||
#ifdef BOOST_NO_LIMITS_COMPILE_TIME_CONSTANTS
|
||||
if(std::numeric_limits<long double>::is_specialized && detail::is_generic_tag_false(static_cast<method*>(0)))
|
||||
return detail::fpclassify_imp(static_cast<value_type>(t), detail::generic_tag<true>());
|
||||
return detail::fpclassify_imp(static_cast<value_type>(t), method());
|
||||
#else
|
||||
return detail::fpclassify_imp(static_cast<value_type>(t), method());
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
||||
namespace detail {
|
||||
|
||||
#ifdef BOOST_MATH_USE_STD_FPCLASSIFY
|
||||
template<class T>
|
||||
inline bool isfinite_impl(T x, native_tag const&)
|
||||
{
|
||||
return (std::isfinite)(x);
|
||||
}
|
||||
#endif
|
||||
|
||||
template<class T>
|
||||
inline bool isfinite_impl(T x, generic_tag<true> const&)
|
||||
{
|
||||
return x >= -(std::numeric_limits<T>::max)()
|
||||
&& x <= (std::numeric_limits<T>::max)();
|
||||
}
|
||||
|
||||
template<class T>
|
||||
inline bool isfinite_impl(T x, generic_tag<false> const&)
|
||||
{
|
||||
#ifdef BOOST_NO_LIMITS_COMPILE_TIME_CONSTANTS
|
||||
if(std::numeric_limits<T>::is_specialized)
|
||||
return isfinite_impl(x, generic_tag<true>());
|
||||
#endif
|
||||
(void)x; // warning suppression.
|
||||
return true;
|
||||
}
|
||||
|
||||
template<class T>
|
||||
inline bool isfinite_impl(T x, ieee_tag const&)
|
||||
{
|
||||
typedef BOOST_DEDUCED_TYPENAME detail::fp_traits<T>::type traits;
|
||||
BOOST_DEDUCED_TYPENAME traits::bits a;
|
||||
traits::get_bits(x,a);
|
||||
a &= traits::exponent;
|
||||
return a != traits::exponent;
|
||||
}
|
||||
|
||||
#if defined(BOOST_MATH_USE_STD_FPCLASSIFY) && defined(BOOST_MATH_NO_NATIVE_LONG_DOUBLE_FP_CLASSIFY)
|
||||
inline bool isfinite_impl BOOST_NO_MACRO_EXPAND(long double t, const native_tag&)
|
||||
{
|
||||
return boost::math::detail::isfinite_impl(t, generic_tag<true>());
|
||||
}
|
||||
#endif
|
||||
|
||||
}
|
||||
|
||||
template<class T>
|
||||
inline bool (isfinite)(T x)
|
||||
{ //!< \brief return true if floating-point type t is finite.
|
||||
typedef typename detail::fp_traits<T>::type traits;
|
||||
typedef typename traits::method method;
|
||||
// typedef typename boost::is_floating_point<T>::type fp_tag;
|
||||
typedef typename tools::promote_args_permissive<T>::type value_type;
|
||||
return detail::isfinite_impl(static_cast<value_type>(x), method());
|
||||
}
|
||||
|
||||
#ifdef BOOST_MATH_NO_LONG_DOUBLE_MATH_FUNCTIONS
|
||||
template<>
|
||||
inline bool (isfinite)(long double x)
|
||||
{ //!< \brief return true if floating-point type t is finite.
|
||||
typedef detail::fp_traits<long double>::type traits;
|
||||
typedef traits::method method;
|
||||
//typedef boost::is_floating_point<long double>::type fp_tag;
|
||||
typedef long double value_type;
|
||||
return detail::isfinite_impl(static_cast<value_type>(x), method());
|
||||
}
|
||||
#endif
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
namespace detail {
|
||||
|
||||
#ifdef BOOST_MATH_USE_STD_FPCLASSIFY
|
||||
template<class T>
|
||||
inline bool isnormal_impl(T x, native_tag const&)
|
||||
{
|
||||
return (std::isnormal)(x);
|
||||
}
|
||||
#endif
|
||||
|
||||
template<class T>
|
||||
inline bool isnormal_impl(T x, generic_tag<true> const&)
|
||||
{
|
||||
if(x < 0) x = -x;
|
||||
return x >= (std::numeric_limits<T>::min)()
|
||||
&& x <= (std::numeric_limits<T>::max)();
|
||||
}
|
||||
|
||||
template<class T>
|
||||
inline bool isnormal_impl(T x, generic_tag<false> const&)
|
||||
{
|
||||
#ifdef BOOST_NO_LIMITS_COMPILE_TIME_CONSTANTS
|
||||
if(std::numeric_limits<T>::is_specialized)
|
||||
return isnormal_impl(x, generic_tag<true>());
|
||||
#endif
|
||||
return !(x == 0);
|
||||
}
|
||||
|
||||
template<class T>
|
||||
inline bool isnormal_impl(T x, ieee_tag const&)
|
||||
{
|
||||
typedef BOOST_DEDUCED_TYPENAME detail::fp_traits<T>::type traits;
|
||||
BOOST_DEDUCED_TYPENAME traits::bits a;
|
||||
traits::get_bits(x,a);
|
||||
a &= traits::exponent | traits::flag;
|
||||
return (a != 0) && (a < traits::exponent);
|
||||
}
|
||||
|
||||
#if defined(BOOST_MATH_USE_STD_FPCLASSIFY) && defined(BOOST_MATH_NO_NATIVE_LONG_DOUBLE_FP_CLASSIFY)
|
||||
inline bool isnormal_impl BOOST_NO_MACRO_EXPAND(long double t, const native_tag&)
|
||||
{
|
||||
return boost::math::detail::isnormal_impl(t, generic_tag<true>());
|
||||
}
|
||||
#endif
|
||||
|
||||
}
|
||||
|
||||
template<class T>
|
||||
inline bool (isnormal)(T x)
|
||||
{
|
||||
typedef typename detail::fp_traits<T>::type traits;
|
||||
typedef typename traits::method method;
|
||||
//typedef typename boost::is_floating_point<T>::type fp_tag;
|
||||
typedef typename tools::promote_args_permissive<T>::type value_type;
|
||||
return detail::isnormal_impl(static_cast<value_type>(x), method());
|
||||
}
|
||||
|
||||
#ifdef BOOST_MATH_NO_LONG_DOUBLE_MATH_FUNCTIONS
|
||||
template<>
|
||||
inline bool (isnormal)(long double x)
|
||||
{
|
||||
typedef detail::fp_traits<long double>::type traits;
|
||||
typedef traits::method method;
|
||||
//typedef boost::is_floating_point<long double>::type fp_tag;
|
||||
typedef long double value_type;
|
||||
return detail::isnormal_impl(static_cast<value_type>(x), method());
|
||||
}
|
||||
#endif
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
namespace detail {
|
||||
|
||||
#ifdef BOOST_MATH_USE_STD_FPCLASSIFY
|
||||
template<class T>
|
||||
inline bool isinf_impl(T x, native_tag const&)
|
||||
{
|
||||
return (std::isinf)(x);
|
||||
}
|
||||
#endif
|
||||
|
||||
template<class T>
|
||||
inline bool isinf_impl(T x, generic_tag<true> const&)
|
||||
{
|
||||
(void)x; // in case the compiler thinks that x is unused because std::numeric_limits<T>::has_infinity is false
|
||||
return std::numeric_limits<T>::has_infinity
|
||||
&& ( x == std::numeric_limits<T>::infinity()
|
||||
|| x == -std::numeric_limits<T>::infinity());
|
||||
}
|
||||
|
||||
template<class T>
|
||||
inline bool isinf_impl(T x, generic_tag<false> const&)
|
||||
{
|
||||
#ifdef BOOST_NO_LIMITS_COMPILE_TIME_CONSTANTS
|
||||
if(std::numeric_limits<T>::is_specialized)
|
||||
return isinf_impl(x, generic_tag<true>());
|
||||
#endif
|
||||
(void)x; // warning suppression.
|
||||
return false;
|
||||
}
|
||||
|
||||
template<class T>
|
||||
inline bool isinf_impl(T x, ieee_copy_all_bits_tag const&)
|
||||
{
|
||||
typedef BOOST_DEDUCED_TYPENAME fp_traits<T>::type traits;
|
||||
|
||||
BOOST_DEDUCED_TYPENAME traits::bits a;
|
||||
traits::get_bits(x,a);
|
||||
a &= traits::exponent | traits::significand;
|
||||
return a == traits::exponent;
|
||||
}
|
||||
|
||||
template<class T>
|
||||
inline bool isinf_impl(T x, ieee_copy_leading_bits_tag const&)
|
||||
{
|
||||
typedef BOOST_DEDUCED_TYPENAME fp_traits<T>::type traits;
|
||||
|
||||
BOOST_DEDUCED_TYPENAME traits::bits a;
|
||||
traits::get_bits(x,a);
|
||||
a &= traits::exponent | traits::significand;
|
||||
if(a != traits::exponent)
|
||||
return false;
|
||||
|
||||
traits::set_bits(x,0);
|
||||
return x == 0;
|
||||
}
|
||||
|
||||
#if defined(BOOST_MATH_USE_STD_FPCLASSIFY) && defined(BOOST_MATH_NO_NATIVE_LONG_DOUBLE_FP_CLASSIFY)
|
||||
inline bool isinf_impl BOOST_NO_MACRO_EXPAND(long double t, const native_tag&)
|
||||
{
|
||||
return boost::math::detail::isinf_impl(t, generic_tag<true>());
|
||||
}
|
||||
#endif
|
||||
|
||||
} // namespace detail
|
||||
|
||||
template<class T>
|
||||
inline bool (isinf)(T x)
|
||||
{
|
||||
typedef typename detail::fp_traits<T>::type traits;
|
||||
typedef typename traits::method method;
|
||||
// typedef typename boost::is_floating_point<T>::type fp_tag;
|
||||
typedef typename tools::promote_args_permissive<T>::type value_type;
|
||||
return detail::isinf_impl(static_cast<value_type>(x), method());
|
||||
}
|
||||
|
||||
#ifdef BOOST_MATH_NO_LONG_DOUBLE_MATH_FUNCTIONS
|
||||
template<>
|
||||
inline bool (isinf)(long double x)
|
||||
{
|
||||
typedef detail::fp_traits<long double>::type traits;
|
||||
typedef traits::method method;
|
||||
//typedef boost::is_floating_point<long double>::type fp_tag;
|
||||
typedef long double value_type;
|
||||
return detail::isinf_impl(static_cast<value_type>(x), method());
|
||||
}
|
||||
#endif
|
||||
#if defined(BOOST_MATH_USE_FLOAT128) && defined(BOOST_MATH_HAS_QUADMATH_H)
|
||||
template<>
|
||||
inline bool (isinf)(__float128 x)
|
||||
{
|
||||
return ::isinfq(x);
|
||||
}
|
||||
#endif
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
namespace detail {
|
||||
|
||||
#ifdef BOOST_MATH_USE_STD_FPCLASSIFY
|
||||
template<class T>
|
||||
inline bool isnan_impl(T x, native_tag const&)
|
||||
{
|
||||
return (std::isnan)(x);
|
||||
}
|
||||
#endif
|
||||
|
||||
template<class T>
|
||||
inline bool isnan_impl(T x, generic_tag<true> const&)
|
||||
{
|
||||
return std::numeric_limits<T>::has_infinity
|
||||
? !(x <= std::numeric_limits<T>::infinity())
|
||||
: x != x;
|
||||
}
|
||||
|
||||
template<class T>
|
||||
inline bool isnan_impl(T x, generic_tag<false> const&)
|
||||
{
|
||||
#ifdef BOOST_NO_LIMITS_COMPILE_TIME_CONSTANTS
|
||||
if(std::numeric_limits<T>::is_specialized)
|
||||
return isnan_impl(x, generic_tag<true>());
|
||||
#endif
|
||||
(void)x; // warning suppression
|
||||
return false;
|
||||
}
|
||||
|
||||
template<class T>
|
||||
inline bool isnan_impl(T x, ieee_copy_all_bits_tag const&)
|
||||
{
|
||||
typedef BOOST_DEDUCED_TYPENAME fp_traits<T>::type traits;
|
||||
|
||||
BOOST_DEDUCED_TYPENAME traits::bits a;
|
||||
traits::get_bits(x,a);
|
||||
a &= traits::exponent | traits::significand;
|
||||
return a > traits::exponent;
|
||||
}
|
||||
|
||||
template<class T>
|
||||
inline bool isnan_impl(T x, ieee_copy_leading_bits_tag const&)
|
||||
{
|
||||
typedef BOOST_DEDUCED_TYPENAME fp_traits<T>::type traits;
|
||||
|
||||
BOOST_DEDUCED_TYPENAME traits::bits a;
|
||||
traits::get_bits(x,a);
|
||||
|
||||
a &= traits::exponent | traits::significand;
|
||||
if(a < traits::exponent)
|
||||
return false;
|
||||
|
||||
a &= traits::significand;
|
||||
traits::set_bits(x,a);
|
||||
return x != 0;
|
||||
}
|
||||
|
||||
} // namespace detail
|
||||
|
||||
template<class T>
|
||||
inline bool (isnan)(T x)
|
||||
{ //!< \brief return true if floating-point type t is NaN (Not A Number).
|
||||
typedef typename detail::fp_traits<T>::type traits;
|
||||
typedef typename traits::method method;
|
||||
// typedef typename boost::is_floating_point<T>::type fp_tag;
|
||||
return detail::isnan_impl(x, method());
|
||||
}
|
||||
|
||||
#ifdef isnan
|
||||
template <> inline bool isnan BOOST_NO_MACRO_EXPAND<float>(float t){ return ::boost::math_detail::is_nan_helper(t, boost::true_type()); }
|
||||
template <> inline bool isnan BOOST_NO_MACRO_EXPAND<double>(double t){ return ::boost::math_detail::is_nan_helper(t, boost::true_type()); }
|
||||
template <> inline bool isnan BOOST_NO_MACRO_EXPAND<long double>(long double t){ return ::boost::math_detail::is_nan_helper(t, boost::true_type()); }
|
||||
#elif defined(BOOST_MATH_NO_LONG_DOUBLE_MATH_FUNCTIONS)
|
||||
template<>
|
||||
inline bool (isnan)(long double x)
|
||||
{ //!< \brief return true if floating-point type t is NaN (Not A Number).
|
||||
typedef detail::fp_traits<long double>::type traits;
|
||||
typedef traits::method method;
|
||||
//typedef boost::is_floating_point<long double>::type fp_tag;
|
||||
return detail::isnan_impl(x, method());
|
||||
}
|
||||
#endif
|
||||
#if defined(BOOST_MATH_USE_FLOAT128) && defined(BOOST_MATH_HAS_QUADMATH_H)
|
||||
template<>
|
||||
inline bool (isnan)(__float128 x)
|
||||
{
|
||||
return ::isnanq(x);
|
||||
}
|
||||
#endif
|
||||
|
||||
} // namespace math
|
||||
} // namespace boost
|
||||
|
||||
#endif // BOOST_MATH_FPCLASSIFY_HPP
|
||||
|
||||
@@ -0,0 +1,90 @@
|
||||
|
||||
#if !defined(BOOST_PHOENIX_DONT_USE_PREPROCESSED_FILES)
|
||||
#ifndef BOOST_PHOENIX_CORE_DETAIL_ACTOR_RESULT_OF_HPP
|
||||
#define BOOST_PHOENIX_CORE_DETAIL_ACTOR_RESULT_OF_HPP
|
||||
|
||||
#include <boost/phoenix/support/iterate.hpp>
|
||||
|
||||
#include <boost/phoenix/core/detail/cpp03/preprocessed/actor_result_of.hpp>
|
||||
|
||||
#endif
|
||||
#else
|
||||
|
||||
#if !BOOST_PHOENIX_IS_ITERATING
|
||||
|
||||
#ifndef BOOST_PHOENIX_CORE_DETAIL_ACTOR_RESULT_OF_HPP
|
||||
#define BOOST_PHOENIX_CORE_DETAIL_ACTOR_RESULT_OF_HPP
|
||||
|
||||
#include <boost/phoenix/support/iterate.hpp>
|
||||
|
||||
#if defined(__WAVE__) && defined(BOOST_PHOENIX_CREATE_PREPROCESSED_FILES)
|
||||
#pragma wave option(preserve: 2, line: 0, output: "preprocessed/actor_result_of_" BOOST_PHOENIX_LIMIT_STR ".hpp")
|
||||
#endif
|
||||
|
||||
/*==============================================================================
|
||||
Copyright (c) 2005-2010 Joel de Guzman
|
||||
Copyright (c) 2010 Thomas Heller
|
||||
|
||||
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)
|
||||
==============================================================================*/
|
||||
|
||||
#if defined(__WAVE__) && defined(BOOST_PHOENIX_CREATE_PREPROCESSED_FILES)
|
||||
#pragma wave option(preserve: 1)
|
||||
#endif
|
||||
|
||||
template <typename Expr
|
||||
, BOOST_PHOENIX_typename_A_void(BOOST_PHOENIX_ACTOR_LIMIT)
|
||||
, typename Dummy = void>
|
||||
struct actor;
|
||||
|
||||
template <typename Expr>
|
||||
struct nullary_actor_result
|
||||
{
|
||||
typedef
|
||||
typename boost::phoenix::evaluator::impl<
|
||||
Expr const&
|
||||
, vector2<
|
||||
vector1<const ::boost::phoenix::actor<Expr> *> &
|
||||
, default_actions
|
||||
> const &
|
||||
, proto::empty_env
|
||||
>::result_type
|
||||
type;
|
||||
};
|
||||
|
||||
#define BOOST_PHOENIX_ITERATION_PARAMS \
|
||||
(3, (1, BOOST_PHOENIX_ACTOR_LIMIT, \
|
||||
<boost/phoenix/core/detail/cpp03/actor_result_of.hpp>))
|
||||
#include BOOST_PHOENIX_ITERATE()
|
||||
|
||||
#if defined(__WAVE__) && defined(BOOST_PHOENIX_CREATE_PREPROCESSED_FILES)
|
||||
#pragma wave option(output: null)
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
#else
|
||||
|
||||
template <typename Expr, BOOST_PHOENIX_typename_A>
|
||||
struct actor<Expr, BOOST_PHOENIX_A>
|
||||
{
|
||||
typedef
|
||||
typename phoenix::evaluator::
|
||||
impl<
|
||||
Expr const&
|
||||
, vector2<
|
||||
BOOST_PP_CAT(
|
||||
vector
|
||||
, BOOST_PP_INC(BOOST_PHOENIX_ITERATION)
|
||||
)<const ::boost::phoenix::actor<Expr> *, BOOST_PHOENIX_A> &
|
||||
, default_actions
|
||||
> const &
|
||||
, proto::empty_env
|
||||
>::result_type
|
||||
type;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
#endif // BOOST_PHOENIX_DONT_USE_PREPROCESSED_FILES
|
||||
@@ -0,0 +1,93 @@
|
||||
//---------------------------------------------------------------------------//
|
||||
// Copyright (c) 2013 Kyle Lutz <kyle.r.lutz@gmail.com>
|
||||
//
|
||||
// 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
|
||||
//
|
||||
// See http://boostorg.github.com/compute for more information.
|
||||
//---------------------------------------------------------------------------//
|
||||
|
||||
#ifndef BOOST_COMPUTE_LAMBDA_PLACEHOLDERS_HPP
|
||||
#define BOOST_COMPUTE_LAMBDA_PLACEHOLDERS_HPP
|
||||
|
||||
#include <boost/mpl/has_xxx.hpp>
|
||||
|
||||
#include <boost/compute/lambda/context.hpp>
|
||||
#include <boost/compute/lambda/result_of.hpp>
|
||||
|
||||
namespace boost {
|
||||
namespace compute {
|
||||
namespace lambda {
|
||||
|
||||
namespace mpl = boost::mpl;
|
||||
namespace proto = boost::proto;
|
||||
|
||||
// lambda placeholders
|
||||
expression<proto::terminal<placeholder<0> >::type> const _1;
|
||||
expression<proto::terminal<placeholder<1> >::type> const _2;
|
||||
expression<proto::terminal<placeholder<2> >::type> const _3;
|
||||
|
||||
namespace detail {
|
||||
|
||||
BOOST_MPL_HAS_XXX_TRAIT_DEF(result_type)
|
||||
|
||||
template<class T, bool HasResultType>
|
||||
struct terminal_type_impl;
|
||||
|
||||
template<class T>
|
||||
struct terminal_type_impl<T, true>
|
||||
{
|
||||
typedef typename T::result_type type;
|
||||
};
|
||||
|
||||
template<class T>
|
||||
struct terminal_type_impl<T, false>
|
||||
{
|
||||
typedef T type;
|
||||
};
|
||||
|
||||
template<class T>
|
||||
struct terminal_type
|
||||
{
|
||||
typedef typename terminal_type_impl<T, has_result_type<T>::value>::type type;
|
||||
};
|
||||
|
||||
} // end detail namespace
|
||||
|
||||
// result_of placeholders
|
||||
template<class Args>
|
||||
struct result_of<expression<proto::terminal<placeholder<0> >::type>, Args, proto::tag::terminal>
|
||||
{
|
||||
typedef typename boost::tuples::element<0, Args>::type arg_type;
|
||||
|
||||
typedef typename detail::terminal_type<arg_type>::type type;
|
||||
};
|
||||
|
||||
template<class Args>
|
||||
struct result_of<expression<proto::terminal<placeholder<1> >::type>, Args, proto::tag::terminal>
|
||||
{
|
||||
typedef typename boost::tuples::element<1, Args>::type arg_type;
|
||||
|
||||
typedef typename detail::terminal_type<arg_type>::type type;
|
||||
};
|
||||
|
||||
template<class Args>
|
||||
struct result_of<expression<proto::terminal<placeholder<2> >::type>, Args, proto::tag::terminal>
|
||||
{
|
||||
typedef typename boost::tuples::element<2, Args>::type arg_type;
|
||||
|
||||
typedef typename detail::terminal_type<arg_type>::type type;
|
||||
};
|
||||
|
||||
} // end lambda namespace
|
||||
|
||||
// lift lambda placeholders up to the boost::compute namespace
|
||||
using lambda::_1;
|
||||
using lambda::_2;
|
||||
using lambda::_3;
|
||||
|
||||
} // end compute namespace
|
||||
} // end boost namespace
|
||||
|
||||
#endif // BOOST_COMPUTE_LAMBDA_PLACEHOLDERS_HPP
|
||||
@@ -0,0 +1,22 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2001-2011 Joel de Guzman
|
||||
|
||||
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)
|
||||
|
||||
This is an auto-generated file. Do not edit!
|
||||
==============================================================================*/
|
||||
|
||||
#if FUSION_MAX_LIST_SIZE <= 10
|
||||
#include <boost/fusion/container/generation/detail/preprocessed/list_tie10.hpp>
|
||||
#elif FUSION_MAX_LIST_SIZE <= 20
|
||||
#include <boost/fusion/container/generation/detail/preprocessed/list_tie20.hpp>
|
||||
#elif FUSION_MAX_LIST_SIZE <= 30
|
||||
#include <boost/fusion/container/generation/detail/preprocessed/list_tie30.hpp>
|
||||
#elif FUSION_MAX_LIST_SIZE <= 40
|
||||
#include <boost/fusion/container/generation/detail/preprocessed/list_tie40.hpp>
|
||||
#elif FUSION_MAX_LIST_SIZE <= 50
|
||||
#include <boost/fusion/container/generation/detail/preprocessed/list_tie50.hpp>
|
||||
#else
|
||||
#error "FUSION_MAX_LIST_SIZE out of bounds for preprocessed headers"
|
||||
#endif
|
||||
@@ -0,0 +1,114 @@
|
||||
|
||||
#if !defined(BOOST_PHOENIX_DONT_USE_PREPROCESSED_FILES)
|
||||
#ifndef BOOST_PHOENIX_STATEMENT_DETAIL_TRY_CATCH_EVAL_HPP
|
||||
#define BOOST_PHOENIX_STATEMENT_DETAIL_TRY_CATCH_EVAL_HPP
|
||||
|
||||
#include <boost/phoenix/support/iterate.hpp>
|
||||
|
||||
#include <boost/phoenix/statement/detail/preprocessed/try_catch_eval.hpp>
|
||||
|
||||
#endif
|
||||
#else
|
||||
|
||||
#if !BOOST_PHOENIX_IS_ITERATING
|
||||
|
||||
#ifndef BOOST_PHOENIX_STATEMENT_DETAIL_TRY_CATCH_EVAL_HPP
|
||||
#define BOOST_PHOENIX_STATEMENT_DETAIL_TRY_CATCH_EVAL_HPP
|
||||
|
||||
#include <boost/phoenix/support/iterate.hpp>
|
||||
|
||||
#if defined(__WAVE__) && defined(BOOST_PHOENIX_CREATE_PREPROCESSED_FILES)
|
||||
#pragma wave option(preserve: 2, line: 0, output: "preprocessed/try_catch_eval_" BOOST_PHOENIX_LIMIT_STR ".hpp")
|
||||
#endif
|
||||
|
||||
/*==============================================================================
|
||||
Copyright (c) 2005-2010 Joel de Guzman
|
||||
Copyright (c) 2010 Thomas Heller
|
||||
|
||||
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)
|
||||
==============================================================================*/
|
||||
|
||||
#if defined(__WAVE__) && defined(BOOST_PHOENIX_CREATE_PREPROCESSED_FILES)
|
||||
#pragma wave option(preserve: 1)
|
||||
#endif
|
||||
|
||||
#define BOOST_PHOENIX_TRY_CATCH_EVAL_R(Z, N, DATA) \
|
||||
catch( \
|
||||
typename proto::result_of::value< \
|
||||
typename proto::result_of::child_c< \
|
||||
BOOST_PP_CAT(A, N) \
|
||||
, 0 \
|
||||
>::type \
|
||||
>::type::type &e \
|
||||
) \
|
||||
{ \
|
||||
eval_catch_body(BOOST_PP_CAT(a, N), e, ctx); \
|
||||
} \
|
||||
/**/
|
||||
|
||||
|
||||
#define BOOST_PHOENIX_ITERATION_PARAMS \
|
||||
(3, (1, BOOST_PHOENIX_CATCH_LIMIT, \
|
||||
<boost/phoenix/statement/detail/try_catch_eval.hpp>))
|
||||
#include BOOST_PHOENIX_ITERATE()
|
||||
|
||||
#undef BOOST_PHOENIX_TRY_CATCH_EVAL_R
|
||||
|
||||
#if defined(__WAVE__) && defined(BOOST_PHOENIX_CREATE_PREPROCESSED_FILES)
|
||||
#pragma wave option(output: null)
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
#else
|
||||
|
||||
template <typename Try, BOOST_PHOENIX_typename_A, typename Context>
|
||||
typename boost::enable_if<
|
||||
proto::matches<
|
||||
BOOST_PP_CAT(A, BOOST_PP_DEC(BOOST_PHOENIX_ITERATION))
|
||||
, rule::catch_
|
||||
>
|
||||
, result_type
|
||||
>::type
|
||||
operator()(Try const & try_, BOOST_PHOENIX_A_const_ref_a, Context const & ctx
|
||||
BOOST_PHOENIX_SFINAE_AND_OVERLOADS) const
|
||||
{
|
||||
try
|
||||
{
|
||||
boost::phoenix::eval(proto::child_c<0>(try_), ctx);
|
||||
}
|
||||
BOOST_PP_REPEAT(BOOST_PHOENIX_ITERATION, BOOST_PHOENIX_TRY_CATCH_EVAL_R, _)
|
||||
}
|
||||
|
||||
template <typename Try, BOOST_PHOENIX_typename_A, typename Context>
|
||||
typename boost::disable_if<
|
||||
proto::matches<
|
||||
BOOST_PP_CAT(A, BOOST_PP_DEC(BOOST_PHOENIX_ITERATION))
|
||||
, rule::catch_
|
||||
>
|
||||
, result_type
|
||||
>::type
|
||||
operator()(Try const & try_, BOOST_PHOENIX_A_const_ref_a, Context const & ctx) const
|
||||
{
|
||||
try
|
||||
{
|
||||
boost::phoenix::eval(proto::child_c<0>(try_), ctx);
|
||||
}
|
||||
BOOST_PP_REPEAT(
|
||||
BOOST_PP_DEC(BOOST_PHOENIX_ITERATION)
|
||||
, BOOST_PHOENIX_TRY_CATCH_EVAL_R, _
|
||||
)
|
||||
catch(...)
|
||||
{
|
||||
boost::phoenix::eval(
|
||||
proto::child_c<0>(
|
||||
BOOST_PP_CAT(a, BOOST_PP_DEC(BOOST_PHOENIX_ITERATION))
|
||||
)
|
||||
, ctx);
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
#endif // BOOST_PHOENIX_DONT_USE_PREPROCESSED_FILES
|
||||
@@ -0,0 +1,406 @@
|
||||
|
||||
// Copyright Peter Dimov 2001
|
||||
// Copyright Aleksey Gurtovoy 2001-2004
|
||||
//
|
||||
// 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)
|
||||
//
|
||||
|
||||
// Preprocessed version of "boost/mpl/aux_/basic_bind.hpp" header
|
||||
// -- DO NOT modify by hand!
|
||||
|
||||
namespace boost { namespace mpl {
|
||||
|
||||
namespace aux {
|
||||
|
||||
template<
|
||||
typename T, typename U1, typename U2, typename U3, typename U4
|
||||
, typename U5
|
||||
>
|
||||
struct resolve_bind_arg
|
||||
{
|
||||
typedef T type;
|
||||
};
|
||||
|
||||
template<
|
||||
int N, typename U1, typename U2, typename U3, typename U4, typename U5
|
||||
>
|
||||
struct resolve_bind_arg< arg<N>, U1, U2, U3, U4, U5 >
|
||||
{
|
||||
typedef typename apply_wrap5<mpl::arg<N>, U1, U2, U3, U4, U5>::type type;
|
||||
};
|
||||
|
||||
template<
|
||||
typename F, typename T1, typename T2, typename T3, typename T4
|
||||
, typename T5, typename U1, typename U2, typename U3, typename U4
|
||||
, typename U5
|
||||
>
|
||||
struct resolve_bind_arg< bind< F,T1,T2,T3,T4,T5 >, U1, U2, U3, U4, U5 >
|
||||
{
|
||||
typedef bind< F,T1,T2,T3,T4,T5 > f_;
|
||||
typedef typename apply_wrap5< f_,U1,U2,U3,U4,U5 >::type type;
|
||||
};
|
||||
|
||||
} // namespace aux
|
||||
|
||||
template<
|
||||
typename F, int dummy_
|
||||
>
|
||||
struct bind0
|
||||
{
|
||||
template<
|
||||
typename U1 = na, typename U2 = na, typename U3 = na
|
||||
, typename U4 = na, typename U5 = na
|
||||
>
|
||||
struct apply
|
||||
{
|
||||
private:
|
||||
typedef typename aux::resolve_bind_arg< F,U1,U2,U3,U4,U5 >::type f_;
|
||||
|
||||
public:
|
||||
typedef typename apply_wrap0<
|
||||
f_
|
||||
>::type type;
|
||||
|
||||
};
|
||||
};
|
||||
|
||||
namespace aux {
|
||||
|
||||
template<
|
||||
typename F, typename U1, typename U2, typename U3, typename U4
|
||||
, typename U5
|
||||
>
|
||||
struct resolve_bind_arg<
|
||||
bind0<F>, U1, U2, U3, U4, U5
|
||||
>
|
||||
{
|
||||
typedef bind0<F> f_;
|
||||
typedef typename apply_wrap5< f_,U1,U2,U3,U4,U5 >::type type;
|
||||
};
|
||||
|
||||
} // namespace aux
|
||||
|
||||
BOOST_MPL_AUX_ARITY_SPEC(1, bind0)
|
||||
BOOST_MPL_AUX_TEMPLATE_ARITY_SPEC(1, bind0)
|
||||
|
||||
template<
|
||||
typename F, int dummy_
|
||||
>
|
||||
struct bind< F,na,na,na,na,na >
|
||||
: bind0<F>
|
||||
{
|
||||
};
|
||||
|
||||
template<
|
||||
typename F, typename T1, int dummy_
|
||||
>
|
||||
struct bind1
|
||||
{
|
||||
template<
|
||||
typename U1 = na, typename U2 = na, typename U3 = na
|
||||
, typename U4 = na, typename U5 = na
|
||||
>
|
||||
struct apply
|
||||
{
|
||||
private:
|
||||
typedef typename aux::resolve_bind_arg< F,U1,U2,U3,U4,U5 >::type f_;
|
||||
typedef aux::resolve_bind_arg< T1,U1,U2,U3,U4,U5 > t1;
|
||||
|
||||
public:
|
||||
typedef typename apply_wrap1<
|
||||
f_
|
||||
, typename t1::type
|
||||
>::type type;
|
||||
|
||||
};
|
||||
};
|
||||
|
||||
namespace aux {
|
||||
|
||||
template<
|
||||
typename F, typename T1, typename U1, typename U2, typename U3
|
||||
, typename U4, typename U5
|
||||
>
|
||||
struct resolve_bind_arg<
|
||||
bind1< F,T1 >, U1, U2, U3, U4, U5
|
||||
>
|
||||
{
|
||||
typedef bind1< F,T1 > f_;
|
||||
typedef typename apply_wrap5< f_,U1,U2,U3,U4,U5 >::type type;
|
||||
};
|
||||
|
||||
} // namespace aux
|
||||
|
||||
BOOST_MPL_AUX_ARITY_SPEC(2, bind1)
|
||||
BOOST_MPL_AUX_TEMPLATE_ARITY_SPEC(2, bind1)
|
||||
|
||||
template<
|
||||
typename F, typename T1, int dummy_
|
||||
>
|
||||
struct bind< F,T1,na,na,na,na >
|
||||
: bind1< F,T1 >
|
||||
{
|
||||
};
|
||||
|
||||
template<
|
||||
typename F, typename T1, typename T2, int dummy_
|
||||
>
|
||||
struct bind2
|
||||
{
|
||||
template<
|
||||
typename U1 = na, typename U2 = na, typename U3 = na
|
||||
, typename U4 = na, typename U5 = na
|
||||
>
|
||||
struct apply
|
||||
{
|
||||
private:
|
||||
typedef typename aux::resolve_bind_arg< F,U1,U2,U3,U4,U5 >::type f_;
|
||||
typedef aux::resolve_bind_arg< T1,U1,U2,U3,U4,U5 > t1;
|
||||
typedef aux::resolve_bind_arg< T2,U1,U2,U3,U4,U5 > t2;
|
||||
|
||||
public:
|
||||
typedef typename apply_wrap2<
|
||||
f_
|
||||
, typename t1::type, typename t2::type
|
||||
>::type type;
|
||||
|
||||
};
|
||||
};
|
||||
|
||||
namespace aux {
|
||||
|
||||
template<
|
||||
typename F, typename T1, typename T2, typename U1, typename U2
|
||||
, typename U3, typename U4, typename U5
|
||||
>
|
||||
struct resolve_bind_arg<
|
||||
bind2< F,T1,T2 >, U1, U2, U3, U4, U5
|
||||
>
|
||||
{
|
||||
typedef bind2< F,T1,T2 > f_;
|
||||
typedef typename apply_wrap5< f_,U1,U2,U3,U4,U5 >::type type;
|
||||
};
|
||||
|
||||
} // namespace aux
|
||||
|
||||
BOOST_MPL_AUX_ARITY_SPEC(3, bind2)
|
||||
BOOST_MPL_AUX_TEMPLATE_ARITY_SPEC(3, bind2)
|
||||
|
||||
template<
|
||||
typename F, typename T1, typename T2, int dummy_
|
||||
>
|
||||
struct bind< F,T1,T2,na,na,na >
|
||||
: bind2< F,T1,T2 >
|
||||
{
|
||||
};
|
||||
|
||||
template<
|
||||
typename F, typename T1, typename T2, typename T3, int dummy_
|
||||
>
|
||||
struct bind3
|
||||
{
|
||||
template<
|
||||
typename U1 = na, typename U2 = na, typename U3 = na
|
||||
, typename U4 = na, typename U5 = na
|
||||
>
|
||||
struct apply
|
||||
{
|
||||
private:
|
||||
typedef typename aux::resolve_bind_arg< F,U1,U2,U3,U4,U5 >::type f_;
|
||||
typedef aux::resolve_bind_arg< T1,U1,U2,U3,U4,U5 > t1;
|
||||
typedef aux::resolve_bind_arg< T2,U1,U2,U3,U4,U5 > t2;
|
||||
typedef aux::resolve_bind_arg< T3,U1,U2,U3,U4,U5 > t3;
|
||||
|
||||
public:
|
||||
typedef typename apply_wrap3<
|
||||
f_
|
||||
, typename t1::type, typename t2::type, typename t3::type
|
||||
>::type type;
|
||||
|
||||
};
|
||||
};
|
||||
|
||||
namespace aux {
|
||||
|
||||
template<
|
||||
typename F, typename T1, typename T2, typename T3, typename U1
|
||||
, typename U2, typename U3, typename U4, typename U5
|
||||
>
|
||||
struct resolve_bind_arg<
|
||||
bind3< F,T1,T2,T3 >, U1, U2, U3, U4, U5
|
||||
>
|
||||
{
|
||||
typedef bind3< F,T1,T2,T3 > f_;
|
||||
typedef typename apply_wrap5< f_,U1,U2,U3,U4,U5 >::type type;
|
||||
};
|
||||
|
||||
} // namespace aux
|
||||
|
||||
BOOST_MPL_AUX_ARITY_SPEC(4, bind3)
|
||||
BOOST_MPL_AUX_TEMPLATE_ARITY_SPEC(4, bind3)
|
||||
|
||||
template<
|
||||
typename F, typename T1, typename T2, typename T3, int dummy_
|
||||
>
|
||||
struct bind< F,T1,T2,T3,na,na >
|
||||
: bind3< F,T1,T2,T3 >
|
||||
{
|
||||
};
|
||||
|
||||
template<
|
||||
typename F, typename T1, typename T2, typename T3, typename T4
|
||||
, int dummy_
|
||||
>
|
||||
struct bind4
|
||||
{
|
||||
template<
|
||||
typename U1 = na, typename U2 = na, typename U3 = na
|
||||
, typename U4 = na, typename U5 = na
|
||||
>
|
||||
struct apply
|
||||
{
|
||||
private:
|
||||
typedef typename aux::resolve_bind_arg< F,U1,U2,U3,U4,U5 >::type f_;
|
||||
typedef aux::resolve_bind_arg< T1,U1,U2,U3,U4,U5 > t1;
|
||||
typedef aux::resolve_bind_arg< T2,U1,U2,U3,U4,U5 > t2;
|
||||
typedef aux::resolve_bind_arg< T3,U1,U2,U3,U4,U5 > t3;
|
||||
typedef aux::resolve_bind_arg< T4,U1,U2,U3,U4,U5 > t4;
|
||||
|
||||
public:
|
||||
typedef typename apply_wrap4<
|
||||
f_
|
||||
, typename t1::type, typename t2::type, typename t3::type
|
||||
, typename t4::type
|
||||
>::type type;
|
||||
|
||||
};
|
||||
};
|
||||
|
||||
namespace aux {
|
||||
|
||||
template<
|
||||
typename F, typename T1, typename T2, typename T3, typename T4
|
||||
, typename U1, typename U2, typename U3, typename U4, typename U5
|
||||
>
|
||||
struct resolve_bind_arg<
|
||||
bind4< F,T1,T2,T3,T4 >, U1, U2, U3, U4, U5
|
||||
>
|
||||
{
|
||||
typedef bind4< F,T1,T2,T3,T4 > f_;
|
||||
typedef typename apply_wrap5< f_,U1,U2,U3,U4,U5 >::type type;
|
||||
};
|
||||
|
||||
} // namespace aux
|
||||
|
||||
BOOST_MPL_AUX_ARITY_SPEC(5, bind4)
|
||||
BOOST_MPL_AUX_TEMPLATE_ARITY_SPEC(5, bind4)
|
||||
|
||||
template<
|
||||
typename F, typename T1, typename T2, typename T3, typename T4
|
||||
, int dummy_
|
||||
>
|
||||
struct bind< F,T1,T2,T3,T4,na >
|
||||
: bind4< F,T1,T2,T3,T4 >
|
||||
{
|
||||
};
|
||||
|
||||
template<
|
||||
typename F, typename T1, typename T2, typename T3, typename T4
|
||||
, typename T5, int dummy_
|
||||
>
|
||||
struct bind5
|
||||
{
|
||||
template<
|
||||
typename U1 = na, typename U2 = na, typename U3 = na
|
||||
, typename U4 = na, typename U5 = na
|
||||
>
|
||||
struct apply
|
||||
{
|
||||
private:
|
||||
typedef typename aux::resolve_bind_arg< F,U1,U2,U3,U4,U5 >::type f_;
|
||||
typedef aux::resolve_bind_arg< T1,U1,U2,U3,U4,U5 > t1;
|
||||
typedef aux::resolve_bind_arg< T2,U1,U2,U3,U4,U5 > t2;
|
||||
typedef aux::resolve_bind_arg< T3,U1,U2,U3,U4,U5 > t3;
|
||||
typedef aux::resolve_bind_arg< T4,U1,U2,U3,U4,U5 > t4;
|
||||
typedef aux::resolve_bind_arg< T5,U1,U2,U3,U4,U5 > t5;
|
||||
|
||||
public:
|
||||
typedef typename apply_wrap5<
|
||||
f_
|
||||
, typename t1::type, typename t2::type, typename t3::type
|
||||
, typename t4::type, typename t5::type
|
||||
>::type type;
|
||||
|
||||
};
|
||||
};
|
||||
|
||||
namespace aux {
|
||||
|
||||
template<
|
||||
typename F, typename T1, typename T2, typename T3, typename T4
|
||||
, typename T5, typename U1, typename U2, typename U3, typename U4
|
||||
, typename U5
|
||||
>
|
||||
struct resolve_bind_arg<
|
||||
bind5< F,T1,T2,T3,T4,T5 >, U1, U2, U3, U4, U5
|
||||
>
|
||||
{
|
||||
typedef bind5< F,T1,T2,T3,T4,T5 > f_;
|
||||
typedef typename apply_wrap5< f_,U1,U2,U3,U4,U5 >::type type;
|
||||
};
|
||||
|
||||
} // namespace aux
|
||||
|
||||
BOOST_MPL_AUX_ARITY_SPEC(6, bind5)
|
||||
BOOST_MPL_AUX_TEMPLATE_ARITY_SPEC(6, bind5)
|
||||
|
||||
/// primary template (not a specialization!)
|
||||
|
||||
template<
|
||||
typename F, typename T1, typename T2, typename T3, typename T4
|
||||
, typename T5, int dummy_
|
||||
>
|
||||
struct bind
|
||||
: bind5< F,T1,T2,T3,T4,T5 >
|
||||
{
|
||||
};
|
||||
|
||||
/// if_/eval_if specializations
|
||||
template< template< typename T1, typename T2, typename T3 > class F, typename Tag >
|
||||
struct quote3;
|
||||
|
||||
template< typename T1, typename T2, typename T3 > struct if_;
|
||||
|
||||
template<
|
||||
typename Tag, typename T1, typename T2, typename T3
|
||||
>
|
||||
struct bind3<
|
||||
quote3< if_,Tag >
|
||||
, T1, T2, T3
|
||||
>
|
||||
{
|
||||
template<
|
||||
typename U1 = na, typename U2 = na, typename U3 = na
|
||||
, typename U4 = na, typename U5 = na
|
||||
>
|
||||
struct apply
|
||||
{
|
||||
private:
|
||||
typedef mpl::arg<1> n1;
|
||||
typedef aux::resolve_bind_arg< T1,U1,U2,U3,U4,U5 > t1;
|
||||
typedef aux::resolve_bind_arg< T2,U1,U2,U3,U4,U5 > t2;
|
||||
typedef aux::resolve_bind_arg< T3,U1,U2,U3,U4,U5 > t3;
|
||||
typedef typename if_<
|
||||
typename t1::type
|
||||
, t2, t3
|
||||
>::type f_;
|
||||
|
||||
public:
|
||||
typedef typename f_::type type;
|
||||
};
|
||||
};
|
||||
|
||||
}}
|
||||
|
||||
@@ -0,0 +1,256 @@
|
||||
/* boost integer_traits.hpp header file
|
||||
*
|
||||
* Copyright Jens Maurer 2000
|
||||
* 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)
|
||||
*
|
||||
* $Id$
|
||||
*
|
||||
* Idea by Beman Dawes, Ed Brey, Steve Cleary, and Nathan Myers
|
||||
*/
|
||||
|
||||
// See http://www.boost.org/libs/integer for documentation.
|
||||
|
||||
|
||||
#ifndef BOOST_INTEGER_TRAITS_HPP
|
||||
#define BOOST_INTEGER_TRAITS_HPP
|
||||
|
||||
#include <boost/config.hpp>
|
||||
#include <boost/limits.hpp>
|
||||
|
||||
// These are an implementation detail and not part of the interface
|
||||
#include <limits.h>
|
||||
// we need wchar.h for WCHAR_MAX/MIN but not all platforms provide it,
|
||||
// and some may have <wchar.h> but not <cwchar> ...
|
||||
#if !defined(BOOST_NO_INTRINSIC_WCHAR_T) && (!defined(BOOST_NO_CWCHAR) || defined(sun) || defined(__sun) || defined(__QNX__))
|
||||
#include <wchar.h>
|
||||
#endif
|
||||
|
||||
//
|
||||
// We simply cannot include this header on gcc without getting copious warnings of the kind:
|
||||
//
|
||||
// ../../../boost/integer_traits.hpp:164:66: warning: use of C99 long long integer constant
|
||||
//
|
||||
// And yet there is no other reasonable implementation, so we declare this a system header
|
||||
// to suppress these warnings.
|
||||
//
|
||||
#if defined(__GNUC__) && (__GNUC__ >= 4)
|
||||
#pragma GCC system_header
|
||||
#endif
|
||||
|
||||
namespace boost {
|
||||
template<class T>
|
||||
class integer_traits : public std::numeric_limits<T>
|
||||
{
|
||||
public:
|
||||
BOOST_STATIC_CONSTANT(bool, is_integral = false);
|
||||
};
|
||||
|
||||
namespace detail {
|
||||
template<class T, T min_val, T max_val>
|
||||
class integer_traits_base
|
||||
{
|
||||
public:
|
||||
BOOST_STATIC_CONSTANT(bool, is_integral = true);
|
||||
BOOST_STATIC_CONSTANT(T, const_min = min_val);
|
||||
BOOST_STATIC_CONSTANT(T, const_max = max_val);
|
||||
};
|
||||
|
||||
#ifndef BOOST_NO_INCLASS_MEMBER_INITIALIZATION
|
||||
// A definition is required even for integral static constants
|
||||
template<class T, T min_val, T max_val>
|
||||
const bool integer_traits_base<T, min_val, max_val>::is_integral;
|
||||
|
||||
template<class T, T min_val, T max_val>
|
||||
const T integer_traits_base<T, min_val, max_val>::const_min;
|
||||
|
||||
template<class T, T min_val, T max_val>
|
||||
const T integer_traits_base<T, min_val, max_val>::const_max;
|
||||
#endif
|
||||
|
||||
} // namespace detail
|
||||
|
||||
template<>
|
||||
class integer_traits<bool>
|
||||
: public std::numeric_limits<bool>,
|
||||
public detail::integer_traits_base<bool, false, true>
|
||||
{ };
|
||||
|
||||
template<>
|
||||
class integer_traits<char>
|
||||
: public std::numeric_limits<char>,
|
||||
public detail::integer_traits_base<char, CHAR_MIN, CHAR_MAX>
|
||||
{ };
|
||||
|
||||
template<>
|
||||
class integer_traits<signed char>
|
||||
: public std::numeric_limits<signed char>,
|
||||
public detail::integer_traits_base<signed char, SCHAR_MIN, SCHAR_MAX>
|
||||
{ };
|
||||
|
||||
template<>
|
||||
class integer_traits<unsigned char>
|
||||
: public std::numeric_limits<unsigned char>,
|
||||
public detail::integer_traits_base<unsigned char, 0, UCHAR_MAX>
|
||||
{ };
|
||||
|
||||
#ifndef BOOST_NO_INTRINSIC_WCHAR_T
|
||||
template<>
|
||||
class integer_traits<wchar_t>
|
||||
: public std::numeric_limits<wchar_t>,
|
||||
// Don't trust WCHAR_MIN and WCHAR_MAX with Mac OS X's native
|
||||
// library: they are wrong!
|
||||
#if defined(WCHAR_MIN) && defined(WCHAR_MAX) && !defined(__APPLE__)
|
||||
public detail::integer_traits_base<wchar_t, WCHAR_MIN, WCHAR_MAX>
|
||||
#elif defined(__BORLANDC__) || defined(__CYGWIN__) || defined(__MINGW32__) || (defined(__BEOS__) && defined(__GNUC__))
|
||||
// No WCHAR_MIN and WCHAR_MAX, whar_t is short and unsigned:
|
||||
public detail::integer_traits_base<wchar_t, 0, 0xffff>
|
||||
#elif (defined(__sgi) && (!defined(__SGI_STL_PORT) || __SGI_STL_PORT < 0x400))\
|
||||
|| (defined __APPLE__)\
|
||||
|| (defined(__OpenBSD__) && defined(__GNUC__))\
|
||||
|| (defined(__NetBSD__) && defined(__GNUC__))\
|
||||
|| (defined(__FreeBSD__) && defined(__GNUC__))\
|
||||
|| (defined(__DragonFly__) && defined(__GNUC__))\
|
||||
|| (defined(__hpux) && defined(__GNUC__) && (__GNUC__ == 3) && !defined(__SGI_STL_PORT))
|
||||
// No WCHAR_MIN and WCHAR_MAX, wchar_t has the same range as int.
|
||||
// - SGI MIPSpro with native library
|
||||
// - gcc 3.x on HP-UX
|
||||
// - Mac OS X with native library
|
||||
// - gcc on FreeBSD, OpenBSD and NetBSD
|
||||
public detail::integer_traits_base<wchar_t, INT_MIN, INT_MAX>
|
||||
#else
|
||||
#error No WCHAR_MIN and WCHAR_MAX present, please adjust integer_traits<> for your compiler.
|
||||
#endif
|
||||
{ };
|
||||
#endif // BOOST_NO_INTRINSIC_WCHAR_T
|
||||
|
||||
template<>
|
||||
class integer_traits<short>
|
||||
: public std::numeric_limits<short>,
|
||||
public detail::integer_traits_base<short, SHRT_MIN, SHRT_MAX>
|
||||
{ };
|
||||
|
||||
template<>
|
||||
class integer_traits<unsigned short>
|
||||
: public std::numeric_limits<unsigned short>,
|
||||
public detail::integer_traits_base<unsigned short, 0, USHRT_MAX>
|
||||
{ };
|
||||
|
||||
template<>
|
||||
class integer_traits<int>
|
||||
: public std::numeric_limits<int>,
|
||||
public detail::integer_traits_base<int, INT_MIN, INT_MAX>
|
||||
{ };
|
||||
|
||||
template<>
|
||||
class integer_traits<unsigned int>
|
||||
: public std::numeric_limits<unsigned int>,
|
||||
public detail::integer_traits_base<unsigned int, 0, UINT_MAX>
|
||||
{ };
|
||||
|
||||
template<>
|
||||
class integer_traits<long>
|
||||
: public std::numeric_limits<long>,
|
||||
public detail::integer_traits_base<long, LONG_MIN, LONG_MAX>
|
||||
{ };
|
||||
|
||||
template<>
|
||||
class integer_traits<unsigned long>
|
||||
: public std::numeric_limits<unsigned long>,
|
||||
public detail::integer_traits_base<unsigned long, 0, ULONG_MAX>
|
||||
{ };
|
||||
|
||||
#if !defined(BOOST_NO_INTEGRAL_INT64_T) && !defined(BOOST_NO_INT64_T)
|
||||
#if defined(ULLONG_MAX) && defined(BOOST_HAS_LONG_LONG)
|
||||
|
||||
template<>
|
||||
class integer_traits< ::boost::long_long_type>
|
||||
: public std::numeric_limits< ::boost::long_long_type>,
|
||||
public detail::integer_traits_base< ::boost::long_long_type, LLONG_MIN, LLONG_MAX>
|
||||
{ };
|
||||
|
||||
template<>
|
||||
class integer_traits< ::boost::ulong_long_type>
|
||||
: public std::numeric_limits< ::boost::ulong_long_type>,
|
||||
public detail::integer_traits_base< ::boost::ulong_long_type, 0, ULLONG_MAX>
|
||||
{ };
|
||||
|
||||
#elif defined(ULONG_LONG_MAX) && defined(BOOST_HAS_LONG_LONG)
|
||||
|
||||
template<>
|
||||
class integer_traits< ::boost::long_long_type> : public std::numeric_limits< ::boost::long_long_type>, public detail::integer_traits_base< ::boost::long_long_type, LONG_LONG_MIN, LONG_LONG_MAX>{ };
|
||||
template<>
|
||||
class integer_traits< ::boost::ulong_long_type>
|
||||
: public std::numeric_limits< ::boost::ulong_long_type>,
|
||||
public detail::integer_traits_base< ::boost::ulong_long_type, 0, ULONG_LONG_MAX>
|
||||
{ };
|
||||
|
||||
#elif defined(ULONGLONG_MAX) && defined(BOOST_HAS_LONG_LONG)
|
||||
|
||||
template<>
|
||||
class integer_traits< ::boost::long_long_type>
|
||||
: public std::numeric_limits< ::boost::long_long_type>,
|
||||
public detail::integer_traits_base< ::boost::long_long_type, LONGLONG_MIN, LONGLONG_MAX>
|
||||
{ };
|
||||
|
||||
template<>
|
||||
class integer_traits< ::boost::ulong_long_type>
|
||||
: public std::numeric_limits< ::boost::ulong_long_type>,
|
||||
public detail::integer_traits_base< ::boost::ulong_long_type, 0, ULONGLONG_MAX>
|
||||
{ };
|
||||
|
||||
#elif defined(_LLONG_MAX) && defined(_C2) && defined(BOOST_HAS_LONG_LONG)
|
||||
|
||||
template<>
|
||||
class integer_traits< ::boost::long_long_type>
|
||||
: public std::numeric_limits< ::boost::long_long_type>,
|
||||
public detail::integer_traits_base< ::boost::long_long_type, -_LLONG_MAX - _C2, _LLONG_MAX>
|
||||
{ };
|
||||
|
||||
template<>
|
||||
class integer_traits< ::boost::ulong_long_type>
|
||||
: public std::numeric_limits< ::boost::ulong_long_type>,
|
||||
public detail::integer_traits_base< ::boost::ulong_long_type, 0, _ULLONG_MAX>
|
||||
{ };
|
||||
|
||||
#elif defined(BOOST_HAS_LONG_LONG)
|
||||
//
|
||||
// we have long long but no constants, this happens for example with gcc in -ansi mode,
|
||||
// we'll just have to work out the values for ourselves (assumes 2's compliment representation):
|
||||
//
|
||||
template<>
|
||||
class integer_traits< ::boost::long_long_type>
|
||||
: public std::numeric_limits< ::boost::long_long_type>,
|
||||
public detail::integer_traits_base< ::boost::long_long_type, (1LL << (sizeof(::boost::long_long_type) * CHAR_BIT - 1)), ~(1LL << (sizeof(::boost::long_long_type) * CHAR_BIT - 1))>
|
||||
{ };
|
||||
|
||||
template<>
|
||||
class integer_traits< ::boost::ulong_long_type>
|
||||
: public std::numeric_limits< ::boost::ulong_long_type>,
|
||||
public detail::integer_traits_base< ::boost::ulong_long_type, 0, ~0uLL>
|
||||
{ };
|
||||
|
||||
#elif defined(BOOST_HAS_MS_INT64)
|
||||
|
||||
template<>
|
||||
class integer_traits< __int64>
|
||||
: public std::numeric_limits< __int64>,
|
||||
public detail::integer_traits_base< __int64, _I64_MIN, _I64_MAX>
|
||||
{ };
|
||||
|
||||
template<>
|
||||
class integer_traits< unsigned __int64>
|
||||
: public std::numeric_limits< unsigned __int64>,
|
||||
public detail::integer_traits_base< unsigned __int64, 0, _UI64_MAX>
|
||||
{ };
|
||||
|
||||
#endif
|
||||
#endif
|
||||
|
||||
} // namespace boost
|
||||
|
||||
#endif /* BOOST_INTEGER_TRAITS_HPP */
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,8 @@
|
||||
// (C) Copyright John Maddock 2003.
|
||||
// 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)
|
||||
|
||||
#pragma pack(pop)
|
||||
|
||||
|
||||
@@ -0,0 +1,50 @@
|
||||
/* Copyright 2003-2008 Joaquin M Lopez Munoz.
|
||||
* 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)
|
||||
*
|
||||
* See http://www.boost.org/libs/multi_index for library home page.
|
||||
*/
|
||||
|
||||
#ifndef BOOST_MULTI_INDEX_DETAIL_HEADER_HOLDER_HPP
|
||||
#define BOOST_MULTI_INDEX_DETAIL_HEADER_HOLDER_HPP
|
||||
|
||||
#if defined(_MSC_VER)
|
||||
#pragma once
|
||||
#endif
|
||||
|
||||
#include <boost/noncopyable.hpp>
|
||||
|
||||
namespace boost{
|
||||
|
||||
namespace multi_index{
|
||||
|
||||
namespace detail{
|
||||
|
||||
/* A utility class used to hold a pointer to the header node.
|
||||
* The base from member idiom is used because index classes, which are
|
||||
* superclasses of multi_index_container, need this header in construction
|
||||
* time. The allocation is made by the allocator of the multi_index_container
|
||||
* class --hence, this allocator needs also be stored resorting
|
||||
* to the base from member trick.
|
||||
*/
|
||||
|
||||
template<typename NodeTypePtr,typename Final>
|
||||
struct header_holder:private noncopyable
|
||||
{
|
||||
header_holder():member(final().allocate_node()){}
|
||||
~header_holder(){final().deallocate_node(&*member);}
|
||||
|
||||
NodeTypePtr member;
|
||||
|
||||
private:
|
||||
Final& final(){return *static_cast<Final*>(this);}
|
||||
};
|
||||
|
||||
} /* namespace multi_index::detail */
|
||||
|
||||
} /* namespace multi_index */
|
||||
|
||||
} /* namespace boost */
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,44 @@
|
||||
|
||||
#ifndef BOOST_MPL_MAP_MAP40_HPP_INCLUDED
|
||||
#define BOOST_MPL_MAP_MAP40_HPP_INCLUDED
|
||||
|
||||
// Copyright Aleksey Gurtovoy 2000-2004
|
||||
// Copyright David Abrahams 2003-2004
|
||||
//
|
||||
// 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)
|
||||
//
|
||||
// See http://www.boost.org/libs/mpl for documentation.
|
||||
|
||||
// $Id$
|
||||
// $Date$
|
||||
// $Revision$
|
||||
|
||||
#if !defined(BOOST_MPL_PREPROCESSING_MODE)
|
||||
# include <boost/mpl/map/map30.hpp>
|
||||
#endif
|
||||
|
||||
#include <boost/mpl/aux_/config/use_preprocessed.hpp>
|
||||
|
||||
#if !defined(BOOST_MPL_CFG_NO_PREPROCESSED_HEADERS) \
|
||||
&& !defined(BOOST_MPL_PREPROCESSING_MODE)
|
||||
|
||||
# define BOOST_MPL_PREPROCESSED_HEADER map40.hpp
|
||||
# include <boost/mpl/map/aux_/include_preprocessed.hpp>
|
||||
|
||||
#else
|
||||
|
||||
# include <boost/preprocessor/iterate.hpp>
|
||||
|
||||
namespace boost { namespace mpl {
|
||||
|
||||
# define BOOST_PP_ITERATION_PARAMS_1 \
|
||||
(3,(31, 40, <boost/mpl/map/aux_/numbered.hpp>))
|
||||
# include BOOST_PP_ITERATE()
|
||||
|
||||
}}
|
||||
|
||||
#endif // BOOST_MPL_CFG_NO_PREPROCESSED_HEADERS
|
||||
|
||||
#endif // BOOST_MPL_MAP_MAP40_HPP_INCLUDED
|
||||
@@ -0,0 +1,99 @@
|
||||
// Status=review
|
||||
|
||||
The following controls appear at the bottom of the Wide Graph window.
|
||||
With the exception of *JT65 nnnn JT9* (when operating in JT9+JT65
|
||||
mode), they affect only the graphical displays. They have no effect
|
||||
on the decoding process.
|
||||
|
||||
image::wide-graph-controls.png[align="center",alt="Wide Graph Controls"]
|
||||
|
||||
- *Bins/Pixel* controls the displayed frequency resolution. Set this
|
||||
value to 1 for the highest possible resolution, or to higher numbers
|
||||
to compress the spectral display. Normal operation with a convenient
|
||||
window size works well at 2 to 8 bins per pixel.
|
||||
|
||||
- *JT65 nnnn JT9* sets the dividing point (blue marker) for wide-band
|
||||
decoding of JT65 and JT9 signals in *JT9+JT65* mode. The decoder
|
||||
looks for JT65 signals everywhere, but JT9 signals only above this
|
||||
frequency. This setting is stored separately for each band.
|
||||
|
||||
- *Start nnn Hz* sets the low-frequency starting point of the
|
||||
waterfall frequency scale.
|
||||
|
||||
- *N Avg* is the number of successive spectra to be averaged before
|
||||
updating the display. Values around 5 are suitable for normal JT9 and
|
||||
JT65 operation. Adjust *N Avg* to make the waterfall move faster or
|
||||
slower, as desired.
|
||||
|
||||
- A dropdown list below the *Palette* label lets you select from a
|
||||
wide range of waterfall color palettes.
|
||||
|
||||
- Click *Adjust* to activate a window that allows you to create a
|
||||
user-defined palette.
|
||||
|
||||
- Check *Flatten* if you want _WSJT-X_ to compensate for a sloping or
|
||||
uneven response across the received passband. For this feature to
|
||||
work properly, you should restrict the range of displayed frequencies
|
||||
so that only the active part of the spectrum is shown.
|
||||
|
||||
- Select *Current* or *Cumulative* for the spectrum displayed in the
|
||||
bottom one-third of the Wide Graph window. *Current* is the average
|
||||
spectrum over the most recent *N Avg* FFT calculations. *Cumulative*
|
||||
is the average spectrum since the start of the present UTC minute.
|
||||
*Linear Avg* is useful in JT4 mode, especially when short-form
|
||||
messages are used.
|
||||
|
||||
- Four sliders control reference levels and scaling for waterfall
|
||||
colors and the spectrum plot. Values around midscale are usually
|
||||
about right, depending on the input signal level, the chosen palette,
|
||||
and your own preferences. Hover the mouse over a control to display a
|
||||
tip reminding you of its function.
|
||||
|
||||
- *Smoothing* is active only when *Linear Average* has been selected.
|
||||
Smoothing the displayed spectrum over more than one bin can enhance
|
||||
your ability to detect weak EME signals with Doppler spread more than
|
||||
a few Hz.
|
||||
|
||||
[[CONTROLS_FAST]]
|
||||
=== Fast Graph
|
||||
|
||||
The waterfall palette used for the Fast Graph is the same as the one
|
||||
selected on the Wide Graph. Three sliders at the bottom of the Fast
|
||||
Graph window can be used to optimize gain and zero-offset for the
|
||||
displayed information. Hover the mouse over a control to display a
|
||||
tip reminding you of its function. Clicking the *Auto Level* button
|
||||
will produce reasonable settings as a starting point.
|
||||
|
||||
image::fast-graph-controls.png[align="center",alt="Fast Graph Controls"]
|
||||
|
||||
[[CONTROLS_ECHO]]
|
||||
=== Echo Graph
|
||||
|
||||
The following controls appear at the bottom of the Echo Graph:
|
||||
|
||||
image::echo-graph-controls.png[align="center",alt="EchoGraph Controls"]
|
||||
|
||||
- *Bins/Pixel* controls the displayed frequency resolution. Set this
|
||||
value to 1 for the highest possible resolution, or to higher numbers
|
||||
to compress the spectral display.
|
||||
|
||||
- *Gain* and *Zero* sliders control scaling and offset of plotted
|
||||
spectra.
|
||||
|
||||
- *Smooth* values greater than 0 apply running averages to the plotted
|
||||
spectra, thereby smoothing the curves over multiple bins.
|
||||
|
||||
- Label *N* shows the number of echo pulses averaged.
|
||||
|
||||
- Click the *Colors* button to cycle through 6 possible choices of
|
||||
color and line width for the plots.
|
||||
|
||||
[[CONTROLS_MISCELLANEOUS]]
|
||||
=== Miscellaneous
|
||||
|
||||
Most windows can be resized as desired. If you are short of screen
|
||||
space you can make the Main Window and Wide Graph smaller by hiding
|
||||
some controls and labels. To enable this feature type *Ctrl+M* with
|
||||
focus on the appropriate window. (For the Main Window you can select
|
||||
*Hide menus and labels* on the *View* menu.) Type *Ctrl+M* again
|
||||
to make the controls visible once more.
|
||||
@@ -0,0 +1,18 @@
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// (C) Copyright Ion Gaztanaga 2012-2012. 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)
|
||||
//
|
||||
// See http://www.boost.org/libs/interprocess for documentation.
|
||||
//
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
#ifndef BOOST_INTERPROCESS_EXTERNAL_CONFIG_INCLUDED
|
||||
#define BOOST_INTERPROCESS_EXTERNAL_CONFIG_INCLUDED
|
||||
#include <boost/config.hpp>
|
||||
#endif
|
||||
|
||||
#if defined(__GNUC__) && ((__GNUC__*100 + __GNUC_MINOR__) >= 406)
|
||||
# pragma GCC diagnostic push
|
||||
# pragma GCC diagnostic ignored "-Wshadow"
|
||||
#endif
|
||||
@@ -0,0 +1,27 @@
|
||||
subroutine chkcrc12(decoded,nbadcrc)
|
||||
|
||||
use crc
|
||||
integer*1 decoded(84)
|
||||
integer*1, target:: i1Dec8BitBytes(11)
|
||||
|
||||
! Check the CRC
|
||||
! Collapse 84 decoded bits to 11 bytes. Bytes 1-9 are the message,
|
||||
! byte 10 and first half of byte 11 is the crc
|
||||
do ibyte=1,9
|
||||
itmp=0
|
||||
do ibit=1,8
|
||||
itmp=ishft(itmp,1)+iand(1,decoded((ibyte-1)*8+ibit))
|
||||
enddo
|
||||
i1Dec8BitBytes(ibyte)=itmp
|
||||
enddo
|
||||
|
||||
! Pack the crc into bytes 10 and 11 for crc12_check
|
||||
i1Dec8BitBytes(10)=decoded(73)*8 + decoded(74)*4 + decoded(75)*2 + decoded(76)
|
||||
i1Dec8BitBytes(11)=decoded(77)*128 + decoded(78)*64 + &
|
||||
decoded(79)*32 + decoded(80)*16 + decoded(81)*8 + decoded(82)*4 + &
|
||||
decoded(83)*2 + decoded(84)
|
||||
nbadcrc=1
|
||||
if( crc12_check(c_loc (i1Dec8BitBytes), 11) ) nbadcrc=0
|
||||
|
||||
return
|
||||
end subroutine chkcrc12
|
||||
@@ -0,0 +1,90 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 1998-2003 Joel de Guzman
|
||||
Copyright (c) 2001 Daniel Nuffer
|
||||
Copyright (c) 2002 Hartmut Kaiser
|
||||
http://spirit.sourceforge.net/
|
||||
|
||||
Use, modification and distribution is 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)
|
||||
=============================================================================*/
|
||||
#if !defined(BOOST_SPIRIT_DIFFERENCE_IPP)
|
||||
#define BOOST_SPIRIT_DIFFERENCE_IPP
|
||||
|
||||
namespace boost { namespace spirit {
|
||||
|
||||
BOOST_SPIRIT_CLASSIC_NAMESPACE_BEGIN
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// difference class implementation
|
||||
//
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
template <typename A, typename B>
|
||||
inline difference<A, B>
|
||||
operator-(parser<A> const& a, parser<B> const& b)
|
||||
{
|
||||
return difference<A, B>(a.derived(), b.derived());
|
||||
}
|
||||
|
||||
template <typename A>
|
||||
inline difference<A, chlit<char> >
|
||||
operator-(parser<A> const& a, char b)
|
||||
{
|
||||
return difference<A, chlit<char> >(a.derived(), b);
|
||||
}
|
||||
|
||||
template <typename B>
|
||||
inline difference<chlit<char>, B>
|
||||
operator-(char a, parser<B> const& b)
|
||||
{
|
||||
return difference<chlit<char>, B>(a, b.derived());
|
||||
}
|
||||
|
||||
template <typename A>
|
||||
inline difference<A, strlit<char const*> >
|
||||
operator-(parser<A> const& a, char const* b)
|
||||
{
|
||||
return difference<A, strlit<char const*> >(a.derived(), b);
|
||||
}
|
||||
|
||||
template <typename B>
|
||||
inline difference<strlit<char const*>, B>
|
||||
operator-(char const* a, parser<B> const& b)
|
||||
{
|
||||
return difference<strlit<char const*>, B>(a, b.derived());
|
||||
}
|
||||
|
||||
template <typename A>
|
||||
inline difference<A, chlit<wchar_t> >
|
||||
operator-(parser<A> const& a, wchar_t b)
|
||||
{
|
||||
return difference<A, chlit<wchar_t> >(a.derived(), b);
|
||||
}
|
||||
|
||||
template <typename B>
|
||||
inline difference<chlit<wchar_t>, B>
|
||||
operator-(wchar_t a, parser<B> const& b)
|
||||
{
|
||||
return difference<chlit<wchar_t>, B>(a, b.derived());
|
||||
}
|
||||
|
||||
template <typename A>
|
||||
inline difference<A, strlit<wchar_t const*> >
|
||||
operator-(parser<A> const& a, wchar_t const* b)
|
||||
{
|
||||
return difference<A, strlit<wchar_t const*> >(a.derived(), b);
|
||||
}
|
||||
|
||||
template <typename B>
|
||||
inline difference<strlit<wchar_t const*>, B>
|
||||
operator-(wchar_t const* a, parser<B> const& b)
|
||||
{
|
||||
return difference<strlit<wchar_t const*>, B>(a, b.derived());
|
||||
}
|
||||
|
||||
BOOST_SPIRIT_CLASSIC_NAMESPACE_END
|
||||
|
||||
}} // namespace boost::spirit
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user