Initial Commit
This commit is contained in:
@@ -0,0 +1,81 @@
|
||||
#ifndef GREGORIAN_FORMATTERS_LIMITED_HPP___
|
||||
#define GREGORIAN_FORMATTERS_LIMITED_HPP___
|
||||
|
||||
/* Copyright (c) 2002,2003 CrystalClear Software, Inc.
|
||||
* Use, modification and distribution is subject to the
|
||||
* Boost Software License, Version 1.0. (See accompanying
|
||||
* file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt)
|
||||
* Author: Jeff Garland, Bart Garst
|
||||
* $Date$
|
||||
*/
|
||||
|
||||
#include "boost/date_time/gregorian/gregorian_types.hpp"
|
||||
#include "boost/date_time/date_formatting_limited.hpp"
|
||||
#include "boost/date_time/iso_format.hpp"
|
||||
#include "boost/date_time/date_format_simple.hpp"
|
||||
#include "boost/date_time/compiler_config.hpp"
|
||||
|
||||
namespace boost {
|
||||
namespace gregorian {
|
||||
|
||||
//! To YYYY-mmm-DD string where mmm 3 char month name. Example: 2002-Jan-01
|
||||
/*!\ingroup date_format
|
||||
*/
|
||||
inline std::string to_simple_string(const date& d) {
|
||||
return date_time::date_formatter<date,date_time::simple_format<char> >::date_to_string(d);
|
||||
}
|
||||
|
||||
//! Convert date period to simple string. Example: [2002-Jan-01/2002-Jan-02]
|
||||
/*!\ingroup date_format
|
||||
*/
|
||||
inline std::string to_simple_string(const date_period& d) {
|
||||
std::string s("[");
|
||||
std::string d1(date_time::date_formatter<date,date_time::simple_format<char> >::date_to_string(d.begin()));
|
||||
std::string d2(date_time::date_formatter<date,date_time::simple_format<char> >::date_to_string(d.last()));
|
||||
return std::string("[" + d1 + "/" + d2 + "]");
|
||||
}
|
||||
|
||||
//! Date period to iso standard format CCYYMMDD/CCYYMMDD. Example: 20021225/20021231
|
||||
/*!\ingroup date_format
|
||||
*/
|
||||
inline std::string to_iso_string(const date_period& d) {
|
||||
std::string s(date_time::date_formatter<date,date_time::iso_format<char> >::date_to_string(d.begin()));
|
||||
return s + "/" + date_time::date_formatter<date,date_time::iso_format<char> >::date_to_string(d.last());
|
||||
}
|
||||
|
||||
|
||||
//! Convert to iso extended format string CCYY-MM-DD. Example 2002-12-31
|
||||
/*!\ingroup date_format
|
||||
*/
|
||||
inline std::string to_iso_extended_string(const date& d) {
|
||||
return date_time::date_formatter<date,date_time::iso_extended_format<char> >::date_to_string(d);
|
||||
}
|
||||
|
||||
//! Convert to iso standard string YYYYMMDD. Example: 20021231
|
||||
/*!\ingroup date_format
|
||||
*/
|
||||
inline std::string to_iso_string(const date& d) {
|
||||
return date_time::date_formatter<date,date_time::iso_format<char> >::date_to_string(d);
|
||||
}
|
||||
|
||||
|
||||
|
||||
inline std::string to_sql_string(const date& d)
|
||||
{
|
||||
date::ymd_type ymd = d.year_month_day();
|
||||
std::ostringstream ss;
|
||||
ss << ymd.year << "-"
|
||||
<< std::setw(2) << std::setfill('0')
|
||||
<< ymd.month.as_number() //solves problem with gcc 3.1 hanging
|
||||
<< "-"
|
||||
<< std::setw(2) << std::setfill('0')
|
||||
<< ymd.day;
|
||||
return ss.str();
|
||||
}
|
||||
|
||||
|
||||
} } //namespace gregorian
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
@@ -0,0 +1,76 @@
|
||||
// Copyright Peter Dimov and 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 GET_POINTER_DWA20021219_HPP
|
||||
#define GET_POINTER_DWA20021219_HPP
|
||||
|
||||
#include <boost/config.hpp>
|
||||
|
||||
// In order to avoid circular dependencies with Boost.TR1
|
||||
// we make sure that our include of <memory> doesn't try to
|
||||
// pull in the TR1 headers: that's why we use this header
|
||||
// rather than including <memory> directly:
|
||||
#include <boost/config/no_tr1/memory.hpp> // std::auto_ptr
|
||||
|
||||
namespace boost {
|
||||
|
||||
// get_pointer(p) extracts a ->* capable pointer from p
|
||||
|
||||
template<class T> T * get_pointer(T * p)
|
||||
{
|
||||
return p;
|
||||
}
|
||||
|
||||
// get_pointer(shared_ptr<T> const & p) has been moved to shared_ptr.hpp
|
||||
|
||||
#if !defined( BOOST_NO_AUTO_PTR )
|
||||
|
||||
#if defined( __GNUC__ ) && (defined( __GXX_EXPERIMENTAL_CXX0X__ ) || (__cplusplus >= 201103L))
|
||||
#if defined( BOOST_GCC )
|
||||
#if BOOST_GCC >= 40600
|
||||
#define BOOST_CORE_DETAIL_DISABLE_LIBSTDCXX_DEPRECATED_WARNINGS
|
||||
#endif // BOOST_GCC >= 40600
|
||||
#elif defined( __clang__ ) && defined( __has_warning )
|
||||
#if __has_warning("-Wdeprecated-declarations")
|
||||
#define BOOST_CORE_DETAIL_DISABLE_LIBSTDCXX_DEPRECATED_WARNINGS
|
||||
#endif // __has_warning("-Wdeprecated-declarations")
|
||||
#endif
|
||||
#endif // defined( __GNUC__ ) && (defined( __GXX_EXPERIMENTAL_CXX0X__ ) || (__cplusplus >= 201103L))
|
||||
|
||||
#if defined( BOOST_CORE_DETAIL_DISABLE_LIBSTDCXX_DEPRECATED_WARNINGS )
|
||||
// Disable libstdc++ warnings about std::auto_ptr being deprecated in C++11 mode
|
||||
#pragma GCC diagnostic push
|
||||
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
|
||||
#define BOOST_CORE_DETAIL_DISABLED_DEPRECATED_WARNINGS
|
||||
#endif
|
||||
|
||||
template<class T> T * get_pointer(std::auto_ptr<T> const& p)
|
||||
{
|
||||
return p.get();
|
||||
}
|
||||
|
||||
#if defined( BOOST_CORE_DETAIL_DISABLE_LIBSTDCXX_DEPRECATED_WARNINGS )
|
||||
#pragma GCC diagnostic pop
|
||||
#undef BOOST_CORE_DETAIL_DISABLE_LIBSTDCXX_DEPRECATED_WARNINGS
|
||||
#endif
|
||||
|
||||
#endif // !defined( BOOST_NO_AUTO_PTR )
|
||||
|
||||
#if !defined( BOOST_NO_CXX11_SMART_PTR )
|
||||
|
||||
template<class T> T * get_pointer( std::unique_ptr<T> const& p )
|
||||
{
|
||||
return p.get();
|
||||
}
|
||||
|
||||
template<class T> T * get_pointer( std::shared_ptr<T> const& p )
|
||||
{
|
||||
return p.get();
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
} // namespace boost
|
||||
|
||||
#endif // GET_POINTER_DWA20021219_HPP
|
||||
@@ -0,0 +1,245 @@
|
||||
|
||||
// Copyright Aleksey Gurtovoy 2000-2004
|
||||
//
|
||||
// Distributed under the Boost Software License, Version 1.0.
|
||||
// (See accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
//
|
||||
|
||||
// Preprocessed version of "boost/mpl/aux_/fold_impl.hpp" header
|
||||
// -- DO NOT modify by hand!
|
||||
|
||||
namespace boost { namespace mpl { namespace aux {
|
||||
|
||||
/// forward declaration
|
||||
|
||||
template<
|
||||
int N
|
||||
, typename First
|
||||
, typename Last
|
||||
, typename State
|
||||
, typename ForwardOp
|
||||
>
|
||||
struct fold_impl;
|
||||
|
||||
template< int N >
|
||||
struct fold_chunk;
|
||||
|
||||
template<> struct fold_chunk<0>
|
||||
{
|
||||
template<
|
||||
typename First
|
||||
, typename Last
|
||||
, typename State
|
||||
, typename ForwardOp
|
||||
>
|
||||
struct result_
|
||||
{
|
||||
typedef First iter0;
|
||||
typedef State state0;
|
||||
typedef state0 state;
|
||||
typedef iter0 iterator;
|
||||
};
|
||||
};
|
||||
|
||||
template<> struct fold_chunk<1>
|
||||
{
|
||||
template<
|
||||
typename First
|
||||
, typename Last
|
||||
, typename State
|
||||
, typename ForwardOp
|
||||
>
|
||||
struct result_
|
||||
{
|
||||
typedef First iter0;
|
||||
typedef State state0;
|
||||
typedef typename apply2< ForwardOp, state0, typename deref<iter0>::type >::type state1;
|
||||
typedef typename mpl::next<iter0>::type iter1;
|
||||
|
||||
|
||||
typedef state1 state;
|
||||
typedef iter1 iterator;
|
||||
};
|
||||
};
|
||||
|
||||
template<> struct fold_chunk<2>
|
||||
{
|
||||
template<
|
||||
typename First
|
||||
, typename Last
|
||||
, typename State
|
||||
, typename ForwardOp
|
||||
>
|
||||
struct result_
|
||||
{
|
||||
typedef First iter0;
|
||||
typedef State state0;
|
||||
typedef typename apply2< ForwardOp, state0, typename deref<iter0>::type >::type state1;
|
||||
typedef typename mpl::next<iter0>::type iter1;
|
||||
typedef typename apply2< ForwardOp, state1, typename deref<iter1>::type >::type state2;
|
||||
typedef typename mpl::next<iter1>::type iter2;
|
||||
|
||||
|
||||
typedef state2 state;
|
||||
typedef iter2 iterator;
|
||||
};
|
||||
};
|
||||
|
||||
template<> struct fold_chunk<3>
|
||||
{
|
||||
template<
|
||||
typename First
|
||||
, typename Last
|
||||
, typename State
|
||||
, typename ForwardOp
|
||||
>
|
||||
struct result_
|
||||
{
|
||||
typedef First iter0;
|
||||
typedef State state0;
|
||||
typedef typename apply2< ForwardOp, state0, typename deref<iter0>::type >::type state1;
|
||||
typedef typename mpl::next<iter0>::type iter1;
|
||||
typedef typename apply2< ForwardOp, state1, typename deref<iter1>::type >::type state2;
|
||||
typedef typename mpl::next<iter1>::type iter2;
|
||||
typedef typename apply2< ForwardOp, state2, typename deref<iter2>::type >::type state3;
|
||||
typedef typename mpl::next<iter2>::type iter3;
|
||||
|
||||
|
||||
typedef state3 state;
|
||||
typedef iter3 iterator;
|
||||
};
|
||||
};
|
||||
|
||||
template<> struct fold_chunk<4>
|
||||
{
|
||||
template<
|
||||
typename First
|
||||
, typename Last
|
||||
, typename State
|
||||
, typename ForwardOp
|
||||
>
|
||||
struct result_
|
||||
{
|
||||
typedef First iter0;
|
||||
typedef State state0;
|
||||
typedef typename apply2< ForwardOp, state0, typename deref<iter0>::type >::type state1;
|
||||
typedef typename mpl::next<iter0>::type iter1;
|
||||
typedef typename apply2< ForwardOp, state1, typename deref<iter1>::type >::type state2;
|
||||
typedef typename mpl::next<iter1>::type iter2;
|
||||
typedef typename apply2< ForwardOp, state2, typename deref<iter2>::type >::type state3;
|
||||
typedef typename mpl::next<iter2>::type iter3;
|
||||
typedef typename apply2< ForwardOp, state3, typename deref<iter3>::type >::type state4;
|
||||
typedef typename mpl::next<iter3>::type iter4;
|
||||
|
||||
|
||||
typedef state4 state;
|
||||
typedef iter4 iterator;
|
||||
};
|
||||
};
|
||||
|
||||
template< int N >
|
||||
struct fold_chunk
|
||||
{
|
||||
template<
|
||||
typename First
|
||||
, typename Last
|
||||
, typename State
|
||||
, typename ForwardOp
|
||||
>
|
||||
struct result_
|
||||
{
|
||||
typedef fold_impl<
|
||||
4
|
||||
, First
|
||||
, Last
|
||||
, State
|
||||
, ForwardOp
|
||||
> chunk_;
|
||||
|
||||
typedef fold_impl<
|
||||
( (N - 4) < 0 ? 0 : N - 4 )
|
||||
, typename chunk_::iterator
|
||||
, Last
|
||||
, typename chunk_::state
|
||||
, ForwardOp
|
||||
> res_;
|
||||
|
||||
typedef typename res_::state state;
|
||||
typedef typename res_::iterator iterator;
|
||||
};
|
||||
};
|
||||
|
||||
template<
|
||||
typename First
|
||||
, typename Last
|
||||
, typename State
|
||||
, typename ForwardOp
|
||||
>
|
||||
struct fold_step;
|
||||
|
||||
template<
|
||||
typename Last
|
||||
, typename State
|
||||
>
|
||||
struct fold_null_step
|
||||
{
|
||||
typedef Last iterator;
|
||||
typedef State state;
|
||||
};
|
||||
|
||||
template<>
|
||||
struct fold_chunk< -1 >
|
||||
{
|
||||
template<
|
||||
typename First
|
||||
, typename Last
|
||||
, typename State
|
||||
, typename ForwardOp
|
||||
>
|
||||
struct result_
|
||||
{
|
||||
typedef typename if_<
|
||||
typename is_same< First,Last >::type
|
||||
, fold_null_step< Last,State >
|
||||
, fold_step< First,Last,State,ForwardOp >
|
||||
>::type res_;
|
||||
|
||||
typedef typename res_::state state;
|
||||
typedef typename res_::iterator iterator;
|
||||
};
|
||||
};
|
||||
|
||||
template<
|
||||
typename First
|
||||
, typename Last
|
||||
, typename State
|
||||
, typename ForwardOp
|
||||
>
|
||||
struct fold_step
|
||||
{
|
||||
typedef fold_chunk< -1 >::template result_<
|
||||
typename mpl::next<First>::type
|
||||
, Last
|
||||
, typename apply2<ForwardOp,State, typename deref<First>::type>::type
|
||||
, ForwardOp
|
||||
> chunk_;
|
||||
|
||||
typedef typename chunk_::state state;
|
||||
typedef typename chunk_::iterator iterator;
|
||||
};
|
||||
|
||||
template<
|
||||
int N
|
||||
, typename First
|
||||
, typename Last
|
||||
, typename State
|
||||
, typename ForwardOp
|
||||
>
|
||||
struct fold_impl
|
||||
: fold_chunk<N>
|
||||
::template result_< First,Last,State,ForwardOp >
|
||||
{
|
||||
};
|
||||
|
||||
}}}
|
||||
@@ -0,0 +1,12 @@
|
||||
logical*1 function stdmsg(msg0)
|
||||
|
||||
use packjt
|
||||
character*22 msg0,msg
|
||||
integer dat(12)
|
||||
|
||||
call packmsg(msg0,dat,itype)
|
||||
call unpackmsg(dat,msg)
|
||||
stdmsg=(msg.eq.msg0) .and. (itype.ge.0)
|
||||
|
||||
return
|
||||
end function stdmsg
|
||||
@@ -0,0 +1,29 @@
|
||||
# /* **************************************************************************
|
||||
# * *
|
||||
# * (C) Copyright Paul Mensonides 2002.
|
||||
# * Distributed under the Boost Software License, Version 1.0. (See
|
||||
# * accompanying file LICENSE_1_0.txt or copy at
|
||||
# * http://www.boost.org/LICENSE_1_0.txt)
|
||||
# * *
|
||||
# ************************************************************************** */
|
||||
#
|
||||
# /* See http://www.boost.org for most recent version. */
|
||||
#
|
||||
# ifndef BOOST_PREPROCESSOR_WSTRINGIZE_HPP
|
||||
# define BOOST_PREPROCESSOR_WSTRINGIZE_HPP
|
||||
#
|
||||
# include <boost/preprocessor/config/config.hpp>
|
||||
#
|
||||
# /* BOOST_PP_WSTRINGIZE */
|
||||
#
|
||||
# if ~BOOST_PP_CONFIG_FLAGS() & BOOST_PP_CONFIG_MWCC()
|
||||
# define BOOST_PP_WSTRINGIZE(text) BOOST_PP_WSTRINGIZE_I(text)
|
||||
# else
|
||||
# define BOOST_PP_WSTRINGIZE(text) BOOST_PP_WSTRINGIZE_OO((text))
|
||||
# define BOOST_PP_WSTRINGIZE_OO(par) BOOST_PP_WSTRINGIZE_I ## par
|
||||
# endif
|
||||
#
|
||||
# define BOOST_PP_WSTRINGIZE_I(text) BOOST_PP_WSTRINGIZE_II(#text)
|
||||
# define BOOST_PP_WSTRINGIZE_II(str) L ## str
|
||||
#
|
||||
# endif
|
||||
@@ -0,0 +1,106 @@
|
||||
// boost asinh.hpp header file
|
||||
|
||||
// (C) Copyright Eric Ford & Hubert Holin 2001.
|
||||
// (C) Copyright John Maddock 2008.
|
||||
// Distributed under the Boost Software License, Version 1.0. (See
|
||||
// accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
// See http://www.boost.org for updates, documentation, and revision history.
|
||||
|
||||
#ifndef BOOST_ASINH_HPP
|
||||
#define BOOST_ASINH_HPP
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#pragma once
|
||||
#endif
|
||||
|
||||
|
||||
#include <boost/config/no_tr1/cmath.hpp>
|
||||
#include <boost/config.hpp>
|
||||
#include <boost/math/tools/precision.hpp>
|
||||
#include <boost/math/special_functions/math_fwd.hpp>
|
||||
#include <boost/math/special_functions/sqrt1pm1.hpp>
|
||||
#include <boost/math/special_functions/log1p.hpp>
|
||||
#include <boost/math/constants/constants.hpp>
|
||||
|
||||
// This is the inverse of the hyperbolic sine function.
|
||||
|
||||
namespace boost
|
||||
{
|
||||
namespace math
|
||||
{
|
||||
namespace detail{
|
||||
template<typename T, class Policy>
|
||||
inline T asinh_imp(const T x, const Policy& pol)
|
||||
{
|
||||
BOOST_MATH_STD_USING
|
||||
|
||||
if (x >= tools::forth_root_epsilon<T>())
|
||||
{
|
||||
if (x > 1 / tools::root_epsilon<T>())
|
||||
{
|
||||
// http://functions.wolfram.com/ElementaryFunctions/ArcSinh/06/01/06/01/0001/
|
||||
// approximation by laurent series in 1/x at 0+ order from -1 to 1
|
||||
return constants::ln_two<T>() + log(x) + 1/ (4 * x * x);
|
||||
}
|
||||
else if(x < 0.5f)
|
||||
{
|
||||
// As below, but rearranged to preserve digits:
|
||||
return boost::math::log1p(x + boost::math::sqrt1pm1(x * x, pol), pol);
|
||||
}
|
||||
else
|
||||
{
|
||||
// http://functions.wolfram.com/ElementaryFunctions/ArcSinh/02/
|
||||
return( log( x + sqrt(x*x+1) ) );
|
||||
}
|
||||
}
|
||||
else if (x <= -tools::forth_root_epsilon<T>())
|
||||
{
|
||||
return(-asinh(-x, pol));
|
||||
}
|
||||
else
|
||||
{
|
||||
// http://functions.wolfram.com/ElementaryFunctions/ArcSinh/06/01/03/01/0001/
|
||||
// approximation by taylor series in x at 0 up to order 2
|
||||
T result = x;
|
||||
|
||||
if (abs(x) >= tools::root_epsilon<T>())
|
||||
{
|
||||
T x3 = x*x*x;
|
||||
|
||||
// approximation by taylor series in x at 0 up to order 4
|
||||
result -= x3/static_cast<T>(6);
|
||||
}
|
||||
|
||||
return(result);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
inline typename tools::promote_args<T>::type asinh(T x)
|
||||
{
|
||||
return boost::math::asinh(x, policies::policy<>());
|
||||
}
|
||||
template<typename T, typename Policy>
|
||||
inline typename tools::promote_args<T>::type asinh(T x, const Policy&)
|
||||
{
|
||||
typedef typename tools::promote_args<T>::type result_type;
|
||||
typedef typename policies::evaluation<result_type, Policy>::type value_type;
|
||||
typedef typename policies::normalise<
|
||||
Policy,
|
||||
policies::promote_float<false>,
|
||||
policies::promote_double<false>,
|
||||
policies::discrete_quantile<>,
|
||||
policies::assert_undefined<> >::type forwarding_policy;
|
||||
return policies::checked_narrowing_cast<result_type, forwarding_policy>(
|
||||
detail::asinh_imp(static_cast<value_type>(x), forwarding_policy()),
|
||||
"boost::math::asinh<%1%>(%1%)");
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
#endif /* BOOST_ASINH_HPP */
|
||||
|
||||
@@ -0,0 +1,41 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2001-2011 Joel de Guzman
|
||||
|
||||
Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
==============================================================================*/
|
||||
#if !defined(BOOST_FUSION_BEGIN_IMPL_09242011_1744)
|
||||
#define BOOST_FUSION_BEGIN_IMPL_09242011_1744
|
||||
|
||||
#include <boost/fusion/support/config.hpp>
|
||||
#include <boost/fusion/adapted/std_tuple/std_tuple_iterator.hpp>
|
||||
|
||||
namespace boost { namespace fusion
|
||||
{
|
||||
struct std_tuple_tag;
|
||||
|
||||
namespace extension
|
||||
{
|
||||
template<typename T>
|
||||
struct begin_impl;
|
||||
|
||||
template <>
|
||||
struct begin_impl<std_tuple_tag>
|
||||
{
|
||||
template <typename Sequence>
|
||||
struct apply
|
||||
{
|
||||
typedef std_tuple_iterator<Sequence, 0> type;
|
||||
|
||||
BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
|
||||
static type
|
||||
call(Sequence& v)
|
||||
{
|
||||
return type(v);
|
||||
}
|
||||
};
|
||||
};
|
||||
}
|
||||
}}
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,163 @@
|
||||
// Copyright 2004 The Trustees of Indiana University.
|
||||
|
||||
// Use, modification and distribution is subject to the Boost Software
|
||||
// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
// Authors: Douglas Gregor
|
||||
// Andrew Lumsdaine
|
||||
#ifndef BOOST_GRAPH_PARALLEL_BFS_HPP
|
||||
#define BOOST_GRAPH_PARALLEL_BFS_HPP
|
||||
|
||||
#ifndef BOOST_GRAPH_USE_MPI
|
||||
#error "Parallel BGL files should not be included unless <boost/graph/use_mpi.hpp> has been included"
|
||||
#endif
|
||||
|
||||
#include <boost/graph/breadth_first_search.hpp>
|
||||
#include <boost/graph/overloading.hpp>
|
||||
#include <boost/graph/distributed/concepts.hpp>
|
||||
#include <boost/graph/distributed/detail/filtered_queue.hpp>
|
||||
#include <boost/graph/distributed/queue.hpp>
|
||||
#include <boost/dynamic_bitset.hpp>
|
||||
#include <boost/pending/queue.hpp>
|
||||
#include <boost/graph/parallel/properties.hpp>
|
||||
#include <boost/graph/parallel/container_traits.hpp>
|
||||
|
||||
namespace boost {
|
||||
namespace detail {
|
||||
/** @brief A unary predicate that decides when to push into a
|
||||
* breadth-first search queue.
|
||||
*
|
||||
* This predicate stores a color map that is used to determine
|
||||
* when to push. If it is provided with a key for which the color
|
||||
* is white, it darkens the color to gray and returns true (so
|
||||
* that the value will be pushed appropriately); if the color is
|
||||
* not white, it returns false so that the vertex will be
|
||||
* ignored.
|
||||
*/
|
||||
template<typename ColorMap>
|
||||
struct darken_and_push
|
||||
{
|
||||
typedef typename property_traits<ColorMap>::key_type argument_type;
|
||||
typedef bool result_type;
|
||||
|
||||
explicit darken_and_push(const ColorMap& color) : color(color) { }
|
||||
|
||||
bool operator()(const argument_type& value) const
|
||||
{
|
||||
typedef color_traits<typename property_traits<ColorMap>::value_type>
|
||||
Color;
|
||||
if (get(color, value) == Color::white()) {
|
||||
put(color, value, Color::gray());
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
ColorMap color;
|
||||
};
|
||||
|
||||
template<typename IndexMap>
|
||||
struct has_not_been_seen
|
||||
{
|
||||
typedef bool result_type;
|
||||
|
||||
has_not_been_seen() { }
|
||||
|
||||
has_not_been_seen(std::size_t n, IndexMap index_map)
|
||||
: seen(n), index_map(index_map) {}
|
||||
|
||||
template<typename Key>
|
||||
result_type operator()(Key key)
|
||||
{
|
||||
bool result = seen[get(index_map, key)];
|
||||
seen[get(index_map, key)] = true;
|
||||
return !result;
|
||||
}
|
||||
|
||||
void swap(has_not_been_seen& other)
|
||||
{
|
||||
using std::swap;
|
||||
swap(seen, other.seen);
|
||||
swap(index_map, other.index_map);
|
||||
}
|
||||
|
||||
private:
|
||||
dynamic_bitset<> seen;
|
||||
IndexMap index_map;
|
||||
};
|
||||
|
||||
template<typename IndexMap>
|
||||
inline void
|
||||
swap(has_not_been_seen<IndexMap>& x, has_not_been_seen<IndexMap>& y)
|
||||
{
|
||||
x.swap(y);
|
||||
}
|
||||
|
||||
template <class DistributedGraph, class ColorMap, class BFSVisitor,
|
||||
class BufferRef, class VertexIndexMap>
|
||||
inline void
|
||||
parallel_bfs_helper
|
||||
(DistributedGraph& g,
|
||||
typename graph_traits<DistributedGraph>::vertex_descriptor s,
|
||||
ColorMap color,
|
||||
BFSVisitor vis,
|
||||
BufferRef Q,
|
||||
VertexIndexMap)
|
||||
{
|
||||
set_property_map_role(vertex_color, color);
|
||||
color.set_consistency_model(0);
|
||||
breadth_first_search(g, s, Q.ref, vis, color);
|
||||
}
|
||||
|
||||
template <class DistributedGraph, class ColorMap, class BFSVisitor,
|
||||
class VertexIndexMap>
|
||||
void parallel_bfs_helper
|
||||
(DistributedGraph& g,
|
||||
typename graph_traits<DistributedGraph>::vertex_descriptor s,
|
||||
ColorMap color,
|
||||
BFSVisitor vis,
|
||||
boost::param_not_found,
|
||||
VertexIndexMap vertex_index)
|
||||
{
|
||||
using boost::graph::parallel::process_group;
|
||||
|
||||
typedef graph_traits<DistributedGraph> Traits;
|
||||
typedef typename Traits::vertex_descriptor Vertex;
|
||||
typedef typename boost::graph::parallel::process_group_type<DistributedGraph>::type
|
||||
process_group_type;
|
||||
|
||||
set_property_map_role(vertex_color, color);
|
||||
color.set_consistency_model(0);
|
||||
|
||||
// Buffer default
|
||||
typedef typename property_map<DistributedGraph, vertex_owner_t>
|
||||
::const_type vertex_owner_map;
|
||||
typedef boost::graph::distributed::distributed_queue<
|
||||
process_group_type, vertex_owner_map, queue<Vertex>,
|
||||
detail::darken_and_push<ColorMap> > queue_t;
|
||||
queue_t Q(process_group(g),
|
||||
get(vertex_owner, g),
|
||||
detail::darken_and_push<ColorMap>(color));
|
||||
breadth_first_search(g, s, Q, vis, color);
|
||||
}
|
||||
|
||||
template <class DistributedGraph, class ColorMap, class BFSVisitor,
|
||||
class P, class T, class R>
|
||||
void bfs_helper
|
||||
(DistributedGraph& g,
|
||||
typename graph_traits<DistributedGraph>::vertex_descriptor s,
|
||||
ColorMap color,
|
||||
BFSVisitor vis,
|
||||
const bgl_named_params<P, T, R>& params,
|
||||
boost::mpl::true_)
|
||||
{
|
||||
parallel_bfs_helper
|
||||
(g, s, color, vis, get_param(params, buffer_param_t()),
|
||||
choose_const_pmap(get_param(params, vertex_index), g, vertex_index));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endif // BOOST_GRAPH_PARALLEL_BFS_HPP
|
||||
@@ -0,0 +1,144 @@
|
||||
/*==============================================================================
|
||||
Copyright (c) 2005-2010 Joel de Guzman
|
||||
Copyright (c) 2010 Thomas Heller
|
||||
|
||||
Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
==============================================================================*/
|
||||
#ifndef BOOST_PHOENIX_CORE_TERMINAL_HPP
|
||||
#define BOOST_PHOENIX_CORE_TERMINAL_HPP
|
||||
|
||||
#include <boost/phoenix/core/limits.hpp>
|
||||
#include <boost/call_traits.hpp>
|
||||
#include <boost/is_placeholder.hpp>
|
||||
#include <boost/phoenix/core/actor.hpp>
|
||||
#include <boost/phoenix/core/meta_grammar.hpp>
|
||||
#include <boost/phoenix/core/terminal_fwd.hpp>
|
||||
#include <boost/proto/matches.hpp>
|
||||
#include <boost/proto/transform/lazy.hpp>
|
||||
#include <boost/proto/functional/fusion/at.hpp>
|
||||
#include <boost/type_traits/remove_pointer.hpp>
|
||||
|
||||
#define BOOST_PHOENIX_DEFINE_CUSTOM_TERMINAL(Template, Terminal, IsNullary, EvalFun)\
|
||||
namespace boost { namespace phoenix \
|
||||
{ \
|
||||
namespace result_of \
|
||||
{ \
|
||||
Template \
|
||||
struct is_nullary< \
|
||||
custom_terminal< \
|
||||
Terminal \
|
||||
> \
|
||||
> \
|
||||
: IsNullary \
|
||||
{}; \
|
||||
} \
|
||||
Template \
|
||||
struct is_custom_terminal<Terminal >: mpl::true_ {}; \
|
||||
\
|
||||
Template \
|
||||
struct custom_terminal<Terminal > : proto::call<EvalFun > {}; \
|
||||
}} \
|
||||
/**/
|
||||
|
||||
namespace boost { namespace phoenix
|
||||
{
|
||||
template <typename T, typename Dummy>
|
||||
struct is_custom_terminal
|
||||
: mpl::false_ {};
|
||||
|
||||
template <typename T, typename Dummy>
|
||||
struct custom_terminal;
|
||||
|
||||
namespace tag {
|
||||
struct terminal /*: public proto::tag::terminal */ {};
|
||||
}
|
||||
|
||||
namespace expression
|
||||
{
|
||||
template <typename T, template <typename> class Actor = actor>
|
||||
struct terminal
|
||||
: proto::terminal<
|
||||
T//typename call_traits<T>::value_type
|
||||
>
|
||||
{
|
||||
typedef
|
||||
proto::basic_expr<
|
||||
proto::tag::terminal
|
||||
// tag::terminal //cannot change to use phoenix tag - breaks code.
|
||||
, proto::term<T>
|
||||
, 0
|
||||
>
|
||||
base_type;
|
||||
typedef Actor<base_type> type;
|
||||
|
||||
static const type make(typename call_traits<T>::param_type t)
|
||||
{
|
||||
// ?? Should the next line be Actor not actor which is the default?
|
||||
actor<base_type> const e = {base_type::make(t)};
|
||||
//Actor<base_type> const e = {base_type::make(t)};
|
||||
return e;
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
namespace rule
|
||||
{
|
||||
struct argument
|
||||
: proto::if_<boost::is_placeholder<proto::_value>()>
|
||||
{};
|
||||
|
||||
struct custom_terminal
|
||||
: proto::if_<boost::phoenix::is_custom_terminal<proto::_value>()>
|
||||
{};
|
||||
|
||||
struct terminal
|
||||
: proto::terminal<proto::_>
|
||||
{};
|
||||
}
|
||||
|
||||
template <typename Dummy>
|
||||
struct meta_grammar::case_<proto::tag::terminal, Dummy>
|
||||
: proto::or_<
|
||||
enable_rule<rule::argument , Dummy>
|
||||
, enable_rule<rule::custom_terminal, Dummy>
|
||||
, enable_rule<rule::terminal , Dummy>
|
||||
>
|
||||
{};
|
||||
|
||||
template <typename Dummy>
|
||||
struct default_actions::when<rule::custom_terminal, Dummy>
|
||||
: proto::lazy<
|
||||
custom_terminal<proto::_value>(
|
||||
proto::_value
|
||||
, _context
|
||||
)
|
||||
>
|
||||
{};
|
||||
|
||||
namespace detail
|
||||
{
|
||||
template <typename N>
|
||||
struct placeholder_idx
|
||||
: mpl::int_<N::value>
|
||||
{};
|
||||
}
|
||||
|
||||
template <typename Grammar>
|
||||
struct default_actions::when<rule::argument, Grammar>
|
||||
: proto::call<
|
||||
proto::functional::at(
|
||||
_env
|
||||
, proto::make<
|
||||
detail::placeholder_idx<
|
||||
proto::make<
|
||||
boost::is_placeholder<proto::_value>()
|
||||
>
|
||||
>()
|
||||
>
|
||||
)
|
||||
>
|
||||
{};
|
||||
}}
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,15 @@
|
||||
// Status=review
|
||||
[[FIG_CONFIG_RPT]]
|
||||
image::reporting.png[align="center",alt="Reporting Screen"]
|
||||
|
||||
- _Logging_: Choose any desired options from this group.
|
||||
|
||||
- _Network Services_: Check *Enable PSK Reporter Spotting* to send
|
||||
reception reports to the {pskreporter} mapping facility.
|
||||
|
||||
- _UDP Server_: This group of options controls the network name or
|
||||
address and port number used by a program that will receive status
|
||||
updates from _WSJT-X_. Cooperating applications like _JTAlert_ use
|
||||
this feature to obtain information about a running _WSJT-X_ instance.
|
||||
If you are using _JTAlert_, be sure to check the three boxes at lower
|
||||
right.
|
||||
@@ -0,0 +1,277 @@
|
||||
// (C) Copyright Gennadiy Rozental 2001.
|
||||
// Distributed under the Boost Software License, Version 1.0.
|
||||
// (See accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
// See http://www.boost.org/libs/test for the library home page.
|
||||
//
|
||||
// File : $RCSfile$
|
||||
//
|
||||
// Version : $Revision: 62016 $
|
||||
//
|
||||
// Description : defines decorators to be using with auto registered test units
|
||||
// ***************************************************************************
|
||||
|
||||
#ifndef BOOST_TEST_TREE_DECORATOR_HPP_091911GER
|
||||
#define BOOST_TEST_TREE_DECORATOR_HPP_091911GER
|
||||
|
||||
// Boost.Test
|
||||
#include <boost/test/detail/config.hpp>
|
||||
#include <boost/test/detail/global_typedef.hpp>
|
||||
|
||||
#include <boost/test/tree/fixture.hpp>
|
||||
|
||||
#include <boost/test/tools/assertion_result.hpp>
|
||||
|
||||
#include <boost/test/utils/basic_cstring/basic_cstring.hpp>
|
||||
#include <boost/test/utils/trivial_singleton.hpp>
|
||||
|
||||
// Boost
|
||||
#include <boost/shared_ptr.hpp>
|
||||
#include <boost/function/function0.hpp>
|
||||
#include <boost/function/function1.hpp>
|
||||
|
||||
#include <boost/test/detail/suppress_warnings.hpp>
|
||||
|
||||
// STL
|
||||
#include <vector>
|
||||
|
||||
//____________________________________________________________________________//
|
||||
|
||||
namespace boost {
|
||||
namespace unit_test {
|
||||
|
||||
class test_unit;
|
||||
|
||||
namespace decorator {
|
||||
|
||||
// ************************************************************************** //
|
||||
// ************** decorator::collector ************** //
|
||||
// ************************************************************************** //
|
||||
|
||||
class base;
|
||||
typedef boost::shared_ptr<base> base_ptr;
|
||||
|
||||
class BOOST_TEST_DECL collector : public singleton<collector> {
|
||||
public:
|
||||
collector& operator*( base const& d );
|
||||
|
||||
void store_in( test_unit& tu );
|
||||
|
||||
void reset();
|
||||
|
||||
private:
|
||||
BOOST_TEST_SINGLETON_CONS( collector )
|
||||
|
||||
// Data members
|
||||
std::vector<base_ptr> m_tu_decorators;
|
||||
};
|
||||
|
||||
// ************************************************************************** //
|
||||
// ************** decorator::base ************** //
|
||||
// ************************************************************************** //
|
||||
|
||||
class BOOST_TEST_DECL base {
|
||||
public:
|
||||
// composition interface
|
||||
collector& operator*() const;
|
||||
|
||||
// application interface
|
||||
virtual void apply( test_unit& tu ) = 0;
|
||||
|
||||
// deep cloning interface
|
||||
virtual base_ptr clone() const = 0;
|
||||
|
||||
protected:
|
||||
virtual ~base() {}
|
||||
};
|
||||
|
||||
// ************************************************************************** //
|
||||
// ************** decorator::label ************** //
|
||||
// ************************************************************************** //
|
||||
|
||||
class BOOST_TEST_DECL label : public decorator::base {
|
||||
public:
|
||||
explicit label( const_string l ) : m_label( l ) {}
|
||||
|
||||
private:
|
||||
// decorator::base interface
|
||||
virtual void apply( test_unit& tu );
|
||||
virtual base_ptr clone() const { return base_ptr(new label( m_label )); }
|
||||
|
||||
// Data members
|
||||
const_string m_label;
|
||||
};
|
||||
|
||||
// ************************************************************************** //
|
||||
// ************** decorator::expected_failures ************** //
|
||||
// ************************************************************************** //
|
||||
|
||||
class BOOST_TEST_DECL expected_failures : public decorator::base {
|
||||
public:
|
||||
explicit expected_failures( counter_t ef ) : m_exp_fail( ef ) {}
|
||||
|
||||
private:
|
||||
// decorator::base interface
|
||||
virtual void apply( test_unit& tu );
|
||||
virtual base_ptr clone() const { return base_ptr(new expected_failures( m_exp_fail )); }
|
||||
|
||||
// Data members
|
||||
counter_t m_exp_fail;
|
||||
};
|
||||
|
||||
// ************************************************************************** //
|
||||
// ************** decorator::timeout ************** //
|
||||
// ************************************************************************** //
|
||||
|
||||
class BOOST_TEST_DECL timeout : public decorator::base {
|
||||
public:
|
||||
explicit timeout( unsigned t ) : m_timeout( t ) {}
|
||||
|
||||
private:
|
||||
// decorator::base interface
|
||||
virtual void apply( test_unit& tu );
|
||||
virtual base_ptr clone() const { return base_ptr(new timeout( m_timeout )); }
|
||||
|
||||
// Data members
|
||||
unsigned m_timeout;
|
||||
};
|
||||
|
||||
// ************************************************************************** //
|
||||
// ************** decorator::description ************** //
|
||||
// ************************************************************************** //
|
||||
|
||||
class BOOST_TEST_DECL description : public decorator::base {
|
||||
public:
|
||||
explicit description( const_string descr ) : m_description( descr ) {}
|
||||
|
||||
private:
|
||||
// decorator::base interface
|
||||
virtual void apply( test_unit& tu );
|
||||
virtual base_ptr clone() const { return base_ptr(new description( m_description )); }
|
||||
|
||||
// Data members
|
||||
const_string m_description;
|
||||
};
|
||||
|
||||
// ************************************************************************** //
|
||||
// ************** decorator::depends_on ************** //
|
||||
// ************************************************************************** //
|
||||
|
||||
class BOOST_TEST_DECL depends_on : public decorator::base {
|
||||
public:
|
||||
explicit depends_on( const_string dependency ) : m_dependency( dependency ) {}
|
||||
|
||||
private:
|
||||
// decorator::base interface
|
||||
virtual void apply( test_unit& tu );
|
||||
virtual base_ptr clone() const { return base_ptr(new depends_on( m_dependency )); }
|
||||
|
||||
// Data members
|
||||
const_string m_dependency;
|
||||
};
|
||||
|
||||
// ************************************************************************** //
|
||||
// ************** decorator::enable_if/enabled/disabled ************** //
|
||||
// ************************************************************************** //
|
||||
|
||||
class BOOST_TEST_DECL enable_if_impl : public decorator::base {
|
||||
protected:
|
||||
void apply_impl( test_unit& tu, bool condition );
|
||||
};
|
||||
|
||||
template<bool condition>
|
||||
class enable_if : public enable_if_impl {
|
||||
private:
|
||||
// decorator::base interface
|
||||
virtual void apply( test_unit& tu ) { this->apply_impl( tu, condition ); }
|
||||
virtual base_ptr clone() const { return base_ptr(new enable_if<condition>()); }
|
||||
};
|
||||
|
||||
typedef enable_if<true> enabled;
|
||||
typedef enable_if<false> disabled;
|
||||
|
||||
// ************************************************************************** //
|
||||
// ************** decorator::fixture ************** //
|
||||
// ************************************************************************** //
|
||||
|
||||
class BOOST_TEST_DECL fixture_t : public decorator::base {
|
||||
public:
|
||||
// Constructor
|
||||
explicit fixture_t( test_unit_fixture_ptr impl ) : m_impl( impl ) {}
|
||||
|
||||
private:
|
||||
// decorator::base interface
|
||||
virtual void apply( test_unit& tu );
|
||||
virtual base_ptr clone() const { return base_ptr(new fixture_t( m_impl )); }
|
||||
|
||||
// Data members
|
||||
test_unit_fixture_ptr m_impl;
|
||||
};
|
||||
|
||||
//____________________________________________________________________________//
|
||||
|
||||
template<typename F>
|
||||
inline fixture_t
|
||||
fixture()
|
||||
{
|
||||
return fixture_t( test_unit_fixture_ptr( new unit_test::class_based_fixture<F>() ) );
|
||||
}
|
||||
|
||||
//____________________________________________________________________________//
|
||||
|
||||
template<typename F, typename Arg>
|
||||
inline fixture_t
|
||||
fixture( Arg const& arg )
|
||||
{
|
||||
return fixture_t( test_unit_fixture_ptr( new unit_test::class_based_fixture<F,Arg>( arg ) ) );
|
||||
}
|
||||
|
||||
//____________________________________________________________________________//
|
||||
|
||||
inline fixture_t
|
||||
fixture( boost::function<void()> const& setup, boost::function<void()> const& teardown = boost::function<void()>() )
|
||||
{
|
||||
return fixture_t( test_unit_fixture_ptr( new unit_test::function_based_fixture( setup, teardown ) ) );
|
||||
}
|
||||
|
||||
//____________________________________________________________________________//
|
||||
|
||||
// ************************************************************************** //
|
||||
// ************** decorator::depends_on ************** //
|
||||
// ************************************************************************** //
|
||||
|
||||
class BOOST_TEST_DECL precondition : public decorator::base {
|
||||
public:
|
||||
typedef boost::function<test_tools::assertion_result (test_unit_id)> predicate_t;
|
||||
|
||||
explicit precondition( predicate_t p ) : m_precondition( p ) {}
|
||||
|
||||
private:
|
||||
// decorator::base interface
|
||||
virtual void apply( test_unit& tu );
|
||||
virtual base_ptr clone() const { return base_ptr(new precondition( m_precondition )); }
|
||||
|
||||
// Data members
|
||||
predicate_t m_precondition;
|
||||
};
|
||||
|
||||
} // namespace decorator
|
||||
|
||||
using decorator::label;
|
||||
using decorator::expected_failures;
|
||||
using decorator::timeout;
|
||||
using decorator::description;
|
||||
using decorator::depends_on;
|
||||
using decorator::enable_if;
|
||||
using decorator::enabled;
|
||||
using decorator::disabled;
|
||||
using decorator::fixture;
|
||||
using decorator::precondition;
|
||||
|
||||
} // namespace unit_test
|
||||
} // namespace boost
|
||||
|
||||
#include <boost/test/detail/enable_warnings.hpp>
|
||||
|
||||
#endif // BOOST_TEST_TREE_DECORATOR_HPP_091911GER
|
||||
@@ -0,0 +1,759 @@
|
||||
//
|
||||
// Copyright (c) 2000-2002
|
||||
// Joerg Walter, Mathias Koch
|
||||
//
|
||||
// Distributed under the Boost Software License, Version 1.0. (See
|
||||
// accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
//
|
||||
// The authors gratefully acknowledge the support of
|
||||
// GeNeSys mbH & Co. KG in producing this work.
|
||||
//
|
||||
|
||||
#ifndef _BOOST_UBLAS_TRAITS_
|
||||
#define _BOOST_UBLAS_TRAITS_
|
||||
|
||||
#include <iterator>
|
||||
#include <complex>
|
||||
#include <boost/config/no_tr1/cmath.hpp>
|
||||
|
||||
#include <boost/numeric/ublas/detail/config.hpp>
|
||||
#include <boost/numeric/ublas/detail/iterator.hpp>
|
||||
#include <boost/numeric/ublas/detail/returntype_deduction.hpp>
|
||||
#ifdef BOOST_UBLAS_USE_INTERVAL
|
||||
#include <boost/numeric/interval.hpp>
|
||||
#endif
|
||||
|
||||
#include <boost/type_traits.hpp>
|
||||
#include <complex>
|
||||
#include <boost/typeof/typeof.hpp>
|
||||
#include <boost/utility/enable_if.hpp>
|
||||
#include <boost/type_traits/is_float.hpp>
|
||||
#include <boost/type_traits/is_integral.hpp>
|
||||
#include <boost/type_traits/is_unsigned.hpp>
|
||||
#include <boost/mpl/and.hpp>
|
||||
|
||||
// anonymous namespace to avoid ADL issues
|
||||
namespace {
|
||||
template<class T> T boost_numeric_ublas_sqrt (const T& t) {
|
||||
using namespace std;
|
||||
// we'll find either std::sqrt or else another version via ADL:
|
||||
return sqrt (t);
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
inline typename boost::disable_if<
|
||||
boost::is_unsigned<T>, T >::type
|
||||
boost_numeric_ublas_abs (const T &t ) {
|
||||
using namespace std;
|
||||
return abs( t );
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
inline typename boost::enable_if<
|
||||
boost::is_unsigned<T>, T >::type
|
||||
boost_numeric_ublas_abs (const T &t ) {
|
||||
return t;
|
||||
}
|
||||
}
|
||||
|
||||
namespace boost { namespace numeric { namespace ublas {
|
||||
|
||||
|
||||
template<typename R, typename I>
|
||||
typename boost::enable_if<
|
||||
mpl::and_<
|
||||
boost::is_float<R>,
|
||||
boost::is_integral<I>
|
||||
>,
|
||||
std::complex<R> >::type inline operator+ (I in1, std::complex<R> const& in2 ) {
|
||||
return R (in1) + in2;
|
||||
}
|
||||
|
||||
template<typename R, typename I>
|
||||
typename boost::enable_if<
|
||||
mpl::and_<
|
||||
boost::is_float<R>,
|
||||
boost::is_integral<I>
|
||||
>,
|
||||
std::complex<R> >::type inline operator+ (std::complex<R> const& in1, I in2) {
|
||||
return in1 + R (in2);
|
||||
}
|
||||
|
||||
template<typename R, typename I>
|
||||
typename boost::enable_if<
|
||||
mpl::and_<
|
||||
boost::is_float<R>,
|
||||
boost::is_integral<I>
|
||||
>,
|
||||
std::complex<R> >::type inline operator- (I in1, std::complex<R> const& in2) {
|
||||
return R (in1) - in2;
|
||||
}
|
||||
|
||||
template<typename R, typename I>
|
||||
typename boost::enable_if<
|
||||
mpl::and_<
|
||||
boost::is_float<R>,
|
||||
boost::is_integral<I>
|
||||
>,
|
||||
std::complex<R> >::type inline operator- (std::complex<R> const& in1, I in2) {
|
||||
return in1 - R (in2);
|
||||
}
|
||||
|
||||
template<typename R, typename I>
|
||||
typename boost::enable_if<
|
||||
mpl::and_<
|
||||
boost::is_float<R>,
|
||||
boost::is_integral<I>
|
||||
>,
|
||||
std::complex<R> >::type inline operator* (I in1, std::complex<R> const& in2) {
|
||||
return R (in1) * in2;
|
||||
}
|
||||
|
||||
template<typename R, typename I>
|
||||
typename boost::enable_if<
|
||||
mpl::and_<
|
||||
boost::is_float<R>,
|
||||
boost::is_integral<I>
|
||||
>,
|
||||
std::complex<R> >::type inline operator* (std::complex<R> const& in1, I in2) {
|
||||
return in1 * R(in2);
|
||||
}
|
||||
|
||||
template<typename R, typename I>
|
||||
typename boost::enable_if<
|
||||
mpl::and_<
|
||||
boost::is_float<R>,
|
||||
boost::is_integral<I>
|
||||
>,
|
||||
std::complex<R> >::type inline operator/ (I in1, std::complex<R> const& in2) {
|
||||
return R(in1) / in2;
|
||||
}
|
||||
|
||||
template<typename R, typename I>
|
||||
typename boost::enable_if<
|
||||
mpl::and_<
|
||||
boost::is_float<R>,
|
||||
boost::is_integral<I>
|
||||
>,
|
||||
std::complex<R> >::type inline operator/ (std::complex<R> const& in1, I in2) {
|
||||
return in1 / R (in2);
|
||||
}
|
||||
|
||||
// Use Joel de Guzman's return type deduction
|
||||
// uBLAS assumes a common return type for all binary arithmetic operators
|
||||
template<class X, class Y>
|
||||
struct promote_traits {
|
||||
typedef type_deduction_detail::base_result_of<X, Y> base_type;
|
||||
static typename base_type::x_type x;
|
||||
static typename base_type::y_type y;
|
||||
static const std::size_t size = sizeof (
|
||||
type_deduction_detail::test<
|
||||
typename base_type::x_type
|
||||
, typename base_type::y_type
|
||||
>(x + y) // Use x+y to stand of all the arithmetic actions
|
||||
);
|
||||
|
||||
static const std::size_t index = (size / sizeof (char)) - 1;
|
||||
typedef typename mpl::at_c<
|
||||
typename base_type::types, index>::type id;
|
||||
typedef typename id::type promote_type;
|
||||
};
|
||||
|
||||
|
||||
|
||||
// Type traits - generic numeric properties and functions
|
||||
template<class T>
|
||||
struct type_traits;
|
||||
|
||||
// Define properties for a generic scalar type
|
||||
template<class T>
|
||||
struct scalar_traits {
|
||||
typedef scalar_traits<T> self_type;
|
||||
typedef T value_type;
|
||||
typedef const T &const_reference;
|
||||
typedef T &reference;
|
||||
|
||||
typedef T real_type;
|
||||
typedef real_type precision_type; // we do not know what type has more precision then the real_type
|
||||
|
||||
static const unsigned plus_complexity = 1;
|
||||
static const unsigned multiplies_complexity = 1;
|
||||
|
||||
static
|
||||
BOOST_UBLAS_INLINE
|
||||
real_type real (const_reference t) {
|
||||
return t;
|
||||
}
|
||||
static
|
||||
BOOST_UBLAS_INLINE
|
||||
real_type imag (const_reference /*t*/) {
|
||||
return 0;
|
||||
}
|
||||
static
|
||||
BOOST_UBLAS_INLINE
|
||||
value_type conj (const_reference t) {
|
||||
return t;
|
||||
}
|
||||
|
||||
static
|
||||
BOOST_UBLAS_INLINE
|
||||
real_type type_abs (const_reference t) {
|
||||
return boost_numeric_ublas_abs (t);
|
||||
}
|
||||
static
|
||||
BOOST_UBLAS_INLINE
|
||||
value_type type_sqrt (const_reference t) {
|
||||
// force a type conversion back to value_type for intgral types
|
||||
return value_type (boost_numeric_ublas_sqrt (t));
|
||||
}
|
||||
|
||||
static
|
||||
BOOST_UBLAS_INLINE
|
||||
real_type norm_1 (const_reference t) {
|
||||
return self_type::type_abs (t);
|
||||
}
|
||||
static
|
||||
BOOST_UBLAS_INLINE
|
||||
real_type norm_2 (const_reference t) {
|
||||
return self_type::type_abs (t);
|
||||
}
|
||||
static
|
||||
BOOST_UBLAS_INLINE
|
||||
real_type norm_inf (const_reference t) {
|
||||
return self_type::type_abs (t);
|
||||
}
|
||||
|
||||
static
|
||||
BOOST_UBLAS_INLINE
|
||||
bool equals (const_reference t1, const_reference t2) {
|
||||
return self_type::norm_inf (t1 - t2) < BOOST_UBLAS_TYPE_CHECK_EPSILON *
|
||||
(std::max) ((std::max) (self_type::norm_inf (t1),
|
||||
self_type::norm_inf (t2)),
|
||||
BOOST_UBLAS_TYPE_CHECK_MIN);
|
||||
}
|
||||
};
|
||||
|
||||
// Define default type traits, assume T is a scalar type
|
||||
template<class T>
|
||||
struct type_traits : scalar_traits <T> {
|
||||
typedef type_traits<T> self_type;
|
||||
typedef T value_type;
|
||||
typedef const T &const_reference;
|
||||
typedef T &reference;
|
||||
|
||||
typedef T real_type;
|
||||
typedef real_type precision_type;
|
||||
static const unsigned multiplies_complexity = 1;
|
||||
|
||||
};
|
||||
|
||||
// Define real type traits
|
||||
template<>
|
||||
struct type_traits<float> : scalar_traits<float> {
|
||||
typedef type_traits<float> self_type;
|
||||
typedef float value_type;
|
||||
typedef const value_type &const_reference;
|
||||
typedef value_type &reference;
|
||||
typedef value_type real_type;
|
||||
typedef double precision_type;
|
||||
};
|
||||
template<>
|
||||
struct type_traits<double> : scalar_traits<double> {
|
||||
typedef type_traits<double> self_type;
|
||||
typedef double value_type;
|
||||
typedef const value_type &const_reference;
|
||||
typedef value_type &reference;
|
||||
typedef value_type real_type;
|
||||
typedef long double precision_type;
|
||||
};
|
||||
template<>
|
||||
struct type_traits<long double> : scalar_traits<long double> {
|
||||
typedef type_traits<long double> self_type;
|
||||
typedef long double value_type;
|
||||
typedef const value_type &const_reference;
|
||||
typedef value_type &reference;
|
||||
typedef value_type real_type;
|
||||
typedef value_type precision_type;
|
||||
};
|
||||
|
||||
// Define properties for a generic complex type
|
||||
template<class T>
|
||||
struct complex_traits {
|
||||
typedef complex_traits<T> self_type;
|
||||
typedef T value_type;
|
||||
typedef const T &const_reference;
|
||||
typedef T &reference;
|
||||
|
||||
typedef typename T::value_type real_type;
|
||||
typedef real_type precision_type; // we do not know what type has more precision then the real_type
|
||||
|
||||
static const unsigned plus_complexity = 2;
|
||||
static const unsigned multiplies_complexity = 6;
|
||||
|
||||
static
|
||||
BOOST_UBLAS_INLINE
|
||||
real_type real (const_reference t) {
|
||||
return std::real (t);
|
||||
}
|
||||
static
|
||||
BOOST_UBLAS_INLINE
|
||||
real_type imag (const_reference t) {
|
||||
return std::imag (t);
|
||||
}
|
||||
static
|
||||
BOOST_UBLAS_INLINE
|
||||
value_type conj (const_reference t) {
|
||||
return std::conj (t);
|
||||
}
|
||||
|
||||
static
|
||||
BOOST_UBLAS_INLINE
|
||||
real_type type_abs (const_reference t) {
|
||||
return abs (t);
|
||||
}
|
||||
static
|
||||
BOOST_UBLAS_INLINE
|
||||
value_type type_sqrt (const_reference t) {
|
||||
return sqrt (t);
|
||||
}
|
||||
|
||||
static
|
||||
BOOST_UBLAS_INLINE
|
||||
real_type norm_1 (const_reference t) {
|
||||
return self_type::type_abs (t);
|
||||
// original computation has been replaced because a complex number should behave like a scalar type
|
||||
// return type_traits<real_type>::type_abs (self_type::real (t)) +
|
||||
// type_traits<real_type>::type_abs (self_type::imag (t));
|
||||
}
|
||||
static
|
||||
BOOST_UBLAS_INLINE
|
||||
real_type norm_2 (const_reference t) {
|
||||
return self_type::type_abs (t);
|
||||
}
|
||||
static
|
||||
BOOST_UBLAS_INLINE
|
||||
real_type norm_inf (const_reference t) {
|
||||
return self_type::type_abs (t);
|
||||
// original computation has been replaced because a complex number should behave like a scalar type
|
||||
// return (std::max) (type_traits<real_type>::type_abs (self_type::real (t)),
|
||||
// type_traits<real_type>::type_abs (self_type::imag (t)));
|
||||
}
|
||||
|
||||
static
|
||||
BOOST_UBLAS_INLINE
|
||||
bool equals (const_reference t1, const_reference t2) {
|
||||
return self_type::norm_inf (t1 - t2) < BOOST_UBLAS_TYPE_CHECK_EPSILON *
|
||||
(std::max) ((std::max) (self_type::norm_inf (t1),
|
||||
self_type::norm_inf (t2)),
|
||||
BOOST_UBLAS_TYPE_CHECK_MIN);
|
||||
}
|
||||
};
|
||||
|
||||
// Define complex type traits
|
||||
template<>
|
||||
struct type_traits<std::complex<float> > : complex_traits<std::complex<float> >{
|
||||
typedef type_traits<std::complex<float> > self_type;
|
||||
typedef std::complex<float> value_type;
|
||||
typedef const value_type &const_reference;
|
||||
typedef value_type &reference;
|
||||
typedef float real_type;
|
||||
typedef std::complex<double> precision_type;
|
||||
|
||||
};
|
||||
template<>
|
||||
struct type_traits<std::complex<double> > : complex_traits<std::complex<double> >{
|
||||
typedef type_traits<std::complex<double> > self_type;
|
||||
typedef std::complex<double> value_type;
|
||||
typedef const value_type &const_reference;
|
||||
typedef value_type &reference;
|
||||
typedef double real_type;
|
||||
typedef std::complex<long double> precision_type;
|
||||
};
|
||||
template<>
|
||||
struct type_traits<std::complex<long double> > : complex_traits<std::complex<long double> > {
|
||||
typedef type_traits<std::complex<long double> > self_type;
|
||||
typedef std::complex<long double> value_type;
|
||||
typedef const value_type &const_reference;
|
||||
typedef value_type &reference;
|
||||
typedef long double real_type;
|
||||
typedef value_type precision_type;
|
||||
};
|
||||
|
||||
#ifdef BOOST_UBLAS_USE_INTERVAL
|
||||
// Define scalar interval type traits
|
||||
template<>
|
||||
struct type_traits<boost::numeric::interval<float> > : scalar_traits<boost::numeric::interval<float> > {
|
||||
typedef type_traits<boost::numeric::interval<float> > self_type;
|
||||
typedef boost::numeric::interval<float> value_type;
|
||||
typedef const value_type &const_reference;
|
||||
typedef value_type &reference;
|
||||
typedef value_type real_type;
|
||||
typedef boost::numeric::interval<double> precision_type;
|
||||
|
||||
};
|
||||
template<>
|
||||
struct type_traits<boost::numeric::interval<double> > : scalar_traits<boost::numeric::interval<double> > {
|
||||
typedef type_traits<boost::numeric::interval<double> > self_type;
|
||||
typedef boost::numeric::interval<double> value_type;
|
||||
typedef const value_type &const_reference;
|
||||
typedef value_type &reference;
|
||||
typedef value_type real_type;
|
||||
typedef boost::numeric::interval<long double> precision_type;
|
||||
};
|
||||
template<>
|
||||
struct type_traits<boost::numeric::interval<long double> > : scalar_traits<boost::numeric::interval<long double> > {
|
||||
typedef type_traits<boost::numeric::interval<long double> > self_type;
|
||||
typedef boost::numeric::interval<long double> value_type;
|
||||
typedef const value_type &const_reference;
|
||||
typedef value_type &reference;
|
||||
typedef value_type real_type;
|
||||
typedef value_type precision_type;
|
||||
};
|
||||
#endif
|
||||
|
||||
|
||||
// Storage tags -- hierarchical definition of storage characteristics
|
||||
|
||||
struct unknown_storage_tag {};
|
||||
struct sparse_proxy_tag: public unknown_storage_tag {};
|
||||
struct sparse_tag: public sparse_proxy_tag {};
|
||||
struct packed_proxy_tag: public sparse_proxy_tag {};
|
||||
struct packed_tag: public packed_proxy_tag {};
|
||||
struct dense_proxy_tag: public packed_proxy_tag {};
|
||||
struct dense_tag: public dense_proxy_tag {};
|
||||
|
||||
template<class S1, class S2>
|
||||
struct storage_restrict_traits {
|
||||
typedef S1 storage_category;
|
||||
};
|
||||
|
||||
template<>
|
||||
struct storage_restrict_traits<sparse_tag, dense_proxy_tag> {
|
||||
typedef sparse_proxy_tag storage_category;
|
||||
};
|
||||
template<>
|
||||
struct storage_restrict_traits<sparse_tag, packed_proxy_tag> {
|
||||
typedef sparse_proxy_tag storage_category;
|
||||
};
|
||||
template<>
|
||||
struct storage_restrict_traits<sparse_tag, sparse_proxy_tag> {
|
||||
typedef sparse_proxy_tag storage_category;
|
||||
};
|
||||
|
||||
template<>
|
||||
struct storage_restrict_traits<packed_tag, dense_proxy_tag> {
|
||||
typedef packed_proxy_tag storage_category;
|
||||
};
|
||||
template<>
|
||||
struct storage_restrict_traits<packed_tag, packed_proxy_tag> {
|
||||
typedef packed_proxy_tag storage_category;
|
||||
};
|
||||
template<>
|
||||
struct storage_restrict_traits<packed_tag, sparse_proxy_tag> {
|
||||
typedef sparse_proxy_tag storage_category;
|
||||
};
|
||||
|
||||
template<>
|
||||
struct storage_restrict_traits<packed_proxy_tag, sparse_proxy_tag> {
|
||||
typedef sparse_proxy_tag storage_category;
|
||||
};
|
||||
|
||||
template<>
|
||||
struct storage_restrict_traits<dense_tag, dense_proxy_tag> {
|
||||
typedef dense_proxy_tag storage_category;
|
||||
};
|
||||
template<>
|
||||
struct storage_restrict_traits<dense_tag, packed_proxy_tag> {
|
||||
typedef packed_proxy_tag storage_category;
|
||||
};
|
||||
template<>
|
||||
struct storage_restrict_traits<dense_tag, sparse_proxy_tag> {
|
||||
typedef sparse_proxy_tag storage_category;
|
||||
};
|
||||
|
||||
template<>
|
||||
struct storage_restrict_traits<dense_proxy_tag, packed_proxy_tag> {
|
||||
typedef packed_proxy_tag storage_category;
|
||||
};
|
||||
template<>
|
||||
struct storage_restrict_traits<dense_proxy_tag, sparse_proxy_tag> {
|
||||
typedef sparse_proxy_tag storage_category;
|
||||
};
|
||||
|
||||
|
||||
// Iterator tags -- hierarchical definition of storage characteristics
|
||||
|
||||
struct sparse_bidirectional_iterator_tag : public std::bidirectional_iterator_tag {};
|
||||
struct packed_random_access_iterator_tag : public std::random_access_iterator_tag {};
|
||||
struct dense_random_access_iterator_tag : public packed_random_access_iterator_tag {};
|
||||
|
||||
// Thanks to Kresimir Fresl for convincing Comeau with iterator_base_traits ;-)
|
||||
template<class IC>
|
||||
struct iterator_base_traits {};
|
||||
|
||||
template<>
|
||||
struct iterator_base_traits<std::forward_iterator_tag> {
|
||||
template<class I, class T>
|
||||
struct iterator_base {
|
||||
typedef forward_iterator_base<std::forward_iterator_tag, I, T> type;
|
||||
};
|
||||
};
|
||||
|
||||
template<>
|
||||
struct iterator_base_traits<std::bidirectional_iterator_tag> {
|
||||
template<class I, class T>
|
||||
struct iterator_base {
|
||||
typedef bidirectional_iterator_base<std::bidirectional_iterator_tag, I, T> type;
|
||||
};
|
||||
};
|
||||
template<>
|
||||
struct iterator_base_traits<sparse_bidirectional_iterator_tag> {
|
||||
template<class I, class T>
|
||||
struct iterator_base {
|
||||
typedef bidirectional_iterator_base<sparse_bidirectional_iterator_tag, I, T> type;
|
||||
};
|
||||
};
|
||||
|
||||
template<>
|
||||
struct iterator_base_traits<std::random_access_iterator_tag> {
|
||||
template<class I, class T>
|
||||
struct iterator_base {
|
||||
typedef random_access_iterator_base<std::random_access_iterator_tag, I, T> type;
|
||||
};
|
||||
};
|
||||
template<>
|
||||
struct iterator_base_traits<packed_random_access_iterator_tag> {
|
||||
template<class I, class T>
|
||||
struct iterator_base {
|
||||
typedef random_access_iterator_base<packed_random_access_iterator_tag, I, T> type;
|
||||
};
|
||||
};
|
||||
template<>
|
||||
struct iterator_base_traits<dense_random_access_iterator_tag> {
|
||||
template<class I, class T>
|
||||
struct iterator_base {
|
||||
typedef random_access_iterator_base<dense_random_access_iterator_tag, I, T> type;
|
||||
};
|
||||
};
|
||||
|
||||
template<class I1, class I2>
|
||||
struct iterator_restrict_traits {
|
||||
typedef I1 iterator_category;
|
||||
};
|
||||
|
||||
template<>
|
||||
struct iterator_restrict_traits<packed_random_access_iterator_tag, sparse_bidirectional_iterator_tag> {
|
||||
typedef sparse_bidirectional_iterator_tag iterator_category;
|
||||
};
|
||||
template<>
|
||||
struct iterator_restrict_traits<sparse_bidirectional_iterator_tag, packed_random_access_iterator_tag> {
|
||||
typedef sparse_bidirectional_iterator_tag iterator_category;
|
||||
};
|
||||
|
||||
template<>
|
||||
struct iterator_restrict_traits<dense_random_access_iterator_tag, sparse_bidirectional_iterator_tag> {
|
||||
typedef sparse_bidirectional_iterator_tag iterator_category;
|
||||
};
|
||||
template<>
|
||||
struct iterator_restrict_traits<sparse_bidirectional_iterator_tag, dense_random_access_iterator_tag> {
|
||||
typedef sparse_bidirectional_iterator_tag iterator_category;
|
||||
};
|
||||
|
||||
template<>
|
||||
struct iterator_restrict_traits<dense_random_access_iterator_tag, packed_random_access_iterator_tag> {
|
||||
typedef packed_random_access_iterator_tag iterator_category;
|
||||
};
|
||||
template<>
|
||||
struct iterator_restrict_traits<packed_random_access_iterator_tag, dense_random_access_iterator_tag> {
|
||||
typedef packed_random_access_iterator_tag iterator_category;
|
||||
};
|
||||
|
||||
template<class I>
|
||||
BOOST_UBLAS_INLINE
|
||||
void increment (I &it, const I &it_end, typename I::difference_type compare, packed_random_access_iterator_tag) {
|
||||
it += (std::min) (compare, it_end - it);
|
||||
}
|
||||
template<class I>
|
||||
BOOST_UBLAS_INLINE
|
||||
void increment (I &it, const I &/* it_end */, typename I::difference_type /* compare */, sparse_bidirectional_iterator_tag) {
|
||||
++ it;
|
||||
}
|
||||
template<class I>
|
||||
BOOST_UBLAS_INLINE
|
||||
void increment (I &it, const I &it_end, typename I::difference_type compare) {
|
||||
increment (it, it_end, compare, typename I::iterator_category ());
|
||||
}
|
||||
|
||||
template<class I>
|
||||
BOOST_UBLAS_INLINE
|
||||
void increment (I &it, const I &it_end) {
|
||||
#if BOOST_UBLAS_TYPE_CHECK
|
||||
I cit (it);
|
||||
while (cit != it_end) {
|
||||
BOOST_UBLAS_CHECK (*cit == typename I::value_type/*zero*/(), internal_logic ());
|
||||
++ cit;
|
||||
}
|
||||
#endif
|
||||
it = it_end;
|
||||
}
|
||||
|
||||
namespace detail {
|
||||
|
||||
// specialisation which define whether a type has a trivial constructor
|
||||
// or not. This is used by array types.
|
||||
template<typename T>
|
||||
struct has_trivial_constructor : public boost::has_trivial_constructor<T> {};
|
||||
|
||||
template<typename T>
|
||||
struct has_trivial_destructor : public boost::has_trivial_destructor<T> {};
|
||||
|
||||
template<typename FLT>
|
||||
struct has_trivial_constructor<std::complex<FLT> > : public has_trivial_constructor<FLT> {};
|
||||
|
||||
template<typename FLT>
|
||||
struct has_trivial_destructor<std::complex<FLT> > : public has_trivial_destructor<FLT> {};
|
||||
|
||||
}
|
||||
|
||||
|
||||
/** \brief Traits class to extract type information from a constant matrix or vector CONTAINER.
|
||||
*
|
||||
*/
|
||||
template < class E >
|
||||
struct container_view_traits {
|
||||
/// type of indices
|
||||
typedef typename E::size_type size_type;
|
||||
/// type of differences of indices
|
||||
typedef typename E::difference_type difference_type;
|
||||
|
||||
/// storage category: \c unknown_storage_tag, \c dense_tag, \c packed_tag, ...
|
||||
typedef typename E::storage_category storage_category;
|
||||
|
||||
/// type of elements
|
||||
typedef typename E::value_type value_type;
|
||||
/// const reference to an element
|
||||
typedef typename E::const_reference const_reference;
|
||||
|
||||
/// type used in expressions to mark a reference to this class (usually a const container_reference<const E> or the class itself)
|
||||
typedef typename E::const_closure_type const_closure_type;
|
||||
};
|
||||
|
||||
/** \brief Traits class to extract additional type information from a mutable matrix or vector CONTAINER.
|
||||
*
|
||||
*/
|
||||
template < class E >
|
||||
struct mutable_container_traits {
|
||||
/// reference to an element
|
||||
typedef typename E::reference reference;
|
||||
|
||||
/// type used in expressions to mark a reference to this class (usually a container_reference<E> or the class itself)
|
||||
typedef typename E::closure_type closure_type;
|
||||
};
|
||||
|
||||
/** \brief Traits class to extract type information from a matrix or vector CONTAINER.
|
||||
*
|
||||
*/
|
||||
template < class E >
|
||||
struct container_traits
|
||||
: container_view_traits<E>, mutable_container_traits<E> {
|
||||
|
||||
};
|
||||
|
||||
|
||||
/** \brief Traits class to extract type information from a constant MATRIX.
|
||||
*
|
||||
*/
|
||||
template < class MATRIX >
|
||||
struct matrix_view_traits : container_view_traits <MATRIX> {
|
||||
|
||||
/// orientation of the matrix, either \c row_major_tag, \c column_major_tag or \c unknown_orientation_tag
|
||||
typedef typename MATRIX::orientation_category orientation_category;
|
||||
|
||||
/// row iterator for the matrix
|
||||
typedef typename MATRIX::const_iterator1 const_iterator1;
|
||||
|
||||
/// column iterator for the matrix
|
||||
typedef typename MATRIX::const_iterator2 const_iterator2;
|
||||
};
|
||||
|
||||
/** \brief Traits class to extract additional type information from a mutable MATRIX.
|
||||
*
|
||||
*/
|
||||
template < class MATRIX >
|
||||
struct mutable_matrix_traits
|
||||
: mutable_container_traits <MATRIX> {
|
||||
|
||||
/// row iterator for the matrix
|
||||
typedef typename MATRIX::iterator1 iterator1;
|
||||
|
||||
/// column iterator for the matrix
|
||||
typedef typename MATRIX::iterator2 iterator2;
|
||||
};
|
||||
|
||||
|
||||
/** \brief Traits class to extract type information from a MATRIX.
|
||||
*
|
||||
*/
|
||||
template < class MATRIX >
|
||||
struct matrix_traits
|
||||
: matrix_view_traits <MATRIX>, mutable_matrix_traits <MATRIX> {
|
||||
};
|
||||
|
||||
/** \brief Traits class to extract type information from a VECTOR.
|
||||
*
|
||||
*/
|
||||
template < class VECTOR >
|
||||
struct vector_view_traits : container_view_traits <VECTOR> {
|
||||
|
||||
/// iterator for the VECTOR
|
||||
typedef typename VECTOR::const_iterator const_iterator;
|
||||
|
||||
/// iterator pointing to the first element
|
||||
static
|
||||
const_iterator begin(const VECTOR & v) {
|
||||
return v.begin();
|
||||
}
|
||||
/// iterator pointing behind the last element
|
||||
static
|
||||
const_iterator end(const VECTOR & v) {
|
||||
return v.end();
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
/** \brief Traits class to extract type information from a VECTOR.
|
||||
*
|
||||
*/
|
||||
template < class VECTOR >
|
||||
struct mutable_vector_traits : mutable_container_traits <VECTOR> {
|
||||
/// iterator for the VECTOR
|
||||
typedef typename VECTOR::iterator iterator;
|
||||
|
||||
/// iterator pointing to the first element
|
||||
static
|
||||
iterator begin(VECTOR & v) {
|
||||
return v.begin();
|
||||
}
|
||||
|
||||
/// iterator pointing behind the last element
|
||||
static
|
||||
iterator end(VECTOR & v) {
|
||||
return v.end();
|
||||
}
|
||||
};
|
||||
|
||||
/** \brief Traits class to extract type information from a VECTOR.
|
||||
*
|
||||
*/
|
||||
template < class VECTOR >
|
||||
struct vector_traits
|
||||
: vector_view_traits <VECTOR>, mutable_vector_traits <VECTOR> {
|
||||
};
|
||||
|
||||
|
||||
// Note: specializations for T[N] and T[M][N] have been moved to traits/c_array.hpp
|
||||
|
||||
}}}
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,26 @@
|
||||
/* Copyright 2003-2013 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_FWD_HPP
|
||||
#define BOOST_MULTI_INDEX_IDENTITY_FWD_HPP
|
||||
|
||||
#if defined(_MSC_VER)
|
||||
#pragma once
|
||||
#endif
|
||||
|
||||
namespace boost{
|
||||
|
||||
namespace multi_index{
|
||||
|
||||
template<class Type> struct identity;
|
||||
|
||||
} /* namespace multi_index */
|
||||
|
||||
} /* namespace boost */
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,163 @@
|
||||
// (C) Copyright John Maddock 2001 - 2003.
|
||||
// (C) Copyright Toon Knapen 2001 - 2003.
|
||||
// (C) Copyright Lie-Quan Lee 2001.
|
||||
// (C) Copyright Markus Schoepflin 2002 - 2003.
|
||||
// (C) Copyright Beman Dawes 2002 - 2003.
|
||||
// Use, modification and distribution are subject to the
|
||||
// Boost Software License, Version 1.0. (See accompanying file
|
||||
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
// See http://www.boost.org for most recent version.
|
||||
|
||||
// Visual Age (IBM) C++ compiler setup:
|
||||
|
||||
#if __IBMCPP__ <= 501
|
||||
# define BOOST_NO_MEMBER_TEMPLATE_FRIENDS
|
||||
# define BOOST_NO_MEMBER_FUNCTION_SPECIALIZATIONS
|
||||
#endif
|
||||
|
||||
#if (__IBMCPP__ <= 502)
|
||||
// Actually the compiler supports inclass member initialization but it
|
||||
// requires a definition for the class member and it doesn't recognize
|
||||
// it as an integral constant expression when used as a template argument.
|
||||
# define BOOST_NO_INCLASS_MEMBER_INITIALIZATION
|
||||
# define BOOST_NO_INTEGRAL_INT64_T
|
||||
# define BOOST_NO_MEMBER_TEMPLATE_KEYWORD
|
||||
#endif
|
||||
|
||||
#if (__IBMCPP__ <= 600) || !defined(BOOST_STRICT_CONFIG)
|
||||
# define BOOST_NO_POINTER_TO_MEMBER_TEMPLATE_PARAMETERS
|
||||
#endif
|
||||
|
||||
#if (__IBMCPP__ <= 1110)
|
||||
// XL C++ V11.1 and earlier versions may not always value-initialize
|
||||
// a temporary object T(), when T is a non-POD aggregate class type.
|
||||
// Michael Wong (IBM Canada Ltd) has confirmed this issue and gave it
|
||||
// high priority. -- Niels Dekker (LKEB), May 2010.
|
||||
# define BOOST_NO_COMPLETE_VALUE_INITIALIZATION
|
||||
#endif
|
||||
|
||||
//
|
||||
// On AIX thread support seems to be indicated by _THREAD_SAFE:
|
||||
//
|
||||
#ifdef _THREAD_SAFE
|
||||
# define BOOST_HAS_THREADS
|
||||
#endif
|
||||
|
||||
#define BOOST_COMPILER "IBM Visual Age version " BOOST_STRINGIZE(__IBMCPP__)
|
||||
|
||||
//
|
||||
// versions check:
|
||||
// we don't support Visual age prior to version 5:
|
||||
#if __IBMCPP__ < 500
|
||||
#error "Compiler not supported or configured - please reconfigure"
|
||||
#endif
|
||||
//
|
||||
// last known and checked version is 1210:
|
||||
#if (__IBMCPP__ > 1210)
|
||||
# if defined(BOOST_ASSERT_CONFIG)
|
||||
# error "Unknown compiler version - please run the configure tests and report the results"
|
||||
# endif
|
||||
#endif
|
||||
|
||||
// Some versions of the compiler have issues with default arguments on partial specializations
|
||||
#if __IBMCPP__ <= 1010
|
||||
#define BOOST_NO_PARTIAL_SPECIALIZATION_IMPLICIT_DEFAULT_ARGS
|
||||
#endif
|
||||
|
||||
//
|
||||
// C++0x features
|
||||
//
|
||||
// See boost\config\suffix.hpp for BOOST_NO_LONG_LONG
|
||||
//
|
||||
#if ! __IBMCPP_AUTO_TYPEDEDUCTION
|
||||
# define BOOST_NO_CXX11_AUTO_DECLARATIONS
|
||||
# define BOOST_NO_CXX11_AUTO_MULTIDECLARATIONS
|
||||
#endif
|
||||
#if ! __IBMCPP_UTF_LITERAL__
|
||||
# define BOOST_NO_CXX11_CHAR16_T
|
||||
# define BOOST_NO_CXX11_CHAR32_T
|
||||
#endif
|
||||
#if ! __IBMCPP_CONSTEXPR
|
||||
# define BOOST_NO_CXX11_CONSTEXPR
|
||||
#endif
|
||||
#if ! __IBMCPP_DECLTYPE
|
||||
# define BOOST_NO_CXX11_DECLTYPE
|
||||
#else
|
||||
# define BOOST_HAS_DECLTYPE
|
||||
#endif
|
||||
#define BOOST_NO_CXX11_DECLTYPE_N3276
|
||||
#define BOOST_NO_CXX11_DEFAULTED_FUNCTIONS
|
||||
#define BOOST_NO_CXX11_DELETED_FUNCTIONS
|
||||
#if ! __IBMCPP_EXPLICIT_CONVERSION_OPERATORS
|
||||
# define BOOST_NO_CXX11_EXPLICIT_CONVERSION_OPERATORS
|
||||
#endif
|
||||
#if ! __IBMCPP_EXTERN_TEMPLATE
|
||||
# define BOOST_NO_CXX11_EXTERN_TEMPLATE
|
||||
#endif
|
||||
#if ! __IBMCPP_VARIADIC_TEMPLATES
|
||||
// not enabled separately at this time
|
||||
# define BOOST_NO_CXX11_FUNCTION_TEMPLATE_DEFAULT_ARGS
|
||||
#endif
|
||||
#define BOOST_NO_CXX11_HDR_INITIALIZER_LIST
|
||||
#define BOOST_NO_CXX11_LAMBDAS
|
||||
#define BOOST_NO_CXX11_LOCAL_CLASS_TEMPLATE_PARAMETERS
|
||||
#define BOOST_NO_CXX11_NOEXCEPT
|
||||
#define BOOST_NO_CXX11_NULLPTR
|
||||
#define BOOST_NO_CXX11_RANGE_BASED_FOR
|
||||
#define BOOST_NO_CXX11_RAW_LITERALS
|
||||
#define BOOST_NO_CXX11_USER_DEFINED_LITERALS
|
||||
#if ! __IBMCPP_RVALUE_REFERENCES
|
||||
# define BOOST_NO_CXX11_RVALUE_REFERENCES
|
||||
#endif
|
||||
#if ! __IBMCPP_SCOPED_ENUM
|
||||
# define BOOST_NO_CXX11_SCOPED_ENUMS
|
||||
#endif
|
||||
#define BOOST_NO_SFINAE_EXPR
|
||||
#define BOOST_NO_CXX11_UNIFIED_INITIALIZATION_SYNTAX
|
||||
#if ! __IBMCPP_STATIC_ASSERT
|
||||
# define BOOST_NO_CXX11_STATIC_ASSERT
|
||||
#endif
|
||||
#define BOOST_NO_CXX11_TEMPLATE_ALIASES
|
||||
#define BOOST_NO_CXX11_UNICODE_LITERALS
|
||||
#if ! __IBMCPP_VARIADIC_TEMPLATES
|
||||
# define BOOST_NO_CXX11_VARIADIC_TEMPLATES
|
||||
#endif
|
||||
#if ! __C99_MACRO_WITH_VA_ARGS
|
||||
# define BOOST_NO_CXX11_VARIADIC_MACROS
|
||||
#endif
|
||||
#define BOOST_NO_CXX11_ALIGNAS
|
||||
#define BOOST_NO_CXX11_TRAILING_RESULT_TYPES
|
||||
#define BOOST_NO_CXX11_INLINE_NAMESPACES
|
||||
#define BOOST_NO_CXX11_REF_QUALIFIERS
|
||||
#define BOOST_NO_CXX11_FINAL
|
||||
#define BOOST_NO_CXX11_THREAD_LOCAL
|
||||
|
||||
// C++ 14:
|
||||
#if !defined(__cpp_aggregate_nsdmi) || (__cpp_aggregate_nsdmi < 201304)
|
||||
# define BOOST_NO_CXX14_AGGREGATE_NSDMI
|
||||
#endif
|
||||
#if !defined(__cpp_binary_literals) || (__cpp_binary_literals < 201304)
|
||||
# define BOOST_NO_CXX14_BINARY_LITERALS
|
||||
#endif
|
||||
#if !defined(__cpp_constexpr) || (__cpp_constexpr < 201304)
|
||||
# define BOOST_NO_CXX14_CONSTEXPR
|
||||
#endif
|
||||
#if !defined(__cpp_decltype_auto) || (__cpp_decltype_auto < 201304)
|
||||
# define BOOST_NO_CXX14_DECLTYPE_AUTO
|
||||
#endif
|
||||
#if (__cplusplus < 201304) // There's no SD6 check for this....
|
||||
# define BOOST_NO_CXX14_DIGIT_SEPARATORS
|
||||
#endif
|
||||
#if !defined(__cpp_generic_lambdas) || (__cpp_generic_lambdas < 201304)
|
||||
# define BOOST_NO_CXX14_GENERIC_LAMBDAS
|
||||
#endif
|
||||
#if !defined(__cpp_init_captures) || (__cpp_init_captures < 201304)
|
||||
# define BOOST_NO_CXX14_INITIALIZED_LAMBDA_CAPTURES
|
||||
#endif
|
||||
#if !defined(__cpp_return_type_deduction) || (__cpp_return_type_deduction < 201304)
|
||||
# define BOOST_NO_CXX14_RETURN_TYPE_DEDUCTION
|
||||
#endif
|
||||
#if !defined(__cpp_variable_templates) || (__cpp_variable_templates < 201304)
|
||||
# define BOOST_NO_CXX14_VARIABLE_TEMPLATES
|
||||
#endif
|
||||
@@ -0,0 +1,13 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2001-2007 Joel de Guzman
|
||||
|
||||
Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
==============================================================================*/
|
||||
#if !defined(FUSION_INCLUDE_TAG_OF_FWD)
|
||||
#define FUSION_INCLUDE_TAG_OF_FWD
|
||||
|
||||
#include <boost/fusion/support/config.hpp>
|
||||
#include <boost/fusion/support/tag_of_fwd.hpp>
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,59 @@
|
||||
#ifndef BOOST_PP_IS_ITERATING
|
||||
/*=============================================================================
|
||||
Copyright (c) 2011 Eric Niebler
|
||||
Copyright (c) 2001-2011 Joel de Guzman
|
||||
|
||||
Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
==============================================================================*/
|
||||
#if !defined(BOOST_FUSION_VECTOR40_FWD_HPP_INCLUDED)
|
||||
#define BOOST_FUSION_VECTOR40_FWD_HPP_INCLUDED
|
||||
|
||||
#include <boost/fusion/support/config.hpp>
|
||||
#include <boost/preprocessor/cat.hpp>
|
||||
#include <boost/preprocessor/iteration/iterate.hpp>
|
||||
#include <boost/preprocessor/repetition/enum_params.hpp>
|
||||
|
||||
#if !defined(BOOST_FUSION_DONT_USE_PREPROCESSED_FILES)
|
||||
#include <boost/fusion/container/vector/detail/cpp03/preprocessed/vector40_fwd.hpp>
|
||||
#else
|
||||
#if defined(__WAVE__) && defined(BOOST_FUSION_CREATE_PREPROCESSED_FILES)
|
||||
#pragma wave option(preserve: 2, line: 0, output: "preprocessed/vector40_fwd.hpp")
|
||||
#endif
|
||||
|
||||
/*=============================================================================
|
||||
Copyright (c) 2011 Eric Niebler
|
||||
Copyright (c) 2001-2011 Joel de Guzman
|
||||
|
||||
Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
This is an auto-generated file. Do not edit!
|
||||
==============================================================================*/
|
||||
|
||||
#if defined(__WAVE__) && defined(BOOST_FUSION_CREATE_PREPROCESSED_FILES)
|
||||
#pragma wave option(preserve: 1)
|
||||
#endif
|
||||
|
||||
namespace boost { namespace fusion
|
||||
{
|
||||
// expand vector31 to vector40
|
||||
#define BOOST_PP_FILENAME_1 <boost/fusion/container/vector/detail/cpp03/vector40_fwd.hpp>
|
||||
#define BOOST_PP_ITERATION_LIMITS (31, 40)
|
||||
#include BOOST_PP_ITERATE()
|
||||
}}
|
||||
|
||||
#if defined(__WAVE__) && defined(BOOST_FUSION_CREATE_PREPROCESSED_FILES)
|
||||
#pragma wave option(output: null)
|
||||
#endif
|
||||
|
||||
#endif // BOOST_FUSION_DONT_USE_PREPROCESSED_FILES
|
||||
|
||||
#endif
|
||||
|
||||
#else
|
||||
|
||||
template <BOOST_PP_ENUM_PARAMS(BOOST_PP_ITERATION(), typename T)>
|
||||
struct BOOST_PP_CAT(vector, BOOST_PP_ITERATION());
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,420 @@
|
||||
module jt4_decode
|
||||
type :: jt4_decoder
|
||||
procedure(jt4_decode_callback), pointer :: decode_callback => null ()
|
||||
procedure(jt4_average_callback), pointer :: average_callback => null ()
|
||||
contains
|
||||
procedure :: decode
|
||||
procedure, private :: wsjt4, avg4
|
||||
end type jt4_decoder
|
||||
|
||||
! Callback function to be called with each decode
|
||||
abstract interface
|
||||
subroutine jt4_decode_callback (this, snr, dt, freq, have_sync, &
|
||||
sync, is_deep, decoded, qual, ich, is_average, ave)
|
||||
import jt4_decoder
|
||||
implicit none
|
||||
class(jt4_decoder), intent(inout) :: this
|
||||
integer, intent(in) :: snr
|
||||
real, intent(in) :: dt
|
||||
integer, intent(in) :: freq
|
||||
logical, intent(in) :: have_sync
|
||||
logical, intent(in) :: is_deep
|
||||
character(len=1), intent(in) :: sync
|
||||
character(len=22), intent(in) :: decoded
|
||||
real, intent(in) :: qual
|
||||
integer, intent(in) :: ich
|
||||
logical, intent(in) :: is_average
|
||||
integer, intent(in) :: ave
|
||||
end subroutine jt4_decode_callback
|
||||
end interface
|
||||
|
||||
! Callback function to be called with each average result
|
||||
abstract interface
|
||||
subroutine jt4_average_callback (this, used, utc, sync, dt, freq, flip)
|
||||
import jt4_decoder
|
||||
implicit none
|
||||
class(jt4_decoder), intent(inout) :: this
|
||||
logical, intent(in) :: used
|
||||
integer, intent(in) :: utc
|
||||
real, intent(in) :: sync
|
||||
real, intent(in) :: dt
|
||||
integer, intent(in) :: freq
|
||||
logical, intent(in) :: flip
|
||||
end subroutine jt4_average_callback
|
||||
end interface
|
||||
|
||||
contains
|
||||
|
||||
subroutine decode(this,decode_callback,dd,jz,nutc,nfqso,ntol0,emedelay, &
|
||||
dttol,nagain,ndepth,nclearave,minsync,minw,nsubmode,mycall,hiscall, &
|
||||
hisgrid,nlist0,listutc0,average_callback)
|
||||
|
||||
use jt4
|
||||
use timer_module, only: timer
|
||||
|
||||
class(jt4_decoder), intent(inout) :: this
|
||||
procedure(jt4_decode_callback) :: decode_callback
|
||||
integer, intent(in) :: jz,nutc,nfqso,ntol0,ndepth,minsync,minw,nsubmode, &
|
||||
nlist0,listutc0(10)
|
||||
real, intent(in) :: dd(jz),emedelay,dttol
|
||||
logical, intent(in) :: nagain, nclearave
|
||||
character(len=12), intent(in) :: mycall,hiscall
|
||||
character(len=6), intent(in) :: hisgrid
|
||||
procedure(jt4_average_callback), optional :: average_callback
|
||||
|
||||
real*4 dat(30*11025)
|
||||
character*6 cfile6
|
||||
|
||||
this%decode_callback => decode_callback
|
||||
if (present (average_callback)) then
|
||||
this%average_callback => average_callback
|
||||
end if
|
||||
mode4=nch(nsubmode+1)
|
||||
ntol=ntol0
|
||||
neme=0
|
||||
lumsg=6 !### temp ? ###
|
||||
ndiag=1
|
||||
nlist=nlist0
|
||||
listutc=listutc0
|
||||
|
||||
! Lowpass filter and decimate by 2
|
||||
call timer('lpf1 ',0)
|
||||
call lpf1(dd,jz,dat,jz2)
|
||||
call timer('lpf1 ',1)
|
||||
|
||||
write(cfile6(1:4),1000) nutc
|
||||
1000 format(i4.4)
|
||||
cfile6(5:6)=' '
|
||||
|
||||
call timer('wsjt4 ',0)
|
||||
call this%wsjt4(dat,jz2,nutc,NClearAve,minsync,ntol,emedelay,dttol,mode4, &
|
||||
minw,mycall,hiscall,hisgrid,nfqso,NAgain,ndepth,neme)
|
||||
call timer('wsjt4 ',1)
|
||||
|
||||
return
|
||||
end subroutine decode
|
||||
|
||||
subroutine wsjt4(this,dat,npts,nutc,NClearAve,minsync,ntol,emedelay,dttol, &
|
||||
mode4,minw,mycall,hiscall,hisgrid,nfqso,NAgain,ndepth,neme)
|
||||
|
||||
! Orchestrates the process of decoding JT4 messages. Note that JT4
|
||||
! always operates as if in "Single Decode" mode; it looks for only one
|
||||
! decodable signal in the FTol range.
|
||||
|
||||
use jt4
|
||||
use timer_module, only: timer
|
||||
|
||||
class(jt4_decoder), intent(inout) :: this
|
||||
integer, intent(in) :: npts,nutc,minsync,ntol,mode4,minw, &
|
||||
nfqso,ndepth,neme
|
||||
logical, intent(in) :: NAgain,NClearAve
|
||||
character(len=12), intent(in) :: mycall,hiscall
|
||||
character(len=6), intent(in) :: hisgrid
|
||||
real, intent(in) :: dat(npts) !Raw data
|
||||
|
||||
real ccfblue(-5:540) !CCF in time
|
||||
real ccfred(-224:224) !CCF in frequency
|
||||
real ps0(450)
|
||||
|
||||
! real z(458,65)
|
||||
logical first,prtavg
|
||||
character decoded*22,special*5
|
||||
character*22 avemsg,deepmsg,deepave,blank,deepmsg0,deepave1
|
||||
character csync*1
|
||||
data first/.true./,nutc0/-999/,nfreq0/-999999/
|
||||
save
|
||||
|
||||
if(first) then
|
||||
nsave=0
|
||||
first=.false.
|
||||
blank=' '
|
||||
ccfblue=0.
|
||||
ccfred=0.
|
||||
! Silence compiler warnings
|
||||
if(dttol.eq.-99.0 .and. emedelay.eq.-99.0 .and. nagain) stop
|
||||
endif
|
||||
|
||||
zz=0.
|
||||
! syncmin=3.0 + minsync
|
||||
syncmin=1.0+minsync
|
||||
naggressive=0
|
||||
if(ndepth.ge.2) naggressive=1
|
||||
nq1=3
|
||||
nq2=6
|
||||
if(naggressive.eq.1) nq1=1
|
||||
if(NClearAve) then
|
||||
nsave=0
|
||||
iutc=-1
|
||||
nfsave=0.
|
||||
listutc=0
|
||||
ppsave=0.
|
||||
rsymbol=0.
|
||||
dtsave=0.
|
||||
syncsave=0.
|
||||
nfanoave=0
|
||||
ndeepave=0
|
||||
endif
|
||||
|
||||
! Attempt to synchronize: look for sync pattern, get DF and DT.
|
||||
call timer('sync4 ',0)
|
||||
mousedf=nint(nfqso + 1.5*4.375*mode4 - 1270.46)
|
||||
call sync4(dat,npts,ntol,1,MouseDF,4,mode4,minw+1,dtx,dfx, &
|
||||
snrx,snrsync,ccfblue,ccfred,flip,width,ps0)
|
||||
sync=snrsync
|
||||
dtxz=dtx-0.8
|
||||
nfreqz=dfx + 1270.46 - 1.5*4.375*mode4
|
||||
call timer('sync4 ',1)
|
||||
|
||||
snrx=db(sync) - 26.
|
||||
nsnr=nint(snrx)
|
||||
if(sync.lt.syncmin) then
|
||||
if (associated (this%decode_callback)) then
|
||||
call this%decode_callback(nsnr,dtxz,nfreqz,.false.,csync, &
|
||||
.false.,decoded,0.,ich,.false.,0)
|
||||
end if
|
||||
go to 990
|
||||
endif
|
||||
|
||||
! We have achieved sync
|
||||
decoded=blank
|
||||
deepmsg=blank
|
||||
special=' '
|
||||
nsync=sync
|
||||
nsnrlim=-33
|
||||
csync='*'
|
||||
if(flip.lt.0.0) csync='#'
|
||||
qbest=0.
|
||||
qabest=0.
|
||||
prtavg=.false.
|
||||
|
||||
do idt=-2,2
|
||||
dtx=dtxz + 0.03*idt
|
||||
nfreq=nfreqz + 2*idf
|
||||
|
||||
! Attempt a single-sequence decode, including deep4 if Fano fails.
|
||||
call timer('decode4 ',0)
|
||||
call decode4(dat,npts,dtx,nfreq,flip,mode4,ndepth,neme,minw, &
|
||||
mycall,hiscall,hisgrid,decoded,nfano,deepmsg,qual,ich)
|
||||
call timer('decode4 ',1)
|
||||
|
||||
if(nfano.gt.0) then
|
||||
! Fano succeeded: report the message and return !Fano OK
|
||||
if (associated (this%decode_callback)) then
|
||||
call this%decode_callback(nsnr,dtx,nfreq,.true.,csync, &
|
||||
.false.,decoded,99.,ich,.false.,0)
|
||||
end if
|
||||
nsave=0
|
||||
go to 990
|
||||
|
||||
else !Fano failed
|
||||
if(qual.gt.qbest) then
|
||||
dtx0=dtx
|
||||
nfreq0=nfreq
|
||||
deepmsg0=deepmsg
|
||||
ich0=ich
|
||||
qbest=qual
|
||||
endif
|
||||
endif
|
||||
|
||||
if(idt.ne.0) cycle
|
||||
! Single-sequence Fano decode failed, so try for an average Fano decode:
|
||||
qave=0.
|
||||
! If we're doing averaging, call avg4
|
||||
if(iand(ndepth,16).eq.16 .and. (.not.prtavg)) then
|
||||
if(nutc.ne.nutc0 .or. abs(nfreq-nfreq0).gt.ntol) then
|
||||
! This is a new minute or a new frequency, so call avg4.
|
||||
nutc0=nutc !Try decoding average
|
||||
nfreq0=nfreq
|
||||
nsave=nsave+1
|
||||
nsave=mod(nsave-1,64)+1
|
||||
call timer('avg4 ',0)
|
||||
call this%avg4(nutc,sync,dtx,flip,nfreq,mode4,ntol,ndepth,neme, &
|
||||
mycall,hiscall,hisgrid,nfanoave,avemsg,qave,deepave,ich, &
|
||||
ndeepave)
|
||||
call timer('avg4 ',1)
|
||||
endif
|
||||
|
||||
if(nfanoave.gt.0) then
|
||||
! Fano succeeded: report the message AVG FANO OK
|
||||
if (associated (this%decode_callback)) then
|
||||
call this%decode_callback(nsnr,dtx,nfreq,.true.,csync, &
|
||||
.false.,avemsg,99.,ich,.true.,nfanoave)
|
||||
end if
|
||||
prtavg=.true.
|
||||
cycle
|
||||
else
|
||||
if(qave.gt.qabest) then
|
||||
dtx1=dtx
|
||||
nfreq1=nfreq
|
||||
deepave1=deepave
|
||||
ich1=ich
|
||||
qabest=qave
|
||||
endif
|
||||
endif
|
||||
endif
|
||||
enddo
|
||||
|
||||
dtx=dtx0
|
||||
nfreq=nfreq0
|
||||
deepmsg=deepmsg0
|
||||
ich=ich0
|
||||
qual=qbest
|
||||
|
||||
if (associated (this%decode_callback)) then
|
||||
if(int(qual).ge.nq1) then
|
||||
call this%decode_callback(nsnr,dtx,nfreqz,.true.,csync,.true., &
|
||||
deepmsg,qual,ich,.false.,0)
|
||||
else
|
||||
call this%decode_callback(nsnr,dtxz,nfreqz,.true.,csync, &
|
||||
.false.,blank,0.,ich,.false.,0)
|
||||
endif
|
||||
end if
|
||||
|
||||
dtx=dtx1
|
||||
nfreq=nfreq1
|
||||
deepave=deepave1
|
||||
ich=ich1
|
||||
qave=qabest
|
||||
|
||||
if (associated (this%decode_callback) .and. ndeepave.ge.2) then
|
||||
if(int(qave).ge.nq1) then
|
||||
call this%decode_callback(nsnr,dtx,nfreq,.true.,csync,.true., &
|
||||
deepave,qave,ich,.true.,ndeepave)
|
||||
endif
|
||||
end if
|
||||
|
||||
990 return
|
||||
end subroutine wsjt4
|
||||
|
||||
subroutine avg4(this,nutc,snrsync,dtxx,flip,nfreq,mode4,ntol,ndepth,neme, &
|
||||
mycall,hiscall,hisgrid,nfanoave,avemsg,qave,deepave,ichbest,ndeepave)
|
||||
|
||||
! Decodes averaged JT4 data
|
||||
|
||||
use jt4
|
||||
class(jt4_decoder), intent(inout) :: this
|
||||
|
||||
character*22 avemsg,deepave,deepbest
|
||||
character mycall*12,hiscall*12,hisgrid*6
|
||||
character*1 csync,cused(64)
|
||||
real sym(207,7)
|
||||
integer iused(64)
|
||||
logical first
|
||||
data first/.true./
|
||||
save
|
||||
|
||||
if(first) then
|
||||
iutc=-1
|
||||
nfsave=0
|
||||
dtdiff=0.2
|
||||
first=.false.
|
||||
endif
|
||||
|
||||
do i=1,64
|
||||
if(nutc.eq.iutc(i) .and. abs(nfreq-nfsave(i)).le.ntol) go to 10
|
||||
enddo
|
||||
|
||||
! Save data for message averaging
|
||||
iutc(nsave)=nutc
|
||||
syncsave(nsave)=snrsync
|
||||
dtsave(nsave)=dtxx
|
||||
nfsave(nsave)=nfreq
|
||||
flipsave(nsave)=flip
|
||||
ppsave(1:207,1:7,nsave)=rsymbol(1:207,1:7)
|
||||
|
||||
10 sym=0.
|
||||
syncsum=0.
|
||||
dtsum=0.
|
||||
nfsum=0
|
||||
nsum=0
|
||||
|
||||
do i=1,64
|
||||
cused(i)='.'
|
||||
if(iutc(i).lt.0) cycle
|
||||
if(mod(iutc(i),2).ne.mod(nutc,2)) cycle !Use only same sequence
|
||||
if(abs(dtxx-dtsave(i)).gt.dtdiff) cycle !DT must match
|
||||
if(abs(nfreq-nfsave(i)).gt.ntol) cycle !Freq must match
|
||||
if(flip.ne.flipsave(i)) cycle !Sync (*/#) must match
|
||||
sym(1:207,1:7)=sym(1:207,1:7) + ppsave(1:207,1:7,i)
|
||||
syncsum=syncsum + syncsave(i)
|
||||
dtsum=dtsum + dtsave(i)
|
||||
nfsum=nfsum + nfsave(i)
|
||||
cused(i)='$'
|
||||
nsum=nsum+1
|
||||
iused(nsum)=i
|
||||
enddo
|
||||
if(nsum.lt.64) iused(nsum+1)=0
|
||||
|
||||
syncave=0.
|
||||
dtave=0.
|
||||
fave=0.
|
||||
if(nsum.gt.0) then
|
||||
sym=sym/nsum
|
||||
syncave=syncsum/nsum
|
||||
dtave=dtsum/nsum
|
||||
fave=float(nfsum)/nsum
|
||||
endif
|
||||
|
||||
do i=1,nsave
|
||||
csync='*'
|
||||
if(flipsave(i).lt.0.0) csync='#'
|
||||
if (associated (this%average_callback)) then
|
||||
call this%average_callback(cused(i) .eq. '$',iutc(i), &
|
||||
syncsave(i),dtsave(i),nfsave(i),flipsave(i).lt.0.)
|
||||
end if
|
||||
enddo
|
||||
|
||||
sqt=0.
|
||||
sqf=0.
|
||||
do j=1,64
|
||||
i=iused(j)
|
||||
if(i.eq.0) exit
|
||||
csync='*'
|
||||
if(flipsave(i).lt.0.0) csync='#'
|
||||
sqt=sqt + (dtsave(i)-dtave)**2
|
||||
sqf=sqf + (nfsave(i)-fave)**2
|
||||
enddo
|
||||
rmst=0.
|
||||
rmsf=0.
|
||||
if(nsum.ge.2) then
|
||||
rmst=sqrt(sqt/(nsum-1))
|
||||
rmsf=sqrt(sqf/(nsum-1))
|
||||
endif
|
||||
kbest=ich1
|
||||
do k=ich1,ich2
|
||||
call extract4(sym(1,k),ncount,avemsg) !Do the Fano decode
|
||||
nfanoave=0
|
||||
if(ncount.ge.0) then
|
||||
ichbest=k
|
||||
nfanoave=nsum
|
||||
go to 900
|
||||
endif
|
||||
if(nch(k).ge.mode4) exit
|
||||
enddo
|
||||
|
||||
deepave=' '
|
||||
qave=0.
|
||||
|
||||
! Possibly should pass nadd=nused, also ?
|
||||
if(iand(ndepth,32).eq.32) then
|
||||
flipx=1.0 !Normal flip not relevant for ave msg
|
||||
qbest=0.
|
||||
do k=ich1,ich2
|
||||
call deep4(sym(2,k),neme,flipx,mycall,hiscall,hisgrid,deepave,qave)
|
||||
if(qave.gt.qbest) then
|
||||
qbest=qave
|
||||
deepbest=deepave
|
||||
kbest=k
|
||||
ndeepave=nsum
|
||||
endif
|
||||
if(nch(k).ge.mode4) exit
|
||||
enddo
|
||||
|
||||
deepave=deepbest
|
||||
qave=qbest
|
||||
ichbest=kbest
|
||||
endif
|
||||
|
||||
900 return
|
||||
end subroutine avg4
|
||||
end module jt4_decode
|
||||
@@ -0,0 +1,52 @@
|
||||
|
||||
// Copyright Aleksey Gurtovoy 2000-2004
|
||||
//
|
||||
// Distributed under the Boost Software License, Version 1.0.
|
||||
// (See accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
//
|
||||
|
||||
// Preprocessed version of "boost/mpl/apply_fwd.hpp" header
|
||||
// -- DO NOT modify by hand!
|
||||
|
||||
namespace boost { namespace mpl {
|
||||
|
||||
template<
|
||||
typename F, typename T1 = na, typename T2 = na, typename T3 = na
|
||||
, typename T4 = na, typename T5 = na
|
||||
>
|
||||
struct apply;
|
||||
|
||||
template<
|
||||
typename F
|
||||
>
|
||||
struct apply0;
|
||||
|
||||
template<
|
||||
typename F, typename T1
|
||||
>
|
||||
struct apply1;
|
||||
|
||||
template<
|
||||
typename F, typename T1, typename T2
|
||||
>
|
||||
struct apply2;
|
||||
|
||||
template<
|
||||
typename F, typename T1, typename T2, typename T3
|
||||
>
|
||||
struct apply3;
|
||||
|
||||
template<
|
||||
typename F, typename T1, typename T2, typename T3, typename T4
|
||||
>
|
||||
struct apply4;
|
||||
|
||||
template<
|
||||
typename F, typename T1, typename T2, typename T3, typename T4
|
||||
, typename T5
|
||||
>
|
||||
struct apply5;
|
||||
|
||||
}}
|
||||
|
||||
@@ -0,0 +1,34 @@
|
||||
# /* **************************************************************************
|
||||
# * *
|
||||
# * (C) Copyright Paul Mensonides 2002.
|
||||
# * Distributed under the Boost Software License, Version 1.0. (See
|
||||
# * accompanying file LICENSE_1_0.txt or copy at
|
||||
# * http://www.boost.org/LICENSE_1_0.txt)
|
||||
# * *
|
||||
# ************************************************************************** */
|
||||
#
|
||||
# /* See http://www.boost.org for most recent version. */
|
||||
#
|
||||
# ifndef BOOST_PREPROCESSOR_CONTROL_IIF_HPP
|
||||
# define BOOST_PREPROCESSOR_CONTROL_IIF_HPP
|
||||
#
|
||||
# include <boost/preprocessor/config/config.hpp>
|
||||
#
|
||||
# if ~BOOST_PP_CONFIG_FLAGS() & BOOST_PP_CONFIG_MWCC()
|
||||
# define BOOST_PP_IIF(bit, t, f) BOOST_PP_IIF_I(bit, t, f)
|
||||
# else
|
||||
# define BOOST_PP_IIF(bit, t, f) BOOST_PP_IIF_OO((bit, t, f))
|
||||
# define BOOST_PP_IIF_OO(par) BOOST_PP_IIF_I ## par
|
||||
# endif
|
||||
#
|
||||
# if ~BOOST_PP_CONFIG_FLAGS() & BOOST_PP_CONFIG_MSVC()
|
||||
# define BOOST_PP_IIF_I(bit, t, f) BOOST_PP_IIF_ ## bit(t, f)
|
||||
# else
|
||||
# define BOOST_PP_IIF_I(bit, t, f) BOOST_PP_IIF_II(BOOST_PP_IIF_ ## bit(t, f))
|
||||
# define BOOST_PP_IIF_II(id) id
|
||||
# endif
|
||||
#
|
||||
# define BOOST_PP_IIF_0(t, f) f
|
||||
# define BOOST_PP_IIF_1(t, f) t
|
||||
#
|
||||
# endif
|
||||
@@ -0,0 +1,104 @@
|
||||
program ft8sim
|
||||
|
||||
! Generate simulated data for a 15-second HF/6m mode using 8-FSK.
|
||||
! Output is saved to a *.wav file.
|
||||
|
||||
use wavhdr
|
||||
include 'ft8_params.f90' !Set various constants
|
||||
type(hdr) h !Header for .wav file
|
||||
character arg*12,fname*17
|
||||
character msg*22,msgsent*22
|
||||
complex c0(0:NMAX-1)
|
||||
complex c(0:NMAX-1)
|
||||
integer itone(NN)
|
||||
integer*2 iwave(NMAX) !Generated full-length waveform
|
||||
|
||||
! Get command-line argument(s)
|
||||
nargs=iargc()
|
||||
if(nargs.ne.7) then
|
||||
print*,'Usage: ft8sim "message" f0 DT fdop del nfiles snr'
|
||||
print*,'Example: ft8sim "K1ABC W9XYZ EN37" 1500 0.0 0.1 1.0 10 -18'
|
||||
go to 999
|
||||
endif
|
||||
call getarg(1,msg) !Message to be transmitted
|
||||
call getarg(2,arg)
|
||||
read(arg,*) f0 !Freq of tone 0 (Hz)
|
||||
call getarg(3,arg)
|
||||
read(arg,*) xdt !Time offset from nominal (s)
|
||||
call getarg(4,arg)
|
||||
read(arg,*) fspread !Watterson frequency spread (Hz)
|
||||
call getarg(5,arg)
|
||||
read(arg,*) delay !Watterson delay (ms)
|
||||
call getarg(6,arg)
|
||||
read(arg,*) nfiles !Number of files
|
||||
call getarg(7,arg)
|
||||
read(arg,*) snrdb !SNR_2500
|
||||
|
||||
twopi=8.0*atan(1.0)
|
||||
fs=12000.0 !Sample rate (Hz)
|
||||
dt=1.0/fs !Sample interval (s)
|
||||
tt=NSPS*dt !Duration of symbols (s)
|
||||
baud=1.0/tt !Keying rate (baud)
|
||||
bw=8*baud !Occupied bandwidth (Hz)
|
||||
txt=NZ*dt !Transmission length (s)
|
||||
bandwidth_ratio=2500.0/(fs/2.0)
|
||||
sig=sqrt(2*bandwidth_ratio) * 10.0**(0.05*snrdb)
|
||||
if(snrdb.gt.90.0) sig=1.0
|
||||
txt=NN*NSPS/12000.0
|
||||
|
||||
call genft8(msg,msgsent,itone) !Source-encode, then get itone()
|
||||
write(*,1000) f0,xdt,txt,snrdb,bw,msgsent
|
||||
1000 format('f0:',f9.3,' DT:',f6.2,' TxT:',f6.1,' SNR:',f6.1, &
|
||||
' BW:',f4.1,2x,a22)
|
||||
|
||||
phi=0.0
|
||||
c0=0.
|
||||
k=-1 + nint(xdt/dt)
|
||||
do j=1,NN !Generate 8-FSK waveform from itone
|
||||
dphi=twopi*(f0+itone(j)*baud)*dt
|
||||
if(k.eq.0) phi=-dphi
|
||||
do i=1,NSPS
|
||||
k=k+1
|
||||
phi=phi+dphi
|
||||
if(phi.gt.twopi) phi=phi-twopi
|
||||
xphi=phi
|
||||
if(k.ge.0 .and. k.lt.NMAX) c0(k)=cmplx(cos(xphi),sin(xphi))
|
||||
enddo
|
||||
enddo
|
||||
|
||||
! call sgran()
|
||||
do ifile=1,nfiles
|
||||
c=c0
|
||||
if( fspread .ne. 0.0 .or. delay .ne. 0.0 ) then
|
||||
call watterson(c,NZ,fs,delay,fspread)
|
||||
endif
|
||||
c=c*sig
|
||||
if(snrdb.lt.90) then
|
||||
do i=0,NZ-1 !Add gaussian noise at specified SNR
|
||||
xnoise=gran()
|
||||
ynoise=gran()
|
||||
c(i)=c(i) + cmplx(xnoise,ynoise)
|
||||
enddo
|
||||
endif
|
||||
|
||||
fac=32767.0
|
||||
rms=100.0
|
||||
if(snrdb.ge.90.0) iwave(1:NMAX)=nint(fac*real(c))
|
||||
if(snrdb.lt.90.0) iwave(1:NMAX)=nint(rms*real(c))
|
||||
iwave(NZ+1:)=0
|
||||
|
||||
h=default_header(12000,NMAX)
|
||||
write(fname,1102) ifile
|
||||
1102 format('000000_',i6.6,'.wav')
|
||||
open(10,file=fname,status='unknown',access='stream')
|
||||
write(10) h,iwave !Save to *.wav file
|
||||
close(10)
|
||||
write(*,1110) ifile,xdt,f0,snrdb,fname
|
||||
1110 format(i4,f7.2,f8.2,f7.1,2x,a17)
|
||||
! do i=0,NZ-1
|
||||
! write(13,3001) i,i/12000.0,c(i),iwave(i+1)
|
||||
!3001 format(i8,f12.6,2f12.3,i8)
|
||||
! enddo
|
||||
enddo
|
||||
|
||||
999 end program ft8sim
|
||||
@@ -0,0 +1,78 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2003 Jonathan de Halleux (dehalleux@pelikhan.com)
|
||||
http://spirit.sourceforge.net/
|
||||
|
||||
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_SPIRIT_ACTOR_REF_CONST_REF_ACTOR_HPP
|
||||
#define BOOST_SPIRIT_ACTOR_REF_CONST_REF_ACTOR_HPP
|
||||
|
||||
#include <boost/spirit/home/classic/namespace.hpp>
|
||||
|
||||
namespace boost { namespace spirit {
|
||||
|
||||
BOOST_SPIRIT_CLASSIC_NAMESPACE_BEGIN
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
// Summary:
|
||||
// A semantic action policy holder. This holder stores a reference to ref
|
||||
// and a const reference to value_ref.
|
||||
// act methods are feed with ref and value_ref. The parse result is
|
||||
// not used by this holder.
|
||||
//
|
||||
// (This doc uses convention available in actors.hpp)
|
||||
//
|
||||
// Constructor:
|
||||
// ...(T& ref_, ValueT const& value_ref_);
|
||||
// where ref_ and value_ref_ are stored in the holder.
|
||||
//
|
||||
// Action calls:
|
||||
// act(ref, value_ref);
|
||||
//
|
||||
// () operators: both
|
||||
//
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
template<
|
||||
typename T,
|
||||
typename ValueT,
|
||||
typename ActionT
|
||||
>
|
||||
class ref_const_ref_actor : public ActionT
|
||||
{
|
||||
private:
|
||||
T& ref;
|
||||
ValueT const& value_ref;
|
||||
public:
|
||||
ref_const_ref_actor(
|
||||
T& ref_,
|
||||
ValueT const& value_ref_
|
||||
)
|
||||
:
|
||||
ref(ref_),
|
||||
value_ref(value_ref_)
|
||||
{}
|
||||
|
||||
|
||||
template<typename T2>
|
||||
void operator()(T2 const& /*val*/) const
|
||||
{
|
||||
this->act(ref,value_ref); // defined in ActionT
|
||||
}
|
||||
|
||||
|
||||
template<typename IteratorT>
|
||||
void operator()(
|
||||
IteratorT const& /*first*/,
|
||||
IteratorT const& /*last*/
|
||||
) const
|
||||
{
|
||||
this->act(ref,value_ref); // defined in ActionT
|
||||
}
|
||||
};
|
||||
|
||||
BOOST_SPIRIT_CLASSIC_NAMESPACE_END
|
||||
|
||||
}}
|
||||
|
||||
#endif
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,22 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2001-2011 Joel de Guzman
|
||||
|
||||
Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
This is an auto-generated file. Do not edit!
|
||||
==============================================================================*/
|
||||
|
||||
#if FUSION_MAX_MAP_SIZE <= 10
|
||||
#include <boost/fusion/container/generation/detail/preprocessed/make_map10.hpp>
|
||||
#elif FUSION_MAX_MAP_SIZE <= 20
|
||||
#include <boost/fusion/container/generation/detail/preprocessed/make_map20.hpp>
|
||||
#elif FUSION_MAX_MAP_SIZE <= 30
|
||||
#include <boost/fusion/container/generation/detail/preprocessed/make_map30.hpp>
|
||||
#elif FUSION_MAX_MAP_SIZE <= 40
|
||||
#include <boost/fusion/container/generation/detail/preprocessed/make_map40.hpp>
|
||||
#elif FUSION_MAX_MAP_SIZE <= 50
|
||||
#include <boost/fusion/container/generation/detail/preprocessed/make_map50.hpp>
|
||||
#else
|
||||
#error "FUSION_MAX_MAP_SIZE out of bounds for preprocessed headers"
|
||||
#endif
|
||||
@@ -0,0 +1,176 @@
|
||||
// Copyright (c) 2006 Xiaogang Zhang
|
||||
// Copyright (c) 2006 John Maddock
|
||||
// Use, modification and distribution are subject to the
|
||||
// Boost Software License, Version 1.0. (See accompanying file
|
||||
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
//
|
||||
// History:
|
||||
// XZ wrote the original of this file as part of the Google
|
||||
// Summer of Code 2006. JM modified it to fit into the
|
||||
// Boost.Math conceptual framework better, and to ensure
|
||||
// that the code continues to work no matter how many digits
|
||||
// type T has.
|
||||
|
||||
#ifndef BOOST_MATH_ELLINT_D_HPP
|
||||
#define BOOST_MATH_ELLINT_D_HPP
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#pragma once
|
||||
#endif
|
||||
|
||||
#include <boost/math/special_functions/math_fwd.hpp>
|
||||
#include <boost/math/special_functions/ellint_rf.hpp>
|
||||
#include <boost/math/special_functions/ellint_rd.hpp>
|
||||
#include <boost/math/special_functions/ellint_rg.hpp>
|
||||
#include <boost/math/constants/constants.hpp>
|
||||
#include <boost/math/policies/error_handling.hpp>
|
||||
#include <boost/math/tools/workaround.hpp>
|
||||
#include <boost/math/special_functions/round.hpp>
|
||||
|
||||
// Elliptic integrals (complete and incomplete) of the second kind
|
||||
// Carlson, Numerische Mathematik, vol 33, 1 (1979)
|
||||
|
||||
namespace boost { namespace math {
|
||||
|
||||
template <class T1, class T2, class Policy>
|
||||
typename tools::promote_args<T1, T2>::type ellint_d(T1 k, T2 phi, const Policy& pol);
|
||||
|
||||
namespace detail{
|
||||
|
||||
template <typename T, typename Policy>
|
||||
T ellint_d_imp(T k, const Policy& pol);
|
||||
|
||||
// Elliptic integral (Legendre form) of the second kind
|
||||
template <typename T, typename Policy>
|
||||
T ellint_d_imp(T phi, T k, const Policy& pol)
|
||||
{
|
||||
BOOST_MATH_STD_USING
|
||||
using namespace boost::math::tools;
|
||||
using namespace boost::math::constants;
|
||||
|
||||
bool invert = false;
|
||||
if(phi < 0)
|
||||
{
|
||||
phi = fabs(phi);
|
||||
invert = true;
|
||||
}
|
||||
|
||||
T result;
|
||||
|
||||
if(phi >= tools::max_value<T>())
|
||||
{
|
||||
// Need to handle infinity as a special case:
|
||||
result = policies::raise_overflow_error<T>("boost::math::ellint_d<%1%>(%1%,%1%)", 0, pol);
|
||||
}
|
||||
else if(phi > 1 / tools::epsilon<T>())
|
||||
{
|
||||
// Phi is so large that phi%pi is necessarily zero (or garbage),
|
||||
// just return the second part of the duplication formula:
|
||||
result = 2 * phi * ellint_d_imp(k, pol) / constants::pi<T>();
|
||||
}
|
||||
else
|
||||
{
|
||||
// Carlson's algorithm works only for |phi| <= pi/2,
|
||||
// use the integrand's periodicity to normalize phi
|
||||
//
|
||||
T rphi = boost::math::tools::fmod_workaround(phi, T(constants::half_pi<T>()));
|
||||
T m = boost::math::round((phi - rphi) / constants::half_pi<T>());
|
||||
int s = 1;
|
||||
if(boost::math::tools::fmod_workaround(m, T(2)) > 0.5)
|
||||
{
|
||||
m += 1;
|
||||
s = -1;
|
||||
rphi = constants::half_pi<T>() - rphi;
|
||||
}
|
||||
T sinp = sin(rphi);
|
||||
T cosp = cos(rphi);
|
||||
T c = 1 / (sinp * sinp);
|
||||
T cm1 = cosp * cosp / (sinp * sinp); // c - 1
|
||||
T k2 = k * k;
|
||||
if(k2 > 1)
|
||||
{
|
||||
return policies::raise_domain_error<T>("boost::math::ellint_d<%1%>(%1%, %1%)", "The parameter k is out of range, got k = %1%", k, pol);
|
||||
}
|
||||
else if(rphi == 0)
|
||||
{
|
||||
result = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
// http://dlmf.nist.gov/19.25#E10
|
||||
result = s * ellint_rd_imp(cm1, T(c - k2), c, pol) / 3;
|
||||
}
|
||||
if(m != 0)
|
||||
result += m * ellint_d_imp(k, pol);
|
||||
}
|
||||
return invert ? T(-result) : result;
|
||||
}
|
||||
|
||||
// Complete elliptic integral (Legendre form) of the second kind
|
||||
template <typename T, typename Policy>
|
||||
T ellint_d_imp(T k, const Policy& pol)
|
||||
{
|
||||
BOOST_MATH_STD_USING
|
||||
using namespace boost::math::tools;
|
||||
|
||||
if (abs(k) >= 1)
|
||||
{
|
||||
return policies::raise_domain_error<T>("boost::math::ellint_d<%1%>(%1%)",
|
||||
"Got k = %1%, function requires |k| <= 1", k, pol);
|
||||
}
|
||||
if(fabs(k) <= tools::root_epsilon<T>())
|
||||
return constants::pi<T>() / 4;
|
||||
|
||||
T x = 0;
|
||||
T t = k * k;
|
||||
T y = 1 - t;
|
||||
T z = 1;
|
||||
T value = ellint_rd_imp(x, y, z, pol) / 3;
|
||||
|
||||
return value;
|
||||
}
|
||||
|
||||
template <typename T, typename Policy>
|
||||
inline typename tools::promote_args<T>::type ellint_d(T k, const Policy& pol, const mpl::true_&)
|
||||
{
|
||||
typedef typename tools::promote_args<T>::type result_type;
|
||||
typedef typename policies::evaluation<result_type, Policy>::type value_type;
|
||||
return policies::checked_narrowing_cast<result_type, Policy>(detail::ellint_d_imp(static_cast<value_type>(k), pol), "boost::math::ellint_d<%1%>(%1%)");
|
||||
}
|
||||
|
||||
// Elliptic integral (Legendre form) of the second kind
|
||||
template <class T1, class T2>
|
||||
inline typename tools::promote_args<T1, T2>::type ellint_d(T1 k, T2 phi, const mpl::false_&)
|
||||
{
|
||||
return boost::math::ellint_d(k, phi, policies::policy<>());
|
||||
}
|
||||
|
||||
} // detail
|
||||
|
||||
// Complete elliptic integral (Legendre form) of the second kind
|
||||
template <typename T>
|
||||
inline typename tools::promote_args<T>::type ellint_d(T k)
|
||||
{
|
||||
return ellint_d(k, policies::policy<>());
|
||||
}
|
||||
|
||||
// Elliptic integral (Legendre form) of the second kind
|
||||
template <class T1, class T2>
|
||||
inline typename tools::promote_args<T1, T2>::type ellint_d(T1 k, T2 phi)
|
||||
{
|
||||
typedef typename policies::is_policy<T2>::type tag_type;
|
||||
return detail::ellint_d(k, phi, tag_type());
|
||||
}
|
||||
|
||||
template <class T1, class T2, class Policy>
|
||||
inline typename tools::promote_args<T1, T2>::type ellint_d(T1 k, T2 phi, const Policy& pol)
|
||||
{
|
||||
typedef typename tools::promote_args<T1, T2>::type result_type;
|
||||
typedef typename policies::evaluation<result_type, Policy>::type value_type;
|
||||
return policies::checked_narrowing_cast<result_type, Policy>(detail::ellint_d_imp(static_cast<value_type>(phi), static_cast<value_type>(k), pol), "boost::math::ellint_2<%1%>(%1%,%1%)");
|
||||
}
|
||||
|
||||
}} // namespaces
|
||||
|
||||
#endif // BOOST_MATH_ELLINT_D_HPP
|
||||
|
||||
@@ -0,0 +1,44 @@
|
||||
|
||||
#ifndef BOOST_MPL_MAP_AUX_HAS_KEY_IMPL_HPP_INCLUDED
|
||||
#define BOOST_MPL_MAP_AUX_HAS_KEY_IMPL_HPP_INCLUDED
|
||||
|
||||
// Copyright Aleksey Gurtovoy 2003-2004
|
||||
// Copyright David Abrahams 2003-2004
|
||||
//
|
||||
// Distributed under the Boost Software License, Version 1.0.
|
||||
// (See accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
//
|
||||
// See http://www.boost.org/libs/mpl for documentation.
|
||||
|
||||
// $Id$
|
||||
// $Date$
|
||||
// $Revision$
|
||||
|
||||
#include <boost/mpl/has_key_fwd.hpp>
|
||||
#include <boost/mpl/map/aux_/tag.hpp>
|
||||
#include <boost/mpl/map/aux_/at_impl.hpp>
|
||||
#include <boost/mpl/void.hpp>
|
||||
#include <boost/mpl/aux_/config/typeof.hpp>
|
||||
|
||||
namespace boost { namespace mpl {
|
||||
|
||||
template<>
|
||||
struct has_key_impl< aux::map_tag >
|
||||
{
|
||||
template< typename Map, typename Key > struct apply
|
||||
#if defined(BOOST_MPL_CFG_TYPEOF_BASED_SEQUENCES)
|
||||
: is_not_void_<
|
||||
typename at_impl<aux::map_tag>
|
||||
::apply<Map,Key>::type
|
||||
>
|
||||
#else
|
||||
: bool_< ( x_order_impl<Map,Key>::value > 1 ) >
|
||||
#endif
|
||||
{
|
||||
};
|
||||
};
|
||||
|
||||
}}
|
||||
|
||||
#endif // BOOST_MPL_MAP_AUX_HAS_KEY_IMPL_HPP_INCLUDED
|
||||
@@ -0,0 +1,155 @@
|
||||
// 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)
|
||||
// (C) Copyright 2011 Vicente J. Botet Escriba
|
||||
|
||||
#ifndef BOOST_THREAD_V2_THREAD_HPP
|
||||
#define BOOST_THREAD_V2_THREAD_HPP
|
||||
|
||||
#include <boost/thread/detail/config.hpp>
|
||||
#ifdef BOOST_THREAD_USES_CHRONO
|
||||
#include <boost/chrono/system_clocks.hpp>
|
||||
#include <boost/chrono/ceil.hpp>
|
||||
#endif
|
||||
#include <boost/thread/condition_variable.hpp>
|
||||
#include <boost/thread/lock_types.hpp>
|
||||
|
||||
namespace boost
|
||||
{
|
||||
namespace this_thread
|
||||
{
|
||||
namespace no_interruption_point
|
||||
{
|
||||
#ifdef BOOST_THREAD_USES_CHRONO
|
||||
|
||||
template <class Clock, class Duration>
|
||||
void sleep_until(const chrono::time_point<Clock, Duration>& t)
|
||||
{
|
||||
using namespace chrono;
|
||||
mutex mut;
|
||||
condition_variable cv;
|
||||
unique_lock<mutex> lk(mut);
|
||||
while (Clock::now() < t)
|
||||
cv.wait_until(lk, t);
|
||||
}
|
||||
|
||||
#ifdef BOOST_THREAD_SLEEP_FOR_IS_STEADY
|
||||
|
||||
template <class Rep, class Period>
|
||||
void sleep_for(const chrono::duration<Rep, Period>& d)
|
||||
{
|
||||
using namespace chrono;
|
||||
if (d > duration<Rep, Period>::zero())
|
||||
{
|
||||
duration<long double> Max = nanoseconds::max BOOST_PREVENT_MACRO_SUBSTITUTION ();
|
||||
nanoseconds ns;
|
||||
if (d < Max)
|
||||
{
|
||||
ns = duration_cast<nanoseconds>(d);
|
||||
if (ns < d)
|
||||
++ns;
|
||||
}
|
||||
else
|
||||
ns = nanoseconds:: max BOOST_PREVENT_MACRO_SUBSTITUTION ();
|
||||
sleep_for(ns);
|
||||
}
|
||||
}
|
||||
|
||||
template <class Duration>
|
||||
inline BOOST_SYMBOL_VISIBLE
|
||||
void sleep_until(const chrono::time_point<chrono::steady_clock, Duration>& t)
|
||||
{
|
||||
using namespace chrono;
|
||||
sleep_for(t - steady_clock::now());
|
||||
}
|
||||
#else
|
||||
template <class Rep, class Period>
|
||||
void sleep_for(const chrono::duration<Rep, Period>& d)
|
||||
{
|
||||
using namespace chrono;
|
||||
if (d > duration<Rep, Period>::zero())
|
||||
{
|
||||
steady_clock::time_point c_timeout = steady_clock::now() + ceil<nanoseconds>(d);
|
||||
sleep_until(c_timeout);
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
#endif
|
||||
}
|
||||
#ifdef BOOST_THREAD_USES_CHRONO
|
||||
|
||||
template <class Clock, class Duration>
|
||||
void sleep_until(const chrono::time_point<Clock, Duration>& t)
|
||||
{
|
||||
using namespace chrono;
|
||||
mutex mut;
|
||||
condition_variable cv;
|
||||
unique_lock<mutex> lk(mut);
|
||||
while (Clock::now() < t)
|
||||
cv.wait_until(lk, t);
|
||||
}
|
||||
|
||||
#if defined BOOST_THREAD_HAS_CONDATTR_SET_CLOCK_MONOTONIC && defined BOOST_CHRONO_HAS_CLOCK_STEADY
|
||||
template <class Rep, class Period>
|
||||
void sleep_for(const chrono::duration<Rep, Period>& d)
|
||||
{
|
||||
using namespace chrono;
|
||||
if (d > duration<Rep, Period>::zero())
|
||||
{
|
||||
steady_clock::time_point c_timeout = steady_clock::now() + ceil<nanoseconds>(d);
|
||||
sleep_until(c_timeout);
|
||||
}
|
||||
}
|
||||
|
||||
#elif defined BOOST_THREAD_SLEEP_FOR_IS_STEADY
|
||||
|
||||
template <class Rep, class Period>
|
||||
void sleep_for(const chrono::duration<Rep, Period>& d)
|
||||
{
|
||||
using namespace chrono;
|
||||
if (d > duration<Rep, Period>::zero())
|
||||
{
|
||||
duration<long double> Max = nanoseconds::max BOOST_PREVENT_MACRO_SUBSTITUTION ();
|
||||
nanoseconds ns;
|
||||
if (d < Max)
|
||||
{
|
||||
ns = duration_cast<nanoseconds>(d);
|
||||
if (ns < d)
|
||||
++ns;
|
||||
}
|
||||
else
|
||||
ns = nanoseconds:: max BOOST_PREVENT_MACRO_SUBSTITUTION ();
|
||||
sleep_for(ns);
|
||||
}
|
||||
}
|
||||
|
||||
template <class Duration>
|
||||
inline BOOST_SYMBOL_VISIBLE
|
||||
void sleep_until(const chrono::time_point<chrono::steady_clock, Duration>& t)
|
||||
{
|
||||
using namespace chrono;
|
||||
sleep_for(t - steady_clock::now());
|
||||
}
|
||||
#else
|
||||
template <class Rep, class Period>
|
||||
void sleep_for(const chrono::duration<Rep, Period>& d)
|
||||
{
|
||||
using namespace chrono;
|
||||
if (d > duration<Rep, Period>::zero())
|
||||
{
|
||||
//system_clock::time_point c_timeout = time_point_cast<system_clock::duration>(system_clock::now() + ceil<nanoseconds>(d));
|
||||
system_clock::time_point c_timeout = system_clock::now() + ceil<system_clock::duration>(d);
|
||||
sleep_until(c_timeout);
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,26 @@
|
||||
// cv_status.hpp
|
||||
//
|
||||
// Copyright (C) 2011 Vicente J. Botet Escriba
|
||||
//
|
||||
// Distributed under the Boost Software License, Version 1.0. (See
|
||||
// accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
#ifndef BOOST_THREAD_CV_STATUS_HPP
|
||||
#define BOOST_THREAD_CV_STATUS_HPP
|
||||
|
||||
#include <boost/core/scoped_enum.hpp>
|
||||
|
||||
namespace boost
|
||||
{
|
||||
|
||||
// enum class cv_status;
|
||||
BOOST_SCOPED_ENUM_DECLARE_BEGIN(cv_status)
|
||||
{
|
||||
no_timeout,
|
||||
timeout
|
||||
}
|
||||
BOOST_SCOPED_ENUM_DECLARE_END(cv_status)
|
||||
}
|
||||
|
||||
#endif // header
|
||||
@@ -0,0 +1,16 @@
|
||||
/*==============================================================================
|
||||
Copyright (c) 2001-2010 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)
|
||||
==============================================================================*/
|
||||
#ifndef BOOST_PHOENIX_BIND_HPP
|
||||
#define BOOST_PHOENIX_BIND_HPP
|
||||
|
||||
#include <boost/phoenix/version.hpp>
|
||||
#include <boost/phoenix/bind/bind_function.hpp>
|
||||
#include <boost/phoenix/bind/bind_function_object.hpp>
|
||||
#include <boost/phoenix/bind/bind_member_function.hpp>
|
||||
#include <boost/phoenix/bind/bind_member_variable.hpp>
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user