Initial Commit

This commit is contained in:
Jordan Sherer
2018-02-08 21:28:33 -05:00
commit 678c1d3966
14352 changed files with 3176737 additions and 0 deletions
@@ -0,0 +1,65 @@
/*
Copyright Rene Rivera 2008-2015
Distributed under the Boost Software License, Version 1.0.
(See accompanying file LICENSE_1_0.txt or copy at
http://www.boost.org/LICENSE_1_0.txt)
*/
#ifndef BOOST_PREDEF_COMPILER_INTEL_H
#define BOOST_PREDEF_COMPILER_INTEL_H
#include <boost/predef/version_number.h>
#include <boost/predef/make.h>
/*`
[heading `BOOST_COMP_INTEL`]
[@http://en.wikipedia.org/wiki/Intel_C%2B%2B Intel C/C++] compiler.
Version number available as major, minor, and patch.
[table
[[__predef_symbol__] [__predef_version__]]
[[`__INTEL_COMPILER`] [__predef_detection__]]
[[`__ICL`] [__predef_detection__]]
[[`__ICC`] [__predef_detection__]]
[[`__ECC`] [__predef_detection__]]
[[`__INTEL_COMPILER`] [V.R.P]]
]
*/
#define BOOST_COMP_INTEL BOOST_VERSION_NUMBER_NOT_AVAILABLE
#if defined(__INTEL_COMPILER) || defined(__ICL) || defined(__ICC) || \
defined(__ECC)
# if !defined(BOOST_COMP_INTEL_DETECTION) && defined(__INTEL_COMPILER)
# define BOOST_COMP_INTEL_DETECTION BOOST_PREDEF_MAKE_10_VRP(__INTEL_COMPILER)
# endif
# if !defined(BOOST_COMP_INTEL_DETECTION)
# define BOOST_COMP_INTEL_DETECTION BOOST_VERSION_NUMBER_AVAILABLE
# endif
#endif
#ifdef BOOST_COMP_INTEL_DETECTION
# if defined(BOOST_PREDEF_DETAIL_COMP_DETECTED)
# define BOOST_COMP_INTEL_EMULATED BOOST_COMP_INTEL_DETECTION
# else
# undef BOOST_COMP_INTEL
# define BOOST_COMP_INTEL BOOST_COMP_INTEL_DETECTION
# endif
# define BOOST_COMP_INTEL_AVAILABLE
# include <boost/predef/detail/comp_detected.h>
#endif
#define BOOST_COMP_INTEL_NAME "Intel C/C++"
#endif
#include <boost/predef/detail/test.h>
BOOST_PREDEF_DECLARE_TEST(BOOST_COMP_INTEL,BOOST_COMP_INTEL_NAME)
#ifdef BOOST_COMP_INTEL_EMULATED
#include <boost/predef/detail/test.h>
BOOST_PREDEF_DECLARE_TEST(BOOST_COMP_INTEL_EMULATED,BOOST_COMP_INTEL_NAME)
#endif
@@ -0,0 +1,253 @@
//////////////////////////////////////////////////////////////////////////////
//
// (C) Copyright Ion Gaztanaga 2005-2012. Distributed under the Boost
// Software License, Version 1.0. (See accompanying file
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
//
// See http://www.boost.org/libs/interprocess for documentation.
//
//////////////////////////////////////////////////////////////////////////////
#ifndef BOOST_INTERPROCESS_POSIX_SEMAPHORE_WRAPPER_HPP
#define BOOST_INTERPROCESS_POSIX_SEMAPHORE_WRAPPER_HPP
#ifndef BOOST_CONFIG_HPP
# include <boost/config.hpp>
#endif
#
#if defined(BOOST_HAS_PRAGMA_ONCE)
# pragma once
#endif
#include <boost/interprocess/detail/posix_time_types_wrk.hpp>
#include <boost/interprocess/exceptions.hpp>
#include <boost/interprocess/creation_tags.hpp>
#include <boost/interprocess/detail/os_file_functions.hpp>
#include <boost/interprocess/detail/shared_dir_helpers.hpp>
#include <boost/interprocess/permissions.hpp>
#include <fcntl.h> //O_CREAT, O_*...
#include <unistd.h> //close
#include <string> //std::string
#include <semaphore.h> //sem_* family, SEM_VALUE_MAX
#include <sys/stat.h> //mode_t, S_IRWXG, S_IRWXO, S_IRWXU,
#include <boost/assert.hpp>
#ifdef SEM_FAILED
#define BOOST_INTERPROCESS_POSIX_SEM_FAILED (reinterpret_cast<sem_t*>(SEM_FAILED))
#else
#define BOOST_INTERPROCESS_POSIX_SEM_FAILED (reinterpret_cast<sem_t*>(-1))
#endif
#ifdef BOOST_INTERPROCESS_POSIX_TIMEOUTS
#include <boost/interprocess/sync/posix/ptime_to_timespec.hpp>
#else
#include <boost/interprocess/detail/os_thread_functions.hpp>
#include <boost/interprocess/sync/detail/locks.hpp>
#include <boost/interprocess/sync/detail/common_algorithms.hpp>
#endif
namespace boost {
namespace interprocess {
namespace ipcdetail {
#ifdef BOOST_INTERPROCESS_POSIX_NAMED_SEMAPHORES
inline bool semaphore_open
(sem_t *&handle, create_enum_t type, const char *origname,
unsigned int count = 0, const permissions &perm = permissions())
{
std::string name;
#ifndef BOOST_INTERPROCESS_FILESYSTEM_BASED_POSIX_SEMAPHORES
add_leading_slash(origname, name);
#else
create_shared_dir_cleaning_old_and_get_filepath(origname, name);
#endif
//Create new mapping
int oflag = 0;
switch(type){
case DoOpen:
{
//No addition
handle = ::sem_open(name.c_str(), oflag);
}
break;
case DoOpenOrCreate:
case DoCreate:
{
while(1){
oflag = (O_CREAT | O_EXCL);
handle = ::sem_open(name.c_str(), oflag, perm.get_permissions(), count);
if(handle != BOOST_INTERPROCESS_POSIX_SEM_FAILED){
//We can't change semaphore permissions!
//::fchmod(handle, perm.get_permissions());
break;
}
else if(errno == EEXIST && type == DoOpenOrCreate){
oflag = 0;
if( (handle = ::sem_open(name.c_str(), oflag)) != BOOST_INTERPROCESS_POSIX_SEM_FAILED
|| (errno != ENOENT) ){
break;
}
}
else{
break;
}
}
}
break;
default:
{
error_info err(other_error);
throw interprocess_exception(err);
}
}
//Check for error
if(handle == BOOST_INTERPROCESS_POSIX_SEM_FAILED){
throw interprocess_exception(error_info(errno));
}
return true;
}
inline void semaphore_close(sem_t *handle)
{
int ret = sem_close(handle);
if(ret != 0){
BOOST_ASSERT(0);
}
}
inline bool semaphore_unlink(const char *semname)
{
try{
std::string sem_str;
#ifndef BOOST_INTERPROCESS_FILESYSTEM_BASED_POSIX_SEMAPHORES
add_leading_slash(semname, sem_str);
#else
shared_filepath(semname, sem_str);
#endif
return 0 == sem_unlink(sem_str.c_str());
}
catch(...){
return false;
}
}
#endif //BOOST_INTERPROCESS_POSIX_NAMED_SEMAPHORES
#ifdef BOOST_INTERPROCESS_POSIX_UNNAMED_SEMAPHORES
inline void semaphore_init(sem_t *handle, unsigned int initialCount)
{
int ret = sem_init(handle, 1, initialCount);
//According to SUSV3 version 2003 edition, the return value of a successful
//sem_init call is not defined, but -1 is returned on failure.
//In the future, a successful call might be required to return 0.
if(ret == -1){
error_info err = system_error_code();
throw interprocess_exception(err);
}
}
inline void semaphore_destroy(sem_t *handle)
{
int ret = sem_destroy(handle);
if(ret != 0){
BOOST_ASSERT(0);
}
}
#endif //BOOST_INTERPROCESS_POSIX_UNNAMED_SEMAPHORES
inline void semaphore_post(sem_t *handle)
{
int ret = sem_post(handle);
if(ret != 0){
error_info err = system_error_code();
throw interprocess_exception(err);
}
}
inline void semaphore_wait(sem_t *handle)
{
int ret = sem_wait(handle);
if(ret != 0){
error_info err = system_error_code();
throw interprocess_exception(err);
}
}
inline bool semaphore_try_wait(sem_t *handle)
{
int res = sem_trywait(handle);
if(res == 0)
return true;
if(system_error_code() == EAGAIN){
return false;
}
error_info err = system_error_code();
throw interprocess_exception(err);
}
#ifndef BOOST_INTERPROCESS_POSIX_TIMEOUTS
struct semaphore_wrapper_try_wrapper
{
explicit semaphore_wrapper_try_wrapper(sem_t *handle)
: m_handle(handle)
{}
void wait()
{ semaphore_wait(m_handle); }
bool try_wait()
{ return semaphore_try_wait(m_handle); }
private:
sem_t *m_handle;
};
#endif
inline bool semaphore_timed_wait(sem_t *handle, const boost::posix_time::ptime &abs_time)
{
#ifdef BOOST_INTERPROCESS_POSIX_TIMEOUTS
//Posix does not support infinity absolute time so handle it here
if(abs_time == boost::posix_time::pos_infin){
semaphore_wait(handle);
return true;
}
timespec tspec = ptime_to_timespec(abs_time);
for (;;){
int res = sem_timedwait(handle, &tspec);
if(res == 0)
return true;
if (res > 0){
//buggy glibc, copy the returned error code to errno
errno = res;
}
if(system_error_code() == ETIMEDOUT){
return false;
}
error_info err = system_error_code();
throw interprocess_exception(err);
}
return false;
#else //#ifdef BOOST_INTERPROCESS_POSIX_TIMEOUTS
semaphore_wrapper_try_wrapper swtw(handle);
ipcdetail::lock_to_wait<semaphore_wrapper_try_wrapper> lw(swtw);
return ipcdetail::try_based_timed_lock(lw, abs_time);
#endif //#ifdef BOOST_INTERPROCESS_POSIX_TIMEOUTS
}
} //namespace ipcdetail {
} //namespace interprocess {
} //namespace boost {
#endif //#ifndef BOOST_INTERPROCESS_POSIX_SEMAPHORE_WRAPPER_HPP
@@ -0,0 +1,51 @@
/*=============================================================================
Copyright (c) 2011 Thomas Heller
Distributed under the Boost Software License, Version 1.0. (See accompanying
file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
==============================================================================*/
#ifndef BOOST_PHOENIX_CORE_V2_EVAL_HPP
#define BOOST_PHOENIX_CORE_V2_EVAL_HPP
#include <boost/phoenix/core/limits.hpp>
#include <boost/phoenix/core/environment.hpp>
#include <boost/phoenix/core/is_actor.hpp>
#include <boost/phoenix/core/meta_grammar.hpp>
#include <boost/phoenix/core/terminal_fwd.hpp>
#include <boost/phoenix/support/vector.hpp>
#include <boost/proto/transform/fold.hpp>
#include <boost/proto/transform/lazy.hpp>
namespace boost { namespace phoenix
{
struct v2_eval
: proto::callable
{
template <typename Sig>
struct result;
template <typename This, typename Eval, typename Env>
struct result<This(Eval, Env)>
: Eval::template result<typename proto::detail::uncvref<Env>::type>
{};
template <typename This, typename Eval, typename Env>
struct result<This(Eval &, Env)>
: Eval::template result<typename proto::detail::uncvref<Env>::type>
{};
template <typename This, typename Eval, typename Env>
struct result<This(Eval const &, Env)>
: Eval::template result<typename proto::detail::uncvref<Env>::type>
{};
template <typename Eval, typename Env>
typename result<v2_eval(Eval const&, Env)>::type
operator()(Eval const & e, Env const & env) const
{
return e.eval(env);
}
};
}}
#endif
@@ -0,0 +1,84 @@
// (C) Copyright Steve Cleary, Beman Dawes, Howard Hinnant & John Maddock 2000.
// Use, modification and distribution are subject to the Boost Software License,
// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt).
//
// See http://www.boost.org/libs/type_traits for most recent version including documentation.
#ifndef BOOST_TT_HAS_NOTHROW_ASSIGN_HPP_INCLUDED
#define BOOST_TT_HAS_NOTHROW_ASSIGN_HPP_INCLUDED
#include <cstddef> // size_t
#include <boost/type_traits/integral_constant.hpp>
#include <boost/type_traits/intrinsics.hpp>
#if !defined(BOOST_HAS_NOTHROW_ASSIGN) || defined(BOOST_MSVC) || defined(BOOST_INTEL)
#include <boost/type_traits/has_trivial_assign.hpp>
#if !defined(BOOST_NO_CXX11_NOEXCEPT) && !defined(BOOST_NO_CXX11_RVALUE_REFERENCES)
#include <boost/type_traits/declval.hpp>
#include <boost/type_traits/is_const.hpp>
#include <boost/type_traits/is_volatile.hpp>
#include <boost/type_traits/is_reference.hpp>
#include <boost/type_traits/is_assignable.hpp>
#include <boost/type_traits/add_reference.hpp>
#include <boost/type_traits/remove_reference.hpp>
#endif
#endif
#if defined(__GNUC__) || defined(__SUNPRO_CC) || defined(__clang__)
#include <boost/type_traits/is_const.hpp>
#include <boost/type_traits/is_volatile.hpp>
#include <boost/type_traits/is_assignable.hpp>
#include <boost/type_traits/is_array.hpp>
#ifdef BOOST_INTEL
#include <boost/type_traits/is_pod.hpp>
#endif
#endif
namespace boost {
#if !defined(BOOST_HAS_NOTHROW_ASSIGN) && !defined(BOOST_NO_CXX11_NOEXCEPT) && !defined(BOOST_NO_CXX11_RVALUE_REFERENCES)
namespace detail
{
template <class T, bool b1, bool b2> struct has_nothrow_assign_imp{ static const bool value = false; };
template <class T> struct has_nothrow_assign_imp<T, false, true>{ static const bool value = noexcept(boost::declval<typename add_reference<T>::type>() = boost::declval<typename add_reference<T const>::type>()); };
template <class T, std::size_t N> struct has_nothrow_assign_imp<T[N], false, true>{ static const bool value = has_nothrow_assign_imp<T, false, true>::value; };
template <class T> struct has_nothrow_assign_imp<T[], false, true>{ static const bool value = has_nothrow_assign_imp<T, false, true>::value; };
}
#endif
template <class T>
struct has_nothrow_assign : public integral_constant < bool,
#ifndef BOOST_HAS_NOTHROW_ASSIGN
#if !defined(BOOST_NO_CXX11_NOEXCEPT) && !defined(BOOST_NO_CXX11_RVALUE_REFERENCES)
// Portable C++11 version:
detail::has_nothrow_assign_imp<T,
(is_const<typename remove_reference<T>::type>::value || is_volatile<typename remove_reference<T>::type>::value || is_reference<T>::value),
is_assignable<typename add_reference<T>::type, typename add_reference<const T>::type>::value
>::value
#else
::boost::has_trivial_assign<T>::value
#endif
#else
BOOST_HAS_NOTHROW_ASSIGN(T)
#endif
> {};
template <class T, std::size_t N> struct has_nothrow_assign <T[N]> : public has_nothrow_assign<T> {};
template <> struct has_nothrow_assign<void> : public false_type{};
template <class T> struct has_nothrow_assign<T volatile> : public false_type{};
template <class T> struct has_nothrow_assign<T&> : public false_type{};
#if !defined(BOOST_NO_CXX11_RVALUE_REFERENCES)
template <class T> struct has_nothrow_assign<T&&> : public false_type{};
#endif
#ifndef BOOST_NO_CV_VOID_SPECIALIZATIONS
template <> struct has_nothrow_assign<void const> : public false_type{};
template <> struct has_nothrow_assign<void const volatile> : public false_type{};
template <> struct has_nothrow_assign<void volatile> : public false_type{};
#endif
} // namespace boost
#endif // BOOST_TT_HAS_NOTHROW_ASSIGN_HPP_INCLUDED
@@ -0,0 +1,64 @@
#ifndef BOOST_MPL_AUX_IS_MSVC_ETI_ARG_HPP_INCLUDED
#define BOOST_MPL_AUX_IS_MSVC_ETI_ARG_HPP_INCLUDED
// Copyright Aleksey Gurtovoy 2001-2004
//
// Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
//
// See http://www.boost.org/libs/mpl for documentation.
// $Id$
// $Date$
// $Revision$
#include <boost/mpl/aux_/yes_no.hpp>
#include <boost/mpl/aux_/config/eti.hpp>
#include <boost/mpl/aux_/config/static_constant.hpp>
namespace boost { namespace mpl { namespace aux {
#if defined(BOOST_MPL_CFG_MSVC_ETI_BUG)
#if defined(BOOST_MPL_CFG_MSVC_60_ETI_BUG)
template< typename T >
struct is_msvc_eti_arg
{
BOOST_STATIC_CONSTANT(bool, value = false);
};
#else // BOOST_MPL_CFG_MSVC_60_ETI_BUG
struct eti_int_convertible
{
eti_int_convertible(int);
};
template< typename T >
struct is_msvc_eti_arg
{
static no_tag test(...);
static yes_tag test(eti_int_convertible);
static T& get();
BOOST_STATIC_CONSTANT(bool, value =
sizeof(test(get())) == sizeof(yes_tag)
);
};
#endif
template<>
struct is_msvc_eti_arg<int>
{
BOOST_STATIC_CONSTANT(bool, value = true);
};
#endif // BOOST_MPL_CFG_MSVC_ETI_BUG
}}}
#endif // BOOST_MPL_AUX_IS_MSVC_ETI_ARG_HPP_INCLUDED
@@ -0,0 +1,260 @@
// (C) Copyright John Maddock 2005-2006.
// Use, modification and distribution are subject to the
// Boost Software License, Version 1.0. (See accompanying file
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
#ifndef BOOST_MATH_TOOLS_FRACTION_INCLUDED
#define BOOST_MATH_TOOLS_FRACTION_INCLUDED
#ifdef _MSC_VER
#pragma once
#endif
#include <boost/config/no_tr1/cmath.hpp>
#include <boost/cstdint.hpp>
#include <boost/type_traits/integral_constant.hpp>
#include <boost/mpl/if.hpp>
#include <boost/math/tools/precision.hpp>
namespace boost{ namespace math{ namespace tools{
namespace detail
{
template <class T>
struct is_pair : public boost::false_type{};
template <class T, class U>
struct is_pair<std::pair<T,U> > : public boost::true_type{};
template <class Gen>
struct fraction_traits_simple
{
typedef typename Gen::result_type result_type;
typedef typename Gen::result_type value_type;
static result_type a(const value_type&) BOOST_MATH_NOEXCEPT(value_type)
{
return 1;
}
static result_type b(const value_type& v) BOOST_MATH_NOEXCEPT(value_type)
{
return v;
}
};
template <class Gen>
struct fraction_traits_pair
{
typedef typename Gen::result_type value_type;
typedef typename value_type::first_type result_type;
static result_type a(const value_type& v) BOOST_MATH_NOEXCEPT(value_type)
{
return v.first;
}
static result_type b(const value_type& v) BOOST_MATH_NOEXCEPT(value_type)
{
return v.second;
}
};
template <class Gen>
struct fraction_traits
: public boost::mpl::if_c<
is_pair<typename Gen::result_type>::value,
fraction_traits_pair<Gen>,
fraction_traits_simple<Gen> >::type
{
};
} // namespace detail
//
// continued_fraction_b
// Evaluates:
//
// b0 + a1
// ---------------
// b1 + a2
// ----------
// b2 + a3
// -----
// b3 + ...
//
// Note that the first a0 returned by generator Gen is disarded.
//
template <class Gen, class U>
inline typename detail::fraction_traits<Gen>::result_type continued_fraction_b(Gen& g, const U& factor, boost::uintmax_t& max_terms)
BOOST_NOEXCEPT_IF(BOOST_MATH_IS_FLOAT(typename detail::fraction_traits<Gen>::result_type) && noexcept(std::declval<Gen>()()))
{
BOOST_MATH_STD_USING // ADL of std names
typedef detail::fraction_traits<Gen> traits;
typedef typename traits::result_type result_type;
typedef typename traits::value_type value_type;
result_type tiny = tools::min_value<result_type>();
value_type v = g();
result_type f, C, D, delta;
f = traits::b(v);
if(f == 0)
f = tiny;
C = f;
D = 0;
boost::uintmax_t counter(max_terms);
do{
v = g();
D = traits::b(v) + traits::a(v) * D;
if(D == 0)
D = tiny;
C = traits::b(v) + traits::a(v) / C;
if(C == 0)
C = tiny;
D = 1/D;
delta = C*D;
f = f * delta;
}while((fabs(delta - 1) > factor) && --counter);
max_terms = max_terms - counter;
return f;
}
template <class Gen, class U>
inline typename detail::fraction_traits<Gen>::result_type continued_fraction_b(Gen& g, const U& factor)
BOOST_NOEXCEPT_IF(BOOST_MATH_IS_FLOAT(typename detail::fraction_traits<Gen>::result_type) && noexcept(std::declval<Gen>()()))
{
boost::uintmax_t max_terms = (std::numeric_limits<boost::uintmax_t>::max)();
return continued_fraction_b(g, factor, max_terms);
}
template <class Gen>
inline typename detail::fraction_traits<Gen>::result_type continued_fraction_b(Gen& g, int bits)
BOOST_NOEXCEPT_IF(BOOST_MATH_IS_FLOAT(typename detail::fraction_traits<Gen>::result_type) && noexcept(std::declval<Gen>()()))
{
BOOST_MATH_STD_USING // ADL of std names
typedef detail::fraction_traits<Gen> traits;
typedef typename traits::result_type result_type;
result_type factor = ldexp(1.0f, 1 - bits); // 1 / pow(result_type(2), bits);
boost::uintmax_t max_terms = (std::numeric_limits<boost::uintmax_t>::max)();
return continued_fraction_b(g, factor, max_terms);
}
template <class Gen>
inline typename detail::fraction_traits<Gen>::result_type continued_fraction_b(Gen& g, int bits, boost::uintmax_t& max_terms)
BOOST_NOEXCEPT_IF(BOOST_MATH_IS_FLOAT(typename detail::fraction_traits<Gen>::result_type) && noexcept(std::declval<Gen>()()))
{
BOOST_MATH_STD_USING // ADL of std names
typedef detail::fraction_traits<Gen> traits;
typedef typename traits::result_type result_type;
result_type factor = ldexp(1.0f, 1 - bits); // 1 / pow(result_type(2), bits);
return continued_fraction_b(g, factor, max_terms);
}
//
// continued_fraction_a
// Evaluates:
//
// a1
// ---------------
// b1 + a2
// ----------
// b2 + a3
// -----
// b3 + ...
//
// Note that the first a1 and b1 returned by generator Gen are both used.
//
template <class Gen, class U>
inline typename detail::fraction_traits<Gen>::result_type continued_fraction_a(Gen& g, const U& factor, boost::uintmax_t& max_terms)
BOOST_NOEXCEPT_IF(BOOST_MATH_IS_FLOAT(typename detail::fraction_traits<Gen>::result_type) && noexcept(std::declval<Gen>()()))
{
BOOST_MATH_STD_USING // ADL of std names
typedef detail::fraction_traits<Gen> traits;
typedef typename traits::result_type result_type;
typedef typename traits::value_type value_type;
result_type tiny = tools::min_value<result_type>();
value_type v = g();
result_type f, C, D, delta, a0;
f = traits::b(v);
a0 = traits::a(v);
if(f == 0)
f = tiny;
C = f;
D = 0;
boost::uintmax_t counter(max_terms);
do{
v = g();
D = traits::b(v) + traits::a(v) * D;
if(D == 0)
D = tiny;
C = traits::b(v) + traits::a(v) / C;
if(C == 0)
C = tiny;
D = 1/D;
delta = C*D;
f = f * delta;
}while((fabs(delta - 1) > factor) && --counter);
max_terms = max_terms - counter;
return a0/f;
}
template <class Gen, class U>
inline typename detail::fraction_traits<Gen>::result_type continued_fraction_a(Gen& g, const U& factor)
BOOST_NOEXCEPT_IF(BOOST_MATH_IS_FLOAT(typename detail::fraction_traits<Gen>::result_type) && noexcept(std::declval<Gen>()()))
{
boost::uintmax_t max_iter = (std::numeric_limits<boost::uintmax_t>::max)();
return continued_fraction_a(g, factor, max_iter);
}
template <class Gen>
inline typename detail::fraction_traits<Gen>::result_type continued_fraction_a(Gen& g, int bits)
BOOST_NOEXCEPT_IF(BOOST_MATH_IS_FLOAT(typename detail::fraction_traits<Gen>::result_type) && noexcept(std::declval<Gen>()()))
{
BOOST_MATH_STD_USING // ADL of std names
typedef detail::fraction_traits<Gen> traits;
typedef typename traits::result_type result_type;
result_type factor = ldexp(1.0f, 1-bits); // 1 / pow(result_type(2), bits);
boost::uintmax_t max_iter = (std::numeric_limits<boost::uintmax_t>::max)();
return continued_fraction_a(g, factor, max_iter);
}
template <class Gen>
inline typename detail::fraction_traits<Gen>::result_type continued_fraction_a(Gen& g, int bits, boost::uintmax_t& max_terms)
BOOST_NOEXCEPT_IF(BOOST_MATH_IS_FLOAT(typename detail::fraction_traits<Gen>::result_type) && noexcept(std::declval<Gen>()()))
{
BOOST_MATH_STD_USING // ADL of std names
typedef detail::fraction_traits<Gen> traits;
typedef typename traits::result_type result_type;
result_type factor = ldexp(1.0f, 1-bits); // 1 / pow(result_type(2), bits);
return continued_fraction_a(g, factor, max_terms);
}
} // namespace tools
} // namespace math
} // namespace boost
#endif // BOOST_MATH_TOOLS_FRACTION_INCLUDED
@@ -0,0 +1,328 @@
// Copyright Aleksey Gurtovoy 2000-2004
//
// Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
//
// *Preprocessed* version of the main "list_c.hpp" header
// -- DO NOT modify by hand!
namespace boost { namespace mpl {
template<
typename T, long C0 = LONG_MAX, long C1 = LONG_MAX, long C2 = LONG_MAX
, long C3 = LONG_MAX, long C4 = LONG_MAX, long C5 = LONG_MAX
, long C6 = LONG_MAX, long C7 = LONG_MAX, long C8 = LONG_MAX
, long C9 = LONG_MAX, long C10 = LONG_MAX, long C11 = LONG_MAX
, long C12 = LONG_MAX, long C13 = LONG_MAX, long C14 = LONG_MAX
, long C15 = LONG_MAX, long C16 = LONG_MAX, long C17 = LONG_MAX
, long C18 = LONG_MAX, long C19 = LONG_MAX
>
struct list_c;
template<
typename T
>
struct list_c<
T, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX
, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX
, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX
>
: list0_c<T>
{
typedef typename list0_c<T>::type type;
};
template<
typename T, long C0
>
struct list_c<
T, C0, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX
, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX
, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX
>
: list1_c< T,C0 >
{
typedef typename list1_c< T,C0 >::type type;
};
template<
typename T, long C0, long C1
>
struct list_c<
T, C0, C1, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX
, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX
, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX
>
: list2_c< T,C0,C1 >
{
typedef typename list2_c< T,C0,C1 >::type type;
};
template<
typename T, long C0, long C1, long C2
>
struct list_c<
T, C0, C1, C2, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX
, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX
, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX
>
: list3_c< T,C0,C1,C2 >
{
typedef typename list3_c< T,C0,C1,C2 >::type type;
};
template<
typename T, long C0, long C1, long C2, long C3
>
struct list_c<
T, C0, C1, C2, C3, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX
, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX
, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX
>
: list4_c< T,C0,C1,C2,C3 >
{
typedef typename list4_c< T,C0,C1,C2,C3 >::type type;
};
template<
typename T, long C0, long C1, long C2, long C3, long C4
>
struct list_c<
T, C0, C1, C2, C3, C4, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX
, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX
, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX
>
: list5_c< T,C0,C1,C2,C3,C4 >
{
typedef typename list5_c< T,C0,C1,C2,C3,C4 >::type type;
};
template<
typename T, long C0, long C1, long C2, long C3, long C4, long C5
>
struct list_c<
T, C0, C1, C2, C3, C4, C5, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX
, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX
, LONG_MAX, LONG_MAX, LONG_MAX
>
: list6_c< T,C0,C1,C2,C3,C4,C5 >
{
typedef typename list6_c< T,C0,C1,C2,C3,C4,C5 >::type type;
};
template<
typename T, long C0, long C1, long C2, long C3, long C4, long C5
, long C6
>
struct list_c<
T, C0, C1, C2, C3, C4, C5, C6, LONG_MAX, LONG_MAX, LONG_MAX
, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX
, LONG_MAX, LONG_MAX, LONG_MAX
>
: list7_c< T,C0,C1,C2,C3,C4,C5,C6 >
{
typedef typename list7_c< T,C0,C1,C2,C3,C4,C5,C6 >::type type;
};
template<
typename T, long C0, long C1, long C2, long C3, long C4, long C5
, long C6, long C7
>
struct list_c<
T, C0, C1, C2, C3, C4, C5, C6, C7, LONG_MAX, LONG_MAX, LONG_MAX
, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX
, LONG_MAX, LONG_MAX
>
: list8_c< T,C0,C1,C2,C3,C4,C5,C6,C7 >
{
typedef typename list8_c< T,C0,C1,C2,C3,C4,C5,C6,C7 >::type type;
};
template<
typename T, long C0, long C1, long C2, long C3, long C4, long C5
, long C6, long C7, long C8
>
struct list_c<
T, C0, C1, C2, C3, C4, C5, C6, C7, C8, LONG_MAX, LONG_MAX, LONG_MAX
, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX
, LONG_MAX
>
: list9_c< T,C0,C1,C2,C3,C4,C5,C6,C7,C8 >
{
typedef typename list9_c< T,C0,C1,C2,C3,C4,C5,C6,C7,C8 >::type type;
};
template<
typename T, long C0, long C1, long C2, long C3, long C4, long C5
, long C6, long C7, long C8, long C9
>
struct list_c<
T, C0, C1, C2, C3, C4, C5, C6, C7, C8, C9, LONG_MAX, LONG_MAX
, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX
, LONG_MAX
>
: list10_c< T,C0,C1,C2,C3,C4,C5,C6,C7,C8,C9 >
{
typedef typename list10_c< T,C0,C1,C2,C3,C4,C5,C6,C7,C8,C9 >::type type;
};
template<
typename T, long C0, long C1, long C2, long C3, long C4, long C5
, long C6, long C7, long C8, long C9, long C10
>
struct list_c<
T, C0, C1, C2, C3, C4, C5, C6, C7, C8, C9, C10, LONG_MAX, LONG_MAX
, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX
>
: list11_c< T,C0,C1,C2,C3,C4,C5,C6,C7,C8,C9,C10 >
{
typedef typename list11_c< T,C0,C1,C2,C3,C4,C5,C6,C7,C8,C9,C10 >::type type;
};
template<
typename T, long C0, long C1, long C2, long C3, long C4, long C5
, long C6, long C7, long C8, long C9, long C10, long C11
>
struct list_c<
T, C0, C1, C2, C3, C4, C5, C6, C7, C8, C9, C10, C11, LONG_MAX
, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX
>
: list12_c< T,C0,C1,C2,C3,C4,C5,C6,C7,C8,C9,C10,C11 >
{
typedef typename list12_c< T,C0,C1,C2,C3,C4,C5,C6,C7,C8,C9,C10,C11 >::type type;
};
template<
typename T, long C0, long C1, long C2, long C3, long C4, long C5
, long C6, long C7, long C8, long C9, long C10, long C11, long C12
>
struct list_c<
T, C0, C1, C2, C3, C4, C5, C6, C7, C8, C9, C10, C11, C12, LONG_MAX
, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX
>
: list13_c< T,C0,C1,C2,C3,C4,C5,C6,C7,C8,C9,C10,C11,C12 >
{
typedef typename list13_c< T,C0,C1,C2,C3,C4,C5,C6,C7,C8,C9,C10,C11,C12 >::type type;
};
template<
typename T, long C0, long C1, long C2, long C3, long C4, long C5
, long C6, long C7, long C8, long C9, long C10, long C11, long C12
, long C13
>
struct list_c<
T, C0, C1, C2, C3, C4, C5, C6, C7, C8, C9, C10, C11, C12, C13
, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX
>
: list14_c<
T, C0, C1, C2, C3, C4, C5, C6, C7, C8, C9, C10, C11, C12, C13
>
{
typedef typename list14_c< T,C0,C1,C2,C3,C4,C5,C6,C7,C8,C9,C10,C11,C12,C13 >::type type;
};
template<
typename T, long C0, long C1, long C2, long C3, long C4, long C5
, long C6, long C7, long C8, long C9, long C10, long C11, long C12
, long C13, long C14
>
struct list_c<
T, C0, C1, C2, C3, C4, C5, C6, C7, C8, C9, C10, C11, C12, C13, C14
, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX
>
: list15_c<
T, C0, C1, C2, C3, C4, C5, C6, C7, C8, C9, C10, C11, C12, C13, C14
>
{
typedef typename list15_c< T,C0,C1,C2,C3,C4,C5,C6,C7,C8,C9,C10,C11,C12,C13,C14 >::type type;
};
template<
typename T, long C0, long C1, long C2, long C3, long C4, long C5
, long C6, long C7, long C8, long C9, long C10, long C11, long C12
, long C13, long C14, long C15
>
struct list_c<
T, C0, C1, C2, C3, C4, C5, C6, C7, C8, C9, C10, C11, C12, C13, C14
, C15, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX
>
: list16_c<
T, C0, C1, C2, C3, C4, C5, C6, C7, C8, C9, C10, C11, C12, C13, C14
, C15
>
{
typedef typename list16_c< T,C0,C1,C2,C3,C4,C5,C6,C7,C8,C9,C10,C11,C12,C13,C14,C15 >::type type;
};
template<
typename T, long C0, long C1, long C2, long C3, long C4, long C5
, long C6, long C7, long C8, long C9, long C10, long C11, long C12
, long C13, long C14, long C15, long C16
>
struct list_c<
T, C0, C1, C2, C3, C4, C5, C6, C7, C8, C9, C10, C11, C12, C13, C14
, C15, C16, LONG_MAX, LONG_MAX, LONG_MAX
>
: list17_c<
T, C0, C1, C2, C3, C4, C5, C6, C7, C8, C9, C10, C11, C12, C13, C14
, C15, C16
>
{
typedef typename list17_c< T,C0,C1,C2,C3,C4,C5,C6,C7,C8,C9,C10,C11,C12,C13,C14,C15,C16 >::type type;
};
template<
typename T, long C0, long C1, long C2, long C3, long C4, long C5
, long C6, long C7, long C8, long C9, long C10, long C11, long C12
, long C13, long C14, long C15, long C16, long C17
>
struct list_c<
T, C0, C1, C2, C3, C4, C5, C6, C7, C8, C9, C10, C11, C12, C13, C14
, C15, C16, C17, LONG_MAX, LONG_MAX
>
: list18_c<
T, C0, C1, C2, C3, C4, C5, C6, C7, C8, C9, C10, C11, C12, C13, C14
, C15, C16, C17
>
{
typedef typename list18_c< T,C0,C1,C2,C3,C4,C5,C6,C7,C8,C9,C10,C11,C12,C13,C14,C15,C16,C17 >::type type;
};
template<
typename T, long C0, long C1, long C2, long C3, long C4, long C5
, long C6, long C7, long C8, long C9, long C10, long C11, long C12
, long C13, long C14, long C15, long C16, long C17, long C18
>
struct list_c<
T, C0, C1, C2, C3, C4, C5, C6, C7, C8, C9, C10, C11, C12, C13, C14
, C15, C16, C17, C18, LONG_MAX
>
: list19_c<
T, C0, C1, C2, C3, C4, C5, C6, C7, C8, C9, C10, C11, C12, C13, C14
, C15, C16, C17, C18
>
{
typedef typename list19_c< T,C0,C1,C2,C3,C4,C5,C6,C7,C8,C9,C10,C11,C12,C13,C14,C15,C16,C17,C18 >::type type;
};
/// primary template (not a specialization!)
template<
typename T, long C0, long C1, long C2, long C3, long C4, long C5
, long C6, long C7, long C8, long C9, long C10, long C11, long C12
, long C13, long C14, long C15, long C16, long C17, long C18, long C19
>
struct list_c
: list20_c<
T, C0, C1, C2, C3, C4, C5, C6, C7, C8, C9, C10, C11, C12, C13, C14
, C15, C16, C17, C18, C19
>
{
typedef typename list20_c< T,C0,C1,C2,C3,C4,C5,C6,C7,C8,C9,C10,C11,C12,C13,C14,C15,C16,C17,C18,C19 >::type type;
};
}}
@@ -0,0 +1,208 @@
// Boost.Units - A C++ library for zero-overhead dimensional analysis and
// unit/quantity manipulation and conversion
//
// Copyright (C) 2003-2008 Matthias Christian Schabel
// Copyright (C) 2008 Steven Watanabe
//
// 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_UNITS_DERIVED_DIMENSION_HPP
#define BOOST_UNITS_DERIVED_DIMENSION_HPP
#include <boost/units/dim.hpp>
#include <boost/units/dimension.hpp>
#include <boost/units/static_rational.hpp>
#include <boost/units/units_fwd.hpp>
#include <boost/units/detail/dimension_list.hpp>
namespace boost {
namespace units {
/// A utility class for defining composite dimensions with integer powers.
template<class DT1 = dimensionless_type,long E1 = 0,
class DT2 = dimensionless_type,long E2 = 0,
class DT3 = dimensionless_type,long E3 = 0,
class DT4 = dimensionless_type,long E4 = 0,
class DT5 = dimensionless_type,long E5 = 0,
class DT6 = dimensionless_type,long E6 = 0,
class DT7 = dimensionless_type,long E7 = 0,
class DT8 = dimensionless_type,long E8 = 0>
struct derived_dimension
{
#ifdef BOOST_UNITS_DOXYGEN
typedef detail::unspecified type;
#else
typedef typename
make_dimension_list< list< dim< DT1,static_rational<E1> >,
list< dim< DT2,static_rational<E2> >,
list< dim< DT3,static_rational<E3> >,
list< dim< DT4,static_rational<E4> >,
list< dim< DT5,static_rational<E5> >,
list< dim< DT6,static_rational<E6> >,
list< dim< DT7,static_rational<E7> >,
list< dim< DT8,static_rational<E8> >, dimensionless_type > > > > > > > > >::type type;
#endif
};
/// INTERNAL ONLY
template<class DT1,long E1>
struct derived_dimension<
DT1, E1,
dimensionless_type,0,
dimensionless_type,0,
dimensionless_type,0,
dimensionless_type,0,
dimensionless_type,0,
dimensionless_type,0,
dimensionless_type,0>
{
typedef typename
make_dimension_list< list< dim< DT1,static_rational<E1> >, dimensionless_type > >::type type;
};
/// INTERNAL ONLY
template<class DT1,long E1,
class DT2,long E2>
struct derived_dimension<
DT1, E1,
DT2, E2,
dimensionless_type,0,
dimensionless_type,0,
dimensionless_type,0,
dimensionless_type,0,
dimensionless_type,0,
dimensionless_type,0>
{
typedef typename
make_dimension_list< list< dim< DT1,static_rational<E1> >,
list< dim< DT2,static_rational<E2> >, dimensionless_type > > >::type type;
};
/// INTERNAL ONLY
template<class DT1,long E1,
class DT2,long E2,
class DT3,long E3>
struct derived_dimension<
DT1, E1,
DT2, E2,
DT3, E3,
dimensionless_type,0,
dimensionless_type,0,
dimensionless_type,0,
dimensionless_type,0,
dimensionless_type,0>
{
typedef typename
make_dimension_list< list< dim< DT1,static_rational<E1> >,
list< dim< DT2,static_rational<E2> >,
list< dim< DT3,static_rational<E3> >, dimensionless_type > > > >::type type;
};
/// INTERNAL ONLY
template<class DT1,long E1,
class DT2,long E2,
class DT3,long E3,
class DT4,long E4>
struct derived_dimension<
DT1, E1,
DT2, E2,
DT3, E3,
DT4, E4,
dimensionless_type,0,
dimensionless_type,0,
dimensionless_type,0,
dimensionless_type,0>
{
typedef typename
make_dimension_list< list< dim< DT1,static_rational<E1> >,
list< dim< DT2,static_rational<E2> >,
list< dim< DT3,static_rational<E3> >,
list< dim< DT4,static_rational<E4> >, dimensionless_type > > > > >::type type;
};
/// INTERNAL ONLY
template<class DT1,long E1,
class DT2,long E2,
class DT3,long E3,
class DT4,long E4,
class DT5,long E5>
struct derived_dimension<
DT1, E1,
DT2, E2,
DT3, E3,
DT4, E4,
DT5, E5,
dimensionless_type,0,
dimensionless_type,0,
dimensionless_type,0>
{
typedef typename
make_dimension_list< list< dim< DT1,static_rational<E1> >,
list< dim< DT2,static_rational<E2> >,
list< dim< DT3,static_rational<E3> >,
list< dim< DT4,static_rational<E4> >,
list< dim< DT5,static_rational<E5> >, dimensionless_type > > > > > >::type type;
};
/// INTERNAL ONLY
template<class DT1,long E1,
class DT2,long E2,
class DT3,long E3,
class DT4,long E4,
class DT5,long E5,
class DT6,long E6>
struct derived_dimension<
DT1, E1,
DT2, E2,
DT3, E3,
DT4, E4,
DT5, E5,
DT6, E6,
dimensionless_type,0,
dimensionless_type,0>
{
typedef typename
make_dimension_list< list< dim< DT1,static_rational<E1> >,
list< dim< DT2,static_rational<E2> >,
list< dim< DT3,static_rational<E3> >,
list< dim< DT4,static_rational<E4> >,
list< dim< DT5,static_rational<E5> >,
list< dim< DT6,static_rational<E6> >, dimensionless_type > > > > > > >::type type;
};
/// INTERNAL ONLY
template<class DT1,long E1,
class DT2,long E2,
class DT3,long E3,
class DT4,long E4,
class DT5,long E5,
class DT6,long E6,
class DT7,long E7>
struct derived_dimension<
DT1, E1,
DT2, E2,
DT3, E3,
DT4, E4,
DT5, E5,
DT6, E6,
DT7, E7,
dimensionless_type,0>
{
typedef typename
make_dimension_list< list< dim< DT1,static_rational<E1> >,
list< dim< DT2,static_rational<E2> >,
list< dim< DT3,static_rational<E3> >,
list< dim< DT4,static_rational<E4> >,
list< dim< DT5,static_rational<E5> >,
list< dim< DT6,static_rational<E6> >,
list< dim< DT7,static_rational<E7> >, dimensionless_type > > > > > > > >::type type;
};
} // namespace units
} // namespace boost
#endif // BOOST_UNITS_DERIVED_DIMENSION_HPP
@@ -0,0 +1,16 @@
/*=============================================================================
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_;
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_
>
struct list;
}}
@@ -0,0 +1,166 @@
/*
[auto_generated]
boost/numeric/odeint/stepper/euler.hpp
[begin_description]
Implementation of the classical explicit Euler stepper. This method is really simple and should only
be used for demonstration purposes.
[end_description]
Copyright 2010-2013 Karsten Ahnert
Copyright 2010-2013 Mario Mulansky
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_EULER_HPP_INCLUDED
#define BOOST_NUMERIC_ODEINT_STEPPER_EULER_HPP_INCLUDED
#include <boost/numeric/odeint/stepper/base/explicit_stepper_base.hpp>
#include <boost/numeric/odeint/util/resizer.hpp>
#include <boost/numeric/odeint/algebra/range_algebra.hpp>
#include <boost/numeric/odeint/algebra/default_operations.hpp>
#include <boost/numeric/odeint/algebra/algebra_dispatcher.hpp>
#include <boost/numeric/odeint/algebra/operations_dispatcher.hpp>
namespace boost {
namespace numeric {
namespace odeint {
template<
class State ,
class Value = double ,
class Deriv = State ,
class Time = Value ,
class Algebra = typename algebra_dispatcher< State >::algebra_type ,
class Operations = typename operations_dispatcher< State >::operations_type ,
class Resizer = initially_resizer
>
#ifndef DOXYGEN_SKIP
class euler
: public explicit_stepper_base<
euler< State , Value , Deriv , Time , Algebra , Operations , Resizer > ,
1 , State , Value , Deriv , Time , Algebra , Operations , Resizer >
#else
class euler : public explicit_stepper_base
#endif
{
public :
#ifndef DOXYGEN_SKIP
typedef explicit_stepper_base< euler< State , Value , Deriv , Time , Algebra , Operations , Resizer > , 1 , State , Value , Deriv , Time , Algebra , Operations , Resizer > stepper_base_type;
#else
typedef explicit_stepper_base< euler< ... > , ... > stepper_base_type;
#endif
typedef typename stepper_base_type::state_type state_type;
typedef typename stepper_base_type::value_type value_type;
typedef typename stepper_base_type::deriv_type deriv_type;
typedef typename stepper_base_type::time_type time_type;
typedef typename stepper_base_type::algebra_type algebra_type;
typedef typename stepper_base_type::operations_type operations_type;
typedef typename stepper_base_type::resizer_type resizer_type;
#ifndef DOXYGEN_SKIP
typedef typename stepper_base_type::stepper_type stepper_type;
typedef typename stepper_base_type::wrapped_state_type wrapped_state_type;
typedef typename stepper_base_type::wrapped_deriv_type wrapped_deriv_type;
#endif
euler( const algebra_type &algebra = algebra_type() ) : stepper_base_type( algebra )
{ }
template< class System , class StateIn , class DerivIn , class StateOut >
void do_step_impl( System /* system */ , const StateIn &in , const DerivIn &dxdt , time_type /* t */ , StateOut &out , time_type dt )
{
stepper_base_type::m_algebra.for_each3( out , in , dxdt ,
typename operations_type::template scale_sum2< value_type , time_type >( 1.0 , dt ) );
}
template< class StateOut , class StateIn1 , class StateIn2 >
void calc_state( StateOut &x , time_type t , const StateIn1 &old_state , time_type t_old , const StateIn2 & /*current_state*/ , time_type /* t_new */ ) const
{
const time_type delta = t - t_old;
stepper_base_type::m_algebra.for_each3( x , old_state , stepper_base_type::m_dxdt.m_v ,
typename operations_type::template scale_sum2< value_type , time_type >( 1.0 , delta ) );
}
template< class StateType >
void adjust_size( const StateType &x )
{
stepper_base_type::adjust_size( x );
}
};
/********** DOXYGEN ***********/
/**
* \class euler
* \brief An implementation of the Euler method.
*
* The Euler method is a very simply solver for ordinary differential equations. This method should not be used
* for real applications. It is only useful for demonstration purposes. Step size control is not provided but
* trivial continuous output is available.
*
* This class derives from explicit_stepper_base and inherits its interface via CRTP (current recurring template pattern),
* see explicit_stepper_base
*
* \tparam State The state type.
* \tparam Value The value type.
* \tparam Deriv The type representing the time derivative of the state.
* \tparam Time The time representing the independent variable - the time.
* \tparam Algebra The algebra type.
* \tparam Operations The operations type.
* \tparam Resizer The resizer policy type.
*/
/**
* \fn euler::euler( const algebra_type &algebra )
* \brief Constructs the euler class. This constructor can be used as a default
* constructor of the algebra has a default constructor.
* \param algebra A copy of algebra is made and stored inside explicit_stepper_base.
*/
/**
* \fn euler::do_step_impl( System system , const StateIn &in , const DerivIn &dxdt , time_type t , StateOut &out , time_type dt )
* \brief This method performs one step. The derivative `dxdt` of `in` at the time `t` is passed to the method.
* The result is updated out of place, hence the input is in `in` and the output in `out`.
* Access to this step functionality is provided by explicit_stepper_base and
* `do_step_impl` should not be called directly.
*
* \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 euler::calc_state( StateOut &x , time_type t , const StateIn1 &old_state , time_type t_old , const StateIn2 &current_state , time_type t_new ) const
* \brief This method is used for continuous output and it calculates the state `x` at a time `t` from the
* knowledge of two states `old_state` and `current_state` at time points `t_old` and `t_new`.
*/
/**
* \fn euler::adjust_size( const StateType &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_EULER_HPP_INCLUDED
@@ -0,0 +1,29 @@
/*
(c) 2014 Glen Joseph Fernandes
<glenjofe -at- gmail.com>
Distributed under the Boost Software
License, Version 1.0.
http://boost.org/LICENSE_1_0.txt
*/
#ifndef BOOST_ALIGN_DETAIL_IS_ALIGNMENT_HPP
#define BOOST_ALIGN_DETAIL_IS_ALIGNMENT_HPP
#include <boost/config.hpp>
#include <cstddef>
namespace boost {
namespace alignment {
namespace detail {
BOOST_CONSTEXPR inline bool is_alignment(std::size_t value)
BOOST_NOEXCEPT
{
return (value > 0) && ((value & (value - 1)) == 0);
}
} /* .detail */
} /* .alignment */
} /* .boost */
#endif
@@ -0,0 +1,30 @@
// (C) Copyright Howard Hinnant
// (C) Copyright 2010-2011 Vicente J. Botet Escriba
// 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 code was adapted by Vicente from Howard Hinnant's experimental work
// on chrono i/o to Boost
#ifndef BOOST_CHRONO_IO_TIMEZONE_HPP
#define BOOST_CHRONO_IO_TIMEZONE_HPP
#include <boost/detail/scoped_enum_emulation.hpp>
namespace boost
{
namespace chrono
{
/**
* Scoped enumeration emulation stating whether the time_point for system_clock I/O is UTC or local.
*/
BOOST_SCOPED_ENUM_DECLARE_BEGIN(timezone)
{
utc, local
}
BOOST_SCOPED_ENUM_DECLARE_END(timezone)
} // chrono
} // boost
#endif // header
@@ -0,0 +1,293 @@
/*
[auto_generated]
boost/numeric/odeint/algebra/array_algebra.hpp
[begin_description]
Algebra for Arrays. Highly specialized for odeint. Const arguments are
introduce to work with odeint.
The Array algebra can be used for Array structures with two template
parameters:
Array<T, N>
[end_description]
Copyright 2011-2013 Mario Mulansky
Copyright 2011-2012 Karsten Ahnert
Distributed under the Boost Software License, Version 1.0.
(See accompanying file LICENSE_1_0.txt or
copy at http://www.boost.org/LICENSE_1_0.txt)
*/
#ifndef BOOST_NUMERIC_ODEINT_ALGEBRA_ARRAY_ALGEBRA_HPP_INCLUDED
#define BOOST_NUMERIC_ODEINT_ALGEBRA_ARRAY_ALGEBRA_HPP_INCLUDED
#include <algorithm>
#include <boost/array.hpp>
#include <boost/numeric/odeint/algebra/norm_result_type.hpp>
namespace boost {
namespace numeric {
namespace odeint {
struct array_algebra
{
//template< typename T , size_t dim , class Op >
template < template < typename, size_t > class Array, typename T,
size_t dim, class Op >
static void for_each1( Array< T, dim > &s1, Op op )
{
for( size_t i=0 ; i<dim ; ++i )
op( s1[i] );
}
template < template < typename, size_t > class Array, typename T,
size_t dim, class Op >
static void for_each2( Array< T, dim > &s1, const Array< T, dim > &s2,
Op op )
{
for( size_t i=0 ; i<dim ; ++i )
op( s1[i] , s2[i] );
}
template < template < typename, size_t > class Array, typename T,
size_t dim, class Op >
static void for_each3( Array< T , dim > &s1 ,
const Array< T , dim > &s2 ,
const Array< T , dim > &s3 , Op op )
{
for( size_t i=0 ; i<dim ; ++i )
op( s1[i] , s2[i] , s3[i] );
}
/* different const signature - required for the scale_sum_swap2 operation */
template < template < typename, size_t > class Array, typename T,
size_t dim, class Op >
static void for_each3( Array< T , dim > &s1 ,
Array< T , dim > &s2 ,
const Array< T , dim > &s3 , Op op )
{
for( size_t i=0 ; i<dim ; ++i )
op( s1[i] , s2[i] , s3[i] );
}
template < template < typename, size_t > class Array, typename T,
size_t dim, class Op >
static void for_each4( Array< T , dim > &s1 ,
const Array< T , dim > &s2 ,
const Array< T , dim > &s3 ,
const Array< T , dim > &s4 , Op op )
{
for( size_t i=0 ; i<dim ; ++i )
op( s1[i] , s2[i] , s3[i] , s4[i] );
}
template < template < typename, size_t > class Array, typename T,
size_t dim, class Op >
static void for_each5( Array< T , dim > &s1 ,
const Array< T , dim > &s2 ,
const Array< T , dim > &s3 ,
const Array< T , dim > &s4 ,
const Array< T , dim > &s5 , Op op )
{
for( size_t i=0 ; i<dim ; ++i )
op( s1[i] , s2[i] , s3[i] , s4[i] , s5[i] );
}
template < template < typename, size_t > class Array, typename T,
size_t dim, class Op >
static void for_each6( Array< T , dim > &s1 ,
const Array< T , dim > &s2 ,
const Array< T , dim > &s3 ,
const Array< T , dim > &s4 ,
const Array< T , dim > &s5 ,
const Array< T , dim > &s6 , Op op )
{
for( size_t i=0 ; i<dim ; ++i )
op( s1[i] , s2[i] , s3[i] , s4[i] , s5[i] , s6[i] );
}
template < template < typename, size_t > class Array, typename T,
size_t dim, class Op >
static void for_each7( Array< T , dim > &s1 ,
const Array< T , dim > &s2 ,
const Array< T , dim > &s3 ,
const Array< T , dim > &s4 ,
const Array< T , dim > &s5 ,
const Array< T , dim > &s6 ,
const Array< T , dim > &s7 , Op op )
{
for( size_t i=0 ; i<dim ; ++i )
op( s1[i] , s2[i] , s3[i] , s4[i] , s5[i] , s6[i] , s7[i] );
}
template < template < typename, size_t > class Array, typename T,
size_t dim, class Op >
static void for_each8( Array< T , dim > &s1 ,
const Array< T , dim > &s2 ,
const Array< T , dim > &s3 ,
const Array< T , dim > &s4 ,
const Array< T , dim > &s5 ,
const Array< T , dim > &s6 ,
const Array< T , dim > &s7 ,
const Array< T , dim > &s8 , Op op )
{
for( size_t i=0 ; i<dim ; ++i )
op( s1[i] , s2[i] , s3[i] , s4[i] , s5[i] , s6[i] , s7[i] , s8[i] );
}
template < template < typename, size_t > class Array, typename T,
size_t dim, class Op >
static void for_each9( Array< T , dim > &s1 ,
const Array< T , dim > &s2 ,
const Array< T , dim > &s3 ,
const Array< T , dim > &s4 ,
const Array< T , dim > &s5 ,
const Array< T , dim > &s6 ,
const Array< T , dim > &s7 ,
const Array< T , dim > &s8 ,
const Array< T , dim > &s9 , Op op )
{
for( size_t i=0 ; i<dim ; ++i )
op( s1[i] , s2[i] , s3[i] , s4[i] , s5[i] , s6[i] , s7[i] , s8[i] , s9[i] );
}
template < template < typename, size_t > class Array, typename T,
size_t dim, class Op >
static void for_each10( Array< T , dim > &s1 ,
const Array< T , dim > &s2 ,
const Array< T , dim > &s3 ,
const Array< T , dim > &s4 ,
const Array< T , dim > &s5 ,
const Array< T , dim > &s6 ,
const Array< T , dim > &s7 ,
const Array< T , dim > &s8 ,
const Array< T , dim > &s9 ,
const Array< T , dim > &s10 , Op op )
{
for( size_t i=0 ; i<dim ; ++i )
op( s1[i] , s2[i] , s3[i] , s4[i] , s5[i] , s6[i] , s7[i] , s8[i] , s9[i] , s10[i] );
}
template < template < typename, size_t > class Array, typename T,
size_t dim, class Op >
static void for_each11( Array< T , dim > &s1 ,
const Array< T , dim > &s2 ,
const Array< T , dim > &s3 ,
const Array< T , dim > &s4 ,
const Array< T , dim > &s5 ,
const Array< T , dim > &s6 ,
const Array< T , dim > &s7 ,
const Array< T , dim > &s8 ,
const Array< T , dim > &s9 ,
const Array< T , dim > &s10 ,
const Array< T , dim > &s11 , Op op )
{
for( size_t i=0 ; i<dim ; ++i )
op( s1[i] , s2[i] , s3[i] , s4[i] , s5[i] , s6[i] , s7[i] , s8[i] , s9[i] , s10[i] , s11[i] );
}
template < template < typename, size_t > class Array, typename T,
size_t dim, class Op >
static void for_each12( Array< T , dim > &s1 ,
const Array< T , dim > &s2 ,
const Array< T , dim > &s3 ,
const Array< T , dim > &s4 ,
const Array< T , dim > &s5 ,
const Array< T , dim > &s6 ,
const Array< T , dim > &s7 ,
const Array< T , dim > &s8 ,
const Array< T , dim > &s9 ,
const Array< T , dim > &s10 ,
const Array< T , dim > &s11 ,
const Array< T , dim > &s12 , Op op )
{
for( size_t i=0 ; i<dim ; ++i )
op( s1[i] , s2[i] , s3[i] , s4[i] , s5[i] , s6[i] , s7[i] , s8[i] , s9[i] , s10[i] , s11[i] , s12[i] );
}
template < template < typename, size_t > class Array, typename T,
size_t dim, class Op >
static void for_each13( Array< T , dim > &s1 ,
const Array< T , dim > &s2 ,
const Array< T , dim > &s3 ,
const Array< T , dim > &s4 ,
const Array< T , dim > &s5 ,
const Array< T , dim > &s6 ,
const Array< T , dim > &s7 ,
const Array< T , dim > &s8 ,
const Array< T , dim > &s9 ,
const Array< T , dim > &s10 ,
const Array< T , dim > &s11 ,
const Array< T , dim > &s12 ,
const Array< T , dim > &s13 , Op op )
{
for( size_t i=0 ; i<dim ; ++i )
op( s1[i] , s2[i] , s3[i] , s4[i] , s5[i] , s6[i] , s7[i] , s8[i] , s9[i] , s10[i] , s11[i] , s12[i] , s13[i] );
}
template < template < typename, size_t > class Array, typename T,
size_t dim, class Op >
static void for_each14( Array< T , dim > &s1 ,
const Array< T , dim > &s2 ,
const Array< T , dim > &s3 ,
const Array< T , dim > &s4 ,
const Array< T , dim > &s5 ,
const Array< T , dim > &s6 ,
const Array< T , dim > &s7 ,
const Array< T , dim > &s8 ,
const Array< T , dim > &s9 ,
const Array< T , dim > &s10 ,
const Array< T , dim > &s11 ,
const Array< T , dim > &s12 ,
const Array< T , dim > &s13 ,
const Array< T , dim > &s14 , Op op )
{
for( size_t i=0 ; i<dim ; ++i )
op( s1[i] , s2[i] , s3[i] , s4[i] , s5[i] , s6[i] , s7[i] , s8[i] , s9[i] , s10[i] , s11[i] , s12[i] , s13[i] , s14[i] );
}
template < template < typename, size_t > class Array, typename T,
size_t dim, class Op >
static void for_each15( Array< T , dim > &s1 ,
const Array< T , dim > &s2 ,
const Array< T , dim > &s3 ,
const Array< T , dim > &s4 ,
const Array< T , dim > &s5 ,
const Array< T , dim > &s6 ,
const Array< T , dim > &s7 ,
const Array< T , dim > &s8 ,
const Array< T , dim > &s9 ,
const Array< T , dim > &s10 ,
const Array< T , dim > &s11 ,
const Array< T , dim > &s12 ,
const Array< T , dim > &s13 ,
const Array< T , dim > &s14 ,
const Array< T , dim > &s15 , Op op )
{
for( size_t i=0 ; i<dim ; ++i )
op( s1[i] , s2[i] , s3[i] , s4[i] , s5[i] , s6[i] , s7[i] , s8[i] , s9[i] , s10[i] , s11[i] , s12[i] , s13[i] , s14[i] , s15[i] );
}
template < template < typename, size_t > class Array, typename T,
size_t dim>
static typename norm_result_type< Array< T , dim > >::type norm_inf( const Array< T , dim > &s )
{
BOOST_USING_STD_MAX();
using std::abs;
typedef typename norm_result_type< Array< T , dim > >::type result_type;
result_type init = static_cast< result_type >( 0 );
for( size_t i=0 ; i<dim ; ++i )
init = max BOOST_PREVENT_MACRO_SUBSTITUTION ( init , static_cast< result_type >(abs(s[i])) );
return init;
}
};
}
}
}
#endif // BOOST_NUMERIC_ODEINT_ALGEBRA_ARRAY_ALGEBRA_HPP_INCLUDED
@@ -0,0 +1,114 @@
// Boost.Range library
//
// Copyright Adam D. Walling 2012. 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_ADAPTOR_MFC_MAP_HPP
#define BOOST_RANGE_ADAPTOR_MFC_MAP_HPP
#if !defined(BOOST_RANGE_MFC_NO_CPAIR)
#include <boost/range/mfc.hpp>
#include <boost/range/adaptor/map.hpp>
namespace boost
{
namespace range_detail
{
// CMap and CMapStringToString range iterators return CPair,
// which has a key and value member. Other MFC range iterators
// already return adapted std::pair objects. This allows usage
// of the map_keys and map_values range adaptors with CMap
// and CMapStringToString
// CPair has a VALUE value member, and a KEY key member; we will
// use VALUE& as the result_type consistent with CMap::operator[]
// specialization for CMap
template<class KEY, class ARG_KEY, class VALUE, class ARG_VALUE>
struct select_first< CMap<KEY, ARG_KEY, VALUE, ARG_VALUE> >
{
typedef BOOST_DEDUCED_TYPENAME CMap<KEY, ARG_KEY, VALUE, ARG_VALUE> map_type;
typedef BOOST_DEDUCED_TYPENAME range_reference<const map_type>::type argument_type;
typedef BOOST_DEDUCED_TYPENAME const KEY& result_type;
result_type operator()( argument_type r ) const
{
return r.key;
}
};
template<class KEY, class ARG_KEY, class VALUE, class ARG_VALUE>
struct select_second_mutable< CMap<KEY, ARG_KEY, VALUE, ARG_VALUE> >
{
typedef BOOST_DEDUCED_TYPENAME CMap<KEY, ARG_KEY, VALUE, ARG_VALUE> map_type;
typedef BOOST_DEDUCED_TYPENAME range_reference<map_type>::type argument_type;
typedef BOOST_DEDUCED_TYPENAME VALUE& result_type;
result_type operator()( argument_type r ) const
{
return r.value;
}
};
template<class KEY, class ARG_KEY, class VALUE, class ARG_VALUE>
struct select_second_const< CMap<KEY, ARG_KEY, VALUE, ARG_VALUE> >
{
typedef BOOST_DEDUCED_TYPENAME CMap<KEY, ARG_KEY, VALUE, ARG_VALUE> map_type;
typedef BOOST_DEDUCED_TYPENAME range_reference<const map_type>::type argument_type;
typedef BOOST_DEDUCED_TYPENAME const VALUE& result_type;
result_type operator()( argument_type r ) const
{
return r.value;
}
};
// specialization for CMapStringToString
template<>
struct select_first< CMapStringToString >
{
typedef range_reference<const CMapStringToString>::type argument_type;
typedef const CString& result_type;
result_type operator()( argument_type r ) const
{
return r.key;
}
};
template<>
struct select_second_mutable< CMapStringToString >
{
typedef range_reference<CMapStringToString>::type argument_type;
typedef CString& result_type;
result_type operator()( argument_type r ) const
{
return r.value;
}
};
template<>
struct select_second_const< CMapStringToString >
{
typedef range_reference<const CMapStringToString>::type argument_type;
typedef const CString& result_type;
result_type operator()( argument_type r ) const
{
return r.value;
}
};
} // 'range_detail'
} // 'boost'
#endif // !defined(BOOST_RANGE_MFC_NO_CPAIR)
#endif
@@ -0,0 +1,146 @@
// Copyright John Maddock 2007.
// Copyright Paul A. Bristow 2007.
// Use, modification and distribution are subject to the
// Boost Software License, Version 1.0. (See accompanying file
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
#ifndef BOOST_STATS_FIND_LOCATION_HPP
#define BOOST_STATS_FIND_LOCATION_HPP
#include <boost/math/distributions/fwd.hpp> // for all distribution signatures.
#include <boost/math/distributions/complement.hpp>
#include <boost/math/policies/policy.hpp>
#include <boost/math/tools/traits.hpp>
#include <boost/static_assert.hpp>
#include <boost/math/special_functions/fpclassify.hpp>
#include <boost/math/policies/error_handling.hpp>
// using boost::math::policies::policy;
// using boost::math::complement; // will be needed by users who want complement,
// but NOT placed here to avoid putting it in global scope.
namespace boost
{
namespace math
{
// Function to find location of random variable z
// to give probability p (given scale)
// Applies to normal, lognormal, extreme value, Cauchy, (and symmetrical triangular),
// enforced by BOOST_STATIC_ASSERT below.
template <class Dist, class Policy>
inline
typename Dist::value_type find_location( // For example, normal mean.
typename Dist::value_type z, // location of random variable z to give probability, P(X > z) == p.
// For example, a nominal minimum acceptable z, so that p * 100 % are > z
typename Dist::value_type p, // probability value desired at x, say 0.95 for 95% > z.
typename Dist::value_type scale, // scale parameter, for example, normal standard deviation.
const Policy& pol
)
{
#if !defined(BOOST_NO_SFINAE) && !BOOST_WORKAROUND(__SUNPRO_CC, BOOST_TESTED_AT(0x590))
// Will fail to compile here if try to use with a distribution without scale & location,
// for example pareto, and many others. These tests are disabled by the pp-logic
// above if the compiler doesn't support the SFINAE tricks used in the traits class.
BOOST_STATIC_ASSERT(::boost::math::tools::is_distribution<Dist>::value);
BOOST_STATIC_ASSERT(::boost::math::tools::is_scaled_distribution<Dist>::value);
#endif
static const char* function = "boost::math::find_location<Dist, Policy>&, %1%)";
if(!(boost::math::isfinite)(p) || (p < 0) || (p > 1))
{
return policies::raise_domain_error<typename Dist::value_type>(
function, "Probability parameter was %1%, but must be >= 0 and <= 1!", p, pol);
}
if(!(boost::math::isfinite)(z))
{
return policies::raise_domain_error<typename Dist::value_type>(
function, "z parameter was %1%, but must be finite!", z, pol);
}
if(!(boost::math::isfinite)(scale))
{
return policies::raise_domain_error<typename Dist::value_type>(
function, "scale parameter was %1%, but must be finite!", scale, pol);
}
//cout << "z " << z << ", p " << p << ", quantile(Dist(), p) "
// << quantile(Dist(), p) << ", quan * scale " << quantile(Dist(), p) * scale << endl;
return z - (quantile(Dist(), p) * scale);
} // find_location
template <class Dist>
inline // with default policy.
typename Dist::value_type find_location( // For example, normal mean.
typename Dist::value_type z, // location of random variable z to give probability, P(X > z) == p.
// For example, a nominal minimum acceptable z, so that p * 100 % are > z
typename Dist::value_type p, // probability value desired at x, say 0.95 for 95% > z.
typename Dist::value_type scale) // scale parameter, for example, normal standard deviation.
{ // Forward to find_location with default policy.
return (find_location<Dist>(z, p, scale, policies::policy<>()));
} // find_location
// So the user can start from the complement q = (1 - p) of the probability p,
// for example, l = find_location<normal>(complement(z, q, sd));
template <class Dist, class Real1, class Real2, class Real3>
inline typename Dist::value_type find_location( // Default policy.
complemented3_type<Real1, Real2, Real3> const& c)
{
static const char* function = "boost::math::find_location<Dist, Policy>&, %1%)";
typename Dist::value_type p = c.param1;
if(!(boost::math::isfinite)(p) || (p < 0) || (p > 1))
{
return policies::raise_domain_error<typename Dist::value_type>(
function, "Probability parameter was %1%, but must be >= 0 and <= 1!", p, policies::policy<>());
}
typename Dist::value_type z = c.dist;
if(!(boost::math::isfinite)(z))
{
return policies::raise_domain_error<typename Dist::value_type>(
function, "z parameter was %1%, but must be finite!", z, policies::policy<>());
}
typename Dist::value_type scale = c.param2;
if(!(boost::math::isfinite)(scale))
{
return policies::raise_domain_error<typename Dist::value_type>(
function, "scale parameter was %1%, but must be finite!", scale, policies::policy<>());
}
// cout << "z " << c.dist << ", quantile (Dist(), " << c.param1 << ") * scale " << c.param2 << endl;
return z - quantile(Dist(), p) * scale;
} // find_location complement
template <class Dist, class Real1, class Real2, class Real3, class Real4>
inline typename Dist::value_type find_location( // Explicit policy.
complemented4_type<Real1, Real2, Real3, Real4> const& c)
{
static const char* function = "boost::math::find_location<Dist, Policy>&, %1%)";
typename Dist::value_type p = c.param1;
if(!(boost::math::isfinite)(p) || (p < 0) || (p > 1))
{
return policies::raise_domain_error<typename Dist::value_type>(
function, "Probability parameter was %1%, but must be >= 0 and <= 1!", p, c.param3);
}
typename Dist::value_type z = c.dist;
if(!(boost::math::isfinite)(z))
{
return policies::raise_domain_error<typename Dist::value_type>(
function, "z parameter was %1%, but must be finite!", z, c.param3);
}
typename Dist::value_type scale = c.param2;
if(!(boost::math::isfinite)(scale))
{
return policies::raise_domain_error<typename Dist::value_type>(
function, "scale parameter was %1%, but must be finite!", scale, c.param3);
}
// cout << "z " << c.dist << ", quantile (Dist(), " << c.param1 << ") * scale " << c.param2 << endl;
return z - quantile(Dist(), p) * scale;
} // find_location complement
} // namespace boost
} // namespace math
#endif // BOOST_STATS_FIND_LOCATION_HPP
@@ -0,0 +1,146 @@
// Copyright Aleksey Gurtovoy 2000-2004
//
// Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
//
// *Preprocessed* version of the main "divides.hpp" header
// -- DO NOT modify by hand!
namespace boost { namespace mpl {
template<
typename Tag1
, typename Tag2
>
struct divides_impl
: if_c<
( BOOST_MPL_AUX_NESTED_VALUE_WKND(int, Tag1)
> BOOST_MPL_AUX_NESTED_VALUE_WKND(int, Tag2)
)
, aux::cast2nd_impl< divides_impl< Tag1,Tag1 >,Tag1, Tag2 >
, aux::cast1st_impl< divides_impl< Tag2,Tag2 >,Tag1, Tag2 >
>::type
{
};
/// for Digital Mars C++/compilers with no CTPS/TTP support
template<> struct divides_impl< na,na >
{
template< typename U1, typename U2 > struct apply
{
typedef apply type;
BOOST_STATIC_CONSTANT(int, value = 0);
};
};
template< typename Tag > struct divides_impl< na,Tag >
{
template< typename U1, typename U2 > struct apply
{
typedef apply type;
BOOST_STATIC_CONSTANT(int, value = 0);
};
};
template< typename Tag > struct divides_impl< Tag,na >
{
template< typename U1, typename U2 > struct apply
{
typedef apply type;
BOOST_STATIC_CONSTANT(int, value = 0);
};
};
template< typename T > struct divides_tag
{
typedef typename T::tag type;
};
template<
typename BOOST_MPL_AUX_NA_PARAM(N1)
, typename BOOST_MPL_AUX_NA_PARAM(N2)
, typename N3 = na, typename N4 = na, typename N5 = na
>
struct divides
: divides< divides< divides< divides< N1,N2 >, N3>, N4>, N5>
{
BOOST_MPL_AUX_LAMBDA_SUPPORT(
5
, divides
, ( N1, N2, N3, N4, N5 )
)
};
template<
typename N1, typename N2, typename N3, typename N4
>
struct divides< N1,N2,N3,N4,na >
: divides< divides< divides< N1,N2 >, N3>, N4>
{
BOOST_MPL_AUX_LAMBDA_SUPPORT_SPEC(
5
, divides
, ( N1, N2, N3, N4, na )
)
};
template<
typename N1, typename N2, typename N3
>
struct divides< N1,N2,N3,na,na >
: divides< divides< N1,N2 >, N3>
{
BOOST_MPL_AUX_LAMBDA_SUPPORT_SPEC(
5
, divides
, ( N1, N2, N3, na, na )
)
};
template<
typename N1, typename N2
>
struct divides< N1,N2,na,na,na >
: divides_impl<
typename divides_tag<N1>::type
, typename divides_tag<N2>::type
>::template apply< N1,N2 >::type
{
BOOST_MPL_AUX_LAMBDA_SUPPORT_SPEC(
5
, divides
, ( N1, N2, na, na, na )
)
};
BOOST_MPL_AUX_NA_SPEC2(2, 5, divides)
}}
namespace boost { namespace mpl {
template<>
struct divides_impl< integral_c_tag,integral_c_tag >
{
template< typename N1, typename N2 > struct apply
: integral_c<
typename aux::largest_int<
typename N1::value_type
, typename N2::value_type
>::type
, ( BOOST_MPL_AUX_VALUE_WKND(N1)::value
/ BOOST_MPL_AUX_VALUE_WKND(N2)::value
)
>
{
};
};
}}
@@ -0,0 +1,55 @@
#ifndef BOOST_THREAD_TIME_HPP
#define BOOST_THREAD_TIME_HPP
// (C) Copyright 2007 Anthony Williams
//
// Distributed under the Boost Software License, Version 1.0. (See
// accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
#include <boost/date_time/time_clock.hpp>
#include <boost/date_time/microsec_time_clock.hpp>
#include <boost/date_time/posix_time/posix_time_types.hpp>
#include <boost/config/abi_prefix.hpp>
namespace boost
{
typedef boost::posix_time::ptime system_time;
inline system_time get_system_time()
{
#if defined(BOOST_DATE_TIME_HAS_HIGH_PRECISION_CLOCK)
return boost::date_time::microsec_clock<system_time>::universal_time();
#else // defined(BOOST_DATE_TIME_HAS_HIGH_PRECISION_CLOCK)
return boost::date_time::second_clock<system_time>::universal_time();
#endif // defined(BOOST_DATE_TIME_HAS_HIGH_PRECISION_CLOCK)
}
namespace detail
{
inline system_time get_system_time_sentinel()
{
return system_time(boost::posix_time::pos_infin);
}
inline unsigned long get_milliseconds_until(system_time const& target_time)
{
if(target_time.is_pos_infinity())
{
return ~(unsigned long)0;
}
system_time const now=get_system_time();
if(target_time<=now)
{
return 0;
}
return static_cast<unsigned long>((target_time-now).total_milliseconds()+1);
}
}
}
#include <boost/config/abi_suffix.hpp>
#endif
@@ -0,0 +1,25 @@
// Copyright (c) 2001 Ronald Garcia, Indiana University (garcia@osl.iu.edu)
// Andrew Lumsdaine, Indiana University (lums@osl.iu.edu). Permission to copy,
// use, modify, sell and distribute this software is granted provided this
// copyright notice appears in all copies. This software is provided "as is"
// without express or implied warranty, and with no claim as to its suitability
// for any purpose.
#ifndef BOOST_PROGRAM_OPTIONS_UTF8_CODECVT_FACET_HPP
#define BOOST_PROGRAM_OPTIONS_UTF8_CODECVT_FACET_HPP
#include <boost/program_options/config.hpp>
#define BOOST_UTF8_BEGIN_NAMESPACE \
namespace boost { namespace program_options { namespace detail {
#define BOOST_UTF8_END_NAMESPACE }}}
#define BOOST_UTF8_DECL BOOST_PROGRAM_OPTIONS_DECL
#include <boost/detail/utf8_codecvt_facet.hpp>
#undef BOOST_UTF8_BEGIN_NAMESPACE
#undef BOOST_UTF8_END_NAMESPACE
#undef BOOST_UTF8_DECL
#endif
@@ -0,0 +1,108 @@
// Copyright David Abrahams 2002.
// Distributed under the Boost Software License, Version 1.0. (See
// accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
#ifndef ENUM_DWA200298_HPP
# define ENUM_DWA200298_HPP
# include <boost/python/detail/prefix.hpp>
# include <boost/python/object/enum_base.hpp>
# include <boost/python/converter/rvalue_from_python_data.hpp>
# include <boost/python/converter/registered.hpp>
namespace boost { namespace python {
template <class T>
struct enum_ : public objects::enum_base
{
typedef objects::enum_base base;
// Declare a new enumeration type in the current scope()
enum_(char const* name, char const* doc = 0);
// Add a new enumeration value with the given name and value.
inline enum_<T>& value(char const* name, T);
// Add all of the defined enumeration values to the current scope with the
// same names used here.
inline enum_<T>& export_values();
private:
static PyObject* to_python(void const* x);
static void* convertible_from_python(PyObject* obj);
static void construct(PyObject* obj, converter::rvalue_from_python_stage1_data* data);
};
template <class T>
inline enum_<T>::enum_(char const* name, char const* doc )
: base(
name
, &enum_<T>::to_python
, &enum_<T>::convertible_from_python
, &enum_<T>::construct
, type_id<T>()
, doc
)
{
}
// This is the conversion function that gets registered for converting
// these enums to Python.
template <class T>
PyObject* enum_<T>::to_python(void const* x)
{
return base::to_python(
converter::registered<T>::converters.m_class_object
, static_cast<long>(*(T const*)x));
}
//
// The following two static functions serve as the elements of an
// rvalue from_python converter for the enumeration type.
//
// This checks that a given Python object can be converted to the
// enumeration type.
template <class T>
void* enum_<T>::convertible_from_python(PyObject* obj)
{
return PyObject_IsInstance(
obj
, upcast<PyObject>(
converter::registered<T>::converters.m_class_object))
? obj : 0;
}
// Constructs an instance of the enumeration type in the from_python
// data.
template <class T>
void enum_<T>::construct(PyObject* obj, converter::rvalue_from_python_stage1_data* data)
{
#if PY_VERSION_HEX >= 0x03000000
T x = static_cast<T>(PyLong_AS_LONG(obj));
#else
T x = static_cast<T>(PyInt_AS_LONG(obj));
#endif
void* const storage = ((converter::rvalue_from_python_storage<T>*)data)->storage.bytes;
new (storage) T(x);
data->convertible = storage;
}
template <class T>
inline enum_<T>& enum_<T>::value(char const* name, T x)
{
this->add_value(name, static_cast<long>(x));
return *this;
}
template <class T>
inline enum_<T>& enum_<T>::export_values()
{
this->base::export_values();
return *this;
}
}} // namespace boost::python
#endif // ENUM_DWA200298_HPP
Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

@@ -0,0 +1,41 @@
// (C) Copyright Dave Abrahams, Steve Cleary, Beman Dawes,
// Howard Hinnant and John Maddock 2000.
// (C) Copyright Mat Marcus, Jesse Jones and Adobe Systems Inc 2001
// Use, modification and distribution are subject to the Boost Software License,
// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt).
//
// See http://www.boost.org/libs/type_traits for most recent version including documentation.
// Fixed is_pointer, is_reference, is_const, is_volatile, is_same,
// is_member_pointer based on the Simulated Partial Specialization work
// of Mat Marcus and Jesse Jones. See http://opensource.adobe.com or
// http://groups.yahoo.com/group/boost/message/5441
// Some workarounds in here use ideas suggested from "Generic<Programming>:
// Mappings between Types and Values"
// by Andrei Alexandrescu (see http://www.cuj.com/experts/1810/alexandr.html).
#ifndef BOOST_TT_IS_SAME_HPP_INCLUDED
#define BOOST_TT_IS_SAME_HPP_INCLUDED
#include <boost/type_traits/integral_constant.hpp>
namespace boost {
template <class T, class U> struct is_same : public false_type {};
template <class T> struct is_same<T,T> : public true_type {};
#if BOOST_WORKAROUND(__BORLANDC__, < 0x600)
// without this, Borland's compiler gives the wrong answer for
// references to arrays:
template <class T> struct is_same<T&, T&> : public true_type{};
#endif
} // namespace boost
#endif // BOOST_TT_IS_SAME_HPP_INCLUDED
@@ -0,0 +1,43 @@
// Boost.Assign library
//
// Copyright Thorsten Ottosen 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/assign/
//
#ifndef BOOST_ASSIGN_ASSIGNMENT_EXCEPTION_HPP
#define BOOST_ASSIGN_ASSIGNMENT_EXCEPTION_HPP
#if defined(_MSC_VER)
# pragma once
#endif
#include <exception>
namespace boost
{
namespace assign
{
class assignment_exception : public std::exception
{
public:
assignment_exception( const char* _what )
: what_( _what )
{ }
virtual const char* what() const throw()
{
return what_;
}
private:
const char* what_;
};
}
}
#endif
@@ -0,0 +1,325 @@
// See http://www.boost.org/libs/any for Documentation.
#ifndef BOOST_ANY_INCLUDED
#define BOOST_ANY_INCLUDED
#if defined(_MSC_VER)
# pragma once
#endif
// what: variant type boost::any
// who: contributed by Kevlin Henney,
// with features contributed and bugs found by
// Antony Polukhin, Ed Brey, Mark Rodgers,
// Peter Dimov, and James Curran
// when: July 2001, April 2013 - May 2013
#include <algorithm>
#include "boost/config.hpp"
#include <boost/type_index.hpp>
#include <boost/type_traits/remove_reference.hpp>
#include <boost/type_traits/decay.hpp>
#include <boost/type_traits/remove_cv.hpp>
#include <boost/type_traits/add_reference.hpp>
#include <boost/type_traits/is_reference.hpp>
#include <boost/type_traits/is_const.hpp>
#include <boost/throw_exception.hpp>
#include <boost/static_assert.hpp>
#include <boost/utility/enable_if.hpp>
#include <boost/type_traits/is_same.hpp>
#include <boost/type_traits/is_const.hpp>
#include <boost/mpl/if.hpp>
namespace boost
{
class any
{
public: // structors
any() BOOST_NOEXCEPT
: content(0)
{
}
template<typename ValueType>
any(const ValueType & value)
: content(new holder<
BOOST_DEDUCED_TYPENAME remove_cv<BOOST_DEDUCED_TYPENAME decay<const ValueType>::type>::type
>(value))
{
}
any(const any & other)
: content(other.content ? other.content->clone() : 0)
{
}
#ifndef BOOST_NO_CXX11_RVALUE_REFERENCES
// Move constructor
any(any&& other) BOOST_NOEXCEPT
: content(other.content)
{
other.content = 0;
}
// Perfect forwarding of ValueType
template<typename ValueType>
any(ValueType&& value
, typename boost::disable_if<boost::is_same<any&, ValueType> >::type* = 0 // disable if value has type `any&`
, typename boost::disable_if<boost::is_const<ValueType> >::type* = 0) // disable if value has type `const ValueType&&`
: content(new holder< typename decay<ValueType>::type >(static_cast<ValueType&&>(value)))
{
}
#endif
~any() BOOST_NOEXCEPT
{
delete content;
}
public: // modifiers
any & swap(any & rhs) BOOST_NOEXCEPT
{
std::swap(content, rhs.content);
return *this;
}
#ifdef BOOST_NO_CXX11_RVALUE_REFERENCES
template<typename ValueType>
any & operator=(const ValueType & rhs)
{
any(rhs).swap(*this);
return *this;
}
any & operator=(any rhs)
{
any(rhs).swap(*this);
return *this;
}
#else
any & operator=(const any& rhs)
{
any(rhs).swap(*this);
return *this;
}
// move assignement
any & operator=(any&& rhs) BOOST_NOEXCEPT
{
rhs.swap(*this);
any().swap(rhs);
return *this;
}
// Perfect forwarding of ValueType
template <class ValueType>
any & operator=(ValueType&& rhs)
{
any(static_cast<ValueType&&>(rhs)).swap(*this);
return *this;
}
#endif
public: // queries
bool empty() const BOOST_NOEXCEPT
{
return !content;
}
void clear() BOOST_NOEXCEPT
{
any().swap(*this);
}
const boost::typeindex::type_info& type() const BOOST_NOEXCEPT
{
return content ? content->type() : boost::typeindex::type_id<void>().type_info();
}
#ifndef BOOST_NO_MEMBER_TEMPLATE_FRIENDS
private: // types
#else
public: // types (public so any_cast can be non-friend)
#endif
class placeholder
{
public: // structors
virtual ~placeholder()
{
}
public: // queries
virtual const boost::typeindex::type_info& type() const BOOST_NOEXCEPT = 0;
virtual placeholder * clone() const = 0;
};
template<typename ValueType>
class holder : public placeholder
{
public: // structors
holder(const ValueType & value)
: held(value)
{
}
#ifndef BOOST_NO_CXX11_RVALUE_REFERENCES
holder(ValueType&& value)
: held(static_cast< ValueType&& >(value))
{
}
#endif
public: // queries
virtual const boost::typeindex::type_info& type() const BOOST_NOEXCEPT
{
return boost::typeindex::type_id<ValueType>().type_info();
}
virtual placeholder * clone() const
{
return new holder(held);
}
public: // representation
ValueType held;
private: // intentionally left unimplemented
holder & operator=(const holder &);
};
#ifndef BOOST_NO_MEMBER_TEMPLATE_FRIENDS
private: // representation
template<typename ValueType>
friend ValueType * any_cast(any *) BOOST_NOEXCEPT;
template<typename ValueType>
friend ValueType * unsafe_any_cast(any *) BOOST_NOEXCEPT;
#else
public: // representation (public so any_cast can be non-friend)
#endif
placeholder * content;
};
inline void swap(any & lhs, any & rhs) BOOST_NOEXCEPT
{
lhs.swap(rhs);
}
class BOOST_SYMBOL_VISIBLE bad_any_cast :
#ifndef BOOST_NO_RTTI
public std::bad_cast
#else
public std::exception
#endif
{
public:
virtual const char * what() const BOOST_NOEXCEPT_OR_NOTHROW
{
return "boost::bad_any_cast: "
"failed conversion using boost::any_cast";
}
};
template<typename ValueType>
ValueType * any_cast(any * operand) BOOST_NOEXCEPT
{
return operand && operand->type() == boost::typeindex::type_id<ValueType>()
? &static_cast<any::holder<BOOST_DEDUCED_TYPENAME remove_cv<ValueType>::type> *>(operand->content)->held
: 0;
}
template<typename ValueType>
inline const ValueType * any_cast(const any * operand) BOOST_NOEXCEPT
{
return any_cast<ValueType>(const_cast<any *>(operand));
}
template<typename ValueType>
ValueType any_cast(any & operand)
{
typedef BOOST_DEDUCED_TYPENAME remove_reference<ValueType>::type nonref;
nonref * result = any_cast<nonref>(&operand);
if(!result)
boost::throw_exception(bad_any_cast());
// Attempt to avoid construction of a temporary object in cases when
// `ValueType` is not a reference. Example:
// `static_cast<std::string>(*result);`
// which is equal to `std::string(*result);`
typedef BOOST_DEDUCED_TYPENAME boost::mpl::if_<
boost::is_reference<ValueType>,
ValueType,
BOOST_DEDUCED_TYPENAME boost::add_reference<ValueType>::type
>::type ref_type;
return static_cast<ref_type>(*result);
}
template<typename ValueType>
inline ValueType any_cast(const any & operand)
{
typedef BOOST_DEDUCED_TYPENAME remove_reference<ValueType>::type nonref;
return any_cast<const nonref &>(const_cast<any &>(operand));
}
#ifndef BOOST_NO_CXX11_RVALUE_REFERENCES
template<typename ValueType>
inline ValueType any_cast(any&& operand)
{
BOOST_STATIC_ASSERT_MSG(
boost::is_rvalue_reference<ValueType&&>::value /*true if ValueType is rvalue or just a value*/
|| boost::is_const< typename boost::remove_reference<ValueType>::type >::value,
"boost::any_cast shall not be used for getting nonconst references to temporary objects"
);
return any_cast<ValueType>(operand);
}
#endif
// Note: The "unsafe" versions of any_cast are not part of the
// public interface and may be removed at any time. They are
// required where we know what type is stored in the any and can't
// use typeid() comparison, e.g., when our types may travel across
// different shared libraries.
template<typename ValueType>
inline ValueType * unsafe_any_cast(any * operand) BOOST_NOEXCEPT
{
return &static_cast<any::holder<ValueType> *>(operand->content)->held;
}
template<typename ValueType>
inline const ValueType * unsafe_any_cast(const any * operand) BOOST_NOEXCEPT
{
return unsafe_any_cast<ValueType>(const_cast<any *>(operand));
}
}
// Copyright Kevlin Henney, 2000, 2001, 2002. All rights reserved.
//
// 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)
#endif
@@ -0,0 +1,40 @@
#ifndef BOOST_MPL_VECTOR_AUX_PUSH_FRONT_HPP_INCLUDED
#define BOOST_MPL_VECTOR_AUX_PUSH_FRONT_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$
#include <boost/mpl/push_front_fwd.hpp>
#include <boost/mpl/aux_/config/typeof.hpp>
#if defined(BOOST_MPL_CFG_TYPEOF_BASED_SEQUENCES)
# include <boost/mpl/vector/aux_/item.hpp>
# include <boost/mpl/vector/aux_/tag.hpp>
namespace boost { namespace mpl {
template<>
struct push_front_impl< aux::vector_tag >
{
template< typename Vector, typename T > struct apply
{
typedef v_item<T,Vector,1> type;
};
};
}}
#endif // BOOST_MPL_CFG_TYPEOF_BASED_SEQUENCES
#endif // BOOST_MPL_VECTOR_AUX_PUSH_FRONT_HPP_INCLUDED
@@ -0,0 +1,625 @@
/*
* 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) 2009 Helge Bahmann
* Copyright (c) 2012 Tim Blechmann
* Copyright (c) 2014 Andrey Semashev
*/
/*!
* \file atomic/detail/ops_gcc_x86_dcas.hpp
*
* This header contains implementation of the double-width CAS primitive for x86.
*/
#ifndef BOOST_ATOMIC_DETAIL_OPS_GCC_X86_DCAS_HPP_INCLUDED_
#define BOOST_ATOMIC_DETAIL_OPS_GCC_X86_DCAS_HPP_INCLUDED_
#include <boost/cstdint.hpp>
#include <boost/memory_order.hpp>
#include <boost/atomic/detail/config.hpp>
#include <boost/atomic/detail/storage_type.hpp>
#include <boost/atomic/capabilities.hpp>
#ifdef BOOST_HAS_PRAGMA_ONCE
#pragma once
#endif
namespace boost {
namespace atomics {
namespace detail {
#if defined(BOOST_ATOMIC_DETAIL_X86_HAS_CMPXCHG8B)
template< bool Signed >
struct gcc_dcas_x86
{
typedef typename make_storage_type< 8u, Signed >::type storage_type;
typedef typename make_storage_type< 8u, Signed >::aligned aligned_storage_type;
static BOOST_CONSTEXPR_OR_CONST bool is_always_lock_free = true;
static BOOST_FORCEINLINE void store(storage_type volatile& storage, storage_type v, memory_order) BOOST_NOEXCEPT
{
if ((((uint32_t)&storage) & 0x00000007) == 0)
{
#if defined(__SSE2__)
__asm__ __volatile__
(
#if defined(__AVX__)
"vmovq %1, %%xmm4\n\t"
"vmovq %%xmm4, %0\n\t"
#else
"movq %1, %%xmm4\n\t"
"movq %%xmm4, %0\n\t"
#endif
: "=m" (storage)
: "m" (v)
: "memory", "xmm4"
);
#else
__asm__ __volatile__
(
"fildll %1\n\t"
"fistpll %0\n\t"
: "=m" (storage)
: "m" (v)
: "memory"
);
#endif
}
else
{
#if !defined(BOOST_ATOMIC_DETAIL_NO_ASM_IMPLIED_ZERO_DISPLACEMENTS)
#if defined(__PIC__)
uint32_t scratch;
__asm__ __volatile__
(
"movl %%ebx, %[scratch]\n\t"
"movl %[value_lo], %%ebx\n\t"
"movl %[dest], %%eax\n\t"
"movl 4+%[dest], %%edx\n\t"
".align 16\n\t"
"1: lock; cmpxchg8b %[dest]\n\t"
"jne 1b\n\t"
"movl %[scratch], %%ebx\n\t"
: [scratch] "=m" (scratch), [dest] "=o" (storage)
: [value_lo] "a" ((uint32_t)v), "c" ((uint32_t)(v >> 32))
: BOOST_ATOMIC_DETAIL_ASM_CLOBBER_CC_COMMA "edx", "memory"
);
#else // defined(__PIC__)
__asm__ __volatile__
(
"movl %[dest], %%eax\n\t"
"movl 4+%[dest], %%edx\n\t"
".align 16\n\t"
"1: lock; cmpxchg8b %[dest]\n\t"
"jne 1b\n\t"
: [dest] "=o" (storage)
: [value_lo] "b" ((uint32_t)v), "c" ((uint32_t)(v >> 32))
: BOOST_ATOMIC_DETAIL_ASM_CLOBBER_CC_COMMA "eax", "edx", "memory"
);
#endif // defined(__PIC__)
#else // !defined(BOOST_ATOMIC_DETAIL_NO_ASM_IMPLIED_ZERO_DISPLACEMENTS)
#if defined(__PIC__)
uint32_t scratch;
__asm__ __volatile__
(
"movl %%ebx, %[scratch]\n\t"
"movl %[value_lo], %%ebx\n\t"
"movl 0(%[dest]), %%eax\n\t"
"movl 4(%[dest]), %%edx\n\t"
".align 16\n\t"
"1: lock; cmpxchg8b 0(%[dest])\n\t"
"jne 1b\n\t"
"movl %[scratch], %%ebx\n\t"
#if !defined(BOOST_ATOMIC_DETAIL_NO_ASM_CONSTRAINT_ALTERNATIVES)
: [scratch] "=m,m" (scratch)
: [value_lo] "a,a" ((uint32_t)v), "c,c" ((uint32_t)(v >> 32)), [dest] "D,S" (&storage)
#else
: [scratch] "=m" (scratch)
: [value_lo] "a" ((uint32_t)v), "c" ((uint32_t)(v >> 32)), [dest] "D" (&storage)
#endif
: BOOST_ATOMIC_DETAIL_ASM_CLOBBER_CC_COMMA "edx", "memory"
);
#else // defined(__PIC__)
__asm__ __volatile__
(
"movl 0(%[dest]), %%eax\n\t"
"movl 4(%[dest]), %%edx\n\t"
".align 16\n\t"
"1: lock; cmpxchg8b 0(%[dest])\n\t"
"jne 1b\n\t"
:
#if !defined(BOOST_ATOMIC_DETAIL_NO_ASM_CONSTRAINT_ALTERNATIVES)
: [value_lo] "b,b" ((uint32_t)v), "c,c" ((uint32_t)(v >> 32)), [dest] "D,S" (&storage)
#else
: [value_lo] "b" ((uint32_t)v), "c" ((uint32_t)(v >> 32)), [dest] "D" (&storage)
#endif
: BOOST_ATOMIC_DETAIL_ASM_CLOBBER_CC_COMMA "eax", "edx", "memory"
);
#endif // defined(__PIC__)
#endif // !defined(BOOST_ATOMIC_DETAIL_NO_ASM_IMPLIED_ZERO_DISPLACEMENTS)
}
}
static BOOST_FORCEINLINE storage_type load(storage_type const volatile& storage, memory_order) BOOST_NOEXCEPT
{
storage_type value;
if ((((uint32_t)&storage) & 0x00000007) == 0)
{
#if defined(__SSE2__)
__asm__ __volatile__
(
#if defined(__AVX__)
"vmovq %1, %%xmm4\n\t"
"vmovq %%xmm4, %0\n\t"
#else
"movq %1, %%xmm4\n\t"
"movq %%xmm4, %0\n\t"
#endif
: "=m" (value)
: "m" (storage)
: "memory", "xmm4"
);
#else
__asm__ __volatile__
(
"fildll %1\n\t"
"fistpll %0\n\t"
: "=m" (value)
: "m" (storage)
: "memory"
);
#endif
}
else
{
#if defined(__clang__)
// Clang cannot allocate eax:edx register pairs but it has sync intrinsics
value = __sync_val_compare_and_swap(&storage, (storage_type)0, (storage_type)0);
#else
// We don't care for comparison result here; the previous value will be stored into value anyway.
// Also we don't care for ebx and ecx values, they just have to be equal to eax and edx before cmpxchg8b.
__asm__ __volatile__
(
"movl %%ebx, %%eax\n\t"
"movl %%ecx, %%edx\n\t"
"lock; cmpxchg8b %[storage]\n\t"
: "=&A" (value)
: [storage] "m" (storage)
: BOOST_ATOMIC_DETAIL_ASM_CLOBBER_CC_COMMA "memory"
);
#endif
}
return value;
}
static BOOST_FORCEINLINE bool compare_exchange_strong(
storage_type volatile& storage, storage_type& expected, storage_type desired, memory_order, memory_order) BOOST_NOEXCEPT
{
#if defined(__clang__)
// Clang cannot allocate eax:edx register pairs but it has sync intrinsics
storage_type old_expected = expected;
expected = __sync_val_compare_and_swap(&storage, old_expected, desired);
return expected == old_expected;
#elif defined(__PIC__)
// Make sure ebx is saved and restored properly in case
// of position independent code. To make this work
// setup register constraints such that ebx can not be
// used by accident e.g. as base address for the variable
// to be modified. Accessing "scratch" should always be okay,
// as it can only be placed on the stack (and therefore
// accessed through ebp or esp only).
//
// In theory, could push/pop ebx onto/off the stack, but movs
// to a prepared stack slot turn out to be faster.
uint32_t scratch;
bool success;
__asm__ __volatile__
(
"movl %%ebx, %[scratch]\n\t"
"movl %[desired_lo], %%ebx\n\t"
"lock; cmpxchg8b %[dest]\n\t"
"movl %[scratch], %%ebx\n\t"
"sete %[success]\n\t"
#if !defined(BOOST_ATOMIC_DETAIL_NO_ASM_CONSTRAINT_ALTERNATIVES)
: "+A,A,A,A,A,A" (expected), [dest] "+m,m,m,m,m,m" (storage), [scratch] "=m,m,m,m,m,m" (scratch), [success] "=q,m,q,m,q,m" (success)
: [desired_lo] "S,S,D,D,m,m" ((uint32_t)desired), "c,c,c,c,c,c" ((uint32_t)(desired >> 32))
#else
: "+A" (expected), [dest] "+m" (storage), [scratch] "=m" (scratch), [success] "=q" (success)
: [desired_lo] "S" ((uint32_t)desired), "c" ((uint32_t)(desired >> 32))
#endif
: BOOST_ATOMIC_DETAIL_ASM_CLOBBER_CC_COMMA "memory"
);
return success;
#else
bool success;
__asm__ __volatile__
(
"lock; cmpxchg8b %[dest]\n\t"
"sete %[success]\n\t"
#if !defined(BOOST_ATOMIC_DETAIL_NO_ASM_CONSTRAINT_ALTERNATIVES)
: "+A,A" (expected), [dest] "+m,m" (storage), [success] "=q,m" (success)
: "b,b" ((uint32_t)desired), "c,c" ((uint32_t)(desired >> 32))
#else
: "+A" (expected), [dest] "+m" (storage), [success] "=q" (success)
: "b" ((uint32_t)desired), "c" ((uint32_t)(desired >> 32))
#endif
: BOOST_ATOMIC_DETAIL_ASM_CLOBBER_CC_COMMA "memory"
);
return success;
#endif
}
static BOOST_FORCEINLINE bool compare_exchange_weak(
storage_type volatile& storage, storage_type& expected, storage_type desired, memory_order success_order, memory_order failure_order) BOOST_NOEXCEPT
{
return compare_exchange_strong(storage, expected, desired, success_order, failure_order);
}
static BOOST_FORCEINLINE storage_type exchange(storage_type volatile& storage, storage_type v, memory_order order) BOOST_NOEXCEPT
{
#if defined(__clang__)
// Clang cannot allocate eax:edx register pairs but it has sync intrinsics
storage_type old_val = storage;
while (true)
{
storage_type val = __sync_val_compare_and_swap(&storage, old_val, v);
if (val == old_val)
return val;
old_val = val;
}
#elif !defined(BOOST_ATOMIC_DETAIL_NO_ASM_IMPLIED_ZERO_DISPLACEMENTS)
#if defined(__PIC__)
uint32_t scratch;
__asm__ __volatile__
(
"movl %%ebx, %[scratch]\n\t"
"movl %%eax, %%ebx\n\t"
"movl %%edx, %%ecx\n\t"
"movl %[dest], %%eax\n\t"
"movl 4+%[dest], %%edx\n\t"
".align 16\n\t"
"1: lock; cmpxchg8b %[dest]\n\t"
"jne 1b\n\t"
"movl %[scratch], %%ebx\n\t"
: "+A" (v), [scratch] "=m" (scratch), [dest] "+o" (storage)
:
: BOOST_ATOMIC_DETAIL_ASM_CLOBBER_CC_COMMA "ecx", "memory"
);
return v;
#else // defined(__PIC__)
__asm__ __volatile__
(
"movl %[dest], %%eax\n\t"
"movl 4+%[dest], %%edx\n\t"
".align 16\n\t"
"1: lock; cmpxchg8b %[dest]\n\t"
"jne 1b\n\t"
: "=A" (v), [dest] "+o" (storage)
: "b" ((uint32_t)v), "c" ((uint32_t)(v >> 32))
: BOOST_ATOMIC_DETAIL_ASM_CLOBBER_CC_COMMA "memory"
);
return v;
#endif // defined(__PIC__)
#else // !defined(BOOST_ATOMIC_DETAIL_NO_ASM_IMPLIED_ZERO_DISPLACEMENTS)
#if defined(__PIC__)
uint32_t scratch;
__asm__ __volatile__
(
"movl %%ebx, %[scratch]\n\t"
"movl %%eax, %%ebx\n\t"
"movl %%edx, %%ecx\n\t"
"movl 0(%[dest]), %%eax\n\t"
"movl 4(%[dest]), %%edx\n\t"
".align 16\n\t"
"1: lock; cmpxchg8b 0(%[dest])\n\t"
"jne 1b\n\t"
"movl %[scratch], %%ebx\n\t"
#if !defined(BOOST_ATOMIC_DETAIL_NO_ASM_CONSTRAINT_ALTERNATIVES)
: "+A,A" (v), [scratch] "=m,m" (scratch)
: [dest] "D,S" (&storage)
#else
: "+A" (v), [scratch] "=m" (scratch)
: [dest] "D" (&storage)
#endif
: BOOST_ATOMIC_DETAIL_ASM_CLOBBER_CC_COMMA "ecx", "memory"
);
return v;
#else // defined(__PIC__)
__asm__ __volatile__
(
"movl 0(%[dest]), %%eax\n\t"
"movl 4(%[dest]), %%edx\n\t"
".align 16\n\t"
"1: lock; cmpxchg8b 0(%[dest])\n\t"
"jne 1b\n\t"
#if !defined(BOOST_ATOMIC_DETAIL_NO_ASM_CONSTRAINT_ALTERNATIVES)
: "=A,A" (v)
: "b,b" ((uint32_t)v), "c,c" ((uint32_t)(v >> 32)), [dest] "D,S" (&storage)
#else
: "=A" (v)
: "b" ((uint32_t)v), "c" ((uint32_t)(v >> 32)), [dest] "D" (&storage)
#endif
: BOOST_ATOMIC_DETAIL_ASM_CLOBBER_CC_COMMA "memory"
);
return v;
#endif // defined(__PIC__)
#endif
}
static BOOST_FORCEINLINE bool is_lock_free(storage_type const volatile&) BOOST_NOEXCEPT
{
return true;
}
};
#endif // defined(BOOST_ATOMIC_DETAIL_X86_HAS_CMPXCHG8B)
#if defined(BOOST_ATOMIC_DETAIL_X86_HAS_CMPXCHG16B)
template< bool Signed >
struct gcc_dcas_x86_64
{
typedef typename make_storage_type< 16u, Signed >::type storage_type;
typedef typename make_storage_type< 16u, Signed >::aligned aligned_storage_type;
static BOOST_CONSTEXPR_OR_CONST bool is_always_lock_free = true;
static BOOST_FORCEINLINE void store(storage_type volatile& storage, storage_type v, memory_order) BOOST_NOEXCEPT
{
uint64_t const* p_value = (uint64_t const*)&v;
const uint64_t v_lo = p_value[0], v_hi = p_value[1];
#if !defined(BOOST_ATOMIC_DETAIL_NO_ASM_IMPLIED_ZERO_DISPLACEMENTS)
__asm__ __volatile__
(
"movq %[dest], %%rax\n\t"
"movq 8+%[dest], %%rdx\n\t"
".align 16\n\t"
"1: lock; cmpxchg16b %[dest]\n\t"
"jne 1b\n\t"
: [dest] "=o" (storage)
: "b" (v_lo), "c" (v_hi)
: BOOST_ATOMIC_DETAIL_ASM_CLOBBER_CC_COMMA "rax", "rdx", "memory"
);
#else // !defined(BOOST_ATOMIC_DETAIL_NO_ASM_IMPLIED_ZERO_DISPLACEMENTS)
__asm__ __volatile__
(
"movq 0(%[dest]), %%rax\n\t"
"movq 8(%[dest]), %%rdx\n\t"
".align 16\n\t"
"1: lock; cmpxchg16b 0(%[dest])\n\t"
"jne 1b\n\t"
:
: "b" (v_lo), "c" (v_hi), [dest] "r" (&storage)
: BOOST_ATOMIC_DETAIL_ASM_CLOBBER_CC_COMMA "rax", "rdx", "memory"
);
#endif // !defined(BOOST_ATOMIC_DETAIL_NO_ASM_IMPLIED_ZERO_DISPLACEMENTS)
}
static BOOST_FORCEINLINE storage_type load(storage_type const volatile& storage, memory_order) BOOST_NOEXCEPT
{
#if defined(__clang__)
// Clang cannot allocate rax:rdx register pairs but it has sync intrinsics
storage_type value = storage_type();
return __sync_val_compare_and_swap(&storage, value, value);
#elif defined(BOOST_ATOMIC_DETAIL_NO_ASM_RAX_RDX_PAIRS)
// GCC 4.4 can't allocate rax:rdx register pair either but it also doesn't support 128-bit __sync_val_compare_and_swap
storage_type value;
// We don't care for comparison result here; the previous value will be stored into value anyway.
// Also we don't care for rbx and rcx values, they just have to be equal to rax and rdx before cmpxchg16b.
#if !defined(BOOST_ATOMIC_DETAIL_NO_ASM_IMPLIED_ZERO_DISPLACEMENTS)
__asm__ __volatile__
(
"movq %%rbx, %%rax\n\t"
"movq %%rcx, %%rdx\n\t"
"lock; cmpxchg16b %[storage]\n\t"
"movq %%rax, %[value]\n\t"
"movq %%rdx, 8+%[value]\n\t"
: [value] "=o" (value)
: [storage] "m" (storage)
: BOOST_ATOMIC_DETAIL_ASM_CLOBBER_CC_COMMA "memory", "rax", "rdx"
);
#else // !defined(BOOST_ATOMIC_DETAIL_NO_ASM_IMPLIED_ZERO_DISPLACEMENTS)
__asm__ __volatile__
(
"movq %%rbx, %%rax\n\t"
"movq %%rcx, %%rdx\n\t"
"lock; cmpxchg16b %[storage]\n\t"
"movq %%rax, 0(%[value])\n\t"
"movq %%rdx, 8(%[value])\n\t"
:
: [storage] "m" (storage), [value] "r" (&value)
: BOOST_ATOMIC_DETAIL_ASM_CLOBBER_CC_COMMA "memory", "rax", "rdx"
);
#endif // !defined(BOOST_ATOMIC_DETAIL_NO_ASM_IMPLIED_ZERO_DISPLACEMENTS)
return value;
#else // defined(BOOST_ATOMIC_DETAIL_NO_ASM_RAX_RDX_PAIRS)
storage_type value;
// We don't care for comparison result here; the previous value will be stored into value anyway.
// Also we don't care for rbx and rcx values, they just have to be equal to rax and rdx before cmpxchg16b.
__asm__ __volatile__
(
"movq %%rbx, %%rax\n\t"
"movq %%rcx, %%rdx\n\t"
"lock; cmpxchg16b %[storage]\n\t"
: "=&A" (value)
: [storage] "m" (storage)
: BOOST_ATOMIC_DETAIL_ASM_CLOBBER_CC_COMMA "memory"
);
return value;
#endif
}
static BOOST_FORCEINLINE bool compare_exchange_strong(
storage_type volatile& storage, storage_type& expected, storage_type desired, memory_order, memory_order) BOOST_NOEXCEPT
{
#if defined(__clang__)
// Clang cannot allocate rax:rdx register pairs but it has sync intrinsics
storage_type old_expected = expected;
expected = __sync_val_compare_and_swap(&storage, old_expected, desired);
return expected == old_expected;
#elif defined(BOOST_ATOMIC_DETAIL_NO_ASM_RAX_RDX_PAIRS)
// GCC 4.4 can't allocate rax:rdx register pair either but it also doesn't support 128-bit __sync_val_compare_and_swap
uint64_t const* p_desired = (uint64_t const*)&desired;
const uint64_t desired_lo = p_desired[0], desired_hi = p_desired[1];
bool success;
#if !defined(BOOST_ATOMIC_DETAIL_NO_ASM_IMPLIED_ZERO_DISPLACEMENTS)
__asm__ __volatile__
(
"movq %[expected], %%rax\n\t"
"movq 8+%[expected], %%rdx\n\t"
"lock; cmpxchg16b %[dest]\n\t"
"sete %[success]\n\t"
"movq %%rax, %[expected]\n\t"
"movq %%rdx, 8+%[expected]\n\t"
: [dest] "+m" (storage), [expected] "+o" (expected), [success] "=q" (success)
: "b" (desired_lo), "c" (desired_hi)
: BOOST_ATOMIC_DETAIL_ASM_CLOBBER_CC_COMMA "memory", "rax", "rdx"
);
#else // !defined(BOOST_ATOMIC_DETAIL_NO_ASM_IMPLIED_ZERO_DISPLACEMENTS)
__asm__ __volatile__
(
"movq 0(%[expected]), %%rax\n\t"
"movq 8(%[expected]), %%rdx\n\t"
"lock; cmpxchg16b %[dest]\n\t"
"sete %[success]\n\t"
"movq %%rax, 0(%[expected])\n\t"
"movq %%rdx, 8(%[expected])\n\t"
: [dest] "+m" (storage), [success] "=q" (success)
: "b" (desired_lo), "c" (desired_hi), [expected] "r" (&expected)
: BOOST_ATOMIC_DETAIL_ASM_CLOBBER_CC_COMMA "memory", "rax", "rdx"
);
#endif // !defined(BOOST_ATOMIC_DETAIL_NO_ASM_IMPLIED_ZERO_DISPLACEMENTS)
return success;
#else // defined(BOOST_ATOMIC_DETAIL_NO_ASM_RAX_RDX_PAIRS)
uint64_t const* p_desired = (uint64_t const*)&desired;
const uint64_t desired_lo = p_desired[0], desired_hi = p_desired[1];
bool success;
__asm__ __volatile__
(
"lock; cmpxchg16b %[dest]\n\t"
"sete %[success]\n\t"
#if !defined(BOOST_ATOMIC_DETAIL_NO_ASM_CONSTRAINT_ALTERNATIVES)
: "+A,A" (expected), [dest] "+m,m" (storage), [success] "=q,m" (success)
: "b,b" (desired_lo), "c,c" (desired_hi)
#else
: "+A" (expected), [dest] "+m" (storage), [success] "=q" (success)
: "b" (desired_lo), "c" (desired_hi)
#endif
: BOOST_ATOMIC_DETAIL_ASM_CLOBBER_CC_COMMA "memory"
);
return success;
#endif
}
static BOOST_FORCEINLINE bool compare_exchange_weak(
storage_type volatile& storage, storage_type& expected, storage_type desired, memory_order success_order, memory_order failure_order) BOOST_NOEXCEPT
{
return compare_exchange_strong(storage, expected, desired, success_order, failure_order);
}
static BOOST_FORCEINLINE storage_type exchange(storage_type volatile& storage, storage_type v, memory_order) BOOST_NOEXCEPT
{
#if defined(__clang__)
// Clang cannot allocate eax:edx register pairs but it has sync intrinsics
storage_type old_val = storage;
while (true)
{
storage_type val = __sync_val_compare_and_swap(&storage, old_val, v);
if (val == old_val)
return val;
old_val = val;
}
#elif defined(BOOST_ATOMIC_DETAIL_NO_ASM_RAX_RDX_PAIRS)
// GCC 4.4 can't allocate rax:rdx register pair either but it also doesn't support 128-bit __sync_val_compare_and_swap
storage_type old_value;
uint64_t const* p_value = (uint64_t const*)&v;
const uint64_t v_lo = p_value[0], v_hi = p_value[1];
#if !defined(BOOST_ATOMIC_DETAIL_NO_ASM_IMPLIED_ZERO_DISPLACEMENTS)
__asm__ __volatile__
(
"movq %[dest], %%rax\n\t"
"movq 8+%[dest], %%rdx\n\t"
".align 16\n\t"
"1: lock; cmpxchg16b %[dest]\n\t"
"jne 1b\n\t"
"movq %%rax, %[old_value]\n\t"
"movq %%rdx, 8+%[old_value]\n\t"
: [dest] "+o" (storage), [old_value] "=o" (old_value)
: "b" (v_lo), "c" (v_hi)
: BOOST_ATOMIC_DETAIL_ASM_CLOBBER_CC_COMMA "memory", "rax", "rdx"
);
#else // !defined(BOOST_ATOMIC_DETAIL_NO_ASM_IMPLIED_ZERO_DISPLACEMENTS)
__asm__ __volatile__
(
"movq 0(%[dest]), %%rax\n\t"
"movq 8(%[dest]), %%rdx\n\t"
".align 16\n\t"
"1: lock; cmpxchg16b 0(%[dest])\n\t"
"jne 1b\n\t"
"movq %%rax, 0(%[old_value])\n\t"
"movq %%rdx, 8(%[old_value])\n\t"
:
: "b" (v_lo), "c" (v_hi), [dest] "r" (&storage), [old_value] "r" (&old_value)
: BOOST_ATOMIC_DETAIL_ASM_CLOBBER_CC_COMMA "memory", "rax", "rdx"
);
#endif // !defined(BOOST_ATOMIC_DETAIL_NO_ASM_IMPLIED_ZERO_DISPLACEMENTS)
return old_value;
#else // defined(BOOST_ATOMIC_DETAIL_NO_ASM_RAX_RDX_PAIRS)
uint64_t const* p_value = (uint64_t const*)&v;
const uint64_t v_lo = p_value[0], v_hi = p_value[1];
#if !defined(BOOST_ATOMIC_DETAIL_NO_ASM_IMPLIED_ZERO_DISPLACEMENTS)
__asm__ __volatile__
(
"movq %[dest], %%rax\n\t"
"movq 8+%[dest], %%rdx\n\t"
".align 16\n\t"
"1: lock; cmpxchg16b %[dest]\n\t"
"jne 1b\n\t"
: "=&A" (v), [dest] "+o" (storage)
: "b" (v_lo), "c" (v_hi)
: BOOST_ATOMIC_DETAIL_ASM_CLOBBER_CC_COMMA "memory"
);
#else // !defined(BOOST_ATOMIC_DETAIL_NO_ASM_IMPLIED_ZERO_DISPLACEMENTS)
__asm__ __volatile__
(
"movq 0(%[dest]), %%rax\n\t"
"movq 8(%[dest]), %%rdx\n\t"
".align 16\n\t"
"1: lock; cmpxchg16b 0(%[dest])\n\t"
"jne 1b\n\t"
: "=&A" (v)
: "b" (v_lo), "c" (v_hi), [dest] "r" (&storage)
: BOOST_ATOMIC_DETAIL_ASM_CLOBBER_CC_COMMA "memory"
);
#endif // !defined(BOOST_ATOMIC_DETAIL_NO_ASM_IMPLIED_ZERO_DISPLACEMENTS)
return v;
#endif
}
static BOOST_FORCEINLINE bool is_lock_free(storage_type const volatile&) BOOST_NOEXCEPT
{
return true;
}
};
#endif // defined(BOOST_ATOMIC_DETAIL_X86_HAS_CMPXCHG16B)
} // namespace detail
} // namespace atomics
} // namespace boost
#endif // BOOST_ATOMIC_DETAIL_OPS_GCC_X86_DCAS_HPP_INCLUDED_
@@ -0,0 +1,104 @@
Notes on WSJT-X Installation for Mac OS X
-----------------------------------------
Updated 16 July 2017
--------------------
If you have already downloaded a previous version of WSJT-X then I suggest
you change the name in the Applications folder from WSJT-X to WSJT-X_previous
before proceeding.
If you have installed a previous version of WSJT-X before then there is no
need to change anything on your system so proceed to NEXT.
BEGIN:
There are some system matters you must deal with first. Open a Terminal window
by going to Applications->Utilities and clicking on Terminal.
Along with this ReadMe file there is a file: sysctl.conf. Drag this file to your Desktop.
WSJT-X makes use of a block of memory which is shared between different parts of
the code. The normal allocation of shared memory on a Mac is insufficient and this
has to be increased. You should use a Mac editor to examine sysctl.conf.
There are two important parameters that you need to consider. shmmax determines the
amount of shared memory that must be allocated for WSJT-X to operate. This is 14680064 (14MB)
and this is defined in the sysctl.conf file and should not be changed.
It is possible to run more than one instance of WSJT-X simultaneously. See
"Section 14. Platform Dependencies" in the User Guide. The second important parameter
shmall=17920 determines how many instances are permitted. This is calculated as:
(shmall x 4096/14680064) = 5.
The sysctl.conf file is configured to permit up to 5 instances of wsjtx to run simultaneously.
If this limitation is acceptable then you can continue to install the sysctl.conf file without making any
alterations. Otherwise you must edit the file to increase shmall according to this calculation.
Now move this file into place for the system to use by typing: (Note this assumes that
you really did drag this file to your Desktop as required earlier.)
sudo cp $HOME/Desktop/sysctl.conf /etc/
sudo chmod 664 /etc/sysctl.conf
sudo chown root:wheel /etc/sysctl.conf
and then reboot your Mac. This is necessary to install the changes. After the
reboot you should re-open the Terminal window as before and you can check that the
change has been made by typing:
sysctl -a | grep sysv.shm
If shmmax is not shown as 14680064 then contact me since WSJT-X will fail to load with
an error message: "Unable to create shared memory segment".
You are now finished with system changes. You should make certain that NO error messages
have been produced during these steps. You can now close the Terminal window. It will
not be necessary to repeat this procedure again, even when you download an updated
version of WSJT-X.
NEXT:
Drag the WSJT-X app to your preferred location, such as Applications.
You need to configure your sound card. Visit Applications > Utilities > Audio MIDI
Setup and select your sound card and then set Format to be "48000Hz 2ch-16bit" for
input and output.
Now double-click on the WSJT-X app and two windows will appear. Select Preferences
under the WSJT-X Menu and fill in various station details on the General panel.
I recommend checking the 4 boxes under the Display heading and the first 4 boxes under
the Behaviour heading.
Next visit the Audio panel and select the Audio Codec you use to communicate between
WSJT-X and your rig. There are so many audio interfaces available that it is not
possible to give detailed advice on selection. If you have difficulties contact me.
Note the location of the Save Directory. Decoded wave forms are located here.
Look at the Reporting panel. If you check the "Prompt me" box, a logging panel will appear
at the end of the QSO. Two log files are provided in Library/Application Support/WSJT-X.
These are a simple wsjtx.log file and wsjtx_log.adi which is formatted for use with
logging databases. The "File" menu bar items include a button "Open log directory"
to open the log directory in Finder for you, ready for processing by any logging
application you use.
Finally, visit the Radio panel. WSJT-X is most effective when operated with CAT
control. You will need to install the relevant Mac driver for your rig. This must
be located in the device driver directory /dev. You should install your driver
and then re-launch WSJT-X. Return to the the Radio panel in Preferences and in
the "Serial port" panel select your driver from the list that is presented. If
for some reason your driver is not shown, then insert the full name
of your driver in the Serial Port panel. Such as: /dev/tty.PL2303-00002226 or
whatever driver you have. The /dev/ prefix is mandatory. Set the relevant
communication parameters as required by your transceiver and click "Test CAT" to
check.
WSJT-X needs the Mac clock to be accurate. Visit System Preferences > Date & Time
and make sure that date and time are set automatically. The drop-down menu will
normally offer you several time servers to choose from.
On the Help menu, have a look at the new Online User's Guide for operational hints
and tips.
Please email me if you have problems.
--- John G4KLA (g4kla@rmnjmn.co.uk)
@@ -0,0 +1,145 @@
/* Copyright 2003-2015 Joaquin M Lopez Munoz.
* Distributed under the Boost Software License, Version 1.0.
* (See accompanying file LICENSE_1_0.txt or copy at
* http://www.boost.org/LICENSE_1_0.txt)
*
* See http://www.boost.org/libs/multi_index for library home page.
*/
#ifndef BOOST_MULTI_INDEX_IDENTITY_HPP
#define BOOST_MULTI_INDEX_IDENTITY_HPP
#if defined(_MSC_VER)
#pragma once
#endif
#include <boost/config.hpp>
#include <boost/detail/workaround.hpp>
#include <boost/mpl/if.hpp>
#include <boost/multi_index/identity_fwd.hpp>
#include <boost/type_traits/is_const.hpp>
#include <boost/type_traits/remove_const.hpp>
#include <boost/utility/enable_if.hpp>
#if !defined(BOOST_NO_SFINAE)
#include <boost/type_traits/is_convertible.hpp>
#endif
namespace boost{
template<class Type> class reference_wrapper; /* fwd decl. */
namespace multi_index{
namespace detail{
/* identity is a do-nothing key extractor that returns the [const] Type&
* object passed.
* Additionally, identity is overloaded to support referece_wrappers
* of Type and "chained pointers" to Type's. By chained pointer to Type we
* mean a type P such that, given a p of type P
* *...n...*x is convertible to Type&, for some n>=1.
* Examples of chained pointers are raw and smart pointers, iterators and
* arbitrary combinations of these (vg. Type** or unique_ptr<Type*>.)
*/
template<typename Type>
struct const_identity_base
{
typedef Type result_type;
template<typename ChainedPtr>
#if !defined(BOOST_NO_SFINAE)
typename disable_if<is_convertible<const ChainedPtr&,Type&>,Type&>::type
#else
Type&
#endif
operator()(const ChainedPtr& x)const
{
return operator()(*x);
}
Type& operator()(Type& x)const
{
return x;
}
Type& operator()(const reference_wrapper<Type>& x)const
{
return x.get();
}
Type& operator()(
const reference_wrapper<typename remove_const<Type>::type>& x
#if BOOST_WORKAROUND(BOOST_MSVC,==1310)
/* http://lists.boost.org/Archives/boost/2015/10/226135.php */
,int=0
#endif
)const
{
return x.get();
}
};
template<typename Type>
struct non_const_identity_base
{
typedef Type result_type;
/* templatized for pointer-like types */
template<typename ChainedPtr>
#if !defined(BOOST_NO_SFINAE)
typename disable_if<
is_convertible<const ChainedPtr&,const Type&>,Type&>::type
#else
Type&
#endif
operator()(const ChainedPtr& x)const
{
return operator()(*x);
}
const Type& operator()(const Type& x)const
{
return x;
}
Type& operator()(Type& x)const
{
return x;
}
const Type& operator()(const reference_wrapper<const Type>& x)const
{
return x.get();
}
Type& operator()(const reference_wrapper<Type>& x)const
{
return x.get();
}
};
} /* namespace multi_index::detail */
template<class Type>
struct identity:
mpl::if_c<
is_const<Type>::value,
detail::const_identity_base<Type>,detail::non_const_identity_base<Type>
>::type
{
};
} /* namespace multi_index */
} /* namespace boost */
#endif
@@ -0,0 +1,58 @@
<HTML><HEAD>
<TITLE> References on Low Density Parity Check Codes </TITLE>
</HEAD><BODY>
<H1> References on Low Density Parity Check Codes </H1>
Robert Gallager's original work on low density parity check codes was published
as the following book, based his doctoral dissertation, and a related paper:
<BLOCKQUOTE>
<P>Gallager, R. G. (1963) <I>Low Density Parity Check Codes</I>,
Cambridge, MA: MIT Press.
<P>Gallager, R. G. (1962) ``Low-density parity-check codes'', <I>IRE
Transactions on Information Theory</I>, vol. IT-8, pp. 21-28.
</BLOCKQUOTE>
More recent work on these codes by David MacKay and myself was published
as follows:
<BLOCKQUOTE>
<P>MacKay, D. J. C. and Neal, R. M. (1996) ``Near Shannon limit performance
of low density parity check codes'', <I>Electronics Letters</I>,
vol. 32, pp. 1645-1646. Reprinted with printing errors corrected
in vol. 33, pp. 457-458.
<P>MacKay, D. J. C. (1999) ``Good error-correcting codes based on very
sparse matrices'', <I>IEEE Transactions on Information Theory</I>,
vol. 45, pp. 399-431.
</BLOCKQUOTE>
The decoding algorithms described in the above references can visualized
in terms of a ``factor graph'' representation of the code, as described
in the following paper:
<BLOCKQUOTE>
<P>Kschischang, F. R., Frey, B. J., and Loeliger, H.-A. (1998) ``Factor graphs
and the sum-product algorithm'', <I>IEEE Transactions on Information
Theory</I>, vol. 47, pp. 498-519.
</BLOCKQUOTE>
I presented the application of sparse matrix techniques to encoding of
LDPC codes at the IMA workshop on Codes, Systems and Graphical Models,
Minneapolis, 1999. You can view the slides of this talk <A
HREF="sparse-encode.pdf">here</A>. <B>Note</B>: Due to a bug in the
program I used then, the results shown for the minimal product heuristic in
these slides are somewhat worse than the actual performance. For instance,
the number of bit operations per check bit for for <I>M</I>=3200 with
3 checks per bit is actually around 12.7, not the value around 17 shown
on one of the slides.
<P>Text and references to many more recent and classical papers can be
obtained via the <A HREF="http://www.ima.umn.edu/csg/">IMA workshop's
web page</A>.
<HR>
<A HREF="index.html">Back to index for LDPC software</A>
</BODY></HTML>
@@ -0,0 +1,74 @@
#ifndef BOOST_SERIALIZATION_CONFIG_HPP
#define BOOST_SERIALIZATION_CONFIG_HPP
// config.hpp ---------------------------------------------//
// (c) Copyright Robert Ramey 2004
// Use, modification, and distribution is subject to the Boost Software
// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
// See library home page at http://www.boost.org/libs/serialization
//----------------------------------------------------------------------------//
// This header implements separate compilation features as described in
// http://www.boost.org/more/separate_compilation.html
#include <boost/config.hpp>
#include <boost/detail/workaround.hpp>
// note: this version incorporates the related code into the the
// the same library as BOOST_ARCHIVE. This could change some day in the
// future
// if BOOST_SERIALIZATION_DECL is defined undefine it now:
#ifdef BOOST_SERIALIZATION_DECL
#undef BOOST_SERIALIZATION_DECL
#endif
// we need to import/export our code only if the user has specifically
// asked for it by defining either BOOST_ALL_DYN_LINK if they want all boost
// libraries to be dynamically linked, or BOOST_SERIALIZATION_DYN_LINK
// if they want just this one to be dynamically liked:
#if defined(BOOST_ALL_DYN_LINK) || defined(BOOST_SERIALIZATION_DYN_LINK)
#if !defined(BOOST_DYN_LINK)
#define BOOST_DYN_LINK
#endif
// export if this is our own source, otherwise import:
#if defined(BOOST_SERIALIZATION_SOURCE)
#define BOOST_SERIALIZATION_DECL BOOST_SYMBOL_EXPORT
#else
#define BOOST_SERIALIZATION_DECL BOOST_SYMBOL_IMPORT
#endif // defined(BOOST_SERIALIZATION_SOURCE)
#endif // defined(BOOST_ALL_DYN_LINK) || defined(BOOST_SERIALIZATION_DYN_LINK)
// if BOOST_SERIALIZATION_DECL isn't defined yet define it now:
#ifndef BOOST_SERIALIZATION_DECL
#define BOOST_SERIALIZATION_DECL
#endif
// enable automatic library variant selection ------------------------------//
#if !defined(BOOST_ALL_NO_LIB) && !defined(BOOST_SERIALIZATION_NO_LIB) \
&& !defined(BOOST_ARCHIVE_SOURCE) && !defined(BOOST_WARCHIVE_SOURCE) \
&& !defined(BOOST_SERIALIZATION_SOURCE)
//
// Set the name of our library, this will get undef'ed by auto_link.hpp
// once it's done with it:
//
#define BOOST_LIB_NAME boost_serialization
//
// If we're importing code from a dll, then tell auto_link.hpp about it:
//
#if defined(BOOST_ALL_DYN_LINK) || defined(BOOST_SERIALIZATION_DYN_LINK)
# define BOOST_DYN_LINK
#endif
//
// And include the header that does the work:
//
#include <boost/config/auto_link.hpp>
#endif
#endif // BOOST_SERIALIZATION_CONFIG_HPP
@@ -0,0 +1,83 @@
/* Boost interval/detail/ia64_rounding_control.hpp file
*
* Copyright 2006-2007 Boris Gubenko
*
* 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_INTERVAL_DETAIL_IA64_ROUNDING_CONTROL_HPP
#define BOOST_NUMERIC_INTERVAL_DETAIL_IA64_ROUNDING_CONTROL_HPP
#if !defined(ia64) && !defined(__ia64) && !defined(__ia64__)
#error This header only works on ia64 CPUs.
#endif
#if defined(__hpux)
# include <fenv.h>
namespace boost {
namespace numeric {
namespace interval_lib {
namespace detail {
struct ia64_rounding_control
{
typedef unsigned int rounding_mode;
static void set_rounding_mode(const rounding_mode& mode) {
fesetround(mode); }
static void get_rounding_mode(rounding_mode& mode) { mode = fegetround(); }
static void downward() { set_rounding_mode(FE_DOWNWARD); }
static void upward() { set_rounding_mode(FE_UPWARD); }
static void to_nearest() { set_rounding_mode(FE_TONEAREST); }
static void toward_zero() { set_rounding_mode(FE_TOWARDZERO); }
};
} // namespace detail
extern "C" {
float rintf(float);
double rint(double);
long double rintl(long double);
}
template<>
struct rounding_control<float>:
detail::ia64_rounding_control
{
static float force_rounding(const float r)
{ volatile float _r = r; return _r; }
static float to_int(const float& x) { return rintf(x); }
};
template<>
struct rounding_control<double>:
detail::ia64_rounding_control
{
static const double & force_rounding(const double& r) { return r; }
static double to_int(const double& r) { return rint(r); }
};
template<>
struct rounding_control<long double>:
detail::ia64_rounding_control
{
static const long double & force_rounding(const long double& r) { return r; }
static long double to_int(const long double& r) { return rintl(r); }
};
} // namespace interval_lib
} // namespace numeric
} // namespace boost
#undef BOOST_NUMERIC_INTERVAL_NO_HARDWARE
#endif /* __hpux */
#endif /* BOOST_NUMERIC_INTERVAL_DETAIL_IA64_ROUNDING_CONTROL_HPP */