Initial Commit
This commit is contained in:
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,195 @@
|
||||
// (C) Copyright Gennadiy Rozental 2001.
|
||||
// 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/test for the library home page.
|
||||
//
|
||||
// File : $RCSfile$
|
||||
//
|
||||
// Version : $Revision$
|
||||
//
|
||||
// Description : defines runtime parameters setup error
|
||||
// ***************************************************************************
|
||||
|
||||
#ifndef BOOST_TEST_UTILS_RUNTIME_INIT_ERROR_HPP
|
||||
#define BOOST_TEST_UTILS_RUNTIME_INIT_ERROR_HPP
|
||||
|
||||
// Boost.Test Runtime parameters
|
||||
#include <boost/test/utils/runtime/fwd.hpp>
|
||||
|
||||
// Boost.Test
|
||||
#include <boost/test/utils/string_cast.hpp>
|
||||
|
||||
// Boost.Test
|
||||
#include <boost/config.hpp>
|
||||
|
||||
// STL
|
||||
#include <exception>
|
||||
#include <vector>
|
||||
|
||||
#include <boost/test/detail/suppress_warnings.hpp>
|
||||
|
||||
namespace boost {
|
||||
namespace runtime {
|
||||
|
||||
// ************************************************************************** //
|
||||
// ************** runtime::param_error ************** //
|
||||
// ************************************************************************** //
|
||||
|
||||
class param_error : public std::exception {
|
||||
public:
|
||||
~param_error() BOOST_NOEXCEPT_OR_NOTHROW {}
|
||||
|
||||
virtual const char * what() const BOOST_NOEXCEPT_OR_NOTHROW
|
||||
{
|
||||
return msg.c_str();
|
||||
}
|
||||
|
||||
cstring param_name;
|
||||
std::string msg;
|
||||
|
||||
protected:
|
||||
explicit param_error( cstring param_name_ ) : param_name( param_name_) {}
|
||||
};
|
||||
|
||||
//____________________________________________________________________________//
|
||||
|
||||
class init_error : public param_error {
|
||||
protected:
|
||||
explicit init_error( cstring param_name ) : param_error( param_name ) {}
|
||||
~init_error() BOOST_NOEXCEPT_OR_NOTHROW {}
|
||||
};
|
||||
|
||||
class input_error : public param_error {
|
||||
protected:
|
||||
explicit input_error( cstring param_name ) : param_error( param_name ) {}
|
||||
~input_error() BOOST_NOEXCEPT_OR_NOTHROW {}
|
||||
};
|
||||
|
||||
//____________________________________________________________________________//
|
||||
|
||||
template<typename Derived, typename Base>
|
||||
class specific_param_error : public Base {
|
||||
protected:
|
||||
explicit specific_param_error( cstring param_name ) : Base( param_name ) {}
|
||||
~specific_param_error() BOOST_NOEXCEPT_OR_NOTHROW {}
|
||||
|
||||
public:
|
||||
|
||||
//____________________________________________________________________________//
|
||||
|
||||
#if !defined(BOOST_NO_CXX11_RVALUE_REFERENCES) && \
|
||||
!defined(BOOST_NO_CXX11_REF_QUALIFIERS)
|
||||
|
||||
Derived operator<<(char const* val) &&
|
||||
{
|
||||
this->msg.append( val );
|
||||
|
||||
return reinterpret_cast<Derived&&>(*this);
|
||||
}
|
||||
|
||||
//____________________________________________________________________________//
|
||||
|
||||
template<typename T>
|
||||
Derived operator<<(T const& val) &&
|
||||
{
|
||||
this->msg.append( unit_test::utils::string_cast( val ) );
|
||||
|
||||
return reinterpret_cast<Derived&&>(*this);
|
||||
}
|
||||
|
||||
//____________________________________________________________________________//
|
||||
|
||||
#else
|
||||
|
||||
Derived const& operator<<(char const* val) const
|
||||
{
|
||||
const_cast<specific_param_error<Derived, Base>&>(*this).msg.append( val );
|
||||
|
||||
return static_cast<Derived const&>(*this);
|
||||
}
|
||||
|
||||
//____________________________________________________________________________//
|
||||
|
||||
template<typename T>
|
||||
Derived const& operator<<(T const& val) const
|
||||
{
|
||||
const_cast<specific_param_error<Derived, Base>&>(*this).msg.append( unit_test::utils::string_cast( val ) );
|
||||
|
||||
return static_cast<Derived const&>(*this);
|
||||
}
|
||||
|
||||
//____________________________________________________________________________//
|
||||
|
||||
#endif
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
// ************************************************************************** //
|
||||
// ************** specific exception types ************** //
|
||||
// ************************************************************************** //
|
||||
|
||||
#define SPECIFIC_EX_TYPE( type, base ) \
|
||||
class type : public specific_param_error<type,base> { \
|
||||
public: \
|
||||
explicit type( cstring param_name = cstring() ) \
|
||||
: specific_param_error<type,base>( param_name ) \
|
||||
{} \
|
||||
} \
|
||||
/**/
|
||||
|
||||
SPECIFIC_EX_TYPE( invalid_cla_id, init_error );
|
||||
SPECIFIC_EX_TYPE( duplicate_param, init_error );
|
||||
SPECIFIC_EX_TYPE( conflicting_param, init_error );
|
||||
SPECIFIC_EX_TYPE( unknown_param, init_error );
|
||||
SPECIFIC_EX_TYPE( access_to_missing_argument, init_error );
|
||||
SPECIFIC_EX_TYPE( arg_type_mismatch, init_error );
|
||||
SPECIFIC_EX_TYPE( invalid_param_spec, init_error );
|
||||
|
||||
SPECIFIC_EX_TYPE( format_error, input_error );
|
||||
SPECIFIC_EX_TYPE( duplicate_arg, input_error );
|
||||
SPECIFIC_EX_TYPE( missing_req_arg, input_error );
|
||||
|
||||
#undef SPECIFIC_EX_TYPE
|
||||
|
||||
class ambiguous_param : public specific_param_error<ambiguous_param, input_error> {
|
||||
public:
|
||||
#ifndef BOOST_NO_CXX11_RVALUE_REFERENCES
|
||||
explicit ambiguous_param( std::vector<cstring>&& amb_candidates )
|
||||
: specific_param_error<ambiguous_param,input_error>( "" )
|
||||
, m_amb_candidates( std::move( amb_candidates ) ) {}
|
||||
#else
|
||||
explicit ambiguous_param( std::vector<cstring> const& amb_candidates )
|
||||
: specific_param_error<ambiguous_param,input_error>( "" )
|
||||
, m_amb_candidates( amb_candidates ) {}
|
||||
#endif
|
||||
~ambiguous_param() BOOST_NOEXCEPT_OR_NOTHROW {}
|
||||
|
||||
std::vector<cstring> m_amb_candidates;
|
||||
};
|
||||
|
||||
class unrecognized_param : public specific_param_error<unrecognized_param, input_error> {
|
||||
public:
|
||||
#ifndef BOOST_NO_CXX11_RVALUE_REFERENCES
|
||||
explicit unrecognized_param( std::vector<cstring>&& type_candidates )
|
||||
: specific_param_error<unrecognized_param,input_error>( "" )
|
||||
, m_typo_candidates( std::move( type_candidates ) ) {}
|
||||
#else
|
||||
explicit unrecognized_param( std::vector<cstring> const& type_candidates )
|
||||
: specific_param_error<unrecognized_param,input_error>( "" )
|
||||
, m_typo_candidates( type_candidates ) {}
|
||||
#endif
|
||||
~unrecognized_param() BOOST_NOEXCEPT_OR_NOTHROW {}
|
||||
|
||||
std::vector<cstring> m_typo_candidates;
|
||||
};
|
||||
|
||||
} // namespace runtime
|
||||
} // namespace boost
|
||||
|
||||
#include <boost/test/detail/enable_warnings.hpp>
|
||||
|
||||
#endif // BOOST_TEST_UTILS_RUNTIME_INIT_ERROR_HPP
|
||||
@@ -0,0 +1,214 @@
|
||||
// (C) Copyright David Abrahams 2000.
|
||||
// Distributed under the Boost Software License, Version 1.0. (See
|
||||
// accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
//
|
||||
// The author gratefully acknowleges the support of Dragon Systems, Inc., in
|
||||
// producing this work.
|
||||
|
||||
// This file serves as a wrapper around <Python.h> which allows it to be
|
||||
// compiled with GCC 2.95.2 under Win32 and which disables the default MSVC
|
||||
// behavior so that a program may be compiled in debug mode without requiring a
|
||||
// special debugging build of the Python library.
|
||||
|
||||
|
||||
// To use the Python debugging library, #define BOOST_DEBUG_PYTHON on the
|
||||
// compiler command-line.
|
||||
|
||||
// Revision History:
|
||||
// 05 Mar 01 Suppress warnings under Cygwin with Python 2.0 (Dave Abrahams)
|
||||
// 04 Mar 01 Rolled in some changes from the Dragon fork (Dave Abrahams)
|
||||
// 01 Mar 01 define PyObject_INIT() for Python 1.x (Dave Abrahams)
|
||||
|
||||
#ifdef _DEBUG
|
||||
# ifndef BOOST_DEBUG_PYTHON
|
||||
# ifdef _MSC_VER
|
||||
// VC8.0 will complain if system headers are #included both with
|
||||
// and without _DEBUG defined, so we have to #include all the
|
||||
// system headers used by pyconfig.h right here.
|
||||
# include <stddef.h>
|
||||
# include <stdarg.h>
|
||||
# include <stdio.h>
|
||||
# include <stdlib.h>
|
||||
# include <assert.h>
|
||||
# include <errno.h>
|
||||
# include <ctype.h>
|
||||
# include <wchar.h>
|
||||
# include <basetsd.h>
|
||||
# include <io.h>
|
||||
# include <limits.h>
|
||||
# include <float.h>
|
||||
# include <string.h>
|
||||
# include <math.h>
|
||||
# include <time.h>
|
||||
# endif
|
||||
# undef _DEBUG // Don't let Python force the debug library just because we're debugging.
|
||||
# define DEBUG_UNDEFINED_FROM_WRAP_PYTHON_H
|
||||
# endif
|
||||
#endif
|
||||
|
||||
# include <pyconfig.h>
|
||||
# if defined(_SGI_COMPILER_VERSION) && _SGI_COMPILER_VERSION >= 740
|
||||
# undef _POSIX_C_SOURCE
|
||||
# undef _XOPEN_SOURCE
|
||||
# undef HAVE_STDINT_H // undo Python 2.5.1 define
|
||||
# endif
|
||||
|
||||
//
|
||||
// Python's LongObject.h helpfully #defines ULONGLONG_MAX for us,
|
||||
// which confuses Boost's config
|
||||
//
|
||||
#include <limits.h>
|
||||
#ifndef ULONG_MAX
|
||||
# define BOOST_PYTHON_ULONG_MAX_UNDEFINED
|
||||
#endif
|
||||
#ifndef LONGLONG_MAX
|
||||
# define BOOST_PYTHON_LONGLONG_MAX_UNDEFINED
|
||||
#endif
|
||||
#ifndef ULONGLONG_MAX
|
||||
# define BOOST_PYTHON_ULONGLONG_MAX_UNDEFINED
|
||||
#endif
|
||||
|
||||
//
|
||||
// Get ahold of Python's version number
|
||||
//
|
||||
#include <patchlevel.h>
|
||||
|
||||
#if PY_MAJOR_VERSION<2 || PY_MAJOR_VERSION==2 && PY_MINOR_VERSION<2
|
||||
#error Python 2.2 or higher is required for this version of Boost.Python.
|
||||
#endif
|
||||
|
||||
//
|
||||
// Some things we need in order to get Python.h to work with compilers other
|
||||
// than MSVC on Win32
|
||||
//
|
||||
#if defined(_WIN32) || defined(__CYGWIN__)
|
||||
# if defined(__GNUC__) && defined(__CYGWIN__)
|
||||
|
||||
# if defined(__LP64__)
|
||||
# define SIZEOF_LONG 8
|
||||
# else
|
||||
# define SIZEOF_LONG 4
|
||||
# endif
|
||||
|
||||
|
||||
# if PY_MAJOR_VERSION < 2 || PY_MAJOR_VERSION == 2 && PY_MINOR_VERSION <= 2
|
||||
|
||||
typedef int pid_t;
|
||||
|
||||
# if defined(__LP64__)
|
||||
# define WORD_BIT 64
|
||||
# else
|
||||
# define WORD_BIT 32
|
||||
# endif
|
||||
# define hypot _hypot
|
||||
# include <stdio.h>
|
||||
|
||||
# if PY_MAJOR_VERSION < 2
|
||||
# define HAVE_CLOCK
|
||||
# define HAVE_STRFTIME
|
||||
# define HAVE_STRERROR
|
||||
# endif
|
||||
|
||||
# define NT_THREADS
|
||||
|
||||
# ifndef NETSCAPE_PI
|
||||
# define USE_SOCKET
|
||||
# endif
|
||||
|
||||
# ifdef USE_DL_IMPORT
|
||||
# define DL_IMPORT(RTYPE) __declspec(dllimport) RTYPE
|
||||
# endif
|
||||
|
||||
# ifdef USE_DL_EXPORT
|
||||
# define DL_IMPORT(RTYPE) __declspec(dllexport) RTYPE
|
||||
# define DL_EXPORT(RTYPE) __declspec(dllexport) RTYPE
|
||||
# endif
|
||||
|
||||
# define HAVE_LONG_LONG 1
|
||||
# define LONG_LONG long long
|
||||
# endif
|
||||
|
||||
# elif defined(__MWERKS__)
|
||||
|
||||
# ifndef _MSC_VER
|
||||
# define PY_MSC_VER_DEFINED_FROM_WRAP_PYTHON_H 1
|
||||
# define _MSC_VER 900
|
||||
# endif
|
||||
|
||||
# undef hypot // undo the evil #define left by Python.
|
||||
|
||||
# elif defined(__BORLANDC__)
|
||||
# undef HAVE_HYPOT
|
||||
# define HAVE_HYPOT 1
|
||||
# endif
|
||||
|
||||
#endif // _WIN32
|
||||
|
||||
#if PY_MAJOR_VERSION == 2 && PY_MINOR_VERSION == 2 && PY_MICRO_VERSION < 2
|
||||
# include <boost/python/detail/python22_fixed.h>
|
||||
#else
|
||||
# include <Python.h>
|
||||
#endif
|
||||
|
||||
#ifdef BOOST_PYTHON_ULONG_MAX_UNDEFINED
|
||||
# undef ULONG_MAX
|
||||
# undef BOOST_PYTHON_ULONG_MAX_UNDEFINED
|
||||
#endif
|
||||
|
||||
#ifdef BOOST_PYTHON_LONGLONG_MAX_UNDEFINED
|
||||
# undef LONGLONG_MAX
|
||||
# undef BOOST_PYTHON_LONGLONG_MAX_UNDEFINED
|
||||
#endif
|
||||
|
||||
#ifdef BOOST_PYTHON_ULONGLONG_MAX_UNDEFINED
|
||||
# undef ULONGLONG_MAX
|
||||
# undef BOOST_PYTHON_ULONGLONG_MAX_UNDEFINED
|
||||
#endif
|
||||
|
||||
#ifdef PY_MSC_VER_DEFINED_FROM_WRAP_PYTHON_H
|
||||
# undef _MSC_VER
|
||||
#endif
|
||||
|
||||
#ifdef DEBUG_UNDEFINED_FROM_WRAP_PYTHON_H
|
||||
# undef DEBUG_UNDEFINED_FROM_WRAP_PYTHON_H
|
||||
# define _DEBUG
|
||||
# ifdef _CRT_NOFORCE_MANIFEST_DEFINED_FROM_WRAP_PYTHON_H
|
||||
# undef _CRT_NOFORCE_MANIFEST_DEFINED_FROM_WRAP_PYTHON_H
|
||||
# undef _CRT_NOFORCE_MANIFEST
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#if !defined(PY_MAJOR_VERSION) || PY_MAJOR_VERSION < 2
|
||||
# define PyObject_INIT(op, typeobj) \
|
||||
( (op)->ob_type = (typeobj), _Py_NewReference((PyObject *)(op)), (op) )
|
||||
#endif
|
||||
|
||||
// Define Python 3 macros for Python 2.x
|
||||
#if PY_VERSION_HEX < 0x02060000
|
||||
|
||||
# define Py_TYPE(o) (((PyObject*)(o))->ob_type)
|
||||
# define Py_REFCNT(o) (((PyObject*)(o))->ob_refcnt)
|
||||
# define Py_SIZE(o) (((PyVarObject*)(o))->ob_size)
|
||||
|
||||
# define PyVarObject_HEAD_INIT(type, size) \
|
||||
PyObject_HEAD_INIT(type) size,
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef __MWERKS__
|
||||
# pragma warn_possunwant off
|
||||
#elif _MSC_VER
|
||||
# pragma warning(disable:4786)
|
||||
#endif
|
||||
|
||||
#if defined(HAVE_LONG_LONG)
|
||||
# if defined(PY_LONG_LONG)
|
||||
# define BOOST_PYTHON_LONG_LONG PY_LONG_LONG
|
||||
# elif defined(LONG_LONG)
|
||||
# define BOOST_PYTHON_LONG_LONG LONG_LONG
|
||||
# else
|
||||
# error "HAVE_LONG_LONG defined but not PY_LONG_LONG or LONG_LONG"
|
||||
# endif
|
||||
#endif
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,548 @@
|
||||
// ------------------------------------------------------------------------------
|
||||
// Copyright (c) 2000 Cadenza New Zealand Ltd
|
||||
// Distributed under the Boost Software License, Version 1.0. (See accompany-
|
||||
// ing file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
// ------------------------------------------------------------------------------
|
||||
// Boost functional.hpp header file
|
||||
// See http://www.boost.org/libs/functional for documentation.
|
||||
// ------------------------------------------------------------------------------
|
||||
// $Id$
|
||||
// ------------------------------------------------------------------------------
|
||||
|
||||
#ifndef BOOST_FUNCTIONAL_HPP
|
||||
#define BOOST_FUNCTIONAL_HPP
|
||||
|
||||
#include <boost/config.hpp>
|
||||
#include <boost/call_traits.hpp>
|
||||
#include <functional>
|
||||
|
||||
namespace boost
|
||||
{
|
||||
#ifndef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
|
||||
// --------------------------------------------------------------------------
|
||||
// The following traits classes allow us to avoid the need for ptr_fun
|
||||
// because the types of arguments and the result of a function can be
|
||||
// deduced.
|
||||
//
|
||||
// In addition to the standard types defined in unary_function and
|
||||
// binary_function, we add
|
||||
//
|
||||
// - function_type, the type of the function or function object itself.
|
||||
//
|
||||
// - param_type, the type that should be used for passing the function or
|
||||
// function object as an argument.
|
||||
// --------------------------------------------------------------------------
|
||||
namespace detail
|
||||
{
|
||||
template <class Operation>
|
||||
struct unary_traits_imp;
|
||||
|
||||
template <class Operation>
|
||||
struct unary_traits_imp<Operation*>
|
||||
{
|
||||
typedef Operation function_type;
|
||||
typedef const function_type & param_type;
|
||||
typedef typename Operation::result_type result_type;
|
||||
typedef typename Operation::argument_type argument_type;
|
||||
};
|
||||
|
||||
template <class R, class A>
|
||||
struct unary_traits_imp<R(*)(A)>
|
||||
{
|
||||
typedef R (*function_type)(A);
|
||||
typedef R (*param_type)(A);
|
||||
typedef R result_type;
|
||||
typedef A argument_type;
|
||||
};
|
||||
|
||||
template <class Operation>
|
||||
struct binary_traits_imp;
|
||||
|
||||
template <class Operation>
|
||||
struct binary_traits_imp<Operation*>
|
||||
{
|
||||
typedef Operation function_type;
|
||||
typedef const function_type & param_type;
|
||||
typedef typename Operation::result_type result_type;
|
||||
typedef typename Operation::first_argument_type first_argument_type;
|
||||
typedef typename Operation::second_argument_type second_argument_type;
|
||||
};
|
||||
|
||||
template <class R, class A1, class A2>
|
||||
struct binary_traits_imp<R(*)(A1,A2)>
|
||||
{
|
||||
typedef R (*function_type)(A1,A2);
|
||||
typedef R (*param_type)(A1,A2);
|
||||
typedef R result_type;
|
||||
typedef A1 first_argument_type;
|
||||
typedef A2 second_argument_type;
|
||||
};
|
||||
} // namespace detail
|
||||
|
||||
template <class Operation>
|
||||
struct unary_traits
|
||||
{
|
||||
typedef typename detail::unary_traits_imp<Operation*>::function_type function_type;
|
||||
typedef typename detail::unary_traits_imp<Operation*>::param_type param_type;
|
||||
typedef typename detail::unary_traits_imp<Operation*>::result_type result_type;
|
||||
typedef typename detail::unary_traits_imp<Operation*>::argument_type argument_type;
|
||||
};
|
||||
|
||||
template <class R, class A>
|
||||
struct unary_traits<R(*)(A)>
|
||||
{
|
||||
typedef R (*function_type)(A);
|
||||
typedef R (*param_type)(A);
|
||||
typedef R result_type;
|
||||
typedef A argument_type;
|
||||
};
|
||||
|
||||
template <class Operation>
|
||||
struct binary_traits
|
||||
{
|
||||
typedef typename detail::binary_traits_imp<Operation*>::function_type function_type;
|
||||
typedef typename detail::binary_traits_imp<Operation*>::param_type param_type;
|
||||
typedef typename detail::binary_traits_imp<Operation*>::result_type result_type;
|
||||
typedef typename detail::binary_traits_imp<Operation*>::first_argument_type first_argument_type;
|
||||
typedef typename detail::binary_traits_imp<Operation*>::second_argument_type second_argument_type;
|
||||
};
|
||||
|
||||
template <class R, class A1, class A2>
|
||||
struct binary_traits<R(*)(A1,A2)>
|
||||
{
|
||||
typedef R (*function_type)(A1,A2);
|
||||
typedef R (*param_type)(A1,A2);
|
||||
typedef R result_type;
|
||||
typedef A1 first_argument_type;
|
||||
typedef A2 second_argument_type;
|
||||
};
|
||||
#else // BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
|
||||
// --------------------------------------------------------------------------
|
||||
// If we have no partial specialisation available, decay to a situation
|
||||
// that is no worse than in the Standard, i.e., ptr_fun will be required.
|
||||
// --------------------------------------------------------------------------
|
||||
|
||||
template <class Operation>
|
||||
struct unary_traits
|
||||
{
|
||||
typedef Operation function_type;
|
||||
typedef const Operation& param_type;
|
||||
typedef typename Operation::result_type result_type;
|
||||
typedef typename Operation::argument_type argument_type;
|
||||
};
|
||||
|
||||
template <class Operation>
|
||||
struct binary_traits
|
||||
{
|
||||
typedef Operation function_type;
|
||||
typedef const Operation & param_type;
|
||||
typedef typename Operation::result_type result_type;
|
||||
typedef typename Operation::first_argument_type first_argument_type;
|
||||
typedef typename Operation::second_argument_type second_argument_type;
|
||||
};
|
||||
#endif // BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
|
||||
|
||||
// --------------------------------------------------------------------------
|
||||
// unary_negate, not1
|
||||
// --------------------------------------------------------------------------
|
||||
template <class Predicate>
|
||||
class unary_negate
|
||||
: public std::unary_function<typename unary_traits<Predicate>::argument_type,bool>
|
||||
{
|
||||
public:
|
||||
explicit unary_negate(typename unary_traits<Predicate>::param_type x)
|
||||
:
|
||||
pred(x)
|
||||
{}
|
||||
bool operator()(typename call_traits<typename unary_traits<Predicate>::argument_type>::param_type x) const
|
||||
{
|
||||
return !pred(x);
|
||||
}
|
||||
private:
|
||||
typename unary_traits<Predicate>::function_type pred;
|
||||
};
|
||||
|
||||
template <class Predicate>
|
||||
unary_negate<Predicate> not1(const Predicate &pred)
|
||||
{
|
||||
// The cast is to placate Borland C++Builder in certain circumstances.
|
||||
// I don't think it should be necessary.
|
||||
return unary_negate<Predicate>((typename unary_traits<Predicate>::param_type)pred);
|
||||
}
|
||||
|
||||
template <class Predicate>
|
||||
unary_negate<Predicate> not1(Predicate &pred)
|
||||
{
|
||||
return unary_negate<Predicate>(pred);
|
||||
}
|
||||
|
||||
// --------------------------------------------------------------------------
|
||||
// binary_negate, not2
|
||||
// --------------------------------------------------------------------------
|
||||
template <class Predicate>
|
||||
class binary_negate
|
||||
: public std::binary_function<typename binary_traits<Predicate>::first_argument_type,
|
||||
typename binary_traits<Predicate>::second_argument_type,
|
||||
bool>
|
||||
{
|
||||
public:
|
||||
explicit binary_negate(typename binary_traits<Predicate>::param_type x)
|
||||
:
|
||||
pred(x)
|
||||
{}
|
||||
bool operator()(typename call_traits<typename binary_traits<Predicate>::first_argument_type>::param_type x,
|
||||
typename call_traits<typename binary_traits<Predicate>::second_argument_type>::param_type y) const
|
||||
{
|
||||
return !pred(x,y);
|
||||
}
|
||||
private:
|
||||
typename binary_traits<Predicate>::function_type pred;
|
||||
};
|
||||
|
||||
template <class Predicate>
|
||||
binary_negate<Predicate> not2(const Predicate &pred)
|
||||
{
|
||||
// The cast is to placate Borland C++Builder in certain circumstances.
|
||||
// I don't think it should be necessary.
|
||||
return binary_negate<Predicate>((typename binary_traits<Predicate>::param_type)pred);
|
||||
}
|
||||
|
||||
template <class Predicate>
|
||||
binary_negate<Predicate> not2(Predicate &pred)
|
||||
{
|
||||
return binary_negate<Predicate>(pred);
|
||||
}
|
||||
|
||||
// --------------------------------------------------------------------------
|
||||
// binder1st, bind1st
|
||||
// --------------------------------------------------------------------------
|
||||
template <class Operation>
|
||||
class binder1st
|
||||
: public std::unary_function<typename binary_traits<Operation>::second_argument_type,
|
||||
typename binary_traits<Operation>::result_type>
|
||||
{
|
||||
public:
|
||||
binder1st(typename binary_traits<Operation>::param_type x,
|
||||
typename call_traits<typename binary_traits<Operation>::first_argument_type>::param_type y)
|
||||
:
|
||||
op(x), value(y)
|
||||
{}
|
||||
|
||||
typename binary_traits<Operation>::result_type
|
||||
operator()(typename call_traits<typename binary_traits<Operation>::second_argument_type>::param_type x) const
|
||||
{
|
||||
return op(value, x);
|
||||
}
|
||||
|
||||
protected:
|
||||
typename binary_traits<Operation>::function_type op;
|
||||
typename binary_traits<Operation>::first_argument_type value;
|
||||
};
|
||||
|
||||
template <class Operation>
|
||||
inline binder1st<Operation> bind1st(const Operation &op,
|
||||
typename call_traits<
|
||||
typename binary_traits<Operation>::first_argument_type
|
||||
>::param_type x)
|
||||
{
|
||||
// The cast is to placate Borland C++Builder in certain circumstances.
|
||||
// I don't think it should be necessary.
|
||||
return binder1st<Operation>((typename binary_traits<Operation>::param_type)op, x);
|
||||
}
|
||||
|
||||
template <class Operation>
|
||||
inline binder1st<Operation> bind1st(Operation &op,
|
||||
typename call_traits<
|
||||
typename binary_traits<Operation>::first_argument_type
|
||||
>::param_type x)
|
||||
{
|
||||
return binder1st<Operation>(op, x);
|
||||
}
|
||||
|
||||
// --------------------------------------------------------------------------
|
||||
// binder2nd, bind2nd
|
||||
// --------------------------------------------------------------------------
|
||||
template <class Operation>
|
||||
class binder2nd
|
||||
: public std::unary_function<typename binary_traits<Operation>::first_argument_type,
|
||||
typename binary_traits<Operation>::result_type>
|
||||
{
|
||||
public:
|
||||
binder2nd(typename binary_traits<Operation>::param_type x,
|
||||
typename call_traits<typename binary_traits<Operation>::second_argument_type>::param_type y)
|
||||
:
|
||||
op(x), value(y)
|
||||
{}
|
||||
|
||||
typename binary_traits<Operation>::result_type
|
||||
operator()(typename call_traits<typename binary_traits<Operation>::first_argument_type>::param_type x) const
|
||||
{
|
||||
return op(x, value);
|
||||
}
|
||||
|
||||
protected:
|
||||
typename binary_traits<Operation>::function_type op;
|
||||
typename binary_traits<Operation>::second_argument_type value;
|
||||
};
|
||||
|
||||
template <class Operation>
|
||||
inline binder2nd<Operation> bind2nd(const Operation &op,
|
||||
typename call_traits<
|
||||
typename binary_traits<Operation>::second_argument_type
|
||||
>::param_type x)
|
||||
{
|
||||
// The cast is to placate Borland C++Builder in certain circumstances.
|
||||
// I don't think it should be necessary.
|
||||
return binder2nd<Operation>((typename binary_traits<Operation>::param_type)op, x);
|
||||
}
|
||||
|
||||
template <class Operation>
|
||||
inline binder2nd<Operation> bind2nd(Operation &op,
|
||||
typename call_traits<
|
||||
typename binary_traits<Operation>::second_argument_type
|
||||
>::param_type x)
|
||||
{
|
||||
return binder2nd<Operation>(op, x);
|
||||
}
|
||||
|
||||
// --------------------------------------------------------------------------
|
||||
// mem_fun, etc
|
||||
// --------------------------------------------------------------------------
|
||||
template <class S, class T>
|
||||
class mem_fun_t : public std::unary_function<T*, S>
|
||||
{
|
||||
public:
|
||||
explicit mem_fun_t(S (T::*p)())
|
||||
:
|
||||
ptr(p)
|
||||
{}
|
||||
S operator()(T* p) const
|
||||
{
|
||||
return (p->*ptr)();
|
||||
}
|
||||
private:
|
||||
S (T::*ptr)();
|
||||
};
|
||||
|
||||
template <class S, class T, class A>
|
||||
class mem_fun1_t : public std::binary_function<T*, A, S>
|
||||
{
|
||||
public:
|
||||
explicit mem_fun1_t(S (T::*p)(A))
|
||||
:
|
||||
ptr(p)
|
||||
{}
|
||||
S operator()(T* p, typename call_traits<A>::param_type x) const
|
||||
{
|
||||
return (p->*ptr)(x);
|
||||
}
|
||||
private:
|
||||
S (T::*ptr)(A);
|
||||
};
|
||||
|
||||
template <class S, class T>
|
||||
class const_mem_fun_t : public std::unary_function<const T*, S>
|
||||
{
|
||||
public:
|
||||
explicit const_mem_fun_t(S (T::*p)() const)
|
||||
:
|
||||
ptr(p)
|
||||
{}
|
||||
S operator()(const T* p) const
|
||||
{
|
||||
return (p->*ptr)();
|
||||
}
|
||||
private:
|
||||
S (T::*ptr)() const;
|
||||
};
|
||||
|
||||
template <class S, class T, class A>
|
||||
class const_mem_fun1_t : public std::binary_function<const T*, A, S>
|
||||
{
|
||||
public:
|
||||
explicit const_mem_fun1_t(S (T::*p)(A) const)
|
||||
:
|
||||
ptr(p)
|
||||
{}
|
||||
S operator()(const T* p, typename call_traits<A>::param_type x) const
|
||||
{
|
||||
return (p->*ptr)(x);
|
||||
}
|
||||
private:
|
||||
S (T::*ptr)(A) const;
|
||||
};
|
||||
|
||||
template<class S, class T>
|
||||
inline mem_fun_t<S,T> mem_fun(S (T::*f)())
|
||||
{
|
||||
return mem_fun_t<S,T>(f);
|
||||
}
|
||||
|
||||
template<class S, class T, class A>
|
||||
inline mem_fun1_t<S,T,A> mem_fun(S (T::*f)(A))
|
||||
{
|
||||
return mem_fun1_t<S,T,A>(f);
|
||||
}
|
||||
|
||||
#ifndef BOOST_NO_POINTER_TO_MEMBER_CONST
|
||||
template<class S, class T>
|
||||
inline const_mem_fun_t<S,T> mem_fun(S (T::*f)() const)
|
||||
{
|
||||
return const_mem_fun_t<S,T>(f);
|
||||
}
|
||||
|
||||
template<class S, class T, class A>
|
||||
inline const_mem_fun1_t<S,T,A> mem_fun(S (T::*f)(A) const)
|
||||
{
|
||||
return const_mem_fun1_t<S,T,A>(f);
|
||||
}
|
||||
#endif // BOOST_NO_POINTER_TO_MEMBER_CONST
|
||||
|
||||
// --------------------------------------------------------------------------
|
||||
// mem_fun_ref, etc
|
||||
// --------------------------------------------------------------------------
|
||||
template <class S, class T>
|
||||
class mem_fun_ref_t : public std::unary_function<T&, S>
|
||||
{
|
||||
public:
|
||||
explicit mem_fun_ref_t(S (T::*p)())
|
||||
:
|
||||
ptr(p)
|
||||
{}
|
||||
S operator()(T& p) const
|
||||
{
|
||||
return (p.*ptr)();
|
||||
}
|
||||
private:
|
||||
S (T::*ptr)();
|
||||
};
|
||||
|
||||
template <class S, class T, class A>
|
||||
class mem_fun1_ref_t : public std::binary_function<T&, A, S>
|
||||
{
|
||||
public:
|
||||
explicit mem_fun1_ref_t(S (T::*p)(A))
|
||||
:
|
||||
ptr(p)
|
||||
{}
|
||||
S operator()(T& p, typename call_traits<A>::param_type x) const
|
||||
{
|
||||
return (p.*ptr)(x);
|
||||
}
|
||||
private:
|
||||
S (T::*ptr)(A);
|
||||
};
|
||||
|
||||
template <class S, class T>
|
||||
class const_mem_fun_ref_t : public std::unary_function<const T&, S>
|
||||
{
|
||||
public:
|
||||
explicit const_mem_fun_ref_t(S (T::*p)() const)
|
||||
:
|
||||
ptr(p)
|
||||
{}
|
||||
|
||||
S operator()(const T &p) const
|
||||
{
|
||||
return (p.*ptr)();
|
||||
}
|
||||
private:
|
||||
S (T::*ptr)() const;
|
||||
};
|
||||
|
||||
template <class S, class T, class A>
|
||||
class const_mem_fun1_ref_t : public std::binary_function<const T&, A, S>
|
||||
{
|
||||
public:
|
||||
explicit const_mem_fun1_ref_t(S (T::*p)(A) const)
|
||||
:
|
||||
ptr(p)
|
||||
{}
|
||||
|
||||
S operator()(const T& p, typename call_traits<A>::param_type x) const
|
||||
{
|
||||
return (p.*ptr)(x);
|
||||
}
|
||||
private:
|
||||
S (T::*ptr)(A) const;
|
||||
};
|
||||
|
||||
template<class S, class T>
|
||||
inline mem_fun_ref_t<S,T> mem_fun_ref(S (T::*f)())
|
||||
{
|
||||
return mem_fun_ref_t<S,T>(f);
|
||||
}
|
||||
|
||||
template<class S, class T, class A>
|
||||
inline mem_fun1_ref_t<S,T,A> mem_fun_ref(S (T::*f)(A))
|
||||
{
|
||||
return mem_fun1_ref_t<S,T,A>(f);
|
||||
}
|
||||
|
||||
#ifndef BOOST_NO_POINTER_TO_MEMBER_CONST
|
||||
template<class S, class T>
|
||||
inline const_mem_fun_ref_t<S,T> mem_fun_ref(S (T::*f)() const)
|
||||
{
|
||||
return const_mem_fun_ref_t<S,T>(f);
|
||||
}
|
||||
|
||||
template<class S, class T, class A>
|
||||
inline const_mem_fun1_ref_t<S,T,A> mem_fun_ref(S (T::*f)(A) const)
|
||||
{
|
||||
return const_mem_fun1_ref_t<S,T,A>(f);
|
||||
}
|
||||
#endif // BOOST_NO_POINTER_TO_MEMBER_CONST
|
||||
|
||||
// --------------------------------------------------------------------------
|
||||
// ptr_fun
|
||||
// --------------------------------------------------------------------------
|
||||
template <class Arg, class Result>
|
||||
class pointer_to_unary_function : public std::unary_function<Arg,Result>
|
||||
{
|
||||
public:
|
||||
explicit pointer_to_unary_function(Result (*f)(Arg))
|
||||
:
|
||||
func(f)
|
||||
{}
|
||||
|
||||
Result operator()(typename call_traits<Arg>::param_type x) const
|
||||
{
|
||||
return func(x);
|
||||
}
|
||||
|
||||
private:
|
||||
Result (*func)(Arg);
|
||||
};
|
||||
|
||||
template <class Arg, class Result>
|
||||
inline pointer_to_unary_function<Arg,Result> ptr_fun(Result (*f)(Arg))
|
||||
{
|
||||
return pointer_to_unary_function<Arg,Result>(f);
|
||||
}
|
||||
|
||||
template <class Arg1, class Arg2, class Result>
|
||||
class pointer_to_binary_function : public std::binary_function<Arg1,Arg2,Result>
|
||||
{
|
||||
public:
|
||||
explicit pointer_to_binary_function(Result (*f)(Arg1, Arg2))
|
||||
:
|
||||
func(f)
|
||||
{}
|
||||
|
||||
Result operator()(typename call_traits<Arg1>::param_type x, typename call_traits<Arg2>::param_type y) const
|
||||
{
|
||||
return func(x,y);
|
||||
}
|
||||
|
||||
private:
|
||||
Result (*func)(Arg1, Arg2);
|
||||
};
|
||||
|
||||
template <class Arg1, class Arg2, class Result>
|
||||
inline pointer_to_binary_function<Arg1,Arg2,Result> ptr_fun(Result (*f)(Arg1, Arg2))
|
||||
{
|
||||
return pointer_to_binary_function<Arg1,Arg2,Result>(f);
|
||||
}
|
||||
} // namespace boost
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,145 @@
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
/// \file pass_through.hpp
|
||||
///
|
||||
/// Definition of the pass_through transform, which is the default transform
|
||||
/// of all of the expression generator metafunctions such as unary_plus<>, plus<>
|
||||
/// and nary_expr<>.
|
||||
//
|
||||
// Copyright 2008 Eric Niebler. Distributed under the Boost
|
||||
// Software License, Version 1.0. (See accompanying file
|
||||
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
#ifndef BOOST_PROTO_TRANSFORM_PASS_THROUGH_HPP_EAN_12_26_2006
|
||||
#define BOOST_PROTO_TRANSFORM_PASS_THROUGH_HPP_EAN_12_26_2006
|
||||
|
||||
#include <boost/preprocessor/cat.hpp>
|
||||
#include <boost/preprocessor/repetition/enum.hpp>
|
||||
#include <boost/preprocessor/iteration/iterate.hpp>
|
||||
#include <boost/mpl/bool.hpp>
|
||||
#include <boost/mpl/if.hpp>
|
||||
#include <boost/type_traits/is_same.hpp>
|
||||
#include <boost/type_traits/remove_reference.hpp>
|
||||
#include <boost/proto/proto_fwd.hpp>
|
||||
#include <boost/proto/args.hpp>
|
||||
#include <boost/proto/transform/impl.hpp>
|
||||
#include <boost/proto/detail/ignore_unused.hpp>
|
||||
|
||||
#if defined(_MSC_VER)
|
||||
# pragma warning(push)
|
||||
# pragma warning(disable : 4714) // function 'xxx' marked as __forceinline not inlined
|
||||
#endif
|
||||
|
||||
namespace boost { namespace proto
|
||||
{
|
||||
namespace detail
|
||||
{
|
||||
template<
|
||||
typename Grammar
|
||||
, typename Domain
|
||||
, typename Expr
|
||||
, typename State
|
||||
, typename Data
|
||||
, long Arity = arity_of<Expr>::value
|
||||
>
|
||||
struct pass_through_impl
|
||||
{};
|
||||
|
||||
#include <boost/proto/transform/detail/pass_through_impl.hpp>
|
||||
|
||||
template<typename Grammar, typename Domain, typename Expr, typename State, typename Data>
|
||||
struct pass_through_impl<Grammar, Domain, Expr, State, Data, 0>
|
||||
: transform_impl<Expr, State, Data>
|
||||
{
|
||||
typedef Expr result_type;
|
||||
|
||||
/// \param e An expression
|
||||
/// \return \c e
|
||||
/// \throw nothrow
|
||||
BOOST_FORCEINLINE
|
||||
BOOST_PROTO_RETURN_TYPE_STRICT_LOOSE(result_type, typename pass_through_impl::expr_param)
|
||||
operator()(
|
||||
typename pass_through_impl::expr_param e
|
||||
, typename pass_through_impl::state_param
|
||||
, typename pass_through_impl::data_param
|
||||
) const
|
||||
{
|
||||
return e;
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace detail
|
||||
|
||||
/// \brief A PrimitiveTransform that transforms the child expressions
|
||||
/// of an expression node according to the corresponding children of
|
||||
/// a Grammar.
|
||||
///
|
||||
/// Given a Grammar such as <tt>plus\<T0, T1\></tt>, an expression type
|
||||
/// that matches the grammar such as <tt>plus\<E0, E1\>::type</tt>, a
|
||||
/// state \c S and a data \c V, the result of applying the
|
||||
/// <tt>pass_through\<plus\<T0, T1\> \></tt> transform is:
|
||||
///
|
||||
/// \code
|
||||
/// plus<
|
||||
/// T0::result<T0(E0, S, V)>::type
|
||||
/// , T1::result<T1(E1, S, V)>::type
|
||||
/// >::type
|
||||
/// \endcode
|
||||
///
|
||||
/// The above demonstrates how child transforms and child expressions
|
||||
/// are applied pairwise, and how the results are reassembled into a new
|
||||
/// expression node with the same tag type as the original.
|
||||
///
|
||||
/// The explicit use of <tt>pass_through\<\></tt> is not usually needed,
|
||||
/// since the expression generator metafunctions such as
|
||||
/// <tt>plus\<\></tt> have <tt>pass_through\<\></tt> as their default
|
||||
/// transform. So, for instance, these are equivalent:
|
||||
///
|
||||
/// \code
|
||||
/// // Within a grammar definition, these are equivalent:
|
||||
/// when< plus<X, Y>, pass_through< plus<X, Y> > >
|
||||
/// when< plus<X, Y>, plus<X, Y> >
|
||||
/// when< plus<X, Y> > // because of when<class X, class Y=X>
|
||||
/// plus<X, Y> // because plus<> is both a
|
||||
/// // grammar and a transform
|
||||
/// \endcode
|
||||
///
|
||||
/// For example, consider the following transform that promotes all
|
||||
/// \c float terminals in an expression to \c double.
|
||||
///
|
||||
/// \code
|
||||
/// // This transform finds all float terminals in an expression and promotes
|
||||
/// // them to doubles.
|
||||
/// struct Promote
|
||||
/// : or_<
|
||||
/// when<terminal<float>, terminal<double>::type(_value) >
|
||||
/// // terminal<>'s default transform is a no-op:
|
||||
/// , terminal<_>
|
||||
/// // nary_expr<> has a pass_through<> transform:
|
||||
/// , nary_expr<_, vararg<Promote> >
|
||||
/// >
|
||||
/// {};
|
||||
/// \endcode
|
||||
template<typename Grammar, typename Domain /* = deduce_domain*/>
|
||||
struct pass_through
|
||||
: transform<pass_through<Grammar, Domain> >
|
||||
{
|
||||
template<typename Expr, typename State, typename Data>
|
||||
struct impl
|
||||
: detail::pass_through_impl<Grammar, Domain, Expr, State, Data>
|
||||
{};
|
||||
};
|
||||
|
||||
/// INTERNAL ONLY
|
||||
///
|
||||
template<typename Grammar, typename Domain>
|
||||
struct is_callable<pass_through<Grammar, Domain> >
|
||||
: mpl::true_
|
||||
{};
|
||||
|
||||
}} // namespace boost::proto
|
||||
|
||||
#if defined(_MSC_VER)
|
||||
# pragma warning(pop)
|
||||
#endif
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,72 @@
|
||||
// (C) Copyright John Maddock 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)
|
||||
//
|
||||
// This file is machine generated, do not edit by hand
|
||||
|
||||
// Polynomial evaluation using Horners rule
|
||||
#ifndef BOOST_MATH_TOOLS_POLY_EVAL_8_HPP
|
||||
#define BOOST_MATH_TOOLS_POLY_EVAL_8_HPP
|
||||
|
||||
namespace boost{ namespace math{ namespace tools{ namespace detail{
|
||||
|
||||
template <class T, class V>
|
||||
inline V evaluate_polynomial_c_imp(const T*, const V&, const mpl::int_<0>*) BOOST_MATH_NOEXCEPT(V)
|
||||
{
|
||||
return static_cast<V>(0);
|
||||
}
|
||||
|
||||
template <class T, class V>
|
||||
inline V evaluate_polynomial_c_imp(const T* a, const V&, const mpl::int_<1>*) BOOST_MATH_NOEXCEPT(V)
|
||||
{
|
||||
return static_cast<V>(a[0]);
|
||||
}
|
||||
|
||||
template <class T, class V>
|
||||
inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<2>*) BOOST_MATH_NOEXCEPT(V)
|
||||
{
|
||||
return static_cast<V>(a[1] * x + a[0]);
|
||||
}
|
||||
|
||||
template <class T, class V>
|
||||
inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<3>*) BOOST_MATH_NOEXCEPT(V)
|
||||
{
|
||||
return static_cast<V>((a[2] * x + a[1]) * x + a[0]);
|
||||
}
|
||||
|
||||
template <class T, class V>
|
||||
inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<4>*) BOOST_MATH_NOEXCEPT(V)
|
||||
{
|
||||
return static_cast<V>(((a[3] * x + a[2]) * x + a[1]) * x + a[0]);
|
||||
}
|
||||
|
||||
template <class T, class V>
|
||||
inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<5>*) BOOST_MATH_NOEXCEPT(V)
|
||||
{
|
||||
return static_cast<V>((((a[4] * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]);
|
||||
}
|
||||
|
||||
template <class T, class V>
|
||||
inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<6>*) BOOST_MATH_NOEXCEPT(V)
|
||||
{
|
||||
return static_cast<V>(((((a[5] * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]);
|
||||
}
|
||||
|
||||
template <class T, class V>
|
||||
inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<7>*) BOOST_MATH_NOEXCEPT(V)
|
||||
{
|
||||
return static_cast<V>((((((a[6] * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]);
|
||||
}
|
||||
|
||||
template <class T, class V>
|
||||
inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<8>*) BOOST_MATH_NOEXCEPT(V)
|
||||
{
|
||||
return static_cast<V>(((((((a[7] * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]);
|
||||
}
|
||||
|
||||
|
||||
}}}} // namespaces
|
||||
|
||||
#endif // include guard
|
||||
|
||||
@@ -0,0 +1,81 @@
|
||||
|
||||
#if !defined(BOOST_PHOENIX_DONT_USE_PREPROCESSED_FILES)
|
||||
#ifndef BOOST_PHOENIX_OBJECT_DETAIL_CONSTRUCT_EVAL_HPP
|
||||
#define BOOST_PHOENIX_OBJECT_DETAIL_CONSTRUCT_EVAL_HPP
|
||||
|
||||
#include <boost/phoenix/object/detail/cpp03/preprocessed/construct_eval.hpp>
|
||||
|
||||
#endif
|
||||
#else
|
||||
|
||||
#if !BOOST_PHOENIX_IS_ITERATING
|
||||
|
||||
#ifndef BOOST_PHOENIX_OBJECT_DETAIL_CONSTRUCT_EVAL_HPP
|
||||
#define BOOST_PHOENIX_OBJECT_DETAIL_CONSTRUCT_EVAL_HPP
|
||||
|
||||
#include <boost/preprocessor/repetition/enum_shifted_binary_params.hpp>
|
||||
|
||||
#if defined(__WAVE__) && defined(BOOST_PHOENIX_CREATE_PREPROCESSED_FILES)
|
||||
#pragma wave option(preserve: 2, line: 0, output: "preprocessed/construct_eval_" BOOST_PHOENIX_LIMIT_STR ".hpp")
|
||||
#endif
|
||||
|
||||
/*==============================================================================
|
||||
Copyright (c) 2005-2010 Joel de Guzman
|
||||
Copyright (c) 2010 Thomas Heller
|
||||
|
||||
Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
==============================================================================*/
|
||||
|
||||
#if defined(__WAVE__) && defined(BOOST_PHOENIX_CREATE_PREPROCESSED_FILES)
|
||||
#pragma wave option(preserve: 1)
|
||||
#endif
|
||||
|
||||
#define BOOST_PHOENIX_ITERATION_PARAMS \
|
||||
(3, (2, BOOST_PHOENIX_COMPOSITE_LIMIT, \
|
||||
<boost/phoenix/object/detail/cpp03/construct_eval.hpp>))
|
||||
#include BOOST_PHOENIX_ITERATE()
|
||||
|
||||
#if defined(__WAVE__) && defined(BOOST_PHOENIX_CREATE_PREPROCESSED_FILES)
|
||||
#pragma wave option(output: null)
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
#else
|
||||
|
||||
template <typename This, BOOST_PHOENIX_typename_A, typename Context>
|
||||
struct result<This(BOOST_PHOENIX_A, Context)>
|
||||
: detail::result_of::target<A0>
|
||||
{
|
||||
};
|
||||
|
||||
template <BOOST_PHOENIX_typename_A, typename Context>
|
||||
typename detail::result_of::target<A0>::type
|
||||
operator()(
|
||||
A0 const&
|
||||
, BOOST_PP_ENUM_SHIFTED_BINARY_PARAMS(
|
||||
BOOST_PHOENIX_ITERATION
|
||||
, A
|
||||
, const& a
|
||||
)
|
||||
, Context const & ctx
|
||||
) const
|
||||
{
|
||||
#define EVAL_a(_,n,__) \
|
||||
BOOST_PP_COMMA_IF(BOOST_PP_DEC(n)) boost::phoenix::eval(a ## n, ctx)
|
||||
|
||||
return
|
||||
typename detail::result_of::target<A0>::type(
|
||||
BOOST_PP_REPEAT_FROM_TO(
|
||||
1
|
||||
, BOOST_PHOENIX_ITERATION
|
||||
, EVAL_a, _
|
||||
)
|
||||
);
|
||||
#undef EVAL_a
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
#endif // BOOST_PHOENIX_DONT_USE_PREPROCESSED_FILES
|
||||
@@ -0,0 +1,93 @@
|
||||
/*
|
||||
*
|
||||
* Copyright (c) 1998-2002
|
||||
* John Maddock
|
||||
*
|
||||
* 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)
|
||||
*
|
||||
*/
|
||||
|
||||
/*
|
||||
* LOCATION: see http://www.boost.org for most recent version.
|
||||
* FILE user.hpp
|
||||
* VERSION see <boost/version.hpp>
|
||||
* DESCRIPTION: User settable options.
|
||||
*/
|
||||
|
||||
// define if you want the regex library to use the C locale
|
||||
// even on Win32:
|
||||
// #define BOOST_REGEX_USE_C_LOCALE
|
||||
|
||||
// define this is you want the regex library to use the C++
|
||||
// locale:
|
||||
// #define BOOST_REGEX_USE_CPP_LOCALE
|
||||
|
||||
// define this if the runtime library is a dll, and you
|
||||
// want BOOST_REGEX_DYN_LINK to set up dll exports/imports
|
||||
// with __declspec(dllexport)/__declspec(dllimport.)
|
||||
// #define BOOST_REGEX_HAS_DLL_RUNTIME
|
||||
|
||||
// define this if you want to dynamically link to regex,
|
||||
// if the runtime library is also a dll (Probably Win32 specific,
|
||||
// and has no effect unless BOOST_REGEX_HAS_DLL_RUNTIME is set):
|
||||
// #define BOOST_REGEX_DYN_LINK
|
||||
|
||||
// define this if you don't want the lib to automatically
|
||||
// select its link libraries:
|
||||
// #define BOOST_REGEX_NO_LIB
|
||||
|
||||
// define this if templates with switch statements cause problems:
|
||||
// #define BOOST_REGEX_NO_TEMPLATE_SWITCH_MERGE
|
||||
|
||||
// define this to disable Win32 support when available:
|
||||
// #define BOOST_REGEX_NO_W32
|
||||
|
||||
// define this if bool is not a real type:
|
||||
// #define BOOST_REGEX_NO_BOOL
|
||||
|
||||
// define this if no template instances are to be placed in
|
||||
// the library rather than users object files:
|
||||
// #define BOOST_REGEX_NO_EXTERNAL_TEMPLATES
|
||||
|
||||
// define this if the forward declarations in regex_fwd.hpp
|
||||
// cause more problems than they are worth:
|
||||
// #define BOOST_REGEX_NO_FWD
|
||||
|
||||
// define this if your compiler supports MS Windows structured
|
||||
// exception handling.
|
||||
// #define BOOST_REGEX_HAS_MS_STACK_GUARD
|
||||
|
||||
// define this if you want to use the recursive algorithm
|
||||
// even if BOOST_REGEX_HAS_MS_STACK_GUARD is not defined.
|
||||
// #define BOOST_REGEX_RECURSIVE
|
||||
|
||||
// define this if you want to use the non-recursive
|
||||
// algorithm, even if the recursive version would be the default.
|
||||
// #define BOOST_REGEX_NON_RECURSIVE
|
||||
|
||||
// define this if you want to set the size of the memory blocks
|
||||
// used by the non-recursive algorithm.
|
||||
// #define BOOST_REGEX_BLOCKSIZE 4096
|
||||
|
||||
// define this if you want to set the maximum number of memory blocks
|
||||
// used by the non-recursive algorithm.
|
||||
// #define BOOST_REGEX_MAX_BLOCKS 1024
|
||||
|
||||
// define this if you want to set the maximum number of memory blocks
|
||||
// cached by the non-recursive algorithm: Normally this is 16, but can be
|
||||
// higher if you have multiple threads all using boost.regex, or lower
|
||||
// if you don't want boost.regex to cache memory.
|
||||
// #define BOOST_REGEX_MAX_CACHE_BLOCKS 16
|
||||
|
||||
// define this if you want to be able to access extended capture
|
||||
// information in your sub_match's (caution this will slow things
|
||||
// down quite a bit).
|
||||
// #define BOOST_REGEX_MATCH_EXTRA
|
||||
|
||||
// define this if you want to enable support for Unicode via ICU.
|
||||
// #define BOOST_HAS_ICU
|
||||
|
||||
// define this if you want regex to use __cdecl calling convensions, even when __fastcall is available:
|
||||
// #define BOOST_REGEX_NO_FASTCALL
|
||||
@@ -0,0 +1,98 @@
|
||||
|
||||
// Copyright Aleksey Gurtovoy 2000-2004
|
||||
//
|
||||
// Distributed under the Boost Software License, Version 1.0.
|
||||
// (See accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
//
|
||||
|
||||
// Preprocessed version of "boost/mpl/less_equal.hpp" header
|
||||
// -- DO NOT modify by hand!
|
||||
|
||||
namespace boost { namespace mpl {
|
||||
|
||||
template<
|
||||
typename Tag1
|
||||
, typename Tag2
|
||||
>
|
||||
struct less_equal_impl
|
||||
: if_c<
|
||||
( BOOST_MPL_AUX_NESTED_VALUE_WKND(int, Tag1)
|
||||
> BOOST_MPL_AUX_NESTED_VALUE_WKND(int, Tag2)
|
||||
)
|
||||
|
||||
, aux::cast2nd_impl< less_equal_impl< Tag1,Tag1 >,Tag1, Tag2 >
|
||||
, aux::cast1st_impl< less_equal_impl< Tag2,Tag2 >,Tag1, Tag2 >
|
||||
>::type
|
||||
{
|
||||
};
|
||||
|
||||
/// for Digital Mars C++/compilers with no CTPS/TTP support
|
||||
template<> struct less_equal_impl< na,na >
|
||||
{
|
||||
template< typename U1, typename U2 > struct apply
|
||||
{
|
||||
typedef apply type;
|
||||
BOOST_STATIC_CONSTANT(int, value = 0);
|
||||
};
|
||||
};
|
||||
|
||||
template< typename Tag > struct less_equal_impl< na,Tag >
|
||||
{
|
||||
template< typename U1, typename U2 > struct apply
|
||||
{
|
||||
typedef apply type;
|
||||
BOOST_STATIC_CONSTANT(int, value = 0);
|
||||
};
|
||||
};
|
||||
|
||||
template< typename Tag > struct less_equal_impl< Tag,na >
|
||||
{
|
||||
template< typename U1, typename U2 > struct apply
|
||||
{
|
||||
typedef apply type;
|
||||
BOOST_STATIC_CONSTANT(int, value = 0);
|
||||
};
|
||||
};
|
||||
|
||||
template< typename T > struct less_equal_tag
|
||||
{
|
||||
typedef typename T::tag type;
|
||||
};
|
||||
|
||||
template<
|
||||
typename BOOST_MPL_AUX_NA_PARAM(N1)
|
||||
, typename BOOST_MPL_AUX_NA_PARAM(N2)
|
||||
>
|
||||
struct less_equal
|
||||
|
||||
: less_equal_impl<
|
||||
typename less_equal_tag<N1>::type
|
||||
, typename less_equal_tag<N2>::type
|
||||
>::template apply< N1,N2 >::type
|
||||
{
|
||||
BOOST_MPL_AUX_LAMBDA_SUPPORT(2, less_equal, (N1, N2))
|
||||
|
||||
};
|
||||
|
||||
BOOST_MPL_AUX_NA_SPEC2(2, 2, less_equal)
|
||||
|
||||
}}
|
||||
|
||||
namespace boost { namespace mpl {
|
||||
|
||||
template<>
|
||||
struct less_equal_impl< integral_c_tag,integral_c_tag >
|
||||
{
|
||||
template< typename N1, typename N2 > struct apply
|
||||
|
||||
{
|
||||
BOOST_STATIC_CONSTANT(bool, value =
|
||||
( BOOST_MPL_AUX_VALUE_WKND(N1)::value <=
|
||||
BOOST_MPL_AUX_VALUE_WKND(N2)::value )
|
||||
);
|
||||
typedef bool_<value> type;
|
||||
};
|
||||
};
|
||||
|
||||
}}
|
||||
@@ -0,0 +1,95 @@
|
||||
// Copyright David Abrahams 2001.
|
||||
// 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 FORWARD_DWA20011215_HPP
|
||||
# define FORWARD_DWA20011215_HPP
|
||||
|
||||
# include <boost/mpl/if.hpp>
|
||||
# include <boost/type_traits/is_scalar.hpp>
|
||||
# include <boost/type_traits/add_const.hpp>
|
||||
# include <boost/type_traits/add_reference.hpp>
|
||||
# include <boost/ref.hpp>
|
||||
# include <boost/python/detail/value_arg.hpp>
|
||||
# include <boost/python/detail/copy_ctor_mutates_rhs.hpp>
|
||||
# include <boost/mpl/or.hpp>
|
||||
|
||||
namespace boost { namespace python { namespace objects {
|
||||
|
||||
// Very much like boost::reference_wrapper<T>, except that in this
|
||||
// case T can be a reference already without causing a
|
||||
// reference-to-reference error.
|
||||
template <class T>
|
||||
struct reference_to_value
|
||||
{
|
||||
typedef typename add_reference<typename add_const<T>::type>::type reference;
|
||||
|
||||
reference_to_value(reference x) : m_value(x) {}
|
||||
reference get() const { return m_value; }
|
||||
private:
|
||||
reference m_value;
|
||||
};
|
||||
|
||||
// A little metaprogram which selects the type to pass through an
|
||||
// intermediate forwarding function when the destination argument type
|
||||
// is T.
|
||||
template <class T>
|
||||
struct forward
|
||||
: mpl::if_<
|
||||
mpl::or_<python::detail::copy_ctor_mutates_rhs<T>, is_scalar<T> >
|
||||
, T
|
||||
, reference_to_value<T>
|
||||
>
|
||||
{
|
||||
};
|
||||
|
||||
template<typename T>
|
||||
struct unforward
|
||||
{
|
||||
typedef typename unwrap_reference<T>::type& type;
|
||||
};
|
||||
|
||||
template<typename T>
|
||||
struct unforward<reference_to_value<T> >
|
||||
{
|
||||
typedef T type;
|
||||
};
|
||||
|
||||
template <typename T>
|
||||
struct unforward_cref
|
||||
: python::detail::value_arg<
|
||||
typename unwrap_reference<T>::type
|
||||
>
|
||||
{
|
||||
};
|
||||
|
||||
template<typename T>
|
||||
struct unforward_cref<reference_to_value<T> >
|
||||
: add_reference<typename add_const<T>::type>
|
||||
{
|
||||
};
|
||||
|
||||
|
||||
template <class T>
|
||||
typename reference_to_value<T>::reference
|
||||
do_unforward(reference_to_value<T> const& x, int)
|
||||
{
|
||||
return x.get();
|
||||
}
|
||||
|
||||
template <class T>
|
||||
typename reference_wrapper<T>::type&
|
||||
do_unforward(reference_wrapper<T> const& x, int)
|
||||
{
|
||||
return x.get();
|
||||
}
|
||||
|
||||
template <class T>
|
||||
T const& do_unforward(T const& x, ...)
|
||||
{
|
||||
return x;
|
||||
}
|
||||
|
||||
}}} // namespace boost::python::objects
|
||||
|
||||
#endif // FORWARD_DWA20011215_HPP
|
||||
@@ -0,0 +1,46 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2001-2011 Joel de Guzman
|
||||
|
||||
Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
==============================================================================*/
|
||||
#if !defined(FUSION_CONS_TIE_07182005_0854)
|
||||
#define FUSION_CONS_TIE_07182005_0854
|
||||
|
||||
#include <boost/fusion/support/config.hpp>
|
||||
#include <boost/fusion/container/list/cons.hpp>
|
||||
|
||||
namespace boost { namespace fusion
|
||||
{
|
||||
struct nil_;
|
||||
|
||||
namespace result_of
|
||||
{
|
||||
template <typename Car, typename Cdr = nil_>
|
||||
struct cons_tie
|
||||
{
|
||||
typedef cons<Car&, Cdr> type;
|
||||
};
|
||||
}
|
||||
|
||||
// $$$ do we really want a cons_tie? $$$
|
||||
template <typename Car>
|
||||
BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
|
||||
inline cons<Car&>
|
||||
cons_tie(Car& car)
|
||||
{
|
||||
return cons<Car&>(car);
|
||||
}
|
||||
|
||||
// $$$ do we really want a cons_tie? $$$
|
||||
template <typename Car, typename Cdr>
|
||||
BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
|
||||
inline cons<Car&, Cdr>
|
||||
cons_tie(Car& car, Cdr const& cdr)
|
||||
{
|
||||
return cons<Car&, Cdr>(car, cdr);
|
||||
}
|
||||
}}
|
||||
|
||||
#endif
|
||||
|
||||
@@ -0,0 +1,90 @@
|
||||
<HTML><HEAD>
|
||||
|
||||
<TITLE> Sparse LU Decomposition Methods </TITLE>
|
||||
|
||||
</HEAD><BODY>
|
||||
|
||||
|
||||
<H1> Sparse LU Decomposition Methods </H1>
|
||||
|
||||
<P>The sparse modulo-2 matrix LU decomposition routine <A
|
||||
HREF="mod2sparse.html#decomp"><TT>mod2sparse_decomp</TT></A> (which
|
||||
is used by the <A HREF="encoding.html#make-gen"><TT>make-gen</TT></A>
|
||||
program when it is asked to create a sparse generator matrix) tries to
|
||||
find an sub-matrix of a matrix (for <TT>make-gen</TT>, the parity
|
||||
check matrix), and an ordering of rows and columns for this
|
||||
sub-matrix, that leads to the lower-triangular matrix <B>L</B> and the
|
||||
upper-triangular matrix <B>U</B> making up the LU decomposition being
|
||||
as sparse as possible. Finding an optimal solution is too difficult,
|
||||
so instead a heuristic strategy is used.
|
||||
|
||||
<P>The overall algorithm finds <B>L</B> and <B>U</B> a column at a
|
||||
time, from left to right (as reordered, in the case of <B>U</B>). As
|
||||
this is done, a copy, <B>B</B>, of the original matrix is modified.
|
||||
To create column <I>i</I> of <B>L</B> and <B>U</B>, some element with
|
||||
value 1 in <B>B</B> whose row and column indexes, after reordering,
|
||||
are both greater than <I>i</I> is found. The row and column of this
|
||||
element are considered to come next in the reordering, and the
|
||||
contents of the column containing this element is copied to <B>L</B>
|
||||
and <B>U</B> (upper elements going to <B>U</B>, lower to <B>L</B>).
|
||||
The row containing this element is then added to some later rows so as
|
||||
to clear the lower part of this column to zeros.
|
||||
|
||||
<P>At the first step of this process - selecting an element with value
|
||||
1 from the later rows and columns - there will often be several
|
||||
possibilities. Different choices can lead to the final result being
|
||||
more or less sparse. The possible strategies for picking an element
|
||||
are identified by the constants <TT>Mod2sparse_first</TT>,
|
||||
<TT>Mod2sparse_mincol</TT>, and <TT>Mod2sparse_minprod</TT>. These
|
||||
strategies operate as follows:
|
||||
|
||||
<P><TT>Mod2sparse_first</TT>
|
||||
<BLOCKQUOTE>
|
||||
Select the first element with value 1 that is encountered in a top
|
||||
to bottom, left to right search.
|
||||
</BLOCKQUOTE>
|
||||
|
||||
<P><TT>Mod2sparse_mincol</TT>
|
||||
<BLOCKQUOTE>
|
||||
Select the first element with value 1 that is contained in a column
|
||||
of <B>B</B> that has the smallest number of 1s of any column.
|
||||
</BLOCKQUOTE>
|
||||
|
||||
<P><TT>Mod2sparse_minprod</TT>
|
||||
<BLOCKQUOTE>
|
||||
Select an element with value 1 for which the product of the number of
|
||||
1s in that row of <B>B</B> minus one times the number of 1s in that
|
||||
column of <B>B</B> minus one is as small as possible.
|
||||
</BLOCKQUOTE>
|
||||
|
||||
<P>The <B>abandon_number</B> and <B>abandon_when</B> parameters can
|
||||
modify the basic strategy. If <B>abandon_number</B> is greater than
|
||||
zero, then after <B>abandon_when</B> columns have been selected,
|
||||
<B>abandon_number</B> of the remaining columns are abandoned as
|
||||
candidates for possible future selection, the abandoned columns being
|
||||
those with the greatest number of entries. Abandoning such columns
|
||||
saves space and time, but may make the final result less sparse than
|
||||
it would otherwise be, and can possibly result in the matrix appearing
|
||||
to have lower rank than it actually has.
|
||||
|
||||
<P>The methods described here are fairly straightforward adaptations
|
||||
of standard methods for sparse square matrices of reals, as described, for
|
||||
example, in
|
||||
<BLOCKQUOTE>
|
||||
I. S. Duff, A. M. Erisman, J. K. Reid (1986) <I>Direct Methods for
|
||||
Sparse Matrices</I>, Oxford: Clarendon Press.
|
||||
</BLOCKQUOTE>
|
||||
In the coding context, however, we are interested in matrices of
|
||||
modulo-2 elements, and it is enough to find a sparse LU decomposition
|
||||
of any square sub-matrix that can be obtained by selecting columns of
|
||||
the rectangular parity check matrix. I talked about the application
|
||||
of sparse matrix methods to encoding of LDPC codes at the 1999 IMA
|
||||
workshop on Codes, Systems and Graphical Models (see the <A
|
||||
HREF="refs.html">references</A>).
|
||||
|
||||
|
||||
<HR>
|
||||
|
||||
<A HREF="index.html">Back to index for LDPC software</A>
|
||||
|
||||
</BODY></HTML>
|
||||
@@ -0,0 +1,30 @@
|
||||
# /* **************************************************************************
|
||||
# * *
|
||||
# * (C) Copyright Paul Mensonides 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)
|
||||
# * *
|
||||
# ************************************************************************** */
|
||||
#
|
||||
# /* See http://www.boost.org for most recent version. */
|
||||
#
|
||||
# ifndef BOOST_PREPROCESSOR_DETAIL_IS_UNARY_HPP
|
||||
# define BOOST_PREPROCESSOR_DETAIL_IS_UNARY_HPP
|
||||
#
|
||||
# include <boost/preprocessor/config/config.hpp>
|
||||
# include <boost/preprocessor/detail/check.hpp>
|
||||
#
|
||||
# /* BOOST_PP_IS_UNARY */
|
||||
#
|
||||
# if ~BOOST_PP_CONFIG_FLAGS() & BOOST_PP_CONFIG_EDG()
|
||||
# define BOOST_PP_IS_UNARY(x) BOOST_PP_CHECK(x, BOOST_PP_IS_UNARY_CHECK)
|
||||
# else
|
||||
# define BOOST_PP_IS_UNARY(x) BOOST_PP_IS_UNARY_I(x)
|
||||
# define BOOST_PP_IS_UNARY_I(x) BOOST_PP_CHECK(x, BOOST_PP_IS_UNARY_CHECK)
|
||||
# endif
|
||||
#
|
||||
# define BOOST_PP_IS_UNARY_CHECK(a) 1
|
||||
# define BOOST_PP_CHECK_RESULT_BOOST_PP_IS_UNARY_CHECK 0, BOOST_PP_NIL
|
||||
#
|
||||
# endif
|
||||
@@ -0,0 +1,4 @@
|
||||
gcc -c gran.c
|
||||
gfortran -c four2a.f90
|
||||
gfortran -c f77_wisdom.f90
|
||||
gfortran -o chkfft chkfft.f90 four2a.o f77_wisdom.o gran.o -lfftw3f
|
||||
@@ -0,0 +1,182 @@
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
/// \file fold_tree.hpp
|
||||
/// Contains definition of the fold_tree<> and reverse_fold_tree<> transforms.
|
||||
//
|
||||
// Copyright 2008 Eric Niebler. Distributed under the Boost
|
||||
// Software License, Version 1.0. (See accompanying file
|
||||
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
#ifndef BOOST_PROTO_TRANSFORM_FOLD_TREE_HPP_EAN_11_05_2007
|
||||
#define BOOST_PROTO_TRANSFORM_FOLD_TREE_HPP_EAN_11_05_2007
|
||||
|
||||
#include <boost/type_traits/is_same.hpp>
|
||||
#include <boost/proto/proto_fwd.hpp>
|
||||
#include <boost/proto/traits.hpp>
|
||||
#include <boost/proto/matches.hpp>
|
||||
#include <boost/proto/transform/fold.hpp>
|
||||
#include <boost/proto/transform/impl.hpp>
|
||||
|
||||
namespace boost { namespace proto
|
||||
{
|
||||
namespace detail
|
||||
{
|
||||
template<typename Tag>
|
||||
struct has_tag
|
||||
{
|
||||
template<typename Expr, typename State, typename Data, typename EnableIf = Tag>
|
||||
struct impl
|
||||
{
|
||||
typedef mpl::false_ result_type;
|
||||
};
|
||||
|
||||
template<typename Expr, typename State, typename Data>
|
||||
struct impl<Expr, State, Data, typename Expr::proto_tag>
|
||||
{
|
||||
typedef mpl::true_ result_type;
|
||||
};
|
||||
|
||||
template<typename Expr, typename State, typename Data>
|
||||
struct impl<Expr &, State, Data, typename Expr::proto_tag>
|
||||
{
|
||||
typedef mpl::true_ result_type;
|
||||
};
|
||||
};
|
||||
|
||||
template<typename Tag, typename Fun>
|
||||
struct fold_tree_
|
||||
: if_<has_tag<Tag>, fold<_, _state, fold_tree_<Tag, Fun> >, Fun>
|
||||
{};
|
||||
|
||||
template<typename Tag, typename Fun>
|
||||
struct reverse_fold_tree_
|
||||
: if_<has_tag<Tag>, reverse_fold<_, _state, reverse_fold_tree_<Tag, Fun> >, Fun>
|
||||
{};
|
||||
}
|
||||
|
||||
/// \brief A PrimitiveTransform that recursively applies the
|
||||
/// <tt>fold\<\></tt> transform to sub-trees that all share a common
|
||||
/// tag type.
|
||||
///
|
||||
/// <tt>fold_tree\<\></tt> is useful for flattening trees into lists;
|
||||
/// for example, you might use <tt>fold_tree\<\></tt> to flatten an
|
||||
/// expression tree like <tt>a | b | c</tt> into a Fusion list like
|
||||
/// <tt>cons(c, cons(b, cons(a)))</tt>.
|
||||
///
|
||||
/// <tt>fold_tree\<\></tt> is easily understood in terms of a
|
||||
/// <tt>recurse_if_\<\></tt> helper, defined as follows:
|
||||
///
|
||||
/// \code
|
||||
/// template<typename Tag, typename Fun>
|
||||
/// struct recurse_if_
|
||||
/// : if_<
|
||||
/// // If the current node has type "Tag" ...
|
||||
/// is_same<tag_of<_>, Tag>()
|
||||
/// // ... recurse, otherwise ...
|
||||
/// , fold<_, _state, recurse_if_<Tag, Fun> >
|
||||
/// // ... apply the Fun transform.
|
||||
/// , Fun
|
||||
/// >
|
||||
/// {};
|
||||
/// \endcode
|
||||
///
|
||||
/// With <tt>recurse_if_\<\></tt> as defined above,
|
||||
/// <tt>fold_tree\<Sequence, State0, Fun\>()(e, s, d)</tt> is
|
||||
/// equivalent to
|
||||
/// <tt>fold<Sequence, State0, recurse_if_<Expr::proto_tag, Fun> >()(e, s, d).</tt>
|
||||
/// It has the effect of folding a tree front-to-back, recursing into
|
||||
/// child nodes that share a tag type with the parent node.
|
||||
template<typename Sequence, typename State0, typename Fun>
|
||||
struct fold_tree
|
||||
: transform<fold_tree<Sequence, State0, Fun> >
|
||||
{
|
||||
template<typename Expr, typename State, typename Data>
|
||||
struct impl
|
||||
: fold<
|
||||
Sequence
|
||||
, State0
|
||||
, detail::fold_tree_<typename Expr::proto_tag, Fun>
|
||||
>::template impl<Expr, State, Data>
|
||||
{};
|
||||
|
||||
template<typename Expr, typename State, typename Data>
|
||||
struct impl<Expr &, State, Data>
|
||||
: fold<
|
||||
Sequence
|
||||
, State0
|
||||
, detail::fold_tree_<typename Expr::proto_tag, Fun>
|
||||
>::template impl<Expr &, State, Data>
|
||||
{};
|
||||
};
|
||||
|
||||
/// \brief A PrimitiveTransform that recursively applies the
|
||||
/// <tt>reverse_fold\<\></tt> transform to sub-trees that all share
|
||||
/// a common tag type.
|
||||
///
|
||||
/// <tt>reverse_fold_tree\<\></tt> is useful for flattening trees into
|
||||
/// lists; for example, you might use <tt>reverse_fold_tree\<\></tt> to
|
||||
/// flatten an expression tree like <tt>a | b | c</tt> into a Fusion list
|
||||
/// like <tt>cons(a, cons(b, cons(c)))</tt>.
|
||||
///
|
||||
/// <tt>reverse_fold_tree\<\></tt> is easily understood in terms of a
|
||||
/// <tt>recurse_if_\<\></tt> helper, defined as follows:
|
||||
///
|
||||
/// \code
|
||||
/// template<typename Tag, typename Fun>
|
||||
/// struct recurse_if_
|
||||
/// : if_<
|
||||
/// // If the current node has type "Tag" ...
|
||||
/// is_same<tag_of<_>, Tag>()
|
||||
/// // ... recurse, otherwise ...
|
||||
/// , reverse_fold<_, _state, recurse_if_<Tag, Fun> >
|
||||
/// // ... apply the Fun transform.
|
||||
/// , Fun
|
||||
/// >
|
||||
/// {};
|
||||
/// \endcode
|
||||
///
|
||||
/// With <tt>recurse_if_\<\></tt> as defined above,
|
||||
/// <tt>reverse_fold_tree\<Sequence, State0, Fun\>()(e, s, d)</tt> is
|
||||
/// equivalent to
|
||||
/// <tt>reverse_fold<Sequence, State0, recurse_if_<Expr::proto_tag, Fun> >()(e, s, d).</tt>
|
||||
/// It has the effect of folding a tree back-to-front, recursing into
|
||||
/// child nodes that share a tag type with the parent node.
|
||||
template<typename Sequence, typename State0, typename Fun>
|
||||
struct reverse_fold_tree
|
||||
: transform<reverse_fold_tree<Sequence, State0, Fun> >
|
||||
{
|
||||
template<typename Expr, typename State, typename Data>
|
||||
struct impl
|
||||
: reverse_fold<
|
||||
Sequence
|
||||
, State0
|
||||
, detail::reverse_fold_tree_<typename Expr::proto_tag, Fun>
|
||||
>::template impl<Expr, State, Data>
|
||||
{};
|
||||
|
||||
template<typename Expr, typename State, typename Data>
|
||||
struct impl<Expr &, State, Data>
|
||||
: reverse_fold<
|
||||
Sequence
|
||||
, State0
|
||||
, detail::reverse_fold_tree_<typename Expr::proto_tag, Fun>
|
||||
>::template impl<Expr &, State, Data>
|
||||
{};
|
||||
};
|
||||
|
||||
/// INTERNAL ONLY
|
||||
///
|
||||
template<typename Sequence, typename State0, typename Fun>
|
||||
struct is_callable<fold_tree<Sequence, State0, Fun> >
|
||||
: mpl::true_
|
||||
{};
|
||||
|
||||
/// INTERNAL ONLY
|
||||
///
|
||||
template<typename Sequence, typename State0, typename Fun>
|
||||
struct is_callable<reverse_fold_tree<Sequence, State0, Fun> >
|
||||
: mpl::true_
|
||||
{};
|
||||
|
||||
}}
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,84 @@
|
||||
#ifndef WSPR_BAND_HOPPING_HPP__
|
||||
#define WSPR_BAND_HOPPING_HPP__
|
||||
|
||||
#include <QObject>
|
||||
|
||||
#include "pimpl_h.hpp"
|
||||
|
||||
class QSettings;
|
||||
class Configuration;
|
||||
class QWidget;
|
||||
|
||||
//
|
||||
// WSPR Band Hopping Control
|
||||
//
|
||||
// WSPR specifies a globally coordinated band hopping schedule and
|
||||
// this class implements that.
|
||||
//
|
||||
// Responsibilities
|
||||
//
|
||||
// Provides a maintenance dialog allowing the user to define which
|
||||
// bands are allowed from the band hopping schedule as defined here:
|
||||
//
|
||||
// http://physics.princeton.edu/pulsar/K1JT/doc/wspr/wspr-main.html
|
||||
//
|
||||
// Along with selecting bands a flag indicating that a short tune up
|
||||
// signal is required for specified bands before they are used for
|
||||
// receive.
|
||||
//
|
||||
// Provides a Qt property that holds the Tx percentage which is used
|
||||
// to generate a semi-randomized schedule of period to transmit. This
|
||||
// schedule is random but adjusted to limit the number of consecutive
|
||||
// transmission periods, it also adjusts the schedule to ensure that
|
||||
// the overall number of transmission periods in any two hour hopping
|
||||
// schedule reflects the percentage provided.
|
||||
//
|
||||
// Collaborations
|
||||
//
|
||||
// Settings including the selected bands with periods, the tune up
|
||||
// flags and the gray line duration are maintained in persistent
|
||||
// storage using the provided QSettings object instance.
|
||||
//
|
||||
// A passed in Configuration object instance is used to query the
|
||||
// FrequencyList_v2 model to determine working frequencies for each
|
||||
// band. The row index of this model is returned by this classes
|
||||
// hopping scheduling method so it may be conveniently used to select
|
||||
// a new working frequency by a client.
|
||||
//
|
||||
class WSPRBandHopping
|
||||
: public QObject
|
||||
{
|
||||
Q_OBJECT;
|
||||
Q_PROPERTY (int tx_percent READ tx_percent WRITE set_tx_percent);
|
||||
|
||||
public:
|
||||
WSPRBandHopping (QSettings *, Configuration const *, QWidget * parent = nullptr);
|
||||
~WSPRBandHopping ();
|
||||
|
||||
// display the band hopping maintenance dialog
|
||||
Q_SLOT void show_dialog (bool);
|
||||
|
||||
// Property tx_percent implementation
|
||||
int tx_percent () const;
|
||||
Q_SLOT void set_tx_percent (int);
|
||||
|
||||
// structure that defines the results of the next_hop() method
|
||||
struct Hop
|
||||
{
|
||||
QString period_name_;
|
||||
int frequencies_index_; // may be -1 indicating no change
|
||||
bool tune_required_;
|
||||
bool tx_next_;
|
||||
};
|
||||
// return the next band parameters
|
||||
Hop next_hop (bool tx_enabled);
|
||||
// determine if the next period should be a transmit period
|
||||
bool next_is_tx (bool simple_schedule = false);
|
||||
|
||||
private:
|
||||
// implementation hidden from public interface
|
||||
class impl;
|
||||
pimpl<impl> m_;
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,219 @@
|
||||
|
||||
// Copyright Aleksey Gurtovoy 2000-2004
|
||||
//
|
||||
// Distributed under the Boost Software License, Version 1.0.
|
||||
// (See accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
//
|
||||
|
||||
// Preprocessed version of "boost/mpl/vector/vector50.hpp" header
|
||||
// -- DO NOT modify by hand!
|
||||
|
||||
namespace boost { namespace mpl {
|
||||
|
||||
template<
|
||||
typename T0, typename T1, typename T2, typename T3, typename T4
|
||||
, typename T5, typename T6, typename T7, typename T8, typename T9
|
||||
, typename T10, typename T11, typename T12, typename T13, typename T14
|
||||
, typename T15, typename T16, typename T17, typename T18, typename T19
|
||||
, typename T20, typename T21, typename T22, typename T23, typename T24
|
||||
, typename T25, typename T26, typename T27, typename T28, typename T29
|
||||
, typename T30, typename T31, typename T32, typename T33, typename T34
|
||||
, typename T35, typename T36, typename T37, typename T38, typename T39
|
||||
, typename T40
|
||||
>
|
||||
struct vector41
|
||||
: v_item<
|
||||
T40
|
||||
, vector40< T0,T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14,T15,T16,T17,T18,T19,T20,T21,T22,T23,T24,T25,T26,T27,T28,T29,T30,T31,T32,T33,T34,T35,T36,T37,T38,T39 >
|
||||
>
|
||||
{
|
||||
typedef vector41 type;
|
||||
};
|
||||
|
||||
template<
|
||||
typename T0, typename T1, typename T2, typename T3, typename T4
|
||||
, typename T5, typename T6, typename T7, typename T8, typename T9
|
||||
, typename T10, typename T11, typename T12, typename T13, typename T14
|
||||
, typename T15, typename T16, typename T17, typename T18, typename T19
|
||||
, typename T20, typename T21, typename T22, typename T23, typename T24
|
||||
, typename T25, typename T26, typename T27, typename T28, typename T29
|
||||
, typename T30, typename T31, typename T32, typename T33, typename T34
|
||||
, typename T35, typename T36, typename T37, typename T38, typename T39
|
||||
, typename T40, typename T41
|
||||
>
|
||||
struct vector42
|
||||
: v_item<
|
||||
T41
|
||||
, vector41< T0,T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14,T15,T16,T17,T18,T19,T20,T21,T22,T23,T24,T25,T26,T27,T28,T29,T30,T31,T32,T33,T34,T35,T36,T37,T38,T39,T40 >
|
||||
>
|
||||
{
|
||||
typedef vector42 type;
|
||||
};
|
||||
|
||||
template<
|
||||
typename T0, typename T1, typename T2, typename T3, typename T4
|
||||
, typename T5, typename T6, typename T7, typename T8, typename T9
|
||||
, typename T10, typename T11, typename T12, typename T13, typename T14
|
||||
, typename T15, typename T16, typename T17, typename T18, typename T19
|
||||
, typename T20, typename T21, typename T22, typename T23, typename T24
|
||||
, typename T25, typename T26, typename T27, typename T28, typename T29
|
||||
, typename T30, typename T31, typename T32, typename T33, typename T34
|
||||
, typename T35, typename T36, typename T37, typename T38, typename T39
|
||||
, typename T40, typename T41, typename T42
|
||||
>
|
||||
struct vector43
|
||||
: v_item<
|
||||
T42
|
||||
, vector42< T0,T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14,T15,T16,T17,T18,T19,T20,T21,T22,T23,T24,T25,T26,T27,T28,T29,T30,T31,T32,T33,T34,T35,T36,T37,T38,T39,T40,T41 >
|
||||
>
|
||||
{
|
||||
typedef vector43 type;
|
||||
};
|
||||
|
||||
template<
|
||||
typename T0, typename T1, typename T2, typename T3, typename T4
|
||||
, typename T5, typename T6, typename T7, typename T8, typename T9
|
||||
, typename T10, typename T11, typename T12, typename T13, typename T14
|
||||
, typename T15, typename T16, typename T17, typename T18, typename T19
|
||||
, typename T20, typename T21, typename T22, typename T23, typename T24
|
||||
, typename T25, typename T26, typename T27, typename T28, typename T29
|
||||
, typename T30, typename T31, typename T32, typename T33, typename T34
|
||||
, typename T35, typename T36, typename T37, typename T38, typename T39
|
||||
, typename T40, typename T41, typename T42, typename T43
|
||||
>
|
||||
struct vector44
|
||||
: v_item<
|
||||
T43
|
||||
, vector43< T0,T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14,T15,T16,T17,T18,T19,T20,T21,T22,T23,T24,T25,T26,T27,T28,T29,T30,T31,T32,T33,T34,T35,T36,T37,T38,T39,T40,T41,T42 >
|
||||
>
|
||||
{
|
||||
typedef vector44 type;
|
||||
};
|
||||
|
||||
template<
|
||||
typename T0, typename T1, typename T2, typename T3, typename T4
|
||||
, typename T5, typename T6, typename T7, typename T8, typename T9
|
||||
, typename T10, typename T11, typename T12, typename T13, typename T14
|
||||
, typename T15, typename T16, typename T17, typename T18, typename T19
|
||||
, typename T20, typename T21, typename T22, typename T23, typename T24
|
||||
, typename T25, typename T26, typename T27, typename T28, typename T29
|
||||
, typename T30, typename T31, typename T32, typename T33, typename T34
|
||||
, typename T35, typename T36, typename T37, typename T38, typename T39
|
||||
, typename T40, typename T41, typename T42, typename T43, typename T44
|
||||
>
|
||||
struct vector45
|
||||
: v_item<
|
||||
T44
|
||||
, vector44< T0,T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14,T15,T16,T17,T18,T19,T20,T21,T22,T23,T24,T25,T26,T27,T28,T29,T30,T31,T32,T33,T34,T35,T36,T37,T38,T39,T40,T41,T42,T43 >
|
||||
>
|
||||
{
|
||||
typedef vector45 type;
|
||||
};
|
||||
|
||||
template<
|
||||
typename T0, typename T1, typename T2, typename T3, typename T4
|
||||
, typename T5, typename T6, typename T7, typename T8, typename T9
|
||||
, typename T10, typename T11, typename T12, typename T13, typename T14
|
||||
, typename T15, typename T16, typename T17, typename T18, typename T19
|
||||
, typename T20, typename T21, typename T22, typename T23, typename T24
|
||||
, typename T25, typename T26, typename T27, typename T28, typename T29
|
||||
, typename T30, typename T31, typename T32, typename T33, typename T34
|
||||
, typename T35, typename T36, typename T37, typename T38, typename T39
|
||||
, typename T40, typename T41, typename T42, typename T43, typename T44
|
||||
, typename T45
|
||||
>
|
||||
struct vector46
|
||||
: v_item<
|
||||
T45
|
||||
, vector45< T0,T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14,T15,T16,T17,T18,T19,T20,T21,T22,T23,T24,T25,T26,T27,T28,T29,T30,T31,T32,T33,T34,T35,T36,T37,T38,T39,T40,T41,T42,T43,T44 >
|
||||
>
|
||||
{
|
||||
typedef vector46 type;
|
||||
};
|
||||
|
||||
template<
|
||||
typename T0, typename T1, typename T2, typename T3, typename T4
|
||||
, typename T5, typename T6, typename T7, typename T8, typename T9
|
||||
, typename T10, typename T11, typename T12, typename T13, typename T14
|
||||
, typename T15, typename T16, typename T17, typename T18, typename T19
|
||||
, typename T20, typename T21, typename T22, typename T23, typename T24
|
||||
, typename T25, typename T26, typename T27, typename T28, typename T29
|
||||
, typename T30, typename T31, typename T32, typename T33, typename T34
|
||||
, typename T35, typename T36, typename T37, typename T38, typename T39
|
||||
, typename T40, typename T41, typename T42, typename T43, typename T44
|
||||
, typename T45, typename T46
|
||||
>
|
||||
struct vector47
|
||||
: v_item<
|
||||
T46
|
||||
, vector46< T0,T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14,T15,T16,T17,T18,T19,T20,T21,T22,T23,T24,T25,T26,T27,T28,T29,T30,T31,T32,T33,T34,T35,T36,T37,T38,T39,T40,T41,T42,T43,T44,T45 >
|
||||
>
|
||||
{
|
||||
typedef vector47 type;
|
||||
};
|
||||
|
||||
template<
|
||||
typename T0, typename T1, typename T2, typename T3, typename T4
|
||||
, typename T5, typename T6, typename T7, typename T8, typename T9
|
||||
, typename T10, typename T11, typename T12, typename T13, typename T14
|
||||
, typename T15, typename T16, typename T17, typename T18, typename T19
|
||||
, typename T20, typename T21, typename T22, typename T23, typename T24
|
||||
, typename T25, typename T26, typename T27, typename T28, typename T29
|
||||
, typename T30, typename T31, typename T32, typename T33, typename T34
|
||||
, typename T35, typename T36, typename T37, typename T38, typename T39
|
||||
, typename T40, typename T41, typename T42, typename T43, typename T44
|
||||
, typename T45, typename T46, typename T47
|
||||
>
|
||||
struct vector48
|
||||
: v_item<
|
||||
T47
|
||||
, vector47< T0,T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14,T15,T16,T17,T18,T19,T20,T21,T22,T23,T24,T25,T26,T27,T28,T29,T30,T31,T32,T33,T34,T35,T36,T37,T38,T39,T40,T41,T42,T43,T44,T45,T46 >
|
||||
>
|
||||
{
|
||||
typedef vector48 type;
|
||||
};
|
||||
|
||||
template<
|
||||
typename T0, typename T1, typename T2, typename T3, typename T4
|
||||
, typename T5, typename T6, typename T7, typename T8, typename T9
|
||||
, typename T10, typename T11, typename T12, typename T13, typename T14
|
||||
, typename T15, typename T16, typename T17, typename T18, typename T19
|
||||
, typename T20, typename T21, typename T22, typename T23, typename T24
|
||||
, typename T25, typename T26, typename T27, typename T28, typename T29
|
||||
, typename T30, typename T31, typename T32, typename T33, typename T34
|
||||
, typename T35, typename T36, typename T37, typename T38, typename T39
|
||||
, typename T40, typename T41, typename T42, typename T43, typename T44
|
||||
, typename T45, typename T46, typename T47, typename T48
|
||||
>
|
||||
struct vector49
|
||||
: v_item<
|
||||
T48
|
||||
, vector48< T0,T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14,T15,T16,T17,T18,T19,T20,T21,T22,T23,T24,T25,T26,T27,T28,T29,T30,T31,T32,T33,T34,T35,T36,T37,T38,T39,T40,T41,T42,T43,T44,T45,T46,T47 >
|
||||
>
|
||||
{
|
||||
typedef vector49 type;
|
||||
};
|
||||
|
||||
template<
|
||||
typename T0, typename T1, typename T2, typename T3, typename T4
|
||||
, typename T5, typename T6, typename T7, typename T8, typename T9
|
||||
, typename T10, typename T11, typename T12, typename T13, typename T14
|
||||
, typename T15, typename T16, typename T17, typename T18, typename T19
|
||||
, typename T20, typename T21, typename T22, typename T23, typename T24
|
||||
, typename T25, typename T26, typename T27, typename T28, typename T29
|
||||
, typename T30, typename T31, typename T32, typename T33, typename T34
|
||||
, typename T35, typename T36, typename T37, typename T38, typename T39
|
||||
, typename T40, typename T41, typename T42, typename T43, typename T44
|
||||
, typename T45, typename T46, typename T47, typename T48, typename T49
|
||||
>
|
||||
struct vector50
|
||||
: v_item<
|
||||
T49
|
||||
, vector49< T0,T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14,T15,T16,T17,T18,T19,T20,T21,T22,T23,T24,T25,T26,T27,T28,T29,T30,T31,T32,T33,T34,T35,T36,T37,T38,T39,T40,T41,T42,T43,T44,T45,T46,T47,T48 >
|
||||
>
|
||||
{
|
||||
typedef vector50 type;
|
||||
};
|
||||
|
||||
}}
|
||||
@@ -0,0 +1,24 @@
|
||||
|
||||
#ifndef BOOST_MPL_POP_FRONT_FWD_HPP_INCLUDED
|
||||
#define BOOST_MPL_POP_FRONT_FWD_HPP_INCLUDED
|
||||
|
||||
// Copyright Aleksey Gurtovoy 2000-2004
|
||||
//
|
||||
// Distributed under the Boost Software License, Version 1.0.
|
||||
// (See accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
//
|
||||
// See http://www.boost.org/libs/mpl for documentation.
|
||||
|
||||
// $Id$
|
||||
// $Date$
|
||||
// $Revision$
|
||||
|
||||
namespace boost { namespace mpl {
|
||||
|
||||
template< typename Tag > struct pop_front_impl;
|
||||
template< typename Sequence > struct pop_front;
|
||||
|
||||
}}
|
||||
|
||||
#endif // BOOST_MPL_POP_FRONT_FWD_HPP_INCLUDED
|
||||
@@ -0,0 +1,239 @@
|
||||
/*
|
||||
This file is part of wsprd.
|
||||
|
||||
File name: fano.c
|
||||
|
||||
Description: Soft decision Fano sequential decoder for K=32 r=1/2
|
||||
convolutional code.
|
||||
|
||||
Copyright 1994, Phil Karn, KA9Q
|
||||
Minor modifications by Joe Taylor, K1JT
|
||||
*/
|
||||
|
||||
#define LL 1 // Select Layland-Lushbaugh code
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <math.h>
|
||||
#include "fano.h"
|
||||
|
||||
struct node {
|
||||
unsigned long encstate; // Encoder state of next node
|
||||
long gamma; // Cumulative metric to this node
|
||||
int metrics[4]; // Metrics indexed by all possible tx syms
|
||||
int tm[2]; // Sorted metrics for current hypotheses
|
||||
int i; // Current branch being tested
|
||||
};
|
||||
|
||||
// Convolutional coding polynomials. All are rate 1/2, K=32
|
||||
#ifdef NASA_STANDARD
|
||||
/* "NASA standard" code by Massey & Costello
|
||||
* Nonsystematic, quick look-in, dmin=11, dfree=23
|
||||
* used on Pioneer 10-12, Helios A,B
|
||||
*/
|
||||
#define POLY1 0xbbef6bb7
|
||||
#define POLY2 0xbbef6bb5
|
||||
#endif
|
||||
|
||||
#ifdef MJ
|
||||
/* Massey-Johannesson code
|
||||
* Nonsystematic, quick look-in, dmin=13, dfree>=23
|
||||
* Purported to be more computationally efficient than Massey-Costello
|
||||
*/
|
||||
#define POLY1 0xb840a20f
|
||||
#define POLY2 0xb840a20d
|
||||
#endif
|
||||
|
||||
#ifdef LL
|
||||
/* Layland-Lushbaugh code
|
||||
* Nonsystematic, non-quick look-in, dmin=?, dfree=?
|
||||
*/
|
||||
#define POLY1 0xf2d05351
|
||||
#define POLY2 0xe4613c47
|
||||
#endif
|
||||
|
||||
/* Convolutionally encode a packet. The input data bytes are read
|
||||
* high bit first and the encoded packet is written into 'symbols',
|
||||
* one symbol per byte. The first symbol is generated from POLY1,
|
||||
* the second from POLY2.
|
||||
*
|
||||
* Storing only one symbol per byte uses more space, but it is faster
|
||||
* and easier than trying to pack them more compactly.
|
||||
*/
|
||||
int encode(
|
||||
unsigned char *symbols, // Output buffer, 2*nbytes*8
|
||||
unsigned char *data, // Input buffer, nbytes
|
||||
unsigned int nbytes) // Number of bytes in data
|
||||
{
|
||||
unsigned long encstate;
|
||||
int sym;
|
||||
int i;
|
||||
|
||||
encstate = 0;
|
||||
while(nbytes-- != 0) {
|
||||
for(i=7;i>=0;i--) {
|
||||
encstate = (encstate << 1) | ((*data >> i) & 1);
|
||||
ENCODE(sym,encstate);
|
||||
*symbols++ = sym >> 1;
|
||||
*symbols++ = sym & 1;
|
||||
}
|
||||
data++;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Decode packet with the Fano algorithm.
|
||||
* Return 0 on success, -1 on timeout
|
||||
*/
|
||||
int fano(
|
||||
unsigned int *metric, // Final path metric (returned value)
|
||||
unsigned int *cycles, // Cycle count (returned value)
|
||||
unsigned int *maxnp, // Progress before timeout (returned value)
|
||||
unsigned char *data, // Decoded output data
|
||||
unsigned char *symbols, // Raw deinterleaved input symbols
|
||||
unsigned int nbits, // Number of output bits
|
||||
int mettab[2][256], // Metric table, [sent sym][rx symbol]
|
||||
int delta, // Threshold adjust parameter
|
||||
unsigned int maxcycles) // Decoding timeout in cycles per bit
|
||||
{
|
||||
struct node *nodes; // First node
|
||||
struct node *np; // Current node
|
||||
struct node *lastnode; // Last node
|
||||
struct node *tail; // First node of tail
|
||||
int t; // Threshold
|
||||
int m0,m1;
|
||||
int ngamma;
|
||||
unsigned int lsym;
|
||||
unsigned int i;
|
||||
|
||||
if((nodes = (struct node *)malloc((nbits+1)*sizeof(struct node))) == NULL) {
|
||||
printf("malloc failed\n");
|
||||
return 0;
|
||||
}
|
||||
lastnode = &nodes[nbits-1];
|
||||
tail = &nodes[nbits-31];
|
||||
*maxnp = 0;
|
||||
|
||||
/* Compute all possible branch metrics for each symbol pair
|
||||
* This is the only place we actually look at the raw input symbols
|
||||
*/
|
||||
for(np=nodes;np <= lastnode;np++) {
|
||||
np->metrics[0] = mettab[0][symbols[0]] + mettab[0][symbols[1]];
|
||||
np->metrics[1] = mettab[0][symbols[0]] + mettab[1][symbols[1]];
|
||||
np->metrics[2] = mettab[1][symbols[0]] + mettab[0][symbols[1]];
|
||||
np->metrics[3] = mettab[1][symbols[0]] + mettab[1][symbols[1]];
|
||||
symbols += 2;
|
||||
}
|
||||
np = nodes;
|
||||
np->encstate = 0;
|
||||
|
||||
// Compute and sort branch metrics from root node */
|
||||
ENCODE(lsym,np->encstate); // 0-branch (LSB is 0)
|
||||
m0 = np->metrics[lsym];
|
||||
|
||||
/* Now do the 1-branch. To save another ENCODE call here and
|
||||
* inside the loop, we assume that both polynomials are odd,
|
||||
* providing complementary pairs of branch symbols.
|
||||
|
||||
* This code should be modified if a systematic code were used.
|
||||
*/
|
||||
|
||||
m1 = np->metrics[3^lsym];
|
||||
if(m0 > m1) {
|
||||
np->tm[0] = m0; // 0-branch has better metric
|
||||
np->tm[1] = m1;
|
||||
} else {
|
||||
np->tm[0] = m1; // 1-branch is better
|
||||
np->tm[1] = m0;
|
||||
np->encstate++; // Set low bit
|
||||
}
|
||||
np->i = 0; // Start with best branch
|
||||
maxcycles *= nbits;
|
||||
np->gamma = t = 0;
|
||||
|
||||
// Start the Fano decoder
|
||||
for(i=1;i <= maxcycles;i++) {
|
||||
if((int)(np-nodes) > (int)*maxnp) *maxnp=(int)(np-nodes);
|
||||
#ifdef debug
|
||||
printf("k=%ld, g=%ld, t=%d, m[%d]=%d, maxnp=%d, encstate=%lx\n",
|
||||
np-nodes,np->gamma,t,np->i,np->tm[np->i],*maxnp,np->encstate);
|
||||
#endif
|
||||
// Look forward */
|
||||
ngamma = np->gamma + np->tm[np->i];
|
||||
if(ngamma >= t) {
|
||||
if(np->gamma < t + delta) { // Node is acceptable
|
||||
/* First time we've visited this node;
|
||||
* Tighten threshold.
|
||||
*
|
||||
* This loop could be replaced with
|
||||
* t += delta * ((ngamma - t)/delta);
|
||||
* but the multiply and divide are slower.
|
||||
*/
|
||||
while(ngamma >= t + delta) t += delta;
|
||||
}
|
||||
np[1].gamma = ngamma; // Move forward
|
||||
np[1].encstate = np->encstate << 1;
|
||||
if( ++np == (lastnode+1) ) {
|
||||
break; // Done!
|
||||
}
|
||||
|
||||
/* Compute and sort metrics, starting with the
|
||||
* zero branch
|
||||
*/
|
||||
ENCODE(lsym,np->encstate);
|
||||
if(np >= tail) {
|
||||
/* The tail must be all zeroes, so don't
|
||||
* bother computing the 1-branches here.
|
||||
*/
|
||||
np->tm[0] = np->metrics[lsym];
|
||||
} else {
|
||||
m0 = np->metrics[lsym];
|
||||
m1 = np->metrics[3^lsym];
|
||||
if(m0 > m1) {
|
||||
np->tm[0] = m0; // 0-branch is better
|
||||
np->tm[1] = m1;
|
||||
} else {
|
||||
np->tm[0] = m1; // 1-branch is better
|
||||
np->tm[1] = m0;
|
||||
np->encstate++; // Set low bit
|
||||
}
|
||||
}
|
||||
np->i = 0; // Start with best branch
|
||||
continue;
|
||||
}
|
||||
// Threshold violated, can't go forward
|
||||
for(;;) { // Look backward
|
||||
if(np == nodes || np[-1].gamma < t) {
|
||||
/* Can't back up either.
|
||||
* Relax threshold and and look
|
||||
* forward again to better branch.
|
||||
*/
|
||||
t -= delta;
|
||||
if(np->i != 0) {
|
||||
np->i = 0;
|
||||
np->encstate ^= 1;
|
||||
}
|
||||
break;
|
||||
}
|
||||
// Back up
|
||||
if(--np < tail && np->i != 1) {
|
||||
np->i++; // Search next best branch
|
||||
np->encstate ^= 1;
|
||||
break;
|
||||
} // else keep looking back
|
||||
}
|
||||
}
|
||||
*metric = np->gamma; // Return the final path metric
|
||||
|
||||
// Copy decoded data to user's buffer
|
||||
nbits >>= 3;
|
||||
np = &nodes[7];
|
||||
while(nbits-- != 0) {
|
||||
*data++ = np->encstate;
|
||||
np += 8;
|
||||
}
|
||||
*cycles = i+1;
|
||||
|
||||
free(nodes);
|
||||
if(i >= maxcycles) return -1; // Decoder timed out
|
||||
return 0; // Successful completion
|
||||
}
|
||||
@@ -0,0 +1,415 @@
|
||||
/*
|
||||
[auto_generated]
|
||||
boost/numeric/odeint/stepper/base/explicit_stepper_base.hpp
|
||||
|
||||
[begin_description]
|
||||
Base class for all explicit Runge Kutta steppers.
|
||||
[end_description]
|
||||
|
||||
Copyright 2010-2013 Karsten Ahnert
|
||||
Copyright 2010-2012 Mario Mulansky
|
||||
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_BASE_EXPLICIT_STEPPER_BASE_HPP_INCLUDED
|
||||
#define BOOST_NUMERIC_ODEINT_STEPPER_BASE_EXPLICIT_STEPPER_BASE_HPP_INCLUDED
|
||||
|
||||
|
||||
#include <boost/utility/enable_if.hpp>
|
||||
#include <boost/type_traits/is_same.hpp>
|
||||
|
||||
#include <boost/numeric/odeint/util/bind.hpp>
|
||||
#include <boost/numeric/odeint/util/unwrap_reference.hpp>
|
||||
|
||||
#include <boost/numeric/odeint/util/state_wrapper.hpp>
|
||||
#include <boost/numeric/odeint/util/resizer.hpp>
|
||||
#include <boost/numeric/odeint/util/is_resizeable.hpp>
|
||||
|
||||
#include <boost/numeric/odeint/stepper/stepper_categories.hpp>
|
||||
|
||||
#include <boost/numeric/odeint/stepper/base/algebra_stepper_base.hpp>
|
||||
|
||||
namespace boost {
|
||||
namespace numeric {
|
||||
namespace odeint {
|
||||
|
||||
/*
|
||||
* base class for explicit steppers
|
||||
* models the stepper concept
|
||||
*
|
||||
* this class provides the following overloads
|
||||
* do_step( sys , x , t , dt )
|
||||
* do_step( sys , in , t , out , dt )
|
||||
* do_step( sys , x , dxdt_in , t , dt )
|
||||
* do_step( sys , in , dxdt_in , t , out , dt )
|
||||
*/
|
||||
|
||||
template<
|
||||
class Stepper ,
|
||||
unsigned short Order ,
|
||||
class State ,
|
||||
class Value ,
|
||||
class Deriv ,
|
||||
class Time ,
|
||||
class Algebra ,
|
||||
class Operations ,
|
||||
class Resizer
|
||||
>
|
||||
class explicit_stepper_base : public algebra_stepper_base< Algebra , Operations >
|
||||
{
|
||||
public:
|
||||
|
||||
#ifndef DOXYGEN_SKIP
|
||||
typedef explicit_stepper_base< Stepper , Order , State , Value , Deriv , Time , Algebra , Operations , Resizer > internal_stepper_base_type;
|
||||
#endif // DOXYGEN_SKIP
|
||||
|
||||
|
||||
typedef State state_type;
|
||||
typedef Value value_type;
|
||||
typedef Deriv deriv_type;
|
||||
typedef Time time_type;
|
||||
typedef Resizer resizer_type;
|
||||
typedef Stepper stepper_type;
|
||||
typedef stepper_tag stepper_category;
|
||||
typedef algebra_stepper_base< Algebra , Operations > algebra_stepper_base_type;
|
||||
typedef typename algebra_stepper_base_type::algebra_type algebra_type;
|
||||
typedef typename algebra_stepper_base_type::operations_type operations_type;
|
||||
typedef unsigned short order_type;
|
||||
|
||||
#ifndef DOXYGEN_SKIP
|
||||
typedef state_wrapper< state_type > wrapped_state_type;
|
||||
typedef state_wrapper< deriv_type > wrapped_deriv_type;
|
||||
#endif // DOXYGEN_SKIP
|
||||
|
||||
|
||||
static const order_type order_value = Order;
|
||||
|
||||
|
||||
explicit_stepper_base( const algebra_type &algebra = algebra_type() )
|
||||
: algebra_stepper_base_type( algebra )
|
||||
{ }
|
||||
|
||||
/**
|
||||
* \return Returns the order of the stepper.
|
||||
*/
|
||||
order_type order( void ) const
|
||||
{
|
||||
return order_value;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Version 1 : do_step( sys , x , t , dt )
|
||||
*
|
||||
* the two overloads are needed in order to solve the forwarding problem
|
||||
*/
|
||||
template< class System , class StateInOut >
|
||||
void do_step( System system , StateInOut &x , time_type t , time_type dt )
|
||||
{
|
||||
do_step_v1( system , x , t , dt );
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief Second version to solve the forwarding problem, can be called with Boost.Range as StateInOut.
|
||||
*/
|
||||
template< class System , class StateInOut >
|
||||
void do_step( System system , const StateInOut &x , time_type t , time_type dt )
|
||||
{
|
||||
do_step_v1( system , x , t , dt );
|
||||
}
|
||||
|
||||
/*
|
||||
* Version 2 : do_step( sys , x , dxdt , t , dt )
|
||||
*
|
||||
* this version does not solve the forwarding problem, boost.range can not be used
|
||||
*
|
||||
* the disable is needed to avoid ambiguous overloads if state_type = time_type
|
||||
*/
|
||||
template< class System , class StateInOut , class DerivIn >
|
||||
typename boost::disable_if< boost::is_same< DerivIn , time_type > , void >::type
|
||||
do_step( System system , StateInOut &x , const DerivIn &dxdt , time_type t , time_type dt )
|
||||
{
|
||||
this->stepper().do_step_impl( system , x , dxdt , t , x , dt );
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* named Version 2: do_step_dxdt_impl( sys , in , dxdt , t , dt )
|
||||
*
|
||||
* this version is needed when this stepper is used for initializing
|
||||
* multistep stepper like adams-bashforth. Hence we provide an explicitely
|
||||
* named version that is not disabled. Meant for internal use only.
|
||||
*/
|
||||
template < class System, class StateInOut, class DerivIn >
|
||||
void do_step_dxdt_impl( System system, StateInOut &x, const DerivIn &dxdt,
|
||||
time_type t, time_type dt )
|
||||
{
|
||||
this->stepper().do_step_impl( system , x , dxdt , t , x , dt );
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Version 3 : do_step( sys , in , t , out , dt )
|
||||
*
|
||||
* this version does not solve the forwarding problem, boost.range can not be used
|
||||
*/
|
||||
template< class System , class StateIn , class StateOut >
|
||||
void do_step( System system , const StateIn &in , time_type t , StateOut &out , time_type dt )
|
||||
{
|
||||
typename odeint::unwrap_reference< System >::type &sys = system;
|
||||
m_resizer.adjust_size( in , detail::bind( &internal_stepper_base_type::template resize_impl<StateIn> , detail::ref( *this ) , detail::_1 ) );
|
||||
sys( in , m_dxdt.m_v ,t );
|
||||
this->stepper().do_step_impl( system , in , m_dxdt.m_v , t , out , dt );
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Version 4 : do_step( sys , in , dxdt , t , out , dt )
|
||||
*
|
||||
* this version does not solve the forwarding problem, boost.range can not be used
|
||||
*/
|
||||
template< class System , class StateIn , class DerivIn , class StateOut >
|
||||
void do_step( System system , const StateIn &in , const DerivIn &dxdt , time_type t , StateOut &out , time_type dt )
|
||||
{
|
||||
this->stepper().do_step_impl( system , in , dxdt , t , out , dt );
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* named Version 4: do_step_dxdt_impl( sys , in , dxdt , t , out, dt )
|
||||
*
|
||||
* this version is needed when this stepper is used for initializing
|
||||
* multistep stepper like adams-bashforth. Hence we provide an explicitely
|
||||
* named version. Meant for internal use only.
|
||||
*/
|
||||
template < class System, class StateIn, class DerivIn, class StateOut >
|
||||
void do_step_dxdt_impl( System system, const StateIn &in,
|
||||
const DerivIn &dxdt, time_type t, StateOut &out,
|
||||
time_type dt )
|
||||
{
|
||||
this->stepper().do_step_impl( system , in , dxdt , t , out , dt );
|
||||
}
|
||||
|
||||
template< class StateIn >
|
||||
void adjust_size( const StateIn &x )
|
||||
{
|
||||
resize_impl( x );
|
||||
}
|
||||
|
||||
private:
|
||||
|
||||
stepper_type& stepper( void )
|
||||
{
|
||||
return *static_cast< stepper_type* >( this );
|
||||
}
|
||||
|
||||
const stepper_type& stepper( void ) const
|
||||
{
|
||||
return *static_cast< const stepper_type* >( this );
|
||||
}
|
||||
|
||||
|
||||
template< class StateIn >
|
||||
bool resize_impl( const StateIn &x )
|
||||
{
|
||||
return adjust_size_by_resizeability( m_dxdt , x , typename is_resizeable<deriv_type>::type() );
|
||||
}
|
||||
|
||||
|
||||
template< class System , class StateInOut >
|
||||
void do_step_v1( System system , StateInOut &x , time_type t , time_type dt )
|
||||
{
|
||||
typename odeint::unwrap_reference< System >::type &sys = system;
|
||||
m_resizer.adjust_size( x , detail::bind( &internal_stepper_base_type::template resize_impl< StateInOut > , detail::ref( *this ) , detail::_1 ) );
|
||||
sys( x , m_dxdt.m_v ,t );
|
||||
this->stepper().do_step_impl( system , x , m_dxdt.m_v , t , x , dt );
|
||||
}
|
||||
|
||||
|
||||
resizer_type m_resizer;
|
||||
|
||||
protected:
|
||||
|
||||
wrapped_deriv_type m_dxdt;
|
||||
};
|
||||
|
||||
|
||||
/******* DOXYGEN *********/
|
||||
|
||||
/**
|
||||
* \class explicit_stepper_base
|
||||
* \brief Base class for explicit steppers without step size control and without dense output.
|
||||
*
|
||||
* This class serves as the base class for all explicit steppers with algebra and operations.
|
||||
* Step size control and error estimation as well as dense output are not provided. explicit_stepper_base
|
||||
* is used as the interface in a CRTP (currently recurring template pattern). In order to work
|
||||
* correctly the parent class needs to have a method `do_step_impl( system , in , dxdt_in , t , out , dt )`.
|
||||
* This is method is used by explicit_stepper_base. explicit_stepper_base derives from
|
||||
* algebra_stepper_base. An example how this class can be used is
|
||||
*
|
||||
* \code
|
||||
* template< class State , class Value , class Deriv , class Time , class Algebra , class Operations , class Resizer >
|
||||
* class custom_euler : public explicit_stepper_base< 1 , State , Value , Deriv , Time , Algebra , Operations , Resizer >
|
||||
* {
|
||||
* public:
|
||||
*
|
||||
* typedef explicit_stepper_base< 1 , State , Value , Deriv , Time , Algebra , Operations , Resizer > base_type;
|
||||
*
|
||||
* custom_euler( const Algebra &algebra = Algebra() ) { }
|
||||
*
|
||||
* template< class Sys , class StateIn , class DerivIn , class StateOut >
|
||||
* void do_step_impl( Sys sys , const StateIn &in , const DerivIn &dxdt , Time t , StateOut &out , Time dt )
|
||||
* {
|
||||
* m_algebra.for_each3( out , in , dxdt , Operations::scale_sum2< Value , Time >( 1.0 , dt );
|
||||
* }
|
||||
*
|
||||
* template< class State >
|
||||
* void adjust_size( const State &x )
|
||||
* {
|
||||
* base_type::adjust_size( x );
|
||||
* }
|
||||
* };
|
||||
* \endcode
|
||||
*
|
||||
* For the Stepper concept only the `do_step( sys , x , t , dt )` needs to be implemented. But this class
|
||||
* provides additional `do_step` variants since the stepper is explicit. These methods can be used to increase
|
||||
* the performance in some situation, for example if one needs to analyze `dxdt` during each step. In this case
|
||||
* one can use
|
||||
*
|
||||
* \code
|
||||
* sys( x , dxdt , t );
|
||||
* stepper.do_step( sys , x , dxdt , t , dt ); // the value of dxdt is used here
|
||||
* t += dt;
|
||||
* \endcode
|
||||
*
|
||||
* In detail explicit_stepper_base provides the following `do_step` variants
|
||||
* - `do_step( sys , x , t , dt )` - The classical `do_step` method needed to fulfill the Stepper concept. The state is updated in-place.
|
||||
* A type modelling a Boost.Range can be used for x.
|
||||
* - `do_step( sys , in , t , out , dt )` - This method updates the state out-of-place, hence the result of the step is stored in `out`.
|
||||
* - `do_step( sys , x , dxdt , t , dt )` - This method updates the state in-place, but the derivative at the point `t` must be
|
||||
* explicitly passed in `dxdt`. For an example see the code snippet above.
|
||||
* - `do_step( sys , in , dxdt , t , out , dt )` - This method update the state out-of-place and expects that the derivative at the point
|
||||
* `t` is explicitly passed in `dxdt`. It is a combination of the two `do_step` methods above.
|
||||
*
|
||||
* \note The system is always passed as value, which might result in poor performance if it contains data. In this case it can be used with `boost::ref`
|
||||
* or `std::ref`, for example `stepper.do_step( boost::ref( sys ) , x , t , dt );`
|
||||
*
|
||||
* \note The time `t` is not advanced by the stepper. This has to done manually, or by the appropriate `integrate` routines or `iterator`s.
|
||||
*
|
||||
* \tparam Stepper The stepper on which this class should work. It is used via CRTP, hence explicit_stepper_base
|
||||
* provides the interface for the Stepper.
|
||||
* \tparam Order The order of the stepper.
|
||||
* \tparam State The state type for the stepper.
|
||||
* \tparam Value The value type for the stepper. This should be a floating point type, like float,
|
||||
* double, or a multiprecision type. It must not necessary be the value_type of the State. For example
|
||||
* the State can be a `vector< complex< double > >` in this case the Value must be double.
|
||||
* The default value is double.
|
||||
* \tparam Deriv The type representing time derivatives of the state type. It is usually the same type as the
|
||||
* state type, only if used with Boost.Units both types differ.
|
||||
* \tparam Time The type representing the time. Usually the same type as the value type. When Boost.Units is
|
||||
* used, this type has usually a unit.
|
||||
* \tparam Algebra The algebra type which must fulfill the Algebra Concept.
|
||||
* \tparam Operations The type for the operations which must fulfill the Operations Concept.
|
||||
* \tparam Resizer The resizer policy class.
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* \fn explicit_stepper_base::explicit_stepper_base( const algebra_type &algebra )
|
||||
* \brief Constructs a explicit_stepper_base class. This constructor can be used as a default
|
||||
* constructor if the algebra has a default constructor.
|
||||
* \param algebra A copy of algebra is made and stored inside explicit_stepper_base.
|
||||
*/
|
||||
|
||||
/**
|
||||
* \fn explicit_stepper_base::order_type order( void ) const
|
||||
* \return Returns the order of the stepper.
|
||||
*/
|
||||
|
||||
/**
|
||||
* \fn explicit_stepper_base::do_step( System system , StateInOut &x , time_type t , time_type dt )
|
||||
* \brief This method performs one step. It transforms the result in-place.
|
||||
*
|
||||
* \param system The system function to solve, hence the r.h.s. of the ordinary differential equation. It must fulfill the
|
||||
* Simple System concept.
|
||||
* \param x The state of the ODE which should be solved. After calling do_step the result is updated in x.
|
||||
* \param t The value of the time, at which the step should be performed.
|
||||
* \param dt The step size.
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* \fn explicit_stepper_base::do_step( System system , StateInOut &x , const DerivIn &dxdt , time_type t , time_type dt )
|
||||
|
||||
* \brief The method performs one step. Additionally to the other method
|
||||
* the derivative of x is also passed to this method. It is supposed to be used in the following way:
|
||||
*
|
||||
* \code
|
||||
* sys( x , dxdt , t );
|
||||
* stepper.do_step( sys , x , dxdt , t , dt );
|
||||
* \endcode
|
||||
*
|
||||
* The result is updated in place in x. This method is disabled if Time and Deriv are of the same type. In this
|
||||
* case the method could not be distinguished from other `do_step` versions.
|
||||
*
|
||||
* \note This method does not solve the forwarding problem.
|
||||
*
|
||||
* \param system The system function to solve, hence the r.h.s. of the ODE. It must fulfill the
|
||||
* Simple System concept.
|
||||
* \param x The state of the ODE which should be solved. After calling do_step the result is updated in x.
|
||||
* \param dxdt The derivative of x at t.
|
||||
* \param t The value of the time, at which the step should be performed.
|
||||
* \param dt The step size.
|
||||
*/
|
||||
|
||||
/**
|
||||
* \fn void explicit_stepper_base::do_step( System system , const StateIn &in , time_type t , StateOut &out , time_type dt )
|
||||
* \brief The method performs one step. The state of the ODE is updated out-of-place.
|
||||
* \note This method does not solve the forwarding problem.
|
||||
*
|
||||
* \param system The system function to solve, hence the r.h.s. of the ODE. It must fulfill the
|
||||
* Simple System concept.
|
||||
* \param in The state of the ODE which should be solved. in is not modified in this method
|
||||
* \param t The value of the time, at which the step should be performed.
|
||||
* \param out The result of the step is written in out.
|
||||
* \param dt The step size.
|
||||
*/
|
||||
|
||||
/**
|
||||
* \fn void explicit_stepper_base::do_step( System system , const StateIn &in , const DerivIn &dxdt , time_type t , StateOut &out , time_type dt )
|
||||
* \brief The method performs one step. The state of the ODE is updated out-of-place.
|
||||
* Furthermore, the derivative of x at t is passed to the stepper.
|
||||
* It is supposed to be used in the following way:
|
||||
*
|
||||
* \code
|
||||
* sys( in , dxdt , t );
|
||||
* stepper.do_step( sys , in , dxdt , t , out , dt );
|
||||
* \endcode
|
||||
*
|
||||
* \note This method does not solve the forwarding problem.
|
||||
*
|
||||
* \param system The system function to solve, hence the r.h.s. of the ODE. It must fulfill the
|
||||
* Simple System concept.
|
||||
* \param in The state of the ODE which should be solved. in is not modified in this method
|
||||
* \param dxdt The derivative of x at t.
|
||||
* \param t The value of the time, at which the step should be performed.
|
||||
* \param out The result of the step is written in out.
|
||||
* \param dt The step size.
|
||||
*/
|
||||
|
||||
/**
|
||||
* \fn void explicit_stepper_base::adjust_size( const StateIn &x )
|
||||
* \brief Adjust the size of all temporaries in the stepper manually.
|
||||
* \param x A state from which the size of the temporaries to be resized is deduced.
|
||||
*/
|
||||
|
||||
} // odeint
|
||||
} // numeric
|
||||
} // boost
|
||||
|
||||
#endif // BOOST_NUMERIC_ODEINT_STEPPER_BASE_EXPLICIT_STEPPER_BASE_HPP_INCLUDED
|
||||
@@ -0,0 +1,66 @@
|
||||
// Boost.Range library
|
||||
//
|
||||
// Copyright Neil Groves 2014.
|
||||
//
|
||||
// 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).
|
||||
//
|
||||
// For more information, see http://www.boost.org/libs/range/
|
||||
//
|
||||
#ifndef BOOST_RANGE_DETAIL_HAS_MEMBER_SIZE_HPP
|
||||
#define BOOST_RANGE_DETAIL_HAS_MEMBER_SIZE_HPP
|
||||
|
||||
#include <boost/type_traits/is_class.hpp>
|
||||
#include <boost/type_traits/is_member_function_pointer.hpp>
|
||||
#include <boost/mpl/and.hpp>
|
||||
#include <boost/mpl/bool.hpp>
|
||||
#include <boost/cstdint.hpp>
|
||||
|
||||
namespace boost
|
||||
{
|
||||
namespace range_detail
|
||||
{
|
||||
|
||||
template<class T>
|
||||
class has_member_size_impl
|
||||
{
|
||||
private:
|
||||
template<class U, U>
|
||||
class check
|
||||
{
|
||||
};
|
||||
|
||||
template<class C>
|
||||
static boost::uint8_t f(check<std::size_t(C::*)(void) const, &C::size>*);
|
||||
|
||||
template<class C>
|
||||
static boost::uint16_t f(...);
|
||||
|
||||
public:
|
||||
static const bool value =
|
||||
(sizeof(f<T>(0)) == sizeof(boost::uint8_t));
|
||||
|
||||
typedef typename mpl::if_c<
|
||||
(sizeof(f<T>(0)) == sizeof(boost::uint8_t)),
|
||||
mpl::true_,
|
||||
mpl::false_
|
||||
>::type type;
|
||||
};
|
||||
|
||||
template<class T>
|
||||
struct has_member_size
|
||||
{
|
||||
typedef typename mpl::and_<
|
||||
typename is_class<T>::type,
|
||||
typename has_member_size_impl<const T>::type
|
||||
>::type type;
|
||||
|
||||
static const bool value =
|
||||
is_class<T>::value && has_member_size_impl<const T>::value;
|
||||
};
|
||||
|
||||
} // namespace range_detail
|
||||
}// namespace boost
|
||||
|
||||
#endif // include guard
|
||||
@@ -0,0 +1,63 @@
|
||||
// Boost.Range library
|
||||
//
|
||||
// Copyright Neil Groves 2003-2004.
|
||||
// Use, modification and distribution is subject to the Boost Software
|
||||
// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
//
|
||||
// For more information, see http://www.boost.org/libs/range/
|
||||
//
|
||||
#ifndef BOOST_RANGE_RANGE_FWD_HPP_INCLUDED
|
||||
#define BOOST_RANGE_RANGE_FWD_HPP_INCLUDED
|
||||
|
||||
namespace boost
|
||||
{
|
||||
|
||||
// Extension points
|
||||
template<typename C, typename Enabler>
|
||||
struct range_iterator;
|
||||
|
||||
template<typename C, typename Enabler>
|
||||
struct range_mutable_iterator;
|
||||
|
||||
template<typename C, typename Enabler>
|
||||
struct range_const_iterator;
|
||||
|
||||
// Core classes
|
||||
template<typename IteratorT>
|
||||
class iterator_range;
|
||||
|
||||
template<typename ForwardRange>
|
||||
class sub_range;
|
||||
|
||||
// Meta-functions
|
||||
template<typename T>
|
||||
struct range_category;
|
||||
|
||||
template<typename T>
|
||||
struct range_difference;
|
||||
|
||||
template<typename T>
|
||||
struct range_pointer;
|
||||
|
||||
template<typename T>
|
||||
struct range_reference;
|
||||
|
||||
template<typename T>
|
||||
struct range_reverse_iterator;
|
||||
|
||||
template<typename T>
|
||||
struct range_size;
|
||||
|
||||
template<typename T>
|
||||
struct range_value;
|
||||
|
||||
template<typename T>
|
||||
struct has_range_iterator;
|
||||
|
||||
template<typename T>
|
||||
struct has_range_const_iterator;
|
||||
|
||||
} // namespace boost
|
||||
|
||||
#endif // include guard
|
||||
@@ -0,0 +1,24 @@
|
||||
|
||||
#ifndef BOOST_MPL_AUX_RANGE_C_TAG_HPP_INCLUDED
|
||||
#define BOOST_MPL_AUX_RANGE_C_TAG_HPP_INCLUDED
|
||||
|
||||
// Copyright Aleksey Gurtovoy 2000-2004
|
||||
//
|
||||
// Distributed under the Boost Software License, Version 1.0.
|
||||
// (See accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
//
|
||||
// See http://www.boost.org/libs/mpl for documentation.
|
||||
|
||||
// $Id$
|
||||
// $Date$
|
||||
// $Revision$
|
||||
|
||||
namespace boost { namespace mpl { namespace aux {
|
||||
|
||||
struct half_open_range_tag;
|
||||
struct r_iter_tag;
|
||||
|
||||
}}}
|
||||
|
||||
#endif // BOOST_MPL_AUX_RANGE_C_TAG_HPP_INCLUDED
|
||||
@@ -0,0 +1,67 @@
|
||||
/*
|
||||
* 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)
|
||||
*
|
||||
* Copyright (c) 2011 Helge Bahmann
|
||||
* Copyright (c) 2013 Tim Blechmann
|
||||
* Copyright (c) 2014 Andrey Semashev
|
||||
*/
|
||||
/*!
|
||||
* \file atomic/fences.hpp
|
||||
*
|
||||
* This header contains definition of \c atomic_thread_fence and \c atomic_signal_fence functions.
|
||||
*/
|
||||
|
||||
#ifndef BOOST_ATOMIC_FENCES_HPP_INCLUDED_
|
||||
#define BOOST_ATOMIC_FENCES_HPP_INCLUDED_
|
||||
|
||||
#include <boost/memory_order.hpp>
|
||||
#include <boost/atomic/capabilities.hpp>
|
||||
#include <boost/atomic/detail/operations.hpp>
|
||||
|
||||
#ifdef BOOST_HAS_PRAGMA_ONCE
|
||||
#pragma once
|
||||
#endif
|
||||
|
||||
/*
|
||||
* IMPLEMENTATION NOTE: All interface functions MUST be declared with BOOST_FORCEINLINE,
|
||||
* see comment for convert_memory_order_to_gcc in ops_gcc_atomic.hpp.
|
||||
*/
|
||||
|
||||
namespace boost {
|
||||
|
||||
namespace atomics {
|
||||
|
||||
#if BOOST_ATOMIC_THREAD_FENCE > 0
|
||||
BOOST_FORCEINLINE void atomic_thread_fence(memory_order order) BOOST_NOEXCEPT
|
||||
{
|
||||
detail::thread_fence(order);
|
||||
}
|
||||
#else
|
||||
BOOST_FORCEINLINE void atomic_thread_fence(memory_order) BOOST_NOEXCEPT
|
||||
{
|
||||
detail::lockpool::thread_fence();
|
||||
}
|
||||
#endif
|
||||
|
||||
#if BOOST_ATOMIC_SIGNAL_FENCE > 0
|
||||
BOOST_FORCEINLINE void atomic_signal_fence(memory_order order) BOOST_NOEXCEPT
|
||||
{
|
||||
detail::signal_fence(order);
|
||||
}
|
||||
#else
|
||||
BOOST_FORCEINLINE void atomic_signal_fence(memory_order) BOOST_NOEXCEPT
|
||||
{
|
||||
detail::lockpool::signal_fence();
|
||||
}
|
||||
#endif
|
||||
|
||||
} // namespace atomics
|
||||
|
||||
using atomics::atomic_thread_fence;
|
||||
using atomics::atomic_signal_fence;
|
||||
|
||||
} // namespace boost
|
||||
|
||||
#endif // BOOST_ATOMIC_FENCES_HPP_INCLUDED_
|
||||
@@ -0,0 +1,37 @@
|
||||
#include "qt_helpers.hpp"
|
||||
|
||||
#include <QString>
|
||||
#include <QFont>
|
||||
#include <QWidget>
|
||||
#include <QStyle>
|
||||
#include <QVariant>
|
||||
|
||||
QString font_as_stylesheet (QFont const& font)
|
||||
{
|
||||
QString font_weight;
|
||||
switch (font.weight ())
|
||||
{
|
||||
case QFont::Light: font_weight = "light"; break;
|
||||
case QFont::Normal: font_weight = "normal"; break;
|
||||
case QFont::DemiBold: font_weight = "demibold"; break;
|
||||
case QFont::Bold: font_weight = "bold"; break;
|
||||
case QFont::Black: font_weight = "black"; break;
|
||||
}
|
||||
return QString {
|
||||
" font-family: %1;\n"
|
||||
" font-size: %2pt;\n"
|
||||
" font-style: %3;\n"
|
||||
" font-weight: %4;\n"}
|
||||
.arg (font.family ())
|
||||
.arg (font.pointSize ())
|
||||
.arg (font.styleName ())
|
||||
.arg (font_weight);
|
||||
}
|
||||
|
||||
void update_dynamic_property (QWidget * widget, char const * property, QVariant const& value)
|
||||
{
|
||||
widget->setProperty (property, value);
|
||||
widget->style ()->unpolish (widget);
|
||||
widget->style ()->polish (widget);
|
||||
widget->update ();
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2001-2011 Joel de Guzman
|
||||
|
||||
Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
This is an auto-generated file. Do not edit!
|
||||
==============================================================================*/
|
||||
namespace boost { namespace fusion
|
||||
{
|
||||
struct void_;
|
||||
struct set_tag;
|
||||
struct set_iterator_tag;
|
||||
template <
|
||||
typename T0 = void_ , typename T1 = void_ , typename T2 = void_ , typename T3 = void_ , typename T4 = void_ , typename T5 = void_ , typename T6 = void_ , typename T7 = void_ , typename T8 = void_ , typename T9 = void_ , typename T10 = void_ , typename T11 = void_ , typename T12 = void_ , typename T13 = void_ , typename T14 = void_ , typename T15 = void_ , typename T16 = void_ , typename T17 = void_ , typename T18 = void_ , typename T19 = void_ , typename T20 = void_ , typename T21 = void_ , typename T22 = void_ , typename T23 = void_ , typename T24 = void_ , typename T25 = void_ , typename T26 = void_ , typename T27 = void_ , typename T28 = void_ , typename T29 = void_ , typename T30 = void_ , typename T31 = void_ , typename T32 = void_ , typename T33 = void_ , typename T34 = void_ , typename T35 = void_ , typename T36 = void_ , typename T37 = void_ , typename T38 = void_ , typename T39 = void_ , typename T40 = void_ , typename T41 = void_ , typename T42 = void_ , typename T43 = void_ , typename T44 = void_ , typename T45 = void_ , typename T46 = void_ , typename T47 = void_ , typename T48 = void_ , typename T49 = void_
|
||||
>
|
||||
struct set;
|
||||
}}
|
||||
@@ -0,0 +1,35 @@
|
||||
/*
|
||||
* Reads cty.dat file
|
||||
* Establishes a map between prefixes and their country names
|
||||
* VK3ACF July 2013
|
||||
*/
|
||||
|
||||
|
||||
#ifndef __COUNTRYDAT_H
|
||||
#define __COUNTRYDAT_H
|
||||
|
||||
|
||||
#include <QString>
|
||||
#include <QStringList>
|
||||
#include <QHash>
|
||||
|
||||
|
||||
class CountryDat
|
||||
{
|
||||
public:
|
||||
void init(const QString filename);
|
||||
void load();
|
||||
QString find(QString prefix); // return country name or ""
|
||||
QStringList getCountryNames() { return _countryNames; };
|
||||
|
||||
private:
|
||||
QString _extractName(const QString line);
|
||||
void _removeBrackets(QString &line, const QString a, const QString b);
|
||||
QStringList _extractPrefix(QString &line, bool &more);
|
||||
|
||||
QString _filename;
|
||||
QStringList _countryNames;
|
||||
QHash<QString, QString> _data;
|
||||
};
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user