Initial Commit
This commit is contained in:
@@ -0,0 +1,40 @@
|
||||
// (C) Copyright 2009-2011 Frederic Bron.
|
||||
//
|
||||
// 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).
|
||||
//
|
||||
// See http://www.boost.org/libs/type_traits for most recent version including documentation.
|
||||
|
||||
#ifndef BOOST_TT_HAS_LOGICAL_AND_HPP_INCLUDED
|
||||
#define BOOST_TT_HAS_LOGICAL_AND_HPP_INCLUDED
|
||||
|
||||
#define BOOST_TT_TRAIT_NAME has_logical_and
|
||||
#define BOOST_TT_TRAIT_OP &&
|
||||
#define BOOST_TT_FORBIDDEN_IF\
|
||||
/* pointer with fundamental non convertible to bool */\
|
||||
(\
|
||||
(\
|
||||
::boost::is_pointer< Lhs_noref >::value && \
|
||||
( \
|
||||
::boost::is_fundamental< Rhs_nocv >::value && \
|
||||
(! ::boost::is_convertible< Rhs_nocv, bool >::value )\
|
||||
)\
|
||||
)||\
|
||||
(\
|
||||
::boost::is_pointer< Rhs_noref >::value && \
|
||||
( \
|
||||
::boost::is_fundamental< Lhs_nocv >::value && \
|
||||
(! ::boost::is_convertible< Lhs_nocv, bool >::value )\
|
||||
)\
|
||||
)\
|
||||
)
|
||||
|
||||
|
||||
#include <boost/type_traits/detail/has_binary_operator.hpp>
|
||||
|
||||
#undef BOOST_TT_TRAIT_NAME
|
||||
#undef BOOST_TT_TRAIT_OP
|
||||
#undef BOOST_TT_FORBIDDEN_IF
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,170 @@
|
||||
//---------------------------------------------------------------------------//
|
||||
// Copyright (c) 2014 Roshan <thisisroshansmail@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_SET_INTERSECTION_HPP
|
||||
#define BOOST_COMPUTE_ALGORITHM_SET_INTERSECTION_HPP
|
||||
|
||||
#include <iterator>
|
||||
|
||||
#include <boost/compute/algorithm/detail/compact.hpp>
|
||||
#include <boost/compute/algorithm/detail/balanced_path.hpp>
|
||||
#include <boost/compute/algorithm/exclusive_scan.hpp>
|
||||
#include <boost/compute/algorithm/fill_n.hpp>
|
||||
#include <boost/compute/container/vector.hpp>
|
||||
#include <boost/compute/detail/iterator_range_size.hpp>
|
||||
#include <boost/compute/detail/meta_kernel.hpp>
|
||||
#include <boost/compute/system.hpp>
|
||||
|
||||
namespace boost {
|
||||
namespace compute {
|
||||
namespace detail {
|
||||
|
||||
///
|
||||
/// \brief Serial set intersection kernel class
|
||||
///
|
||||
/// Subclass of meta_kernel to perform serial set intersection after tiling
|
||||
///
|
||||
class serial_set_intersection_kernel : meta_kernel
|
||||
{
|
||||
public:
|
||||
unsigned int tile_size;
|
||||
|
||||
serial_set_intersection_kernel() : meta_kernel("set_intersection")
|
||||
{
|
||||
tile_size = 4;
|
||||
}
|
||||
|
||||
template<class InputIterator1, class InputIterator2,
|
||||
class InputIterator3, class InputIterator4,
|
||||
class OutputIterator1, class OutputIterator2>
|
||||
void set_range(InputIterator1 first1,
|
||||
InputIterator2 first2,
|
||||
InputIterator3 tile_first1,
|
||||
InputIterator3 tile_last1,
|
||||
InputIterator4 tile_first2,
|
||||
OutputIterator1 result,
|
||||
OutputIterator2 counts)
|
||||
{
|
||||
m_count = iterator_range_size(tile_first1, tile_last1) - 1;
|
||||
|
||||
*this <<
|
||||
"uint i = get_global_id(0);\n" <<
|
||||
"uint start1 = " << tile_first1[expr<uint_>("i")] << ";\n" <<
|
||||
"uint end1 = " << tile_first1[expr<uint_>("i+1")] << ";\n" <<
|
||||
"uint start2 = " << tile_first2[expr<uint_>("i")] << ";\n" <<
|
||||
"uint end2 = " << tile_first2[expr<uint_>("i+1")] << ";\n" <<
|
||||
"uint index = i*" << tile_size << ";\n" <<
|
||||
"uint count = 0;\n" <<
|
||||
"while(start1<end1 && start2<end2)\n" <<
|
||||
"{\n" <<
|
||||
" if(" << first1[expr<uint_>("start1")] << " == " <<
|
||||
first2[expr<uint_>("start2")] << ")\n" <<
|
||||
" {\n" <<
|
||||
result[expr<uint_>("index")] <<
|
||||
" = " << first1[expr<uint_>("start1")] << ";\n" <<
|
||||
" index++; count++;\n" <<
|
||||
" start1++; start2++;\n" <<
|
||||
" }\n" <<
|
||||
" else if(" << first1[expr<uint_>("start1")] << " < " <<
|
||||
first2[expr<uint_>("start2")] << ")\n" <<
|
||||
" start1++;\n" <<
|
||||
" else start2++;\n" <<
|
||||
"}\n" <<
|
||||
counts[expr<uint_>("i")] << " = count;\n";
|
||||
}
|
||||
|
||||
event exec(command_queue &queue)
|
||||
{
|
||||
if(m_count == 0) {
|
||||
return event();
|
||||
}
|
||||
|
||||
return exec_1d(queue, 0, m_count);
|
||||
}
|
||||
|
||||
private:
|
||||
size_t m_count;
|
||||
};
|
||||
|
||||
} //end detail namespace
|
||||
|
||||
///
|
||||
/// \brief Set intersection algorithm
|
||||
///
|
||||
/// Finds the intersection of the sorted range [first1, last1) with the sorted
|
||||
/// range [first2, last2) and stores it in range starting at result
|
||||
/// \return Iterator pointing to end of intersection
|
||||
///
|
||||
/// \param first1 Iterator pointing to start of first set
|
||||
/// \param last1 Iterator pointing to end of first set
|
||||
/// \param first2 Iterator pointing to start of second set
|
||||
/// \param last2 Iterator pointing to end of second set
|
||||
/// \param result Iterator pointing to start of range in which the intersection
|
||||
/// will be stored
|
||||
/// \param queue Queue on which to execute
|
||||
///
|
||||
template<class InputIterator1, class InputIterator2, class OutputIterator>
|
||||
inline OutputIterator set_intersection(InputIterator1 first1,
|
||||
InputIterator1 last1,
|
||||
InputIterator2 first2,
|
||||
InputIterator2 last2,
|
||||
OutputIterator result,
|
||||
command_queue &queue = system::default_queue())
|
||||
{
|
||||
typedef typename std::iterator_traits<InputIterator1>::value_type value_type;
|
||||
|
||||
int tile_size = 1024;
|
||||
|
||||
int count1 = detail::iterator_range_size(first1, last1);
|
||||
int count2 = detail::iterator_range_size(first2, last2);
|
||||
|
||||
vector<uint_> tile_a((count1+count2+tile_size-1)/tile_size+1, queue.get_context());
|
||||
vector<uint_> tile_b((count1+count2+tile_size-1)/tile_size+1, queue.get_context());
|
||||
|
||||
// Tile the sets
|
||||
detail::balanced_path_kernel tiling_kernel;
|
||||
tiling_kernel.tile_size = tile_size;
|
||||
tiling_kernel.set_range(first1, last1, first2, last2,
|
||||
tile_a.begin()+1, tile_b.begin()+1);
|
||||
fill_n(tile_a.begin(), 1, 0, queue);
|
||||
fill_n(tile_b.begin(), 1, 0, queue);
|
||||
tiling_kernel.exec(queue);
|
||||
|
||||
fill_n(tile_a.end()-1, 1, count1, queue);
|
||||
fill_n(tile_b.end()-1, 1, count2, queue);
|
||||
|
||||
vector<value_type> temp_result(count1+count2, queue.get_context());
|
||||
vector<uint_> counts((count1+count2+tile_size-1)/tile_size + 1, queue.get_context());
|
||||
fill_n(counts.end()-1, 1, 0, queue);
|
||||
|
||||
// Find individual intersections
|
||||
detail::serial_set_intersection_kernel intersection_kernel;
|
||||
intersection_kernel.tile_size = tile_size;
|
||||
intersection_kernel.set_range(first1, first2, tile_a.begin(), tile_a.end(),
|
||||
tile_b.begin(), temp_result.begin(), counts.begin());
|
||||
|
||||
intersection_kernel.exec(queue);
|
||||
|
||||
exclusive_scan(counts.begin(), counts.end(), counts.begin(), queue);
|
||||
|
||||
// Compact the results
|
||||
detail::compact_kernel compact_kernel;
|
||||
compact_kernel.tile_size = tile_size;
|
||||
compact_kernel.set_range(temp_result.begin(), counts.begin(), counts.end(), result);
|
||||
|
||||
compact_kernel.exec(queue);
|
||||
|
||||
return result + (counts.end() - 1).read(queue);
|
||||
}
|
||||
|
||||
} //end compute namespace
|
||||
} //end boost namespace
|
||||
|
||||
#endif // BOOST_COMPUTE_ALGORITHM_SET_INTERSECTION_HPP
|
||||
@@ -0,0 +1,47 @@
|
||||
/*=============================================================================
|
||||
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)
|
||||
==============================================================================*/
|
||||
#if !defined(FUSION_CLEAR_10022005_1442)
|
||||
#define FUSION_CLEAR_10022005_1442
|
||||
|
||||
#include <boost/fusion/support/config.hpp>
|
||||
#include <boost/fusion/container/vector/vector_fwd.hpp>
|
||||
#include <boost/fusion/container/list/list_fwd.hpp>
|
||||
#include <boost/fusion/container/map/map_fwd.hpp>
|
||||
#include <boost/fusion/container/set/set_fwd.hpp>
|
||||
#include <boost/fusion/container/deque/deque_fwd.hpp>
|
||||
|
||||
namespace boost { namespace fusion
|
||||
{
|
||||
struct cons_tag;
|
||||
struct map_tag;
|
||||
struct set_tag;
|
||||
struct vector_tag;
|
||||
struct deque_tag;
|
||||
|
||||
namespace detail
|
||||
{
|
||||
template <typename Tag>
|
||||
struct clear;
|
||||
|
||||
template <>
|
||||
struct clear<cons_tag> : mpl::identity<list<> > {};
|
||||
|
||||
template <>
|
||||
struct clear<map_tag> : mpl::identity<map<> > {};
|
||||
|
||||
template <>
|
||||
struct clear<set_tag> : mpl::identity<set<> > {};
|
||||
|
||||
template <>
|
||||
struct clear<vector_tag> : mpl::identity<vector<> > {};
|
||||
|
||||
template <>
|
||||
struct clear<deque_tag> : mpl::identity<deque<> > {};
|
||||
}
|
||||
}}
|
||||
|
||||
#endif
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,42 @@
|
||||
/*
|
||||
Copyright Rene Rivera 2011-2015
|
||||
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_PREDEF_ARCHITECTURE_PYRAMID_H
|
||||
#define BOOST_PREDEF_ARCHITECTURE_PYRAMID_H
|
||||
|
||||
#include <boost/predef/version_number.h>
|
||||
#include <boost/predef/make.h>
|
||||
|
||||
/*`
|
||||
[heading `BOOST_ARCH_PYRAMID`]
|
||||
|
||||
Pyramid 9810 architecture.
|
||||
|
||||
[table
|
||||
[[__predef_symbol__] [__predef_version__]]
|
||||
|
||||
[[`pyr`] [__predef_detection__]]
|
||||
]
|
||||
*/
|
||||
|
||||
#define BOOST_ARCH_PYRAMID BOOST_VERSION_NUMBER_NOT_AVAILABLE
|
||||
|
||||
#if defined(pyr)
|
||||
# undef BOOST_ARCH_PYRAMID
|
||||
# define BOOST_ARCH_PYRAMID BOOST_VERSION_NUMBER_AVAILABLE
|
||||
#endif
|
||||
|
||||
#if BOOST_ARCH_PYRAMID
|
||||
# define BOOST_ARCH_PYRAMID_AVAILABLE
|
||||
#endif
|
||||
|
||||
#define BOOST_ARCH_PYRAMID_NAME "Pyramid 9810"
|
||||
|
||||
#endif
|
||||
|
||||
#include <boost/predef/detail/test.h>
|
||||
BOOST_PREDEF_DECLARE_TEST(BOOST_ARCH_PYRAMID,BOOST_ARCH_PYRAMID_NAME)
|
||||
@@ -0,0 +1,517 @@
|
||||
/*==============================================================================
|
||||
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)
|
||||
==============================================================================*/
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
template <typename T, typename A0>
|
||||
inline
|
||||
typename expression::construct<detail::target<T>, A0>::type const
|
||||
construct(A0 const& a0)
|
||||
{
|
||||
return
|
||||
expression::
|
||||
construct<detail::target<T>, A0>::
|
||||
make(detail::target<T>(), a0);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
template <typename T, typename A0 , typename A1>
|
||||
inline
|
||||
typename expression::construct<detail::target<T>, A0 , A1>::type const
|
||||
construct(A0 const& a0 , A1 const& a1)
|
||||
{
|
||||
return
|
||||
expression::
|
||||
construct<detail::target<T>, A0 , A1>::
|
||||
make(detail::target<T>(), a0 , a1);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
template <typename T, typename A0 , typename A1 , typename A2>
|
||||
inline
|
||||
typename expression::construct<detail::target<T>, A0 , A1 , A2>::type const
|
||||
construct(A0 const& a0 , A1 const& a1 , A2 const& a2)
|
||||
{
|
||||
return
|
||||
expression::
|
||||
construct<detail::target<T>, A0 , A1 , A2>::
|
||||
make(detail::target<T>(), a0 , a1 , a2);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
template <typename T, typename A0 , typename A1 , typename A2 , typename A3>
|
||||
inline
|
||||
typename expression::construct<detail::target<T>, A0 , A1 , A2 , A3>::type const
|
||||
construct(A0 const& a0 , A1 const& a1 , A2 const& a2 , A3 const& a3)
|
||||
{
|
||||
return
|
||||
expression::
|
||||
construct<detail::target<T>, A0 , A1 , A2 , A3>::
|
||||
make(detail::target<T>(), a0 , a1 , a2 , a3);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
template <typename T, typename A0 , typename A1 , typename A2 , typename A3 , typename A4>
|
||||
inline
|
||||
typename expression::construct<detail::target<T>, A0 , A1 , A2 , A3 , A4>::type const
|
||||
construct(A0 const& a0 , A1 const& a1 , A2 const& a2 , A3 const& a3 , A4 const& a4)
|
||||
{
|
||||
return
|
||||
expression::
|
||||
construct<detail::target<T>, A0 , A1 , A2 , A3 , A4>::
|
||||
make(detail::target<T>(), a0 , a1 , a2 , a3 , a4);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
template <typename T, typename A0 , typename A1 , typename A2 , typename A3 , typename A4 , typename A5>
|
||||
inline
|
||||
typename expression::construct<detail::target<T>, A0 , A1 , A2 , A3 , A4 , A5>::type const
|
||||
construct(A0 const& a0 , A1 const& a1 , A2 const& a2 , A3 const& a3 , A4 const& a4 , A5 const& a5)
|
||||
{
|
||||
return
|
||||
expression::
|
||||
construct<detail::target<T>, A0 , A1 , A2 , A3 , A4 , A5>::
|
||||
make(detail::target<T>(), a0 , a1 , a2 , a3 , a4 , a5);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
template <typename T, typename A0 , typename A1 , typename A2 , typename A3 , typename A4 , typename A5 , typename A6>
|
||||
inline
|
||||
typename expression::construct<detail::target<T>, A0 , A1 , A2 , A3 , A4 , A5 , A6>::type const
|
||||
construct(A0 const& a0 , A1 const& a1 , A2 const& a2 , A3 const& a3 , A4 const& a4 , A5 const& a5 , A6 const& a6)
|
||||
{
|
||||
return
|
||||
expression::
|
||||
construct<detail::target<T>, A0 , A1 , A2 , A3 , A4 , A5 , A6>::
|
||||
make(detail::target<T>(), a0 , a1 , a2 , a3 , a4 , a5 , a6);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
template <typename T, typename A0 , typename A1 , typename A2 , typename A3 , typename A4 , typename A5 , typename A6 , typename A7>
|
||||
inline
|
||||
typename expression::construct<detail::target<T>, A0 , A1 , A2 , A3 , A4 , A5 , A6 , A7>::type const
|
||||
construct(A0 const& a0 , A1 const& a1 , A2 const& a2 , A3 const& a3 , A4 const& a4 , A5 const& a5 , A6 const& a6 , A7 const& a7)
|
||||
{
|
||||
return
|
||||
expression::
|
||||
construct<detail::target<T>, A0 , A1 , A2 , A3 , A4 , A5 , A6 , A7>::
|
||||
make(detail::target<T>(), a0 , a1 , a2 , a3 , a4 , a5 , a6 , a7);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
template <typename T, typename A0 , typename A1 , typename A2 , typename A3 , typename A4 , typename A5 , typename A6 , typename A7 , typename A8>
|
||||
inline
|
||||
typename expression::construct<detail::target<T>, A0 , A1 , A2 , A3 , A4 , A5 , A6 , A7 , A8>::type const
|
||||
construct(A0 const& a0 , A1 const& a1 , A2 const& a2 , A3 const& a3 , A4 const& a4 , A5 const& a5 , A6 const& a6 , A7 const& a7 , A8 const& a8)
|
||||
{
|
||||
return
|
||||
expression::
|
||||
construct<detail::target<T>, A0 , A1 , A2 , A3 , A4 , A5 , A6 , A7 , A8>::
|
||||
make(detail::target<T>(), a0 , a1 , a2 , a3 , a4 , a5 , a6 , a7 , a8);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
template <typename T, typename A0 , typename A1 , typename A2 , typename A3 , typename A4 , typename A5 , typename A6 , typename A7 , typename A8 , typename A9>
|
||||
inline
|
||||
typename expression::construct<detail::target<T>, A0 , A1 , A2 , A3 , A4 , A5 , A6 , A7 , A8 , A9>::type const
|
||||
construct(A0 const& a0 , A1 const& a1 , A2 const& a2 , A3 const& a3 , A4 const& a4 , A5 const& a5 , A6 const& a6 , A7 const& a7 , A8 const& a8 , A9 const& a9)
|
||||
{
|
||||
return
|
||||
expression::
|
||||
construct<detail::target<T>, A0 , A1 , A2 , A3 , A4 , A5 , A6 , A7 , A8 , A9>::
|
||||
make(detail::target<T>(), a0 , a1 , a2 , a3 , a4 , a5 , a6 , a7 , a8 , a9);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
template <typename T, typename A0 , typename A1 , typename A2 , typename A3 , typename A4 , typename A5 , typename A6 , typename A7 , typename A8 , typename A9 , typename A10>
|
||||
inline
|
||||
typename expression::construct<detail::target<T>, A0 , A1 , A2 , A3 , A4 , A5 , A6 , A7 , A8 , A9 , A10>::type const
|
||||
construct(A0 const& a0 , A1 const& a1 , A2 const& a2 , A3 const& a3 , A4 const& a4 , A5 const& a5 , A6 const& a6 , A7 const& a7 , A8 const& a8 , A9 const& a9 , A10 const& a10)
|
||||
{
|
||||
return
|
||||
expression::
|
||||
construct<detail::target<T>, A0 , A1 , A2 , A3 , A4 , A5 , A6 , A7 , A8 , A9 , A10>::
|
||||
make(detail::target<T>(), a0 , a1 , a2 , a3 , a4 , a5 , a6 , a7 , a8 , a9 , a10);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
template <typename T, typename A0 , typename A1 , typename A2 , typename A3 , typename A4 , typename A5 , typename A6 , typename A7 , typename A8 , typename A9 , typename A10 , typename A11>
|
||||
inline
|
||||
typename expression::construct<detail::target<T>, A0 , A1 , A2 , A3 , A4 , A5 , A6 , A7 , A8 , A9 , A10 , A11>::type const
|
||||
construct(A0 const& a0 , A1 const& a1 , A2 const& a2 , A3 const& a3 , A4 const& a4 , A5 const& a5 , A6 const& a6 , A7 const& a7 , A8 const& a8 , A9 const& a9 , A10 const& a10 , A11 const& a11)
|
||||
{
|
||||
return
|
||||
expression::
|
||||
construct<detail::target<T>, A0 , A1 , A2 , A3 , A4 , A5 , A6 , A7 , A8 , A9 , A10 , A11>::
|
||||
make(detail::target<T>(), a0 , a1 , a2 , a3 , a4 , a5 , a6 , a7 , a8 , a9 , a10 , a11);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
template <typename T, typename A0 , typename A1 , typename A2 , typename A3 , typename A4 , typename A5 , typename A6 , typename A7 , typename A8 , typename A9 , typename A10 , typename A11 , typename A12>
|
||||
inline
|
||||
typename expression::construct<detail::target<T>, A0 , A1 , A2 , A3 , A4 , A5 , A6 , A7 , A8 , A9 , A10 , A11 , A12>::type const
|
||||
construct(A0 const& a0 , A1 const& a1 , A2 const& a2 , A3 const& a3 , A4 const& a4 , A5 const& a5 , A6 const& a6 , A7 const& a7 , A8 const& a8 , A9 const& a9 , A10 const& a10 , A11 const& a11 , A12 const& a12)
|
||||
{
|
||||
return
|
||||
expression::
|
||||
construct<detail::target<T>, A0 , A1 , A2 , A3 , A4 , A5 , A6 , A7 , A8 , A9 , A10 , A11 , A12>::
|
||||
make(detail::target<T>(), a0 , a1 , a2 , a3 , a4 , a5 , a6 , a7 , a8 , a9 , a10 , a11 , a12);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
template <typename T, typename A0 , typename A1 , typename A2 , typename A3 , typename A4 , typename A5 , typename A6 , typename A7 , typename A8 , typename A9 , typename A10 , typename A11 , typename A12 , typename A13>
|
||||
inline
|
||||
typename expression::construct<detail::target<T>, A0 , A1 , A2 , A3 , A4 , A5 , A6 , A7 , A8 , A9 , A10 , A11 , A12 , A13>::type const
|
||||
construct(A0 const& a0 , A1 const& a1 , A2 const& a2 , A3 const& a3 , A4 const& a4 , A5 const& a5 , A6 const& a6 , A7 const& a7 , A8 const& a8 , A9 const& a9 , A10 const& a10 , A11 const& a11 , A12 const& a12 , A13 const& a13)
|
||||
{
|
||||
return
|
||||
expression::
|
||||
construct<detail::target<T>, A0 , A1 , A2 , A3 , A4 , A5 , A6 , A7 , A8 , A9 , A10 , A11 , A12 , A13>::
|
||||
make(detail::target<T>(), a0 , a1 , a2 , a3 , a4 , a5 , a6 , a7 , a8 , a9 , a10 , a11 , a12 , a13);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
template <typename T, typename A0 , typename A1 , typename A2 , typename A3 , typename A4 , typename A5 , typename A6 , typename A7 , typename A8 , typename A9 , typename A10 , typename A11 , typename A12 , typename A13 , typename A14>
|
||||
inline
|
||||
typename expression::construct<detail::target<T>, A0 , A1 , A2 , A3 , A4 , A5 , A6 , A7 , A8 , A9 , A10 , A11 , A12 , A13 , A14>::type const
|
||||
construct(A0 const& a0 , A1 const& a1 , A2 const& a2 , A3 const& a3 , A4 const& a4 , A5 const& a5 , A6 const& a6 , A7 const& a7 , A8 const& a8 , A9 const& a9 , A10 const& a10 , A11 const& a11 , A12 const& a12 , A13 const& a13 , A14 const& a14)
|
||||
{
|
||||
return
|
||||
expression::
|
||||
construct<detail::target<T>, A0 , A1 , A2 , A3 , A4 , A5 , A6 , A7 , A8 , A9 , A10 , A11 , A12 , A13 , A14>::
|
||||
make(detail::target<T>(), a0 , a1 , a2 , a3 , a4 , a5 , a6 , a7 , a8 , a9 , a10 , a11 , a12 , a13 , a14);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
template <typename T, typename A0 , typename A1 , typename A2 , typename A3 , typename A4 , typename A5 , typename A6 , typename A7 , typename A8 , typename A9 , typename A10 , typename A11 , typename A12 , typename A13 , typename A14 , typename A15>
|
||||
inline
|
||||
typename expression::construct<detail::target<T>, A0 , A1 , A2 , A3 , A4 , A5 , A6 , A7 , A8 , A9 , A10 , A11 , A12 , A13 , A14 , A15>::type const
|
||||
construct(A0 const& a0 , A1 const& a1 , A2 const& a2 , A3 const& a3 , A4 const& a4 , A5 const& a5 , A6 const& a6 , A7 const& a7 , A8 const& a8 , A9 const& a9 , A10 const& a10 , A11 const& a11 , A12 const& a12 , A13 const& a13 , A14 const& a14 , A15 const& a15)
|
||||
{
|
||||
return
|
||||
expression::
|
||||
construct<detail::target<T>, A0 , A1 , A2 , A3 , A4 , A5 , A6 , A7 , A8 , A9 , A10 , A11 , A12 , A13 , A14 , A15>::
|
||||
make(detail::target<T>(), a0 , a1 , a2 , a3 , a4 , a5 , a6 , a7 , a8 , a9 , a10 , a11 , a12 , a13 , a14 , a15);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
template <typename T, typename A0 , typename A1 , typename A2 , typename A3 , typename A4 , typename A5 , typename A6 , typename A7 , typename A8 , typename A9 , typename A10 , typename A11 , typename A12 , typename A13 , typename A14 , typename A15 , typename A16>
|
||||
inline
|
||||
typename expression::construct<detail::target<T>, A0 , A1 , A2 , A3 , A4 , A5 , A6 , A7 , A8 , A9 , A10 , A11 , A12 , A13 , A14 , A15 , A16>::type const
|
||||
construct(A0 const& a0 , A1 const& a1 , A2 const& a2 , A3 const& a3 , A4 const& a4 , A5 const& a5 , A6 const& a6 , A7 const& a7 , A8 const& a8 , A9 const& a9 , A10 const& a10 , A11 const& a11 , A12 const& a12 , A13 const& a13 , A14 const& a14 , A15 const& a15 , A16 const& a16)
|
||||
{
|
||||
return
|
||||
expression::
|
||||
construct<detail::target<T>, A0 , A1 , A2 , A3 , A4 , A5 , A6 , A7 , A8 , A9 , A10 , A11 , A12 , A13 , A14 , A15 , A16>::
|
||||
make(detail::target<T>(), a0 , a1 , a2 , a3 , a4 , a5 , a6 , a7 , a8 , a9 , a10 , a11 , a12 , a13 , a14 , a15 , a16);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
template <typename T, typename A0 , typename A1 , typename A2 , typename A3 , typename A4 , typename A5 , typename A6 , typename A7 , typename A8 , typename A9 , typename A10 , typename A11 , typename A12 , typename A13 , typename A14 , typename A15 , typename A16 , typename A17>
|
||||
inline
|
||||
typename expression::construct<detail::target<T>, A0 , A1 , A2 , A3 , A4 , A5 , A6 , A7 , A8 , A9 , A10 , A11 , A12 , A13 , A14 , A15 , A16 , A17>::type const
|
||||
construct(A0 const& a0 , A1 const& a1 , A2 const& a2 , A3 const& a3 , A4 const& a4 , A5 const& a5 , A6 const& a6 , A7 const& a7 , A8 const& a8 , A9 const& a9 , A10 const& a10 , A11 const& a11 , A12 const& a12 , A13 const& a13 , A14 const& a14 , A15 const& a15 , A16 const& a16 , A17 const& a17)
|
||||
{
|
||||
return
|
||||
expression::
|
||||
construct<detail::target<T>, A0 , A1 , A2 , A3 , A4 , A5 , A6 , A7 , A8 , A9 , A10 , A11 , A12 , A13 , A14 , A15 , A16 , A17>::
|
||||
make(detail::target<T>(), a0 , a1 , a2 , a3 , a4 , a5 , a6 , a7 , a8 , a9 , a10 , a11 , a12 , a13 , a14 , a15 , a16 , a17);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
template <typename T, typename A0 , typename A1 , typename A2 , typename A3 , typename A4 , typename A5 , typename A6 , typename A7 , typename A8 , typename A9 , typename A10 , typename A11 , typename A12 , typename A13 , typename A14 , typename A15 , typename A16 , typename A17 , typename A18>
|
||||
inline
|
||||
typename expression::construct<detail::target<T>, A0 , A1 , A2 , A3 , A4 , A5 , A6 , A7 , A8 , A9 , A10 , A11 , A12 , A13 , A14 , A15 , A16 , A17 , A18>::type const
|
||||
construct(A0 const& a0 , A1 const& a1 , A2 const& a2 , A3 const& a3 , A4 const& a4 , A5 const& a5 , A6 const& a6 , A7 const& a7 , A8 const& a8 , A9 const& a9 , A10 const& a10 , A11 const& a11 , A12 const& a12 , A13 const& a13 , A14 const& a14 , A15 const& a15 , A16 const& a16 , A17 const& a17 , A18 const& a18)
|
||||
{
|
||||
return
|
||||
expression::
|
||||
construct<detail::target<T>, A0 , A1 , A2 , A3 , A4 , A5 , A6 , A7 , A8 , A9 , A10 , A11 , A12 , A13 , A14 , A15 , A16 , A17 , A18>::
|
||||
make(detail::target<T>(), a0 , a1 , a2 , a3 , a4 , a5 , a6 , a7 , a8 , a9 , a10 , a11 , a12 , a13 , a14 , a15 , a16 , a17 , a18);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
template <typename T, typename A0 , typename A1 , typename A2 , typename A3 , typename A4 , typename A5 , typename A6 , typename A7 , typename A8 , typename A9 , typename A10 , typename A11 , typename A12 , typename A13 , typename A14 , typename A15 , typename A16 , typename A17 , typename A18 , typename A19>
|
||||
inline
|
||||
typename expression::construct<detail::target<T>, A0 , A1 , A2 , A3 , A4 , A5 , A6 , A7 , A8 , A9 , A10 , A11 , A12 , A13 , A14 , A15 , A16 , A17 , A18 , A19>::type const
|
||||
construct(A0 const& a0 , A1 const& a1 , A2 const& a2 , A3 const& a3 , A4 const& a4 , A5 const& a5 , A6 const& a6 , A7 const& a7 , A8 const& a8 , A9 const& a9 , A10 const& a10 , A11 const& a11 , A12 const& a12 , A13 const& a13 , A14 const& a14 , A15 const& a15 , A16 const& a16 , A17 const& a17 , A18 const& a18 , A19 const& a19)
|
||||
{
|
||||
return
|
||||
expression::
|
||||
construct<detail::target<T>, A0 , A1 , A2 , A3 , A4 , A5 , A6 , A7 , A8 , A9 , A10 , A11 , A12 , A13 , A14 , A15 , A16 , A17 , A18 , A19>::
|
||||
make(detail::target<T>(), a0 , a1 , a2 , a3 , a4 , a5 , a6 , a7 , a8 , a9 , a10 , a11 , a12 , a13 , a14 , a15 , a16 , a17 , a18 , a19);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
template <typename T, typename A0 , typename A1 , typename A2 , typename A3 , typename A4 , typename A5 , typename A6 , typename A7 , typename A8 , typename A9 , typename A10 , typename A11 , typename A12 , typename A13 , typename A14 , typename A15 , typename A16 , typename A17 , typename A18 , typename A19 , typename A20>
|
||||
inline
|
||||
typename expression::construct<detail::target<T>, A0 , A1 , A2 , A3 , A4 , A5 , A6 , A7 , A8 , A9 , A10 , A11 , A12 , A13 , A14 , A15 , A16 , A17 , A18 , A19 , A20>::type const
|
||||
construct(A0 const& a0 , A1 const& a1 , A2 const& a2 , A3 const& a3 , A4 const& a4 , A5 const& a5 , A6 const& a6 , A7 const& a7 , A8 const& a8 , A9 const& a9 , A10 const& a10 , A11 const& a11 , A12 const& a12 , A13 const& a13 , A14 const& a14 , A15 const& a15 , A16 const& a16 , A17 const& a17 , A18 const& a18 , A19 const& a19 , A20 const& a20)
|
||||
{
|
||||
return
|
||||
expression::
|
||||
construct<detail::target<T>, A0 , A1 , A2 , A3 , A4 , A5 , A6 , A7 , A8 , A9 , A10 , A11 , A12 , A13 , A14 , A15 , A16 , A17 , A18 , A19 , A20>::
|
||||
make(detail::target<T>(), a0 , a1 , a2 , a3 , a4 , a5 , a6 , a7 , a8 , a9 , a10 , a11 , a12 , a13 , a14 , a15 , a16 , a17 , a18 , a19 , a20);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
template <typename T, typename A0 , typename A1 , typename A2 , typename A3 , typename A4 , typename A5 , typename A6 , typename A7 , typename A8 , typename A9 , typename A10 , typename A11 , typename A12 , typename A13 , typename A14 , typename A15 , typename A16 , typename A17 , typename A18 , typename A19 , typename A20 , typename A21>
|
||||
inline
|
||||
typename expression::construct<detail::target<T>, A0 , A1 , A2 , A3 , A4 , A5 , A6 , A7 , A8 , A9 , A10 , A11 , A12 , A13 , A14 , A15 , A16 , A17 , A18 , A19 , A20 , A21>::type const
|
||||
construct(A0 const& a0 , A1 const& a1 , A2 const& a2 , A3 const& a3 , A4 const& a4 , A5 const& a5 , A6 const& a6 , A7 const& a7 , A8 const& a8 , A9 const& a9 , A10 const& a10 , A11 const& a11 , A12 const& a12 , A13 const& a13 , A14 const& a14 , A15 const& a15 , A16 const& a16 , A17 const& a17 , A18 const& a18 , A19 const& a19 , A20 const& a20 , A21 const& a21)
|
||||
{
|
||||
return
|
||||
expression::
|
||||
construct<detail::target<T>, A0 , A1 , A2 , A3 , A4 , A5 , A6 , A7 , A8 , A9 , A10 , A11 , A12 , A13 , A14 , A15 , A16 , A17 , A18 , A19 , A20 , A21>::
|
||||
make(detail::target<T>(), a0 , a1 , a2 , a3 , a4 , a5 , a6 , a7 , a8 , a9 , a10 , a11 , a12 , a13 , a14 , a15 , a16 , a17 , a18 , a19 , a20 , a21);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
template <typename T, typename A0 , typename A1 , typename A2 , typename A3 , typename A4 , typename A5 , typename A6 , typename A7 , typename A8 , typename A9 , typename A10 , typename A11 , typename A12 , typename A13 , typename A14 , typename A15 , typename A16 , typename A17 , typename A18 , typename A19 , typename A20 , typename A21 , typename A22>
|
||||
inline
|
||||
typename expression::construct<detail::target<T>, A0 , A1 , A2 , A3 , A4 , A5 , A6 , A7 , A8 , A9 , A10 , A11 , A12 , A13 , A14 , A15 , A16 , A17 , A18 , A19 , A20 , A21 , A22>::type const
|
||||
construct(A0 const& a0 , A1 const& a1 , A2 const& a2 , A3 const& a3 , A4 const& a4 , A5 const& a5 , A6 const& a6 , A7 const& a7 , A8 const& a8 , A9 const& a9 , A10 const& a10 , A11 const& a11 , A12 const& a12 , A13 const& a13 , A14 const& a14 , A15 const& a15 , A16 const& a16 , A17 const& a17 , A18 const& a18 , A19 const& a19 , A20 const& a20 , A21 const& a21 , A22 const& a22)
|
||||
{
|
||||
return
|
||||
expression::
|
||||
construct<detail::target<T>, A0 , A1 , A2 , A3 , A4 , A5 , A6 , A7 , A8 , A9 , A10 , A11 , A12 , A13 , A14 , A15 , A16 , A17 , A18 , A19 , A20 , A21 , A22>::
|
||||
make(detail::target<T>(), a0 , a1 , a2 , a3 , a4 , a5 , a6 , a7 , a8 , a9 , a10 , a11 , a12 , a13 , a14 , a15 , a16 , a17 , a18 , a19 , a20 , a21 , a22);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
template <typename T, typename A0 , typename A1 , typename A2 , typename A3 , typename A4 , typename A5 , typename A6 , typename A7 , typename A8 , typename A9 , typename A10 , typename A11 , typename A12 , typename A13 , typename A14 , typename A15 , typename A16 , typename A17 , typename A18 , typename A19 , typename A20 , typename A21 , typename A22 , typename A23>
|
||||
inline
|
||||
typename expression::construct<detail::target<T>, A0 , A1 , A2 , A3 , A4 , A5 , A6 , A7 , A8 , A9 , A10 , A11 , A12 , A13 , A14 , A15 , A16 , A17 , A18 , A19 , A20 , A21 , A22 , A23>::type const
|
||||
construct(A0 const& a0 , A1 const& a1 , A2 const& a2 , A3 const& a3 , A4 const& a4 , A5 const& a5 , A6 const& a6 , A7 const& a7 , A8 const& a8 , A9 const& a9 , A10 const& a10 , A11 const& a11 , A12 const& a12 , A13 const& a13 , A14 const& a14 , A15 const& a15 , A16 const& a16 , A17 const& a17 , A18 const& a18 , A19 const& a19 , A20 const& a20 , A21 const& a21 , A22 const& a22 , A23 const& a23)
|
||||
{
|
||||
return
|
||||
expression::
|
||||
construct<detail::target<T>, A0 , A1 , A2 , A3 , A4 , A5 , A6 , A7 , A8 , A9 , A10 , A11 , A12 , A13 , A14 , A15 , A16 , A17 , A18 , A19 , A20 , A21 , A22 , A23>::
|
||||
make(detail::target<T>(), a0 , a1 , a2 , a3 , a4 , a5 , a6 , a7 , a8 , a9 , a10 , a11 , a12 , a13 , a14 , a15 , a16 , a17 , a18 , a19 , a20 , a21 , a22 , a23);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
template <typename T, typename A0 , typename A1 , typename A2 , typename A3 , typename A4 , typename A5 , typename A6 , typename A7 , typename A8 , typename A9 , typename A10 , typename A11 , typename A12 , typename A13 , typename A14 , typename A15 , typename A16 , typename A17 , typename A18 , typename A19 , typename A20 , typename A21 , typename A22 , typename A23 , typename A24>
|
||||
inline
|
||||
typename expression::construct<detail::target<T>, A0 , A1 , A2 , A3 , A4 , A5 , A6 , A7 , A8 , A9 , A10 , A11 , A12 , A13 , A14 , A15 , A16 , A17 , A18 , A19 , A20 , A21 , A22 , A23 , A24>::type const
|
||||
construct(A0 const& a0 , A1 const& a1 , A2 const& a2 , A3 const& a3 , A4 const& a4 , A5 const& a5 , A6 const& a6 , A7 const& a7 , A8 const& a8 , A9 const& a9 , A10 const& a10 , A11 const& a11 , A12 const& a12 , A13 const& a13 , A14 const& a14 , A15 const& a15 , A16 const& a16 , A17 const& a17 , A18 const& a18 , A19 const& a19 , A20 const& a20 , A21 const& a21 , A22 const& a22 , A23 const& a23 , A24 const& a24)
|
||||
{
|
||||
return
|
||||
expression::
|
||||
construct<detail::target<T>, A0 , A1 , A2 , A3 , A4 , A5 , A6 , A7 , A8 , A9 , A10 , A11 , A12 , A13 , A14 , A15 , A16 , A17 , A18 , A19 , A20 , A21 , A22 , A23 , A24>::
|
||||
make(detail::target<T>(), a0 , a1 , a2 , a3 , a4 , a5 , a6 , a7 , a8 , a9 , a10 , a11 , a12 , a13 , a14 , a15 , a16 , a17 , a18 , a19 , a20 , a21 , a22 , a23 , a24);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
template <typename T, typename A0 , typename A1 , typename A2 , typename A3 , typename A4 , typename A5 , typename A6 , typename A7 , typename A8 , typename A9 , typename A10 , typename A11 , typename A12 , typename A13 , typename A14 , typename A15 , typename A16 , typename A17 , typename A18 , typename A19 , typename A20 , typename A21 , typename A22 , typename A23 , typename A24 , typename A25>
|
||||
inline
|
||||
typename expression::construct<detail::target<T>, A0 , A1 , A2 , A3 , A4 , A5 , A6 , A7 , A8 , A9 , A10 , A11 , A12 , A13 , A14 , A15 , A16 , A17 , A18 , A19 , A20 , A21 , A22 , A23 , A24 , A25>::type const
|
||||
construct(A0 const& a0 , A1 const& a1 , A2 const& a2 , A3 const& a3 , A4 const& a4 , A5 const& a5 , A6 const& a6 , A7 const& a7 , A8 const& a8 , A9 const& a9 , A10 const& a10 , A11 const& a11 , A12 const& a12 , A13 const& a13 , A14 const& a14 , A15 const& a15 , A16 const& a16 , A17 const& a17 , A18 const& a18 , A19 const& a19 , A20 const& a20 , A21 const& a21 , A22 const& a22 , A23 const& a23 , A24 const& a24 , A25 const& a25)
|
||||
{
|
||||
return
|
||||
expression::
|
||||
construct<detail::target<T>, A0 , A1 , A2 , A3 , A4 , A5 , A6 , A7 , A8 , A9 , A10 , A11 , A12 , A13 , A14 , A15 , A16 , A17 , A18 , A19 , A20 , A21 , A22 , A23 , A24 , A25>::
|
||||
make(detail::target<T>(), a0 , a1 , a2 , a3 , a4 , a5 , a6 , a7 , a8 , a9 , a10 , a11 , a12 , a13 , a14 , a15 , a16 , a17 , a18 , a19 , a20 , a21 , a22 , a23 , a24 , a25);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
template <typename T, typename A0 , typename A1 , typename A2 , typename A3 , typename A4 , typename A5 , typename A6 , typename A7 , typename A8 , typename A9 , typename A10 , typename A11 , typename A12 , typename A13 , typename A14 , typename A15 , typename A16 , typename A17 , typename A18 , typename A19 , typename A20 , typename A21 , typename A22 , typename A23 , typename A24 , typename A25 , typename A26>
|
||||
inline
|
||||
typename expression::construct<detail::target<T>, A0 , A1 , A2 , A3 , A4 , A5 , A6 , A7 , A8 , A9 , A10 , A11 , A12 , A13 , A14 , A15 , A16 , A17 , A18 , A19 , A20 , A21 , A22 , A23 , A24 , A25 , A26>::type const
|
||||
construct(A0 const& a0 , A1 const& a1 , A2 const& a2 , A3 const& a3 , A4 const& a4 , A5 const& a5 , A6 const& a6 , A7 const& a7 , A8 const& a8 , A9 const& a9 , A10 const& a10 , A11 const& a11 , A12 const& a12 , A13 const& a13 , A14 const& a14 , A15 const& a15 , A16 const& a16 , A17 const& a17 , A18 const& a18 , A19 const& a19 , A20 const& a20 , A21 const& a21 , A22 const& a22 , A23 const& a23 , A24 const& a24 , A25 const& a25 , A26 const& a26)
|
||||
{
|
||||
return
|
||||
expression::
|
||||
construct<detail::target<T>, A0 , A1 , A2 , A3 , A4 , A5 , A6 , A7 , A8 , A9 , A10 , A11 , A12 , A13 , A14 , A15 , A16 , A17 , A18 , A19 , A20 , A21 , A22 , A23 , A24 , A25 , A26>::
|
||||
make(detail::target<T>(), a0 , a1 , a2 , a3 , a4 , a5 , a6 , a7 , a8 , a9 , a10 , a11 , a12 , a13 , a14 , a15 , a16 , a17 , a18 , a19 , a20 , a21 , a22 , a23 , a24 , a25 , a26);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
template <typename T, typename A0 , typename A1 , typename A2 , typename A3 , typename A4 , typename A5 , typename A6 , typename A7 , typename A8 , typename A9 , typename A10 , typename A11 , typename A12 , typename A13 , typename A14 , typename A15 , typename A16 , typename A17 , typename A18 , typename A19 , typename A20 , typename A21 , typename A22 , typename A23 , typename A24 , typename A25 , typename A26 , typename A27>
|
||||
inline
|
||||
typename expression::construct<detail::target<T>, A0 , A1 , A2 , A3 , A4 , A5 , A6 , A7 , A8 , A9 , A10 , A11 , A12 , A13 , A14 , A15 , A16 , A17 , A18 , A19 , A20 , A21 , A22 , A23 , A24 , A25 , A26 , A27>::type const
|
||||
construct(A0 const& a0 , A1 const& a1 , A2 const& a2 , A3 const& a3 , A4 const& a4 , A5 const& a5 , A6 const& a6 , A7 const& a7 , A8 const& a8 , A9 const& a9 , A10 const& a10 , A11 const& a11 , A12 const& a12 , A13 const& a13 , A14 const& a14 , A15 const& a15 , A16 const& a16 , A17 const& a17 , A18 const& a18 , A19 const& a19 , A20 const& a20 , A21 const& a21 , A22 const& a22 , A23 const& a23 , A24 const& a24 , A25 const& a25 , A26 const& a26 , A27 const& a27)
|
||||
{
|
||||
return
|
||||
expression::
|
||||
construct<detail::target<T>, A0 , A1 , A2 , A3 , A4 , A5 , A6 , A7 , A8 , A9 , A10 , A11 , A12 , A13 , A14 , A15 , A16 , A17 , A18 , A19 , A20 , A21 , A22 , A23 , A24 , A25 , A26 , A27>::
|
||||
make(detail::target<T>(), a0 , a1 , a2 , a3 , a4 , a5 , a6 , a7 , a8 , a9 , a10 , a11 , a12 , a13 , a14 , a15 , a16 , a17 , a18 , a19 , a20 , a21 , a22 , a23 , a24 , a25 , a26 , a27);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
template <typename T, typename A0 , typename A1 , typename A2 , typename A3 , typename A4 , typename A5 , typename A6 , typename A7 , typename A8 , typename A9 , typename A10 , typename A11 , typename A12 , typename A13 , typename A14 , typename A15 , typename A16 , typename A17 , typename A18 , typename A19 , typename A20 , typename A21 , typename A22 , typename A23 , typename A24 , typename A25 , typename A26 , typename A27 , typename A28>
|
||||
inline
|
||||
typename expression::construct<detail::target<T>, A0 , A1 , A2 , A3 , A4 , A5 , A6 , A7 , A8 , A9 , A10 , A11 , A12 , A13 , A14 , A15 , A16 , A17 , A18 , A19 , A20 , A21 , A22 , A23 , A24 , A25 , A26 , A27 , A28>::type const
|
||||
construct(A0 const& a0 , A1 const& a1 , A2 const& a2 , A3 const& a3 , A4 const& a4 , A5 const& a5 , A6 const& a6 , A7 const& a7 , A8 const& a8 , A9 const& a9 , A10 const& a10 , A11 const& a11 , A12 const& a12 , A13 const& a13 , A14 const& a14 , A15 const& a15 , A16 const& a16 , A17 const& a17 , A18 const& a18 , A19 const& a19 , A20 const& a20 , A21 const& a21 , A22 const& a22 , A23 const& a23 , A24 const& a24 , A25 const& a25 , A26 const& a26 , A27 const& a27 , A28 const& a28)
|
||||
{
|
||||
return
|
||||
expression::
|
||||
construct<detail::target<T>, A0 , A1 , A2 , A3 , A4 , A5 , A6 , A7 , A8 , A9 , A10 , A11 , A12 , A13 , A14 , A15 , A16 , A17 , A18 , A19 , A20 , A21 , A22 , A23 , A24 , A25 , A26 , A27 , A28>::
|
||||
make(detail::target<T>(), a0 , a1 , a2 , a3 , a4 , a5 , a6 , a7 , a8 , a9 , a10 , a11 , a12 , a13 , a14 , a15 , a16 , a17 , a18 , a19 , a20 , a21 , a22 , a23 , a24 , a25 , a26 , a27 , a28);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
template <typename T, typename A0 , typename A1 , typename A2 , typename A3 , typename A4 , typename A5 , typename A6 , typename A7 , typename A8 , typename A9 , typename A10 , typename A11 , typename A12 , typename A13 , typename A14 , typename A15 , typename A16 , typename A17 , typename A18 , typename A19 , typename A20 , typename A21 , typename A22 , typename A23 , typename A24 , typename A25 , typename A26 , typename A27 , typename A28 , typename A29>
|
||||
inline
|
||||
typename expression::construct<detail::target<T>, A0 , A1 , A2 , A3 , A4 , A5 , A6 , A7 , A8 , A9 , A10 , A11 , A12 , A13 , A14 , A15 , A16 , A17 , A18 , A19 , A20 , A21 , A22 , A23 , A24 , A25 , A26 , A27 , A28 , A29>::type const
|
||||
construct(A0 const& a0 , A1 const& a1 , A2 const& a2 , A3 const& a3 , A4 const& a4 , A5 const& a5 , A6 const& a6 , A7 const& a7 , A8 const& a8 , A9 const& a9 , A10 const& a10 , A11 const& a11 , A12 const& a12 , A13 const& a13 , A14 const& a14 , A15 const& a15 , A16 const& a16 , A17 const& a17 , A18 const& a18 , A19 const& a19 , A20 const& a20 , A21 const& a21 , A22 const& a22 , A23 const& a23 , A24 const& a24 , A25 const& a25 , A26 const& a26 , A27 const& a27 , A28 const& a28 , A29 const& a29)
|
||||
{
|
||||
return
|
||||
expression::
|
||||
construct<detail::target<T>, A0 , A1 , A2 , A3 , A4 , A5 , A6 , A7 , A8 , A9 , A10 , A11 , A12 , A13 , A14 , A15 , A16 , A17 , A18 , A19 , A20 , A21 , A22 , A23 , A24 , A25 , A26 , A27 , A28 , A29>::
|
||||
make(detail::target<T>(), a0 , a1 , a2 , a3 , a4 , a5 , a6 , a7 , a8 , a9 , a10 , a11 , a12 , a13 , a14 , a15 , a16 , a17 , a18 , a19 , a20 , a21 , a22 , a23 , a24 , a25 , a26 , a27 , a28 , a29);
|
||||
}
|
||||
@@ -0,0 +1,66 @@
|
||||
// Copyright David Abrahams 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 PREPROCESSOR_DWA200247_HPP
|
||||
# define PREPROCESSOR_DWA200247_HPP
|
||||
|
||||
# include <boost/preprocessor/cat.hpp>
|
||||
# include <boost/preprocessor/comma_if.hpp>
|
||||
# include <boost/preprocessor/repeat.hpp>
|
||||
# include <boost/preprocessor/tuple/elem.hpp>
|
||||
|
||||
// stuff that should be in the preprocessor library
|
||||
|
||||
# define BOOST_PYTHON_APPLY(x) BOOST_PP_CAT(BOOST_PYTHON_APPLY_, x)
|
||||
|
||||
# define BOOST_PYTHON_APPLY_BOOST_PYTHON_ITEM(v) v
|
||||
# define BOOST_PYTHON_APPLY_BOOST_PYTHON_NIL
|
||||
|
||||
// cv-qualifiers
|
||||
|
||||
# if !defined(__MWERKS__) || __MWERKS__ > 0x2407
|
||||
# define BOOST_PYTHON_CV_COUNT 4
|
||||
# else
|
||||
# define BOOST_PYTHON_CV_COUNT 1
|
||||
# endif
|
||||
|
||||
# ifndef BOOST_PYTHON_MAX_ARITY
|
||||
# define BOOST_PYTHON_MAX_ARITY 15
|
||||
# endif
|
||||
|
||||
# ifndef BOOST_PYTHON_MAX_BASES
|
||||
# define BOOST_PYTHON_MAX_BASES 10
|
||||
# endif
|
||||
|
||||
# define BOOST_PYTHON_CV_QUALIFIER(i) \
|
||||
BOOST_PYTHON_APPLY( \
|
||||
BOOST_PP_TUPLE_ELEM(4, i, BOOST_PYTHON_CV_QUALIFIER_I) \
|
||||
)
|
||||
|
||||
# define BOOST_PYTHON_CV_QUALIFIER_I \
|
||||
( \
|
||||
BOOST_PYTHON_NIL, \
|
||||
BOOST_PYTHON_ITEM(const), \
|
||||
BOOST_PYTHON_ITEM(volatile), \
|
||||
BOOST_PYTHON_ITEM(const volatile) \
|
||||
)
|
||||
|
||||
// enumerators
|
||||
# define BOOST_PYTHON_UNARY_ENUM(c, text) BOOST_PP_REPEAT(c, BOOST_PYTHON_UNARY_ENUM_I, text)
|
||||
# define BOOST_PYTHON_UNARY_ENUM_I(z, n, text) BOOST_PP_COMMA_IF(n) text ## n
|
||||
|
||||
# define BOOST_PYTHON_BINARY_ENUM(c, a, b) BOOST_PP_REPEAT(c, BOOST_PYTHON_BINARY_ENUM_I, (a, b))
|
||||
# define BOOST_PYTHON_BINARY_ENUM_I(z, n, _) BOOST_PP_COMMA_IF(n) BOOST_PP_CAT(BOOST_PP_TUPLE_ELEM(2, 0, _), n) BOOST_PP_CAT(BOOST_PP_TUPLE_ELEM(2, 1, _), n)
|
||||
|
||||
# define BOOST_PYTHON_ENUM_WITH_DEFAULT(c, text, def) BOOST_PP_REPEAT(c, BOOST_PYTHON_ENUM_WITH_DEFAULT_I, (text, def))
|
||||
# define BOOST_PYTHON_ENUM_WITH_DEFAULT_I(z, n, _) BOOST_PP_COMMA_IF(n) BOOST_PP_CAT(BOOST_PP_TUPLE_ELEM(2, 0, _), n) = BOOST_PP_TUPLE_ELEM(2, 1, _)
|
||||
|
||||
// fixed text (no commas)
|
||||
# define BOOST_PYTHON_FIXED(z, n, text) text
|
||||
|
||||
// flags
|
||||
# define BOOST_PYTHON_FUNCTION_POINTER 0x0001
|
||||
# define BOOST_PYTHON_POINTER_TO_MEMBER 0x0002
|
||||
|
||||
#endif // PREPROCESSOR_DWA200247_HPP
|
||||
@@ -0,0 +1,374 @@
|
||||
// Copyright 2004 The Trustees of Indiana University.
|
||||
// Copyright 2005 Matthias Troyer.
|
||||
// Copyright 2006 Douglas Gregor <doug.gregor -at- gmail.com>.
|
||||
|
||||
// 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)
|
||||
|
||||
// Authors: Douglas Gregor
|
||||
// Andrew Lumsdaine
|
||||
// Matthias Troyer
|
||||
|
||||
/** @file datatype.hpp
|
||||
*
|
||||
* This header provides the mapping from C++ types to MPI data types.
|
||||
*/
|
||||
#ifndef BOOST_MPI_DATATYPE_HPP
|
||||
#define BOOST_MPI_DATATYPE_HPP
|
||||
|
||||
#include <boost/mpi/config.hpp>
|
||||
#include <boost/mpi/datatype_fwd.hpp>
|
||||
#include <mpi.h>
|
||||
#include <boost/config.hpp>
|
||||
#include <boost/mpl/bool.hpp>
|
||||
#include <boost/mpl/or.hpp>
|
||||
#include <boost/mpl/and.hpp>
|
||||
#include <boost/mpi/detail/mpi_datatype_cache.hpp>
|
||||
#include <boost/mpl/assert.hpp>
|
||||
#include <boost/archive/basic_archive.hpp>
|
||||
#include <boost/serialization/item_version_type.hpp>
|
||||
#include <utility> // for std::pair
|
||||
|
||||
#if defined(__cplusplus) && (201103L <= __cplusplus)
|
||||
#include <array>
|
||||
#endif
|
||||
|
||||
namespace boost { namespace mpi {
|
||||
|
||||
/**
|
||||
* @brief Type trait that determines if there exists a built-in
|
||||
* integer MPI data type for a given C++ type.
|
||||
*
|
||||
* This type trait determines when there is a direct mapping from a
|
||||
* C++ type to an MPI data type that is classified as an integer data
|
||||
* type. See @c is_mpi_builtin_datatype for general information about
|
||||
* built-in MPI data types.
|
||||
*/
|
||||
template<typename T>
|
||||
struct is_mpi_integer_datatype
|
||||
: public boost::mpl::false_ { };
|
||||
|
||||
/**
|
||||
* @brief Type trait that determines if there exists a built-in
|
||||
* floating point MPI data type for a given C++ type.
|
||||
*
|
||||
* This type trait determines when there is a direct mapping from a
|
||||
* C++ type to an MPI data type that is classified as a floating
|
||||
* point data type. See @c is_mpi_builtin_datatype for general
|
||||
* information about built-in MPI data types.
|
||||
*/
|
||||
template<typename T>
|
||||
struct is_mpi_floating_point_datatype
|
||||
: public boost::mpl::false_ { };
|
||||
|
||||
/**
|
||||
* @brief Type trait that determines if there exists a built-in
|
||||
* logical MPI data type for a given C++ type.
|
||||
*
|
||||
* This type trait determines when there is a direct mapping from a
|
||||
* C++ type to an MPI data type that is classified as an logical data
|
||||
* type. See @c is_mpi_builtin_datatype for general information about
|
||||
* built-in MPI data types.
|
||||
*/
|
||||
template<typename T>
|
||||
struct is_mpi_logical_datatype
|
||||
: public boost::mpl::false_ { };
|
||||
|
||||
/**
|
||||
* @brief Type trait that determines if there exists a built-in
|
||||
* complex MPI data type for a given C++ type.
|
||||
*
|
||||
* This type trait determines when there is a direct mapping from a
|
||||
* C++ type to an MPI data type that is classified as an complex data
|
||||
* type. See @c is_mpi_builtin_datatype for general information about
|
||||
* built-in MPI data types.
|
||||
*/
|
||||
template<typename T>
|
||||
struct is_mpi_complex_datatype
|
||||
: public boost::mpl::false_ { };
|
||||
|
||||
/**
|
||||
* @brief Type trait that determines if there exists a built-in
|
||||
* byte MPI data type for a given C++ type.
|
||||
*
|
||||
* This type trait determines when there is a direct mapping from a
|
||||
* C++ type to an MPI data type that is classified as an byte data
|
||||
* type. See @c is_mpi_builtin_datatype for general information about
|
||||
* built-in MPI data types.
|
||||
*/
|
||||
template<typename T>
|
||||
struct is_mpi_byte_datatype
|
||||
: public boost::mpl::false_ { };
|
||||
|
||||
/** @brief Type trait that determines if there exists a built-in MPI
|
||||
* data type for a given C++ type.
|
||||
*
|
||||
* This type trait determines when there is a direct mapping from a
|
||||
* C++ type to an MPI type. For instance, the C++ @c int type maps
|
||||
* directly to the MPI type @c MPI_INT. When there is a direct
|
||||
* mapping from the type @c T to an MPI type, @c
|
||||
* is_mpi_builtin_datatype will derive from @c mpl::true_ and the MPI
|
||||
* data type will be accessible via @c get_mpi_datatype.
|
||||
*
|
||||
* In general, users should not need to specialize this
|
||||
* trait. However, if you have an additional C++ type that can map
|
||||
* directly to only of MPI's built-in types, specialize either this
|
||||
* trait or one of the traits corresponding to categories of MPI data
|
||||
* types (@c is_mpi_integer_datatype, @c
|
||||
* is_mpi_floating_point_datatype, @c is_mpi_logical_datatype, @c
|
||||
* is_mpi_complex_datatype, or @c is_mpi_builtin_datatype). @c
|
||||
* is_mpi_builtin_datatype derives @c mpl::true_ if any of the traits
|
||||
* corresponding to MPI data type categories derived @c mpl::true_.
|
||||
*/
|
||||
template<typename T>
|
||||
struct is_mpi_builtin_datatype
|
||||
: boost::mpl::or_<is_mpi_integer_datatype<T>,
|
||||
is_mpi_floating_point_datatype<T>,
|
||||
is_mpi_logical_datatype<T>,
|
||||
is_mpi_complex_datatype<T>,
|
||||
is_mpi_byte_datatype<T> >
|
||||
{
|
||||
};
|
||||
|
||||
/** @brief Type trait that determines if a C++ type can be mapped to
|
||||
* an MPI data type.
|
||||
*
|
||||
* This type trait determines if it is possible to build an MPI data
|
||||
* type that represents a C++ data type. When this is the case, @c
|
||||
* is_mpi_datatype derives @c mpl::true_ and the MPI data type will
|
||||
* be accessible via @c get_mpi_datatype.
|
||||
|
||||
* For any C++ type that maps to a built-in MPI data type (see @c
|
||||
* is_mpi_builtin_datatype), @c is_mpi_data_type is trivially
|
||||
* true. However, any POD ("Plain Old Data") type containing types
|
||||
* that themselves can be represented by MPI data types can itself be
|
||||
* represented as an MPI data type. For instance, a @c point3d class
|
||||
* containing three @c double values can be represented as an MPI
|
||||
* data type. To do so, first make the data type Serializable (using
|
||||
* the Boost.Serialization library); then, specialize the @c
|
||||
* is_mpi_datatype trait for the point type so that it will derive @c
|
||||
* mpl::true_:
|
||||
*
|
||||
* @code
|
||||
* namespace boost { namespace mpi {
|
||||
* template<> struct is_mpi_datatype<point>
|
||||
* : public mpl::true_ { };
|
||||
* } }
|
||||
* @endcode
|
||||
*/
|
||||
template<typename T>
|
||||
struct is_mpi_datatype
|
||||
: public is_mpi_builtin_datatype<T>
|
||||
{
|
||||
};
|
||||
|
||||
/** @brief Returns an MPI data type for a C++ type.
|
||||
*
|
||||
* The function creates an MPI data type for the given object @c
|
||||
* x. The first time it is called for a class @c T, the MPI data type
|
||||
* is created and cached. Subsequent calls for objects of the same
|
||||
* type @c T return the cached MPI data type. The type @c T must
|
||||
* allow creation of an MPI data type. That is, it must be
|
||||
* Serializable and @c is_mpi_datatype<T> must derive @c mpl::true_.
|
||||
*
|
||||
* For fundamental MPI types, a copy of the MPI data type of the MPI
|
||||
* library is returned.
|
||||
*
|
||||
* Note that since the data types are cached, the caller should never
|
||||
* call @c MPI_Type_free() for the MPI data type returned by this
|
||||
* call.
|
||||
*
|
||||
* @param x for an optimized call, a constructed object of the type
|
||||
* should be passed; otherwise, an object will be
|
||||
* default-constructed.
|
||||
*
|
||||
* @returns The MPI data type corresponding to type @c T.
|
||||
*/
|
||||
template<typename T> MPI_Datatype get_mpi_datatype(const T& x)
|
||||
{
|
||||
BOOST_MPL_ASSERT((is_mpi_datatype<T>));
|
||||
return detail::mpi_datatype_cache().datatype(x);
|
||||
}
|
||||
|
||||
// Don't parse this part when we're generating Doxygen documentation.
|
||||
#ifndef BOOST_MPI_DOXYGEN
|
||||
|
||||
/// INTERNAL ONLY
|
||||
#define BOOST_MPI_DATATYPE(CppType, MPIType, Kind) \
|
||||
template<> \
|
||||
inline MPI_Datatype \
|
||||
get_mpi_datatype< CppType >(const CppType&) { return MPIType; } \
|
||||
\
|
||||
template<> \
|
||||
struct BOOST_JOIN(is_mpi_,BOOST_JOIN(Kind,_datatype))< CppType > \
|
||||
: boost::mpl::true_ \
|
||||
{}
|
||||
|
||||
/// INTERNAL ONLY
|
||||
BOOST_MPI_DATATYPE(packed, MPI_PACKED, builtin);
|
||||
|
||||
/// INTERNAL ONLY
|
||||
BOOST_MPI_DATATYPE(char, MPI_CHAR, builtin);
|
||||
|
||||
/// INTERNAL ONLY
|
||||
BOOST_MPI_DATATYPE(short, MPI_SHORT, integer);
|
||||
|
||||
/// INTERNAL ONLY
|
||||
BOOST_MPI_DATATYPE(int, MPI_INT, integer);
|
||||
|
||||
/// INTERNAL ONLY
|
||||
BOOST_MPI_DATATYPE(long, MPI_LONG, integer);
|
||||
|
||||
/// INTERNAL ONLY
|
||||
BOOST_MPI_DATATYPE(float, MPI_FLOAT, floating_point);
|
||||
|
||||
/// INTERNAL ONLY
|
||||
BOOST_MPI_DATATYPE(double, MPI_DOUBLE, floating_point);
|
||||
|
||||
/// INTERNAL ONLY
|
||||
BOOST_MPI_DATATYPE(long double, MPI_LONG_DOUBLE, floating_point);
|
||||
|
||||
/// INTERNAL ONLY
|
||||
BOOST_MPI_DATATYPE(unsigned char, MPI_UNSIGNED_CHAR, builtin);
|
||||
|
||||
/// INTERNAL ONLY
|
||||
BOOST_MPI_DATATYPE(unsigned short, MPI_UNSIGNED_SHORT, integer);
|
||||
|
||||
/// INTERNAL ONLY
|
||||
BOOST_MPI_DATATYPE(unsigned, MPI_UNSIGNED, integer);
|
||||
|
||||
/// INTERNAL ONLY
|
||||
BOOST_MPI_DATATYPE(unsigned long, MPI_UNSIGNED_LONG, integer);
|
||||
|
||||
/// INTERNAL ONLY
|
||||
#define BOOST_MPI_LIST2(A, B) A, B
|
||||
/// INTERNAL ONLY
|
||||
BOOST_MPI_DATATYPE(std::pair<BOOST_MPI_LIST2(float, int)>, MPI_FLOAT_INT,
|
||||
builtin);
|
||||
/// INTERNAL ONLY
|
||||
BOOST_MPI_DATATYPE(std::pair<BOOST_MPI_LIST2(double, int)>, MPI_DOUBLE_INT,
|
||||
builtin);
|
||||
/// INTERNAL ONLY
|
||||
BOOST_MPI_DATATYPE(std::pair<BOOST_MPI_LIST2(long double, int)>,
|
||||
MPI_LONG_DOUBLE_INT, builtin);
|
||||
/// INTERNAL ONLY
|
||||
BOOST_MPI_DATATYPE(std::pair<BOOST_MPI_LIST2(long, int>), MPI_LONG_INT,
|
||||
builtin);
|
||||
/// INTERNAL ONLY
|
||||
BOOST_MPI_DATATYPE(std::pair<BOOST_MPI_LIST2(short, int>), MPI_SHORT_INT,
|
||||
builtin);
|
||||
/// INTERNAL ONLY
|
||||
BOOST_MPI_DATATYPE(std::pair<BOOST_MPI_LIST2(int, int>), MPI_2INT, builtin);
|
||||
#undef BOOST_MPI_LIST2
|
||||
|
||||
/// specialization of is_mpi_datatype for pairs
|
||||
template <class T, class U>
|
||||
struct is_mpi_datatype<std::pair<T,U> >
|
||||
: public mpl::and_<is_mpi_datatype<T>,is_mpi_datatype<U> >
|
||||
{
|
||||
};
|
||||
|
||||
/// specialization of is_mpi_datatype for arrays
|
||||
#if defined(__cplusplus) && (201103L <= __cplusplus)
|
||||
template<class T, std::size_t N>
|
||||
struct is_mpi_datatype<std::array<T, N> >
|
||||
: public is_mpi_datatype<T>
|
||||
{
|
||||
};
|
||||
#endif
|
||||
|
||||
// Define wchar_t specialization of is_mpi_datatype, if possible.
|
||||
#if !defined(BOOST_NO_INTRINSIC_WCHAR_T) && \
|
||||
(defined(MPI_WCHAR) || (defined(MPI_VERSION) && MPI_VERSION >= 2))
|
||||
BOOST_MPI_DATATYPE(wchar_t, MPI_WCHAR, builtin);
|
||||
#endif
|
||||
|
||||
// Define long long or __int64 specialization of is_mpi_datatype, if possible.
|
||||
#if defined(BOOST_HAS_LONG_LONG) && \
|
||||
(defined(MPI_LONG_LONG_INT) || (defined(MPI_VERSION) && MPI_VERSION >= 2))
|
||||
BOOST_MPI_DATATYPE(long long, MPI_LONG_LONG_INT, builtin);
|
||||
#elif defined(BOOST_HAS_MS_INT64) && \
|
||||
(defined(MPI_LONG_LONG_INT) || (defined(MPI_VERSION) && MPI_VERSION >= 2))
|
||||
BOOST_MPI_DATATYPE(__int64, MPI_LONG_LONG_INT, builtin);
|
||||
#endif
|
||||
|
||||
// Define unsigned long long or unsigned __int64 specialization of
|
||||
// is_mpi_datatype, if possible. We separate this from the check for
|
||||
// the (signed) long long/__int64 because some MPI implementations
|
||||
// (e.g., MPICH-MX) have MPI_LONG_LONG_INT but not
|
||||
// MPI_UNSIGNED_LONG_LONG.
|
||||
#if defined(BOOST_HAS_LONG_LONG) && \
|
||||
(defined(MPI_UNSIGNED_LONG_LONG) \
|
||||
|| (defined(MPI_VERSION) && MPI_VERSION >= 2))
|
||||
BOOST_MPI_DATATYPE(unsigned long long, MPI_UNSIGNED_LONG_LONG, builtin);
|
||||
#elif defined(BOOST_HAS_MS_INT64) && \
|
||||
(defined(MPI_UNSIGNED_LONG_LONG) \
|
||||
|| (defined(MPI_VERSION) && MPI_VERSION >= 2))
|
||||
BOOST_MPI_DATATYPE(unsigned __int64, MPI_UNSIGNED_LONG_LONG, builtin);
|
||||
#endif
|
||||
|
||||
// Define signed char specialization of is_mpi_datatype, if possible.
|
||||
#if defined(MPI_SIGNED_CHAR) || (defined(MPI_VERSION) && MPI_VERSION >= 2)
|
||||
BOOST_MPI_DATATYPE(signed char, MPI_SIGNED_CHAR, builtin);
|
||||
#endif
|
||||
|
||||
|
||||
#endif // Doxygen
|
||||
|
||||
namespace detail {
|
||||
inline MPI_Datatype build_mpi_datatype_for_bool()
|
||||
{
|
||||
MPI_Datatype type;
|
||||
MPI_Type_contiguous(sizeof(bool), MPI_BYTE, &type);
|
||||
MPI_Type_commit(&type);
|
||||
return type;
|
||||
}
|
||||
}
|
||||
|
||||
/// Support for bool. There is no corresponding MPI_BOOL.
|
||||
/// INTERNAL ONLY
|
||||
template<>
|
||||
inline MPI_Datatype get_mpi_datatype<bool>(const bool&)
|
||||
{
|
||||
static MPI_Datatype type = detail::build_mpi_datatype_for_bool();
|
||||
return type;
|
||||
}
|
||||
|
||||
/// INTERNAL ONLY
|
||||
template<>
|
||||
struct is_mpi_datatype<bool>
|
||||
: boost::mpl::bool_<true>
|
||||
{};
|
||||
|
||||
|
||||
#ifndef BOOST_MPI_DOXYGEN
|
||||
// direct support for special primitive data types of the serialization library
|
||||
BOOST_MPI_DATATYPE(boost::archive::library_version_type, get_mpi_datatype(uint_least16_t()), integer);
|
||||
BOOST_MPI_DATATYPE(boost::archive::version_type, get_mpi_datatype(uint_least8_t()), integer);
|
||||
BOOST_MPI_DATATYPE(boost::archive::class_id_type, get_mpi_datatype(int_least16_t()), integer);
|
||||
BOOST_MPI_DATATYPE(boost::archive::class_id_reference_type, get_mpi_datatype(int_least16_t()), integer);
|
||||
BOOST_MPI_DATATYPE(boost::archive::class_id_optional_type, get_mpi_datatype(int_least16_t()), integer);
|
||||
BOOST_MPI_DATATYPE(boost::archive::object_id_type, get_mpi_datatype(uint_least32_t()), integer);
|
||||
BOOST_MPI_DATATYPE(boost::archive::object_reference_type, get_mpi_datatype(uint_least32_t()), integer);
|
||||
BOOST_MPI_DATATYPE(boost::archive::tracking_type, get_mpi_datatype(bool()), builtin);
|
||||
BOOST_MPI_DATATYPE(boost::serialization::collection_size_type, get_mpi_datatype(std::size_t()), integer);
|
||||
BOOST_MPI_DATATYPE(boost::serialization::item_version_type, get_mpi_datatype(uint_least8_t()), integer);
|
||||
#endif // Doxygen
|
||||
|
||||
|
||||
} } // end namespace boost::mpi
|
||||
|
||||
// direct support for special primitive data types of the serialization library
|
||||
// in the case of homogeneous systems
|
||||
// define a macro to make explicit designation of this more transparent
|
||||
#define BOOST_IS_MPI_DATATYPE(T) \
|
||||
namespace boost { \
|
||||
namespace mpi { \
|
||||
template<> \
|
||||
struct is_mpi_datatype< T > : mpl::true_ {}; \
|
||||
}} \
|
||||
/**/
|
||||
|
||||
|
||||
#endif // BOOST_MPI_MPI_DATATYPE_HPP
|
||||
@@ -0,0 +1,32 @@
|
||||
// Copyright (C) 2004 Arkadiy Vertleyb
|
||||
// Use, modification and distribution is subject to the Boost Software
|
||||
// License, Version 1.0. (http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
#include <boost/typeof/encode_decode_params.hpp>
|
||||
|
||||
// member functions
|
||||
|
||||
template<class V, class T, class R BOOST_PP_ENUM_TRAILING_PARAMS(n, class P)>
|
||||
struct encode_type_impl<V, R(T::*)(BOOST_PP_ENUM_PARAMS(n, P)) BOOST_TYPEOF_qualifier>
|
||||
{
|
||||
typedef R BOOST_PP_CAT(P, n);
|
||||
typedef T BOOST_PP_CAT(P, BOOST_PP_INC(n));
|
||||
typedef BOOST_TYPEOF_ENCODE_PARAMS(BOOST_PP_ADD(n, 2), BOOST_TYPEOF_id + n) type;
|
||||
};
|
||||
|
||||
template<class Iter>
|
||||
struct decode_type_impl<boost::mpl::size_t<BOOST_TYPEOF_id + n>, Iter>
|
||||
{
|
||||
typedef Iter iter0;
|
||||
BOOST_TYPEOF_DECODE_PARAMS(BOOST_PP_ADD(n, 2))
|
||||
template<class T> struct workaround{
|
||||
typedef BOOST_PP_CAT(p, n)(T::*type)(BOOST_PP_ENUM_PARAMS(n, p)) BOOST_TYPEOF_qualifier;
|
||||
};
|
||||
typedef typename workaround<BOOST_PP_CAT(p, BOOST_PP_INC(n))>::type type;
|
||||
typedef BOOST_PP_CAT(iter, BOOST_PP_ADD(n, 2)) iter;
|
||||
};
|
||||
|
||||
// undef parameters
|
||||
|
||||
#undef BOOST_TYPEOF_id
|
||||
#undef BOOST_TYPEOF_qualifier
|
||||
@@ -0,0 +1,99 @@
|
||||
|
||||
// Copyright Aleksey Gurtovoy 2000-2004
|
||||
// Copyright Jaap Suter 2003
|
||||
//
|
||||
// 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/shift_left.hpp" header
|
||||
// -- DO NOT modify by hand!
|
||||
|
||||
namespace boost { namespace mpl {
|
||||
|
||||
template<
|
||||
typename Tag1
|
||||
, typename Tag2
|
||||
>
|
||||
struct shift_left_impl
|
||||
: if_c<
|
||||
( BOOST_MPL_AUX_NESTED_VALUE_WKND(int, Tag1)
|
||||
> BOOST_MPL_AUX_NESTED_VALUE_WKND(int, Tag2)
|
||||
)
|
||||
|
||||
, aux::cast2nd_impl< shift_left_impl< Tag1,Tag1 >,Tag1, Tag2 >
|
||||
, aux::cast1st_impl< shift_left_impl< Tag2,Tag2 >,Tag1, Tag2 >
|
||||
>::type
|
||||
{
|
||||
};
|
||||
|
||||
/// for Digital Mars C++/compilers with no CTPS/TTP support
|
||||
template<> struct shift_left_impl< na,na >
|
||||
{
|
||||
template< typename U1, typename U2 > struct apply
|
||||
{
|
||||
typedef apply type;
|
||||
BOOST_STATIC_CONSTANT(int, value = 0);
|
||||
};
|
||||
};
|
||||
|
||||
template<> struct shift_left_impl< na,integral_c_tag >
|
||||
{
|
||||
template< typename U1, typename U2 > struct apply
|
||||
{
|
||||
typedef apply type;
|
||||
BOOST_STATIC_CONSTANT(int, value = 0);
|
||||
};
|
||||
};
|
||||
|
||||
template<> struct shift_left_impl< integral_c_tag,na >
|
||||
{
|
||||
template< typename U1, typename U2 > struct apply
|
||||
{
|
||||
typedef apply type;
|
||||
BOOST_STATIC_CONSTANT(int, value = 0);
|
||||
};
|
||||
};
|
||||
|
||||
template< typename T > struct shift_left_tag
|
||||
{
|
||||
typedef typename T::tag type;
|
||||
};
|
||||
|
||||
template<
|
||||
typename BOOST_MPL_AUX_NA_PARAM(N1)
|
||||
, typename BOOST_MPL_AUX_NA_PARAM(N2)
|
||||
>
|
||||
struct shift_left
|
||||
|
||||
: shift_left_impl<
|
||||
typename shift_left_tag<N1>::type
|
||||
, typename shift_left_tag<N2>::type
|
||||
>::template apply< N1,N2 >::type
|
||||
{
|
||||
BOOST_MPL_AUX_LAMBDA_SUPPORT(2, shift_left, (N1, N2))
|
||||
|
||||
};
|
||||
|
||||
BOOST_MPL_AUX_NA_SPEC2(2, 2, shift_left)
|
||||
|
||||
}}
|
||||
|
||||
namespace boost { namespace mpl {
|
||||
template<>
|
||||
struct shift_left_impl< integral_c_tag,integral_c_tag >
|
||||
{
|
||||
template< typename N, typename S > struct apply
|
||||
|
||||
: integral_c<
|
||||
typename N::value_type
|
||||
, ( BOOST_MPL_AUX_VALUE_WKND(N)::value
|
||||
<< BOOST_MPL_AUX_VALUE_WKND(S)::value
|
||||
)
|
||||
>
|
||||
{
|
||||
};
|
||||
};
|
||||
|
||||
}}
|
||||
@@ -0,0 +1,249 @@
|
||||
|
||||
// Copyright (C) 2003-2004 Jeremy B. Maitin-Shepard.
|
||||
// Copyright (C) 2005-2011 Daniel James
|
||||
// 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_UNORDERED_DETAIL_UTIL_HPP_INCLUDED
|
||||
#define BOOST_UNORDERED_DETAIL_UTIL_HPP_INCLUDED
|
||||
|
||||
#include <boost/config.hpp>
|
||||
#if defined(BOOST_HAS_PRAGMA_ONCE)
|
||||
#pragma once
|
||||
#endif
|
||||
|
||||
#include <boost/type_traits/is_convertible.hpp>
|
||||
#include <boost/type_traits/is_empty.hpp>
|
||||
#include <boost/iterator/iterator_categories.hpp>
|
||||
#include <boost/utility/enable_if.hpp>
|
||||
#include <boost/detail/select_type.hpp>
|
||||
#include <boost/move/move.hpp>
|
||||
#include <boost/preprocessor/seq/size.hpp>
|
||||
#include <boost/preprocessor/seq/enum.hpp>
|
||||
#include <boost/swap.hpp>
|
||||
|
||||
namespace boost { namespace unordered { namespace detail {
|
||||
|
||||
static const float minimum_max_load_factor = 1e-3f;
|
||||
static const std::size_t default_bucket_count = 11;
|
||||
struct move_tag {};
|
||||
struct empty_emplace {};
|
||||
|
||||
namespace func {
|
||||
template <class T>
|
||||
inline void ignore_unused_variable_warning(T const&) {}
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////
|
||||
// iterator SFINAE
|
||||
|
||||
template <typename I>
|
||||
struct is_forward :
|
||||
boost::is_convertible<
|
||||
typename boost::iterator_traversal<I>::type,
|
||||
boost::forward_traversal_tag>
|
||||
{};
|
||||
|
||||
template <typename I, typename ReturnType>
|
||||
struct enable_if_forward :
|
||||
boost::enable_if_c<
|
||||
boost::unordered::detail::is_forward<I>::value,
|
||||
ReturnType>
|
||||
{};
|
||||
|
||||
template <typename I, typename ReturnType>
|
||||
struct disable_if_forward :
|
||||
boost::disable_if_c<
|
||||
boost::unordered::detail::is_forward<I>::value,
|
||||
ReturnType>
|
||||
{};
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////
|
||||
// primes
|
||||
|
||||
#define BOOST_UNORDERED_PRIMES \
|
||||
(17ul)(29ul)(37ul)(53ul)(67ul)(79ul) \
|
||||
(97ul)(131ul)(193ul)(257ul)(389ul)(521ul)(769ul) \
|
||||
(1031ul)(1543ul)(2053ul)(3079ul)(6151ul)(12289ul)(24593ul) \
|
||||
(49157ul)(98317ul)(196613ul)(393241ul)(786433ul) \
|
||||
(1572869ul)(3145739ul)(6291469ul)(12582917ul)(25165843ul) \
|
||||
(50331653ul)(100663319ul)(201326611ul)(402653189ul)(805306457ul) \
|
||||
(1610612741ul)(3221225473ul)(4294967291ul)
|
||||
|
||||
template<class T> struct prime_list_template
|
||||
{
|
||||
static std::size_t const value[];
|
||||
|
||||
#if !defined(SUNPRO_CC)
|
||||
static std::ptrdiff_t const length;
|
||||
#else
|
||||
static std::ptrdiff_t const length
|
||||
= BOOST_PP_SEQ_SIZE(BOOST_UNORDERED_PRIMES);
|
||||
#endif
|
||||
};
|
||||
|
||||
template<class T>
|
||||
std::size_t const prime_list_template<T>::value[] = {
|
||||
BOOST_PP_SEQ_ENUM(BOOST_UNORDERED_PRIMES)
|
||||
};
|
||||
|
||||
#if !defined(SUNPRO_CC)
|
||||
template<class T>
|
||||
std::ptrdiff_t const prime_list_template<T>::length
|
||||
= BOOST_PP_SEQ_SIZE(BOOST_UNORDERED_PRIMES);
|
||||
#endif
|
||||
|
||||
#undef BOOST_UNORDERED_PRIMES
|
||||
|
||||
typedef prime_list_template<std::size_t> prime_list;
|
||||
|
||||
// no throw
|
||||
inline std::size_t next_prime(std::size_t num) {
|
||||
std::size_t const* const prime_list_begin = prime_list::value;
|
||||
std::size_t const* const prime_list_end = prime_list_begin +
|
||||
prime_list::length;
|
||||
std::size_t const* bound =
|
||||
std::lower_bound(prime_list_begin, prime_list_end, num);
|
||||
if(bound == prime_list_end)
|
||||
bound--;
|
||||
return *bound;
|
||||
}
|
||||
|
||||
// no throw
|
||||
inline std::size_t prev_prime(std::size_t num) {
|
||||
std::size_t const* const prime_list_begin = prime_list::value;
|
||||
std::size_t const* const prime_list_end = prime_list_begin +
|
||||
prime_list::length;
|
||||
std::size_t const* bound =
|
||||
std::upper_bound(prime_list_begin,prime_list_end, num);
|
||||
if(bound != prime_list_begin)
|
||||
bound--;
|
||||
return *bound;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////
|
||||
// insert_size/initial_size
|
||||
|
||||
template <class I>
|
||||
inline std::size_t insert_size(I i, I j, typename
|
||||
boost::unordered::detail::enable_if_forward<I, void*>::type = 0)
|
||||
{
|
||||
return static_cast<std::size_t>(std::distance(i, j));
|
||||
}
|
||||
|
||||
template <class I>
|
||||
inline std::size_t insert_size(I, I, typename
|
||||
boost::unordered::detail::disable_if_forward<I, void*>::type = 0)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
template <class I>
|
||||
inline std::size_t initial_size(I i, I j,
|
||||
std::size_t num_buckets =
|
||||
boost::unordered::detail::default_bucket_count)
|
||||
{
|
||||
// TODO: Why +1?
|
||||
return (std::max)(
|
||||
boost::unordered::detail::insert_size(i, j) + 1,
|
||||
num_buckets);
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////
|
||||
// compressed
|
||||
|
||||
template <typename T, int Index>
|
||||
struct compressed_base : private T
|
||||
{
|
||||
compressed_base(T const& x) : T(x) {}
|
||||
compressed_base(T& x, move_tag) : T(boost::move(x)) {}
|
||||
|
||||
T& get() { return *this; }
|
||||
T const& get() const { return *this; }
|
||||
};
|
||||
|
||||
template <typename T, int Index>
|
||||
struct uncompressed_base
|
||||
{
|
||||
uncompressed_base(T const& x) : value_(x) {}
|
||||
uncompressed_base(T& x, move_tag) : value_(boost::move(x)) {}
|
||||
|
||||
T& get() { return value_; }
|
||||
T const& get() const { return value_; }
|
||||
private:
|
||||
T value_;
|
||||
};
|
||||
|
||||
template <typename T, int Index>
|
||||
struct generate_base
|
||||
: boost::detail::if_true<
|
||||
boost::is_empty<T>::value
|
||||
>:: BOOST_NESTED_TEMPLATE then<
|
||||
boost::unordered::detail::compressed_base<T, Index>,
|
||||
boost::unordered::detail::uncompressed_base<T, Index>
|
||||
>
|
||||
{};
|
||||
|
||||
template <typename T1, typename T2>
|
||||
struct compressed
|
||||
: private boost::unordered::detail::generate_base<T1, 1>::type,
|
||||
private boost::unordered::detail::generate_base<T2, 2>::type
|
||||
{
|
||||
typedef typename generate_base<T1, 1>::type base1;
|
||||
typedef typename generate_base<T2, 2>::type base2;
|
||||
|
||||
typedef T1 first_type;
|
||||
typedef T2 second_type;
|
||||
|
||||
first_type& first() {
|
||||
return static_cast<base1*>(this)->get();
|
||||
}
|
||||
|
||||
first_type const& first() const {
|
||||
return static_cast<base1 const*>(this)->get();
|
||||
}
|
||||
|
||||
second_type& second() {
|
||||
return static_cast<base2*>(this)->get();
|
||||
}
|
||||
|
||||
second_type const& second() const {
|
||||
return static_cast<base2 const*>(this)->get();
|
||||
}
|
||||
|
||||
template <typename First, typename Second>
|
||||
compressed(First const& x1, Second const& x2)
|
||||
: base1(x1), base2(x2) {}
|
||||
|
||||
compressed(compressed const& x)
|
||||
: base1(x.first()), base2(x.second()) {}
|
||||
|
||||
compressed(compressed& x, move_tag m)
|
||||
: base1(x.first(), m), base2(x.second(), m) {}
|
||||
|
||||
void assign(compressed const& x)
|
||||
{
|
||||
first() = x.first();
|
||||
second() = x.second();
|
||||
}
|
||||
|
||||
void move_assign(compressed& x)
|
||||
{
|
||||
first() = boost::move(x.first());
|
||||
second() = boost::move(x.second());
|
||||
}
|
||||
|
||||
void swap(compressed& x)
|
||||
{
|
||||
boost::swap(first(), x.first());
|
||||
boost::swap(second(), x.second());
|
||||
}
|
||||
|
||||
private:
|
||||
// Prevent assignment just to make use of assign or
|
||||
// move_assign explicit.
|
||||
compressed& operator=(compressed const&);
|
||||
};
|
||||
}}}
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,254 @@
|
||||
//---------------------------------------------------------------------------//
|
||||
// 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_RANDOM_MERSENNE_TWISTER_ENGINE_HPP
|
||||
#define BOOST_COMPUTE_RANDOM_MERSENNE_TWISTER_ENGINE_HPP
|
||||
|
||||
#include <algorithm>
|
||||
|
||||
#include <boost/compute/types.hpp>
|
||||
#include <boost/compute/buffer.hpp>
|
||||
#include <boost/compute/kernel.hpp>
|
||||
#include <boost/compute/context.hpp>
|
||||
#include <boost/compute/program.hpp>
|
||||
#include <boost/compute/command_queue.hpp>
|
||||
#include <boost/compute/algorithm/transform.hpp>
|
||||
#include <boost/compute/container/vector.hpp>
|
||||
#include <boost/compute/detail/iterator_range_size.hpp>
|
||||
#include <boost/compute/iterator/discard_iterator.hpp>
|
||||
#include <boost/compute/utility/program_cache.hpp>
|
||||
|
||||
namespace boost {
|
||||
namespace compute {
|
||||
|
||||
/// \class mersenne_twister_engine
|
||||
/// \brief Mersenne twister pseudorandom number generator.
|
||||
template<class T>
|
||||
class mersenne_twister_engine
|
||||
{
|
||||
public:
|
||||
typedef T result_type;
|
||||
static const T default_seed = 5489U;
|
||||
static const T n = 624;
|
||||
static const T m = 397;
|
||||
|
||||
/// Creates a new mersenne_twister_engine and seeds it with \p value.
|
||||
explicit mersenne_twister_engine(command_queue &queue,
|
||||
result_type value = default_seed)
|
||||
: m_context(queue.get_context()),
|
||||
m_state_buffer(m_context, n * sizeof(result_type))
|
||||
{
|
||||
// setup program
|
||||
load_program();
|
||||
|
||||
// seed state
|
||||
seed(value, queue);
|
||||
}
|
||||
|
||||
/// Creates a new mersenne_twister_engine object as a copy of \p other.
|
||||
mersenne_twister_engine(const mersenne_twister_engine<T> &other)
|
||||
: m_context(other.m_context),
|
||||
m_state_index(other.m_state_index),
|
||||
m_program(other.m_program),
|
||||
m_state_buffer(other.m_state_buffer)
|
||||
{
|
||||
}
|
||||
|
||||
/// Copies \p other to \c *this.
|
||||
mersenne_twister_engine<T>& operator=(const mersenne_twister_engine<T> &other)
|
||||
{
|
||||
if(this != &other){
|
||||
m_context = other.m_context;
|
||||
m_state_index = other.m_state_index;
|
||||
m_program = other.m_program;
|
||||
m_state_buffer = other.m_state_buffer;
|
||||
}
|
||||
|
||||
return *this;
|
||||
}
|
||||
|
||||
/// Destroys the mersenne_twister_engine object.
|
||||
~mersenne_twister_engine()
|
||||
{
|
||||
}
|
||||
|
||||
/// Seeds the random number generator with \p value.
|
||||
///
|
||||
/// \param value seed value for the random-number generator
|
||||
/// \param queue command queue to perform the operation
|
||||
///
|
||||
/// If no seed value is provided, \c default_seed is used.
|
||||
void seed(result_type value, command_queue &queue)
|
||||
{
|
||||
kernel seed_kernel = m_program.create_kernel("seed");
|
||||
seed_kernel.set_arg(0, value);
|
||||
seed_kernel.set_arg(1, m_state_buffer);
|
||||
|
||||
queue.enqueue_task(seed_kernel);
|
||||
|
||||
m_state_index = 0;
|
||||
}
|
||||
|
||||
/// \overload
|
||||
void seed(command_queue &queue)
|
||||
{
|
||||
seed(default_seed, queue);
|
||||
}
|
||||
|
||||
/// Generates random numbers and stores them to the range [\p first, \p last).
|
||||
template<class OutputIterator>
|
||||
void generate(OutputIterator first, OutputIterator last, command_queue &queue)
|
||||
{
|
||||
const size_t size = detail::iterator_range_size(first, last);
|
||||
|
||||
kernel fill_kernel(m_program, "fill");
|
||||
fill_kernel.set_arg(0, m_state_buffer);
|
||||
fill_kernel.set_arg(2, first.get_buffer());
|
||||
|
||||
size_t offset = 0;
|
||||
size_t &p = m_state_index;
|
||||
|
||||
for(;;){
|
||||
size_t count = 0;
|
||||
if(size > n){
|
||||
count = (std::min)(static_cast<size_t>(n), size - offset);
|
||||
}
|
||||
else {
|
||||
count = size;
|
||||
}
|
||||
fill_kernel.set_arg(1, static_cast<const uint_>(p));
|
||||
fill_kernel.set_arg(3, static_cast<const uint_>(offset));
|
||||
queue.enqueue_1d_range_kernel(fill_kernel, 0, count, 0);
|
||||
|
||||
p += count;
|
||||
offset += count;
|
||||
|
||||
if(offset >= size){
|
||||
break;
|
||||
}
|
||||
|
||||
generate_state(queue);
|
||||
p = 0;
|
||||
}
|
||||
}
|
||||
|
||||
/// \internal_
|
||||
void generate(discard_iterator first, discard_iterator last, command_queue &queue)
|
||||
{
|
||||
(void) queue;
|
||||
|
||||
m_state_index += std::distance(first, last);
|
||||
}
|
||||
|
||||
/// Generates random numbers, transforms them with \p op, and then stores
|
||||
/// them to the range [\p first, \p last).
|
||||
template<class OutputIterator, class Function>
|
||||
void generate(OutputIterator first, OutputIterator last, Function op, command_queue &queue)
|
||||
{
|
||||
vector<T> tmp(std::distance(first, last), queue.get_context());
|
||||
generate(tmp.begin(), tmp.end(), queue);
|
||||
transform(tmp.begin(), tmp.end(), first, op, queue);
|
||||
}
|
||||
|
||||
/// Generates \p z random numbers and discards them.
|
||||
void discard(size_t z, command_queue &queue)
|
||||
{
|
||||
generate(discard_iterator(0), discard_iterator(z), queue);
|
||||
}
|
||||
|
||||
/// \internal_ (deprecated)
|
||||
template<class OutputIterator>
|
||||
void fill(OutputIterator first, OutputIterator last, command_queue &queue)
|
||||
{
|
||||
generate(first, last, queue);
|
||||
}
|
||||
|
||||
private:
|
||||
/// \internal_
|
||||
void generate_state(command_queue &queue)
|
||||
{
|
||||
kernel generate_state_kernel =
|
||||
m_program.create_kernel("generate_state");
|
||||
generate_state_kernel.set_arg(0, m_state_buffer);
|
||||
queue.enqueue_task(generate_state_kernel);
|
||||
}
|
||||
|
||||
/// \internal_
|
||||
void load_program()
|
||||
{
|
||||
boost::shared_ptr<program_cache> cache =
|
||||
program_cache::get_global_cache(m_context);
|
||||
|
||||
std::string cache_key =
|
||||
std::string("__boost_mersenne_twister_engine_") + type_name<T>();
|
||||
|
||||
const char source[] =
|
||||
"static uint twiddle(uint u, uint v)\n"
|
||||
"{\n"
|
||||
" return (((u & 0x80000000U) | (v & 0x7FFFFFFFU)) >> 1) ^\n"
|
||||
" ((v & 1U) ? 0x9908B0DFU : 0x0U);\n"
|
||||
"}\n"
|
||||
|
||||
"__kernel void generate_state(__global uint *state)\n"
|
||||
"{\n"
|
||||
" const uint n = 624;\n"
|
||||
" const uint m = 397;\n"
|
||||
" for(uint i = 0; i < (n - m); i++)\n"
|
||||
" state[i] = state[i+m] ^ twiddle(state[i], state[i+1]);\n"
|
||||
" for(uint i = n - m; i < (n - 1); i++)\n"
|
||||
" state[i] = state[i+m-n] ^ twiddle(state[i], state[i+1]);\n"
|
||||
" state[n-1] = state[m-1] ^ twiddle(state[n-1], state[0]);\n"
|
||||
"}\n"
|
||||
|
||||
"__kernel void seed(const uint s, __global uint *state)\n"
|
||||
"{\n"
|
||||
" const uint n = 624;\n"
|
||||
" state[0] = s & 0xFFFFFFFFU;\n"
|
||||
" for(uint i = 1; i < n; i++){\n"
|
||||
" state[i] = 1812433253U * (state[i-1] ^ (state[i-1] >> 30)) + i;\n"
|
||||
" state[i] &= 0xFFFFFFFFU;\n"
|
||||
" }\n"
|
||||
" generate_state(state);\n"
|
||||
"}\n"
|
||||
|
||||
"static uint random_number(__global uint *state, const uint p)\n"
|
||||
"{\n"
|
||||
" uint x = state[p];\n"
|
||||
" x ^= (x >> 11);\n"
|
||||
" x ^= (x << 7) & 0x9D2C5680U;\n"
|
||||
" x ^= (x << 15) & 0xEFC60000U;\n"
|
||||
" return x ^ (x >> 18);\n"
|
||||
"}\n"
|
||||
|
||||
"__kernel void fill(__global uint *state,\n"
|
||||
" const uint state_index,\n"
|
||||
" __global uint *vector,\n"
|
||||
" const uint offset)\n"
|
||||
"{\n"
|
||||
" const uint i = get_global_id(0);\n"
|
||||
" vector[offset+i] = random_number(state, state_index + i);\n"
|
||||
"}\n";
|
||||
|
||||
m_program = cache->get_or_build(cache_key, std::string(), source, m_context);
|
||||
}
|
||||
|
||||
private:
|
||||
context m_context;
|
||||
size_t m_state_index;
|
||||
program m_program;
|
||||
buffer m_state_buffer;
|
||||
};
|
||||
|
||||
typedef mersenne_twister_engine<uint_> mt19937;
|
||||
|
||||
} // end compute namespace
|
||||
} // end boost namespace
|
||||
|
||||
#endif // BOOST_COMPUTE_RANDOM_MERSENNE_TWISTER_ENGINE_HPP
|
||||
@@ -0,0 +1,80 @@
|
||||
// (C) Copyright 2005 Matthias Troyer
|
||||
|
||||
// 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)
|
||||
|
||||
// Authors: Matthias Troyer
|
||||
|
||||
#ifndef BOOST_MPI_DETAIL_FORWARD_SKELETON_IARCHIVE_HPP
|
||||
#define BOOST_MPI_DETAIL_FORWARD_SKELETON_IARCHIVE_HPP
|
||||
|
||||
#include <boost/archive/detail/auto_link_archive.hpp>
|
||||
#include <boost/archive/detail/iserializer.hpp>
|
||||
#include <boost/archive/detail/interface_iarchive.hpp>
|
||||
#include <boost/archive/detail/common_iarchive.hpp>
|
||||
#include <boost/serialization/collection_size_type.hpp>
|
||||
|
||||
namespace boost { namespace mpi { namespace detail {
|
||||
|
||||
template<class Archive, class ImplementationArchive>
|
||||
class forward_skeleton_iarchive
|
||||
: public archive::detail::common_iarchive<Archive>
|
||||
{
|
||||
public:
|
||||
|
||||
typedef ImplementationArchive implementation_archive_type;
|
||||
|
||||
forward_skeleton_iarchive(implementation_archive_type& ar)
|
||||
: archive::detail::common_iarchive<Archive>(archive::no_header),
|
||||
implementation_archive(ar)
|
||||
{
|
||||
}
|
||||
|
||||
#ifdef BOOST_NO_MEMBER_TEMPLATE_FRIENDS
|
||||
public:
|
||||
#else
|
||||
friend class archive::detail::interface_iarchive<Archive>;
|
||||
friend class archive::load_access;
|
||||
protected:
|
||||
#endif
|
||||
|
||||
template<class T>
|
||||
void load_override(T & t)
|
||||
{
|
||||
archive::load(* this->This(), t);
|
||||
}
|
||||
|
||||
#define BOOST_ARCHIVE_FORWARD_IMPLEMENTATION(T) \
|
||||
void load_override(T & t) \
|
||||
{ \
|
||||
implementation_archive >> t; \
|
||||
}
|
||||
|
||||
BOOST_ARCHIVE_FORWARD_IMPLEMENTATION(archive::class_id_optional_type)
|
||||
BOOST_ARCHIVE_FORWARD_IMPLEMENTATION(archive::version_type)
|
||||
BOOST_ARCHIVE_FORWARD_IMPLEMENTATION(archive::class_id_type)
|
||||
BOOST_ARCHIVE_FORWARD_IMPLEMENTATION(archive::class_id_reference_type)
|
||||
BOOST_ARCHIVE_FORWARD_IMPLEMENTATION(archive::object_id_type)
|
||||
BOOST_ARCHIVE_FORWARD_IMPLEMENTATION(archive::object_reference_type)
|
||||
BOOST_ARCHIVE_FORWARD_IMPLEMENTATION(archive::tracking_type)
|
||||
BOOST_ARCHIVE_FORWARD_IMPLEMENTATION(archive::class_name_type)
|
||||
BOOST_ARCHIVE_FORWARD_IMPLEMENTATION(serialization::collection_size_type)
|
||||
|
||||
void load_override(std::string & s)
|
||||
{
|
||||
serialization::collection_size_type length(s.size());
|
||||
load_override(length);
|
||||
s.resize(length);
|
||||
}
|
||||
|
||||
#undef BOOST_ARCHIVE_FORWARD_IMPLEMENTATION
|
||||
protected:
|
||||
/// the actual archive used to serialize the information we actually want to store
|
||||
implementation_archive_type& implementation_archive;
|
||||
};
|
||||
|
||||
|
||||
} } } // end namespace boost::mpi::detail
|
||||
|
||||
#endif // BOOST_MPI_DETAIL_FORWARD_SKELETON_IARCHIVE_HPP
|
||||
@@ -0,0 +1,46 @@
|
||||
/*=============================================================================
|
||||
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)
|
||||
==============================================================================*/
|
||||
#if !defined(FUSION_BACK_09162005_0350)
|
||||
#define FUSION_BACK_09162005_0350
|
||||
|
||||
#include <boost/fusion/support/config.hpp>
|
||||
#include <boost/fusion/sequence/intrinsic_fwd.hpp>
|
||||
#include <boost/fusion/sequence/intrinsic/end.hpp>
|
||||
#include <boost/fusion/iterator/prior.hpp>
|
||||
#include <boost/fusion/iterator/deref.hpp>
|
||||
#include <boost/mpl/bool.hpp>
|
||||
|
||||
namespace boost { namespace fusion
|
||||
{
|
||||
struct fusion_sequence_tag;
|
||||
|
||||
namespace result_of
|
||||
{
|
||||
template <typename Sequence>
|
||||
struct back
|
||||
: result_of::deref<typename result_of::prior<typename result_of::end<Sequence>::type>::type>
|
||||
{};
|
||||
}
|
||||
|
||||
template <typename Sequence>
|
||||
BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
|
||||
inline typename result_of::back<Sequence>::type
|
||||
back(Sequence& seq)
|
||||
{
|
||||
return *fusion::prior(fusion::end(seq));
|
||||
}
|
||||
|
||||
template <typename Sequence>
|
||||
BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
|
||||
inline typename result_of::back<Sequence const>::type
|
||||
back(Sequence const& seq)
|
||||
{
|
||||
return *fusion::prior(fusion::end(seq));
|
||||
}
|
||||
}}
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,30 @@
|
||||
// (c) Copyright Fernando Luis Cacciola Carballal 2000-2004
|
||||
// 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)
|
||||
|
||||
// See library home page at http://www.boost.org/libs/numeric/conversion
|
||||
//
|
||||
// Contact the author at: fernando_cacciola@hotmail.com
|
||||
//
|
||||
#ifndef BOOST_NUMERIC_CONVERSION_INT_FLOAT_MIXTURE_FLC_12NOV2002_HPP
|
||||
#define BOOST_NUMERIC_CONVERSION_INT_FLOAT_MIXTURE_FLC_12NOV2002_HPP
|
||||
|
||||
#include "boost/numeric/conversion/detail/int_float_mixture.hpp"
|
||||
|
||||
namespace boost { namespace numeric
|
||||
{
|
||||
|
||||
template<class T, class S>
|
||||
struct int_float_mixture
|
||||
: convdetail::get_int_float_mixture< BOOST_DEDUCED_TYPENAME remove_cv<T>::type
|
||||
,BOOST_DEDUCED_TYPENAME remove_cv<S>::type
|
||||
>::type {} ;
|
||||
|
||||
} } // namespace boost::numeric
|
||||
|
||||
#endif
|
||||
//
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
@@ -0,0 +1,347 @@
|
||||
// Copyright John Maddock 2005-2006, 2011.
|
||||
// Copyright Paul A. Bristow 2006-2011.
|
||||
// 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_CONSTANTS_CONSTANTS_INCLUDED
|
||||
#define BOOST_MATH_CONSTANTS_CONSTANTS_INCLUDED
|
||||
|
||||
#include <boost/math/tools/config.hpp>
|
||||
#include <boost/math/policies/policy.hpp>
|
||||
#include <boost/math/tools/precision.hpp>
|
||||
#include <boost/math/tools/convert_from_string.hpp>
|
||||
#ifdef BOOST_MSVC
|
||||
#pragma warning(push)
|
||||
#pragma warning(disable: 4127 4701)
|
||||
#endif
|
||||
#ifndef BOOST_MATH_NO_LEXICAL_CAST
|
||||
#include <boost/lexical_cast.hpp>
|
||||
#endif
|
||||
#ifdef BOOST_MSVC
|
||||
#pragma warning(pop)
|
||||
#endif
|
||||
#include <boost/mpl/if.hpp>
|
||||
#include <boost/mpl/and.hpp>
|
||||
#include <boost/mpl/int.hpp>
|
||||
#include <boost/type_traits/is_convertible.hpp>
|
||||
#include <boost/utility/declval.hpp>
|
||||
|
||||
|
||||
namespace boost{ namespace math
|
||||
{
|
||||
namespace constants
|
||||
{
|
||||
// To permit other calculations at about 100 decimal digits with some UDT,
|
||||
// it is obviously necessary to define constants to this accuracy.
|
||||
|
||||
// However, some compilers do not accept decimal digits strings as long as this.
|
||||
// So the constant is split into two parts, with the 1st containing at least
|
||||
// long double precision, and the 2nd zero if not needed or known.
|
||||
// The 3rd part permits an exponent to be provided if necessary (use zero if none) -
|
||||
// the other two parameters may only contain decimal digits (and sign and decimal point),
|
||||
// and may NOT include an exponent like 1.234E99.
|
||||
// The second digit string is only used if T is a User-Defined Type,
|
||||
// when the constant is converted to a long string literal and lexical_casted to type T.
|
||||
// (This is necessary because you can't use a numeric constant
|
||||
// since even a long double might not have enough digits).
|
||||
|
||||
enum construction_method
|
||||
{
|
||||
construct_from_float = 1,
|
||||
construct_from_double = 2,
|
||||
construct_from_long_double = 3,
|
||||
construct_from_string = 4,
|
||||
construct_from_float128 = 5,
|
||||
// Must be the largest value above:
|
||||
construct_max = construct_from_float128
|
||||
};
|
||||
|
||||
//
|
||||
// Traits class determines how to convert from string based on whether T has a constructor
|
||||
// from const char* or not:
|
||||
//
|
||||
template <int N>
|
||||
struct dummy_size{};
|
||||
|
||||
//
|
||||
// Max number of binary digits in the string representations
|
||||
// of our constants:
|
||||
//
|
||||
BOOST_STATIC_CONSTANT(int, max_string_digits = (101 * 1000L) / 301L);
|
||||
|
||||
template <class Real, class Policy>
|
||||
struct construction_traits
|
||||
{
|
||||
private:
|
||||
typedef typename policies::precision<Real, Policy>::type t1;
|
||||
typedef typename policies::precision<float, Policy>::type t2;
|
||||
typedef typename policies::precision<double, Policy>::type t3;
|
||||
typedef typename policies::precision<long double, Policy>::type t4;
|
||||
#ifdef BOOST_MATH_USE_FLOAT128
|
||||
typedef mpl::int_<113> t5;
|
||||
#endif
|
||||
public:
|
||||
typedef typename mpl::if_<
|
||||
mpl::and_<boost::is_convertible<float, Real>, mpl::bool_< t1::value <= t2::value>, mpl::bool_<0 != t1::value> >,
|
||||
mpl::int_<construct_from_float>,
|
||||
typename mpl::if_<
|
||||
mpl::and_<boost::is_convertible<double, Real>, mpl::bool_< t1::value <= t3::value>, mpl::bool_<0 != t1::value> >,
|
||||
mpl::int_<construct_from_double>,
|
||||
typename mpl::if_<
|
||||
mpl::and_<boost::is_convertible<long double, Real>, mpl::bool_< t1::value <= t4::value>, mpl::bool_<0 != t1::value> >,
|
||||
mpl::int_<construct_from_long_double>,
|
||||
#ifdef BOOST_MATH_USE_FLOAT128
|
||||
typename mpl::if_<
|
||||
mpl::and_<boost::is_convertible<BOOST_MATH_FLOAT128_TYPE, Real>, mpl::bool_< t1::value <= t5::value>, mpl::bool_<0 != t1::value> >,
|
||||
mpl::int_<construct_from_float128>,
|
||||
typename mpl::if_<
|
||||
mpl::and_<mpl::bool_< t1::value <= max_string_digits>, mpl::bool_<0 != t1::value> >,
|
||||
mpl::int_<construct_from_string>,
|
||||
mpl::int_<t1::value>
|
||||
>::type
|
||||
>::type
|
||||
#else
|
||||
typename mpl::if_<
|
||||
mpl::and_<mpl::bool_< t1::value <= max_string_digits>, mpl::bool_<0 != t1::value> >,
|
||||
mpl::int_<construct_from_string>,
|
||||
mpl::int_<t1::value>
|
||||
>::type
|
||||
#endif
|
||||
>::type
|
||||
>::type
|
||||
>::type type;
|
||||
};
|
||||
|
||||
#ifdef BOOST_HAS_THREADS
|
||||
#define BOOST_MATH_CONSTANT_THREAD_HELPER(name, prefix) \
|
||||
boost::once_flag f = BOOST_ONCE_INIT;\
|
||||
boost::call_once(f, &BOOST_JOIN(BOOST_JOIN(string_, get_), name)<T>);
|
||||
#else
|
||||
#define BOOST_MATH_CONSTANT_THREAD_HELPER(name, prefix)
|
||||
#endif
|
||||
|
||||
namespace detail{
|
||||
|
||||
template <class Real, class Policy = boost::math::policies::policy<> >
|
||||
struct constant_return
|
||||
{
|
||||
typedef typename construction_traits<Real, Policy>::type construct_type;
|
||||
typedef typename mpl::if_c<
|
||||
(construct_type::value == construct_from_string) || (construct_type::value > construct_max),
|
||||
const Real&, Real>::type type;
|
||||
};
|
||||
|
||||
template <class T, const T& (*F)()>
|
||||
struct constant_initializer
|
||||
{
|
||||
static void force_instantiate()
|
||||
{
|
||||
init.force_instantiate();
|
||||
}
|
||||
private:
|
||||
struct initializer
|
||||
{
|
||||
initializer()
|
||||
{
|
||||
F();
|
||||
}
|
||||
void force_instantiate()const{}
|
||||
};
|
||||
static const initializer init;
|
||||
};
|
||||
|
||||
template <class T, const T& (*F)()>
|
||||
typename constant_initializer<T, F>::initializer const constant_initializer<T, F>::init;
|
||||
|
||||
template <class T, int N, const T& (*F)(BOOST_MATH_EXPLICIT_TEMPLATE_TYPE_SPEC(mpl::int_<N>) BOOST_MATH_APPEND_EXPLICIT_TEMPLATE_TYPE_SPEC(T))>
|
||||
struct constant_initializer2
|
||||
{
|
||||
static void force_instantiate()
|
||||
{
|
||||
init.force_instantiate();
|
||||
}
|
||||
private:
|
||||
struct initializer
|
||||
{
|
||||
initializer()
|
||||
{
|
||||
F();
|
||||
}
|
||||
void force_instantiate()const{}
|
||||
};
|
||||
static const initializer init;
|
||||
};
|
||||
|
||||
template <class T, int N, const T& (*F)(BOOST_MATH_EXPLICIT_TEMPLATE_TYPE_SPEC(mpl::int_<N>) BOOST_MATH_APPEND_EXPLICIT_TEMPLATE_TYPE_SPEC(T))>
|
||||
typename constant_initializer2<T, N, F>::initializer const constant_initializer2<T, N, F>::init;
|
||||
|
||||
}
|
||||
|
||||
#ifdef BOOST_MATH_USE_FLOAT128
|
||||
# define BOOST_MATH_FLOAT128_CONSTANT_OVERLOAD(x) \
|
||||
static inline BOOST_CONSTEXPR T get(const mpl::int_<construct_from_float128>&) BOOST_NOEXCEPT\
|
||||
{ return BOOST_JOIN(x, Q); }
|
||||
#else
|
||||
# define BOOST_MATH_FLOAT128_CONSTANT_OVERLOAD(x)
|
||||
#endif
|
||||
|
||||
#ifdef BOOST_NO_CXX11_THREAD_LOCAL
|
||||
# define BOOST_MATH_PRECOMPUTE_IF_NOT_LOCAL(constant_, name) constant_initializer<T, & BOOST_JOIN(constant_, name)<T>::get_from_variable_precision>::force_instantiate();
|
||||
#else
|
||||
# define BOOST_MATH_PRECOMPUTE_IF_NOT_LOCAL(constant_, name)
|
||||
#endif
|
||||
|
||||
#define BOOST_DEFINE_MATH_CONSTANT(name, x, y)\
|
||||
namespace detail{\
|
||||
template <class T> struct BOOST_JOIN(constant_, name){\
|
||||
private:\
|
||||
/* The default implementations come next: */ \
|
||||
static inline const T& get_from_string()\
|
||||
{\
|
||||
static const T result(boost::math::tools::convert_from_string<T>(y));\
|
||||
return result;\
|
||||
}\
|
||||
/* This one is for very high precision that is none the less known at compile time: */ \
|
||||
template <int N> static T compute(BOOST_MATH_EXPLICIT_TEMPLATE_TYPE_SPEC(mpl::int_<N>));\
|
||||
template <int N> static inline const T& get_from_compute(BOOST_MATH_EXPLICIT_TEMPLATE_TYPE_SPEC(mpl::int_<N>))\
|
||||
{\
|
||||
static const T result = compute<N>();\
|
||||
return result;\
|
||||
}\
|
||||
static inline const T& get_from_variable_precision()\
|
||||
{\
|
||||
static BOOST_MATH_THREAD_LOCAL int digits = 0;\
|
||||
static BOOST_MATH_THREAD_LOCAL T value;\
|
||||
int current_digits = boost::math::tools::digits<T>();\
|
||||
if(digits != current_digits)\
|
||||
{\
|
||||
value = current_digits > max_string_digits ? compute<0>() : T(boost::math::tools::convert_from_string<T>(y));\
|
||||
digits = current_digits; \
|
||||
}\
|
||||
return value;\
|
||||
}\
|
||||
/* public getters come next */\
|
||||
public:\
|
||||
static inline const T& get(const mpl::int_<construct_from_string>&)\
|
||||
{\
|
||||
constant_initializer<T, & BOOST_JOIN(constant_, name)<T>::get_from_string >::force_instantiate();\
|
||||
return get_from_string();\
|
||||
}\
|
||||
static inline BOOST_CONSTEXPR T get(const mpl::int_<construct_from_float>) BOOST_NOEXCEPT\
|
||||
{ return BOOST_JOIN(x, F); }\
|
||||
static inline BOOST_CONSTEXPR T get(const mpl::int_<construct_from_double>&) BOOST_NOEXCEPT\
|
||||
{ return x; }\
|
||||
static inline BOOST_CONSTEXPR T get(const mpl::int_<construct_from_long_double>&) BOOST_NOEXCEPT\
|
||||
{ return BOOST_JOIN(x, L); }\
|
||||
BOOST_MATH_FLOAT128_CONSTANT_OVERLOAD(x) \
|
||||
template <int N> static inline const T& get(const mpl::int_<N>&)\
|
||||
{\
|
||||
constant_initializer2<T, N, & BOOST_JOIN(constant_, name)<T>::template get_from_compute<N> >::force_instantiate();\
|
||||
return get_from_compute<N>(); \
|
||||
}\
|
||||
/* This one is for true arbitary precision, which may well vary at runtime: */ \
|
||||
static inline T get(const mpl::int_<0>&)\
|
||||
{\
|
||||
BOOST_MATH_PRECOMPUTE_IF_NOT_LOCAL(constant_, name)\
|
||||
return get_from_variable_precision(); }\
|
||||
}; /* end of struct */\
|
||||
} /* namespace detail */ \
|
||||
\
|
||||
\
|
||||
/* The actual forwarding function: */ \
|
||||
template <class T, class Policy> inline BOOST_CONSTEXPR typename detail::constant_return<T, Policy>::type name(BOOST_MATH_EXPLICIT_TEMPLATE_TYPE_SPEC(T) BOOST_MATH_APPEND_EXPLICIT_TEMPLATE_TYPE_SPEC(Policy)) BOOST_MATH_NOEXCEPT(T)\
|
||||
{ return detail:: BOOST_JOIN(constant_, name)<T>::get(typename construction_traits<T, Policy>::type()); }\
|
||||
template <class T> inline BOOST_CONSTEXPR typename detail::constant_return<T>::type name(BOOST_MATH_EXPLICIT_TEMPLATE_TYPE_SPEC(T)) BOOST_MATH_NOEXCEPT(T)\
|
||||
{ return name<T, boost::math::policies::policy<> >(); }\
|
||||
\
|
||||
\
|
||||
/* Now the namespace specific versions: */ \
|
||||
} namespace float_constants{ BOOST_STATIC_CONSTEXPR float name = BOOST_JOIN(x, F); }\
|
||||
namespace double_constants{ BOOST_STATIC_CONSTEXPR double name = x; } \
|
||||
namespace long_double_constants{ BOOST_STATIC_CONSTEXPR long double name = BOOST_JOIN(x, L); }\
|
||||
namespace constants{
|
||||
|
||||
BOOST_DEFINE_MATH_CONSTANT(half, 5.000000000000000000000000000000000000e-01, "5.00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000e-01")
|
||||
BOOST_DEFINE_MATH_CONSTANT(third, 3.333333333333333333333333333333333333e-01, "3.33333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333e-01")
|
||||
BOOST_DEFINE_MATH_CONSTANT(twothirds, 6.666666666666666666666666666666666666e-01, "6.66666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666667e-01")
|
||||
BOOST_DEFINE_MATH_CONSTANT(two_thirds, 6.666666666666666666666666666666666666e-01, "6.66666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666667e-01")
|
||||
BOOST_DEFINE_MATH_CONSTANT(three_quarters, 7.500000000000000000000000000000000000e-01, "7.50000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000e-01")
|
||||
BOOST_DEFINE_MATH_CONSTANT(root_two, 1.414213562373095048801688724209698078e+00, "1.41421356237309504880168872420969807856967187537694807317667973799073247846210703885038753432764157273501384623e+00")
|
||||
BOOST_DEFINE_MATH_CONSTANT(root_three, 1.732050807568877293527446341505872366e+00, "1.73205080756887729352744634150587236694280525381038062805580697945193301690880003708114618675724857567562614142e+00")
|
||||
BOOST_DEFINE_MATH_CONSTANT(half_root_two, 7.071067811865475244008443621048490392e-01, "7.07106781186547524400844362104849039284835937688474036588339868995366239231053519425193767163820786367506923115e-01")
|
||||
BOOST_DEFINE_MATH_CONSTANT(ln_two, 6.931471805599453094172321214581765680e-01, "6.93147180559945309417232121458176568075500134360255254120680009493393621969694715605863326996418687542001481021e-01")
|
||||
BOOST_DEFINE_MATH_CONSTANT(ln_ln_two, -3.665129205816643270124391582326694694e-01, "-3.66512920581664327012439158232669469454263447837105263053677713670561615319352738549455822856698908358302523045e-01")
|
||||
BOOST_DEFINE_MATH_CONSTANT(root_ln_four, 1.177410022515474691011569326459699637e+00, "1.17741002251547469101156932645969963774738568938582053852252575650002658854698492680841813836877081106747157858e+00")
|
||||
BOOST_DEFINE_MATH_CONSTANT(one_div_root_two, 7.071067811865475244008443621048490392e-01, "7.07106781186547524400844362104849039284835937688474036588339868995366239231053519425193767163820786367506923115e-01")
|
||||
BOOST_DEFINE_MATH_CONSTANT(pi, 3.141592653589793238462643383279502884e+00, "3.14159265358979323846264338327950288419716939937510582097494459230781640628620899862803482534211706798214808651e+00")
|
||||
BOOST_DEFINE_MATH_CONSTANT(half_pi, 1.570796326794896619231321691639751442e+00, "1.57079632679489661923132169163975144209858469968755291048747229615390820314310449931401741267105853399107404326e+00")
|
||||
BOOST_DEFINE_MATH_CONSTANT(third_pi, 1.047197551196597746154214461093167628e+00, "1.04719755119659774615421446109316762806572313312503527365831486410260546876206966620934494178070568932738269550e+00")
|
||||
BOOST_DEFINE_MATH_CONSTANT(sixth_pi, 5.235987755982988730771072305465838140e-01, "5.23598775598298873077107230546583814032861566562517636829157432051302734381034833104672470890352844663691347752e-01")
|
||||
BOOST_DEFINE_MATH_CONSTANT(two_pi, 6.283185307179586476925286766559005768e+00, "6.28318530717958647692528676655900576839433879875021164194988918461563281257241799725606965068423413596429617303e+00")
|
||||
BOOST_DEFINE_MATH_CONSTANT(two_thirds_pi, 2.094395102393195492308428922186335256e+00, "2.09439510239319549230842892218633525613144626625007054731662972820521093752413933241868988356141137865476539101e+00")
|
||||
BOOST_DEFINE_MATH_CONSTANT(three_quarters_pi, 2.356194490192344928846982537459627163e+00, "2.35619449019234492884698253745962716314787704953132936573120844423086230471465674897102611900658780098661106488e+00")
|
||||
BOOST_DEFINE_MATH_CONSTANT(four_thirds_pi, 4.188790204786390984616857844372670512e+00, "4.18879020478639098461685784437267051226289253250014109463325945641042187504827866483737976712282275730953078202e+00")
|
||||
BOOST_DEFINE_MATH_CONSTANT(one_div_two_pi, 1.591549430918953357688837633725143620e-01, "1.59154943091895335768883763372514362034459645740456448747667344058896797634226535090113802766253085956072842727e-01")
|
||||
BOOST_DEFINE_MATH_CONSTANT(one_div_root_two_pi, 3.989422804014326779399460599343818684e-01, "3.98942280401432677939946059934381868475858631164934657665925829670657925899301838501252333907306936430302558863e-01")
|
||||
BOOST_DEFINE_MATH_CONSTANT(root_pi, 1.772453850905516027298167483341145182e+00, "1.77245385090551602729816748334114518279754945612238712821380778985291128459103218137495065673854466541622682362e+00")
|
||||
BOOST_DEFINE_MATH_CONSTANT(root_half_pi, 1.253314137315500251207882642405522626e+00, "1.25331413731550025120788264240552262650349337030496915831496178817114682730392098747329791918902863305800498633e+00")
|
||||
BOOST_DEFINE_MATH_CONSTANT(root_two_pi, 2.506628274631000502415765284811045253e+00, "2.50662827463100050241576528481104525300698674060993831662992357634229365460784197494659583837805726611600997267e+00")
|
||||
BOOST_DEFINE_MATH_CONSTANT(log_root_two_pi, 9.189385332046727417803297364056176398e-01, "9.18938533204672741780329736405617639861397473637783412817151540482765695927260397694743298635954197622005646625e-01")
|
||||
BOOST_DEFINE_MATH_CONSTANT(one_div_root_pi, 5.641895835477562869480794515607725858e-01, "5.64189583547756286948079451560772585844050629328998856844085721710642468441493414486743660202107363443028347906e-01")
|
||||
BOOST_DEFINE_MATH_CONSTANT(root_one_div_pi, 5.641895835477562869480794515607725858e-01, "5.64189583547756286948079451560772585844050629328998856844085721710642468441493414486743660202107363443028347906e-01")
|
||||
BOOST_DEFINE_MATH_CONSTANT(pi_minus_three, 1.415926535897932384626433832795028841e-01, "1.41592653589793238462643383279502884197169399375105820974944592307816406286208998628034825342117067982148086513e-01")
|
||||
BOOST_DEFINE_MATH_CONSTANT(four_minus_pi, 8.584073464102067615373566167204971158e-01, "8.58407346410206761537356616720497115802830600624894179025055407692183593713791001371965174657882932017851913487e-01")
|
||||
//BOOST_DEFINE_MATH_CONSTANT(pow23_four_minus_pi, 7.953167673715975443483953350568065807e-01, "7.95316767371597544348395335056806580727639173327713205445302234388856268267518187590758006888600828436839800178e-01")
|
||||
BOOST_DEFINE_MATH_CONSTANT(pi_pow_e, 2.245915771836104547342715220454373502e+01, "2.24591577183610454734271522045437350275893151339966922492030025540669260403991179123185197527271430315314500731e+01")
|
||||
BOOST_DEFINE_MATH_CONSTANT(pi_sqr, 9.869604401089358618834490999876151135e+00, "9.86960440108935861883449099987615113531369940724079062641334937622004482241920524300177340371855223182402591377e+00")
|
||||
BOOST_DEFINE_MATH_CONSTANT(pi_sqr_div_six, 1.644934066848226436472415166646025189e+00, "1.64493406684822643647241516664602518921894990120679843773555822937000747040320087383362890061975870530400431896e+00")
|
||||
BOOST_DEFINE_MATH_CONSTANT(pi_cubed, 3.100627668029982017547631506710139520e+01, "3.10062766802998201754763150671013952022252885658851076941445381038063949174657060375667010326028861930301219616e+01")
|
||||
BOOST_DEFINE_MATH_CONSTANT(cbrt_pi, 1.464591887561523263020142527263790391e+00, "1.46459188756152326302014252726379039173859685562793717435725593713839364979828626614568206782035382089750397002e+00")
|
||||
BOOST_DEFINE_MATH_CONSTANT(one_div_cbrt_pi, 6.827840632552956814670208331581645981e-01, "6.82784063255295681467020833158164598108367515632448804042681583118899226433403918237673501922595519865685577274e-01")
|
||||
BOOST_DEFINE_MATH_CONSTANT(e, 2.718281828459045235360287471352662497e+00, "2.71828182845904523536028747135266249775724709369995957496696762772407663035354759457138217852516642742746639193e+00")
|
||||
BOOST_DEFINE_MATH_CONSTANT(exp_minus_half, 6.065306597126334236037995349911804534e-01, "6.06530659712633423603799534991180453441918135487186955682892158735056519413748423998647611507989456026423789794e-01")
|
||||
BOOST_DEFINE_MATH_CONSTANT(e_pow_pi, 2.314069263277926900572908636794854738e+01, "2.31406926327792690057290863679485473802661062426002119934450464095243423506904527835169719970675492196759527048e+01")
|
||||
BOOST_DEFINE_MATH_CONSTANT(root_e, 1.648721270700128146848650787814163571e+00, "1.64872127070012814684865078781416357165377610071014801157507931164066102119421560863277652005636664300286663776e+00")
|
||||
BOOST_DEFINE_MATH_CONSTANT(log10_e, 4.342944819032518276511289189166050822e-01, "4.34294481903251827651128918916605082294397005803666566114453783165864649208870774729224949338431748318706106745e-01")
|
||||
BOOST_DEFINE_MATH_CONSTANT(one_div_log10_e, 2.302585092994045684017991454684364207e+00, "2.30258509299404568401799145468436420760110148862877297603332790096757260967735248023599720508959829834196778404e+00")
|
||||
BOOST_DEFINE_MATH_CONSTANT(ln_ten, 2.302585092994045684017991454684364207e+00, "2.30258509299404568401799145468436420760110148862877297603332790096757260967735248023599720508959829834196778404e+00")
|
||||
BOOST_DEFINE_MATH_CONSTANT(degree, 1.745329251994329576923690768488612713e-02, "1.74532925199432957692369076848861271344287188854172545609719144017100911460344944368224156963450948221230449251e-02")
|
||||
BOOST_DEFINE_MATH_CONSTANT(radian, 5.729577951308232087679815481410517033e+01, "5.72957795130823208767981548141051703324054724665643215491602438612028471483215526324409689958511109441862233816e+01")
|
||||
BOOST_DEFINE_MATH_CONSTANT(sin_one, 8.414709848078965066525023216302989996e-01, "8.41470984807896506652502321630298999622563060798371065672751709991910404391239668948639743543052695854349037908e-01")
|
||||
BOOST_DEFINE_MATH_CONSTANT(cos_one, 5.403023058681397174009366074429766037e-01, "5.40302305868139717400936607442976603732310420617922227670097255381100394774471764517951856087183089343571731160e-01")
|
||||
BOOST_DEFINE_MATH_CONSTANT(sinh_one, 1.175201193643801456882381850595600815e+00, "1.17520119364380145688238185059560081515571798133409587022956541301330756730432389560711745208962339184041953333e+00")
|
||||
BOOST_DEFINE_MATH_CONSTANT(cosh_one, 1.543080634815243778477905620757061682e+00, "1.54308063481524377847790562075706168260152911236586370473740221471076906304922369896426472643554303558704685860e+00")
|
||||
BOOST_DEFINE_MATH_CONSTANT(phi, 1.618033988749894848204586834365638117e+00, "1.61803398874989484820458683436563811772030917980576286213544862270526046281890244970720720418939113748475408808e+00")
|
||||
BOOST_DEFINE_MATH_CONSTANT(ln_phi, 4.812118250596034474977589134243684231e-01, "4.81211825059603447497758913424368423135184334385660519661018168840163867608221774412009429122723474997231839958e-01")
|
||||
BOOST_DEFINE_MATH_CONSTANT(one_div_ln_phi, 2.078086921235027537601322606117795767e+00, "2.07808692123502753760132260611779576774219226778328348027813992191974386928553540901445615414453604821933918634e+00")
|
||||
BOOST_DEFINE_MATH_CONSTANT(euler, 5.772156649015328606065120900824024310e-01, "5.77215664901532860606512090082402431042159335939923598805767234884867726777664670936947063291746749514631447250e-01")
|
||||
BOOST_DEFINE_MATH_CONSTANT(one_div_euler, 1.732454714600633473583025315860829681e+00, "1.73245471460063347358302531586082968115577655226680502204843613287065531408655243008832840219409928068072365714e+00")
|
||||
BOOST_DEFINE_MATH_CONSTANT(euler_sqr, 3.331779238077186743183761363552442266e-01, "3.33177923807718674318376136355244226659417140249629743150833338002265793695756669661263268631715977303039565603e-01")
|
||||
BOOST_DEFINE_MATH_CONSTANT(zeta_two, 1.644934066848226436472415166646025189e+00, "1.64493406684822643647241516664602518921894990120679843773555822937000747040320087383362890061975870530400431896e+00")
|
||||
BOOST_DEFINE_MATH_CONSTANT(zeta_three, 1.202056903159594285399738161511449990e+00, "1.20205690315959428539973816151144999076498629234049888179227155534183820578631309018645587360933525814619915780e+00")
|
||||
BOOST_DEFINE_MATH_CONSTANT(catalan, 9.159655941772190150546035149323841107e-01, "9.15965594177219015054603514932384110774149374281672134266498119621763019776254769479356512926115106248574422619e-01")
|
||||
BOOST_DEFINE_MATH_CONSTANT(glaisher, 1.282427129100622636875342568869791727e+00, "1.28242712910062263687534256886979172776768892732500119206374002174040630885882646112973649195820237439420646120e+00")
|
||||
BOOST_DEFINE_MATH_CONSTANT(khinchin, 2.685452001065306445309714835481795693e+00, "2.68545200106530644530971483548179569382038229399446295305115234555721885953715200280114117493184769799515346591e+00")
|
||||
BOOST_DEFINE_MATH_CONSTANT(extreme_value_skewness, 1.139547099404648657492793019389846112e+00, "1.13954709940464865749279301938984611208759979583655182472165571008524800770607068570718754688693851501894272049e+00")
|
||||
BOOST_DEFINE_MATH_CONSTANT(rayleigh_skewness, 6.311106578189371381918993515442277798e-01, "6.31110657818937138191899351544227779844042203134719497658094585692926819617473725459905027032537306794400047264e-01")
|
||||
BOOST_DEFINE_MATH_CONSTANT(rayleigh_kurtosis, 3.245089300687638062848660410619754415e+00, "3.24508930068763806284866041061975441541706673178920936177133764493367904540874159051490619368679348977426462633e+00")
|
||||
BOOST_DEFINE_MATH_CONSTANT(rayleigh_kurtosis_excess, 2.450893006876380628486604106197544154e-01, "2.45089300687638062848660410619754415417066731789209361771337644933679045408741590514906193686793489774264626328e-01")
|
||||
|
||||
BOOST_DEFINE_MATH_CONSTANT(two_div_pi, 6.366197723675813430755350534900574481e-01, "6.36619772367581343075535053490057448137838582961825794990669376235587190536906140360455211065012343824291370907e-01")
|
||||
BOOST_DEFINE_MATH_CONSTANT(root_two_div_pi, 7.978845608028653558798921198687637369e-01, "7.97884560802865355879892119868763736951717262329869315331851659341315851798603677002504667814613872860605117725e-01")
|
||||
|
||||
|
||||
} // namespace constants
|
||||
} // namespace math
|
||||
} // namespace boost
|
||||
|
||||
//
|
||||
// We deliberately include this *after* all the declarations above,
|
||||
// that way the calculation routines can call on other constants above:
|
||||
//
|
||||
#include <boost/math/constants/calculate_constants.hpp>
|
||||
|
||||
#endif // BOOST_MATH_CONSTANTS_CONSTANTS_INCLUDED
|
||||
|
||||
|
||||
@@ -0,0 +1,82 @@
|
||||
// Copyright Jim Bosch 2010-2012.
|
||||
// Copyright Stefan Seefeld 2016.
|
||||
// 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_python_numpy_matrix_hpp_
|
||||
#define boost_python_numpy_matrix_hpp_
|
||||
|
||||
/**
|
||||
* @brief Object manager for numpy.matrix.
|
||||
*/
|
||||
|
||||
#include <boost/python.hpp>
|
||||
#include <boost/python/numpy/numpy_object_mgr_traits.hpp>
|
||||
#include <boost/python/numpy/ndarray.hpp>
|
||||
|
||||
namespace boost { namespace python { namespace numpy {
|
||||
|
||||
/**
|
||||
* @brief A boost.python "object manager" (subclass of object) for numpy.matrix.
|
||||
*
|
||||
* @internal numpy.matrix is defined in Python, so object_manager_traits<matrix>::get_pytype()
|
||||
* is implemented by importing numpy and getting the "matrix" attribute of the module.
|
||||
* We then just hope that doesn't get destroyed while we need it, because if we put
|
||||
* a dynamic python object in a static-allocated boost::python::object or handle<>,
|
||||
* bad things happen when Python shuts down. I think this solution is safe, but I'd
|
||||
* love to get that confirmed.
|
||||
*/
|
||||
class matrix : public ndarray
|
||||
{
|
||||
static object construct(object_cref obj, dtype const & dt, bool copy);
|
||||
static object construct(object_cref obj, bool copy);
|
||||
public:
|
||||
|
||||
BOOST_PYTHON_FORWARD_OBJECT_CONSTRUCTORS(matrix, ndarray);
|
||||
|
||||
/// @brief Equivalent to "numpy.matrix(obj,dt,copy)" in Python.
|
||||
explicit matrix(object const & obj, dtype const & dt, bool copy=true)
|
||||
: ndarray(extract<ndarray>(construct(obj, dt, copy))) {}
|
||||
|
||||
/// @brief Equivalent to "numpy.matrix(obj,copy=copy)" in Python.
|
||||
explicit matrix(object const & obj, bool copy=true)
|
||||
: ndarray(extract<ndarray>(construct(obj, copy))) {}
|
||||
|
||||
/// \brief Return a view of the matrix with the given dtype.
|
||||
matrix view(dtype const & dt) const;
|
||||
|
||||
/// \brief Copy the scalar (deep for all non-object fields).
|
||||
matrix copy() const;
|
||||
|
||||
/// \brief Transpose the matrix.
|
||||
matrix transpose() const;
|
||||
|
||||
};
|
||||
|
||||
/**
|
||||
* @brief CallPolicies that causes a function that returns a numpy.ndarray to
|
||||
* return a numpy.matrix instead.
|
||||
*/
|
||||
template <typename Base = default_call_policies>
|
||||
struct as_matrix : Base
|
||||
{
|
||||
static PyObject * postcall(PyObject *, PyObject * result)
|
||||
{
|
||||
object a = object(handle<>(result));
|
||||
numpy::matrix m(a, false);
|
||||
Py_INCREF(m.ptr());
|
||||
return m.ptr();
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace boost::python::numpy
|
||||
|
||||
namespace converter
|
||||
{
|
||||
|
||||
NUMPY_OBJECT_MANAGER_TRAITS(numpy::matrix);
|
||||
|
||||
}}} // namespace boost::python::converter
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,328 @@
|
||||
|
||||
// Copyright Aleksey Gurtovoy 2000-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 the main "set_c.hpp" header
|
||||
// -- DO NOT modify by hand!
|
||||
|
||||
namespace boost { namespace mpl {
|
||||
|
||||
template<
|
||||
typename T, long C0 = LONG_MAX, long C1 = LONG_MAX, long C2 = LONG_MAX
|
||||
, long C3 = LONG_MAX, long C4 = LONG_MAX, long C5 = LONG_MAX
|
||||
, long C6 = LONG_MAX, long C7 = LONG_MAX, long C8 = LONG_MAX
|
||||
, long C9 = LONG_MAX, long C10 = LONG_MAX, long C11 = LONG_MAX
|
||||
, long C12 = LONG_MAX, long C13 = LONG_MAX, long C14 = LONG_MAX
|
||||
, long C15 = LONG_MAX, long C16 = LONG_MAX, long C17 = LONG_MAX
|
||||
, long C18 = LONG_MAX, long C19 = LONG_MAX
|
||||
>
|
||||
struct set_c;
|
||||
|
||||
template<
|
||||
typename T
|
||||
>
|
||||
struct set_c<
|
||||
T, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX
|
||||
, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX
|
||||
, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX
|
||||
>
|
||||
: set0_c<T>
|
||||
{
|
||||
typedef typename set0_c<T>::type type;
|
||||
};
|
||||
|
||||
template<
|
||||
typename T, long C0
|
||||
>
|
||||
struct set_c<
|
||||
T, C0, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX
|
||||
, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX
|
||||
, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX
|
||||
>
|
||||
: set1_c< T,C0 >
|
||||
{
|
||||
typedef typename set1_c< T,C0 >::type type;
|
||||
};
|
||||
|
||||
template<
|
||||
typename T, long C0, long C1
|
||||
>
|
||||
struct set_c<
|
||||
T, C0, C1, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX
|
||||
, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX
|
||||
, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX
|
||||
>
|
||||
: set2_c< T,C0,C1 >
|
||||
{
|
||||
typedef typename set2_c< T,C0,C1 >::type type;
|
||||
};
|
||||
|
||||
template<
|
||||
typename T, long C0, long C1, long C2
|
||||
>
|
||||
struct set_c<
|
||||
T, C0, C1, C2, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX
|
||||
, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX
|
||||
, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX
|
||||
>
|
||||
: set3_c< T,C0,C1,C2 >
|
||||
{
|
||||
typedef typename set3_c< T,C0,C1,C2 >::type type;
|
||||
};
|
||||
|
||||
template<
|
||||
typename T, long C0, long C1, long C2, long C3
|
||||
>
|
||||
struct set_c<
|
||||
T, C0, C1, C2, C3, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX
|
||||
, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX
|
||||
, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX
|
||||
>
|
||||
: set4_c< T,C0,C1,C2,C3 >
|
||||
{
|
||||
typedef typename set4_c< T,C0,C1,C2,C3 >::type type;
|
||||
};
|
||||
|
||||
template<
|
||||
typename T, long C0, long C1, long C2, long C3, long C4
|
||||
>
|
||||
struct set_c<
|
||||
T, C0, C1, C2, C3, C4, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX
|
||||
, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX
|
||||
, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX
|
||||
>
|
||||
: set5_c< T,C0,C1,C2,C3,C4 >
|
||||
{
|
||||
typedef typename set5_c< T,C0,C1,C2,C3,C4 >::type type;
|
||||
};
|
||||
|
||||
template<
|
||||
typename T, long C0, long C1, long C2, long C3, long C4, long C5
|
||||
>
|
||||
struct set_c<
|
||||
T, C0, C1, C2, C3, C4, C5, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX
|
||||
, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX
|
||||
, LONG_MAX, LONG_MAX, LONG_MAX
|
||||
>
|
||||
: set6_c< T,C0,C1,C2,C3,C4,C5 >
|
||||
{
|
||||
typedef typename set6_c< T,C0,C1,C2,C3,C4,C5 >::type type;
|
||||
};
|
||||
|
||||
template<
|
||||
typename T, long C0, long C1, long C2, long C3, long C4, long C5
|
||||
, long C6
|
||||
>
|
||||
struct set_c<
|
||||
T, C0, C1, C2, C3, C4, C5, C6, LONG_MAX, LONG_MAX, LONG_MAX
|
||||
, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX
|
||||
, LONG_MAX, LONG_MAX, LONG_MAX
|
||||
>
|
||||
: set7_c< T,C0,C1,C2,C3,C4,C5,C6 >
|
||||
{
|
||||
typedef typename set7_c< T,C0,C1,C2,C3,C4,C5,C6 >::type type;
|
||||
};
|
||||
|
||||
template<
|
||||
typename T, long C0, long C1, long C2, long C3, long C4, long C5
|
||||
, long C6, long C7
|
||||
>
|
||||
struct set_c<
|
||||
T, C0, C1, C2, C3, C4, C5, C6, C7, LONG_MAX, LONG_MAX, LONG_MAX
|
||||
, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX
|
||||
, LONG_MAX, LONG_MAX
|
||||
>
|
||||
: set8_c< T,C0,C1,C2,C3,C4,C5,C6,C7 >
|
||||
{
|
||||
typedef typename set8_c< T,C0,C1,C2,C3,C4,C5,C6,C7 >::type type;
|
||||
};
|
||||
|
||||
template<
|
||||
typename T, long C0, long C1, long C2, long C3, long C4, long C5
|
||||
, long C6, long C7, long C8
|
||||
>
|
||||
struct set_c<
|
||||
T, C0, C1, C2, C3, C4, C5, C6, C7, C8, LONG_MAX, LONG_MAX, LONG_MAX
|
||||
, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX
|
||||
, LONG_MAX
|
||||
>
|
||||
: set9_c< T,C0,C1,C2,C3,C4,C5,C6,C7,C8 >
|
||||
{
|
||||
typedef typename set9_c< T,C0,C1,C2,C3,C4,C5,C6,C7,C8 >::type type;
|
||||
};
|
||||
|
||||
template<
|
||||
typename T, long C0, long C1, long C2, long C3, long C4, long C5
|
||||
, long C6, long C7, long C8, long C9
|
||||
>
|
||||
struct set_c<
|
||||
T, C0, C1, C2, C3, C4, C5, C6, C7, C8, C9, LONG_MAX, LONG_MAX
|
||||
, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX
|
||||
, LONG_MAX
|
||||
>
|
||||
: set10_c< T,C0,C1,C2,C3,C4,C5,C6,C7,C8,C9 >
|
||||
{
|
||||
typedef typename set10_c< T,C0,C1,C2,C3,C4,C5,C6,C7,C8,C9 >::type type;
|
||||
};
|
||||
|
||||
template<
|
||||
typename T, long C0, long C1, long C2, long C3, long C4, long C5
|
||||
, long C6, long C7, long C8, long C9, long C10
|
||||
>
|
||||
struct set_c<
|
||||
T, C0, C1, C2, C3, C4, C5, C6, C7, C8, C9, C10, LONG_MAX, LONG_MAX
|
||||
, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX
|
||||
>
|
||||
: set11_c< T,C0,C1,C2,C3,C4,C5,C6,C7,C8,C9,C10 >
|
||||
{
|
||||
typedef typename set11_c< T,C0,C1,C2,C3,C4,C5,C6,C7,C8,C9,C10 >::type type;
|
||||
};
|
||||
|
||||
template<
|
||||
typename T, long C0, long C1, long C2, long C3, long C4, long C5
|
||||
, long C6, long C7, long C8, long C9, long C10, long C11
|
||||
>
|
||||
struct set_c<
|
||||
T, C0, C1, C2, C3, C4, C5, C6, C7, C8, C9, C10, C11, LONG_MAX
|
||||
, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX
|
||||
>
|
||||
: set12_c< T,C0,C1,C2,C3,C4,C5,C6,C7,C8,C9,C10,C11 >
|
||||
{
|
||||
typedef typename set12_c< T,C0,C1,C2,C3,C4,C5,C6,C7,C8,C9,C10,C11 >::type type;
|
||||
};
|
||||
|
||||
template<
|
||||
typename T, long C0, long C1, long C2, long C3, long C4, long C5
|
||||
, long C6, long C7, long C8, long C9, long C10, long C11, long C12
|
||||
>
|
||||
struct set_c<
|
||||
T, C0, C1, C2, C3, C4, C5, C6, C7, C8, C9, C10, C11, C12, LONG_MAX
|
||||
, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX
|
||||
>
|
||||
: set13_c< T,C0,C1,C2,C3,C4,C5,C6,C7,C8,C9,C10,C11,C12 >
|
||||
{
|
||||
typedef typename set13_c< T,C0,C1,C2,C3,C4,C5,C6,C7,C8,C9,C10,C11,C12 >::type type;
|
||||
};
|
||||
|
||||
template<
|
||||
typename T, long C0, long C1, long C2, long C3, long C4, long C5
|
||||
, long C6, long C7, long C8, long C9, long C10, long C11, long C12
|
||||
, long C13
|
||||
>
|
||||
struct set_c<
|
||||
T, C0, C1, C2, C3, C4, C5, C6, C7, C8, C9, C10, C11, C12, C13
|
||||
, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX
|
||||
>
|
||||
: set14_c<
|
||||
T, C0, C1, C2, C3, C4, C5, C6, C7, C8, C9, C10, C11, C12, C13
|
||||
>
|
||||
{
|
||||
typedef typename set14_c< T,C0,C1,C2,C3,C4,C5,C6,C7,C8,C9,C10,C11,C12,C13 >::type type;
|
||||
};
|
||||
|
||||
template<
|
||||
typename T, long C0, long C1, long C2, long C3, long C4, long C5
|
||||
, long C6, long C7, long C8, long C9, long C10, long C11, long C12
|
||||
, long C13, long C14
|
||||
>
|
||||
struct set_c<
|
||||
T, C0, C1, C2, C3, C4, C5, C6, C7, C8, C9, C10, C11, C12, C13, C14
|
||||
, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX
|
||||
>
|
||||
: set15_c<
|
||||
T, C0, C1, C2, C3, C4, C5, C6, C7, C8, C9, C10, C11, C12, C13, C14
|
||||
>
|
||||
{
|
||||
typedef typename set15_c< T,C0,C1,C2,C3,C4,C5,C6,C7,C8,C9,C10,C11,C12,C13,C14 >::type type;
|
||||
};
|
||||
|
||||
template<
|
||||
typename T, long C0, long C1, long C2, long C3, long C4, long C5
|
||||
, long C6, long C7, long C8, long C9, long C10, long C11, long C12
|
||||
, long C13, long C14, long C15
|
||||
>
|
||||
struct set_c<
|
||||
T, C0, C1, C2, C3, C4, C5, C6, C7, C8, C9, C10, C11, C12, C13, C14
|
||||
, C15, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX
|
||||
>
|
||||
: set16_c<
|
||||
T, C0, C1, C2, C3, C4, C5, C6, C7, C8, C9, C10, C11, C12, C13, C14
|
||||
, C15
|
||||
>
|
||||
{
|
||||
typedef typename set16_c< T,C0,C1,C2,C3,C4,C5,C6,C7,C8,C9,C10,C11,C12,C13,C14,C15 >::type type;
|
||||
};
|
||||
|
||||
template<
|
||||
typename T, long C0, long C1, long C2, long C3, long C4, long C5
|
||||
, long C6, long C7, long C8, long C9, long C10, long C11, long C12
|
||||
, long C13, long C14, long C15, long C16
|
||||
>
|
||||
struct set_c<
|
||||
T, C0, C1, C2, C3, C4, C5, C6, C7, C8, C9, C10, C11, C12, C13, C14
|
||||
, C15, C16, LONG_MAX, LONG_MAX, LONG_MAX
|
||||
>
|
||||
: set17_c<
|
||||
T, C0, C1, C2, C3, C4, C5, C6, C7, C8, C9, C10, C11, C12, C13, C14
|
||||
, C15, C16
|
||||
>
|
||||
{
|
||||
typedef typename set17_c< T,C0,C1,C2,C3,C4,C5,C6,C7,C8,C9,C10,C11,C12,C13,C14,C15,C16 >::type type;
|
||||
};
|
||||
|
||||
template<
|
||||
typename T, long C0, long C1, long C2, long C3, long C4, long C5
|
||||
, long C6, long C7, long C8, long C9, long C10, long C11, long C12
|
||||
, long C13, long C14, long C15, long C16, long C17
|
||||
>
|
||||
struct set_c<
|
||||
T, C0, C1, C2, C3, C4, C5, C6, C7, C8, C9, C10, C11, C12, C13, C14
|
||||
, C15, C16, C17, LONG_MAX, LONG_MAX
|
||||
>
|
||||
: set18_c<
|
||||
T, C0, C1, C2, C3, C4, C5, C6, C7, C8, C9, C10, C11, C12, C13, C14
|
||||
, C15, C16, C17
|
||||
>
|
||||
{
|
||||
typedef typename set18_c< T,C0,C1,C2,C3,C4,C5,C6,C7,C8,C9,C10,C11,C12,C13,C14,C15,C16,C17 >::type type;
|
||||
};
|
||||
|
||||
template<
|
||||
typename T, long C0, long C1, long C2, long C3, long C4, long C5
|
||||
, long C6, long C7, long C8, long C9, long C10, long C11, long C12
|
||||
, long C13, long C14, long C15, long C16, long C17, long C18
|
||||
>
|
||||
struct set_c<
|
||||
T, C0, C1, C2, C3, C4, C5, C6, C7, C8, C9, C10, C11, C12, C13, C14
|
||||
, C15, C16, C17, C18, LONG_MAX
|
||||
>
|
||||
: set19_c<
|
||||
T, C0, C1, C2, C3, C4, C5, C6, C7, C8, C9, C10, C11, C12, C13, C14
|
||||
, C15, C16, C17, C18
|
||||
>
|
||||
{
|
||||
typedef typename set19_c< T,C0,C1,C2,C3,C4,C5,C6,C7,C8,C9,C10,C11,C12,C13,C14,C15,C16,C17,C18 >::type type;
|
||||
};
|
||||
|
||||
/// primary template (not a specialization!)
|
||||
|
||||
template<
|
||||
typename T, long C0, long C1, long C2, long C3, long C4, long C5
|
||||
, long C6, long C7, long C8, long C9, long C10, long C11, long C12
|
||||
, long C13, long C14, long C15, long C16, long C17, long C18, long C19
|
||||
>
|
||||
struct set_c
|
||||
: set20_c<
|
||||
T, C0, C1, C2, C3, C4, C5, C6, C7, C8, C9, C10, C11, C12, C13, C14
|
||||
, C15, C16, C17, C18, C19
|
||||
>
|
||||
{
|
||||
typedef typename set20_c< T,C0,C1,C2,C3,C4,C5,C6,C7,C8,C9,C10,C11,C12,C13,C14,C15,C16,C17,C18,C19 >::type type;
|
||||
};
|
||||
|
||||
}}
|
||||
|
||||
@@ -0,0 +1,50 @@
|
||||
/*==============================================================================
|
||||
Copyright (c) 2001-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)
|
||||
==============================================================================*/
|
||||
#ifndef BOOST_PHOENIX_OPERATOR_IF_ELSE_HPP
|
||||
#define BOOST_PHOENIX_OPERATOR_IF_ELSE_HPP
|
||||
|
||||
#include <boost/phoenix/core/limits.hpp>
|
||||
#include <boost/phoenix/core/meta_grammar.hpp>
|
||||
#include <boost/phoenix/core/expression.hpp>
|
||||
#include <boost/proto/operators.hpp>
|
||||
|
||||
namespace boost { namespace phoenix
|
||||
{
|
||||
namespace tag
|
||||
{
|
||||
typedef proto::tag::if_else_ if_else_operator;
|
||||
}
|
||||
|
||||
namespace expression
|
||||
{
|
||||
template <typename A0, typename A1, typename A2>
|
||||
struct if_else_operator
|
||||
: expr<tag::if_else_operator, A0, A1, A2>
|
||||
{};
|
||||
}
|
||||
|
||||
namespace rule
|
||||
{
|
||||
struct if_else_operator
|
||||
: expression::if_else_operator<
|
||||
meta_grammar
|
||||
, meta_grammar
|
||||
, meta_grammar
|
||||
>
|
||||
{};
|
||||
}
|
||||
|
||||
template <typename Dummy>
|
||||
struct meta_grammar::case_<tag::if_else_operator, Dummy>
|
||||
: enable_rule<rule::if_else_operator, Dummy>
|
||||
{};
|
||||
|
||||
using proto::if_else;
|
||||
}}
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,95 @@
|
||||
subroutine xcor4(s2,ipk,nsteps,nsym,lag1,lag2,ich,mode4,ccf,ccf0, &
|
||||
lagpk,flip)
|
||||
|
||||
! Computes ccf of the 4_FSK spectral array s2 and the pseudo-random
|
||||
! array pr2. Returns peak of CCF and the lag at which peak occurs.
|
||||
! The CCF peak may be either positive or negative, with negative
|
||||
! implying the "OOO" message.
|
||||
|
||||
parameter (NHMAX=1260) !Max length of power spectra
|
||||
parameter (NSMAX=525) !Max number of half-symbol steps
|
||||
real s2(NHMAX,NSMAX) !2d spectrum, stepped by half-symbols
|
||||
real a(NSMAX)
|
||||
real ccf(-5:540)
|
||||
integer nch(7)
|
||||
integer npr2(207)
|
||||
real pr2(207)
|
||||
logical first
|
||||
data lagmin/0/ !Silence compiler warning
|
||||
data first/.true./
|
||||
data npr2/ &
|
||||
0,0,0,0,1,1,0,0,0,1,1,0,1,1,0,0,1,0,1,0,0,0,0,0,0,0,1,1,0,0, &
|
||||
0,0,0,0,0,0,0,0,0,0,1,0,1,1,0,1,1,0,1,0,1,1,1,1,1,0,1,0,0,0, &
|
||||
1,0,0,1,0,0,1,1,1,1,1,0,0,0,1,0,1,0,0,0,1,1,1,1,0,1,1,0,0,1, &
|
||||
0,0,0,1,1,0,1,0,1,0,1,0,1,0,1,1,1,1,1,0,1,0,1,0,1,1,0,1,0,1, &
|
||||
0,1,1,1,0,0,1,0,1,1,0,1,1,1,1,0,0,0,0,1,1,0,1,1,0,0,0,1,1,1, &
|
||||
0,1,1,1,0,1,1,1,0,0,1,0,0,0,1,1,0,1,1,0,0,1,0,0,0,1,1,1,1,1, &
|
||||
1,0,0,1,1,0,0,0,0,1,1,0,0,0,1,0,1,1,0,1,1,1,1,0,1,0,1/
|
||||
data nch/1,2,4,9,18,36,72/
|
||||
save
|
||||
|
||||
if(first) then
|
||||
do i=1,207
|
||||
pr2(i)=2*npr2(i)-1
|
||||
enddo
|
||||
first=.false.
|
||||
endif
|
||||
|
||||
ccfmax=0.
|
||||
ccfmin=0.
|
||||
nw=nch(ich)
|
||||
|
||||
do j=1,nsteps
|
||||
n=2*mode4
|
||||
if(mode4.eq.1) then
|
||||
a(j)=max(s2(ipk+n,j),s2(ipk+3*n,j)) - max(s2(ipk ,j),s2(ipk+2*n,j))
|
||||
else
|
||||
kz=max(1,nw/2)
|
||||
ss0=0.
|
||||
ss1=0.
|
||||
ss2=0.
|
||||
ss3=0.
|
||||
wsum=0.
|
||||
do k=-kz+1,kz-1
|
||||
w=float(kz-iabs(k))/nw
|
||||
wsum=wsum+w
|
||||
ss0=ss0 + w*s2(ipk +k,j)
|
||||
ss1=ss1 + w*s2(ipk+ n+k,j)
|
||||
ss2=ss2 + w*s2(ipk+2*n+k,j)
|
||||
ss3=ss3 + w*s2(ipk+3*n+k,j)
|
||||
enddo
|
||||
a(j)=(max(ss1,ss3) - max(ss0,ss2))/sqrt(wsum)
|
||||
endif
|
||||
enddo
|
||||
|
||||
do lag=lag1,lag2
|
||||
x=0.
|
||||
do i=1,nsym
|
||||
j=2*i-1+lag
|
||||
if(j.ge.1 .and. j.le.nsteps) x=x+a(j)*pr2(i)
|
||||
enddo
|
||||
ccf(lag)=2*x !The 2 is for plotting scale
|
||||
if(ccf(lag).gt.ccfmax) then
|
||||
ccfmax=ccf(lag)
|
||||
lagpk=lag
|
||||
endif
|
||||
|
||||
if(ccf(lag).lt.ccfmin) then
|
||||
ccfmin=ccf(lag)
|
||||
lagmin=lag
|
||||
endif
|
||||
enddo
|
||||
|
||||
ccf0=ccfmax
|
||||
flip=1.0
|
||||
if(-ccfmin.gt.ccfmax) then
|
||||
do lag=lag1,lag2
|
||||
ccf(lag)=-ccf(lag)
|
||||
enddo
|
||||
lagpk=lagmin
|
||||
ccf0=-ccfmin
|
||||
flip=-1.0
|
||||
endif
|
||||
|
||||
return
|
||||
end subroutine xcor4
|
||||
@@ -0,0 +1,36 @@
|
||||
// Copyright Jim Bosch 2010-2012.
|
||||
// Copyright Stefan Seefeld 2016.
|
||||
// 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_python_numpy_numpy_object_mgr_traits_hpp_
|
||||
#define boost_python_numpy_numpy_object_mgr_traits_hpp_
|
||||
|
||||
/**
|
||||
* @brief Macro that specializes object_manager_traits by requiring a
|
||||
* source-file implementation of get_pytype().
|
||||
*/
|
||||
|
||||
#define NUMPY_OBJECT_MANAGER_TRAITS(manager) \
|
||||
template <> \
|
||||
struct object_manager_traits<manager> \
|
||||
{ \
|
||||
BOOST_STATIC_CONSTANT(bool, is_specialized = true); \
|
||||
static inline python::detail::new_reference adopt(PyObject* x) \
|
||||
{ \
|
||||
return python::detail::new_reference(python::pytype_check((PyTypeObject*)get_pytype(), x)); \
|
||||
} \
|
||||
static bool check(PyObject* x) \
|
||||
{ \
|
||||
return ::PyObject_IsInstance(x, (PyObject*)get_pytype()); \
|
||||
} \
|
||||
static manager* checked_downcast(PyObject* x) \
|
||||
{ \
|
||||
return python::downcast<manager>((checked_downcast_impl)(x, (PyTypeObject*)get_pytype())); \
|
||||
} \
|
||||
static PyTypeObject const * get_pytype(); \
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
@@ -0,0 +1,113 @@
|
||||
#ifndef BOOST_SMART_PTR_DETAIL_SPINLOCK_W32_HPP_INCLUDED
|
||||
#define BOOST_SMART_PTR_DETAIL_SPINLOCK_W32_HPP_INCLUDED
|
||||
|
||||
// MS compatible compilers support #pragma once
|
||||
|
||||
#if defined(_MSC_VER) && (_MSC_VER >= 1020)
|
||||
# pragma once
|
||||
#endif
|
||||
|
||||
//
|
||||
// Copyright (c) 2008 Peter Dimov
|
||||
//
|
||||
// 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)
|
||||
//
|
||||
|
||||
#include <boost/smart_ptr/detail/sp_interlocked.hpp>
|
||||
#include <boost/smart_ptr/detail/yield_k.hpp>
|
||||
|
||||
// BOOST_COMPILER_FENCE
|
||||
|
||||
#if defined(__INTEL_COMPILER)
|
||||
|
||||
#define BOOST_COMPILER_FENCE __memory_barrier();
|
||||
|
||||
#elif defined( _MSC_VER ) && _MSC_VER >= 1310
|
||||
|
||||
extern "C" void _ReadWriteBarrier();
|
||||
#pragma intrinsic( _ReadWriteBarrier )
|
||||
|
||||
#define BOOST_COMPILER_FENCE _ReadWriteBarrier();
|
||||
|
||||
#elif defined(__GNUC__)
|
||||
|
||||
#define BOOST_COMPILER_FENCE __asm__ __volatile__( "" : : : "memory" );
|
||||
|
||||
#else
|
||||
|
||||
#define BOOST_COMPILER_FENCE
|
||||
|
||||
#endif
|
||||
|
||||
//
|
||||
|
||||
namespace boost
|
||||
{
|
||||
|
||||
namespace detail
|
||||
{
|
||||
|
||||
class spinlock
|
||||
{
|
||||
public:
|
||||
|
||||
long v_;
|
||||
|
||||
public:
|
||||
|
||||
bool try_lock()
|
||||
{
|
||||
long r = BOOST_SP_INTERLOCKED_EXCHANGE( &v_, 1 );
|
||||
|
||||
BOOST_COMPILER_FENCE
|
||||
|
||||
return r == 0;
|
||||
}
|
||||
|
||||
void lock()
|
||||
{
|
||||
for( unsigned k = 0; !try_lock(); ++k )
|
||||
{
|
||||
boost::detail::yield( k );
|
||||
}
|
||||
}
|
||||
|
||||
void unlock()
|
||||
{
|
||||
BOOST_COMPILER_FENCE
|
||||
*const_cast< long volatile* >( &v_ ) = 0;
|
||||
}
|
||||
|
||||
public:
|
||||
|
||||
class scoped_lock
|
||||
{
|
||||
private:
|
||||
|
||||
spinlock & sp_;
|
||||
|
||||
scoped_lock( scoped_lock const & );
|
||||
scoped_lock & operator=( scoped_lock const & );
|
||||
|
||||
public:
|
||||
|
||||
explicit scoped_lock( spinlock & sp ): sp_( sp )
|
||||
{
|
||||
sp.lock();
|
||||
}
|
||||
|
||||
~scoped_lock()
|
||||
{
|
||||
sp_.unlock();
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
} // namespace detail
|
||||
} // namespace boost
|
||||
|
||||
#define BOOST_DETAIL_SPINLOCK_INIT {0}
|
||||
|
||||
#endif // #ifndef BOOST_SMART_PTR_DETAIL_SPINLOCK_W32_HPP_INCLUDED
|
||||
@@ -0,0 +1,218 @@
|
||||
#include "decodedtext.h"
|
||||
|
||||
#include <QStringList>
|
||||
#include <QRegularExpression>
|
||||
#include <QDebug>
|
||||
|
||||
extern "C" {
|
||||
bool stdmsg_(char const * msg, bool contest_mode, char const * mygrid, int len_msg, int len_grid);
|
||||
}
|
||||
|
||||
namespace
|
||||
{
|
||||
QRegularExpression words_re {R"(^(?:(?<word1>(?:CQ|DE|QRZ)(?:\s?DX|\s(?:[A-Z]{2}|\d{3}))|[A-Z0-9/]+)\s)(?:(?<word2>[A-Z0-9/]+)(?:\s(?<word3>[-+A-Z0-9]+)(?:\s(?<word4>(?:OOO|(?!RR73)[A-R]{2}[0-9]{2})))?)?)?)"};
|
||||
}
|
||||
|
||||
DecodedText::DecodedText (QString const& the_string, bool contest_mode, QString const& my_grid)
|
||||
: string_ {the_string}
|
||||
, padding_ {the_string.indexOf (" ") > 4 ? 2 : 0} // allow for
|
||||
// seconds
|
||||
, contest_mode_ {contest_mode}
|
||||
, message_ {string_.mid (column_qsoText + padding_).trimmed ()}
|
||||
, is_standard_ {false}
|
||||
{
|
||||
string_ = string_.left (column_qsoText + padding_ + 25);
|
||||
if (message_.length() >= 1)
|
||||
{
|
||||
message_ = message_.left (21).remove (QRegularExpression {"[<>]"});
|
||||
int i1 = message_.indexOf ('\r');
|
||||
if (i1 > 0)
|
||||
{
|
||||
message_ = message_.left (i1 - 1);
|
||||
}
|
||||
if (message_.contains (QRegularExpression {"^(CQ|QRZ)\\s"}))
|
||||
{
|
||||
// TODO this magic position 16 is guaranteed to be after the
|
||||
// last space in a decoded CQ or QRZ message but before any
|
||||
// appended DXCC entity name or worked before information
|
||||
auto eom_pos = message_.indexOf (' ', 16);
|
||||
// we always want at least the characters to position 16
|
||||
if (eom_pos < 16) eom_pos = message_.size () - 1;
|
||||
// remove DXCC entity and worked B4 status. TODO need a better way to do this
|
||||
message_ = message_.left (eom_pos + 1);
|
||||
}
|
||||
// stdmsg is a fortran routine that packs the text, unpacks it
|
||||
// and compares the result
|
||||
auto message_c_string = message_.toLocal8Bit ();
|
||||
message_c_string += QByteArray {22 - message_c_string.size (), ' '};
|
||||
auto grid_c_string = my_grid.toLocal8Bit ();
|
||||
grid_c_string += QByteArray {6 - grid_c_string.size (), ' '};
|
||||
is_standard_ = stdmsg_ (message_c_string.constData ()
|
||||
, contest_mode_
|
||||
, grid_c_string.constData ()
|
||||
, 22, 6);
|
||||
}
|
||||
};
|
||||
|
||||
QStringList DecodedText::messageWords () const
|
||||
{
|
||||
if (is_standard_)
|
||||
{
|
||||
// extract up to the first four message words
|
||||
return words_re.match (message_).capturedTexts ();
|
||||
}
|
||||
// simple word split for free text messages
|
||||
auto words = message_.split (' ', QString::SkipEmptyParts);
|
||||
// add whole message as item 0 to mimic RE capture list
|
||||
words.prepend (message_);
|
||||
return words;
|
||||
}
|
||||
|
||||
QString DecodedText::CQersCall() const
|
||||
{
|
||||
QRegularExpression callsign_re {R"(^(CQ|DE|QRZ)(\s?DX|\s([A-Z]{2}|\d{3}))?\s(?<callsign>[A-Z0-9/]{2,})(\s[A-R]{2}[0-9]{2})?)"};
|
||||
return callsign_re.match (message_).captured ("callsign");
|
||||
}
|
||||
|
||||
|
||||
bool DecodedText::isJT65() const
|
||||
{
|
||||
return string_.indexOf("#") == column_mode + padding_;
|
||||
}
|
||||
|
||||
bool DecodedText::isJT9() const
|
||||
{
|
||||
return string_.indexOf("@") == column_mode + padding_;
|
||||
}
|
||||
|
||||
bool DecodedText::isTX() const
|
||||
{
|
||||
int i = string_.indexOf("Tx");
|
||||
return (i >= 0 && i < 15); // TODO guessing those numbers. Does Tx ever move?
|
||||
}
|
||||
|
||||
bool DecodedText::isLowConfidence () const
|
||||
{
|
||||
return QChar {'?'} == string_.mid (padding_ + column_qsoText + 21, 1);
|
||||
}
|
||||
|
||||
int DecodedText::frequencyOffset() const
|
||||
{
|
||||
return string_.mid(column_freq + padding_,4).toInt();
|
||||
}
|
||||
|
||||
int DecodedText::snr() const
|
||||
{
|
||||
int i1=string_.indexOf(" ")+1;
|
||||
return string_.mid(i1,3).toInt();
|
||||
}
|
||||
|
||||
float DecodedText::dt() const
|
||||
{
|
||||
return string_.mid(column_dt + padding_,5).toFloat();
|
||||
}
|
||||
|
||||
/*
|
||||
2343 -11 0.8 1259 # YV6BFE F6GUU R-08
|
||||
2343 -19 0.3 718 # VE6WQ SQ2NIJ -14
|
||||
2343 -7 0.3 815 # KK4DSD W7VP -16
|
||||
2343 -13 0.1 3627 @ CT1FBK IK5YZT R+02
|
||||
|
||||
0605 Tx 1259 # CQ VK3ACF QF22
|
||||
*/
|
||||
|
||||
// find and extract any report. Returns true if this is a standard message
|
||||
bool DecodedText::report(QString const& myBaseCall, QString const& dxBaseCall, /*mod*/QString& report) const
|
||||
{
|
||||
if (message_.size () < 1) return false;
|
||||
|
||||
QStringList const& w = message_.split(" ",QString::SkipEmptyParts);
|
||||
if (w.size ()
|
||||
&& is_standard_ && (w[0] == myBaseCall
|
||||
|| w[0].endsWith ("/" + myBaseCall)
|
||||
|| w[0].startsWith (myBaseCall + "/")
|
||||
|| (w.size () > 1 && !dxBaseCall.isEmpty ()
|
||||
&& (w[1] == dxBaseCall
|
||||
|| w[1].endsWith ("/" + dxBaseCall)
|
||||
|| w[1].startsWith (dxBaseCall + "/")))))
|
||||
{
|
||||
QString tt="";
|
||||
if(w.size() > 2) tt=w[2];
|
||||
bool ok;
|
||||
auto i1=tt.toInt(&ok);
|
||||
if (ok and i1>=-50 and i1<50)
|
||||
{
|
||||
report = tt;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (tt.mid(0,1)=="R")
|
||||
{
|
||||
i1=tt.mid(1).toInt(&ok);
|
||||
if(ok and i1>=-50 and i1<50)
|
||||
{
|
||||
report = tt.mid(1);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return is_standard_;
|
||||
}
|
||||
|
||||
// get the first text word, usually the call
|
||||
QString DecodedText::call() const
|
||||
{
|
||||
return words_re.match (message_).captured ("word1");
|
||||
}
|
||||
|
||||
// get the second word, most likely the de call and the third word, most likely grid
|
||||
void DecodedText::deCallAndGrid(/*out*/QString& call, QString& grid) const
|
||||
{
|
||||
auto const& match = words_re.match (message_);
|
||||
call = match.captured ("word2");
|
||||
grid = match.captured ("word3");
|
||||
if (contest_mode_ && "R" == grid)
|
||||
{
|
||||
grid = match.captured ("word4");
|
||||
}
|
||||
}
|
||||
|
||||
unsigned DecodedText::timeInSeconds() const
|
||||
{
|
||||
return 3600 * string_.mid (column_time, 2).toUInt ()
|
||||
+ 60 * string_.mid (column_time + 2, 2).toUInt()
|
||||
+ (padding_ ? string_.mid (column_time + 2 + padding_, 2).toUInt () : 0U);
|
||||
}
|
||||
|
||||
/*
|
||||
2343 -11 0.8 1259 # YV6BFE F6GUU R-08
|
||||
2343 -19 0.3 718 # VE6WQ SQ2NIJ -14
|
||||
2343 -7 0.3 815 # KK4DSD W7VP -16
|
||||
2343 -13 0.1 3627 @ CT1FBK IK5YZT R+02
|
||||
|
||||
0605 Tx 1259 # CQ VK3ACF QF22
|
||||
*/
|
||||
|
||||
QString DecodedText::report() const // returns a string of the SNR field with a leading + or - followed by two digits
|
||||
{
|
||||
int sr = snr();
|
||||
if (sr<-50)
|
||||
sr = -50;
|
||||
else
|
||||
if (sr > 49)
|
||||
sr = 49;
|
||||
|
||||
QString rpt;
|
||||
rpt.sprintf("%d",abs(sr));
|
||||
if (sr > 9)
|
||||
rpt = "+" + rpt;
|
||||
else
|
||||
if (sr >= 0)
|
||||
rpt = "+0" + rpt;
|
||||
else
|
||||
if (sr >= -9)
|
||||
rpt = "-0" + rpt;
|
||||
else
|
||||
rpt = "-" + rpt;
|
||||
return rpt;
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,121 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// (C) Copyright Ion Gaztanaga 2014-2014
|
||||
//
|
||||
// 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/intrusive for documentation.
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef BOOST_INTRUSIVE_DETAIL_KEY_NODEPTR_COMP_HPP
|
||||
#define BOOST_INTRUSIVE_DETAIL_KEY_NODEPTR_COMP_HPP
|
||||
|
||||
#ifndef BOOST_CONFIG_HPP
|
||||
# include <boost/config.hpp>
|
||||
#endif
|
||||
|
||||
#if defined(BOOST_HAS_PRAGMA_ONCE)
|
||||
# pragma once
|
||||
#endif
|
||||
|
||||
#include <boost/intrusive/detail/mpl.hpp>
|
||||
#include <boost/intrusive/detail/ebo_functor_holder.hpp>
|
||||
#include <boost/intrusive/detail/tree_value_compare.hpp>
|
||||
|
||||
|
||||
namespace boost {
|
||||
namespace intrusive {
|
||||
namespace detail {
|
||||
|
||||
template < class KeyTypeKeyCompare
|
||||
, class ValueTraits
|
||||
, class KeyOfValue
|
||||
>
|
||||
struct key_nodeptr_comp_types
|
||||
{
|
||||
typedef ValueTraits value_traits;
|
||||
typedef typename value_traits::value_type value_type;
|
||||
typedef typename value_traits::node_ptr node_ptr;
|
||||
typedef typename value_traits::const_node_ptr const_node_ptr;
|
||||
typedef typename detail::if_c
|
||||
< detail::is_same<KeyOfValue, void>::value
|
||||
, detail::identity<value_type>
|
||||
, KeyOfValue
|
||||
>::type key_of_value;
|
||||
typedef tree_value_compare
|
||||
<typename ValueTraits::pointer, KeyTypeKeyCompare, key_of_value> base_t;
|
||||
};
|
||||
|
||||
//This function object transforms a key comparison type to
|
||||
//a function that can compare nodes or nodes with nodes or keys.
|
||||
template < class KeyTypeKeyCompare
|
||||
, class ValueTraits
|
||||
, class KeyOfValue = void
|
||||
>
|
||||
struct key_nodeptr_comp
|
||||
//Use public inheritance to avoid MSVC bugs with closures
|
||||
: public key_nodeptr_comp_types<KeyTypeKeyCompare, ValueTraits, KeyOfValue>::base_t
|
||||
{
|
||||
typedef key_nodeptr_comp_types<KeyTypeKeyCompare, ValueTraits, KeyOfValue> types_t;
|
||||
typedef typename types_t::value_traits value_traits;
|
||||
typedef typename types_t::value_type value_type;
|
||||
typedef typename types_t::node_ptr node_ptr;
|
||||
typedef typename types_t::const_node_ptr const_node_ptr;
|
||||
typedef typename types_t::base_t base_t;
|
||||
typedef typename types_t::key_of_value key_of_value;
|
||||
|
||||
template <class P1>
|
||||
struct is_same_or_nodeptr_convertible
|
||||
{
|
||||
static const bool same_type = is_same<P1,const_node_ptr>::value || is_same<P1,node_ptr>::value;
|
||||
static const bool value = same_type || is_convertible<P1, const_node_ptr>::value;
|
||||
};
|
||||
|
||||
base_t base() const
|
||||
{ return static_cast<const base_t&>(*this); }
|
||||
|
||||
BOOST_INTRUSIVE_FORCEINLINE key_nodeptr_comp(KeyTypeKeyCompare kcomp, const ValueTraits *traits)
|
||||
: base_t(kcomp), traits_(traits)
|
||||
{}
|
||||
|
||||
//pred(pnode)
|
||||
template<class T1>
|
||||
BOOST_INTRUSIVE_FORCEINLINE bool operator()(const T1 &t1, typename enable_if_c< is_same_or_nodeptr_convertible<T1>::value >::type* =0) const
|
||||
{ return base().get()(key_of_value()(*traits_->to_value_ptr(t1))); }
|
||||
|
||||
//operator() 2 arg
|
||||
//pred(pnode, pnode)
|
||||
template<class T1, class T2>
|
||||
BOOST_INTRUSIVE_FORCEINLINE bool operator()
|
||||
(const T1 &t1, const T2 &t2, typename enable_if_c< is_same_or_nodeptr_convertible<T1>::value && is_same_or_nodeptr_convertible<T2>::value >::type* =0) const
|
||||
{ return base()(*traits_->to_value_ptr(t1), *traits_->to_value_ptr(t2)); }
|
||||
|
||||
//pred(pnode, key)
|
||||
template<class T1, class T2>
|
||||
BOOST_INTRUSIVE_FORCEINLINE bool operator()
|
||||
(const T1 &t1, const T2 &t2, typename enable_if_c< is_same_or_nodeptr_convertible<T1>::value && !is_same_or_nodeptr_convertible<T2>::value >::type* =0) const
|
||||
{ return base()(*traits_->to_value_ptr(t1), t2); }
|
||||
|
||||
//pred(key, pnode)
|
||||
template<class T1, class T2>
|
||||
BOOST_INTRUSIVE_FORCEINLINE bool operator()
|
||||
(const T1 &t1, const T2 &t2, typename enable_if_c< !is_same_or_nodeptr_convertible<T1>::value && is_same_or_nodeptr_convertible<T2>::value >::type* =0) const
|
||||
{ return base()(t1, *traits_->to_value_ptr(t2)); }
|
||||
|
||||
//pred(key, key)
|
||||
template<class T1, class T2>
|
||||
BOOST_INTRUSIVE_FORCEINLINE bool operator()
|
||||
(const T1 &t1, const T2 &t2, typename enable_if_c< !is_same_or_nodeptr_convertible<T1>::value && !is_same_or_nodeptr_convertible<T2>::value >::type* =0) const
|
||||
{ return base()(t1, t2); }
|
||||
|
||||
const ValueTraits *const traits_;
|
||||
};
|
||||
|
||||
} //namespace detail{
|
||||
} //namespace intrusive{
|
||||
} //namespace boost{
|
||||
|
||||
#endif //BOOST_INTRUSIVE_DETAIL_KEY_NODEPTR_COMP_HPP
|
||||
@@ -0,0 +1,35 @@
|
||||
// Copyright (C) 2013 Vicente J. Botet Escriba
|
||||
//
|
||||
// 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)
|
||||
//
|
||||
// 2013/10 Vicente J. Botet Escriba
|
||||
// Creation.
|
||||
|
||||
#ifndef BOOST_CSBL_MEMORY_POINTER_TRAITS_HPP
|
||||
#define BOOST_CSBL_MEMORY_POINTER_TRAITS_HPP
|
||||
|
||||
#include <boost/thread/csbl/memory/config.hpp>
|
||||
|
||||
// 20.7.3, pointer traits
|
||||
#if defined BOOST_NO_CXX11_ALLOCATOR
|
||||
#include <boost/intrusive/pointer_traits.hpp>
|
||||
|
||||
namespace boost
|
||||
{
|
||||
namespace csbl
|
||||
{
|
||||
using ::boost::intrusive::pointer_traits;
|
||||
}
|
||||
}
|
||||
#else
|
||||
namespace boost
|
||||
{
|
||||
namespace csbl
|
||||
{
|
||||
using ::std::pointer_traits;
|
||||
}
|
||||
}
|
||||
#endif // BOOST_NO_CXX11_ALLOCATOR
|
||||
|
||||
#endif // header
|
||||
@@ -0,0 +1,242 @@
|
||||
// (C) Copyright Joel de Guzman 2003.
|
||||
// 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 VECTOR_INDEXING_SUITE_JDG20036_HPP
|
||||
# define VECTOR_INDEXING_SUITE_JDG20036_HPP
|
||||
|
||||
# include <boost/python/suite/indexing/indexing_suite.hpp>
|
||||
# include <boost/python/suite/indexing/container_utils.hpp>
|
||||
# include <boost/python/iterator.hpp>
|
||||
|
||||
namespace boost { namespace python {
|
||||
|
||||
// Forward declaration
|
||||
template <class Container, bool NoProxy, class DerivedPolicies>
|
||||
class vector_indexing_suite;
|
||||
|
||||
namespace detail
|
||||
{
|
||||
template <class Container, bool NoProxy>
|
||||
class final_vector_derived_policies
|
||||
: public vector_indexing_suite<Container,
|
||||
NoProxy, final_vector_derived_policies<Container, NoProxy> > {};
|
||||
}
|
||||
|
||||
// The vector_indexing_suite class is a predefined indexing_suite derived
|
||||
// class for wrapping std::vector (and std::vector like) classes. It provides
|
||||
// all the policies required by the indexing_suite (see indexing_suite).
|
||||
// Example usage:
|
||||
//
|
||||
// class X {...};
|
||||
//
|
||||
// ...
|
||||
//
|
||||
// class_<std::vector<X> >("XVec")
|
||||
// .def(vector_indexing_suite<std::vector<X> >())
|
||||
// ;
|
||||
//
|
||||
// By default indexed elements are returned by proxy. This can be
|
||||
// disabled by supplying *true* in the NoProxy template parameter.
|
||||
//
|
||||
template <
|
||||
class Container,
|
||||
bool NoProxy = false,
|
||||
class DerivedPolicies
|
||||
= detail::final_vector_derived_policies<Container, NoProxy> >
|
||||
class vector_indexing_suite
|
||||
: public indexing_suite<Container, DerivedPolicies, NoProxy>
|
||||
{
|
||||
public:
|
||||
|
||||
typedef typename Container::value_type data_type;
|
||||
typedef typename Container::value_type key_type;
|
||||
typedef typename Container::size_type index_type;
|
||||
typedef typename Container::size_type size_type;
|
||||
typedef typename Container::difference_type difference_type;
|
||||
|
||||
template <class Class>
|
||||
static void
|
||||
extension_def(Class& cl)
|
||||
{
|
||||
cl
|
||||
.def("append", &base_append)
|
||||
.def("extend", &base_extend)
|
||||
;
|
||||
}
|
||||
|
||||
static
|
||||
typename mpl::if_<
|
||||
is_class<data_type>
|
||||
, data_type&
|
||||
, data_type
|
||||
>::type
|
||||
get_item(Container& container, index_type i)
|
||||
{
|
||||
return container[i];
|
||||
}
|
||||
|
||||
static object
|
||||
get_slice(Container& container, index_type from, index_type to)
|
||||
{
|
||||
if (from > to)
|
||||
return object(Container());
|
||||
return object(Container(container.begin()+from, container.begin()+to));
|
||||
}
|
||||
|
||||
static void
|
||||
set_item(Container& container, index_type i, data_type const& v)
|
||||
{
|
||||
container[i] = v;
|
||||
}
|
||||
|
||||
static void
|
||||
set_slice(Container& container, index_type from,
|
||||
index_type to, data_type const& v)
|
||||
{
|
||||
if (from > to) {
|
||||
return;
|
||||
}
|
||||
else {
|
||||
container.erase(container.begin()+from, container.begin()+to);
|
||||
container.insert(container.begin()+from, v);
|
||||
}
|
||||
}
|
||||
|
||||
template <class Iter>
|
||||
static void
|
||||
set_slice(Container& container, index_type from,
|
||||
index_type to, Iter first, Iter last)
|
||||
{
|
||||
if (from > to) {
|
||||
container.insert(container.begin()+from, first, last);
|
||||
}
|
||||
else {
|
||||
container.erase(container.begin()+from, container.begin()+to);
|
||||
container.insert(container.begin()+from, first, last);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
delete_item(Container& container, index_type i)
|
||||
{
|
||||
container.erase(container.begin()+i);
|
||||
}
|
||||
|
||||
static void
|
||||
delete_slice(Container& container, index_type from, index_type to)
|
||||
{
|
||||
if (from > to) {
|
||||
// A null-op.
|
||||
return;
|
||||
}
|
||||
container.erase(container.begin()+from, container.begin()+to);
|
||||
}
|
||||
|
||||
static size_t
|
||||
size(Container& container)
|
||||
{
|
||||
return container.size();
|
||||
}
|
||||
|
||||
static bool
|
||||
contains(Container& container, key_type const& key)
|
||||
{
|
||||
return std::find(container.begin(), container.end(), key)
|
||||
!= container.end();
|
||||
}
|
||||
|
||||
static index_type
|
||||
get_min_index(Container& /*container*/)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
static index_type
|
||||
get_max_index(Container& container)
|
||||
{
|
||||
return container.size();
|
||||
}
|
||||
|
||||
static bool
|
||||
compare_index(Container& /*container*/, index_type a, index_type b)
|
||||
{
|
||||
return a < b;
|
||||
}
|
||||
|
||||
static index_type
|
||||
convert_index(Container& container, PyObject* i_)
|
||||
{
|
||||
extract<long> i(i_);
|
||||
if (i.check())
|
||||
{
|
||||
long index = i();
|
||||
if (index < 0)
|
||||
index += DerivedPolicies::size(container);
|
||||
if (index >= long(container.size()) || index < 0)
|
||||
{
|
||||
PyErr_SetString(PyExc_IndexError, "Index out of range");
|
||||
throw_error_already_set();
|
||||
}
|
||||
return index;
|
||||
}
|
||||
|
||||
PyErr_SetString(PyExc_TypeError, "Invalid index type");
|
||||
throw_error_already_set();
|
||||
return index_type();
|
||||
}
|
||||
|
||||
static void
|
||||
append(Container& container, data_type const& v)
|
||||
{
|
||||
container.push_back(v);
|
||||
}
|
||||
|
||||
template <class Iter>
|
||||
static void
|
||||
extend(Container& container, Iter first, Iter last)
|
||||
{
|
||||
container.insert(container.end(), first, last);
|
||||
}
|
||||
|
||||
private:
|
||||
|
||||
static void
|
||||
base_append(Container& container, object v)
|
||||
{
|
||||
extract<data_type&> elem(v);
|
||||
// try if elem is an exact Data
|
||||
if (elem.check())
|
||||
{
|
||||
DerivedPolicies::append(container, elem());
|
||||
}
|
||||
else
|
||||
{
|
||||
// try to convert elem to data_type
|
||||
extract<data_type> elem(v);
|
||||
if (elem.check())
|
||||
{
|
||||
DerivedPolicies::append(container, elem());
|
||||
}
|
||||
else
|
||||
{
|
||||
PyErr_SetString(PyExc_TypeError,
|
||||
"Attempting to append an invalid type");
|
||||
throw_error_already_set();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
base_extend(Container& container, object v)
|
||||
{
|
||||
std::vector<data_type> temp;
|
||||
container_utils::extend_container(temp, v);
|
||||
DerivedPolicies::extend(container, temp.begin(), temp.end());
|
||||
}
|
||||
};
|
||||
|
||||
}} // namespace boost::python
|
||||
|
||||
#endif // VECTOR_INDEXING_SUITE_JDG20036_HPP
|
||||
@@ -0,0 +1,83 @@
|
||||
subroutine gen65(msg0,ichk,msgsent,itone,itype)
|
||||
|
||||
! Encodes a JT65 message to yieild itone(1:126)
|
||||
! Temporarily, does not implement EME shorthands
|
||||
|
||||
use packjt
|
||||
character*22 msg0
|
||||
character*22 message !Message to be generated
|
||||
character*22 msgsent !Message as it will be received
|
||||
integer itone(126)
|
||||
character*3 cok !' ' or 'OOO'
|
||||
integer dgen(13)
|
||||
integer sent(63)
|
||||
integer nprc(126)
|
||||
data nprc/1,0,0,1,1,0,0,0,1,1,1,1,1,1,0,1,0,1,0,0, &
|
||||
0,1,0,1,1,0,0,1,0,0,0,1,1,1,0,0,1,1,1,1, &
|
||||
0,1,1,0,1,1,1,1,0,0,0,1,1,0,1,0,1,0,1,1, &
|
||||
0,0,1,1,0,1,0,1,0,1,0,0,1,0,0,0,0,0,0,1, &
|
||||
1,0,0,0,0,0,0,0,1,1,0,1,0,0,1,0,1,1,0,1, &
|
||||
0,1,0,1,0,0,1,1,0,0,1,0,0,1,0,0,0,0,1,1, &
|
||||
1,1,1,1,1,1/
|
||||
save
|
||||
|
||||
if(msg0(1:1).eq.'@') then
|
||||
read(msg0(2:5),*,end=1,err=1) nfreq
|
||||
go to 2
|
||||
1 nfreq=1000
|
||||
2 itone(1)=nfreq
|
||||
else
|
||||
message=msg0
|
||||
do i=1,22
|
||||
if(ichar(message(i:i)).eq.0) then
|
||||
message(i:)=' '
|
||||
exit
|
||||
endif
|
||||
enddo
|
||||
|
||||
do i=1,22 !Strip leading blanks
|
||||
if(message(1:1).ne.' ') exit
|
||||
message=message(i+1:)
|
||||
enddo
|
||||
|
||||
call chkmsg(message,cok,nspecial,flip)
|
||||
ntest=0
|
||||
if(flip.lt.0.0) ntest=1
|
||||
if(nspecial.eq.0) then
|
||||
call packmsg(message,dgen,itype,.false.) !Pack message into 72 bits
|
||||
call unpackmsg(dgen,msgsent,.false.,' ') !Unpack to get message sent
|
||||
msgsent(20:22)=cok
|
||||
call fmtmsg(msgsent,iz)
|
||||
if(ichk.ne.0) go to 999 !Return if checking only
|
||||
|
||||
call rs_encode(dgen,sent) !Apply Reed-Solomon code
|
||||
call interleave63(sent,1) !Apply interleaving
|
||||
call graycode65(sent,63,1) !Apply Gray code
|
||||
nsym=126 !Symbols per transmission
|
||||
k=0
|
||||
do j=1,nsym
|
||||
if(nprc(j).eq.ntest) then
|
||||
k=k+1
|
||||
itone(j)=sent(k)+2
|
||||
else
|
||||
itone(j)=0
|
||||
endif
|
||||
enddo
|
||||
else
|
||||
nsym=32
|
||||
k=0
|
||||
do j=1,nsym
|
||||
do n=1,4
|
||||
k=k+1
|
||||
if(iand(j,1).eq.1) itone(k)=0
|
||||
if(iand(j,1).eq.0) itone(k)=10*nspecial
|
||||
if(k.eq.126) go to 10
|
||||
enddo
|
||||
enddo
|
||||
10 msgsent=message
|
||||
itype=7
|
||||
endif
|
||||
endif
|
||||
|
||||
999 return
|
||||
end subroutine gen65
|
||||
@@ -0,0 +1,161 @@
|
||||
/*
|
||||
[auto_generated]
|
||||
boost/numeric/odeint/integrate/detail/integrate_n_steps.hpp
|
||||
|
||||
[begin_description]
|
||||
integrate steps implementation
|
||||
[end_description]
|
||||
|
||||
Copyright 2012-2015 Mario Mulansky
|
||||
Copyright 2012 Christoph Koke
|
||||
Copyright 2012 Karsten Ahnert
|
||||
|
||||
Distributed under the Boost Software License, Version 1.0.
|
||||
(See accompanying file LICENSE_1_0.txt or
|
||||
copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
*/
|
||||
|
||||
#ifndef BOOST_NUMERIC_ODEINT_INTEGRATE_DETAIL_INTEGRATE_N_STEPS_HPP_INCLUDED
|
||||
#define BOOST_NUMERIC_ODEINT_INTEGRATE_DETAIL_INTEGRATE_N_STEPS_HPP_INCLUDED
|
||||
|
||||
#include <boost/numeric/odeint/util/unwrap_reference.hpp>
|
||||
#include <boost/numeric/odeint/stepper/stepper_categories.hpp>
|
||||
#include <boost/numeric/odeint/integrate/detail/integrate_adaptive.hpp>
|
||||
#include <boost/numeric/odeint/util/unit_helper.hpp>
|
||||
|
||||
#include <boost/numeric/odeint/util/detail/less_with_sign.hpp>
|
||||
|
||||
namespace boost {
|
||||
namespace numeric {
|
||||
namespace odeint {
|
||||
namespace detail {
|
||||
|
||||
// forward declaration
|
||||
template< class Stepper , class System , class State , class Time , class Observer >
|
||||
size_t integrate_adaptive_checked(
|
||||
Stepper stepper , System system , State &start_state ,
|
||||
Time &start_time , Time end_time , Time &dt ,
|
||||
Observer observer, controlled_stepper_tag
|
||||
);
|
||||
|
||||
|
||||
/* basic version */
|
||||
template< class Stepper , class System , class State , class Time , class Observer>
|
||||
Time integrate_n_steps(
|
||||
Stepper stepper , System system , State &start_state ,
|
||||
Time start_time , Time dt , size_t num_of_steps ,
|
||||
Observer observer , stepper_tag )
|
||||
{
|
||||
typename odeint::unwrap_reference< Observer >::type &obs = observer;
|
||||
typename odeint::unwrap_reference< Stepper >::type &st = stepper;
|
||||
|
||||
Time time = start_time;
|
||||
|
||||
for( size_t step = 0; step < num_of_steps ; ++step )
|
||||
{
|
||||
obs( start_state , time );
|
||||
st.do_step( system , start_state , time , dt );
|
||||
// direct computation of the time avoids error propagation happening when using time += dt
|
||||
// we need clumsy type analysis to get boost units working here
|
||||
time = start_time + static_cast< typename unit_value_type<Time>::type >( step+1 ) * dt;
|
||||
}
|
||||
obs( start_state , time );
|
||||
|
||||
return time;
|
||||
}
|
||||
|
||||
|
||||
/* controlled version */
|
||||
template< class Stepper , class System , class State , class Time , class Observer >
|
||||
Time integrate_n_steps(
|
||||
Stepper stepper , System system , State &start_state ,
|
||||
Time start_time , Time dt , size_t num_of_steps ,
|
||||
Observer observer , controlled_stepper_tag )
|
||||
{
|
||||
typename odeint::unwrap_reference< Observer >::type &obs = observer;
|
||||
|
||||
Time time = start_time;
|
||||
Time time_step = dt;
|
||||
|
||||
for( size_t step = 0; step < num_of_steps ; ++step )
|
||||
{
|
||||
obs( start_state , time );
|
||||
// integrate_adaptive_checked uses the given checker to throw if an overflow occurs
|
||||
detail::integrate_adaptive(stepper, system, start_state, time, static_cast<Time>(time + time_step), dt,
|
||||
null_observer(), controlled_stepper_tag());
|
||||
// direct computation of the time avoids error propagation happening when using time += dt
|
||||
// we need clumsy type analysis to get boost units working here
|
||||
time = start_time + static_cast< typename unit_value_type<Time>::type >(step+1) * time_step;
|
||||
}
|
||||
obs( start_state , time );
|
||||
|
||||
return time;
|
||||
}
|
||||
|
||||
|
||||
/* dense output version */
|
||||
template< class Stepper , class System , class State , class Time , class Observer >
|
||||
Time integrate_n_steps(
|
||||
Stepper stepper , System system , State &start_state ,
|
||||
Time start_time , Time dt , size_t num_of_steps ,
|
||||
Observer observer , dense_output_stepper_tag )
|
||||
{
|
||||
typename odeint::unwrap_reference< Observer >::type &obs = observer;
|
||||
typename odeint::unwrap_reference< Stepper >::type &st = stepper;
|
||||
|
||||
Time time = start_time;
|
||||
const Time end_time = start_time + static_cast< typename unit_value_type<Time>::type >(num_of_steps) * dt;
|
||||
|
||||
st.initialize( start_state , time , dt );
|
||||
|
||||
size_t step = 0;
|
||||
|
||||
while( step < num_of_steps )
|
||||
{
|
||||
while( less_with_sign( time , st.current_time() , st.current_time_step() ) )
|
||||
{
|
||||
st.calc_state( time , start_state );
|
||||
obs( start_state , time );
|
||||
++step;
|
||||
// direct computation of the time avoids error propagation happening when using time += dt
|
||||
// we need clumsy type analysis to get boost units working here
|
||||
time = start_time + static_cast< typename unit_value_type<Time>::type >(step) * dt;
|
||||
}
|
||||
|
||||
// we have not reached the end, do another real step
|
||||
if( less_with_sign( static_cast<Time>(st.current_time()+st.current_time_step()) ,
|
||||
end_time ,
|
||||
st.current_time_step() ) )
|
||||
{
|
||||
st.do_step( system );
|
||||
}
|
||||
else if( less_with_sign( st.current_time() , end_time , st.current_time_step() ) )
|
||||
{ // do the last step ending exactly on the end point
|
||||
st.initialize( st.current_state() , st.current_time() , static_cast<Time>(end_time - st.current_time()) );
|
||||
st.do_step( system );
|
||||
}
|
||||
}
|
||||
|
||||
// make sure we really end exactly where we should end
|
||||
while( st.current_time() < end_time )
|
||||
{
|
||||
if( less_with_sign( end_time ,
|
||||
static_cast<Time>(st.current_time()+st.current_time_step()) ,
|
||||
st.current_time_step() ) )
|
||||
st.initialize( st.current_state() , st.current_time() , static_cast<Time>(end_time - st.current_time()) );
|
||||
st.do_step( system );
|
||||
}
|
||||
|
||||
// observation at final point
|
||||
obs( st.current_state() , end_time );
|
||||
|
||||
return time;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endif /* BOOST_NUMERIC_ODEINT_INTEGRATE_DETAIL_INTEGRATE_N_STEPS_HPP_INCLUDED */
|
||||
Reference in New Issue
Block a user