Initial Commit

This commit is contained in:
Jordan Sherer
2018-02-08 21:28:33 -05:00
commit 678c1d3966
14352 changed files with 3176737 additions and 0 deletions
@@ -0,0 +1,521 @@
//Copyright (c) 2006-2009 Emil Dotchevski and Reverge Studios, Inc.
//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 UUID_274DA366004E11DCB1DDFE2E56D89593
#define UUID_274DA366004E11DCB1DDFE2E56D89593
#if (__GNUC__*100+__GNUC_MINOR__>301) && !defined(BOOST_EXCEPTION_ENABLE_WARNINGS)
#pragma GCC system_header
#endif
#if defined(_MSC_VER) && !defined(BOOST_EXCEPTION_ENABLE_WARNINGS)
#pragma warning(push,1)
#endif
#ifdef BOOST_EXCEPTION_MINI_BOOST
#include <memory>
namespace boost { namespace exception_detail { using std::shared_ptr; } }
#else
namespace boost { template <class T> class shared_ptr; };
namespace boost { namespace exception_detail { using boost::shared_ptr; } }
#endif
namespace
boost
{
namespace
exception_detail
{
template <class T>
class
refcount_ptr
{
public:
refcount_ptr():
px_(0)
{
}
~refcount_ptr()
{
release();
}
refcount_ptr( refcount_ptr const & x ):
px_(x.px_)
{
add_ref();
}
refcount_ptr &
operator=( refcount_ptr const & x )
{
adopt(x.px_);
return *this;
}
void
adopt( T * px )
{
release();
px_=px;
add_ref();
}
T *
get() const
{
return px_;
}
private:
T * px_;
void
add_ref()
{
if( px_ )
px_->add_ref();
}
void
release()
{
if( px_ && px_->release() )
px_=0;
}
};
}
////////////////////////////////////////////////////////////////////////
template <class Tag,class T>
class error_info;
typedef error_info<struct throw_function_,char const *> throw_function;
typedef error_info<struct throw_file_,char const *> throw_file;
typedef error_info<struct throw_line_,int> throw_line;
template <>
class
error_info<throw_function_,char const *>
{
public:
typedef char const * value_type;
value_type v_;
explicit
error_info( value_type v ):
v_(v)
{
}
};
template <>
class
error_info<throw_file_,char const *>
{
public:
typedef char const * value_type;
value_type v_;
explicit
error_info( value_type v ):
v_(v)
{
}
};
template <>
class
error_info<throw_line_,int>
{
public:
typedef int value_type;
value_type v_;
explicit
error_info( value_type v ):
v_(v)
{
}
};
#if defined(__GNUC__)
# if (__GNUC__ == 4 && __GNUC_MINOR__ >= 1) || (__GNUC__ > 4)
# pragma GCC visibility push (default)
# endif
#endif
class exception;
#if defined(__GNUC__)
# if (__GNUC__ == 4 && __GNUC_MINOR__ >= 1) || (__GNUC__ > 4)
# pragma GCC visibility pop
# endif
#endif
namespace
exception_detail
{
class error_info_base;
struct type_info_;
struct
error_info_container
{
virtual char const * diagnostic_information( char const * ) const = 0;
virtual shared_ptr<error_info_base> get( type_info_ const & ) const = 0;
virtual void set( shared_ptr<error_info_base> const &, type_info_ const & ) = 0;
virtual void add_ref() const = 0;
virtual bool release() const = 0;
virtual refcount_ptr<exception_detail::error_info_container> clone() const = 0;
protected:
~error_info_container() throw()
{
}
};
template <class>
struct get_info;
template <>
struct get_info<throw_function>;
template <>
struct get_info<throw_file>;
template <>
struct get_info<throw_line>;
template <class>
struct set_info_rv;
template <>
struct set_info_rv<throw_function>;
template <>
struct set_info_rv<throw_file>;
template <>
struct set_info_rv<throw_line>;
char const * get_diagnostic_information( exception const &, char const * );
void copy_boost_exception( exception *, exception const * );
template <class E,class Tag,class T>
E const & set_info( E const &, error_info<Tag,T> const & );
template <class E>
E const & set_info( E const &, throw_function const & );
template <class E>
E const & set_info( E const &, throw_file const & );
template <class E>
E const & set_info( E const &, throw_line const & );
}
#if defined(__GNUC__)
# if (__GNUC__ == 4 && __GNUC_MINOR__ >= 1) || (__GNUC__ > 4)
# pragma GCC visibility push (default)
# endif
#endif
class
exception
{
//<N3757>
public:
template <class Tag> void set( typename Tag::type const & );
template <class Tag> typename Tag::type const * get() const;
//</N3757>
protected:
exception():
throw_function_(0),
throw_file_(0),
throw_line_(-1)
{
}
#ifdef __HP_aCC
//On HP aCC, this protected copy constructor prevents throwing boost::exception.
//On all other platforms, the same effect is achieved by the pure virtual destructor.
exception( exception const & x ) throw():
data_(x.data_),
throw_function_(x.throw_function_),
throw_file_(x.throw_file_),
throw_line_(x.throw_line_)
{
}
#endif
virtual ~exception() throw()
#ifndef __HP_aCC
= 0 //Workaround for HP aCC, =0 incorrectly leads to link errors.
#endif
;
#if (defined(__MWERKS__) && __MWERKS__<=0x3207) || (defined(_MSC_VER) && _MSC_VER<=1310)
public:
#else
private:
template <class E>
friend E const & exception_detail::set_info( E const &, throw_function const & );
template <class E>
friend E const & exception_detail::set_info( E const &, throw_file const & );
template <class E>
friend E const & exception_detail::set_info( E const &, throw_line const & );
template <class E,class Tag,class T>
friend E const & exception_detail::set_info( E const &, error_info<Tag,T> const & );
friend char const * exception_detail::get_diagnostic_information( exception const &, char const * );
template <class>
friend struct exception_detail::get_info;
friend struct exception_detail::get_info<throw_function>;
friend struct exception_detail::get_info<throw_file>;
friend struct exception_detail::get_info<throw_line>;
template <class>
friend struct exception_detail::set_info_rv;
friend struct exception_detail::set_info_rv<throw_function>;
friend struct exception_detail::set_info_rv<throw_file>;
friend struct exception_detail::set_info_rv<throw_line>;
friend void exception_detail::copy_boost_exception( exception *, exception const * );
#endif
mutable exception_detail::refcount_ptr<exception_detail::error_info_container> data_;
mutable char const * throw_function_;
mutable char const * throw_file_;
mutable int throw_line_;
};
#if defined(__GNUC__)
# if (__GNUC__ == 4 && __GNUC_MINOR__ >= 1) || (__GNUC__ > 4)
# pragma GCC visibility pop
# endif
#endif
inline
exception::
~exception() throw()
{
}
namespace
exception_detail
{
template <class E>
E const &
set_info( E const & x, throw_function const & y )
{
x.throw_function_=y.v_;
return x;
}
template <class E>
E const &
set_info( E const & x, throw_file const & y )
{
x.throw_file_=y.v_;
return x;
}
template <class E>
E const &
set_info( E const & x, throw_line const & y )
{
x.throw_line_=y.v_;
return x;
}
}
////////////////////////////////////////////////////////////////////////
namespace
exception_detail
{
#if defined(__GNUC__)
# if (__GNUC__ == 4 && __GNUC_MINOR__ >= 1) || (__GNUC__ > 4)
# pragma GCC visibility push (default)
# endif
#endif
template <class T>
struct
error_info_injector:
public T,
public exception
{
explicit
error_info_injector( T const & x ):
T(x)
{
}
~error_info_injector() throw()
{
}
};
#if defined(__GNUC__)
# if (__GNUC__ == 4 && __GNUC_MINOR__ >= 1) || (__GNUC__ > 4)
# pragma GCC visibility pop
# endif
#endif
struct large_size { char c[256]; };
large_size dispatch_boost_exception( exception const * );
struct small_size { };
small_size dispatch_boost_exception( void const * );
template <class,int>
struct enable_error_info_helper;
template <class T>
struct
enable_error_info_helper<T,sizeof(large_size)>
{
typedef T type;
};
template <class T>
struct
enable_error_info_helper<T,sizeof(small_size)>
{
typedef error_info_injector<T> type;
};
template <class T>
struct
enable_error_info_return_type
{
typedef typename enable_error_info_helper<T,sizeof(exception_detail::dispatch_boost_exception(static_cast<T *>(0)))>::type type;
};
}
template <class T>
inline
typename
exception_detail::enable_error_info_return_type<T>::type
enable_error_info( T const & x )
{
typedef typename exception_detail::enable_error_info_return_type<T>::type rt;
return rt(x);
}
////////////////////////////////////////////////////////////////////////
namespace
exception_detail
{
#if defined(__GNUC__)
# if (__GNUC__ == 4 && __GNUC_MINOR__ >= 1) || (__GNUC__ > 4)
# pragma GCC visibility push (default)
# endif
#endif
class
clone_base
{
public:
virtual clone_base const * clone() const = 0;
virtual void rethrow() const = 0;
virtual
~clone_base() throw()
{
}
};
#if defined(__GNUC__)
# if (__GNUC__ == 4 && __GNUC_MINOR__ >= 1) || (__GNUC__ > 4)
# pragma GCC visibility pop
# endif
#endif
inline
void
copy_boost_exception( exception * a, exception const * b )
{
refcount_ptr<error_info_container> data;
if( error_info_container * d=b->data_.get() )
data = d->clone();
a->throw_file_ = b->throw_file_;
a->throw_line_ = b->throw_line_;
a->throw_function_ = b->throw_function_;
a->data_ = data;
}
inline
void
copy_boost_exception( void *, void const * )
{
}
#if defined(__GNUC__)
# if (__GNUC__ == 4 && __GNUC_MINOR__ >= 1) || (__GNUC__ > 4)
# pragma GCC visibility push (default)
# endif
#endif
template <class T>
class
clone_impl:
public T,
public virtual clone_base
{
struct clone_tag { };
clone_impl( clone_impl const & x, clone_tag ):
T(x)
{
copy_boost_exception(this,&x);
}
public:
explicit
clone_impl( T const & x ):
T(x)
{
copy_boost_exception(this,&x);
}
~clone_impl() throw()
{
}
private:
clone_base const *
clone() const
{
return new clone_impl(*this,clone_tag());
}
void
rethrow() const
{
throw*this;
}
};
}
#if defined(__GNUC__)
# if (__GNUC__ == 4 && __GNUC_MINOR__ >= 1) || (__GNUC__ > 4)
# pragma GCC visibility pop
# endif
#endif
template <class T>
inline
exception_detail::clone_impl<T>
enable_current_exception( T const & x )
{
return exception_detail::clone_impl<T>(x);
}
}
#if defined(_MSC_VER) && !defined(BOOST_EXCEPTION_ENABLE_WARNINGS)
#pragma warning(pop)
#endif
#endif
@@ -0,0 +1,70 @@
/*==============================================================================
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_STATEMENT_WHILE_HPP
#define BOOST_PHOENIX_STATEMENT_WHILE_HPP
#include <boost/phoenix/core/limits.hpp>
#include <boost/phoenix/core/call.hpp>
#include <boost/phoenix/core/expression.hpp>
#include <boost/phoenix/core/meta_grammar.hpp>
BOOST_PHOENIX_DEFINE_EXPRESSION(
(boost)(phoenix)(while_)
, (meta_grammar) // Cond
(meta_grammar) // Do
)
namespace boost { namespace phoenix
{
struct while_eval
{
typedef void result_type;
template <typename Cond, typename Do, typename Context>
result_type
operator()(Cond const& cond, Do const& do_it, Context const & ctx) const
{
while(boost::phoenix::eval(cond, ctx))
{
boost::phoenix::eval(do_it, ctx);
}
}
};
template <typename Dummy>
struct default_actions::when<rule::while_, Dummy>
: call<while_eval, Dummy>
{};
template <typename Cond>
struct while_gen
{
while_gen(Cond const& cond_) : cond(cond_) {}
template <typename Do>
typename expression::while_<Cond, Do>::type const
operator[](Do const& do_it) const
{
return expression::while_<Cond, Do>::make(cond, do_it);
}
Cond const& cond;
};
template <typename Cond>
inline
while_gen<Cond> const
while_(Cond const& cond)
{
return while_gen<Cond>(cond);
}
}}
#endif
@@ -0,0 +1,69 @@
/*=============================================================================
Copyright (c) 2011 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_CORE_DETAIL_PHX2_RESULT_HPP
#define BOOST_PHOENIX_CORE_DETAIL_PHX2_RESULT_HPP
#include <boost/phoenix/core/limits.hpp>
#include <boost/phoenix/support/iterate.hpp>
#include <boost/mpl/has_xxx.hpp>
#include <boost/mpl/bool.hpp>
namespace boost { namespace phoenix {
namespace detail
{
BOOST_MPL_HAS_XXX_TRAIT_DEF(result_type)
template <typename Result>
struct has_phx2_result_impl
{
typedef char yes;
typedef char (&no)[2];
template <typename A>
static yes check_(typename A::type *);
template <typename A>
static no check_(...);
static bool const value = (sizeof(yes) == sizeof(check_<Result>(0)));
typedef boost::mpl::bool_<value> type;
};
#ifdef BOOST_PHOENIX_NO_VARIADIC_PHX2_RESULT
#include <boost/phoenix/core/detail/cpp03/phx2_result.hpp>
#else
template <typename F, typename... A>
struct has_phx2_result
: mpl::eval_if<
has_result_type<F>
, mpl::false_
, has_phx2_result_impl<typename F::template result<F(A...)> >
>::type
{};
template <typename F, typename... A>
struct phx2_result
{
typedef typename F::template result<A...>::type type;
};
template <typename F, typename... A>
struct phx2_result<F, A &...>
{
typedef typename F::template result<A...>::type type;
};
template <typename F, typename... A>
struct phx2_result<F, A const &...>
{
typedef typename F::template result<A...>::type type;
};
#endif
}
}}
#endif
@@ -0,0 +1,247 @@
/*
[auto_generated]
boost/numeric/odeint/stepper/detail/generic_rk_algorithm.hpp
[begin_description]
Implementation of the generic Runge-Kutta method.
[end_description]
Copyright 2011-2013 Mario Mulansky
Copyright 2011-2012 Karsten Ahnert
Copyright 2012 Christoph Koke
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_STEPPER_DETAIL_GENERIC_RK_ALGORITHM_HPP_INCLUDED
#define BOOST_NUMERIC_ODEINT_STEPPER_DETAIL_GENERIC_RK_ALGORITHM_HPP_INCLUDED
#include <boost/static_assert.hpp>
#include <boost/mpl/vector.hpp>
#include <boost/mpl/push_back.hpp>
#include <boost/mpl/for_each.hpp>
#include <boost/mpl/range_c.hpp>
#include <boost/mpl/copy.hpp>
#include <boost/mpl/size_t.hpp>
#include <boost/fusion/algorithm.hpp>
#include <boost/fusion/iterator.hpp>
#include <boost/fusion/mpl.hpp>
#include <boost/fusion/sequence.hpp>
#include <boost/array.hpp>
#include <boost/numeric/odeint/algebra/range_algebra.hpp>
#include <boost/numeric/odeint/algebra/default_operations.hpp>
#include <boost/numeric/odeint/stepper/detail/generic_rk_call_algebra.hpp>
#include <boost/numeric/odeint/stepper/detail/generic_rk_operations.hpp>
#include <boost/numeric/odeint/util/bind.hpp>
namespace boost {
namespace numeric {
namespace odeint {
namespace detail {
template< class T , class Constant >
struct array_wrapper
{
typedef const typename boost::array< T , Constant::value > type;
};
template< class T , size_t i >
struct stage
{
T c;
boost::array< T , i > a;
};
template< class T , class Constant >
struct stage_wrapper
{
typedef stage< T , Constant::value > type;
};
template<
size_t StageCount,
class Value ,
class Algebra ,
class Operations
>
class generic_rk_algorithm {
public:
typedef mpl::range_c< size_t , 1 , StageCount > stage_indices;
typedef typename boost::fusion::result_of::as_vector
<
typename boost::mpl::copy
<
stage_indices ,
boost::mpl::inserter
<
boost::mpl::vector0< > ,
boost::mpl::push_back< boost::mpl::_1 , array_wrapper< Value , boost::mpl::_2 > >
>
>::type
>::type coef_a_type;
typedef boost::array< Value , StageCount > coef_b_type;
typedef boost::array< Value , StageCount > coef_c_type;
typedef typename boost::fusion::result_of::as_vector
<
typename boost::mpl::push_back
<
typename boost::mpl::copy
<
stage_indices,
boost::mpl::inserter
<
boost::mpl::vector0<> ,
boost::mpl::push_back< boost::mpl::_1 , stage_wrapper< Value , boost::mpl::_2 > >
>
>::type ,
stage< Value , StageCount >
>::type
>::type stage_vector_base;
struct stage_vector : public stage_vector_base
{
struct do_insertion
{
stage_vector_base &m_base;
const coef_a_type &m_a;
const coef_c_type &m_c;
do_insertion( stage_vector_base &base , const coef_a_type &a , const coef_c_type &c )
: m_base( base ) , m_a( a ) , m_c( c ) { }
template< class Index >
void operator()( Index ) const
{
//boost::fusion::at< Index >( m_base ) = stage< double , Index::value+1 , intermediate_stage >( m_c[ Index::value ] , boost::fusion::at< Index >( m_a ) );
boost::fusion::at< Index >( m_base ).c = m_c[ Index::value ];
boost::fusion::at< Index >( m_base ).a = boost::fusion::at< Index >( m_a );
}
};
struct print_butcher
{
const stage_vector_base &m_base;
std::ostream &m_os;
print_butcher( const stage_vector_base &base , std::ostream &os )
: m_base( base ) , m_os( os )
{ }
template<class Index>
void operator()(Index) const {
m_os << boost::fusion::at<Index>(m_base).c << " | ";
for( size_t i=0 ; i<Index::value ; ++i )
m_os << boost::fusion::at<Index>(m_base).a[i] << " ";
m_os << std::endl;
}
};
stage_vector( const coef_a_type &a , const coef_b_type &b , const coef_c_type &c )
{
typedef boost::mpl::range_c< size_t , 0 , StageCount-1 > indices;
boost::mpl::for_each< indices >( do_insertion( *this , a , c ) );
boost::fusion::at_c< StageCount - 1 >( *this ).c = c[ StageCount - 1 ];
boost::fusion::at_c< StageCount - 1 >( *this ).a = b;
}
void print( std::ostream &os ) const
{
typedef boost::mpl::range_c< size_t , 0 , StageCount > indices;
boost::mpl::for_each< indices >( print_butcher( *this , os ) );
}
};
template< class System , class StateIn , class StateTemp , class DerivIn , class Deriv ,
class StateOut , class Time >
struct calculate_stage
{
Algebra &algebra;
System &system;
const StateIn &x;
StateTemp &x_tmp;
StateOut &x_out;
const DerivIn &dxdt;
Deriv *F;
Time t;
Time dt;
calculate_stage( Algebra &_algebra , System &_system , const StateIn &_x , const DerivIn &_dxdt , StateOut &_out ,
StateTemp &_x_tmp , Deriv *_F , Time _t , Time _dt )
: algebra( _algebra ) , system( _system ) , x( _x ) , x_tmp( _x_tmp ) , x_out( _out) , dxdt( _dxdt ) , F( _F ) , t( _t ) , dt( _dt )
{}
template< typename T , size_t stage_number >
void inline operator()( stage< T , stage_number > const &stage ) const
//typename stage_fusion_wrapper< T , mpl::size_t< stage_number > , intermediate_stage >::type const &stage ) const
{
if( stage_number > 1 )
{
#ifdef BOOST_MSVC
#pragma warning( disable : 4307 34 )
#endif
system( x_tmp , F[stage_number-2].m_v , t + stage.c * dt );
#ifdef BOOST_MSVC
#pragma warning( default : 4307 34 )
#endif
}
//std::cout << stage_number-2 << ", t': " << t + stage.c * dt << std::endl;
if( stage_number < StageCount )
detail::template generic_rk_call_algebra< stage_number , Algebra >()( algebra , x_tmp , x , dxdt , F ,
detail::generic_rk_scale_sum< stage_number , Operations , Value , Time >( stage.a , dt) );
// algebra_type::template for_eachn<stage_number>( x_tmp , x , dxdt , F ,
// typename operations_type::template scale_sumn< stage_number , time_type >( stage.a , dt ) );
else
detail::template generic_rk_call_algebra< stage_number , Algebra >()( algebra , x_out , x , dxdt , F ,
detail::generic_rk_scale_sum< stage_number , Operations , Value , Time >( stage.a , dt ) );
// algebra_type::template for_eachn<stage_number>( x_out , x , dxdt , F ,
// typename operations_type::template scale_sumn< stage_number , time_type >( stage.a , dt ) );
}
};
generic_rk_algorithm( const coef_a_type &a , const coef_b_type &b , const coef_c_type &c )
: m_stages( a , b , c )
{ }
template< class System , class StateIn , class DerivIn , class Time , class StateOut , class StateTemp , class Deriv >
void inline do_step( Algebra &algebra , System system , const StateIn &in , const DerivIn &dxdt ,
Time t , StateOut &out , Time dt ,
StateTemp &x_tmp , Deriv F[StageCount-1] ) const
{
typedef typename odeint::unwrap_reference< System >::type unwrapped_system_type;
unwrapped_system_type &sys = system;
boost::fusion::for_each( m_stages , calculate_stage<
unwrapped_system_type , StateIn , StateTemp , DerivIn , Deriv , StateOut , Time >
( algebra , sys , in , dxdt , out , x_tmp , F , t , dt ) );
}
private:
stage_vector m_stages;
};
}
}
}
}
#endif // BOOST_NUMERIC_ODEINT_STEPPER_DETAIL_GENERIC_RK_ALGORITHM_HPP_INCLUDED
@@ -0,0 +1,197 @@
// Copyright Kevlin Henney, 2000-2005.
// Copyright Alexander Nasonov, 2006-2010.
// Copyright Antony Polukhin, 2011-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)
//
// what: lexical_cast custom keyword cast
// who: contributed by Kevlin Henney,
// enhanced with contributions from Terje Slettebo,
// with additional fixes and suggestions from Gennaro Prota,
// Beman Dawes, Dave Abrahams, Daryle Walker, Peter Dimov,
// Alexander Nasonov, Antony Polukhin, Justin Viiret, Michael Hofmann,
// Cheng Yang, Matthew Bradbury, David W. Birdsall, Pavel Korzh and other Boosters
// when: November 2000, March 2003, June 2005, June 2006, March 2011 - 2014
#ifndef BOOST_LEXICAL_CAST_DETAIL_INF_NAN_HPP
#define BOOST_LEXICAL_CAST_DETAIL_INF_NAN_HPP
#include <boost/config.hpp>
#ifdef BOOST_HAS_PRAGMA_ONCE
# pragma once
#endif
#if defined(BOOST_NO_STRINGSTREAM) || defined(BOOST_NO_STD_WSTRING)
#define BOOST_LCAST_NO_WCHAR_T
#endif
#include <cstddef>
#include <cstring>
#include <boost/limits.hpp>
#include <boost/detail/workaround.hpp>
#include <boost/math/special_functions/sign.hpp>
#include <boost/math/special_functions/fpclassify.hpp>
#include <boost/lexical_cast/detail/lcast_char_constants.hpp>
namespace boost {
namespace detail
{
template <class CharT>
bool lc_iequal(const CharT* val, const CharT* lcase, const CharT* ucase, unsigned int len) BOOST_NOEXCEPT {
for( unsigned int i=0; i < len; ++i ) {
if ( val[i] != lcase[i] && val[i] != ucase[i] ) return false;
}
return true;
}
/* Returns true and sets the correct value if found NaN or Inf. */
template <class CharT, class T>
inline bool parse_inf_nan_impl(const CharT* begin, const CharT* end, T& value
, const CharT* lc_NAN, const CharT* lc_nan
, const CharT* lc_INFINITY, const CharT* lc_infinity
, const CharT opening_brace, const CharT closing_brace) BOOST_NOEXCEPT
{
using namespace std;
if (begin == end) return false;
const CharT minus = lcast_char_constants<CharT>::minus;
const CharT plus = lcast_char_constants<CharT>::plus;
const int inifinity_size = 8; // == sizeof("infinity") - 1
/* Parsing +/- */
bool const has_minus = (*begin == minus);
if (has_minus || *begin == plus) {
++ begin;
}
if (end - begin < 3) return false;
if (lc_iequal(begin, lc_nan, lc_NAN, 3)) {
begin += 3;
if (end != begin) {
/* It is 'nan(...)' or some bad input*/
if (end - begin < 2) return false; // bad input
-- end;
if (*begin != opening_brace || *end != closing_brace) return false; // bad input
}
if( !has_minus ) value = std::numeric_limits<T>::quiet_NaN();
else value = (boost::math::changesign) (std::numeric_limits<T>::quiet_NaN());
return true;
} else if (
( /* 'INF' or 'inf' */
end - begin == 3 // 3 == sizeof('inf') - 1
&& lc_iequal(begin, lc_infinity, lc_INFINITY, 3)
)
||
( /* 'INFINITY' or 'infinity' */
end - begin == inifinity_size
&& lc_iequal(begin, lc_infinity, lc_INFINITY, inifinity_size)
)
)
{
if( !has_minus ) value = std::numeric_limits<T>::infinity();
else value = (boost::math::changesign) (std::numeric_limits<T>::infinity());
return true;
}
return false;
}
template <class CharT, class T>
bool put_inf_nan_impl(CharT* begin, CharT*& end, const T& value
, const CharT* lc_nan
, const CharT* lc_infinity) BOOST_NOEXCEPT
{
using namespace std;
const CharT minus = lcast_char_constants<CharT>::minus;
if ((boost::math::isnan)(value)) {
if ((boost::math::signbit)(value)) {
*begin = minus;
++ begin;
}
memcpy(begin, lc_nan, 3 * sizeof(CharT));
end = begin + 3;
return true;
} else if ((boost::math::isinf)(value)) {
if ((boost::math::signbit)(value)) {
*begin = minus;
++ begin;
}
memcpy(begin, lc_infinity, 3 * sizeof(CharT));
end = begin + 3;
return true;
}
return false;
}
#ifndef BOOST_LCAST_NO_WCHAR_T
template <class T>
bool parse_inf_nan(const wchar_t* begin, const wchar_t* end, T& value) BOOST_NOEXCEPT {
return parse_inf_nan_impl(begin, end, value
, L"NAN", L"nan"
, L"INFINITY", L"infinity"
, L'(', L')');
}
template <class T>
bool put_inf_nan(wchar_t* begin, wchar_t*& end, const T& value) BOOST_NOEXCEPT {
return put_inf_nan_impl(begin, end, value, L"nan", L"infinity");
}
#endif
#if !defined(BOOST_NO_CXX11_CHAR16_T) && !defined(BOOST_NO_CXX11_UNICODE_LITERALS)
template <class T>
bool parse_inf_nan(const char16_t* begin, const char16_t* end, T& value) BOOST_NOEXCEPT {
return parse_inf_nan_impl(begin, end, value
, u"NAN", u"nan"
, u"INFINITY", u"infinity"
, u'(', u')');
}
template <class T>
bool put_inf_nan(char16_t* begin, char16_t*& end, const T& value) BOOST_NOEXCEPT {
return put_inf_nan_impl(begin, end, value, u"nan", u"infinity");
}
#endif
#if !defined(BOOST_NO_CXX11_CHAR32_T) && !defined(BOOST_NO_CXX11_UNICODE_LITERALS)
template <class T>
bool parse_inf_nan(const char32_t* begin, const char32_t* end, T& value) BOOST_NOEXCEPT {
return parse_inf_nan_impl(begin, end, value
, U"NAN", U"nan"
, U"INFINITY", U"infinity"
, U'(', U')');
}
template <class T>
bool put_inf_nan(char32_t* begin, char32_t*& end, const T& value) BOOST_NOEXCEPT {
return put_inf_nan_impl(begin, end, value, U"nan", U"infinity");
}
#endif
template <class CharT, class T>
bool parse_inf_nan(const CharT* begin, const CharT* end, T& value) BOOST_NOEXCEPT {
return parse_inf_nan_impl(begin, end, value
, "NAN", "nan"
, "INFINITY", "infinity"
, '(', ')');
}
template <class CharT, class T>
bool put_inf_nan(CharT* begin, CharT*& end, const T& value) BOOST_NOEXCEPT {
return put_inf_nan_impl(begin, end, value, "nan", "infinity");
}
}
} // namespace boost
#undef BOOST_LCAST_NO_WCHAR_T
#endif // BOOST_LEXICAL_CAST_DETAIL_INF_NAN_HPP
@@ -0,0 +1,137 @@
# Makefile for MinGW on Windows
# Windows re-direct:
# C> make > junk1 2>&1
# Set paths
EXE_DIR = ../../wsjtx_install
INCPATH = -I'C:/JTSDK/Qt5/5.2.1/mingw48_32/include/QtCore' \
-I'C:/JTSDK/Qt5/5.2.1/mingw48_32/include/'
# Compilers
CC = c:/JTSDK/Qt5/Tools/mingw48_32/bin/gcc
FC = c:/JTSDK/Qt5/Tools/mingw48_32/bin/gfortran
CXX = c:/JTSDK/Qt5/Tools/mingw48_32/bin/g++
FFLAGS = -O3 -Wall -Wno-conversion -fno-second-underscore -DWIN32
CFLAGS = -I. -DWIN32
# Default rules
%.o: %.c
${CC} ${CFLAGS} -c $<
%.o: %.f
${FC} ${FFLAGS} -c $<
%.o: %.F
${FC} ${FFLAGS} -c $<
%.o: %.f90
${FC} ${FFLAGS} -c $<
%.o: %.F90
${FC} ${FFLAGS} -c $<
all: libjt9.a libastro.a jt9.exe jt9code.exe jt65code.exe jt9sim.exe
OBJS1 = pctile.o graycode.o sort.o chkmsg.o \
unpackmsg.o igray.o unpackcall.o unpackgrid.o \
grid2k.o unpacktext.o getpfx2.o packmsg.o deg2grid.o \
packtext.o getpfx1.o packcall.o k2grid.o packgrid.o \
nchar.o four2a.o grid2deg.o pfxdump.o wisdom.o \
symspec.o analytic.o db.o genjt9.o flat1.o smo.o \
packbits.o unpackbits.o encode232.o interleave9.o \
entail.o fano232.o gran.o sync9.o jt9fano.o \
fil3.o decoder.o grid2n.o n2grid.o timer.o \
softsym.o getlags.o afc9.o fchisq.o twkfreq.o downsam9.o \
peakdt9.o symspec2.o stdmsg.o morse.o azdist.o geodist.o \
fillcom.o chkss2.o zplot9.o flat2.o \
jt65a.o symspec65.o flat65.o ccf65.o decode65a.o \
filbig.o fil6521.o afc65b.o decode65b.o setup65.o \
extract.o fchisq65.o demod64a.o chkhist.o interleave63.o ccf2.o \
move.o indexx.o graycode65.o twkfreq65.o smo121.o \
wrapkarn.o init_rs.o encode_rs.o decode_rs.o gen65.o fil4.o \
flat4.o polfit.o determ.o baddata.o prog_args.o \
options.o fmtmsg.o decjt9.o
libjt9.a: $(OBJS1)
ar cr libjt9.a $(OBJS1)
ranlib libjt9.a
OBJS2 = jt9.o jt9a.o jt9b.o jt9c.o ipcomm.o sec_midn.o usleep.o
LIBS2 = -L'C:/JTSDK/Qt5/5.2.1/mingw48_32/lib' -lQt5Core
jt9.exe: $(OBJS2) libjt9.a
$(CXX) -o jt9.exe -static $(OBJS2) $(LIBS2) libjt9.a \
C:\JTSDK\fftw3f\libfftw3f-3.dll -lgfortran
# mkdir -p $(EXE_DIR)
cp jt9.exe $(EXE_DIR)
OBJS3 = jt9sim.o
jt9sim.exe: $(OBJS3) libjt9.a
$(FC) -o jt9sim.exe $(OBJS3) libjt9.a
OBJS4 = jt9code.o
jt9code.exe: $(OBJS4) libjt9.a
$(FC) -o jt9code.exe $(OBJS4) libjt9.a
cp jt9code.exe $(EXE_DIR)
OBJS5 = jt65.o
jt65.exe: $(OBJS5) libjt9.a
$(FC) -o jt65.exe $(OBJS5) libjt9.a ../libfftw3f_win.a
OBJS7 = astrosub.o astro0.o astro.o tm2.o grid2deg.o sun.o moondop.o \
coord.o dot.o moon2.o tmoonsub.o toxyz.o geocentric.o \
dcoord.o
libastro.a: $(OBJS7)
ar cr libastro.a $(OBJS7)
ranlib libastro.a
OBJS6 = jt65code.o
jt65code.exe: $(OBJS6) libjt9.a
$(FC) -o jt65code.exe $(OBJS6) libjt9.a
cp jt65code.exe $(EXE_DIR)
sync9.o: sync9.f90 jt9sync.f90
$(FC) $(FFLAGS) -c sync9.f90
spec9.o: spec9.f90 jt9sync.f90
$(FC) $(FFLAGS) -c spec9.f90
peakdt9.o: peakdt9.f90 jt9sync.f90
$(FC) $(FFLAGS) -c peakdt9.f90
jt9sim.o: jt9sim.f90 jt9sync.f90
$(FC) $(FFLAGS) -c jt9sim.f90
genjt9.o: genjt9.f90 jt9sync.f90
$(FC) $(FFLAGS) -c genjt9.f90
redsync.o: redsync.f90 jt9sync.f90
$(FC) $(FFLAGS) -c redsync.f90
unpackmsg.o: unpackmsg.f90
$(FC) -c -O0 -fbounds-check -Wall -Wno-precision-loss unpackmsg.f90
ipcomm.o: ipcomm.cpp
$(CXX) -c $(INCPATH) ipcomm.cpp
sec_midn.o: sec_midn.f90
$(FC) -c -fno-second-underscore sec_midn.f90
#rig_control.o: rig_control.c
# $(CC) -c -Wall -I..\..\..\hamlib-1.2.15.3\include rig_control.c
tstrig.o: tstrig.c
$(CC) -c -Wall -I..\..\..\hamlib-1.2.15.3\include tstrig.c
init_rs.o: init_rs.c
$(CC) -c -DBIGSYM=1 -o init_rs.o init_rs.c
encode_rs.o: encode_rs.c
$(CC) -c -DBIGSYM=1 -o encode_rs.o encode_rs.c
decode_rs.o: decode_rs.c
$(CC) -c -DBIGSYM=1 -o decode_rs.o decode_rs.c
.PHONY : clean
clean:
rm -f *.o libjt9.a wsjtx.exe jt9sim.exe jt9.exe jt65.exe
@@ -0,0 +1,52 @@
// Copyright 2005 Douglas Gregor.
// Use, modification and distribution is subject to the Boost Software
// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
// Message Passing Interface 1.1 -- Section 3. MPI Point-to-point
#ifndef BOOST_MPI_DETAIL_POINT_TO_POINT_HPP
#define BOOST_MPI_DETAIL_POINT_TO_POINT_HPP
// For (de-)serializing sends and receives
#include <boost/mpi/config.hpp>
#include <boost/mpi/packed_oarchive.hpp>
#include <boost/mpi/packed_iarchive.hpp>
namespace boost { namespace mpi { namespace detail {
/** Sends a packed archive using MPI_Send. */
BOOST_MPI_DECL void
packed_archive_send(MPI_Comm comm, int dest, int tag,
const packed_oarchive& ar);
/** Sends a packed archive using MPI_Isend.
*
* This routine may split sends into multiple packets. The MPI_Request
* for each packet will be placed into the out_requests array, up to
* num_out_requests packets. The number of packets sent will be
* returned from the function.
*
* @pre num_out_requests >= 2
*/
BOOST_MPI_DECL int
packed_archive_isend(MPI_Comm comm, int dest, int tag,
const packed_oarchive& ar,
MPI_Request* out_requests, int num_out_requests);
/**
* \overload
*/
BOOST_MPI_DECL int
packed_archive_isend(MPI_Comm comm, int dest, int tag,
const packed_iarchive& ar,
MPI_Request* out_requests, int num_out_requests);
/** Receives a packed archive using MPI_Recv. */
BOOST_MPI_DECL void
packed_archive_recv(MPI_Comm comm, int source, int tag, packed_iarchive& ar,
MPI_Status& status);
} } } // end namespace boost::mpi::detail
#endif // BOOST_MPI_DETAIL_POINT_TO_POINT_HPP
@@ -0,0 +1,24 @@
// 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 CLASS_FWD_DWA200222_HPP
# define CLASS_FWD_DWA200222_HPP
# include <boost/python/detail/prefix.hpp>
# include <boost/python/detail/not_specified.hpp>
namespace boost { namespace python {
template <
class T // class being wrapped
// arbitrarily-ordered optional arguments. Full qualification needed for MSVC6
, class X1 = ::boost::python::detail::not_specified
, class X2 = ::boost::python::detail::not_specified
, class X3 = ::boost::python::detail::not_specified
>
class class_;
}} // namespace boost::python
#endif // CLASS_FWD_DWA200222_HPP
@@ -0,0 +1,30 @@
# /* Copyright (C) 2001
# * Housemarque Oy
# * http://www.housemarque.com
# *
# * Distributed under the Boost Software License, Version 1.0. (See
# * accompanying file LICENSE_1_0.txt or copy at
# * http://www.boost.org/LICENSE_1_0.txt)
# */
#
# /* Revised by Paul Mensonides (2002) */
#
# /* See http://www.boost.org for most recent version. */
#
# ifndef BOOST_PREPROCESSOR_LOGICAL_NOR_HPP
# define BOOST_PREPROCESSOR_LOGICAL_NOR_HPP
#
# include <boost/preprocessor/config/config.hpp>
# include <boost/preprocessor/logical/bool.hpp>
# include <boost/preprocessor/logical/bitnor.hpp>
#
# /* BOOST_PP_NOR */
#
# if ~BOOST_PP_CONFIG_FLAGS() & BOOST_PP_CONFIG_EDG()
# define BOOST_PP_NOR(p, q) BOOST_PP_BITNOR(BOOST_PP_BOOL(p), BOOST_PP_BOOL(q))
# else
# define BOOST_PP_NOR(p, q) BOOST_PP_NOR_I(p, q)
# define BOOST_PP_NOR_I(p, q) BOOST_PP_BITNOR(BOOST_PP_BOOL(p), BOOST_PP_BOOL(q))
# endif
#
# endif
@@ -0,0 +1,138 @@
//---------------------------------------------------------------------------//
// Copyright (c) 2016 Jakub Szuppe <j.szuppe@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_DETAIL_FIND_EXTREMA_ON_CPU_HPP
#define BOOST_COMPUTE_ALGORITHM_DETAIL_FIND_EXTREMA_ON_CPU_HPP
#include <algorithm>
#include <boost/compute/algorithm/detail/find_extrema_with_reduce.hpp>
#include <boost/compute/algorithm/detail/find_extrema_with_atomics.hpp>
#include <boost/compute/algorithm/detail/serial_find_extrema.hpp>
#include <boost/compute/detail/iterator_range_size.hpp>
#include <boost/compute/iterator/buffer_iterator.hpp>
namespace boost {
namespace compute {
namespace detail {
template<class InputIterator, class Compare>
inline InputIterator find_extrema_on_cpu(InputIterator first,
InputIterator last,
Compare compare,
const bool find_minimum,
command_queue &queue)
{
typedef typename std::iterator_traits<InputIterator>::value_type input_type;
typedef typename std::iterator_traits<InputIterator>::difference_type difference_type;
size_t count = iterator_range_size(first, last);
const device &device = queue.get_device();
const uint_ compute_units = queue.get_device().compute_units();
boost::shared_ptr<parameter_cache> parameters =
detail::parameter_cache::get_global_cache(device);
std::string cache_key =
"__boost_find_extrema_cpu_"
+ boost::lexical_cast<std::string>(sizeof(input_type));
// for inputs smaller than serial_find_extrema_threshold
// serial_find_extrema algorithm is used
uint_ serial_find_extrema_threshold = parameters->get(
cache_key,
"serial_find_extrema_threshold",
16384 * sizeof(input_type)
);
serial_find_extrema_threshold =
(std::max)(serial_find_extrema_threshold, uint_(2 * compute_units));
const context &context = queue.get_context();
if(count < serial_find_extrema_threshold) {
return serial_find_extrema(first, last, compare, find_minimum, queue);
}
meta_kernel k("find_extrema_on_cpu");
buffer output(context, sizeof(input_type) * compute_units);
buffer output_idx(
context, sizeof(uint_) * compute_units,
buffer::read_write | buffer::alloc_host_ptr
);
size_t count_arg = k.add_arg<uint_>("count");
size_t output_arg =
k.add_arg<input_type *>(memory_object::global_memory, "output");
size_t output_idx_arg =
k.add_arg<uint_ *>(memory_object::global_memory, "output_idx");
k <<
"uint block = " <<
"(uint)ceil(((float)count)/get_global_size(0));\n" <<
"uint index = get_global_id(0) * block;\n" <<
"uint end = min(count, index + block);\n" <<
"uint value_index = index;\n" <<
k.decl<input_type>("value") << " = " << first[k.var<uint_>("index")] << ";\n" <<
"index++;\n" <<
"while(index < end){\n" <<
k.decl<input_type>("candidate") <<
" = " << first[k.var<uint_>("index")] << ";\n" <<
"#ifndef BOOST_COMPUTE_FIND_MAXIMUM\n" <<
"bool compare = " << compare(k.var<input_type>("candidate"),
k.var<input_type>("value")) << ";\n" <<
"#else\n" <<
"bool compare = " << compare(k.var<input_type>("value"),
k.var<input_type>("candidate")) << ";\n" <<
"#endif\n" <<
"value = compare ? candidate : value;\n" <<
"value_index = compare ? index : value_index;\n" <<
"index++;\n" <<
"}\n" <<
"output[get_global_id(0)] = value;\n" <<
"output_idx[get_global_id(0)] = value_index;\n";
size_t global_work_size = compute_units;
std::string options;
if(!find_minimum){
options = "-DBOOST_COMPUTE_FIND_MAXIMUM";
}
kernel kernel = k.compile(context, options);
kernel.set_arg(count_arg, static_cast<uint_>(count));
kernel.set_arg(output_arg, output);
kernel.set_arg(output_idx_arg, output_idx);
queue.enqueue_1d_range_kernel(kernel, 0, global_work_size, 0);
buffer_iterator<input_type> result = serial_find_extrema(
make_buffer_iterator<input_type>(output),
make_buffer_iterator<input_type>(output, global_work_size),
compare,
find_minimum,
queue
);
uint_* output_idx_host_ptr =
static_cast<uint_*>(
queue.enqueue_map_buffer(
output_idx, command_queue::map_read,
0, global_work_size * sizeof(uint_)
)
);
difference_type extremum_idx =
static_cast<difference_type>(*(output_idx_host_ptr + result.get_index()));
return first + extremum_idx;
}
} // end detail namespace
} // end compute namespace
} // end boost namespace
#endif // BOOST_COMPUTE_ALGORITHM_DETAIL_FIND_EXTREMA_ON_CPU_HPP
@@ -0,0 +1,97 @@
///////////////////////////////////////////////////////////////////////////////
/// \file null_eval.hpp
/// Contains specializations of the null_eval\<\> class template.
//
// Copyright 2008 Eric Niebler. Distributed under the Boost
// Software License, Version 1.0. (See accompanying file
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
template<typename Expr, typename Context>
struct null_eval<Expr, Context, 1>
{
typedef void result_type;
void operator ()(Expr &expr, Context &ctx) const
{
proto::eval(proto::child_c< 0>(expr), ctx);
}
};
template<typename Expr, typename Context>
struct null_eval<Expr, Context, 2>
{
typedef void result_type;
void operator ()(Expr &expr, Context &ctx) const
{
proto::eval(proto::child_c< 0>(expr), ctx); proto::eval(proto::child_c< 1>(expr), ctx);
}
};
template<typename Expr, typename Context>
struct null_eval<Expr, Context, 3>
{
typedef void result_type;
void operator ()(Expr &expr, Context &ctx) const
{
proto::eval(proto::child_c< 0>(expr), ctx); proto::eval(proto::child_c< 1>(expr), ctx); proto::eval(proto::child_c< 2>(expr), ctx);
}
};
template<typename Expr, typename Context>
struct null_eval<Expr, Context, 4>
{
typedef void result_type;
void operator ()(Expr &expr, Context &ctx) const
{
proto::eval(proto::child_c< 0>(expr), ctx); proto::eval(proto::child_c< 1>(expr), ctx); proto::eval(proto::child_c< 2>(expr), ctx); proto::eval(proto::child_c< 3>(expr), ctx);
}
};
template<typename Expr, typename Context>
struct null_eval<Expr, Context, 5>
{
typedef void result_type;
void operator ()(Expr &expr, Context &ctx) const
{
proto::eval(proto::child_c< 0>(expr), ctx); proto::eval(proto::child_c< 1>(expr), ctx); proto::eval(proto::child_c< 2>(expr), ctx); proto::eval(proto::child_c< 3>(expr), ctx); proto::eval(proto::child_c< 4>(expr), ctx);
}
};
template<typename Expr, typename Context>
struct null_eval<Expr, Context, 6>
{
typedef void result_type;
void operator ()(Expr &expr, Context &ctx) const
{
proto::eval(proto::child_c< 0>(expr), ctx); proto::eval(proto::child_c< 1>(expr), ctx); proto::eval(proto::child_c< 2>(expr), ctx); proto::eval(proto::child_c< 3>(expr), ctx); proto::eval(proto::child_c< 4>(expr), ctx); proto::eval(proto::child_c< 5>(expr), ctx);
}
};
template<typename Expr, typename Context>
struct null_eval<Expr, Context, 7>
{
typedef void result_type;
void operator ()(Expr &expr, Context &ctx) const
{
proto::eval(proto::child_c< 0>(expr), ctx); proto::eval(proto::child_c< 1>(expr), ctx); proto::eval(proto::child_c< 2>(expr), ctx); proto::eval(proto::child_c< 3>(expr), ctx); proto::eval(proto::child_c< 4>(expr), ctx); proto::eval(proto::child_c< 5>(expr), ctx); proto::eval(proto::child_c< 6>(expr), ctx);
}
};
template<typename Expr, typename Context>
struct null_eval<Expr, Context, 8>
{
typedef void result_type;
void operator ()(Expr &expr, Context &ctx) const
{
proto::eval(proto::child_c< 0>(expr), ctx); proto::eval(proto::child_c< 1>(expr), ctx); proto::eval(proto::child_c< 2>(expr), ctx); proto::eval(proto::child_c< 3>(expr), ctx); proto::eval(proto::child_c< 4>(expr), ctx); proto::eval(proto::child_c< 5>(expr), ctx); proto::eval(proto::child_c< 6>(expr), ctx); proto::eval(proto::child_c< 7>(expr), ctx);
}
};
template<typename Expr, typename Context>
struct null_eval<Expr, Context, 9>
{
typedef void result_type;
void operator ()(Expr &expr, Context &ctx) const
{
proto::eval(proto::child_c< 0>(expr), ctx); proto::eval(proto::child_c< 1>(expr), ctx); proto::eval(proto::child_c< 2>(expr), ctx); proto::eval(proto::child_c< 3>(expr), ctx); proto::eval(proto::child_c< 4>(expr), ctx); proto::eval(proto::child_c< 5>(expr), ctx); proto::eval(proto::child_c< 6>(expr), ctx); proto::eval(proto::child_c< 7>(expr), ctx); proto::eval(proto::child_c< 8>(expr), ctx);
}
};
template<typename Expr, typename Context>
struct null_eval<Expr, Context, 10>
{
typedef void result_type;
void operator ()(Expr &expr, Context &ctx) const
{
proto::eval(proto::child_c< 0>(expr), ctx); proto::eval(proto::child_c< 1>(expr), ctx); proto::eval(proto::child_c< 2>(expr), ctx); proto::eval(proto::child_c< 3>(expr), ctx); proto::eval(proto::child_c< 4>(expr), ctx); proto::eval(proto::child_c< 5>(expr), ctx); proto::eval(proto::child_c< 6>(expr), ctx); proto::eval(proto::child_c< 7>(expr), ctx); proto::eval(proto::child_c< 8>(expr), ctx); proto::eval(proto::child_c< 9>(expr), ctx);
}
};
@@ -0,0 +1,36 @@
subroutine genfsk4(id,f00,nts,c)
parameter (ND=60) !Data symbols: LDPC (120,60), r=1/2
parameter (NN=ND) !Total symbols (60)
parameter (NSPS=57600) !Samples per symbol at 12000 sps
parameter (NZ=NSPS*NN) !Samples in waveform (3456000)
parameter (NFFT=NZ) !Full length FFT
complex c(0:NFFT-1) !Complex waveform
real*8 twopi,dt,fs,baud,f0,dphi,phi
integer id(NN) !Encoded 2-bit data (values 0-3)
f0=f00
twopi=8.d0*atan(1.d0)
fs=12000.d0
dt=1.0/fs
baud=1.d0/(NSPS*dt)
! Generate the 4-FSK waveform
x=0.
c=0.
phi=0.d0
k=-1
do j=1,NN
dphi=twopi*(f0 + nts*id(j)*baud)*dt
do i=1,NSPS
k=k+1
phi=phi+dphi
if(phi.gt.twopi) phi=phi-twopi
xphi=phi
c(k)=cmplx(cos(xphi),sin(xphi))
enddo
enddo
return
end subroutine genfsk4
@@ -0,0 +1,301 @@
// Copyright Paul A. Bristow 2007.
// 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_STATS_rayleigh_HPP
#define BOOST_STATS_rayleigh_HPP
#include <boost/math/distributions/fwd.hpp>
#include <boost/math/constants/constants.hpp>
#include <boost/math/special_functions/log1p.hpp>
#include <boost/math/special_functions/expm1.hpp>
#include <boost/math/distributions/complement.hpp>
#include <boost/math/distributions/detail/common_error_handling.hpp>
#include <boost/config/no_tr1/cmath.hpp>
#ifdef BOOST_MSVC
# pragma warning(push)
# pragma warning(disable: 4702) // unreachable code (return after domain_error throw).
#endif
#include <utility>
namespace boost{ namespace math{
namespace detail
{ // Error checks:
template <class RealType, class Policy>
inline bool verify_sigma(const char* function, RealType sigma, RealType* presult, const Policy& pol)
{
if((sigma <= 0) || (!(boost::math::isfinite)(sigma)))
{
*presult = policies::raise_domain_error<RealType>(
function,
"The scale parameter \"sigma\" must be > 0 and finite, but was: %1%.", sigma, pol);
return false;
}
return true;
} // bool verify_sigma
template <class RealType, class Policy>
inline bool verify_rayleigh_x(const char* function, RealType x, RealType* presult, const Policy& pol)
{
if((x < 0) || (boost::math::isnan)(x))
{
*presult = policies::raise_domain_error<RealType>(
function,
"The random variable must be >= 0, but was: %1%.", x, pol);
return false;
}
return true;
} // bool verify_rayleigh_x
} // namespace detail
template <class RealType = double, class Policy = policies::policy<> >
class rayleigh_distribution
{
public:
typedef RealType value_type;
typedef Policy policy_type;
rayleigh_distribution(RealType l_sigma = 1)
: m_sigma(l_sigma)
{
RealType err;
detail::verify_sigma("boost::math::rayleigh_distribution<%1%>::rayleigh_distribution", l_sigma, &err, Policy());
} // rayleigh_distribution
RealType sigma()const
{ // Accessor.
return m_sigma;
}
private:
RealType m_sigma;
}; // class rayleigh_distribution
typedef rayleigh_distribution<double> rayleigh;
template <class RealType, class Policy>
inline const std::pair<RealType, RealType> range(const rayleigh_distribution<RealType, Policy>& /*dist*/)
{ // Range of permissible values for random variable x.
using boost::math::tools::max_value;
return std::pair<RealType, RealType>(static_cast<RealType>(0), std::numeric_limits<RealType>::has_infinity ? std::numeric_limits<RealType>::infinity() : max_value<RealType>());
}
template <class RealType, class Policy>
inline const std::pair<RealType, RealType> support(const rayleigh_distribution<RealType, Policy>& /*dist*/)
{ // Range of supported values for random variable x.
// This is range where cdf rises from 0 to 1, and outside it, the pdf is zero.
using boost::math::tools::max_value;
return std::pair<RealType, RealType>(static_cast<RealType>(0), max_value<RealType>());
}
template <class RealType, class Policy>
inline RealType pdf(const rayleigh_distribution<RealType, Policy>& dist, const RealType& x)
{
BOOST_MATH_STD_USING // for ADL of std function exp.
RealType sigma = dist.sigma();
RealType result = 0;
static const char* function = "boost::math::pdf(const rayleigh_distribution<%1%>&, %1%)";
if(false == detail::verify_sigma(function, sigma, &result, Policy()))
{
return result;
}
if(false == detail::verify_rayleigh_x(function, x, &result, Policy()))
{
return result;
}
if((boost::math::isinf)(x))
{
return 0;
}
RealType sigmasqr = sigma * sigma;
result = x * (exp(-(x * x) / ( 2 * sigmasqr))) / sigmasqr;
return result;
} // pdf
template <class RealType, class Policy>
inline RealType cdf(const rayleigh_distribution<RealType, Policy>& dist, const RealType& x)
{
BOOST_MATH_STD_USING // for ADL of std functions
RealType result = 0;
RealType sigma = dist.sigma();
static const char* function = "boost::math::cdf(const rayleigh_distribution<%1%>&, %1%)";
if(false == detail::verify_sigma(function, sigma, &result, Policy()))
{
return result;
}
if(false == detail::verify_rayleigh_x(function, x, &result, Policy()))
{
return result;
}
result = -boost::math::expm1(-x * x / ( 2 * sigma * sigma), Policy());
return result;
} // cdf
template <class RealType, class Policy>
inline RealType quantile(const rayleigh_distribution<RealType, Policy>& dist, const RealType& p)
{
BOOST_MATH_STD_USING // for ADL of std functions
RealType result = 0;
RealType sigma = dist.sigma();
static const char* function = "boost::math::quantile(const rayleigh_distribution<%1%>&, %1%)";
if(false == detail::verify_sigma(function, sigma, &result, Policy()))
return result;
if(false == detail::check_probability(function, p, &result, Policy()))
return result;
if(p == 0)
{
return 0;
}
if(p == 1)
{
return policies::raise_overflow_error<RealType>(function, 0, Policy());
}
result = sqrt(-2 * sigma * sigma * boost::math::log1p(-p, Policy()));
return result;
} // quantile
template <class RealType, class Policy>
inline RealType cdf(const complemented2_type<rayleigh_distribution<RealType, Policy>, RealType>& c)
{
BOOST_MATH_STD_USING // for ADL of std functions
RealType result = 0;
RealType sigma = c.dist.sigma();
static const char* function = "boost::math::cdf(const rayleigh_distribution<%1%>&, %1%)";
if(false == detail::verify_sigma(function, sigma, &result, Policy()))
{
return result;
}
RealType x = c.param;
if(false == detail::verify_rayleigh_x(function, x, &result, Policy()))
{
return result;
}
RealType ea = x * x / (2 * sigma * sigma);
// Fix for VC11/12 x64 bug in exp(float):
if (ea >= tools::max_value<RealType>())
return 0;
result = exp(-ea);
return result;
} // cdf complement
template <class RealType, class Policy>
inline RealType quantile(const complemented2_type<rayleigh_distribution<RealType, Policy>, RealType>& c)
{
BOOST_MATH_STD_USING // for ADL of std functions, log & sqrt.
RealType result = 0;
RealType sigma = c.dist.sigma();
static const char* function = "boost::math::quantile(const rayleigh_distribution<%1%>&, %1%)";
if(false == detail::verify_sigma(function, sigma, &result, Policy()))
{
return result;
}
RealType q = c.param;
if(false == detail::check_probability(function, q, &result, Policy()))
{
return result;
}
if(q == 1)
{
return 0;
}
if(q == 0)
{
return policies::raise_overflow_error<RealType>(function, 0, Policy());
}
result = sqrt(-2 * sigma * sigma * log(q));
return result;
} // quantile complement
template <class RealType, class Policy>
inline RealType mean(const rayleigh_distribution<RealType, Policy>& dist)
{
RealType result = 0;
RealType sigma = dist.sigma();
static const char* function = "boost::math::mean(const rayleigh_distribution<%1%>&, %1%)";
if(false == detail::verify_sigma(function, sigma, &result, Policy()))
{
return result;
}
using boost::math::constants::root_half_pi;
return sigma * root_half_pi<RealType>();
} // mean
template <class RealType, class Policy>
inline RealType variance(const rayleigh_distribution<RealType, Policy>& dist)
{
RealType result = 0;
RealType sigma = dist.sigma();
static const char* function = "boost::math::variance(const rayleigh_distribution<%1%>&, %1%)";
if(false == detail::verify_sigma(function, sigma, &result, Policy()))
{
return result;
}
using boost::math::constants::four_minus_pi;
return four_minus_pi<RealType>() * sigma * sigma / 2;
} // variance
template <class RealType, class Policy>
inline RealType mode(const rayleigh_distribution<RealType, Policy>& dist)
{
return dist.sigma();
}
template <class RealType, class Policy>
inline RealType median(const rayleigh_distribution<RealType, Policy>& dist)
{
using boost::math::constants::root_ln_four;
return root_ln_four<RealType>() * dist.sigma();
}
template <class RealType, class Policy>
inline RealType skewness(const rayleigh_distribution<RealType, Policy>& /*dist*/)
{
// using namespace boost::math::constants;
return static_cast<RealType>(0.63111065781893713819189935154422777984404221106391L);
// Computed using NTL at 150 bit, about 50 decimal digits.
// return 2 * root_pi<RealType>() * pi_minus_three<RealType>() / pow23_four_minus_pi<RealType>();
}
template <class RealType, class Policy>
inline RealType kurtosis(const rayleigh_distribution<RealType, Policy>& /*dist*/)
{
// using namespace boost::math::constants;
return static_cast<RealType>(3.2450893006876380628486604106197544154170667057995L);
// Computed using NTL at 150 bit, about 50 decimal digits.
// return 3 - (6 * pi<RealType>() * pi<RealType>() - 24 * pi<RealType>() + 16) /
// (four_minus_pi<RealType>() * four_minus_pi<RealType>());
}
template <class RealType, class Policy>
inline RealType kurtosis_excess(const rayleigh_distribution<RealType, Policy>& /*dist*/)
{
//using namespace boost::math::constants;
// Computed using NTL at 150 bit, about 50 decimal digits.
return static_cast<RealType>(0.2450893006876380628486604106197544154170667057995L);
// return -(6 * pi<RealType>() * pi<RealType>() - 24 * pi<RealType>() + 16) /
// (four_minus_pi<RealType>() * four_minus_pi<RealType>());
} // kurtosis
} // namespace math
} // namespace boost
#ifdef BOOST_MSVC
# pragma warning(pop)
#endif
// This include must be at the end, *after* the accessors
// for this distribution have been defined, in order to
// keep compilers that support two-phase lookup happy.
#include <boost/math/distributions/detail/derived_accessors.hpp>
#endif // BOOST_STATS_rayleigh_HPP
@@ -0,0 +1,153 @@
# Makefile for MinGW on Windows
#
# Needed libraries are located using the following variables:
#
# QT_DIR - point this at the root of your Qt installation
# FFTW3_DIR - point this at the fftw v3 installation directory
#
# e.g.
# make -f Makefile.MinGW \
# QT_DIR=c:/Qt/5.2.1/mingw48_32 \
# FFTW3_DIR = c:/fftw-3.3.3-dll32-2
#
# Windows re-direct:
# C> make > junk1 2>&1
# Set paths
EXE_DIR = ..\\..\\wsjtx_install
QT_DIR = C:/wsjt-env/Qt5/5.2.1/mingw48_32
FFTW3_DIR = ..
INCPATH = -I${QT_DIR}/include/QtCore -I${QT_DIR}/include
# Compilers
CC = gcc
CXX = g++
FC = gfortran
AR = ar cr
RANLIB = ranlib
MKDIR = mkdir -p
CP = cp
RM = rm -f
FFLAGS = -O2 -fbounds-check -Wall -Wno-precision-loss -fno-second-underscore
CFLAGS = -I. -fbounds-check -mno-stack-arg-probe
# Default rules
%.o: %.c
${CC} ${CFLAGS} -c $<
%.o: %.f
${FC} ${FFLAGS} -c $<
%.o: %.F
${FC} ${FFLAGS} -c $<
%.o: %.f90
${FC} ${FFLAGS} -c $<
%.o: %.F90
${FC} ${FFLAGS} -c $<
all: libjt9.a libastro.a jt9.exe jt9code.exe jt65code.exe
OBJS1 = prog_args.o options.o pctile.o graycode.o sort.o ssort.o chkmsg.o \
unpackmsg.o igray.o unpackcall.o unpackgrid.o \
fmtmsg.o grid2k.o unpacktext.o getpfx2.o packmsg.o deg2grid.o \
packtext.o getpfx1.o packcall.o k2grid.o packgrid.o \
nchar.o four2a.o grid2deg.o pfxdump.o f77_wisdom.o \
symspec.o analytic.o db.o genjt9.o flat1.o smo.o \
packbits.o unpackbits.o encode232.o interleave9.o \
entail.o fano232.o gran.o sync9.o decode9.o \
fil3.o decoder.o grid2n.o n2grid.o timer.o \
softsym.o getlags.o afc9.o fchisq.o twkfreq.o downsam9.o \
peakdt9.o symspec2.o stdmsg.o morse.o azdist.o geodist.o \
fillcom.o chkss2.o zplot9.o flat2.o \
jt65a.o symspec65.o flat65.o ccf65.o decode65a.o \
filbig.o fil6521.o afc65b.o decode65b.o setup65.o \
extract.o fchisq65.o demod64a.o chkhist.o interleave63.o ccf2.o \
move.o indexx.o graycode65.o twkfreq65.o smo121.o \
wrapkarn.o init_rs.o encode_rs.o decode_rs.o gen65.o fil4.o \
flat3.o polfit.o determ.o baddata.o
libjt9.a: $(OBJS1)
$(AR) libjt9.a $(OBJS1)
$(RANLIB) libjt9.a
OBJS2 = jt9.o jt9a.o jt9b.o jt9c.o ipcomm.o sec_midn.o usleep.o
LIBS2 = -L${QT_DIR}/lib -lQt5Core
jt9.exe: $(OBJS2) libjt9.a
$(CXX) -o jt9.exe $(OBJS2) $(LIBS2) libjt9.a \
-L$(FFTW3_DIR) -lfftw3f-3 $(shell $(FC) -print-file-name=lib$(FC).a)
-$(MKDIR) $(EXE_DIR)
$(CP) jt9.exe $(EXE_DIR)
OBJS3 = jt9sim.o
jt9sim.exe: $(OBJS3) libjt9.a
$(FC) -o jt9sim.exe $(OBJS3) libjt9.a
OBJS4 = jt9code.o
jt9code.exe: $(OBJS4) libjt9.a
$(FC) -o jt9code.exe $(OBJS4) libjt9.a
$(CP) jt9code.exe $(EXE_DIR)
OBJS5 = jt65.o
jt65.exe: $(OBJS5) libjt9.a
$(FC) -o jt65.exe $(OBJS5) libjt9.a -L$(FFTW3_DIR) -lfftw3f-3
OBJS7 = astrosub.o astro0.o astro.o tm2.o grid2deg.o sun.o moondop.o \
coord.o dot.o moon2.o tmoonsub.o toxyz.o geocentric.o \
dcoord.o
libastro.a: $(OBJS7)
$(AR) libastro.a $(OBJS7)
$(RANLIB) libastro.a
OBJS6 = jt65code.o
jt65code.exe: $(OBJS6) libjt9.a
$(FC) -o jt65code.exe $(OBJS6) libjt9.a
$(CP) jt65code.exe $(EXE_DIR)
sync9.o: sync9.f90 jt9sync.f90
$(FC) $(FFLAGS) -c sync9.f90
spec9.o: spec9.f90 jt9sync.f90
$(FC) $(FFLAGS) -c spec9.f90
peakdt9.o: peakdt9.f90 jt9sync.f90
$(FC) $(FFLAGS) -c peakdt9.f90
jt9sim.o: jt9sim.f90 jt9sync.f90
$(FC) $(FFLAGS) -c jt9sim.f90
genjt9.o: genjt9.f90 jt9sync.f90
$(FC) $(FFLAGS) -c genjt9.f90
redsync.o: redsync.f90 jt9sync.f90
$(FC) $(FFLAGS) -c redsync.f90
unpackmsg.o: unpackmsg.f90
$(FC) -c -O0 -fbounds-check -Wall -Wno-precision-loss unpackmsg.f90
ipcomm.o: ipcomm.cpp
$(CXX) -c $(INCPATH) ipcomm.cpp
sec_midn.o: sec_midn.f90
$(FC) -c -fno-second-underscore sec_midn.f90
#rig_control.o: rig_control.c
# $(CC) -c -Wall -I..\..\..\hamlib-1.2.15.3\include rig_control.c
tstrig.o: tstrig.c
$(CC) -c -Wall -I..\..\..\hamlib-1.2.15.3\include tstrig.c
init_rs.o: init_rs.c
$(CC) -c -DBIGSYM=1 -o init_rs.o init_rs.c
encode_rs.o: encode_rs.c
$(CC) -c -DBIGSYM=1 -o encode_rs.o encode_rs.c
decode_rs.o: decode_rs.c
$(CC) -c -DBIGSYM=1 -o decode_rs.o decode_rs.c
.PHONY : clean
clean:
$(RM) *.o libjt9.a wsjtx.exe jt9sim.exe jt9.exe jt65.exe
@@ -0,0 +1,39 @@
#include "Transceiver.hpp"
#include "moc_Transceiver.cpp"
#if !defined (QT_NO_DEBUG_STREAM)
ENUM_QDEBUG_OPS_IMPL (Transceiver, MODE);
QDebug operator << (QDebug d, Transceiver::TransceiverState const& s)
{
d.nospace ()
<< "Transceiver::TransceiverState(online: " << (s.online_ ? "yes" : "no")
<< " Frequency {" << s.rx_frequency_ << "Hz, " << s.tx_frequency_ << "Hz} " << s.mode_
<< "; SPLIT: " << (Transceiver::TransceiverState::Split::on == s.split_ ? "on" : Transceiver::TransceiverState::Split::off == s.split_ ? "off" : "unknown")
<< "; PTT: " << (s.ptt_ ? "on" : "off")
<< ')';
return d.space ();
}
#endif
ENUM_QDATASTREAM_OPS_IMPL (Transceiver, MODE);
ENUM_CONVERSION_OPS_IMPL (Transceiver, MODE);
bool operator != (Transceiver::TransceiverState const& lhs, Transceiver::TransceiverState const& rhs)
{
return lhs.online_ != rhs.online_
|| lhs.rx_frequency_ != rhs.rx_frequency_
|| lhs.tx_frequency_ != rhs.tx_frequency_
|| lhs.mode_ != rhs.mode_
|| lhs.split_ != rhs.split_
|| lhs.ptt_ != rhs.ptt_;
}
bool operator == (Transceiver::TransceiverState const& lhs, Transceiver::TransceiverState const& rhs)
{
return !(lhs != rhs);
}
@@ -0,0 +1,49 @@
// (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_EQUAL_TO_HPP_INCLUDED
#define BOOST_TT_HAS_EQUAL_TO_HPP_INCLUDED
#define BOOST_TT_TRAIT_NAME has_equal_to
#define BOOST_TT_TRAIT_OP ==
#define BOOST_TT_FORBIDDEN_IF\
(\
/* Lhs==pointer and Rhs==fundamental */\
(\
::boost::is_pointer< Lhs_noref >::value && \
::boost::is_fundamental< Rhs_nocv >::value\
) || \
/* Rhs==pointer and Lhs==fundamental */\
(\
::boost::is_pointer< Rhs_noref >::value && \
::boost::is_fundamental< Lhs_nocv >::value\
) || \
/* Lhs==pointer and Rhs==pointer and Lhs!=base(Rhs) and Rhs!=base(Lhs) and Lhs!=void* and Rhs!=void* */\
(\
::boost::is_pointer< Lhs_noref >::value && \
::boost::is_pointer< Rhs_noref >::value && \
(! \
(\
::boost::is_base_of< Lhs_noptr, Rhs_noptr >::value || \
::boost::is_base_of< Rhs_noptr, Lhs_noptr >::value || \
::boost::is_same< Lhs_noptr, Rhs_noptr >::value || \
::boost::is_void< Lhs_noptr >::value || \
::boost::is_void< Rhs_noptr >::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,120 @@
// Boost string_algo library sequence_traits.hpp header file ---------------------------//
// Copyright Pavol Droba 2002-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)
// See http://www.boost.org/ for updates, documentation, and revision history.
#ifndef BOOST_STRING_SEQUENCE_TRAITS_HPP
#define BOOST_STRING_SEQUENCE_TRAITS_HPP
#include <boost/config.hpp>
#include <boost/mpl/bool.hpp>
#include <boost/algorithm/string/yes_no_type.hpp>
/*! \file
Traits defined in this header are used by various algorithms to achieve
better performance for specific containers.
Traits provide fail-safe defaults. If a container supports some of these
features, it is possible to specialize the specific trait for this container.
For lacking compilers, it is possible of define an override for a specific tester
function.
Due to a language restriction, it is not currently possible to define specializations for
stl containers without including the corresponding header. To decrease the overhead
needed by this inclusion, user can selectively include a specialization
header for a specific container. They are located in boost/algorithm/string/stl
directory. Alternatively she can include boost/algorithm/string/std_collection_traits.hpp
header which contains specializations for all stl containers.
*/
namespace boost {
namespace algorithm {
// sequence traits -----------------------------------------------//
//! Native replace trait
/*!
This trait specifies that the sequence has \c std::string like replace method
*/
template< typename T >
class has_native_replace
{
public:
# if BOOST_WORKAROUND( __IBMCPP__, <= 600 )
enum { value = false };
# else
BOOST_STATIC_CONSTANT(bool, value=false);
# endif // BOOST_WORKAROUND( __IBMCPP__, <= 600 )
typedef mpl::bool_<has_native_replace<T>::value> type;
};
//! Stable iterators trait
/*!
This trait specifies that the sequence has stable iterators. It means
that operations like insert/erase/replace do not invalidate iterators.
*/
template< typename T >
class has_stable_iterators
{
public:
# if BOOST_WORKAROUND( __IBMCPP__, <= 600 )
enum { value = false };
# else
BOOST_STATIC_CONSTANT(bool, value=false);
# endif // BOOST_WORKAROUND( __IBMCPP__, <= 600 )
typedef mpl::bool_<has_stable_iterators<T>::value> type;
};
//! Const time insert trait
/*!
This trait specifies that the sequence's insert method has
constant time complexity.
*/
template< typename T >
class has_const_time_insert
{
public:
# if BOOST_WORKAROUND( __IBMCPP__, <= 600 )
enum { value = false };
# else
BOOST_STATIC_CONSTANT(bool, value=false);
# endif // BOOST_WORKAROUND( __IBMCPP__, <= 600 )
typedef mpl::bool_<has_const_time_insert<T>::value> type;
};
//! Const time erase trait
/*!
This trait specifies that the sequence's erase method has
constant time complexity.
*/
template< typename T >
class has_const_time_erase
{
public:
# if BOOST_WORKAROUND( __IBMCPP__, <= 600 )
enum { value = false };
# else
BOOST_STATIC_CONSTANT(bool, value=false);
# endif // BOOST_WORKAROUND( __IBMCPP__, <= 600 )
typedef mpl::bool_<has_const_time_erase<T>::value> type;
};
} // namespace algorithm
} // namespace boost
#endif // BOOST_STRING_SEQUENCE_TRAITS_HPP
@@ -0,0 +1,175 @@
program ldpcsim
use, intrinsic :: iso_c_binding
use iso_c_binding, only: c_loc,c_size_t
use hashing
use packjt
parameter(NRECENT=10)
character*12 recent_calls(NRECENT)
character*22 msg,msgsent,msgreceived
character*8 arg
integer*1, allocatable :: codeword(:), decoded(:), message(:)
integer*1, target:: i1Msg8BitBytes(10)
integer*1 i1hash(4)
integer*1 msgbits(80)
integer*4 i4Msg6BitWords(13)
integer ihash
integer nerrtot(128),nerrdec(128)
real*8, allocatable :: lratio(:), rxdata(:), rxavgd(:)
real, allocatable :: yy(:), llr(:)
equivalence(ihash,i1hash)
do i=1,NRECENT
recent_calls(i)=' '
enddo
nerrtot=0
nerrdec=0
nargs=iargc()
if(nargs.ne.4) then
print*,'Usage: ldpcsim niter navg #trials s '
print*,'eg: ldpcsim 10 1 1000 0.75'
return
endif
call getarg(1,arg)
read(arg,*) max_iterations
call getarg(2,arg)
read(arg,*) navg
call getarg(3,arg)
read(arg,*) ntrials
call getarg(4,arg)
read(arg,*) s
! don't count hash bits as data bits
N=128
K=72
rate=real(K)/real(N)
write(*,*) "rate: ",rate
write(*,*) "niter= ",max_iterations," navg= ",navg," s= ",s
allocate ( codeword(N), decoded(K), message(K) )
allocate ( lratio(N), rxdata(N), rxavgd(N), yy(N), llr(N) )
msg="K9AN K1JT EN50"
call packmsg(msg,i4Msg6BitWords,itype,.false.) !Pack into 12 6-bit bytes
call unpackmsg(i4Msg6BitWords,msgsent,.false.,' ') !Unpack to get msgsent
write(*,*) "message sent ",msgsent
i4=0
ik=0
im=0
do i=1,12
nn=i4Msg6BitWords(i)
do j=1, 6
ik=ik+1
i4=i4+i4+iand(1,ishft(nn,j-6))
i4=iand(i4,255)
if(ik.eq.8) then
im=im+1
! if(i4.gt.127) i4=i4-256
i1Msg8BitBytes(im)=i4
ik=0
endif
enddo
enddo
ihash=nhash(c_loc(i1Msg8BitBytes),int(9,c_size_t),146)
ihash=2*iand(ihash,32767) !Generate the 8-bit hash
i1Msg8BitBytes(10)=i1hash(1) !CRC to byte 10
mbit=0
do i=1, 10
i1=i1Msg8BitBytes(i)
do ibit=1,8
mbit=mbit+1
msgbits(mbit)=iand(1,ishft(i1,ibit-8))
enddo
enddo
call encode_msk144(msgbits,codeword)
call init_random_seed()
write(*,*) "Eb/N0 SNR2500 ngood nundetected nbadhash sigma"
do idb = -6, 14
db=idb/2.0-1.0
sigma=1/sqrt( 2*rate*(10**(db/10.0)) )
ngood=0
nue=0
nbadhash=0
do itrial=1, ntrials
rxavgd=0d0
do iav=1,navg
call sgran()
! Create a realization of a noisy received word
do i=1,N
rxdata(i) = 2.0*codeword(i)-1.0 + sigma*gran()
enddo
rxavgd=rxavgd+rxdata
enddo
rxdata=rxavgd
nerr=0
do i=1,N
if( rxdata(i)*(2*codeword(i)-1.0) .lt. 0 ) nerr=nerr+1
enddo
nerrtot(nerr)=nerrtot(nerr)+1
! Correct signal normalization is important for this decoder.
rxav=sum(rxdata)/N
rx2av=sum(rxdata*rxdata)/N
rxsig=sqrt(rx2av-rxav*rxav)
rxdata=rxdata/rxsig
! To match the metric to the channel, s should be set to the noise standard deviation.
! For now, set s to the value that optimizes decode probability near threshold.
! The s parameter can be tuned to trade a few tenth's dB of threshold for an order of
! magnitude in UER
if( s .lt. 0 ) then
ss=sigma
else
ss=s
endif
llr=2.0*rxdata/(ss*ss)
lratio=exp(llr)
yy=rxdata
! max_iterations is max number of belief propagation iterations
! call ldpc_decode(lratio, decoded, max_iterations, niterations, max_dither, ndither)
! call amsdecode(yy, max_iterations, decoded, niterations)
! call bitflipmsk144(rxdata, decoded, niterations)
call bpdecode144(llr, max_iterations, decoded, niterations)
! If the decoder finds a valid codeword, niterations will be .ge. 0.
if( niterations .ge. 0 ) then
call extractmessage144(decoded,msgreceived,nhashflag,recent_calls,nrecent)
if( nhashflag .ne. 1 ) then
nbadhash=nbadhash+1
endif
nueflag=0
! Check the message plus hash against what was sent.
do i=1,K
if( msgbits(i) .ne. decoded(i) ) then
nueflag=1
endif
enddo
if( nhashflag .eq. 1 .and. nueflag .eq. 0 ) then
ngood=ngood+1
nerrdec(nerr)=nerrdec(nerr)+1
else if( nhashflag .eq. 1 .and. nueflag .eq. 1 ) then
nue=nue+1;
endif
endif
enddo
snr2500=db-3.5
write(*,"(f4.1,4x,f5.1,1x,i8,1x,i8,1x,i8,8x,f5.2)") db,snr2500,ngood,nue,nbadhash,ss
enddo
open(unit=23,file='nerrhisto.dat',status='unknown')
do i=1,128
write(23,'(i4,2x,i10,i10,f10.2)') i,nerrdec(i),nerrtot(i),real(nerrdec(i))/real(nerrtot(i)+1e-10)
enddo
close(23)
end program ldpcsim
@@ -0,0 +1,51 @@
/*=============================================================================
Copyright (c) 2001-2011 Joel de Guzman
Copyright (c) 2005 Eric Niebler
Distributed under the Boost Software License, Version 1.0. (See accompanying
file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
==============================================================================*/
#if !defined(FUSION_BEGIN_IMPL_07172005_0824)
#define FUSION_BEGIN_IMPL_07172005_0824
#include <boost/fusion/support/config.hpp>
#include <boost/mpl/if.hpp>
#include <boost/type_traits/is_const.hpp>
namespace boost { namespace fusion
{
struct nil_;
struct cons_tag;
template <typename Car, typename Cdr>
struct cons;
template <typename Cons>
struct cons_iterator;
namespace extension
{
template <typename Tag>
struct begin_impl;
template <>
struct begin_impl<cons_tag>
{
template <typename Sequence>
struct apply
{
typedef cons_iterator<Sequence> type;
BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
static type
call(Sequence& t)
{
return type(t);
}
};
};
}
}}
#endif
@@ -0,0 +1,26 @@
#ifndef BOOST_MPL_VOID_FWD_HPP_INCLUDED
#define BOOST_MPL_VOID_FWD_HPP_INCLUDED
// Copyright Aleksey Gurtovoy 2001-2004
//
// Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
//
// See http://www.boost.org/libs/mpl for documentation.
// $Id$
// $Date$
// $Revision$
#include <boost/mpl/aux_/adl_barrier.hpp>
BOOST_MPL_AUX_ADL_BARRIER_NAMESPACE_OPEN
struct void_;
BOOST_MPL_AUX_ADL_BARRIER_NAMESPACE_CLOSE
BOOST_MPL_AUX_ADL_BARRIER_DECL(void_)
#endif // BOOST_MPL_VOID_FWD_HPP_INCLUDED
@@ -0,0 +1,61 @@
program ft8d
! Decode FT8 data read from *.wav files.
include 'ft8_params.f90'
character*12 arg
character infile*80,datetime*13,message*22
real s(NH1,NHSYM)
real candidate(3,100)
integer ihdr(11)
integer*2 iwave(NMAX) !Generated full-length waveform
real dd(NMAX)
nargs=iargc()
if(nargs.lt.3) then
print*,'Usage: ft8d MaxIt Norder file1 [file2 ...]'
print*,'Example ft8d 40 2 *.wav'
go to 999
endif
call getarg(1,arg)
read(arg,*) max_iterations
call getarg(2,arg)
read(arg,*) norder
nfiles=nargs-2
twopi=8.0*atan(1.0)
fs=12000.0 !Sample rate
dt=1.0/fs !Sample interval (s)
tt=NSPS*dt !Duration of "itone" symbols (s)
ts=2*NSPS*dt !Duration of OQPSK symbols (s)
baud=1.0/tt !Keying rate (baud)
txt=NZ*dt !Transmission length (s)
nfa=100.0
nfb=3000.0
nfqso=1500.0
do ifile=1,nfiles
call getarg(ifile+2,infile)
open(10,file=infile,status='old',access='stream')
read(10,end=999) ihdr,iwave
close(10)
j2=index(infile,'.wav')
read(infile(j2-6:j2-1),*) nutc
datetime=infile(j2-13:j2-1)
call sync8(iwave,nfa,nfb,nfqso,s,candidate,ncand)
syncmin=4.0
do icand=1,ncand
sync=candidate(3,icand)
if( sync.lt.syncmin) cycle
f1=candidate(1,icand)
xdt=candidate(2,icand)
nsnr=min(99,nint(10.0*log10(sync)-25.5))
call ft8b(s,nfqso,f1,xdt,nharderrors,dmin,nbadcrc,message)
xdt=xdt-0.6
write(*,1110) datetime,0,nsnr,xdt,f1,message,nharderrors,dmin
1110 format(a13,2i4,f6.2,f7.1,' ~ ',a22,i6,f7.1)
enddo
enddo ! ifile loop
999 end program ft8d
@@ -0,0 +1,246 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>Astro</class>
<widget class="QWidget" name="Astro">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>359</width>
<height>342</height>
</rect>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<layout class="QGridLayout" name="gridLayout">
<property name="sizeConstraint">
<enum>QLayout::SetFixedSize</enum>
</property>
<item row="0" column="1">
<widget class="QWidget" name="doppler_widget" native="true">
<property name="styleSheet">
<string notr="true">* {
font-weight: normal;
}</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<widget class="QGroupBox" name="groupBox">
<property name="title">
<string>Doppler tracking</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout_2">
<item>
<widget class="QRadioButton" name="rbFullTrack">
<property name="toolTip">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;One station does all Doppler shift correction, their QSO partner receives and transmits on the sked frequency.&lt;/p&gt;&lt;p&gt;If the rig does not accept CAT QSY commands while transmitting a single correction is applied for the whole transmit period.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="text">
<string>Full Doppler to DX Grid</string>
</property>
<property name="checked">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="QRadioButton" name="rbRxOnly">
<property name="toolTip">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Both stations do full correction to their QSO partner's grid square during receive, no correction is applied on transmit.&lt;/p&gt;&lt;p&gt;This mode facilitates accurate Doppler shift correction when one or both stations have a rig that does not accept CAT QSY commands while transmitting.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="text">
<string>Receive only</string>
</property>
</widget>
</item>
<item>
<widget class="QRadioButton" name="rbConstFreqOnMoon">
<property name="toolTip">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Both stations correct for Doppler shift such that they would be heard on the moon at the sked frequency.&lt;/p&gt;&lt;p&gt;If the rig does not accept CAT QSY commands while transmitting a single correction is applied for the whole transmit period.&lt;/p&gt;&lt;p&gt;Use this option also for Echo mode.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="text">
<string>Constant frequency on Moon</string>
</property>
<property name="checked">
<bool>false</bool>
</property>
</widget>
</item>
<item>
<widget class="QRadioButton" name="rbNoDoppler">
<property name="toolTip">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;No Doppler shift correction is applied. This may be used when the QSO partner does full Doppler correction to your grid square.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="text">
<string>None</string>
</property>
<property name="checked">
<bool>false</bool>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item>
<widget class="QGroupBox" name="groupBox_3">
<property name="enabled">
<bool>true</bool>
</property>
<property name="title">
<string>Sked frequency</string>
</property>
<layout class="QGridLayout" name="gridLayout_2" columnstretch="0,1">
<item row="1" column="1">
<widget class="QLabel" name="sked_tx_frequency_label">
<property name="styleSheet">
<string notr="true">* {
font-family: Courier;
font-size: 12pt;
font-weight: bold;
}</string>
</property>
<property name="text">
<string>0</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QLabel" name="sked_frequency_label">
<property name="styleSheet">
<string notr="true">* {
font-family: Courier;
font-size: 12pt;
font-weight: bold;
}</string>
</property>
<property name="text">
<string>0</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item row="0" column="0">
<widget class="QLabel" name="label">
<property name="styleSheet">
<string notr="true">* {
font-family: Courier;
font-size: 12pt;
font-weight: bold;
}</string>
</property>
<property name="text">
<string>Rx:</string>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="label_2">
<property name="styleSheet">
<string notr="true">* {
font-family: Courier;
font-size: 12pt;
font-weight: bold;
}</string>
</property>
<property name="text">
<string>Tx:</string>
</property>
</widget>
</item>
<item row="2" column="0" colspan="2">
<widget class="QLabel" name="label_3">
<property name="text">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Press and hold the CTRL key to adjust the sked frequency manually with the rig's VFO dial or enter frequency directly into the band entry field on the main window.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="textFormat">
<enum>Qt::AutoText</enum>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
<property name="wordWrap">
<bool>true</bool>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item>
<spacer name="verticalSpacer_2">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>0</width>
<height>0</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
</item>
<item row="0" column="0">
<layout class="QVBoxLayout" name="verticalLayout_3">
<item alignment="Qt::AlignHCenter">
<widget class="QLabel" name="text_label">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="MinimumExpanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="styleSheet">
<string notr="true">* {
font-family: Courier;
font-size: 12pt;
font-weight: bold;
}</string>
</property>
<property name="frameShadow">
<enum>QFrame::Sunken</enum>
</property>
<property name="text">
<string>Astro Data</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
<property name="margin">
<number>6</number>
</property>
</widget>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="QCheckBox" name="cbDopplerTracking">
<property name="styleSheet">
<string notr="true"/>
</property>
<property name="text">
<string>Doppler tracking</string>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</item>
</layout>
</widget>
<resources/>
<connections/>
</ui>
@@ -0,0 +1,754 @@
/////////////////////////////////////////////////////////////////////////////
//
// (C) Copyright Ion Gaztanaga 2007-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.
//
/////////////////////////////////////////////////////////////////////////////
// The implementation of splay trees is based on the article and code published
// in C++ Users Journal "Implementing Splay Trees in C++" (September 1, 2005).
//
// The splay code has been modified and (supposedly) improved by Ion Gaztanaga.
//
// Here is the copyright notice of the original file containing the splay code:
//
// splay_tree.h -- implementation of a STL compatible splay tree.
//
// Copyright (c) 2004 Ralf Mattethat
//
// Permission to copy, use, modify, sell and distribute this software
// is granted provided this copyright notice appears in all copies.
// This software is provided "as is" without express or implied
// warranty, and with no claim as to its suitability for any purpose.
//
/////////////////////////////////////////////////////////////////////////////
#ifndef BOOST_INTRUSIVE_SPLAYTREE_ALGORITHMS_HPP
#define BOOST_INTRUSIVE_SPLAYTREE_ALGORITHMS_HPP
#include <boost/intrusive/detail/config_begin.hpp>
#include <boost/intrusive/intrusive_fwd.hpp>
#include <boost/intrusive/detail/assert.hpp>
#include <boost/intrusive/detail/algo_type.hpp>
#include <boost/intrusive/detail/uncast.hpp>
#include <boost/intrusive/bstree_algorithms.hpp>
#include <cstddef>
#if defined(BOOST_HAS_PRAGMA_ONCE)
# pragma once
#endif
namespace boost {
namespace intrusive {
/// @cond
namespace detail {
template<class NodeTraits>
struct splaydown_assemble_and_fix_header
{
typedef typename NodeTraits::node_ptr node_ptr;
splaydown_assemble_and_fix_header(const node_ptr & t, const node_ptr & header, const node_ptr &leftmost, const node_ptr &rightmost)
: t_(t)
, null_node_(header)
, l_(null_node_)
, r_(null_node_)
, leftmost_(leftmost)
, rightmost_(rightmost)
{}
~splaydown_assemble_and_fix_header()
{
this->assemble();
//Now recover the original header except for the
//splayed root node.
//"t_" is the current root and "null_node_" is the header node
NodeTraits::set_parent(null_node_, t_);
NodeTraits::set_parent(t_, null_node_);
//Recover leftmost/rightmost pointers
NodeTraits::set_left (null_node_, leftmost_);
NodeTraits::set_right(null_node_, rightmost_);
}
private:
void assemble()
{
//procedure assemble;
// left(r), right(l) := right(t), left(t);
// left(t), right(t) := right(null), left(null);
//end assemble;
{ // left(r), right(l) := right(t), left(t);
node_ptr const old_t_left = NodeTraits::get_left(t_);
node_ptr const old_t_right = NodeTraits::get_right(t_);
NodeTraits::set_right(l_, old_t_left);
NodeTraits::set_left (r_, old_t_right);
if(old_t_left){
NodeTraits::set_parent(old_t_left, l_);
}
if(old_t_right){
NodeTraits::set_parent(old_t_right, r_);
}
}
{ // left(t), right(t) := right(null), left(null);
node_ptr const null_right = NodeTraits::get_right(null_node_);
node_ptr const null_left = NodeTraits::get_left(null_node_);
NodeTraits::set_left (t_, null_right);
NodeTraits::set_right(t_, null_left);
if(null_right){
NodeTraits::set_parent(null_right, t_);
}
if(null_left){
NodeTraits::set_parent(null_left, t_);
}
}
}
public:
node_ptr t_, null_node_, l_, r_, leftmost_, rightmost_;
};
} //namespace detail {
/// @endcond
//! A splay tree is an implementation of a binary search tree. The tree is
//! self balancing using the splay algorithm as described in
//!
//! "Self-Adjusting Binary Search Trees
//! by Daniel Dominic Sleator and Robert Endre Tarjan
//! AT&T Bell Laboratories, Murray Hill, NJ
//! Journal of the ACM, Vol 32, no 3, July 1985, pp 652-686
//!
//! splaytree_algorithms is configured with a NodeTraits class, which encapsulates the
//! information about the node to be manipulated. NodeTraits must support the
//! following interface:
//!
//! <b>Typedefs</b>:
//!
//! <tt>node</tt>: The type of the node that forms the binary search tree
//!
//! <tt>node_ptr</tt>: A pointer to a node
//!
//! <tt>const_node_ptr</tt>: A pointer to a const node
//!
//! <b>Static functions</b>:
//!
//! <tt>static node_ptr get_parent(const_node_ptr n);</tt>
//!
//! <tt>static void set_parent(node_ptr n, node_ptr parent);</tt>
//!
//! <tt>static node_ptr get_left(const_node_ptr n);</tt>
//!
//! <tt>static void set_left(node_ptr n, node_ptr left);</tt>
//!
//! <tt>static node_ptr get_right(const_node_ptr n);</tt>
//!
//! <tt>static void set_right(node_ptr n, node_ptr right);</tt>
template<class NodeTraits>
class splaytree_algorithms
#ifndef BOOST_INTRUSIVE_DOXYGEN_INVOKED
: public bstree_algorithms<NodeTraits>
#endif
{
/// @cond
private:
typedef bstree_algorithms<NodeTraits> bstree_algo;
/// @endcond
public:
typedef typename NodeTraits::node node;
typedef NodeTraits node_traits;
typedef typename NodeTraits::node_ptr node_ptr;
typedef typename NodeTraits::const_node_ptr const_node_ptr;
//! This type is the information that will be
//! filled by insert_unique_check
typedef typename bstree_algo::insert_commit_data insert_commit_data;
public:
#ifdef BOOST_INTRUSIVE_DOXYGEN_INVOKED
//! @copydoc ::boost::intrusive::bstree_algorithms::get_header(const const_node_ptr&)
static node_ptr get_header(const const_node_ptr & n);
//! @copydoc ::boost::intrusive::bstree_algorithms::begin_node
static node_ptr begin_node(const const_node_ptr & header);
//! @copydoc ::boost::intrusive::bstree_algorithms::end_node
static node_ptr end_node(const const_node_ptr & header);
//! @copydoc ::boost::intrusive::bstree_algorithms::swap_tree
static void swap_tree(const node_ptr & header1, const node_ptr & header2);
//! @copydoc ::boost::intrusive::bstree_algorithms::swap_nodes(const node_ptr&,const node_ptr&)
static void swap_nodes(const node_ptr & node1, const node_ptr & node2);
//! @copydoc ::boost::intrusive::bstree_algorithms::swap_nodes(const node_ptr&,const node_ptr&,const node_ptr&,const node_ptr&)
static void swap_nodes(const node_ptr & node1, const node_ptr & header1, const node_ptr & node2, const node_ptr & header2);
//! @copydoc ::boost::intrusive::bstree_algorithms::replace_node(const node_ptr&,const node_ptr&)
static void replace_node(const node_ptr & node_to_be_replaced, const node_ptr & new_node);
//! @copydoc ::boost::intrusive::bstree_algorithms::replace_node(const node_ptr&,const node_ptr&,const node_ptr&)
static void replace_node(const node_ptr & node_to_be_replaced, const node_ptr & header, const node_ptr & new_node);
//! @copydoc ::boost::intrusive::bstree_algorithms::unlink(const node_ptr&)
static void unlink(const node_ptr & node);
//! @copydoc ::boost::intrusive::bstree_algorithms::unlink_leftmost_without_rebalance
static node_ptr unlink_leftmost_without_rebalance(const node_ptr & header);
//! @copydoc ::boost::intrusive::bstree_algorithms::unique(const const_node_ptr&)
static bool unique(const const_node_ptr & node);
//! @copydoc ::boost::intrusive::bstree_algorithms::size(const const_node_ptr&)
static std::size_t size(const const_node_ptr & header);
//! @copydoc ::boost::intrusive::bstree_algorithms::next_node(const node_ptr&)
static node_ptr next_node(const node_ptr & node);
//! @copydoc ::boost::intrusive::bstree_algorithms::prev_node(const node_ptr&)
static node_ptr prev_node(const node_ptr & node);
//! @copydoc ::boost::intrusive::bstree_algorithms::init(const node_ptr&)
static void init(const node_ptr & node);
//! @copydoc ::boost::intrusive::bstree_algorithms::init_header(const node_ptr&)
static void init_header(const node_ptr & header);
#endif //#ifdef BOOST_INTRUSIVE_DOXYGEN_INVOKED
//! @copydoc ::boost::intrusive::bstree_algorithms::erase(const node_ptr&,const node_ptr&)
//! Additional notes: the previous node of z is splayed to speed up range deletions.
static void erase(const node_ptr & header, const node_ptr & z)
{
//posibility 1
if(NodeTraits::get_left(z)){
splay_up(bstree_algo::prev_node(z), header);
}
//possibility 2
//if(NodeTraits::get_left(z)){
// node_ptr l = NodeTraits::get_left(z);
// splay_up(l, header);
//}
//if(NodeTraits::get_left(z)){
// node_ptr l = bstree_algo::prev_node(z);
// splay_up_impl(l, z);
//}
//possibility 4
//splay_up(z, header);
bstree_algo::erase(header, z);
}
//! @copydoc ::boost::intrusive::bstree_algorithms::transfer_unique
template<class NodePtrCompare>
static bool transfer_unique
(const node_ptr & header1, NodePtrCompare comp, const node_ptr &header2, const node_ptr & z)
{
typename bstree_algo::insert_commit_data commit_data;
bool const transferable = bstree_algo::insert_unique_check(header1, z, comp, commit_data).second;
if(transferable){
erase(header2, z);
bstree_algo::insert_commit(header1, z, commit_data);
splay_up(z, header1);
}
return transferable;
}
//! @copydoc ::boost::intrusive::bstree_algorithms::transfer_equal
template<class NodePtrCompare>
static void transfer_equal
(const node_ptr & header1, NodePtrCompare comp, const node_ptr &header2, const node_ptr & z)
{
insert_commit_data commit_data;
splay_down(header1, z, comp);
bstree_algo::insert_equal_upper_bound_check(header1, z, comp, commit_data);
erase(header2, z);
bstree_algo::insert_commit(header1, z, commit_data);
}
#ifdef BOOST_INTRUSIVE_DOXYGEN_INVOKED
//! @copydoc ::boost::intrusive::bstree_algorithms::clone(const const_node_ptr&,const node_ptr&,Cloner,Disposer)
template <class Cloner, class Disposer>
static void clone
(const const_node_ptr & source_header, const node_ptr & target_header, Cloner cloner, Disposer disposer);
//! @copydoc ::boost::intrusive::bstree_algorithms::clear_and_dispose(const node_ptr&,Disposer)
template<class Disposer>
static void clear_and_dispose(const node_ptr & header, Disposer disposer);
#endif //#ifdef BOOST_INTRUSIVE_DOXYGEN_INVOKED
//! @copydoc ::boost::intrusive::bstree_algorithms::count(const const_node_ptr&,const KeyType&,KeyNodePtrCompare)
//! Additional notes: an element with key `key` is splayed.
template<class KeyType, class KeyNodePtrCompare>
static std::size_t count
(const node_ptr & header, const KeyType &key, KeyNodePtrCompare comp)
{
std::pair<node_ptr, node_ptr> ret = equal_range(header, key, comp);
std::size_t n = 0;
while(ret.first != ret.second){
++n;
ret.first = next_node(ret.first);
}
return n;
}
//! @copydoc ::boost::intrusive::bstree_algorithms::count(const const_node_ptr&,const KeyType&,KeyNodePtrCompare)
//! Additional note: no splaying is performed
template<class KeyType, class KeyNodePtrCompare>
static std::size_t count
(const const_node_ptr & header, const KeyType &key, KeyNodePtrCompare comp)
{ return bstree_algo::count(header, key, comp); }
//! @copydoc ::boost::intrusive::bstree_algorithms::lower_bound(const const_node_ptr&,const KeyType&,KeyNodePtrCompare)
//! Additional notes: the first node of the range is splayed.
template<class KeyType, class KeyNodePtrCompare>
static node_ptr lower_bound
(const node_ptr & header, const KeyType &key, KeyNodePtrCompare comp)
{
splay_down(detail::uncast(header), key, comp);
node_ptr y = bstree_algo::lower_bound(header, key, comp);
//splay_up(y, detail::uncast(header));
return y;
}
//! @copydoc ::boost::intrusive::bstree_algorithms::lower_bound(const const_node_ptr&,const KeyType&,KeyNodePtrCompare)
//! Additional note: no splaying is performed
template<class KeyType, class KeyNodePtrCompare>
static node_ptr lower_bound
(const const_node_ptr & header, const KeyType &key, KeyNodePtrCompare comp)
{ return bstree_algo::lower_bound(header, key, comp); }
//! @copydoc ::boost::intrusive::bstree_algorithms::upper_bound(const const_node_ptr&,const KeyType&,KeyNodePtrCompare)
//! Additional notes: the first node of the range is splayed.
template<class KeyType, class KeyNodePtrCompare>
static node_ptr upper_bound
(const node_ptr & header, const KeyType &key, KeyNodePtrCompare comp)
{
splay_down(detail::uncast(header), key, comp);
node_ptr y = bstree_algo::upper_bound(header, key, comp);
//splay_up(y, detail::uncast(header));
return y;
}
//! @copydoc ::boost::intrusive::bstree_algorithms::upper_bound(const const_node_ptr&,const KeyType&,KeyNodePtrCompare)
//! Additional note: no splaying is performed
template<class KeyType, class KeyNodePtrCompare>
static node_ptr upper_bound
(const const_node_ptr & header, const KeyType &key, KeyNodePtrCompare comp)
{ return bstree_algo::upper_bound(header, key, comp); }
//! @copydoc ::boost::intrusive::bstree_algorithms::find(const const_node_ptr&, const KeyType&,KeyNodePtrCompare)
//! Additional notes: the found node of the lower bound is splayed.
template<class KeyType, class KeyNodePtrCompare>
static node_ptr find
(const node_ptr & header, const KeyType &key, KeyNodePtrCompare comp)
{
splay_down(detail::uncast(header), key, comp);
return bstree_algo::find(header, key, comp);
}
//! @copydoc ::boost::intrusive::bstree_algorithms::find(const const_node_ptr&, const KeyType&,KeyNodePtrCompare)
//! Additional note: no splaying is performed
template<class KeyType, class KeyNodePtrCompare>
static node_ptr find
(const const_node_ptr & header, const KeyType &key, KeyNodePtrCompare comp)
{ return bstree_algo::find(header, key, comp); }
//! @copydoc ::boost::intrusive::bstree_algorithms::equal_range(const const_node_ptr&,const KeyType&,KeyNodePtrCompare)
//! Additional notes: the first node of the range is splayed.
template<class KeyType, class KeyNodePtrCompare>
static std::pair<node_ptr, node_ptr> equal_range
(const node_ptr & header, const KeyType &key, KeyNodePtrCompare comp)
{
splay_down(detail::uncast(header), key, comp);
std::pair<node_ptr, node_ptr> ret = bstree_algo::equal_range(header, key, comp);
//splay_up(ret.first, detail::uncast(header));
return ret;
}
//! @copydoc ::boost::intrusive::bstree_algorithms::equal_range(const const_node_ptr&,const KeyType&,KeyNodePtrCompare)
//! Additional note: no splaying is performed
template<class KeyType, class KeyNodePtrCompare>
static std::pair<node_ptr, node_ptr> equal_range
(const const_node_ptr & header, const KeyType &key, KeyNodePtrCompare comp)
{ return bstree_algo::equal_range(header, key, comp); }
//! @copydoc ::boost::intrusive::bstree_algorithms::lower_bound_range(const const_node_ptr&,const KeyType&,KeyNodePtrCompare)
//! Additional notes: the first node of the range is splayed.
template<class KeyType, class KeyNodePtrCompare>
static std::pair<node_ptr, node_ptr> lower_bound_range
(const node_ptr & header, const KeyType &key, KeyNodePtrCompare comp)
{
splay_down(detail::uncast(header), key, comp);
std::pair<node_ptr, node_ptr> ret = bstree_algo::lower_bound_range(header, key, comp);
//splay_up(ret.first, detail::uncast(header));
return ret;
}
//! @copydoc ::boost::intrusive::bstree_algorithms::lower_bound_range(const const_node_ptr&,const KeyType&,KeyNodePtrCompare)
//! Additional note: no splaying is performed
template<class KeyType, class KeyNodePtrCompare>
static std::pair<node_ptr, node_ptr> lower_bound_range
(const const_node_ptr & header, const KeyType &key, KeyNodePtrCompare comp)
{ return bstree_algo::lower_bound_range(header, key, comp); }
//! @copydoc ::boost::intrusive::bstree_algorithms::bounded_range(const const_node_ptr&,const KeyType&,const KeyType&,KeyNodePtrCompare,bool,bool)
//! Additional notes: the first node of the range is splayed.
template<class KeyType, class KeyNodePtrCompare>
static std::pair<node_ptr, node_ptr> bounded_range
(const node_ptr & header, const KeyType &lower_key, const KeyType &upper_key, KeyNodePtrCompare comp
, bool left_closed, bool right_closed)
{
splay_down(detail::uncast(header), lower_key, comp);
std::pair<node_ptr, node_ptr> ret =
bstree_algo::bounded_range(header, lower_key, upper_key, comp, left_closed, right_closed);
//splay_up(ret.first, detail::uncast(header));
return ret;
}
//! @copydoc ::boost::intrusive::bstree_algorithms::bounded_range(const const_node_ptr&,const KeyType&,const KeyType&,KeyNodePtrCompare,bool,bool)
//! Additional note: no splaying is performed
template<class KeyType, class KeyNodePtrCompare>
static std::pair<node_ptr, node_ptr> bounded_range
(const const_node_ptr & header, const KeyType &lower_key, const KeyType &upper_key, KeyNodePtrCompare comp
, bool left_closed, bool right_closed)
{ return bstree_algo::bounded_range(header, lower_key, upper_key, comp, left_closed, right_closed); }
//! @copydoc ::boost::intrusive::bstree_algorithms::insert_equal_upper_bound(const node_ptr&,const node_ptr&,NodePtrCompare)
//! Additional note: the inserted node is splayed
template<class NodePtrCompare>
static node_ptr insert_equal_upper_bound
(const node_ptr & header, const node_ptr & new_node, NodePtrCompare comp)
{
splay_down(header, new_node, comp);
return bstree_algo::insert_equal_upper_bound(header, new_node, comp);
}
//! @copydoc ::boost::intrusive::bstree_algorithms::insert_equal_lower_bound(const node_ptr&,const node_ptr&,NodePtrCompare)
//! Additional note: the inserted node is splayed
template<class NodePtrCompare>
static node_ptr insert_equal_lower_bound
(const node_ptr & header, const node_ptr & new_node, NodePtrCompare comp)
{
splay_down(header, new_node, comp);
return bstree_algo::insert_equal_lower_bound(header, new_node, comp);
}
//! @copydoc ::boost::intrusive::bstree_algorithms::insert_equal(const node_ptr&,const node_ptr&,const node_ptr&,NodePtrCompare)
//! Additional note: the inserted node is splayed
template<class NodePtrCompare>
static node_ptr insert_equal
(const node_ptr & header, const node_ptr & hint, const node_ptr & new_node, NodePtrCompare comp)
{
splay_down(header, new_node, comp);
return bstree_algo::insert_equal(header, hint, new_node, comp);
}
//! @copydoc ::boost::intrusive::bstree_algorithms::insert_before(const node_ptr&,const node_ptr&,const node_ptr&)
//! Additional note: the inserted node is splayed
static node_ptr insert_before
(const node_ptr & header, const node_ptr & pos, const node_ptr & new_node)
{
bstree_algo::insert_before(header, pos, new_node);
splay_up(new_node, header);
return new_node;
}
//! @copydoc ::boost::intrusive::bstree_algorithms::push_back(const node_ptr&,const node_ptr&)
//! Additional note: the inserted node is splayed
static void push_back(const node_ptr & header, const node_ptr & new_node)
{
bstree_algo::push_back(header, new_node);
splay_up(new_node, header);
}
//! @copydoc ::boost::intrusive::bstree_algorithms::push_front(const node_ptr&,const node_ptr&)
//! Additional note: the inserted node is splayed
static void push_front(const node_ptr & header, const node_ptr & new_node)
{
bstree_algo::push_front(header, new_node);
splay_up(new_node, header);
}
//! @copydoc ::boost::intrusive::bstree_algorithms::insert_unique_check(const const_node_ptr&,const KeyType&,KeyNodePtrCompare,insert_commit_data&)
//! Additional note: nodes with the given key are splayed
template<class KeyType, class KeyNodePtrCompare>
static std::pair<node_ptr, bool> insert_unique_check
(const node_ptr & header, const KeyType &key
,KeyNodePtrCompare comp, insert_commit_data &commit_data)
{
splay_down(header, key, comp);
return bstree_algo::insert_unique_check(header, key, comp, commit_data);
}
//! @copydoc ::boost::intrusive::bstree_algorithms::insert_unique_check(const const_node_ptr&,const node_ptr&,const KeyType&,KeyNodePtrCompare,insert_commit_data&)
//! Additional note: nodes with the given key are splayed
template<class KeyType, class KeyNodePtrCompare>
static std::pair<node_ptr, bool> insert_unique_check
(const node_ptr & header, const node_ptr &hint, const KeyType &key
,KeyNodePtrCompare comp, insert_commit_data &commit_data)
{
splay_down(header, key, comp);
return bstree_algo::insert_unique_check(header, hint, key, comp, commit_data);
}
#ifdef BOOST_INTRUSIVE_DOXYGEN_INVOKED
//! @copydoc ::boost::intrusive::bstree_algorithms::insert_unique_commit(const node_ptr&,const node_ptr&,const insert_commit_data&)
static void insert_unique_commit
(const node_ptr & header, const node_ptr & new_value, const insert_commit_data &commit_data);
//! @copydoc ::boost::intrusive::bstree_algorithms::is_header
static bool is_header(const const_node_ptr & p);
//! @copydoc ::boost::intrusive::bstree_algorithms::rebalance
static void rebalance(const node_ptr & header);
//! @copydoc ::boost::intrusive::bstree_algorithms::rebalance_subtree
static node_ptr rebalance_subtree(const node_ptr & old_root);
#endif //#ifdef BOOST_INTRUSIVE_DOXYGEN_INVOKED
// bottom-up splay, use data_ as parent for n | complexity : logarithmic | exception : nothrow
static void splay_up(const node_ptr & node, const node_ptr & header)
{ priv_splay_up<true>(node, header); }
// top-down splay | complexity : logarithmic | exception : strong, note A
template<class KeyType, class KeyNodePtrCompare>
static node_ptr splay_down(const node_ptr & header, const KeyType &key, KeyNodePtrCompare comp, bool *pfound = 0)
{ return priv_splay_down<true>(header, key, comp, pfound); }
private:
/// @cond
// bottom-up splay, use data_ as parent for n | complexity : logarithmic | exception : nothrow
template<bool SimpleSplay>
static void priv_splay_up(const node_ptr & node, const node_ptr & header)
{
// If (node == header) do a splay for the right most node instead
// this is to boost performance of equal_range/count on equivalent containers in the case
// where there are many equal elements at the end
node_ptr n((node == header) ? NodeTraits::get_right(header) : node);
node_ptr t(header);
if( n == t ) return;
for( ;; ){
node_ptr p(NodeTraits::get_parent(n));
node_ptr g(NodeTraits::get_parent(p));
if( p == t ) break;
if( g == t ){
// zig
rotate(n);
}
else if ((NodeTraits::get_left(p) == n && NodeTraits::get_left(g) == p) ||
(NodeTraits::get_right(p) == n && NodeTraits::get_right(g) == p) ){
// zig-zig
rotate(p);
rotate(n);
}
else {
// zig-zag
rotate(n);
if(!SimpleSplay){
rotate(n);
}
}
}
}
template<bool SimpleSplay, class KeyType, class KeyNodePtrCompare>
static node_ptr priv_splay_down(const node_ptr & header, const KeyType &key, KeyNodePtrCompare comp, bool *pfound = 0)
{
//Most splay tree implementations use a dummy/null node to implement.
//this function. This has some problems for a generic library like Intrusive:
//
// * The node might not have a default constructor.
// * The default constructor could throw.
//
//We already have a header node. Leftmost and rightmost nodes of the tree
//are not changed when splaying (because the invariants of the tree don't
//change) We can back up them, use the header as the null node and
//reassign old values after the function has been completed.
node_ptr const old_root = NodeTraits::get_parent(header);
node_ptr const leftmost = NodeTraits::get_left(header);
node_ptr const rightmost = NodeTraits::get_right(header);
if(leftmost == rightmost){ //Empty or unique node
if(pfound){
*pfound = old_root && !comp(key, old_root) && !comp(old_root, key);
}
return old_root ? old_root : header;
}
else{
//Initialize "null node" (the header in our case)
NodeTraits::set_left (header, node_ptr());
NodeTraits::set_right(header, node_ptr());
//Class that will backup leftmost/rightmost from header, commit the assemble(),
//and will restore leftmost/rightmost to header even if "comp" throws
detail::splaydown_assemble_and_fix_header<NodeTraits> commit(old_root, header, leftmost, rightmost);
bool found = false;
for( ;; ){
if(comp(key, commit.t_)){
node_ptr const t_left = NodeTraits::get_left(commit.t_);
if(!t_left)
break;
if(comp(key, t_left)){
bstree_algo::rotate_right_no_parent_fix(commit.t_, t_left);
commit.t_ = t_left;
if( !NodeTraits::get_left(commit.t_) )
break;
link_right(commit.t_, commit.r_);
}
else{
link_right(commit.t_, commit.r_);
if(!SimpleSplay && comp(t_left, key)){
if( !NodeTraits::get_right(commit.t_) )
break;
link_left(commit.t_, commit.l_);
}
}
}
else if(comp(commit.t_, key)){
node_ptr const t_right = NodeTraits::get_right(commit.t_);
if(!t_right)
break;
if(comp(t_right, key)){
bstree_algo::rotate_left_no_parent_fix(commit.t_, t_right);
commit.t_ = t_right;
if( !NodeTraits::get_right(commit.t_) )
break;
link_left(commit.t_, commit.l_);
}
else{
link_left(commit.t_, commit.l_);
if(!SimpleSplay && comp(key, t_right)){
if( !NodeTraits::get_left(commit.t_) )
break;
link_right(commit.t_, commit.r_);
}
}
}
else{
found = true;
break;
}
}
//commit.~splaydown_assemble_and_fix_header<NodeTraits>() will first
//"assemble()" + link the new root & recover header's leftmost & rightmost
if(pfound){
*pfound = found;
}
return commit.t_;
}
}
// break link to left child node and attach it to left tree pointed to by l | complexity : constant | exception : nothrow
static void link_left(node_ptr & t, node_ptr & l)
{
//procedure link_left;
// t, l, right(l) := right(t), t, t
//end link_left
NodeTraits::set_right(l, t);
NodeTraits::set_parent(t, l);
l = t;
t = NodeTraits::get_right(t);
}
// break link to right child node and attach it to right tree pointed to by r | complexity : constant | exception : nothrow
static void link_right(node_ptr & t, node_ptr & r)
{
//procedure link_right;
// t, r, left(r) := left(t), t, t
//end link_right;
NodeTraits::set_left(r, t);
NodeTraits::set_parent(t, r);
r = t;
t = NodeTraits::get_left(t);
}
// rotate n with its parent | complexity : constant | exception : nothrow
static void rotate(const node_ptr & n)
{
//procedure rotate_left;
// t, right(t), left(right(t)) := right(t), left(right(t)), t
//end rotate_left;
node_ptr p = NodeTraits::get_parent(n);
node_ptr g = NodeTraits::get_parent(p);
//Test if g is header before breaking tree
//invariants that would make is_header invalid
bool g_is_header = bstree_algo::is_header(g);
if(NodeTraits::get_left(p) == n){
NodeTraits::set_left(p, NodeTraits::get_right(n));
if(NodeTraits::get_left(p))
NodeTraits::set_parent(NodeTraits::get_left(p), p);
NodeTraits::set_right(n, p);
}
else{ // must be ( p->right == n )
NodeTraits::set_right(p, NodeTraits::get_left(n));
if(NodeTraits::get_right(p))
NodeTraits::set_parent(NodeTraits::get_right(p), p);
NodeTraits::set_left(n, p);
}
NodeTraits::set_parent(p, n);
NodeTraits::set_parent(n, g);
if(g_is_header){
if(NodeTraits::get_parent(g) == p)
NodeTraits::set_parent(g, n);
else{//must be ( g->right == p )
BOOST_INTRUSIVE_INVARIANT_ASSERT(false);
NodeTraits::set_right(g, n);
}
}
else{
if(NodeTraits::get_left(g) == p)
NodeTraits::set_left(g, n);
else //must be ( g->right == p )
NodeTraits::set_right(g, n);
}
}
/// @endcond
};
/// @cond
template<class NodeTraits>
struct get_algo<SplayTreeAlgorithms, NodeTraits>
{
typedef splaytree_algorithms<NodeTraits> type;
};
template <class ValueTraits, class NodePtrCompare, class ExtraChecker>
struct get_node_checker<SplayTreeAlgorithms, ValueTraits, NodePtrCompare, ExtraChecker>
{
typedef detail::bstree_node_checker<ValueTraits, NodePtrCompare, ExtraChecker> type;
};
/// @endcond
} //namespace intrusive
} //namespace boost
#include <boost/intrusive/detail/config_end.hpp>
#endif //BOOST_INTRUSIVE_SPLAYTREE_ALGORITHMS_HPP
@@ -0,0 +1,41 @@
# /* Copyright (C) 2001
# * Housemarque Oy
# * http://www.housemarque.com
# *
# * Distributed under the Boost Software License, Version 1.0. (See
# * accompanying file LICENSE_1_0.txt or copy at
# * http://www.boost.org/LICENSE_1_0.txt)
# */
#
# /* Revised by Paul Mensonides (2002) */
#
# /* See http://www.boost.org for most recent version. */
#
# ifndef BOOST_PREPROCESSOR_REPETITION_ENUM_PARAMS_HPP
# define BOOST_PREPROCESSOR_REPETITION_ENUM_PARAMS_HPP
#
# include <boost/preprocessor/config/config.hpp>
# include <boost/preprocessor/punctuation/comma_if.hpp>
# include <boost/preprocessor/repetition/repeat.hpp>
#
# /* BOOST_PP_ENUM_PARAMS */
#
# if ~BOOST_PP_CONFIG_FLAGS() & BOOST_PP_CONFIG_EDG()
# define BOOST_PP_ENUM_PARAMS(count, param) BOOST_PP_REPEAT(count, BOOST_PP_ENUM_PARAMS_M, param)
# else
# define BOOST_PP_ENUM_PARAMS(count, param) BOOST_PP_ENUM_PARAMS_I(count, param)
# define BOOST_PP_ENUM_PARAMS_I(count, param) BOOST_PP_REPEAT(count, BOOST_PP_ENUM_PARAMS_M, param)
# endif
#
# define BOOST_PP_ENUM_PARAMS_M(z, n, param) BOOST_PP_COMMA_IF(n) param ## n
#
# /* BOOST_PP_ENUM_PARAMS_Z */
#
# if ~BOOST_PP_CONFIG_FLAGS() & BOOST_PP_CONFIG_EDG()
# define BOOST_PP_ENUM_PARAMS_Z(z, count, param) BOOST_PP_REPEAT_ ## z(count, BOOST_PP_ENUM_PARAMS_M, param)
# else
# define BOOST_PP_ENUM_PARAMS_Z(z, count, param) BOOST_PP_ENUM_PARAMS_Z_I(z, count, param)
# define BOOST_PP_ENUM_PARAMS_Z_I(z, count, param) BOOST_PP_REPEAT_ ## z(count, BOOST_PP_ENUM_PARAMS_M, param)
# endif
#
# endif