Initial Commit
This commit is contained in:
@@ -0,0 +1,333 @@
|
||||
// (C) Copyright John Maddock 2006.
|
||||
// Use, modification and distribution are subject to the
|
||||
// Boost Software License, Version 1.0. (See accompanying file
|
||||
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
#ifndef BOOST_MATH_TOOLS_RATIONAL_HPP
|
||||
#define BOOST_MATH_TOOLS_RATIONAL_HPP
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#pragma once
|
||||
#endif
|
||||
|
||||
#include <boost/array.hpp>
|
||||
#include <boost/math/tools/config.hpp>
|
||||
#include <boost/mpl/int.hpp>
|
||||
|
||||
#if BOOST_MATH_POLY_METHOD == 1
|
||||
# define BOOST_HEADER() <BOOST_JOIN(boost/math/tools/detail/polynomial_horner1_, BOOST_MATH_MAX_POLY_ORDER).hpp>
|
||||
# include BOOST_HEADER()
|
||||
# undef BOOST_HEADER
|
||||
#elif BOOST_MATH_POLY_METHOD == 2
|
||||
# define BOOST_HEADER() <BOOST_JOIN(boost/math/tools/detail/polynomial_horner2_, BOOST_MATH_MAX_POLY_ORDER).hpp>
|
||||
# include BOOST_HEADER()
|
||||
# undef BOOST_HEADER
|
||||
#elif BOOST_MATH_POLY_METHOD == 3
|
||||
# define BOOST_HEADER() <BOOST_JOIN(boost/math/tools/detail/polynomial_horner3_, BOOST_MATH_MAX_POLY_ORDER).hpp>
|
||||
# include BOOST_HEADER()
|
||||
# undef BOOST_HEADER
|
||||
#endif
|
||||
#if BOOST_MATH_RATIONAL_METHOD == 1
|
||||
# define BOOST_HEADER() <BOOST_JOIN(boost/math/tools/detail/rational_horner1_, BOOST_MATH_MAX_POLY_ORDER).hpp>
|
||||
# include BOOST_HEADER()
|
||||
# undef BOOST_HEADER
|
||||
#elif BOOST_MATH_RATIONAL_METHOD == 2
|
||||
# define BOOST_HEADER() <BOOST_JOIN(boost/math/tools/detail/rational_horner2_, BOOST_MATH_MAX_POLY_ORDER).hpp>
|
||||
# include BOOST_HEADER()
|
||||
# undef BOOST_HEADER
|
||||
#elif BOOST_MATH_RATIONAL_METHOD == 3
|
||||
# define BOOST_HEADER() <BOOST_JOIN(boost/math/tools/detail/rational_horner3_, BOOST_MATH_MAX_POLY_ORDER).hpp>
|
||||
# include BOOST_HEADER()
|
||||
# undef BOOST_HEADER
|
||||
#endif
|
||||
|
||||
#if 0
|
||||
//
|
||||
// This just allows dependency trackers to find the headers
|
||||
// used in the above PP-magic.
|
||||
//
|
||||
#include <boost/math/tools/detail/polynomial_horner1_2.hpp>
|
||||
#include <boost/math/tools/detail/polynomial_horner1_3.hpp>
|
||||
#include <boost/math/tools/detail/polynomial_horner1_4.hpp>
|
||||
#include <boost/math/tools/detail/polynomial_horner1_5.hpp>
|
||||
#include <boost/math/tools/detail/polynomial_horner1_6.hpp>
|
||||
#include <boost/math/tools/detail/polynomial_horner1_7.hpp>
|
||||
#include <boost/math/tools/detail/polynomial_horner1_8.hpp>
|
||||
#include <boost/math/tools/detail/polynomial_horner1_9.hpp>
|
||||
#include <boost/math/tools/detail/polynomial_horner1_10.hpp>
|
||||
#include <boost/math/tools/detail/polynomial_horner1_11.hpp>
|
||||
#include <boost/math/tools/detail/polynomial_horner1_12.hpp>
|
||||
#include <boost/math/tools/detail/polynomial_horner1_13.hpp>
|
||||
#include <boost/math/tools/detail/polynomial_horner1_14.hpp>
|
||||
#include <boost/math/tools/detail/polynomial_horner1_15.hpp>
|
||||
#include <boost/math/tools/detail/polynomial_horner1_16.hpp>
|
||||
#include <boost/math/tools/detail/polynomial_horner1_17.hpp>
|
||||
#include <boost/math/tools/detail/polynomial_horner1_18.hpp>
|
||||
#include <boost/math/tools/detail/polynomial_horner1_19.hpp>
|
||||
#include <boost/math/tools/detail/polynomial_horner1_20.hpp>
|
||||
#include <boost/math/tools/detail/polynomial_horner2_2.hpp>
|
||||
#include <boost/math/tools/detail/polynomial_horner2_3.hpp>
|
||||
#include <boost/math/tools/detail/polynomial_horner2_4.hpp>
|
||||
#include <boost/math/tools/detail/polynomial_horner2_5.hpp>
|
||||
#include <boost/math/tools/detail/polynomial_horner2_6.hpp>
|
||||
#include <boost/math/tools/detail/polynomial_horner2_7.hpp>
|
||||
#include <boost/math/tools/detail/polynomial_horner2_8.hpp>
|
||||
#include <boost/math/tools/detail/polynomial_horner2_9.hpp>
|
||||
#include <boost/math/tools/detail/polynomial_horner2_10.hpp>
|
||||
#include <boost/math/tools/detail/polynomial_horner2_11.hpp>
|
||||
#include <boost/math/tools/detail/polynomial_horner2_12.hpp>
|
||||
#include <boost/math/tools/detail/polynomial_horner2_13.hpp>
|
||||
#include <boost/math/tools/detail/polynomial_horner2_14.hpp>
|
||||
#include <boost/math/tools/detail/polynomial_horner2_15.hpp>
|
||||
#include <boost/math/tools/detail/polynomial_horner2_16.hpp>
|
||||
#include <boost/math/tools/detail/polynomial_horner2_17.hpp>
|
||||
#include <boost/math/tools/detail/polynomial_horner2_18.hpp>
|
||||
#include <boost/math/tools/detail/polynomial_horner2_19.hpp>
|
||||
#include <boost/math/tools/detail/polynomial_horner2_20.hpp>
|
||||
#include <boost/math/tools/detail/polynomial_horner3_2.hpp>
|
||||
#include <boost/math/tools/detail/polynomial_horner3_3.hpp>
|
||||
#include <boost/math/tools/detail/polynomial_horner3_4.hpp>
|
||||
#include <boost/math/tools/detail/polynomial_horner3_5.hpp>
|
||||
#include <boost/math/tools/detail/polynomial_horner3_6.hpp>
|
||||
#include <boost/math/tools/detail/polynomial_horner3_7.hpp>
|
||||
#include <boost/math/tools/detail/polynomial_horner3_8.hpp>
|
||||
#include <boost/math/tools/detail/polynomial_horner3_9.hpp>
|
||||
#include <boost/math/tools/detail/polynomial_horner3_10.hpp>
|
||||
#include <boost/math/tools/detail/polynomial_horner3_11.hpp>
|
||||
#include <boost/math/tools/detail/polynomial_horner3_12.hpp>
|
||||
#include <boost/math/tools/detail/polynomial_horner3_13.hpp>
|
||||
#include <boost/math/tools/detail/polynomial_horner3_14.hpp>
|
||||
#include <boost/math/tools/detail/polynomial_horner3_15.hpp>
|
||||
#include <boost/math/tools/detail/polynomial_horner3_16.hpp>
|
||||
#include <boost/math/tools/detail/polynomial_horner3_17.hpp>
|
||||
#include <boost/math/tools/detail/polynomial_horner3_18.hpp>
|
||||
#include <boost/math/tools/detail/polynomial_horner3_19.hpp>
|
||||
#include <boost/math/tools/detail/polynomial_horner3_20.hpp>
|
||||
#include <boost/math/tools/detail/rational_horner1_2.hpp>
|
||||
#include <boost/math/tools/detail/rational_horner1_3.hpp>
|
||||
#include <boost/math/tools/detail/rational_horner1_4.hpp>
|
||||
#include <boost/math/tools/detail/rational_horner1_5.hpp>
|
||||
#include <boost/math/tools/detail/rational_horner1_6.hpp>
|
||||
#include <boost/math/tools/detail/rational_horner1_7.hpp>
|
||||
#include <boost/math/tools/detail/rational_horner1_8.hpp>
|
||||
#include <boost/math/tools/detail/rational_horner1_9.hpp>
|
||||
#include <boost/math/tools/detail/rational_horner1_10.hpp>
|
||||
#include <boost/math/tools/detail/rational_horner1_11.hpp>
|
||||
#include <boost/math/tools/detail/rational_horner1_12.hpp>
|
||||
#include <boost/math/tools/detail/rational_horner1_13.hpp>
|
||||
#include <boost/math/tools/detail/rational_horner1_14.hpp>
|
||||
#include <boost/math/tools/detail/rational_horner1_15.hpp>
|
||||
#include <boost/math/tools/detail/rational_horner1_16.hpp>
|
||||
#include <boost/math/tools/detail/rational_horner1_17.hpp>
|
||||
#include <boost/math/tools/detail/rational_horner1_18.hpp>
|
||||
#include <boost/math/tools/detail/rational_horner1_19.hpp>
|
||||
#include <boost/math/tools/detail/rational_horner1_20.hpp>
|
||||
#include <boost/math/tools/detail/rational_horner2_2.hpp>
|
||||
#include <boost/math/tools/detail/rational_horner2_3.hpp>
|
||||
#include <boost/math/tools/detail/rational_horner2_4.hpp>
|
||||
#include <boost/math/tools/detail/rational_horner2_5.hpp>
|
||||
#include <boost/math/tools/detail/rational_horner2_6.hpp>
|
||||
#include <boost/math/tools/detail/rational_horner2_7.hpp>
|
||||
#include <boost/math/tools/detail/rational_horner2_8.hpp>
|
||||
#include <boost/math/tools/detail/rational_horner2_9.hpp>
|
||||
#include <boost/math/tools/detail/rational_horner2_10.hpp>
|
||||
#include <boost/math/tools/detail/rational_horner2_11.hpp>
|
||||
#include <boost/math/tools/detail/rational_horner2_12.hpp>
|
||||
#include <boost/math/tools/detail/rational_horner2_13.hpp>
|
||||
#include <boost/math/tools/detail/rational_horner2_14.hpp>
|
||||
#include <boost/math/tools/detail/rational_horner2_15.hpp>
|
||||
#include <boost/math/tools/detail/rational_horner2_16.hpp>
|
||||
#include <boost/math/tools/detail/rational_horner2_17.hpp>
|
||||
#include <boost/math/tools/detail/rational_horner2_18.hpp>
|
||||
#include <boost/math/tools/detail/rational_horner2_19.hpp>
|
||||
#include <boost/math/tools/detail/rational_horner2_20.hpp>
|
||||
#include <boost/math/tools/detail/rational_horner3_2.hpp>
|
||||
#include <boost/math/tools/detail/rational_horner3_3.hpp>
|
||||
#include <boost/math/tools/detail/rational_horner3_4.hpp>
|
||||
#include <boost/math/tools/detail/rational_horner3_5.hpp>
|
||||
#include <boost/math/tools/detail/rational_horner3_6.hpp>
|
||||
#include <boost/math/tools/detail/rational_horner3_7.hpp>
|
||||
#include <boost/math/tools/detail/rational_horner3_8.hpp>
|
||||
#include <boost/math/tools/detail/rational_horner3_9.hpp>
|
||||
#include <boost/math/tools/detail/rational_horner3_10.hpp>
|
||||
#include <boost/math/tools/detail/rational_horner3_11.hpp>
|
||||
#include <boost/math/tools/detail/rational_horner3_12.hpp>
|
||||
#include <boost/math/tools/detail/rational_horner3_13.hpp>
|
||||
#include <boost/math/tools/detail/rational_horner3_14.hpp>
|
||||
#include <boost/math/tools/detail/rational_horner3_15.hpp>
|
||||
#include <boost/math/tools/detail/rational_horner3_16.hpp>
|
||||
#include <boost/math/tools/detail/rational_horner3_17.hpp>
|
||||
#include <boost/math/tools/detail/rational_horner3_18.hpp>
|
||||
#include <boost/math/tools/detail/rational_horner3_19.hpp>
|
||||
#include <boost/math/tools/detail/rational_horner3_20.hpp>
|
||||
#endif
|
||||
|
||||
namespace boost{ namespace math{ namespace tools{
|
||||
|
||||
//
|
||||
// Forward declaration to keep two phase lookup happy:
|
||||
//
|
||||
template <class T, class U>
|
||||
U evaluate_polynomial(const T* poly, U const& z, std::size_t count) BOOST_MATH_NOEXCEPT(U);
|
||||
|
||||
namespace detail{
|
||||
|
||||
template <class T, class V, class Tag>
|
||||
inline V evaluate_polynomial_c_imp(const T* a, const V& val, const Tag*) BOOST_MATH_NOEXCEPT(V)
|
||||
{
|
||||
return evaluate_polynomial(a, val, Tag::value);
|
||||
}
|
||||
|
||||
} // namespace detail
|
||||
|
||||
//
|
||||
// Polynomial evaluation with runtime size.
|
||||
// This requires a for-loop which may be more expensive than
|
||||
// the loop expanded versions above:
|
||||
//
|
||||
template <class T, class U>
|
||||
inline U evaluate_polynomial(const T* poly, U const& z, std::size_t count) BOOST_MATH_NOEXCEPT(U)
|
||||
{
|
||||
BOOST_ASSERT(count > 0);
|
||||
U sum = static_cast<U>(poly[count - 1]);
|
||||
for(int i = static_cast<int>(count) - 2; i >= 0; --i)
|
||||
{
|
||||
sum *= z;
|
||||
sum += static_cast<U>(poly[i]);
|
||||
}
|
||||
return sum;
|
||||
}
|
||||
//
|
||||
// Compile time sized polynomials, just inline forwarders to the
|
||||
// implementations above:
|
||||
//
|
||||
template <std::size_t N, class T, class V>
|
||||
inline V evaluate_polynomial(const T(&a)[N], const V& val) BOOST_MATH_NOEXCEPT(V)
|
||||
{
|
||||
typedef mpl::int_<N> tag_type;
|
||||
return detail::evaluate_polynomial_c_imp(static_cast<const T*>(a), val, static_cast<tag_type const*>(0));
|
||||
}
|
||||
|
||||
template <std::size_t N, class T, class V>
|
||||
inline V evaluate_polynomial(const boost::array<T,N>& a, const V& val) BOOST_MATH_NOEXCEPT(V)
|
||||
{
|
||||
typedef mpl::int_<N> tag_type;
|
||||
return detail::evaluate_polynomial_c_imp(static_cast<const T*>(a.data()), val, static_cast<tag_type const*>(0));
|
||||
}
|
||||
//
|
||||
// Even polynomials are trivial: just square the argument!
|
||||
//
|
||||
template <class T, class U>
|
||||
inline U evaluate_even_polynomial(const T* poly, U z, std::size_t count) BOOST_MATH_NOEXCEPT(U)
|
||||
{
|
||||
return evaluate_polynomial(poly, U(z*z), count);
|
||||
}
|
||||
|
||||
template <std::size_t N, class T, class V>
|
||||
inline V evaluate_even_polynomial(const T(&a)[N], const V& z) BOOST_MATH_NOEXCEPT(V)
|
||||
{
|
||||
return evaluate_polynomial(a, V(z*z));
|
||||
}
|
||||
|
||||
template <std::size_t N, class T, class V>
|
||||
inline V evaluate_even_polynomial(const boost::array<T,N>& a, const V& z) BOOST_MATH_NOEXCEPT(V)
|
||||
{
|
||||
return evaluate_polynomial(a, V(z*z));
|
||||
}
|
||||
//
|
||||
// Odd polynomials come next:
|
||||
//
|
||||
template <class T, class U>
|
||||
inline U evaluate_odd_polynomial(const T* poly, U z, std::size_t count) BOOST_MATH_NOEXCEPT(U)
|
||||
{
|
||||
return poly[0] + z * evaluate_polynomial(poly+1, U(z*z), count-1);
|
||||
}
|
||||
|
||||
template <std::size_t N, class T, class V>
|
||||
inline V evaluate_odd_polynomial(const T(&a)[N], const V& z) BOOST_MATH_NOEXCEPT(V)
|
||||
{
|
||||
typedef mpl::int_<N-1> tag_type;
|
||||
return a[0] + z * detail::evaluate_polynomial_c_imp(static_cast<const T*>(a) + 1, V(z*z), static_cast<tag_type const*>(0));
|
||||
}
|
||||
|
||||
template <std::size_t N, class T, class V>
|
||||
inline V evaluate_odd_polynomial(const boost::array<T,N>& a, const V& z) BOOST_MATH_NOEXCEPT(V)
|
||||
{
|
||||
typedef mpl::int_<N-1> tag_type;
|
||||
return a[0] + z * detail::evaluate_polynomial_c_imp(static_cast<const T*>(a.data()) + 1, V(z*z), static_cast<tag_type const*>(0));
|
||||
}
|
||||
|
||||
template <class T, class U, class V>
|
||||
V evaluate_rational(const T* num, const U* denom, const V& z_, std::size_t count) BOOST_MATH_NOEXCEPT(V);
|
||||
|
||||
namespace detail{
|
||||
|
||||
template <class T, class U, class V, class Tag>
|
||||
inline V evaluate_rational_c_imp(const T* num, const U* denom, const V& z, const Tag*) BOOST_MATH_NOEXCEPT(V)
|
||||
{
|
||||
return boost::math::tools::evaluate_rational(num, denom, z, Tag::value);
|
||||
}
|
||||
|
||||
}
|
||||
//
|
||||
// Rational functions: numerator and denominator must be
|
||||
// equal in size. These always have a for-loop and so may be less
|
||||
// efficient than evaluating a pair of polynomials. However, there
|
||||
// are some tricks we can use to prevent overflow that might otherwise
|
||||
// occur in polynomial evaluation, if z is large. This is important
|
||||
// in our Lanczos code for example.
|
||||
//
|
||||
template <class T, class U, class V>
|
||||
V evaluate_rational(const T* num, const U* denom, const V& z_, std::size_t count) BOOST_MATH_NOEXCEPT(V)
|
||||
{
|
||||
V z(z_);
|
||||
V s1, s2;
|
||||
if(z <= 1)
|
||||
{
|
||||
s1 = static_cast<V>(num[count-1]);
|
||||
s2 = static_cast<V>(denom[count-1]);
|
||||
for(int i = (int)count - 2; i >= 0; --i)
|
||||
{
|
||||
s1 *= z;
|
||||
s2 *= z;
|
||||
s1 += num[i];
|
||||
s2 += denom[i];
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
z = 1 / z;
|
||||
s1 = static_cast<V>(num[0]);
|
||||
s2 = static_cast<V>(denom[0]);
|
||||
for(unsigned i = 1; i < count; ++i)
|
||||
{
|
||||
s1 *= z;
|
||||
s2 *= z;
|
||||
s1 += num[i];
|
||||
s2 += denom[i];
|
||||
}
|
||||
}
|
||||
return s1 / s2;
|
||||
}
|
||||
|
||||
template <std::size_t N, class T, class U, class V>
|
||||
inline V evaluate_rational(const T(&a)[N], const U(&b)[N], const V& z) BOOST_MATH_NOEXCEPT(V)
|
||||
{
|
||||
return detail::evaluate_rational_c_imp(a, b, z, static_cast<const mpl::int_<N>*>(0));
|
||||
}
|
||||
|
||||
template <std::size_t N, class T, class U, class V>
|
||||
inline V evaluate_rational(const boost::array<T,N>& a, const boost::array<U,N>& b, const V& z) BOOST_MATH_NOEXCEPT(V)
|
||||
{
|
||||
return detail::evaluate_rational_c_imp(a.data(), b.data(), z, static_cast<mpl::int_<N>*>(0));
|
||||
}
|
||||
|
||||
} // namespace tools
|
||||
} // namespace math
|
||||
} // namespace boost
|
||||
|
||||
#endif // BOOST_MATH_TOOLS_RATIONAL_HPP
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,76 @@
|
||||
/*=============================================================================
|
||||
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)
|
||||
==============================================================================*/
|
||||
#ifndef BOOST_PP_IS_ITERATING
|
||||
#if !defined(FUSION_TUPLE_TIE_10032005_0846)
|
||||
#define FUSION_TUPLE_TIE_10032005_0846
|
||||
|
||||
#include <boost/preprocessor/iterate.hpp>
|
||||
#include <boost/preprocessor/cat.hpp>
|
||||
#include <boost/preprocessor/repetition/enum_params.hpp>
|
||||
#include <boost/preprocessor/repetition/enum_binary_params.hpp>
|
||||
#include <boost/fusion/tuple/detail/tuple.hpp>
|
||||
|
||||
#if !defined(BOOST_FUSION_DONT_USE_PREPROCESSED_FILES)
|
||||
#include <boost/fusion/tuple/detail/preprocessed/tuple_tie.hpp>
|
||||
#else
|
||||
#if defined(__WAVE__) && defined(BOOST_FUSION_CREATE_PREPROCESSED_FILES)
|
||||
#pragma wave option(preserve: 2, line: 0, output: "preprocessed/tuple_tie" FUSION_MAX_VECTOR_SIZE_STR ".hpp")
|
||||
#endif
|
||||
|
||||
/*=============================================================================
|
||||
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
|
||||
{
|
||||
#define BOOST_FUSION_REF(z, n, data) BOOST_PP_CAT(T, n)&
|
||||
|
||||
#define BOOST_PP_FILENAME_1 <boost/fusion/tuple/detail/tuple_tie.hpp>
|
||||
#define BOOST_PP_ITERATION_LIMITS (1, FUSION_MAX_VECTOR_SIZE)
|
||||
#include BOOST_PP_ITERATE()
|
||||
|
||||
#undef BOOST_FUSION_REF
|
||||
|
||||
}}
|
||||
|
||||
#if defined(__WAVE__) && defined(BOOST_FUSION_CREATE_PREPROCESSED_FILES)
|
||||
#pragma wave option(output: null)
|
||||
#endif
|
||||
|
||||
#endif // BOOST_FUSION_DONT_USE_PREPROCESSED_FILES
|
||||
|
||||
#endif
|
||||
#else // defined(BOOST_PP_IS_ITERATING)
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Preprocessor vertical repetition code
|
||||
//
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#define N BOOST_PP_ITERATION()
|
||||
|
||||
template <BOOST_PP_ENUM_PARAMS(N, typename T)>
|
||||
BOOST_FUSION_GPU_ENABLED
|
||||
inline tuple<BOOST_PP_ENUM(N, BOOST_FUSION_REF, _)>
|
||||
tie(BOOST_PP_ENUM_BINARY_PARAMS(N, T, & arg))
|
||||
{
|
||||
return tuple<BOOST_PP_ENUM(N, BOOST_FUSION_REF, _)>(
|
||||
BOOST_PP_ENUM_PARAMS(N, arg));
|
||||
}
|
||||
|
||||
#undef N
|
||||
#endif // defined(BOOST_PP_IS_ITERATING)
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,23 @@
|
||||
#ifndef CALLSIGN_VALIDATOR_HPP__
|
||||
#define CALLSIGN_VALIDATOR_HPP__
|
||||
|
||||
#include <QValidator>
|
||||
#include <QRegularExpression>
|
||||
|
||||
//
|
||||
// CallsignValidator - QValidator implementation for callsigns
|
||||
//
|
||||
class CallsignValidator final
|
||||
: public QValidator
|
||||
{
|
||||
public:
|
||||
CallsignValidator (QObject * parent = nullptr, bool allow_compound = true);
|
||||
|
||||
// QValidator implementation
|
||||
State validate (QString& input, int& pos) const override;
|
||||
|
||||
private:
|
||||
QRegularExpression re_;
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,92 @@
|
||||
|
||||
// Copyright Aleksey Gurtovoy 2000-2004
|
||||
//
|
||||
// Distributed under the Boost Software License, Version 1.0.
|
||||
// (See accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
//
|
||||
|
||||
// Preprocessed version of "boost/mpl/less_equal.hpp" header
|
||||
// -- DO NOT modify by hand!
|
||||
|
||||
namespace boost { namespace mpl {
|
||||
|
||||
template<
|
||||
typename Tag1
|
||||
, typename Tag2
|
||||
>
|
||||
struct less_equal_impl
|
||||
: if_c<
|
||||
( BOOST_MPL_AUX_NESTED_VALUE_WKND(int, Tag1)
|
||||
> BOOST_MPL_AUX_NESTED_VALUE_WKND(int, Tag2)
|
||||
)
|
||||
|
||||
, aux::cast2nd_impl< less_equal_impl< Tag1,Tag1 >,Tag1, Tag2 >
|
||||
, aux::cast1st_impl< less_equal_impl< Tag2,Tag2 >,Tag1, Tag2 >
|
||||
>::type
|
||||
{
|
||||
};
|
||||
|
||||
/// for Digital Mars C++/compilers with no CTPS/TTP support
|
||||
template<> struct less_equal_impl< na,na >
|
||||
{
|
||||
template< typename U1, typename U2 > struct apply
|
||||
{
|
||||
typedef apply type;
|
||||
BOOST_STATIC_CONSTANT(int, value = 0);
|
||||
};
|
||||
};
|
||||
|
||||
template< typename Tag > struct less_equal_impl< na,Tag >
|
||||
{
|
||||
template< typename U1, typename U2 > struct apply
|
||||
{
|
||||
typedef apply type;
|
||||
BOOST_STATIC_CONSTANT(int, value = 0);
|
||||
};
|
||||
};
|
||||
|
||||
template< typename Tag > struct less_equal_impl< Tag,na >
|
||||
{
|
||||
template< typename U1, typename U2 > struct apply
|
||||
{
|
||||
typedef apply type;
|
||||
BOOST_STATIC_CONSTANT(int, value = 0);
|
||||
};
|
||||
};
|
||||
|
||||
template< typename T > struct less_equal_tag
|
||||
{
|
||||
typedef typename T::tag type;
|
||||
};
|
||||
|
||||
template<
|
||||
typename BOOST_MPL_AUX_NA_PARAM(N1)
|
||||
, typename BOOST_MPL_AUX_NA_PARAM(N2)
|
||||
>
|
||||
struct less_equal
|
||||
|
||||
: less_equal_impl<
|
||||
typename less_equal_tag<N1>::type
|
||||
, typename less_equal_tag<N2>::type
|
||||
>::template apply< N1,N2 >::type
|
||||
{
|
||||
};
|
||||
|
||||
BOOST_MPL_AUX_NA_SPEC2(2, 2, less_equal)
|
||||
|
||||
}}
|
||||
|
||||
namespace boost { namespace mpl {
|
||||
|
||||
template<>
|
||||
struct less_equal_impl< integral_c_tag,integral_c_tag >
|
||||
{
|
||||
template< typename N1, typename N2 > struct apply
|
||||
|
||||
: bool_< ( BOOST_MPL_AUX_VALUE_WKND(N1)::value <= BOOST_MPL_AUX_VALUE_WKND(N2)::value ) >
|
||||
{
|
||||
};
|
||||
};
|
||||
|
||||
}}
|
||||
@@ -0,0 +1,69 @@
|
||||
|
||||
#ifndef BOOST_MPL_SET_AUX_SET0_HPP_INCLUDED
|
||||
#define BOOST_MPL_SET_AUX_SET0_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/long.hpp>
|
||||
#include <boost/mpl/void.hpp>
|
||||
#include <boost/mpl/aux_/na.hpp>
|
||||
#include <boost/mpl/set/aux_/tag.hpp>
|
||||
#include <boost/mpl/aux_/yes_no.hpp>
|
||||
#include <boost/mpl/aux_/overload_names.hpp>
|
||||
#include <boost/mpl/aux_/config/operators.hpp>
|
||||
|
||||
#include <boost/preprocessor/cat.hpp>
|
||||
|
||||
namespace boost { namespace mpl {
|
||||
|
||||
#if defined(BOOST_MPL_CFG_USE_OPERATORS_OVERLOADING)
|
||||
|
||||
# define BOOST_MPL_AUX_SET0_OVERLOAD(R, f, X, T) \
|
||||
friend R BOOST_PP_CAT(BOOST_MPL_AUX_OVERLOAD_,f)(X const&, T) \
|
||||
/**/
|
||||
|
||||
# define BOOST_MPL_AUX_SET_OVERLOAD(R, f, X, T) \
|
||||
BOOST_MPL_AUX_SET0_OVERLOAD(R, f, X, T) \
|
||||
/**/
|
||||
|
||||
#else
|
||||
|
||||
# define BOOST_MPL_AUX_SET0_OVERLOAD(R, f, X, T) \
|
||||
static R BOOST_PP_CAT(BOOST_MPL_AUX_OVERLOAD_,f)(X const&, T) \
|
||||
/**/
|
||||
|
||||
# define BOOST_MPL_AUX_SET_OVERLOAD(R, f, X, T) \
|
||||
BOOST_MPL_AUX_SET0_OVERLOAD(R, f, X, T); \
|
||||
using Base::BOOST_PP_CAT(BOOST_MPL_AUX_OVERLOAD_,f) \
|
||||
/**/
|
||||
|
||||
#endif
|
||||
|
||||
template< typename Dummy = na > struct set0
|
||||
{
|
||||
typedef set0<> item_;
|
||||
typedef item_ type;
|
||||
typedef aux::set_tag tag;
|
||||
typedef void_ last_masked_;
|
||||
typedef void_ item_type_;
|
||||
typedef long_<0> size;
|
||||
typedef long_<1> order;
|
||||
|
||||
BOOST_MPL_AUX_SET0_OVERLOAD( aux::no_tag, ORDER_BY_KEY, set0<>, void const volatile* );
|
||||
BOOST_MPL_AUX_SET0_OVERLOAD( aux::yes_tag, IS_MASKED, set0<>, void const volatile* );
|
||||
};
|
||||
|
||||
}}
|
||||
|
||||
#endif // BOOST_MPL_SET_AUX_SET0_HPP_INCLUDED
|
||||
@@ -0,0 +1,41 @@
|
||||
// (C) Copyright Andrew Sutton 2007
|
||||
//
|
||||
// Use, modification and distribution are 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)
|
||||
|
||||
#ifndef BOOST_GRAPH_NULL_PROPERTY_HPP
|
||||
#define BOOST_GRAPH_NULL_PROPERTY_HPP
|
||||
|
||||
#include <boost/property_map/property_map.hpp>
|
||||
|
||||
// TODO: This should really be part of the property maps library rather than
|
||||
// the Boost.Graph library.
|
||||
|
||||
namespace boost
|
||||
{
|
||||
// A null property is somewhat like the inverse of the constant
|
||||
// property map except that instead of returning a single value,
|
||||
// this eats any writes and cannot be read from.
|
||||
|
||||
template <typename Key, typename Value>
|
||||
struct null_property_map
|
||||
{
|
||||
typedef Key key_type;
|
||||
typedef Value value_type;
|
||||
typedef void reference;
|
||||
typedef boost::writable_property_map_tag category;
|
||||
};
|
||||
|
||||
// The null_property_map<K,V> only has a put() function.
|
||||
template <typename K, typename V>
|
||||
void put(null_property_map<K,V>& /*pm*/, const K& /*key*/, const V& /*value*/)
|
||||
{ }
|
||||
|
||||
// A helper function for intantiating null property maps.
|
||||
template <typename Key, typename Value>
|
||||
inline null_property_map<Key, Value> make_null_property()
|
||||
{ return null_property_map<Key, Value>(); }
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,25 @@
|
||||
// (C) Copyright Gennadiy Rozental 2001.
|
||||
// Distributed under the Boost Software License, Version 1.0.
|
||||
// (See accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
// See http://www.boost.org/libs/test for the library home page.
|
||||
//
|
||||
// File : $RCSfile$
|
||||
//
|
||||
// Version : $Revision$
|
||||
//
|
||||
// Description : included (vs. linked ) version of Program Execution Monitor
|
||||
// ***************************************************************************
|
||||
|
||||
#ifndef BOOST_INCLUDED_PRG_EXEC_MONITOR_HPP_071894GER
|
||||
#define BOOST_INCLUDED_PRG_EXEC_MONITOR_HPP_071894GER
|
||||
|
||||
#include <boost/test/impl/execution_monitor.ipp>
|
||||
#include <boost/test/impl/debug.ipp>
|
||||
#include <boost/test/impl/cpp_main.ipp>
|
||||
|
||||
#define BOOST_TEST_INCLUDED
|
||||
#include <boost/test/prg_exec_monitor.hpp>
|
||||
|
||||
#endif // BOOST_INCLUDED_PRG_EXEC_MONITOR_HPP_071894GER
|
||||
@@ -0,0 +1,293 @@
|
||||
/*
|
||||
[auto_generated]
|
||||
boost/numeric/odeint/stepper/extrapolation_stepper.hpp
|
||||
|
||||
[begin_description]
|
||||
extrapolation stepper
|
||||
[end_description]
|
||||
|
||||
Copyright 2009-2015 Mario Mulansky
|
||||
|
||||
Distributed under the Boost Software License, Version 1.0.
|
||||
(See accompanying file LICENSE_1_0.txt or
|
||||
copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
*/
|
||||
|
||||
#ifndef BOOST_NUMERIC_ODEINT_STEPPER_EXTRAPOLATION_STEPPER_HPP_INCLUDED
|
||||
#define BOOST_NUMERIC_ODEINT_STEPPER_EXTRAPOLATION_STEPPER_HPP_INCLUDED
|
||||
|
||||
#include <iostream>
|
||||
|
||||
#include <algorithm>
|
||||
|
||||
#include <boost/config.hpp> // for min/max guidelines
|
||||
#include <boost/static_assert.hpp>
|
||||
|
||||
#include <boost/numeric/odeint/util/bind.hpp>
|
||||
#include <boost/numeric/odeint/util/unwrap_reference.hpp>
|
||||
|
||||
#include <boost/numeric/odeint/stepper/base/explicit_error_stepper_base.hpp>
|
||||
#include <boost/numeric/odeint/stepper/modified_midpoint.hpp>
|
||||
#include <boost/numeric/odeint/stepper/controlled_step_result.hpp>
|
||||
#include <boost/numeric/odeint/algebra/range_algebra.hpp>
|
||||
#include <boost/numeric/odeint/algebra/default_operations.hpp>
|
||||
#include <boost/numeric/odeint/algebra/algebra_dispatcher.hpp>
|
||||
#include <boost/numeric/odeint/algebra/operations_dispatcher.hpp>
|
||||
|
||||
#include <boost/numeric/odeint/util/state_wrapper.hpp>
|
||||
#include <boost/numeric/odeint/util/is_resizeable.hpp>
|
||||
#include <boost/numeric/odeint/util/resizer.hpp>
|
||||
#include <boost/numeric/odeint/util/unit_helper.hpp>
|
||||
#include <boost/numeric/odeint/util/detail/less_with_sign.hpp>
|
||||
|
||||
namespace boost
|
||||
{
|
||||
namespace numeric
|
||||
{
|
||||
namespace odeint
|
||||
{
|
||||
|
||||
template < unsigned short Order, class State, class Value = double,
|
||||
class Deriv = State, class Time = Value,
|
||||
class Algebra = typename algebra_dispatcher< State >::algebra_type,
|
||||
class Operations =
|
||||
typename operations_dispatcher< State >::operations_type,
|
||||
class Resizer = initially_resizer >
|
||||
#ifndef DOXYGEN_SKIP
|
||||
class extrapolation_stepper
|
||||
: public explicit_error_stepper_base<
|
||||
extrapolation_stepper< Order, State, Value, Deriv, Time, Algebra,
|
||||
Operations, Resizer >,
|
||||
Order, Order, Order - 2, State, Value, Deriv, Time, Algebra,
|
||||
Operations, Resizer >
|
||||
#else
|
||||
class extrapolation_stepper : public explicit_error_stepper_base
|
||||
#endif
|
||||
{
|
||||
|
||||
private:
|
||||
// check for Order being odd
|
||||
BOOST_STATIC_ASSERT_MSG(
|
||||
( ( Order % 2 ) == 0 ) && ( Order > 2 ),
|
||||
"extrapolation_stepper requires even Order larger than 2" );
|
||||
|
||||
public:
|
||||
#ifndef DOXYGEN_SKIP
|
||||
typedef explicit_error_stepper_base<
|
||||
extrapolation_stepper< Order, State, Value, Deriv, Time, Algebra,
|
||||
Operations, Resizer >,
|
||||
Order, Order, Order - 2, State, Value, Deriv, Time, Algebra, Operations,
|
||||
Resizer > stepper_base_type;
|
||||
#else
|
||||
typedef explicit_error_stepper_base< extrapolation_stepper< ... >, ... >
|
||||
stepper_base_type;
|
||||
#endif
|
||||
|
||||
typedef typename stepper_base_type::state_type state_type;
|
||||
typedef typename stepper_base_type::value_type value_type;
|
||||
typedef typename stepper_base_type::deriv_type deriv_type;
|
||||
typedef typename stepper_base_type::time_type time_type;
|
||||
typedef typename stepper_base_type::algebra_type algebra_type;
|
||||
typedef typename stepper_base_type::operations_type operations_type;
|
||||
typedef typename stepper_base_type::resizer_type resizer_type;
|
||||
|
||||
#ifndef DOXYGEN_SKIP
|
||||
typedef typename stepper_base_type::stepper_type stepper_type;
|
||||
typedef typename stepper_base_type::wrapped_state_type wrapped_state_type;
|
||||
typedef typename stepper_base_type::wrapped_deriv_type wrapped_deriv_type;
|
||||
|
||||
typedef std::vector< value_type > value_vector;
|
||||
typedef std::vector< value_vector > value_matrix;
|
||||
typedef std::vector< size_t > int_vector;
|
||||
typedef std::vector< wrapped_state_type > state_table_type;
|
||||
typedef modified_midpoint< state_type, value_type, deriv_type, time_type,
|
||||
algebra_type, operations_type,
|
||||
resizer_type > midpoint_stepper_type;
|
||||
|
||||
#endif // DOXYGEN_SKIP
|
||||
|
||||
typedef unsigned short order_type;
|
||||
static const order_type order_value = stepper_base_type::order_value;
|
||||
static const order_type stepper_order_value =
|
||||
stepper_base_type::stepper_order_value;
|
||||
static const order_type error_order_value =
|
||||
stepper_base_type::error_order_value;
|
||||
|
||||
const static size_t m_k_max = ( order_value - 2 ) / 2;
|
||||
|
||||
extrapolation_stepper( const algebra_type &algebra = algebra_type() )
|
||||
: stepper_base_type( algebra ), m_interval_sequence( m_k_max + 1 ),
|
||||
m_coeff( m_k_max + 1 ), m_table( m_k_max )
|
||||
{
|
||||
for ( unsigned short i = 0; i < m_k_max + 1; i++ )
|
||||
{
|
||||
m_interval_sequence[i] = 2 * ( i + 1 );
|
||||
m_coeff[i].resize( i );
|
||||
for ( size_t k = 0; k < i; ++k )
|
||||
{
|
||||
const value_type r =
|
||||
static_cast< value_type >( m_interval_sequence[i] ) /
|
||||
static_cast< value_type >( m_interval_sequence[k] );
|
||||
m_coeff[i][k] =
|
||||
static_cast< value_type >( 1 ) /
|
||||
( r * r - static_cast< value_type >(
|
||||
1 ) ); // coefficients for extrapolation
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
template < class System, class StateIn, class DerivIn, class StateOut,
|
||||
class Err >
|
||||
void do_step_impl( System system, const StateIn &in, const DerivIn &dxdt,
|
||||
time_type t, StateOut &out, time_type dt, Err &xerr )
|
||||
{
|
||||
// std::cout << "dt: " << dt << std::endl;
|
||||
// normal step
|
||||
do_step_impl( system, in, dxdt, t, out, dt );
|
||||
|
||||
static const value_type val1( 1.0 );
|
||||
// additionally, perform the error calculation
|
||||
stepper_base_type::m_algebra.for_each3(
|
||||
xerr, out, m_table[0].m_v,
|
||||
typename operations_type::template scale_sum2<
|
||||
value_type, value_type >( val1, -val1 ) );
|
||||
}
|
||||
|
||||
template < class System, class StateInOut, class DerivIn, class Err >
|
||||
void do_step_impl_io( System system, StateInOut &inout, const DerivIn &dxdt,
|
||||
time_type t, time_type dt, Err &xerr )
|
||||
{
|
||||
// normal step
|
||||
do_step_impl_io( system, inout, dxdt, t, dt );
|
||||
|
||||
static const value_type val1( 1.0 );
|
||||
// additionally, perform the error calculation
|
||||
stepper_base_type::m_algebra.for_each3(
|
||||
xerr, inout, m_table[0].m_v,
|
||||
typename operations_type::template scale_sum2<
|
||||
value_type, value_type >( val1, -val1 ) );
|
||||
}
|
||||
|
||||
template < class System, class StateIn, class DerivIn, class StateOut >
|
||||
void do_step_impl( System system, const StateIn &in, const DerivIn &dxdt,
|
||||
time_type t, StateOut &out, time_type dt )
|
||||
{
|
||||
m_resizer.adjust_size(
|
||||
in, detail::bind( &stepper_type::template resize_impl< StateIn >,
|
||||
detail::ref( *this ), detail::_1 ) );
|
||||
size_t k = 0;
|
||||
m_midpoint.set_steps( m_interval_sequence[k] );
|
||||
m_midpoint.do_step( system, in, dxdt, t, out, dt );
|
||||
for ( k = 1; k <= m_k_max; ++k )
|
||||
{
|
||||
m_midpoint.set_steps( m_interval_sequence[k] );
|
||||
m_midpoint.do_step( system, in, dxdt, t, m_table[k - 1].m_v, dt );
|
||||
extrapolate( k, m_table, m_coeff, out );
|
||||
}
|
||||
}
|
||||
|
||||
template < class System, class StateInOut, class DerivIn >
|
||||
void do_step_impl_io( System system, StateInOut &inout, const DerivIn &dxdt,
|
||||
time_type t, time_type dt )
|
||||
{
|
||||
// special care for inout
|
||||
m_xout_resizer.adjust_size(
|
||||
inout,
|
||||
detail::bind( &stepper_type::template resize_m_xout< StateInOut >,
|
||||
detail::ref( *this ), detail::_1 ) );
|
||||
do_step_impl( system, inout, dxdt, t, m_xout.m_v, dt );
|
||||
boost::numeric::odeint::copy( m_xout.m_v, inout );
|
||||
}
|
||||
|
||||
template < class System, class StateInOut, class DerivIn >
|
||||
void do_step_dxdt_impl( System system, StateInOut &x, const DerivIn &dxdt,
|
||||
time_type t, time_type dt )
|
||||
{
|
||||
do_step_impl_io( system , x , dxdt , t , dt );
|
||||
}
|
||||
|
||||
template < class System, class StateIn, class DerivIn, class StateOut >
|
||||
void do_step_dxdt_impl( System system, const StateIn &in,
|
||||
const DerivIn &dxdt, time_type t, StateOut &out,
|
||||
time_type dt )
|
||||
{
|
||||
do_step_impl( system , in , dxdt , t , out , dt );
|
||||
}
|
||||
|
||||
|
||||
template < class StateIn > void adjust_size( const StateIn &x )
|
||||
{
|
||||
resize_impl( x );
|
||||
m_midpoint.adjust_size( x );
|
||||
}
|
||||
|
||||
private:
|
||||
template < class StateIn > bool resize_impl( const StateIn &x )
|
||||
{
|
||||
bool resized( false );
|
||||
for ( size_t i = 0; i < m_k_max; ++i )
|
||||
resized |= adjust_size_by_resizeability(
|
||||
m_table[i], x, typename is_resizeable< state_type >::type() );
|
||||
return resized;
|
||||
}
|
||||
|
||||
template < class StateIn > bool resize_m_xout( const StateIn &x )
|
||||
{
|
||||
return adjust_size_by_resizeability(
|
||||
m_xout, x, typename is_resizeable< state_type >::type() );
|
||||
}
|
||||
|
||||
template < class StateInOut >
|
||||
void extrapolate( size_t k, state_table_type &table,
|
||||
const value_matrix &coeff, StateInOut &xest )
|
||||
/* polynomial extrapolation, see http://www.nr.com/webnotes/nr3web21.pdf
|
||||
uses the obtained intermediate results to extrapolate to dt->0
|
||||
*/
|
||||
{
|
||||
static const value_type val1 = static_cast< value_type >( 1.0 );
|
||||
|
||||
for ( int j = k - 1; j > 0; --j )
|
||||
{
|
||||
stepper_base_type::m_algebra.for_each3(
|
||||
table[j - 1].m_v, table[j].m_v, table[j - 1].m_v,
|
||||
typename operations_type::template scale_sum2<
|
||||
value_type, value_type >( val1 + coeff[k][j],
|
||||
-coeff[k][j] ) );
|
||||
}
|
||||
stepper_base_type::m_algebra.for_each3(
|
||||
xest, table[0].m_v, xest,
|
||||
typename operations_type::template scale_sum2<
|
||||
value_type, value_type >( val1 + coeff[k][0], -coeff[k][0] ) );
|
||||
}
|
||||
|
||||
private:
|
||||
midpoint_stepper_type m_midpoint;
|
||||
|
||||
resizer_type m_resizer;
|
||||
resizer_type m_xout_resizer;
|
||||
|
||||
int_vector m_interval_sequence; // stores the successive interval counts
|
||||
value_matrix m_coeff;
|
||||
|
||||
wrapped_state_type m_xout;
|
||||
state_table_type m_table; // sequence of states for extrapolation
|
||||
};
|
||||
|
||||
/******** DOXYGEN *******/
|
||||
|
||||
/**
|
||||
* \class extrapolation_stepper
|
||||
* \brief Extrapolation stepper with configurable order, and error estimation.
|
||||
*
|
||||
* The extrapolation stepper is a stepper with error estimation and configurable
|
||||
* order. The order is given as template parameter and needs to be an _odd_
|
||||
* number. The stepper is based on several executions of the modified midpoint
|
||||
* method and a Richardson extrapolation. This is essentially the same technique
|
||||
* as for bulirsch_stoer, but without the variable order.
|
||||
*
|
||||
* \note The Order parameter has to be an even number greater 2.
|
||||
*/
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
@@ -0,0 +1,203 @@
|
||||
|
||||
// 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/list/list50_c.hpp" header
|
||||
// -- DO NOT modify by hand!
|
||||
|
||||
namespace boost { namespace mpl {
|
||||
|
||||
template<
|
||||
typename T
|
||||
, T C0, T C1, T C2, T C3, T C4, T C5, T C6, T C7, T C8, T C9, T C10
|
||||
, T C11, T C12, T C13, T C14, T C15, T C16, T C17, T C18, T C19, T C20
|
||||
, T C21, T C22, T C23, T C24, T C25, T C26, T C27, T C28, T C29, T C30
|
||||
, T C31, T C32, T C33, T C34, T C35, T C36, T C37, T C38, T C39, T C40
|
||||
>
|
||||
struct list41_c
|
||||
: l_item<
|
||||
long_<41>
|
||||
, integral_c< T,C0 >
|
||||
, list40_c< T,C1,C2,C3,C4,C5,C6,C7,C8,C9,C10,C11,C12,C13,C14,C15,C16,C17,C18,C19,C20,C21,C22,C23,C24,C25,C26,C27,C28,C29,C30,C31,C32,C33,C34,C35,C36,C37,C38,C39,C40 >
|
||||
>
|
||||
{
|
||||
typedef list41_c type;
|
||||
typedef T value_type;
|
||||
};
|
||||
|
||||
template<
|
||||
typename T
|
||||
, T C0, T C1, T C2, T C3, T C4, T C5, T C6, T C7, T C8, T C9, T C10
|
||||
, T C11, T C12, T C13, T C14, T C15, T C16, T C17, T C18, T C19, T C20
|
||||
, T C21, T C22, T C23, T C24, T C25, T C26, T C27, T C28, T C29, T C30
|
||||
, T C31, T C32, T C33, T C34, T C35, T C36, T C37, T C38, T C39, T C40
|
||||
, T C41
|
||||
>
|
||||
struct list42_c
|
||||
: l_item<
|
||||
long_<42>
|
||||
, integral_c< T,C0 >
|
||||
, list41_c< T,C1,C2,C3,C4,C5,C6,C7,C8,C9,C10,C11,C12,C13,C14,C15,C16,C17,C18,C19,C20,C21,C22,C23,C24,C25,C26,C27,C28,C29,C30,C31,C32,C33,C34,C35,C36,C37,C38,C39,C40,C41 >
|
||||
>
|
||||
{
|
||||
typedef list42_c type;
|
||||
typedef T value_type;
|
||||
};
|
||||
|
||||
template<
|
||||
typename T
|
||||
, T C0, T C1, T C2, T C3, T C4, T C5, T C6, T C7, T C8, T C9, T C10
|
||||
, T C11, T C12, T C13, T C14, T C15, T C16, T C17, T C18, T C19, T C20
|
||||
, T C21, T C22, T C23, T C24, T C25, T C26, T C27, T C28, T C29, T C30
|
||||
, T C31, T C32, T C33, T C34, T C35, T C36, T C37, T C38, T C39, T C40
|
||||
, T C41, T C42
|
||||
>
|
||||
struct list43_c
|
||||
: l_item<
|
||||
long_<43>
|
||||
, integral_c< T,C0 >
|
||||
, list42_c< T,C1,C2,C3,C4,C5,C6,C7,C8,C9,C10,C11,C12,C13,C14,C15,C16,C17,C18,C19,C20,C21,C22,C23,C24,C25,C26,C27,C28,C29,C30,C31,C32,C33,C34,C35,C36,C37,C38,C39,C40,C41,C42 >
|
||||
>
|
||||
{
|
||||
typedef list43_c type;
|
||||
typedef T value_type;
|
||||
};
|
||||
|
||||
template<
|
||||
typename T
|
||||
, T C0, T C1, T C2, T C3, T C4, T C5, T C6, T C7, T C8, T C9, T C10
|
||||
, T C11, T C12, T C13, T C14, T C15, T C16, T C17, T C18, T C19, T C20
|
||||
, T C21, T C22, T C23, T C24, T C25, T C26, T C27, T C28, T C29, T C30
|
||||
, T C31, T C32, T C33, T C34, T C35, T C36, T C37, T C38, T C39, T C40
|
||||
, T C41, T C42, T C43
|
||||
>
|
||||
struct list44_c
|
||||
: l_item<
|
||||
long_<44>
|
||||
, integral_c< T,C0 >
|
||||
, list43_c< T,C1,C2,C3,C4,C5,C6,C7,C8,C9,C10,C11,C12,C13,C14,C15,C16,C17,C18,C19,C20,C21,C22,C23,C24,C25,C26,C27,C28,C29,C30,C31,C32,C33,C34,C35,C36,C37,C38,C39,C40,C41,C42,C43 >
|
||||
>
|
||||
{
|
||||
typedef list44_c type;
|
||||
typedef T value_type;
|
||||
};
|
||||
|
||||
template<
|
||||
typename T
|
||||
, T C0, T C1, T C2, T C3, T C4, T C5, T C6, T C7, T C8, T C9, T C10
|
||||
, T C11, T C12, T C13, T C14, T C15, T C16, T C17, T C18, T C19, T C20
|
||||
, T C21, T C22, T C23, T C24, T C25, T C26, T C27, T C28, T C29, T C30
|
||||
, T C31, T C32, T C33, T C34, T C35, T C36, T C37, T C38, T C39, T C40
|
||||
, T C41, T C42, T C43, T C44
|
||||
>
|
||||
struct list45_c
|
||||
: l_item<
|
||||
long_<45>
|
||||
, integral_c< T,C0 >
|
||||
, list44_c< T,C1,C2,C3,C4,C5,C6,C7,C8,C9,C10,C11,C12,C13,C14,C15,C16,C17,C18,C19,C20,C21,C22,C23,C24,C25,C26,C27,C28,C29,C30,C31,C32,C33,C34,C35,C36,C37,C38,C39,C40,C41,C42,C43,C44 >
|
||||
>
|
||||
{
|
||||
typedef list45_c type;
|
||||
typedef T value_type;
|
||||
};
|
||||
|
||||
template<
|
||||
typename T
|
||||
, T C0, T C1, T C2, T C3, T C4, T C5, T C6, T C7, T C8, T C9, T C10
|
||||
, T C11, T C12, T C13, T C14, T C15, T C16, T C17, T C18, T C19, T C20
|
||||
, T C21, T C22, T C23, T C24, T C25, T C26, T C27, T C28, T C29, T C30
|
||||
, T C31, T C32, T C33, T C34, T C35, T C36, T C37, T C38, T C39, T C40
|
||||
, T C41, T C42, T C43, T C44, T C45
|
||||
>
|
||||
struct list46_c
|
||||
: l_item<
|
||||
long_<46>
|
||||
, integral_c< T,C0 >
|
||||
, list45_c< T,C1,C2,C3,C4,C5,C6,C7,C8,C9,C10,C11,C12,C13,C14,C15,C16,C17,C18,C19,C20,C21,C22,C23,C24,C25,C26,C27,C28,C29,C30,C31,C32,C33,C34,C35,C36,C37,C38,C39,C40,C41,C42,C43,C44,C45 >
|
||||
>
|
||||
{
|
||||
typedef list46_c type;
|
||||
typedef T value_type;
|
||||
};
|
||||
|
||||
template<
|
||||
typename T
|
||||
, T C0, T C1, T C2, T C3, T C4, T C5, T C6, T C7, T C8, T C9, T C10
|
||||
, T C11, T C12, T C13, T C14, T C15, T C16, T C17, T C18, T C19, T C20
|
||||
, T C21, T C22, T C23, T C24, T C25, T C26, T C27, T C28, T C29, T C30
|
||||
, T C31, T C32, T C33, T C34, T C35, T C36, T C37, T C38, T C39, T C40
|
||||
, T C41, T C42, T C43, T C44, T C45, T C46
|
||||
>
|
||||
struct list47_c
|
||||
: l_item<
|
||||
long_<47>
|
||||
, integral_c< T,C0 >
|
||||
, list46_c< T,C1,C2,C3,C4,C5,C6,C7,C8,C9,C10,C11,C12,C13,C14,C15,C16,C17,C18,C19,C20,C21,C22,C23,C24,C25,C26,C27,C28,C29,C30,C31,C32,C33,C34,C35,C36,C37,C38,C39,C40,C41,C42,C43,C44,C45,C46 >
|
||||
>
|
||||
{
|
||||
typedef list47_c type;
|
||||
typedef T value_type;
|
||||
};
|
||||
|
||||
template<
|
||||
typename T
|
||||
, T C0, T C1, T C2, T C3, T C4, T C5, T C6, T C7, T C8, T C9, T C10
|
||||
, T C11, T C12, T C13, T C14, T C15, T C16, T C17, T C18, T C19, T C20
|
||||
, T C21, T C22, T C23, T C24, T C25, T C26, T C27, T C28, T C29, T C30
|
||||
, T C31, T C32, T C33, T C34, T C35, T C36, T C37, T C38, T C39, T C40
|
||||
, T C41, T C42, T C43, T C44, T C45, T C46, T C47
|
||||
>
|
||||
struct list48_c
|
||||
: l_item<
|
||||
long_<48>
|
||||
, integral_c< T,C0 >
|
||||
, list47_c< T,C1,C2,C3,C4,C5,C6,C7,C8,C9,C10,C11,C12,C13,C14,C15,C16,C17,C18,C19,C20,C21,C22,C23,C24,C25,C26,C27,C28,C29,C30,C31,C32,C33,C34,C35,C36,C37,C38,C39,C40,C41,C42,C43,C44,C45,C46,C47 >
|
||||
>
|
||||
{
|
||||
typedef list48_c type;
|
||||
typedef T value_type;
|
||||
};
|
||||
|
||||
template<
|
||||
typename T
|
||||
, T C0, T C1, T C2, T C3, T C4, T C5, T C6, T C7, T C8, T C9, T C10
|
||||
, T C11, T C12, T C13, T C14, T C15, T C16, T C17, T C18, T C19, T C20
|
||||
, T C21, T C22, T C23, T C24, T C25, T C26, T C27, T C28, T C29, T C30
|
||||
, T C31, T C32, T C33, T C34, T C35, T C36, T C37, T C38, T C39, T C40
|
||||
, T C41, T C42, T C43, T C44, T C45, T C46, T C47, T C48
|
||||
>
|
||||
struct list49_c
|
||||
: l_item<
|
||||
long_<49>
|
||||
, integral_c< T,C0 >
|
||||
, list48_c< T,C1,C2,C3,C4,C5,C6,C7,C8,C9,C10,C11,C12,C13,C14,C15,C16,C17,C18,C19,C20,C21,C22,C23,C24,C25,C26,C27,C28,C29,C30,C31,C32,C33,C34,C35,C36,C37,C38,C39,C40,C41,C42,C43,C44,C45,C46,C47,C48 >
|
||||
>
|
||||
{
|
||||
typedef list49_c type;
|
||||
typedef T value_type;
|
||||
};
|
||||
|
||||
template<
|
||||
typename T
|
||||
, T C0, T C1, T C2, T C3, T C4, T C5, T C6, T C7, T C8, T C9, T C10
|
||||
, T C11, T C12, T C13, T C14, T C15, T C16, T C17, T C18, T C19, T C20
|
||||
, T C21, T C22, T C23, T C24, T C25, T C26, T C27, T C28, T C29, T C30
|
||||
, T C31, T C32, T C33, T C34, T C35, T C36, T C37, T C38, T C39, T C40
|
||||
, T C41, T C42, T C43, T C44, T C45, T C46, T C47, T C48, T C49
|
||||
>
|
||||
struct list50_c
|
||||
: l_item<
|
||||
long_<50>
|
||||
, integral_c< T,C0 >
|
||||
, list49_c< T,C1,C2,C3,C4,C5,C6,C7,C8,C9,C10,C11,C12,C13,C14,C15,C16,C17,C18,C19,C20,C21,C22,C23,C24,C25,C26,C27,C28,C29,C30,C31,C32,C33,C34,C35,C36,C37,C38,C39,C40,C41,C42,C43,C44,C45,C46,C47,C48,C49 >
|
||||
>
|
||||
{
|
||||
typedef list50_c type;
|
||||
typedef T value_type;
|
||||
};
|
||||
|
||||
}}
|
||||
@@ -0,0 +1,133 @@
|
||||
/*
|
||||
[begin_description]
|
||||
Modification of the implicit Euler method, works with the MTL4 matrix library only.
|
||||
[end_description]
|
||||
|
||||
Copyright 2012-2013 Andreas Angelopoulos
|
||||
Copyright 2012-2013 Karsten Ahnert
|
||||
Copyright 2012-2013 Mario Mulansky
|
||||
|
||||
Distributed under the Boost Software License, Version 1.0.
|
||||
(See accompanying file LICENSE_1_0.txt or
|
||||
copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
*/
|
||||
|
||||
|
||||
#ifndef BOOST_NUMERIC_ODEINT_EXTERNAL_MTL4_RESIZE_HPP_INCLUDED
|
||||
#define BOOST_NUMERIC_ODEINT_EXTERNAL_MTL4_RESIZE_HPP_INCLUDED
|
||||
|
||||
#include <boost/numeric/odeint/util/is_resizeable.hpp>
|
||||
#include <boost/numeric/odeint/util/resize.hpp>
|
||||
#include <boost/numeric/odeint/util/same_size.hpp>
|
||||
|
||||
#include <boost/numeric/mtl/vector/dense_vector.hpp>
|
||||
#include <boost/numeric/mtl/matrix/dense2D.hpp>
|
||||
#include <boost/numeric/mtl/matrix/compressed2D.hpp>
|
||||
|
||||
|
||||
namespace boost {
|
||||
namespace numeric {
|
||||
namespace odeint {
|
||||
|
||||
|
||||
template< class Value , class Parameters >
|
||||
struct is_resizeable< mtl::dense_vector< Value , Parameters > >
|
||||
{
|
||||
typedef boost::true_type type;
|
||||
const static bool value = type::value;
|
||||
};
|
||||
|
||||
template< class Value , class Parameters >
|
||||
struct is_resizeable< mtl::dense2D< Value , Parameters > >
|
||||
{
|
||||
typedef boost::true_type type;
|
||||
const static bool value = type::value;
|
||||
};
|
||||
|
||||
template< class Value , class Parameters >
|
||||
struct is_resizeable< mtl::compressed2D< Value , Parameters > >
|
||||
{
|
||||
typedef boost::true_type type;
|
||||
const static bool value = type::value;
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
template< class Value , class Parameters >
|
||||
struct same_size_impl< mtl::dense_vector< Value , Parameters > , mtl::dense_vector< Value , Parameters > >
|
||||
{
|
||||
static bool same_size( const mtl::dense_vector< Value , Parameters > &v1 ,
|
||||
const mtl::dense_vector< Value , Parameters > &v2 )
|
||||
{
|
||||
return mtl::size( v1 ) == mtl::size( v2 );
|
||||
}
|
||||
};
|
||||
|
||||
template< class Value , class Parameters >
|
||||
struct resize_impl< mtl::dense_vector< Value , Parameters > , mtl::dense_vector< Value , Parameters > >
|
||||
{
|
||||
static void resize( mtl::dense_vector< Value , Parameters > &v1 ,
|
||||
const mtl::dense_vector< Value , Parameters > &v2 )
|
||||
{
|
||||
v1.change_dim( mtl::size( v2 ) );
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
|
||||
template< class Value , class MatrixParameters , class VectorParameters >
|
||||
struct same_size_impl< mtl::dense2D< Value , MatrixParameters > , mtl::dense_vector< Value , VectorParameters > >
|
||||
{
|
||||
static bool same_size( const mtl::dense2D< Value , MatrixParameters > &m ,
|
||||
const mtl::dense_vector< Value , VectorParameters > &v )
|
||||
{
|
||||
return ( ( mtl::size( v ) == m.num_cols() ) && ( mtl::size( v ) == m.num_rows() ) );
|
||||
}
|
||||
};
|
||||
|
||||
template< class Value , class MatrixParameters , class VectorParameters >
|
||||
struct resize_impl< mtl::dense2D< Value , MatrixParameters > , mtl::dense_vector< Value , VectorParameters > >
|
||||
{
|
||||
static void resize( mtl::dense2D< Value , MatrixParameters > &m ,
|
||||
const mtl::dense_vector< Value , VectorParameters > &v )
|
||||
{
|
||||
m.change_dim( mtl::size( v ) , mtl::size( v ) , false );
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
template< class Value , class MatrixParameters , class VectorParameters >
|
||||
struct same_size_impl< mtl::compressed2D< Value , MatrixParameters > , mtl::dense_vector< Value , VectorParameters > >
|
||||
{
|
||||
static bool same_size( const mtl::compressed2D< Value , MatrixParameters > &m ,
|
||||
const mtl::dense_vector< Value , VectorParameters > &v )
|
||||
{
|
||||
return ( ( mtl::size( v ) == m.num_cols() ) && ( mtl::size( v ) == m.num_rows() ) );
|
||||
}
|
||||
};
|
||||
|
||||
template< class Value , class MatrixParameters , class VectorParameters >
|
||||
struct resize_impl< mtl::compressed2D< Value , MatrixParameters > , mtl::dense_vector< Value , VectorParameters > >
|
||||
{
|
||||
static void resize( mtl::compressed2D< Value , MatrixParameters > &m ,
|
||||
const mtl::dense_vector< Value , VectorParameters > &v )
|
||||
{
|
||||
m.change_dim( mtl::size( v ) , mtl::size( v ) );
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
} // namespace odeint
|
||||
} // namespace numeric
|
||||
} // namespace boost
|
||||
|
||||
#endif // BOOST_NUMERIC_ODEINT_EXTERNAL_MTL4_RESIZE_HPP_INCLUDED
|
||||
@@ -0,0 +1,59 @@
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
/// \file lazy.hpp
|
||||
/// Contains definition of the lazy<> transform.
|
||||
//
|
||||
// Copyright 2008 Eric Niebler. Distributed under the Boost
|
||||
// Software License, Version 1.0. (See accompanying file
|
||||
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
#ifndef BOOST_PROTO_TRANSFORM_LAZY_HPP_EAN_12_02_2007
|
||||
#define BOOST_PROTO_TRANSFORM_LAZY_HPP_EAN_12_02_2007
|
||||
|
||||
#include <boost/preprocessor/iteration/iterate.hpp>
|
||||
#include <boost/preprocessor/repetition/enum_params.hpp>
|
||||
#include <boost/preprocessor/repetition/enum_trailing_params.hpp>
|
||||
#include <boost/proto/proto_fwd.hpp>
|
||||
#include <boost/proto/transform/make.hpp>
|
||||
#include <boost/proto/transform/call.hpp>
|
||||
#include <boost/proto/transform/impl.hpp>
|
||||
#include <boost/proto/transform/detail/pack.hpp>
|
||||
|
||||
namespace boost { namespace proto
|
||||
{
|
||||
/// \brief A PrimitiveTransform that uses <tt>make\<\></tt> to build
|
||||
/// a CallableTransform, and then uses <tt>call\<\></tt> to apply it.
|
||||
///
|
||||
/// <tt>lazy\<\></tt> is useful as a higher-order transform, when the
|
||||
/// transform to be applied depends on the current state of the
|
||||
/// transformation. The invocation of the <tt>make\<\></tt> transform
|
||||
/// evaluates any nested transforms, and the resulting type is treated
|
||||
/// as a CallableTransform, which is evaluated with <tt>call\<\></tt>.
|
||||
template<typename Object>
|
||||
struct lazy : transform<lazy<Object> >
|
||||
{
|
||||
template<typename Expr, typename State, typename Data>
|
||||
struct impl
|
||||
: call<
|
||||
typename make<Object>::template impl<Expr, State, Data>::result_type
|
||||
>::template impl<Expr, State, Data>
|
||||
{};
|
||||
};
|
||||
|
||||
/// INTERNAL ONLY
|
||||
template<typename Fun>
|
||||
struct lazy<detail::msvc_fun_workaround<Fun> >
|
||||
: lazy<Fun>
|
||||
{};
|
||||
|
||||
#include <boost/proto/transform/detail/lazy.hpp>
|
||||
|
||||
/// INTERNAL ONLY
|
||||
///
|
||||
template<typename Object>
|
||||
struct is_callable<lazy<Object> >
|
||||
: mpl::true_
|
||||
{};
|
||||
|
||||
}}
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,88 @@
|
||||
// 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 2007 Anthony Williams
|
||||
// (C) Copyright 2011-2012 Vicente J. Botet Escriba
|
||||
|
||||
#ifndef BOOST_THREAD_LOCK_GUARD_HPP
|
||||
#define BOOST_THREAD_LOCK_GUARD_HPP
|
||||
|
||||
#include <boost/thread/detail/config.hpp>
|
||||
#include <boost/thread/detail/delete.hpp>
|
||||
#include <boost/thread/detail/move.hpp>
|
||||
#include <boost/thread/detail/lockable_wrapper.hpp>
|
||||
#include <boost/thread/lock_options.hpp>
|
||||
#if ! defined BOOST_THREAD_PROVIDES_NESTED_LOCKS
|
||||
#include <boost/thread/is_locked_by_this_thread.hpp>
|
||||
#include <boost/assert.hpp>
|
||||
#endif
|
||||
|
||||
#include <boost/config/abi_prefix.hpp>
|
||||
|
||||
namespace boost
|
||||
{
|
||||
|
||||
template <typename Mutex>
|
||||
class lock_guard
|
||||
{
|
||||
private:
|
||||
Mutex& m;
|
||||
|
||||
public:
|
||||
typedef Mutex mutex_type;
|
||||
BOOST_THREAD_NO_COPYABLE( lock_guard )
|
||||
|
||||
explicit lock_guard(Mutex& m_) :
|
||||
m(m_)
|
||||
{
|
||||
m.lock();
|
||||
}
|
||||
|
||||
lock_guard(Mutex& m_, adopt_lock_t) :
|
||||
m(m_)
|
||||
{
|
||||
#if ! defined BOOST_THREAD_PROVIDES_NESTED_LOCKS
|
||||
BOOST_ASSERT(is_locked_by_this_thread(m));
|
||||
#endif
|
||||
}
|
||||
|
||||
#if ! defined BOOST_THREAD_NO_CXX11_HDR_INITIALIZER_LIST
|
||||
lock_guard(std::initializer_list<thread_detail::lockable_wrapper<Mutex> > l_) :
|
||||
m(*(const_cast<thread_detail::lockable_wrapper<Mutex>*>(l_.begin())->m))
|
||||
{
|
||||
m.lock();
|
||||
}
|
||||
|
||||
lock_guard(std::initializer_list<thread_detail::lockable_adopt_wrapper<Mutex> > l_) :
|
||||
m(*(const_cast<thread_detail::lockable_adopt_wrapper<Mutex>*>(l_.begin())->m))
|
||||
{
|
||||
#if ! defined BOOST_THREAD_PROVIDES_NESTED_LOCKS
|
||||
BOOST_ASSERT(is_locked_by_this_thread(m));
|
||||
#endif
|
||||
}
|
||||
|
||||
#endif
|
||||
~lock_guard()
|
||||
{
|
||||
m.unlock();
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
#if ! defined BOOST_THREAD_NO_MAKE_LOCK_GUARD
|
||||
template <typename Lockable>
|
||||
lock_guard<Lockable> make_lock_guard(Lockable& mtx)
|
||||
{
|
||||
return { thread_detail::lockable_wrapper<Lockable>(mtx) };
|
||||
}
|
||||
template <typename Lockable>
|
||||
lock_guard<Lockable> make_lock_guard(Lockable& mtx, adopt_lock_t)
|
||||
{
|
||||
return { thread_detail::lockable_adopt_wrapper<Lockable>(mtx) };
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
#include <boost/config/abi_suffix.hpp>
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,486 @@
|
||||
#include "WSPRBandHopping.hpp"
|
||||
|
||||
#include <random>
|
||||
|
||||
#include <QPointer>
|
||||
#include <QSettings>
|
||||
#include <QBitArray>
|
||||
#include <QList>
|
||||
#include <QSet>
|
||||
#include <QtWidgets>
|
||||
|
||||
#include "SettingsGroup.hpp"
|
||||
#include "Configuration.hpp"
|
||||
#include "Bands.hpp"
|
||||
#include "FrequencyList.hpp"
|
||||
#include "WsprTxScheduler.h"
|
||||
#include "pimpl_impl.hpp"
|
||||
#include "moc_WSPRBandHopping.cpp"
|
||||
|
||||
extern "C"
|
||||
{
|
||||
#ifndef CMAKE_BUILD
|
||||
#define FC_grayline grayline_
|
||||
#else
|
||||
#include "FC.h"
|
||||
void FC_grayline (int const * year, int const * month, int const * nday, float const * uth, char const * my_grid
|
||||
, int const * nduration, int * isun
|
||||
, int my_grid_len);
|
||||
#endif
|
||||
};
|
||||
|
||||
namespace
|
||||
{
|
||||
char const * const title = "WSPR Band Hopping";
|
||||
char const * const periods[] = {"Sunrise grayline", "Day", "Sunset grayline", "Night", "Tune", "Rx only"};
|
||||
size_t constexpr num_periods {sizeof (periods) / sizeof (periods[0])};
|
||||
// These 10 bands are globally coordinated
|
||||
QList<QString> const coordinated_bands = {"160m", "80m", "60m", "40m", "30m", "20m", "17m", "15m", "12m", "10m"};
|
||||
}
|
||||
|
||||
//
|
||||
// Dialog - maintenance of band hopping options
|
||||
//
|
||||
class Dialog
|
||||
: public QDialog
|
||||
{
|
||||
public:
|
||||
using BandList = QList<QString>;
|
||||
|
||||
Dialog (QSettings *, Configuration const *, BandList const * WSPT_bands, QBitArray * bands
|
||||
, int * gray_line_duration, QWidget * parent = nullptr);
|
||||
~Dialog ();
|
||||
|
||||
Q_SLOT void frequencies_changed ();
|
||||
void resize_to_maximum ();
|
||||
|
||||
private:
|
||||
void closeEvent (QCloseEvent *) override;
|
||||
void save_window_state ();
|
||||
|
||||
QSettings * settings_;
|
||||
Configuration const * configuration_;
|
||||
BandList const * WSPR_bands_;
|
||||
QBitArray * bands_;
|
||||
int * gray_line_duration_;
|
||||
QPointer<QTableWidget> bands_table_;
|
||||
QBrush coord_background_brush_;
|
||||
QPointer<QSpinBox> gray_line_width_spin_box_;
|
||||
static int constexpr band_index_role {Qt::UserRole};
|
||||
};
|
||||
|
||||
Dialog::Dialog (QSettings * settings, Configuration const * configuration, BandList const * WSPR_bands
|
||||
, QBitArray * bands, int * gray_line_duration, QWidget * parent)
|
||||
: QDialog {parent, Qt::Window | Qt::WindowTitleHint | Qt::WindowCloseButtonHint | Qt::WindowMinimizeButtonHint}
|
||||
, settings_ {settings}
|
||||
, configuration_ {configuration}
|
||||
, WSPR_bands_ {WSPR_bands}
|
||||
, bands_ {bands}
|
||||
, gray_line_duration_ {gray_line_duration}
|
||||
, bands_table_ {new QTableWidget {this}}
|
||||
, coord_background_brush_ {Qt::yellow}
|
||||
, gray_line_width_spin_box_ {new QSpinBox {this}}
|
||||
{
|
||||
setWindowTitle (windowTitle () + ' ' + tr (title));
|
||||
{
|
||||
SettingsGroup g {settings_, title};
|
||||
restoreGeometry (settings_->value ("geometry", saveGeometry ()).toByteArray ());
|
||||
}
|
||||
|
||||
QVBoxLayout * main_layout {new QVBoxLayout};
|
||||
|
||||
bands_table_->setRowCount (num_periods);
|
||||
bands_table_->setVerticalScrollBarPolicy (Qt::ScrollBarAlwaysOff);
|
||||
bands_table_->setHorizontalScrollBarPolicy (Qt::ScrollBarAlwaysOff);
|
||||
bands_table_->setSizePolicy (QSizePolicy::Expanding, QSizePolicy::Expanding);
|
||||
frequencies_changed ();
|
||||
main_layout->addWidget (bands_table_);
|
||||
// recalculate table when frequencies change
|
||||
connect (configuration_->frequencies (), &QAbstractItemModel::layoutChanged
|
||||
, this, &Dialog::frequencies_changed);
|
||||
// handle changes by updating the underlying flags
|
||||
connect (bands_table_.data (), &QTableWidget::itemChanged, [this] (QTableWidgetItem * item) {
|
||||
auto band_number = item->data (band_index_role).toInt ();
|
||||
bands_[item->row ()].setBit (band_number, Qt::Checked == item->checkState ());
|
||||
});
|
||||
|
||||
// set up the gray line duration spin box
|
||||
gray_line_width_spin_box_->setRange (1, 60 * 2);
|
||||
gray_line_width_spin_box_->setSuffix ("min");
|
||||
gray_line_width_spin_box_->setValue (*gray_line_duration_);
|
||||
QFormLayout * form_layout = new QFormLayout;
|
||||
form_layout->addRow (tr ("Gray time:"), gray_line_width_spin_box_);
|
||||
connect (gray_line_width_spin_box_.data ()
|
||||
, static_cast<void (QSpinBox::*) (int)> (&QSpinBox::valueChanged)
|
||||
, [this] (int new_value) {*gray_line_duration_ = new_value;});
|
||||
|
||||
QHBoxLayout * bottom_layout = new QHBoxLayout;
|
||||
bottom_layout->addStretch ();
|
||||
bottom_layout->addLayout (form_layout);
|
||||
main_layout->addLayout (bottom_layout);
|
||||
|
||||
setLayout (main_layout);
|
||||
}
|
||||
|
||||
Dialog::~Dialog ()
|
||||
{
|
||||
// do this here too because ESC or parent shutdown closing this
|
||||
// window doesn't queue a close event
|
||||
save_window_state ();
|
||||
}
|
||||
|
||||
void Dialog::closeEvent (QCloseEvent * e)
|
||||
{
|
||||
save_window_state ();
|
||||
QDialog::closeEvent (e);
|
||||
}
|
||||
|
||||
void Dialog::save_window_state ()
|
||||
{
|
||||
SettingsGroup g {settings_, title};
|
||||
settings_->setValue ("geometry", saveGeometry ());
|
||||
}
|
||||
|
||||
void Dialog::frequencies_changed ()
|
||||
{
|
||||
bands_table_->setColumnCount (WSPR_bands_->size ());
|
||||
// set up and load the table of check boxes
|
||||
for (auto row = 0u; row < num_periods; ++row)
|
||||
{
|
||||
auto vertical_header = new QTableWidgetItem {periods[row]};
|
||||
vertical_header->setTextAlignment (Qt::AlignRight | Qt::AlignVCenter);
|
||||
bands_table_->setVerticalHeaderItem (row, vertical_header);
|
||||
int column {0};
|
||||
int band_number {0};
|
||||
for (auto const& band : *configuration_->bands ())
|
||||
{
|
||||
if (WSPR_bands_->contains (band))
|
||||
{
|
||||
if (0 == row)
|
||||
{
|
||||
auto horizontal_header = new QTableWidgetItem {band};
|
||||
bands_table_->setHorizontalHeaderItem (column, horizontal_header);
|
||||
}
|
||||
auto item = new QTableWidgetItem;
|
||||
item->setFlags (Qt::ItemIsUserCheckable | Qt::ItemIsEnabled);
|
||||
item->setCheckState (bands_[row].testBit (band_number) ? Qt::Checked : Qt::Unchecked);
|
||||
item->setData (band_index_role, band_number);
|
||||
if (coordinated_bands.contains (band))
|
||||
{
|
||||
item->setBackground (coord_background_brush_);
|
||||
}
|
||||
bands_table_->setItem (row, column, item);
|
||||
++column;
|
||||
}
|
||||
++band_number;
|
||||
}
|
||||
}
|
||||
bands_table_->resizeColumnsToContents ();
|
||||
auto is_visible = isVisible ();
|
||||
show ();
|
||||
resize_to_maximum ();
|
||||
adjustSize (); // fix the size
|
||||
if (!is_visible)
|
||||
{
|
||||
hide ();
|
||||
}
|
||||
}
|
||||
|
||||
// to get the dialog window exactly the right size to contain the
|
||||
// widgets without needing scroll bars we need to measure the size of
|
||||
// the table widget and set its minimum size to the measured size
|
||||
void Dialog::resize_to_maximum ()
|
||||
{
|
||||
bands_table_->setMinimumSize ({
|
||||
bands_table_->horizontalHeader ()->length ()
|
||||
+ bands_table_->verticalHeader ()->width ()
|
||||
+ 2 * bands_table_->frameWidth ()
|
||||
, bands_table_->verticalHeader ()->length ()
|
||||
+ bands_table_->horizontalHeader ()->height ()
|
||||
+ 2 * bands_table_->frameWidth ()
|
||||
});
|
||||
bands_table_->setMaximumSize (bands_table_->minimumSize ());
|
||||
}
|
||||
|
||||
class WSPRBandHopping::impl
|
||||
{
|
||||
public:
|
||||
using BandList = Dialog::BandList;
|
||||
|
||||
impl (QSettings * settings, Configuration const * configuration, QWidget * parent_widget)
|
||||
: settings_ {settings}
|
||||
, configuration_ {configuration}
|
||||
, tx_percent_ {0}
|
||||
, parent_widget_ {parent_widget}
|
||||
, last_was_tx_ {false}
|
||||
, carry_ {false}
|
||||
, seed_ {{rand (), rand (), rand (), rand (), rand (), rand (), rand (), rand ()}}
|
||||
, gen_ {seed_}
|
||||
, dist_ {1, 100}
|
||||
{
|
||||
auto num_bands = configuration_->bands ()->rowCount ();
|
||||
for (auto& flags : bands_)
|
||||
{
|
||||
flags.resize (num_bands);
|
||||
}
|
||||
}
|
||||
|
||||
bool simple_scheduler ();
|
||||
|
||||
QSettings * settings_;
|
||||
Configuration const * configuration_;
|
||||
int tx_percent_;
|
||||
BandList WSPR_bands_;
|
||||
BandList rx_permutation_;
|
||||
BandList tx_permutation_;
|
||||
QWidget * parent_widget_;
|
||||
|
||||
// 5 x 10 bit flags representing each hopping band in each period
|
||||
// and tune
|
||||
QBitArray bands_[num_periods];
|
||||
|
||||
int gray_line_duration_;
|
||||
QPointer<Dialog> dialog_;
|
||||
bool last_was_tx_;
|
||||
bool carry_;
|
||||
std::seed_seq seed_;
|
||||
std::mt19937 gen_;
|
||||
std::uniform_int_distribution<int> dist_;
|
||||
};
|
||||
|
||||
bool WSPRBandHopping::impl::simple_scheduler ()
|
||||
{
|
||||
auto tx = carry_ || tx_percent_ > dist_ (gen_);
|
||||
if (carry_)
|
||||
{
|
||||
carry_ = false;
|
||||
}
|
||||
else if (tx_percent_ < 40 && last_was_tx_ && tx)
|
||||
{
|
||||
// if percentage is less than 40 then avoid consecutive tx but
|
||||
// always catch up on the next round
|
||||
tx = false;
|
||||
carry_ = true;
|
||||
}
|
||||
last_was_tx_ = tx;
|
||||
return tx;
|
||||
}
|
||||
|
||||
WSPRBandHopping::WSPRBandHopping (QSettings * settings, Configuration const * configuration, QWidget * parent_widget)
|
||||
: m_ {settings, configuration, parent_widget}
|
||||
{
|
||||
// detect changes to the working frequencies model
|
||||
m_->WSPR_bands_ = m_->configuration_->frequencies ()->all_bands (m_->configuration_->region (), Modes::WSPR).toList ();
|
||||
connect (m_->configuration_->frequencies (), &QAbstractItemModel::layoutChanged
|
||||
, [this] () {
|
||||
m_->WSPR_bands_ = m_->configuration_->frequencies ()->all_bands (m_->configuration_->region (), Modes::WSPR).toList ();
|
||||
});
|
||||
|
||||
// load settings
|
||||
SettingsGroup g {m_->settings_, title};
|
||||
size_t size = m_->settings_->beginReadArray ("phases");
|
||||
for (auto i = 0u; i < size; ++i)
|
||||
{
|
||||
if (i < num_periods)
|
||||
{
|
||||
m_->settings_->setArrayIndex (i);
|
||||
m_->bands_[i] = m_->settings_->value ("bands").toBitArray ();
|
||||
}
|
||||
}
|
||||
m_->settings_->endArray ();
|
||||
m_->gray_line_duration_ = m_->settings_->value ("GrayLineDuration", 60).toUInt ();
|
||||
}
|
||||
|
||||
WSPRBandHopping::~WSPRBandHopping ()
|
||||
{
|
||||
// save settings
|
||||
SettingsGroup g {m_->settings_, title};
|
||||
m_->settings_->beginWriteArray ("phases");
|
||||
for (auto i = 0u; i < num_periods; ++i)
|
||||
{
|
||||
m_->settings_->setArrayIndex (i);
|
||||
m_->settings_->setValue ("bands", m_->bands_[i]);
|
||||
}
|
||||
m_->settings_->endArray ();
|
||||
m_->settings_->setValue ("GrayLineDuration", m_->gray_line_duration_);
|
||||
}
|
||||
|
||||
// pop up the maintenance dialog window
|
||||
void WSPRBandHopping::show_dialog (bool /* checked */)
|
||||
{
|
||||
if (!m_->dialog_)
|
||||
{
|
||||
m_->dialog_ = new Dialog {m_->settings_, m_->configuration_, &m_->WSPR_bands_, m_->bands_
|
||||
, &m_->gray_line_duration_, m_->parent_widget_};
|
||||
}
|
||||
m_->dialog_->show ();
|
||||
m_->dialog_->raise ();
|
||||
m_->dialog_->activateWindow ();
|
||||
}
|
||||
|
||||
int WSPRBandHopping::tx_percent () const
|
||||
{
|
||||
return m_->tx_percent_;
|
||||
}
|
||||
|
||||
void WSPRBandHopping::set_tx_percent (int new_value)
|
||||
{
|
||||
m_->tx_percent_ = new_value;
|
||||
}
|
||||
|
||||
// determine the parameters of the hop, if any
|
||||
auto WSPRBandHopping::next_hop (bool tx_enabled) -> Hop
|
||||
{
|
||||
auto const& now = QDateTime::currentDateTimeUtc ();
|
||||
auto const& date = now.date ();
|
||||
auto year = date.year ();
|
||||
auto month = date.month ();
|
||||
auto day = date.day ();
|
||||
auto const& time = now.time ();
|
||||
float uth = time.hour () + time.minute () / 60.
|
||||
+ (time.second () + .001 * time.msec ()) / 3600.;
|
||||
auto my_grid = m_->configuration_->my_grid ();
|
||||
int period_index;
|
||||
int band_index;
|
||||
int tx_next;
|
||||
|
||||
my_grid = (my_grid + " ").left (6); // hopping doesn't like
|
||||
// short grids
|
||||
|
||||
// look up the period for this time
|
||||
FC_grayline (&year, &month, &day, &uth, my_grid.toLatin1 ().constData ()
|
||||
, &m_->gray_line_duration_, &period_index
|
||||
, my_grid.size ());
|
||||
|
||||
band_index = next_hopping_band();
|
||||
|
||||
tx_next = next_is_tx () && tx_enabled;
|
||||
|
||||
int frequencies_index {-1};
|
||||
auto const& frequencies = m_->configuration_->frequencies ();
|
||||
auto const& bands = m_->configuration_->bands ();
|
||||
auto band_name = bands->data (bands->index (band_index + 3, 0)).toString ();
|
||||
if (m_->bands_[period_index].testBit (band_index + 3) // +3 for
|
||||
// coordinated bands
|
||||
&& m_->WSPR_bands_.contains (band_name))
|
||||
{
|
||||
// here we have a band that has been enabled in the hopping
|
||||
// matrix so check it it has a configured working frequency
|
||||
frequencies_index = frequencies->best_working_frequency (band_name);
|
||||
}
|
||||
|
||||
// if we do not have a configured working frequency on the selected
|
||||
// coordinated hopping band we next pick from a random permutation
|
||||
// of the other enabled bands in the hopping bands matrix
|
||||
if (frequencies_index < 0)
|
||||
{
|
||||
// build sets of available rx and tx bands
|
||||
auto target_rx_bands = m_->WSPR_bands_.toSet ();
|
||||
auto target_tx_bands = target_rx_bands;
|
||||
for (auto i = 0; i < m_->bands_[period_index].size (); ++i)
|
||||
{
|
||||
auto const& band = bands->data (bands->index (i, 0)).toString ();
|
||||
// remove bands that are not enabled for hopping in this phase
|
||||
if (!m_->bands_[period_index].testBit (i))
|
||||
{
|
||||
target_rx_bands.remove (band);
|
||||
target_tx_bands.remove (band);
|
||||
}
|
||||
// remove rx only bands from transmit list and vice versa
|
||||
if (m_->bands_[5].testBit (i))
|
||||
{
|
||||
target_tx_bands.remove (band);
|
||||
}
|
||||
else
|
||||
{
|
||||
target_rx_bands.remove (band);
|
||||
}
|
||||
}
|
||||
// if we have some bands to permute
|
||||
if (target_rx_bands.size () + target_tx_bands.size ())
|
||||
{
|
||||
if (!(m_->rx_permutation_.size () + m_->tx_permutation_.size ()) // all used up
|
||||
// or rx list contains a band no longer scheduled
|
||||
|| !target_rx_bands.contains (m_->rx_permutation_.toSet ())
|
||||
// or tx list contains a band no longer scheduled for tx
|
||||
|| !target_tx_bands.contains (m_->tx_permutation_.toSet ()))
|
||||
{
|
||||
// build new random permutations
|
||||
m_->rx_permutation_ = target_rx_bands.toList ();
|
||||
std::random_shuffle (std::begin (m_->rx_permutation_), std::end (m_->rx_permutation_));
|
||||
m_->tx_permutation_ = target_tx_bands.toList ();
|
||||
std::random_shuffle (std::begin (m_->tx_permutation_), std::end (m_->tx_permutation_));
|
||||
// qDebug () << "New random Rx permutation:" << m_->rx_permutation_
|
||||
// << "random Tx permutation:" << m_->tx_permutation_;
|
||||
}
|
||||
if ((tx_next && m_->tx_permutation_.size ()) || !m_->rx_permutation_.size ())
|
||||
{
|
||||
Q_ASSERT (m_->tx_permutation_.size ());
|
||||
// use one from the current random tx permutation
|
||||
band_name = m_->tx_permutation_.takeFirst ();
|
||||
}
|
||||
else
|
||||
{
|
||||
Q_ASSERT (m_->rx_permutation_.size ());
|
||||
// use one from the current random rx permutation
|
||||
band_name = m_->rx_permutation_.takeFirst ();
|
||||
}
|
||||
// find the first WSPR working frequency for the chosen band
|
||||
frequencies_index = frequencies->best_working_frequency (band_name);
|
||||
if (frequencies_index >= 0) // should be a redundant check,
|
||||
// but to be safe
|
||||
{
|
||||
// we can use the random choice
|
||||
// qDebug () << "random:" << frequencies->data (frequencies->index (frequencies_index, FrequencyList_v2::frequency_column)).toString ();
|
||||
band_index = bands->find (band_name);
|
||||
if (band_index < 0) // this shouldn't happen
|
||||
{
|
||||
Q_ASSERT (band_index >= 0);
|
||||
frequencies_index = -1;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
band_index += 3;
|
||||
// qDebug () << "scheduled:" << frequencies->data (frequencies->index (frequencies_index, FrequencyList_v2::frequency_column)).toString ();
|
||||
// remove from random permutations to stop the coordinated bands
|
||||
// getting too high a weighting - not perfect but surely helps
|
||||
m_->rx_permutation_.removeOne (band_name);
|
||||
m_->tx_permutation_.removeOne (band_name);
|
||||
}
|
||||
|
||||
return {
|
||||
periods[period_index]
|
||||
|
||||
, frequencies_index
|
||||
|
||||
, frequencies_index >= 0 // new band
|
||||
&& tx_enabled // transmit is allowed
|
||||
&& !tx_next // not going to Tx anyway
|
||||
&& m_->bands_[4].testBit (band_index) // tune up required
|
||||
&& !m_->bands_[5].testBit (band_index) // not an Rx only band
|
||||
|
||||
, frequencies_index >= 0 // new band
|
||||
&& tx_next // Tx scheduled
|
||||
&& !m_->bands_[5].testBit (band_index) // not an Rx only band
|
||||
};
|
||||
}
|
||||
|
||||
bool WSPRBandHopping::next_is_tx (bool simple_schedule)
|
||||
{
|
||||
if (simple_schedule)
|
||||
{
|
||||
return m_->simple_scheduler ();
|
||||
}
|
||||
if (100 == m_->tx_percent_)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
// consult scheduler to determine if next period should be a tx interval
|
||||
return next_tx_state(m_->tx_percent_);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,92 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2001-2011 Joel de Guzman
|
||||
|
||||
Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
==============================================================================*/
|
||||
#if !defined(FUSION_TRANSFORM_VIEW_ITERATOR_07162005_1033)
|
||||
#define FUSION_TRANSFORM_VIEW_ITERATOR_07162005_1033
|
||||
|
||||
#include <boost/fusion/support/config.hpp>
|
||||
#include <boost/fusion/support/iterator_base.hpp>
|
||||
#include <boost/fusion/support/category_of.hpp>
|
||||
#include <boost/fusion/iterator/mpl/convert_iterator.hpp>
|
||||
#include <boost/fusion/adapted/mpl/mpl_iterator.hpp>
|
||||
#include <boost/fusion/view/transform_view/detail/deref_impl.hpp>
|
||||
#include <boost/fusion/view/transform_view/detail/next_impl.hpp>
|
||||
#include <boost/fusion/view/transform_view/detail/prior_impl.hpp>
|
||||
#include <boost/fusion/view/transform_view/detail/value_of_impl.hpp>
|
||||
#include <boost/fusion/view/transform_view/detail/advance_impl.hpp>
|
||||
#include <boost/fusion/view/transform_view/detail/distance_impl.hpp>
|
||||
#include <boost/fusion/view/transform_view/detail/equal_to_impl.hpp>
|
||||
|
||||
namespace boost { namespace fusion
|
||||
{
|
||||
// Unary Version
|
||||
struct transform_view_iterator_tag;
|
||||
|
||||
template <typename First, typename F>
|
||||
struct transform_view_iterator
|
||||
: iterator_base<transform_view_iterator<First, F> >
|
||||
{
|
||||
typedef transform_view_iterator_tag fusion_tag;
|
||||
typedef convert_iterator<First> converter;
|
||||
typedef typename converter::type first_type;
|
||||
typedef typename traits::category_of<first_type>::type category;
|
||||
typedef F transform_type;
|
||||
|
||||
BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
|
||||
transform_view_iterator(First const& in_first, F const& in_f)
|
||||
: first(converter::call(in_first)), f(in_f) {}
|
||||
|
||||
first_type first;
|
||||
transform_type f;
|
||||
|
||||
private:
|
||||
// silence MSVC warning C4512: assignment operator could not be generated
|
||||
transform_view_iterator& operator= (transform_view_iterator const&);
|
||||
};
|
||||
|
||||
// Binary Version
|
||||
struct transform_view_iterator2_tag;
|
||||
|
||||
template <typename First1, typename First2, typename F>
|
||||
struct transform_view_iterator2
|
||||
: iterator_base<transform_view_iterator2<First1, First2, F> >
|
||||
{
|
||||
typedef transform_view_iterator2_tag fusion_tag;
|
||||
typedef convert_iterator<First1> converter1;
|
||||
typedef convert_iterator<First2> converter2;
|
||||
typedef typename converter1::type first1_type;
|
||||
typedef typename converter2::type first2_type;
|
||||
typedef typename traits::category_of<first1_type>::type category;
|
||||
typedef F transform_type;
|
||||
|
||||
BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
|
||||
transform_view_iterator2(First1 const& in_first1, First2 const& in_first2, F const& in_f)
|
||||
: first1(converter1::call(in_first1)), first2(converter2::call(in_first2)), f(in_f) {}
|
||||
|
||||
first1_type first1;
|
||||
first2_type first2;
|
||||
transform_type f;
|
||||
|
||||
private:
|
||||
// silence MSVC warning C4512: assignment operator could not be generated
|
||||
transform_view_iterator2& operator= (transform_view_iterator2 const&);
|
||||
};
|
||||
}}
|
||||
|
||||
#ifdef BOOST_FUSION_WORKAROUND_FOR_LWG_2408
|
||||
namespace std
|
||||
{
|
||||
template <typename First, typename F>
|
||||
struct iterator_traits< ::boost::fusion::transform_view_iterator<First, F> >
|
||||
{ };
|
||||
template <typename First1, typename First2, typename F>
|
||||
struct iterator_traits< ::boost::fusion::transform_view_iterator2<First1, First2, F> >
|
||||
{ };
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
@@ -0,0 +1,232 @@
|
||||
/* Boost interval/transc.hpp template implementation file
|
||||
*
|
||||
* Copyright 2000 Jens Maurer
|
||||
* Copyright 2002 Hervé Brönnimann, Guillaume Melquiond, Sylvain Pion
|
||||
*
|
||||
* Distributed under the Boost Software License, Version 1.0.
|
||||
* (See accompanying file LICENSE_1_0.txt or
|
||||
* copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
*/
|
||||
|
||||
#ifndef BOOST_NUMERIC_INTERVAL_TRANSC_HPP
|
||||
#define BOOST_NUMERIC_INTERVAL_TRANSC_HPP
|
||||
|
||||
#include <boost/config.hpp>
|
||||
#include <boost/numeric/interval/detail/interval_prototype.hpp>
|
||||
#include <boost/numeric/interval/detail/bugs.hpp>
|
||||
#include <boost/numeric/interval/detail/test_input.hpp>
|
||||
#include <boost/numeric/interval/rounding.hpp>
|
||||
#include <boost/numeric/interval/constants.hpp>
|
||||
#include <boost/numeric/interval/arith.hpp>
|
||||
#include <boost/numeric/interval/arith2.hpp>
|
||||
#include <algorithm>
|
||||
|
||||
namespace boost {
|
||||
namespace numeric {
|
||||
|
||||
template<class T, class Policies> inline
|
||||
interval<T, Policies> exp(const interval<T, Policies>& x)
|
||||
{
|
||||
typedef interval<T, Policies> I;
|
||||
if (interval_lib::detail::test_input(x))
|
||||
return I::empty();
|
||||
typename Policies::rounding rnd;
|
||||
return I(rnd.exp_down(x.lower()), rnd.exp_up(x.upper()), true);
|
||||
}
|
||||
|
||||
template<class T, class Policies> inline
|
||||
interval<T, Policies> log(const interval<T, Policies>& x)
|
||||
{
|
||||
typedef interval<T, Policies> I;
|
||||
if (interval_lib::detail::test_input(x) ||
|
||||
!interval_lib::user::is_pos(x.upper()))
|
||||
return I::empty();
|
||||
typename Policies::rounding rnd;
|
||||
typedef typename Policies::checking checking;
|
||||
T l = !interval_lib::user::is_pos(x.lower())
|
||||
? checking::neg_inf() : rnd.log_down(x.lower());
|
||||
return I(l, rnd.log_up(x.upper()), true);
|
||||
}
|
||||
|
||||
template<class T, class Policies> inline
|
||||
interval<T, Policies> cos(const interval<T, Policies>& x)
|
||||
{
|
||||
if (interval_lib::detail::test_input(x))
|
||||
return interval<T, Policies>::empty();
|
||||
typename Policies::rounding rnd;
|
||||
typedef interval<T, Policies> I;
|
||||
typedef typename interval_lib::unprotect<I>::type R;
|
||||
|
||||
// get lower bound within [0, pi]
|
||||
const R pi2 = interval_lib::pi_twice<R>();
|
||||
R tmp = fmod((const R&)x, pi2);
|
||||
if (width(tmp) >= pi2.lower())
|
||||
return I(static_cast<T>(-1), static_cast<T>(1), true); // we are covering a full period
|
||||
if (tmp.lower() >= interval_lib::constants::pi_upper<T>())
|
||||
return -cos(tmp - interval_lib::pi<R>());
|
||||
T l = tmp.lower();
|
||||
T u = tmp.upper();
|
||||
|
||||
BOOST_USING_STD_MIN();
|
||||
// separate into monotone subintervals
|
||||
if (u <= interval_lib::constants::pi_lower<T>())
|
||||
return I(rnd.cos_down(u), rnd.cos_up(l), true);
|
||||
else if (u <= pi2.lower())
|
||||
return I(static_cast<T>(-1), rnd.cos_up(min BOOST_PREVENT_MACRO_SUBSTITUTION(rnd.sub_down(pi2.lower(), u), l)), true);
|
||||
else
|
||||
return I(static_cast<T>(-1), static_cast<T>(1), true);
|
||||
}
|
||||
|
||||
template<class T, class Policies> inline
|
||||
interval<T, Policies> sin(const interval<T, Policies>& x)
|
||||
{
|
||||
typedef interval<T, Policies> I;
|
||||
if (interval_lib::detail::test_input(x))
|
||||
return I::empty();
|
||||
typename Policies::rounding rnd;
|
||||
typedef typename interval_lib::unprotect<I>::type R;
|
||||
I r = cos((const R&)x - interval_lib::pi_half<R>());
|
||||
(void)&rnd;
|
||||
return r;
|
||||
}
|
||||
|
||||
template<class T, class Policies> inline
|
||||
interval<T, Policies> tan(const interval<T, Policies>& x)
|
||||
{
|
||||
typedef interval<T, Policies> I;
|
||||
if (interval_lib::detail::test_input(x))
|
||||
return I::empty();
|
||||
typename Policies::rounding rnd;
|
||||
typedef typename interval_lib::unprotect<I>::type R;
|
||||
|
||||
// get lower bound within [-pi/2, pi/2]
|
||||
const R pi = interval_lib::pi<R>();
|
||||
R tmp = fmod((const R&)x, pi);
|
||||
const T pi_half_d = interval_lib::constants::pi_half_lower<T>();
|
||||
if (tmp.lower() >= pi_half_d)
|
||||
tmp -= pi;
|
||||
if (tmp.lower() <= -pi_half_d || tmp.upper() >= pi_half_d)
|
||||
return I::whole();
|
||||
return I(rnd.tan_down(tmp.lower()), rnd.tan_up(tmp.upper()), true);
|
||||
}
|
||||
|
||||
template<class T, class Policies> inline
|
||||
interval<T, Policies> asin(const interval<T, Policies>& x)
|
||||
{
|
||||
typedef interval<T, Policies> I;
|
||||
if (interval_lib::detail::test_input(x)
|
||||
|| x.upper() < static_cast<T>(-1) || x.lower() > static_cast<T>(1))
|
||||
return I::empty();
|
||||
typename Policies::rounding rnd;
|
||||
T l = (x.lower() <= static_cast<T>(-1))
|
||||
? -interval_lib::constants::pi_half_upper<T>()
|
||||
: rnd.asin_down(x.lower());
|
||||
T u = (x.upper() >= static_cast<T>(1) )
|
||||
? interval_lib::constants::pi_half_upper<T>()
|
||||
: rnd.asin_up (x.upper());
|
||||
return I(l, u, true);
|
||||
}
|
||||
|
||||
template<class T, class Policies> inline
|
||||
interval<T, Policies> acos(const interval<T, Policies>& x)
|
||||
{
|
||||
typedef interval<T, Policies> I;
|
||||
if (interval_lib::detail::test_input(x)
|
||||
|| x.upper() < static_cast<T>(-1) || x.lower() > static_cast<T>(1))
|
||||
return I::empty();
|
||||
typename Policies::rounding rnd;
|
||||
T l = (x.upper() >= static_cast<T>(1) )
|
||||
? static_cast<T>(0)
|
||||
: rnd.acos_down(x.upper());
|
||||
T u = (x.lower() <= static_cast<T>(-1))
|
||||
? interval_lib::constants::pi_upper<T>()
|
||||
: rnd.acos_up (x.lower());
|
||||
return I(l, u, true);
|
||||
}
|
||||
|
||||
template<class T, class Policies> inline
|
||||
interval<T, Policies> atan(const interval<T, Policies>& x)
|
||||
{
|
||||
typedef interval<T, Policies> I;
|
||||
if (interval_lib::detail::test_input(x))
|
||||
return I::empty();
|
||||
typename Policies::rounding rnd;
|
||||
return I(rnd.atan_down(x.lower()), rnd.atan_up(x.upper()), true);
|
||||
}
|
||||
|
||||
template<class T, class Policies> inline
|
||||
interval<T, Policies> sinh(const interval<T, Policies>& x)
|
||||
{
|
||||
typedef interval<T, Policies> I;
|
||||
if (interval_lib::detail::test_input(x))
|
||||
return I::empty();
|
||||
typename Policies::rounding rnd;
|
||||
return I(rnd.sinh_down(x.lower()), rnd.sinh_up(x.upper()), true);
|
||||
}
|
||||
|
||||
template<class T, class Policies> inline
|
||||
interval<T, Policies> cosh(const interval<T, Policies>& x)
|
||||
{
|
||||
typedef interval<T, Policies> I;
|
||||
if (interval_lib::detail::test_input(x))
|
||||
return I::empty();
|
||||
typename Policies::rounding rnd;
|
||||
if (interval_lib::user::is_neg(x.upper()))
|
||||
return I(rnd.cosh_down(x.upper()), rnd.cosh_up(x.lower()), true);
|
||||
else if (!interval_lib::user::is_neg(x.lower()))
|
||||
return I(rnd.cosh_down(x.lower()), rnd.cosh_up(x.upper()), true);
|
||||
else
|
||||
return I(static_cast<T>(1), rnd.cosh_up(-x.lower() > x.upper() ? x.lower() : x.upper()), true);
|
||||
}
|
||||
|
||||
template<class T, class Policies> inline
|
||||
interval<T, Policies> tanh(const interval<T, Policies>& x)
|
||||
{
|
||||
typedef interval<T, Policies> I;
|
||||
if (interval_lib::detail::test_input(x))
|
||||
return I::empty();
|
||||
typename Policies::rounding rnd;
|
||||
return I(rnd.tanh_down(x.lower()), rnd.tanh_up(x.upper()), true);
|
||||
}
|
||||
|
||||
template<class T, class Policies> inline
|
||||
interval<T, Policies> asinh(const interval<T, Policies>& x)
|
||||
{
|
||||
typedef interval<T, Policies> I;
|
||||
if (interval_lib::detail::test_input(x))
|
||||
return I::empty();
|
||||
typename Policies::rounding rnd;
|
||||
return I(rnd.asinh_down(x.lower()), rnd.asinh_up(x.upper()), true);
|
||||
}
|
||||
|
||||
template<class T, class Policies> inline
|
||||
interval<T, Policies> acosh(const interval<T, Policies>& x)
|
||||
{
|
||||
typedef interval<T, Policies> I;
|
||||
if (interval_lib::detail::test_input(x) || x.upper() < static_cast<T>(1))
|
||||
return I::empty();
|
||||
typename Policies::rounding rnd;
|
||||
T l = x.lower() <= static_cast<T>(1) ? static_cast<T>(0) : rnd.acosh_down(x.lower());
|
||||
return I(l, rnd.acosh_up(x.upper()), true);
|
||||
}
|
||||
|
||||
template<class T, class Policies> inline
|
||||
interval<T, Policies> atanh(const interval<T, Policies>& x)
|
||||
{
|
||||
typedef interval<T, Policies> I;
|
||||
if (interval_lib::detail::test_input(x)
|
||||
|| x.upper() < static_cast<T>(-1) || x.lower() > static_cast<T>(1))
|
||||
return I::empty();
|
||||
typename Policies::rounding rnd;
|
||||
typedef typename Policies::checking checking;
|
||||
T l = (x.lower() <= static_cast<T>(-1))
|
||||
? checking::neg_inf() : rnd.atanh_down(x.lower());
|
||||
T u = (x.upper() >= static_cast<T>(1) )
|
||||
? checking::pos_inf() : rnd.atanh_up (x.upper());
|
||||
return I(l, u, true);
|
||||
}
|
||||
|
||||
} // namespace numeric
|
||||
} // namespace boost
|
||||
|
||||
#endif // BOOST_NUMERIC_INTERVAL_TRANSC_HPP
|
||||
@@ -0,0 +1,89 @@
|
||||
#ifndef BOOST_SERIALIZATION_BASIC_OSERIALIZER_HPP
|
||||
#define BOOST_SERIALIZATION_BASIC_OSERIALIZER_HPP
|
||||
|
||||
// MS compatible compilers support #pragma once
|
||||
#if defined(_MSC_VER)
|
||||
# pragma once
|
||||
#endif
|
||||
|
||||
/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8
|
||||
// basic_oserializer.hpp: extenstion of type_info required for serialization.
|
||||
|
||||
// (C) Copyright 2002 Robert Ramey - http://www.rrsd.com .
|
||||
// Use, modification and distribution is subject to the Boost Software
|
||||
// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
// See http://www.boost.org for updates, documentation, and revision history.
|
||||
|
||||
#include <cstddef> // NULL
|
||||
#include <boost/config.hpp>
|
||||
#include <boost/noncopyable.hpp>
|
||||
|
||||
#include <boost/archive/basic_archive.hpp>
|
||||
#include <boost/archive/detail/auto_link_archive.hpp>
|
||||
#include <boost/archive/detail/basic_serializer.hpp>
|
||||
|
||||
#include <boost/archive/detail/abi_prefix.hpp> // must be the last header
|
||||
|
||||
#ifdef BOOST_MSVC
|
||||
# pragma warning(push)
|
||||
# pragma warning(disable : 4511 4512)
|
||||
#endif
|
||||
|
||||
namespace boost {
|
||||
namespace serialization {
|
||||
class extended_type_info;
|
||||
} // namespace serialization
|
||||
|
||||
// forward declarations
|
||||
namespace archive {
|
||||
namespace detail {
|
||||
|
||||
class basic_oarchive;
|
||||
class basic_pointer_oserializer;
|
||||
|
||||
class BOOST_SYMBOL_VISIBLE basic_oserializer :
|
||||
public basic_serializer
|
||||
{
|
||||
private:
|
||||
basic_pointer_oserializer *m_bpos;
|
||||
protected:
|
||||
explicit BOOST_ARCHIVE_DECL basic_oserializer(
|
||||
const boost::serialization::extended_type_info & type_
|
||||
);
|
||||
virtual BOOST_ARCHIVE_DECL ~basic_oserializer();
|
||||
public:
|
||||
bool serialized_as_pointer() const {
|
||||
return m_bpos != NULL;
|
||||
}
|
||||
void set_bpos(basic_pointer_oserializer *bpos){
|
||||
m_bpos = bpos;
|
||||
}
|
||||
const basic_pointer_oserializer * get_bpos() const {
|
||||
return m_bpos;
|
||||
}
|
||||
virtual void save_object_data(
|
||||
basic_oarchive & ar, const void * x
|
||||
) const = 0;
|
||||
// returns true if class_info should be saved
|
||||
virtual bool class_info() const = 0;
|
||||
// returns true if objects should be tracked
|
||||
virtual bool tracking(const unsigned int flags) const = 0;
|
||||
// returns class version
|
||||
virtual version_type version() const = 0;
|
||||
// returns true if this class is polymorphic
|
||||
virtual bool is_polymorphic() const = 0;
|
||||
};
|
||||
|
||||
} // namespace detail
|
||||
} // namespace serialization
|
||||
} // namespace boost
|
||||
|
||||
#ifdef BOOST_MSVC
|
||||
#pragma warning(pop)
|
||||
#endif
|
||||
|
||||
#include <boost/archive/detail/abi_suffix.hpp> // pops abi_suffix.hpp pragmas
|
||||
|
||||
#endif // BOOST_SERIALIZATION_BASIC_OSERIALIZER_HPP
|
||||
@@ -0,0 +1,376 @@
|
||||
// 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 correctly
|
||||
// handle the various corner cases.
|
||||
//
|
||||
|
||||
#ifndef BOOST_MATH_ELLINT_3_HPP
|
||||
#define BOOST_MATH_ELLINT_3_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_rj.hpp>
|
||||
#include <boost/math/special_functions/ellint_1.hpp>
|
||||
#include <boost/math/special_functions/ellint_2.hpp>
|
||||
#include <boost/math/special_functions/log1p.hpp>
|
||||
#include <boost/math/special_functions/atanh.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 third kind
|
||||
// Carlson, Numerische Mathematik, vol 33, 1 (1979)
|
||||
|
||||
namespace boost { namespace math {
|
||||
|
||||
namespace detail{
|
||||
|
||||
template <typename T, typename Policy>
|
||||
T ellint_pi_imp(T v, T k, T vc, const Policy& pol);
|
||||
|
||||
// Elliptic integral (Legendre form) of the third kind
|
||||
template <typename T, typename Policy>
|
||||
T ellint_pi_imp(T v, T phi, T k, T vc, const Policy& pol)
|
||||
{
|
||||
// Note vc = 1-v presumably without cancellation error.
|
||||
BOOST_MATH_STD_USING
|
||||
|
||||
static const char* function = "boost::math::ellint_3<%1%>(%1%,%1%,%1%)";
|
||||
|
||||
if(abs(k) > 1)
|
||||
{
|
||||
return policies::raise_domain_error<T>(function,
|
||||
"Got k = %1%, function requires |k| <= 1", k, pol);
|
||||
}
|
||||
|
||||
T sphi = sin(fabs(phi));
|
||||
T result = 0;
|
||||
|
||||
// Special cases first:
|
||||
if(v == 0)
|
||||
{
|
||||
// A&S 17.7.18 & 19
|
||||
return (k == 0) ? phi : ellint_f_imp(phi, k, pol);
|
||||
}
|
||||
if((v > 0) && (1 / v < (sphi * sphi)))
|
||||
{
|
||||
// Complex result is a domain error:
|
||||
return policies::raise_domain_error<T>(function,
|
||||
"Got v = %1%, but result is complex for v > 1 / sin^2(phi)", v, pol);
|
||||
}
|
||||
|
||||
if(v == 1)
|
||||
{
|
||||
// http://functions.wolfram.com/08.06.03.0008.01
|
||||
T m = k * k;
|
||||
result = sqrt(1 - m * sphi * sphi) * tan(phi) - ellint_e_imp(phi, k, pol);
|
||||
result /= 1 - m;
|
||||
result += ellint_f_imp(phi, k, pol);
|
||||
return result;
|
||||
}
|
||||
if(phi == constants::half_pi<T>())
|
||||
{
|
||||
// Have to filter this case out before the next
|
||||
// special case, otherwise we might get an infinity from
|
||||
// tan(phi).
|
||||
// Also note that since we can't represent PI/2 exactly
|
||||
// in a T, this is a bit of a guess as to the users true
|
||||
// intent...
|
||||
//
|
||||
return ellint_pi_imp(v, k, vc, pol);
|
||||
}
|
||||
if((phi > constants::half_pi<T>()) || (phi < 0))
|
||||
{
|
||||
// Carlson's algorithm works only for |phi| <= pi/2,
|
||||
// use the integrand's periodicity to normalize phi
|
||||
//
|
||||
// Xiaogang's original code used a cast to long long here
|
||||
// but that fails if T has more digits than a long long,
|
||||
// so rewritten to use fmod instead:
|
||||
//
|
||||
// See http://functions.wolfram.com/08.06.16.0002.01
|
||||
//
|
||||
if(fabs(phi) > 1 / tools::epsilon<T>())
|
||||
{
|
||||
if(v > 1)
|
||||
return policies::raise_domain_error<T>(
|
||||
function,
|
||||
"Got v = %1%, but this is only supported for 0 <= phi <= pi/2", v, pol);
|
||||
//
|
||||
// Phi is so large that phi%pi is necessarily zero (or garbage),
|
||||
// just return the second part of the duplication formula:
|
||||
//
|
||||
result = 2 * fabs(phi) * ellint_pi_imp(v, k, vc, pol) / constants::pi<T>();
|
||||
}
|
||||
else
|
||||
{
|
||||
T rphi = boost::math::tools::fmod_workaround(T(fabs(phi)), T(constants::half_pi<T>()));
|
||||
T m = boost::math::round((fabs(phi) - rphi) / constants::half_pi<T>());
|
||||
int sign = 1;
|
||||
if((m != 0) && (k >= 1))
|
||||
{
|
||||
return policies::raise_domain_error<T>(function, "Got k=1 and phi=%1% but the result is complex in that domain", phi, pol);
|
||||
}
|
||||
if(boost::math::tools::fmod_workaround(m, T(2)) > 0.5)
|
||||
{
|
||||
m += 1;
|
||||
sign = -1;
|
||||
rphi = constants::half_pi<T>() - rphi;
|
||||
}
|
||||
result = sign * ellint_pi_imp(v, rphi, k, vc, pol);
|
||||
if((m > 0) && (vc > 0))
|
||||
result += m * ellint_pi_imp(v, k, vc, pol);
|
||||
}
|
||||
return phi < 0 ? T(-result) : result;
|
||||
}
|
||||
if(k == 0)
|
||||
{
|
||||
// A&S 17.7.20:
|
||||
if(v < 1)
|
||||
{
|
||||
T vcr = sqrt(vc);
|
||||
return atan(vcr * tan(phi)) / vcr;
|
||||
}
|
||||
else if(v == 1)
|
||||
{
|
||||
return tan(phi);
|
||||
}
|
||||
else
|
||||
{
|
||||
// v > 1:
|
||||
T vcr = sqrt(-vc);
|
||||
T arg = vcr * tan(phi);
|
||||
return (boost::math::log1p(arg, pol) - boost::math::log1p(-arg, pol)) / (2 * vcr);
|
||||
}
|
||||
}
|
||||
if(v < 0)
|
||||
{
|
||||
//
|
||||
// If we don't shift to 0 <= v <= 1 we get
|
||||
// cancellation errors later on. Use
|
||||
// A&S 17.7.15/16 to shift to v > 0.
|
||||
//
|
||||
// Mathematica simplifies the expressions
|
||||
// given in A&S as follows (with thanks to
|
||||
// Rocco Romeo for figuring these out!):
|
||||
//
|
||||
// V = (k2 - n)/(1 - n)
|
||||
// Assuming[(k2 >= 0 && k2 <= 1) && n < 0, FullSimplify[Sqrt[(1 - V)*(1 - k2 / V)] / Sqrt[((1 - n)*(1 - k2 / n))]]]
|
||||
// Result: ((-1 + k2) n) / ((-1 + n) (-k2 + n))
|
||||
//
|
||||
// Assuming[(k2 >= 0 && k2 <= 1) && n < 0, FullSimplify[k2 / (Sqrt[-n*(k2 - n) / (1 - n)] * Sqrt[(1 - n)*(1 - k2 / n)])]]
|
||||
// Result : k2 / (k2 - n)
|
||||
//
|
||||
// Assuming[(k2 >= 0 && k2 <= 1) && n < 0, FullSimplify[Sqrt[1 / ((1 - n)*(1 - k2 / n))]]]
|
||||
// Result : Sqrt[n / ((k2 - n) (-1 + n))]
|
||||
//
|
||||
T k2 = k * k;
|
||||
T N = (k2 - v) / (1 - v);
|
||||
T Nm1 = (1 - k2) / (1 - v);
|
||||
T p2 = -v * N;
|
||||
T t;
|
||||
if(p2 <= tools::min_value<T>())
|
||||
p2 = sqrt(-v) * sqrt(N);
|
||||
else
|
||||
p2 = sqrt(p2);
|
||||
T delta = sqrt(1 - k2 * sphi * sphi);
|
||||
if(N > k2)
|
||||
{
|
||||
result = ellint_pi_imp(N, phi, k, Nm1, pol);
|
||||
result *= v / (v - 1);
|
||||
result *= (k2 - 1) / (v - k2);
|
||||
}
|
||||
|
||||
if(k != 0)
|
||||
{
|
||||
t = ellint_f_imp(phi, k, pol);
|
||||
t *= k2 / (k2 - v);
|
||||
result += t;
|
||||
}
|
||||
t = v / ((k2 - v) * (v - 1));
|
||||
if(t > tools::min_value<T>())
|
||||
{
|
||||
result += atan((p2 / 2) * sin(2 * phi) / delta) * sqrt(t);
|
||||
}
|
||||
else
|
||||
{
|
||||
result += atan((p2 / 2) * sin(2 * phi) / delta) * sqrt(fabs(1 / (k2 - v))) * sqrt(fabs(v / (v - 1)));
|
||||
}
|
||||
return result;
|
||||
}
|
||||
if(k == 1)
|
||||
{
|
||||
// See http://functions.wolfram.com/08.06.03.0013.01
|
||||
result = sqrt(v) * atanh(sqrt(v) * sin(phi)) - log(1 / cos(phi) + tan(phi));
|
||||
result /= v - 1;
|
||||
return result;
|
||||
}
|
||||
#if 0 // disabled but retained for future reference: see below.
|
||||
if(v > 1)
|
||||
{
|
||||
//
|
||||
// If v > 1 we can use the identity in A&S 17.7.7/8
|
||||
// to shift to 0 <= v <= 1. In contrast to previous
|
||||
// revisions of this header, this identity does now work
|
||||
// but appears not to produce better error rates in
|
||||
// practice. Archived here for future reference...
|
||||
//
|
||||
T k2 = k * k;
|
||||
T N = k2 / v;
|
||||
T Nm1 = (v - k2) / v;
|
||||
T p1 = sqrt((-vc) * (1 - k2 / v));
|
||||
T delta = sqrt(1 - k2 * sphi * sphi);
|
||||
//
|
||||
// These next two terms have a large amount of cancellation
|
||||
// so it's not clear if this relation is useable even if
|
||||
// the issues with phi > pi/2 can be fixed:
|
||||
//
|
||||
result = -ellint_pi_imp(N, phi, k, Nm1, pol);
|
||||
result += ellint_f_imp(phi, k, pol);
|
||||
//
|
||||
// This log term gives the complex result when
|
||||
// n > 1/sin^2(phi)
|
||||
// However that case is dealt with as an error above,
|
||||
// so we should always get a real result here:
|
||||
//
|
||||
result += log((delta + p1 * tan(phi)) / (delta - p1 * tan(phi))) / (2 * p1);
|
||||
return result;
|
||||
}
|
||||
#endif
|
||||
//
|
||||
// Carlson's algorithm works only for |phi| <= pi/2,
|
||||
// by the time we get here phi should already have been
|
||||
// normalised above.
|
||||
//
|
||||
BOOST_ASSERT(fabs(phi) < constants::half_pi<T>());
|
||||
BOOST_ASSERT(phi >= 0);
|
||||
T x, y, z, p, t;
|
||||
T cosp = cos(phi);
|
||||
x = cosp * cosp;
|
||||
t = sphi * sphi;
|
||||
y = 1 - k * k * t;
|
||||
z = 1;
|
||||
if(v * t < 0.5)
|
||||
p = 1 - v * t;
|
||||
else
|
||||
p = x + vc * t;
|
||||
result = sphi * (ellint_rf_imp(x, y, z, pol) + v * t * ellint_rj_imp(x, y, z, p, pol) / 3);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
// Complete elliptic integral (Legendre form) of the third kind
|
||||
template <typename T, typename Policy>
|
||||
T ellint_pi_imp(T v, T k, T vc, const Policy& pol)
|
||||
{
|
||||
// Note arg vc = 1-v, possibly without cancellation errors
|
||||
BOOST_MATH_STD_USING
|
||||
using namespace boost::math::tools;
|
||||
|
||||
static const char* function = "boost::math::ellint_pi<%1%>(%1%,%1%)";
|
||||
|
||||
if (abs(k) >= 1)
|
||||
{
|
||||
return policies::raise_domain_error<T>(function,
|
||||
"Got k = %1%, function requires |k| <= 1", k, pol);
|
||||
}
|
||||
if(vc <= 0)
|
||||
{
|
||||
// Result is complex:
|
||||
return policies::raise_domain_error<T>(function,
|
||||
"Got v = %1%, function requires v < 1", v, pol);
|
||||
}
|
||||
|
||||
if(v == 0)
|
||||
{
|
||||
return (k == 0) ? boost::math::constants::pi<T>() / 2 : ellint_k_imp(k, pol);
|
||||
}
|
||||
|
||||
if(v < 0)
|
||||
{
|
||||
// Apply A&S 17.7.17:
|
||||
T k2 = k * k;
|
||||
T N = (k2 - v) / (1 - v);
|
||||
T Nm1 = (1 - k2) / (1 - v);
|
||||
T result = 0;
|
||||
result = boost::math::detail::ellint_pi_imp(N, k, Nm1, pol);
|
||||
// This next part is split in two to avoid spurious over/underflow:
|
||||
result *= -v / (1 - v);
|
||||
result *= (1 - k2) / (k2 - v);
|
||||
result += ellint_k_imp(k, pol) * k2 / (k2 - v);
|
||||
return result;
|
||||
}
|
||||
|
||||
T x = 0;
|
||||
T y = 1 - k * k;
|
||||
T z = 1;
|
||||
T p = vc;
|
||||
T value = ellint_rf_imp(x, y, z, pol) + v * ellint_rj_imp(x, y, z, p, pol) / 3;
|
||||
|
||||
return value;
|
||||
}
|
||||
|
||||
template <class T1, class T2, class T3>
|
||||
inline typename tools::promote_args<T1, T2, T3>::type ellint_3(T1 k, T2 v, T3 phi, const mpl::false_&)
|
||||
{
|
||||
return boost::math::ellint_3(k, v, phi, policies::policy<>());
|
||||
}
|
||||
|
||||
template <class T1, class T2, class Policy>
|
||||
inline typename tools::promote_args<T1, T2>::type ellint_3(T1 k, T2 v, const Policy& pol, const mpl::true_&)
|
||||
{
|
||||
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_pi_imp(
|
||||
static_cast<value_type>(v),
|
||||
static_cast<value_type>(k),
|
||||
static_cast<value_type>(1-v),
|
||||
pol), "boost::math::ellint_3<%1%>(%1%,%1%)");
|
||||
}
|
||||
|
||||
} // namespace detail
|
||||
|
||||
template <class T1, class T2, class T3, class Policy>
|
||||
inline typename tools::promote_args<T1, T2, T3>::type ellint_3(T1 k, T2 v, T3 phi, const Policy& pol)
|
||||
{
|
||||
typedef typename tools::promote_args<T1, T2, T3>::type result_type;
|
||||
typedef typename policies::evaluation<result_type, Policy>::type value_type;
|
||||
return policies::checked_narrowing_cast<result_type, Policy>(
|
||||
detail::ellint_pi_imp(
|
||||
static_cast<value_type>(v),
|
||||
static_cast<value_type>(phi),
|
||||
static_cast<value_type>(k),
|
||||
static_cast<value_type>(1-v),
|
||||
pol), "boost::math::ellint_3<%1%>(%1%,%1%,%1%)");
|
||||
}
|
||||
|
||||
template <class T1, class T2, class T3>
|
||||
typename detail::ellint_3_result<T1, T2, T3>::type ellint_3(T1 k, T2 v, T3 phi)
|
||||
{
|
||||
typedef typename policies::is_policy<T3>::type tag_type;
|
||||
return detail::ellint_3(k, v, phi, tag_type());
|
||||
}
|
||||
|
||||
template <class T1, class T2>
|
||||
inline typename tools::promote_args<T1, T2>::type ellint_3(T1 k, T2 v)
|
||||
{
|
||||
return ellint_3(k, v, policies::policy<>());
|
||||
}
|
||||
|
||||
}} // namespaces
|
||||
|
||||
#endif // BOOST_MATH_ELLINT_3_HPP
|
||||
|
||||
@@ -0,0 +1,821 @@
|
||||
#include "FrequencyList.hpp"
|
||||
|
||||
#include <cstdlib>
|
||||
#include <utility>
|
||||
#include <limits>
|
||||
|
||||
#include <QMetaType>
|
||||
#include <QAbstractTableModel>
|
||||
#include <QString>
|
||||
#include <QList>
|
||||
#include <QListIterator>
|
||||
#include <QVector>
|
||||
#include <QStringList>
|
||||
#include <QMimeData>
|
||||
#include <QDataStream>
|
||||
#include <QByteArray>
|
||||
#include <QDebugStateSaver>
|
||||
|
||||
#include "Radio.hpp"
|
||||
#include "Bands.hpp"
|
||||
#include "pimpl_impl.hpp"
|
||||
|
||||
#include "moc_FrequencyList.cpp"
|
||||
|
||||
namespace
|
||||
{
|
||||
FrequencyList_v2::FrequencyItems const default_frequency_list =
|
||||
{
|
||||
{198000, Modes::FreqCal, IARURegions::R1}, // BBC Radio 4 Droitwich
|
||||
{4996000, Modes::FreqCal, IARURegions::R1}, // RWM time signal
|
||||
{9996000, Modes::FreqCal, IARURegions::R1}, // RWM time signal
|
||||
{14996000, Modes::FreqCal, IARURegions::R1}, // RWM time signal
|
||||
|
||||
{660000, Modes::FreqCal, IARURegions::R2},
|
||||
{880000, Modes::FreqCal, IARURegions::R2},
|
||||
{1210000, Modes::FreqCal, IARURegions::R2},
|
||||
|
||||
{2500000, Modes::FreqCal, IARURegions::ALL},
|
||||
{3330000, Modes::FreqCal, IARURegions::ALL},
|
||||
{5000000, Modes::FreqCal, IARURegions::ALL},
|
||||
{7850000, Modes::FreqCal, IARURegions::ALL},
|
||||
{10000000, Modes::FreqCal, IARURegions::ALL},
|
||||
{14670000, Modes::FreqCal, IARURegions::ALL},
|
||||
{15000000, Modes::FreqCal, IARURegions::ALL},
|
||||
{20000000, Modes::FreqCal, IARURegions::ALL},
|
||||
|
||||
{136000, Modes::WSPR, IARURegions::ALL},
|
||||
{136130, Modes::JT65, IARURegions::ALL},
|
||||
{136130, Modes::JT9, IARURegions::ALL},
|
||||
|
||||
{474200, Modes::JT65, IARURegions::ALL},
|
||||
{474200, Modes::JT9, IARURegions::ALL},
|
||||
{474200, Modes::WSPR, IARURegions::ALL},
|
||||
|
||||
{1836600, Modes::WSPR, IARURegions::ALL},
|
||||
{1838000, Modes::JT65, IARURegions::ALL}, // squeezed allocations
|
||||
{1839000, Modes::JT9, IARURegions::ALL},
|
||||
{1840000, Modes::FT8, IARURegions::ALL},
|
||||
|
||||
{3570000, Modes::JT65, IARURegions::ALL}, // JA compatible
|
||||
{3572000, Modes::JT9, IARURegions::ALL},
|
||||
{3573000, Modes::FT8, IARURegions::ALL}, // above as below JT65
|
||||
// is out of DM allocation
|
||||
{3568600, Modes::WSPR, IARURegions::ALL}, // needs guard marker
|
||||
// and lock out
|
||||
|
||||
{7038600, Modes::WSPR, IARURegions::ALL},
|
||||
{7074000, Modes::FT8, IARURegions::ALL},
|
||||
{7076000, Modes::JT65, IARURegions::ALL},
|
||||
{7078000, Modes::JT9, IARURegions::ALL},
|
||||
|
||||
{10136000, Modes::FT8, IARURegions::ALL},
|
||||
{10138000, Modes::JT65, IARURegions::ALL},
|
||||
{10138700, Modes::WSPR, IARURegions::ALL},
|
||||
{10140000, Modes::JT9, IARURegions::ALL},
|
||||
|
||||
{14095600, Modes::WSPR, IARURegions::ALL},
|
||||
{14074000, Modes::FT8, IARURegions::ALL},
|
||||
{14076000, Modes::JT65, IARURegions::ALL},
|
||||
{14078000, Modes::JT9, IARURegions::ALL},
|
||||
|
||||
{18100000, Modes::FT8, IARURegions::ALL},
|
||||
{18102000, Modes::JT65, IARURegions::ALL},
|
||||
{18104000, Modes::JT9, IARURegions::ALL},
|
||||
{18104600, Modes::WSPR, IARURegions::ALL},
|
||||
|
||||
{21074000, Modes::FT8, IARURegions::ALL},
|
||||
{21076000, Modes::JT65, IARURegions::ALL},
|
||||
{21078000, Modes::JT9, IARURegions::ALL},
|
||||
{21094600, Modes::WSPR, IARURegions::ALL},
|
||||
|
||||
{24915000, Modes::FT8, IARURegions::ALL},
|
||||
{24917000, Modes::JT65, IARURegions::ALL},
|
||||
{24919000, Modes::JT9, IARURegions::ALL},
|
||||
{24924600, Modes::WSPR, IARURegions::ALL},
|
||||
|
||||
{28074000, Modes::FT8, IARURegions::ALL},
|
||||
{28076000, Modes::JT65, IARURegions::ALL},
|
||||
{28078000, Modes::JT9, IARURegions::ALL},
|
||||
{28124600, Modes::WSPR, IARURegions::ALL},
|
||||
|
||||
{50200000, Modes::Echo, IARURegions::ALL},
|
||||
{50276000, Modes::JT65, IARURegions::R2},
|
||||
{50276000, Modes::JT65, IARURegions::R3},
|
||||
{50260000, Modes::MSK144, IARURegions::R2},
|
||||
{50260000, Modes::MSK144, IARURegions::R3},
|
||||
{50293000, Modes::WSPR, IARURegions::R2},
|
||||
{50293000, Modes::WSPR, IARURegions::R3},
|
||||
{50310000, Modes::JT65, IARURegions::ALL},
|
||||
{50312000, Modes::JT9, IARURegions::ALL},
|
||||
{50313000, Modes::FT8, IARURegions::ALL},
|
||||
{50360000, Modes::MSK144, IARURegions::R1},
|
||||
|
||||
{70100000, Modes::FT8, IARURegions::R1},
|
||||
{70102000, Modes::JT65, IARURegions::R1},
|
||||
{70104000, Modes::JT9, IARURegions::R1},
|
||||
{70091000, Modes::WSPR, IARURegions::R1},
|
||||
{70230000, Modes::MSK144, IARURegions::R1},
|
||||
|
||||
{144120000, Modes::JT65, IARURegions::ALL},
|
||||
{144120000, Modes::Echo, IARURegions::ALL},
|
||||
{144360000, Modes::MSK144, IARURegions::R1},
|
||||
{144150000, Modes::MSK144, IARURegions::R2},
|
||||
{144489000, Modes::WSPR, IARURegions::ALL},
|
||||
{144120000, Modes::QRA64, IARURegions::ALL},
|
||||
|
||||
{222065000, Modes::Echo, IARURegions::R2},
|
||||
{222065000, Modes::JT65, IARURegions::R2},
|
||||
{222065000, Modes::QRA64, IARURegions::R2},
|
||||
|
||||
{432065000, Modes::Echo, IARURegions::ALL},
|
||||
{432065000, Modes::JT65, IARURegions::ALL},
|
||||
{432300000, Modes::WSPR, IARURegions::ALL},
|
||||
{432360000, Modes::MSK144, IARURegions::ALL},
|
||||
{432065000, Modes::QRA64, IARURegions::ALL},
|
||||
|
||||
{902065000, Modes::JT65, IARURegions::R2},
|
||||
{902065000, Modes::QRA64, IARURegions::R2},
|
||||
|
||||
{1296065000, Modes::Echo, IARURegions::ALL},
|
||||
{1296065000, Modes::JT65, IARURegions::ALL},
|
||||
{1296500000, Modes::WSPR, IARURegions::ALL},
|
||||
{1296065000, Modes::QRA64, IARURegions::ALL},
|
||||
|
||||
{2301000000, Modes::Echo, IARURegions::ALL},
|
||||
{2301065000, Modes::JT4, IARURegions::ALL},
|
||||
{2301065000, Modes::JT65, IARURegions::ALL},
|
||||
{2301065000, Modes::QRA64, IARURegions::ALL},
|
||||
|
||||
{2304065000, Modes::Echo, IARURegions::ALL},
|
||||
{2304065000, Modes::JT4, IARURegions::ALL},
|
||||
{2304065000, Modes::JT65, IARURegions::ALL},
|
||||
{2304065000, Modes::QRA64, IARURegions::ALL},
|
||||
|
||||
{2320065000, Modes::Echo, IARURegions::ALL},
|
||||
{2320065000, Modes::JT4, IARURegions::ALL},
|
||||
{2320065000, Modes::JT65, IARURegions::ALL},
|
||||
{2320065000, Modes::QRA64, IARURegions::ALL},
|
||||
|
||||
{3400065000, Modes::Echo, IARURegions::ALL},
|
||||
{3400065000, Modes::JT4, IARURegions::ALL},
|
||||
{3400065000, Modes::JT65, IARURegions::ALL},
|
||||
{3400065000, Modes::QRA64, IARURegions::ALL},
|
||||
|
||||
{5760065000, Modes::Echo, IARURegions::ALL},
|
||||
{5760065000, Modes::JT4, IARURegions::ALL},
|
||||
{5760065000, Modes::JT65, IARURegions::ALL},
|
||||
{5760200000, Modes::QRA64, IARURegions::ALL},
|
||||
|
||||
{10368100000, Modes::Echo, IARURegions::ALL},
|
||||
{10368200000, Modes::JT4, IARURegions::ALL},
|
||||
{10368200000, Modes::QRA64, IARURegions::ALL},
|
||||
|
||||
{24048100000, Modes::Echo, IARURegions::ALL},
|
||||
{24048200000, Modes::JT4, IARURegions::ALL},
|
||||
{24048200000, Modes::QRA64, IARURegions::ALL},
|
||||
};
|
||||
}
|
||||
|
||||
#if !defined (QT_NO_DEBUG_STREAM)
|
||||
QDebug operator << (QDebug debug, FrequencyList_v2::Item const& item)
|
||||
{
|
||||
QDebugStateSaver saver {debug};
|
||||
debug.nospace () << "FrequencyItem("
|
||||
<< item.frequency_ << ", "
|
||||
<< item.region_ << ", "
|
||||
<< item.mode_ << ')';
|
||||
return debug;
|
||||
}
|
||||
#endif
|
||||
|
||||
QDataStream& operator << (QDataStream& os, FrequencyList_v2::Item const& item)
|
||||
{
|
||||
return os << item.frequency_
|
||||
<< item.mode_
|
||||
<< item.region_;
|
||||
}
|
||||
|
||||
QDataStream& operator >> (QDataStream& is, FrequencyList_v2::Item& item)
|
||||
{
|
||||
return is >> item.frequency_
|
||||
>> item.mode_
|
||||
>> item.region_;
|
||||
}
|
||||
|
||||
class FrequencyList_v2::impl final
|
||||
: public QAbstractTableModel
|
||||
{
|
||||
public:
|
||||
impl (Bands const * bands, QObject * parent)
|
||||
: QAbstractTableModel {parent}
|
||||
, bands_ {bands}
|
||||
, region_filter_ {IARURegions::ALL}
|
||||
, mode_filter_ {Modes::ALL}
|
||||
{
|
||||
}
|
||||
|
||||
FrequencyItems frequency_list (FrequencyItems);
|
||||
QModelIndex add (Item);
|
||||
void add (FrequencyItems);
|
||||
|
||||
// Implement the QAbstractTableModel interface
|
||||
int rowCount (QModelIndex const& parent = QModelIndex {}) const override;
|
||||
int columnCount (QModelIndex const& parent = QModelIndex {}) const override;
|
||||
Qt::ItemFlags flags (QModelIndex const& = QModelIndex {}) const override;
|
||||
QVariant data (QModelIndex const&, int role = Qt::DisplayRole) const override;
|
||||
bool setData (QModelIndex const&, QVariant const& value, int role = Qt::EditRole) override;
|
||||
QVariant headerData (int section, Qt::Orientation, int = Qt::DisplayRole) const override;
|
||||
bool removeRows (int row, int count, QModelIndex const& parent = QModelIndex {}) override;
|
||||
bool insertRows (int row, int count, QModelIndex const& parent = QModelIndex {}) override;
|
||||
QStringList mimeTypes () const override;
|
||||
QMimeData * mimeData (QModelIndexList const&) const override;
|
||||
|
||||
static int constexpr num_cols {SENTINAL};
|
||||
static auto constexpr mime_type = "application/wsjt.Frequencies";
|
||||
|
||||
Bands const * bands_;
|
||||
FrequencyItems frequency_list_;
|
||||
Region region_filter_;
|
||||
Mode mode_filter_;
|
||||
};
|
||||
|
||||
FrequencyList_v2::FrequencyList_v2 (Bands const * bands, QObject * parent)
|
||||
: QSortFilterProxyModel {parent}
|
||||
, m_ {bands, parent}
|
||||
{
|
||||
setSourceModel (&*m_);
|
||||
setSortRole (SortRole);
|
||||
}
|
||||
|
||||
FrequencyList_v2::~FrequencyList_v2 ()
|
||||
{
|
||||
}
|
||||
|
||||
auto FrequencyList_v2::frequency_list (FrequencyItems frequency_list) -> FrequencyItems
|
||||
{
|
||||
return m_->frequency_list (frequency_list);
|
||||
}
|
||||
|
||||
auto FrequencyList_v2::frequency_list () const -> FrequencyItems const&
|
||||
{
|
||||
return m_->frequency_list_;
|
||||
}
|
||||
|
||||
auto FrequencyList_v2::frequency_list (QModelIndexList const& model_index_list) const -> FrequencyItems
|
||||
{
|
||||
FrequencyItems list;
|
||||
Q_FOREACH (auto const& index, model_index_list)
|
||||
{
|
||||
list << m_->frequency_list_[mapToSource (index).row ()];
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
void FrequencyList_v2::frequency_list_merge (FrequencyItems const& items)
|
||||
{
|
||||
m_->add (items);
|
||||
}
|
||||
|
||||
int FrequencyList_v2::best_working_frequency (Frequency f) const
|
||||
{
|
||||
int result {-1};
|
||||
auto const& target_band = m_->bands_->find (f);
|
||||
if (!target_band.isEmpty ())
|
||||
{
|
||||
Radio::FrequencyDelta delta {std::numeric_limits<Radio::FrequencyDelta>::max ()};
|
||||
// find a frequency in the same band that is allowed
|
||||
for (int row = 0; row < rowCount (); ++row)
|
||||
{
|
||||
auto const& source_row = mapToSource (index (row, 0)).row ();
|
||||
auto const& candidate_frequency = m_->frequency_list_[source_row].frequency_;
|
||||
auto const& band = m_->bands_->find (candidate_frequency);
|
||||
if (band == target_band)
|
||||
{
|
||||
// take closest band match
|
||||
Radio::FrequencyDelta new_delta = f - candidate_frequency;
|
||||
if (std::abs (new_delta) < std::abs (delta))
|
||||
{
|
||||
delta = new_delta;
|
||||
result = row;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
int FrequencyList_v2::best_working_frequency (QString const& target_band) const
|
||||
{
|
||||
int result {-1};
|
||||
if (!target_band.isEmpty ())
|
||||
{
|
||||
// find a frequency in the same band that is allowed
|
||||
for (int row = 0; row < rowCount (); ++row)
|
||||
{
|
||||
auto const& source_row = mapToSource (index (row, 0)).row ();
|
||||
auto const& band = m_->bands_->find (m_->frequency_list_[source_row].frequency_);
|
||||
if (band == target_band)
|
||||
{
|
||||
return row;
|
||||
}
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
void FrequencyList_v2::reset_to_defaults ()
|
||||
{
|
||||
m_->frequency_list (default_frequency_list);
|
||||
}
|
||||
|
||||
QModelIndex FrequencyList_v2::add (Item f)
|
||||
{
|
||||
return mapFromSource (m_->add (f));
|
||||
}
|
||||
|
||||
bool FrequencyList_v2::remove (Item f)
|
||||
{
|
||||
auto row = m_->frequency_list_.indexOf (f);
|
||||
|
||||
if (0 > row)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
return m_->removeRow (row);
|
||||
}
|
||||
|
||||
namespace
|
||||
{
|
||||
bool row_is_higher (QModelIndex const& lhs, QModelIndex const& rhs)
|
||||
{
|
||||
return lhs.row () > rhs.row ();
|
||||
}
|
||||
}
|
||||
|
||||
bool FrequencyList_v2::removeDisjointRows (QModelIndexList rows)
|
||||
{
|
||||
bool result {true};
|
||||
|
||||
// We must work with source model indexes because we don't want row
|
||||
// removes to invalidate model indexes we haven't yet processed. We
|
||||
// achieve that by processing them in decending row order.
|
||||
for (int r = 0; r < rows.size (); ++r)
|
||||
{
|
||||
rows[r] = mapToSource (rows[r]);
|
||||
}
|
||||
|
||||
// reverse sort by row
|
||||
qSort (rows.begin (), rows.end (), row_is_higher);
|
||||
Q_FOREACH (auto index, rows)
|
||||
{
|
||||
if (result && !m_->removeRow (index.row ()))
|
||||
{
|
||||
result = false;
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
void FrequencyList_v2::filter (Region region, Mode mode)
|
||||
{
|
||||
m_->region_filter_ = region;
|
||||
m_->mode_filter_ = mode;
|
||||
invalidateFilter ();
|
||||
}
|
||||
|
||||
bool FrequencyList_v2::filterAcceptsRow (int source_row, QModelIndex const& /* parent */) const
|
||||
{
|
||||
bool result {true};
|
||||
auto const& item = m_->frequency_list_[source_row];
|
||||
if (m_->region_filter_ != IARURegions::ALL)
|
||||
{
|
||||
result = IARURegions::ALL == item.region_ || m_->region_filter_ == item.region_;
|
||||
}
|
||||
if (result && m_->mode_filter_ != Modes::ALL)
|
||||
{
|
||||
// we pass ALL mode rows unless filtering for FreqCal mode
|
||||
result = (Modes::ALL == item.mode_ && m_->mode_filter_ != Modes::FreqCal)
|
||||
|| m_->mode_filter_ == item.mode_;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
auto FrequencyList_v2::impl::frequency_list (FrequencyItems frequency_list) -> FrequencyItems
|
||||
{
|
||||
beginResetModel ();
|
||||
std::swap (frequency_list_, frequency_list);
|
||||
endResetModel ();
|
||||
return frequency_list;
|
||||
}
|
||||
|
||||
QModelIndex FrequencyList_v2::impl::add (Item f)
|
||||
{
|
||||
// Any Frequency that isn't in the list may be added
|
||||
if (!frequency_list_.contains (f))
|
||||
{
|
||||
auto row = frequency_list_.size ();
|
||||
|
||||
beginInsertRows (QModelIndex {}, row, row);
|
||||
frequency_list_.append (f);
|
||||
endInsertRows ();
|
||||
|
||||
return index (row, 0);
|
||||
}
|
||||
return QModelIndex {};
|
||||
}
|
||||
|
||||
void FrequencyList_v2::impl::add (FrequencyItems items)
|
||||
{
|
||||
// Any Frequency that isn't in the list may be added
|
||||
for (auto p = items.begin (); p != items.end ();)
|
||||
{
|
||||
if (frequency_list_.contains (*p))
|
||||
{
|
||||
p = items.erase (p);
|
||||
}
|
||||
else
|
||||
{
|
||||
++p;
|
||||
}
|
||||
}
|
||||
|
||||
if (items.size ())
|
||||
{
|
||||
auto row = frequency_list_.size ();
|
||||
|
||||
beginInsertRows (QModelIndex {}, row, row + items.size () - 1);
|
||||
frequency_list_.append (items);
|
||||
endInsertRows ();
|
||||
}
|
||||
}
|
||||
|
||||
int FrequencyList_v2::impl::rowCount (QModelIndex const& parent) const
|
||||
{
|
||||
return parent.isValid () ? 0 : frequency_list_.size ();
|
||||
}
|
||||
|
||||
int FrequencyList_v2::impl::columnCount (QModelIndex const& parent) const
|
||||
{
|
||||
return parent.isValid () ? 0 : num_cols;
|
||||
}
|
||||
|
||||
Qt::ItemFlags FrequencyList_v2::impl::flags (QModelIndex const& index) const
|
||||
{
|
||||
auto result = QAbstractTableModel::flags (index) | Qt::ItemIsDropEnabled;
|
||||
auto row = index.row ();
|
||||
auto column = index.column ();
|
||||
if (index.isValid ()
|
||||
&& row < frequency_list_.size ()
|
||||
&& column < num_cols)
|
||||
{
|
||||
if (frequency_mhz_column != column)
|
||||
{
|
||||
result |= Qt::ItemIsEditable | Qt::ItemIsDragEnabled;
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
QVariant FrequencyList_v2::impl::data (QModelIndex const& index, int role) const
|
||||
{
|
||||
QVariant item;
|
||||
|
||||
auto const& row = index.row ();
|
||||
auto const& column = index.column ();
|
||||
|
||||
if (index.isValid ()
|
||||
&& row < frequency_list_.size ()
|
||||
&& column < num_cols)
|
||||
{
|
||||
auto const& frequency_item = frequency_list_.at (row);
|
||||
switch (column)
|
||||
{
|
||||
case region_column:
|
||||
switch (role)
|
||||
{
|
||||
case SortRole:
|
||||
case Qt::DisplayRole:
|
||||
case Qt::EditRole:
|
||||
case Qt::AccessibleTextRole:
|
||||
item = IARURegions::name (frequency_item.region_);
|
||||
break;
|
||||
|
||||
case Qt::ToolTipRole:
|
||||
case Qt::AccessibleDescriptionRole:
|
||||
item = tr ("IARU Region");
|
||||
break;
|
||||
|
||||
case Qt::TextAlignmentRole:
|
||||
item = Qt::AlignHCenter + Qt::AlignVCenter;
|
||||
break;
|
||||
}
|
||||
break;
|
||||
|
||||
case mode_column:
|
||||
switch (role)
|
||||
{
|
||||
case SortRole:
|
||||
case Qt::DisplayRole:
|
||||
case Qt::EditRole:
|
||||
case Qt::AccessibleTextRole:
|
||||
item = Modes::name (frequency_item.mode_);
|
||||
break;
|
||||
|
||||
case Qt::ToolTipRole:
|
||||
case Qt::AccessibleDescriptionRole:
|
||||
item = tr ("Mode");
|
||||
break;
|
||||
|
||||
case Qt::TextAlignmentRole:
|
||||
item = Qt::AlignHCenter + Qt::AlignVCenter;
|
||||
break;
|
||||
}
|
||||
break;
|
||||
|
||||
case frequency_column:
|
||||
switch (role)
|
||||
{
|
||||
case SortRole:
|
||||
case Qt::EditRole:
|
||||
case Qt::AccessibleTextRole:
|
||||
item = frequency_item.frequency_;
|
||||
break;
|
||||
|
||||
case Qt::DisplayRole:
|
||||
{
|
||||
auto const& band = bands_->find (frequency_item.frequency_);
|
||||
item = Radio::pretty_frequency_MHz_string (frequency_item.frequency_)
|
||||
+ " MHz (" + (band.isEmpty () ? "OOB" : band) + ')';
|
||||
}
|
||||
break;
|
||||
|
||||
case Qt::ToolTipRole:
|
||||
case Qt::AccessibleDescriptionRole:
|
||||
item = tr ("Frequency");
|
||||
break;
|
||||
|
||||
case Qt::TextAlignmentRole:
|
||||
item = Qt::AlignRight + Qt::AlignVCenter;
|
||||
break;
|
||||
}
|
||||
break;
|
||||
|
||||
case frequency_mhz_column:
|
||||
switch (role)
|
||||
{
|
||||
case Qt::EditRole:
|
||||
case Qt::AccessibleTextRole:
|
||||
item = Radio::frequency_MHz_string (frequency_item.frequency_);
|
||||
break;
|
||||
|
||||
case Qt::DisplayRole:
|
||||
{
|
||||
auto const& band = bands_->find (frequency_item.frequency_);
|
||||
item = Radio::pretty_frequency_MHz_string (frequency_item.frequency_)
|
||||
+ " MHz (" + (band.isEmpty () ? "OOB" : band) + ')';
|
||||
}
|
||||
break;
|
||||
|
||||
case Qt::ToolTipRole:
|
||||
case Qt::AccessibleDescriptionRole:
|
||||
item = tr ("Frequency (MHz)");
|
||||
break;
|
||||
|
||||
case Qt::TextAlignmentRole:
|
||||
item = Qt::AlignRight + Qt::AlignVCenter;
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
return item;
|
||||
}
|
||||
|
||||
bool FrequencyList_v2::impl::setData (QModelIndex const& model_index, QVariant const& value, int role)
|
||||
{
|
||||
bool changed {false};
|
||||
|
||||
auto const& row = model_index.row ();
|
||||
if (model_index.isValid ()
|
||||
&& Qt::EditRole == role
|
||||
&& row < frequency_list_.size ())
|
||||
{
|
||||
QVector<int> roles;
|
||||
roles << role;
|
||||
|
||||
auto& item = frequency_list_[row];
|
||||
switch (model_index.column ())
|
||||
{
|
||||
case region_column:
|
||||
if (value.canConvert<Region> ())
|
||||
{
|
||||
auto region = static_cast<Region> (value.toUInt ());
|
||||
if (region != item.region_)
|
||||
{
|
||||
item.region_ = region;
|
||||
Q_EMIT dataChanged (model_index, model_index, roles);
|
||||
changed = true;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case mode_column:
|
||||
if (value.canConvert<Mode> ())
|
||||
{
|
||||
auto mode = Modes::value (value.toString ());
|
||||
if (mode != item.mode_)
|
||||
{
|
||||
item.mode_ = mode;
|
||||
Q_EMIT dataChanged (model_index, model_index, roles);
|
||||
changed = true;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case frequency_column:
|
||||
if (value.canConvert<Frequency> ())
|
||||
{
|
||||
Radio::Frequency frequency {qvariant_cast <Radio::Frequency> (value)};
|
||||
if (frequency != item.frequency_)
|
||||
{
|
||||
item.frequency_ = frequency;
|
||||
// mark derived column (1) changed as well
|
||||
Q_EMIT dataChanged (index (model_index.row (), 1), model_index, roles);
|
||||
changed = true;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return changed;
|
||||
}
|
||||
|
||||
QVariant FrequencyList_v2::impl::headerData (int section, Qt::Orientation orientation, int role) const
|
||||
{
|
||||
QVariant header;
|
||||
if (Qt::DisplayRole == role
|
||||
&& Qt::Horizontal == orientation
|
||||
&& section < num_cols)
|
||||
{
|
||||
switch (section)
|
||||
{
|
||||
case region_column: header = tr ("IARU Region"); break;
|
||||
case mode_column: header = tr ("Mode"); break;
|
||||
case frequency_column: header = tr ("Frequency"); break;
|
||||
case frequency_mhz_column: header = tr ("Frequency (MHz)"); break;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
header = QAbstractTableModel::headerData (section, orientation, role);
|
||||
}
|
||||
return header;
|
||||
}
|
||||
|
||||
bool FrequencyList_v2::impl::removeRows (int row, int count, QModelIndex const& parent)
|
||||
{
|
||||
if (0 < count && (row + count) <= rowCount (parent))
|
||||
{
|
||||
beginRemoveRows (parent, row, row + count - 1);
|
||||
for (auto r = 0; r < count; ++r)
|
||||
{
|
||||
frequency_list_.removeAt (row);
|
||||
}
|
||||
endRemoveRows ();
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
bool FrequencyList_v2::impl::insertRows (int row, int count, QModelIndex const& parent)
|
||||
{
|
||||
if (0 < count)
|
||||
{
|
||||
beginInsertRows (parent, row, row + count - 1);
|
||||
for (auto r = 0; r < count; ++r)
|
||||
{
|
||||
frequency_list_.insert (row, Item {0, Mode::ALL, IARURegions::ALL});
|
||||
}
|
||||
endInsertRows ();
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
QStringList FrequencyList_v2::impl::mimeTypes () const
|
||||
{
|
||||
QStringList types;
|
||||
types << mime_type;
|
||||
return types;
|
||||
}
|
||||
|
||||
QMimeData * FrequencyList_v2::impl::mimeData (QModelIndexList const& items) const
|
||||
{
|
||||
QMimeData * mime_data = new QMimeData {};
|
||||
QByteArray encoded_data;
|
||||
QDataStream stream {&encoded_data, QIODevice::WriteOnly};
|
||||
|
||||
Q_FOREACH (auto const& item, items)
|
||||
{
|
||||
if (item.isValid () && frequency_column == item.column ())
|
||||
{
|
||||
stream << frequency_list_.at (item.row ());
|
||||
}
|
||||
}
|
||||
|
||||
mime_data->setData (mime_type, encoded_data);
|
||||
return mime_data;
|
||||
}
|
||||
|
||||
auto FrequencyList_v2::const_iterator::operator * () const -> Item const&
|
||||
{
|
||||
return parent_->frequency_list ().at(parent_->mapToSource (parent_->index (row_, 0)).row ());
|
||||
}
|
||||
|
||||
auto FrequencyList_v2::const_iterator::operator -> () const -> Item const *
|
||||
{
|
||||
return &parent_->frequency_list ().at(parent_->mapToSource (parent_->index (row_, 0)).row ());
|
||||
}
|
||||
|
||||
bool FrequencyList_v2::const_iterator::operator != (const_iterator const& rhs) const
|
||||
{
|
||||
return parent_ != rhs.parent_ || row_ != rhs.row_;
|
||||
}
|
||||
|
||||
bool FrequencyList_v2::const_iterator::operator == (const_iterator const& rhs) const
|
||||
{
|
||||
return parent_ == rhs.parent_ && row_ == rhs.row_;
|
||||
}
|
||||
|
||||
auto FrequencyList_v2::const_iterator::operator ++ () -> const_iterator&
|
||||
{
|
||||
++row_;
|
||||
return *this;
|
||||
}
|
||||
|
||||
auto FrequencyList_v2::begin () const -> const_iterator
|
||||
{
|
||||
return const_iterator (this, 0);
|
||||
}
|
||||
|
||||
auto FrequencyList_v2::end () const -> const_iterator
|
||||
{
|
||||
return const_iterator (this, rowCount ());
|
||||
}
|
||||
|
||||
auto FrequencyList_v2::find (Frequency f) const -> const_iterator
|
||||
{
|
||||
int row {0};
|
||||
for (; row < rowCount (); ++row)
|
||||
{
|
||||
if (m_->frequency_list_[mapToSource (index (row, 0)).row ()].frequency_ == f)
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
return const_iterator (this, row);
|
||||
}
|
||||
|
||||
auto FrequencyList_v2::filtered_bands () const -> BandSet
|
||||
{
|
||||
BandSet result;
|
||||
for (auto const& item : *this)
|
||||
{
|
||||
result << m_->bands_->find (item.frequency_);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
auto FrequencyList_v2::all_bands (Region region, Mode mode) const -> BandSet
|
||||
{
|
||||
BandSet result;
|
||||
for (auto const& item : m_->frequency_list_)
|
||||
{
|
||||
if (region == IARURegions::ALL || item.region_ == region
|
||||
|| mode == Modes::ALL || item.mode_ == mode)
|
||||
{
|
||||
result << m_->bands_->find (item.frequency_);
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
// Obsolete version of FrequencyList no longer used but needed to
|
||||
// allow loading and saving of old settings contents without damage
|
||||
//
|
||||
QDataStream& operator << (QDataStream& os, FrequencyList::Item const& item)
|
||||
{
|
||||
return os << item.frequency_
|
||||
<< item.mode_;
|
||||
}
|
||||
|
||||
QDataStream& operator >> (QDataStream& is, FrequencyList::Item& item)
|
||||
{
|
||||
return is >> item.frequency_
|
||||
>> item.mode_;
|
||||
}
|
||||
@@ -0,0 +1,465 @@
|
||||
/*==============================================================================
|
||||
Copyright (c) 2005-2010 Joel de Guzman
|
||||
Copyright (c) 2010 Thomas Heller
|
||||
|
||||
Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
==============================================================================*/
|
||||
template <typename Expr
|
||||
, typename A0 = void , typename A1 = void , typename A2 = void , typename A3 = void , typename A4 = void , typename A5 = void , typename A6 = void , typename A7 = void , typename A8 = void , typename A9 = void , typename A10 = void , typename A11 = void , typename A12 = void , typename A13 = void , typename A14 = void , typename A15 = void , typename A16 = void , typename A17 = void , typename A18 = void , typename A19 = void
|
||||
, typename Dummy = void>
|
||||
struct actor;
|
||||
template <typename Expr>
|
||||
struct nullary_actor_result
|
||||
{
|
||||
typedef
|
||||
typename boost::phoenix::evaluator::impl<
|
||||
Expr const&
|
||||
, vector2<
|
||||
vector1<const ::boost::phoenix::actor<Expr> *> &
|
||||
, default_actions
|
||||
> const &
|
||||
, proto::empty_env
|
||||
>::result_type
|
||||
type;
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
template <typename Expr, typename A0>
|
||||
struct actor<Expr, A0>
|
||||
{
|
||||
typedef
|
||||
typename phoenix::evaluator::
|
||||
impl<
|
||||
Expr const&
|
||||
, vector2<
|
||||
vector2<const ::boost::phoenix::actor<Expr> *, A0> &
|
||||
, default_actions
|
||||
> const &
|
||||
, proto::empty_env
|
||||
>::result_type
|
||||
type;
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
template <typename Expr, typename A0 , typename A1>
|
||||
struct actor<Expr, A0 , A1>
|
||||
{
|
||||
typedef
|
||||
typename phoenix::evaluator::
|
||||
impl<
|
||||
Expr const&
|
||||
, vector2<
|
||||
vector3<const ::boost::phoenix::actor<Expr> *, A0 , A1> &
|
||||
, default_actions
|
||||
> const &
|
||||
, proto::empty_env
|
||||
>::result_type
|
||||
type;
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
template <typename Expr, typename A0 , typename A1 , typename A2>
|
||||
struct actor<Expr, A0 , A1 , A2>
|
||||
{
|
||||
typedef
|
||||
typename phoenix::evaluator::
|
||||
impl<
|
||||
Expr const&
|
||||
, vector2<
|
||||
vector4<const ::boost::phoenix::actor<Expr> *, A0 , A1 , A2> &
|
||||
, default_actions
|
||||
> const &
|
||||
, proto::empty_env
|
||||
>::result_type
|
||||
type;
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
template <typename Expr, typename A0 , typename A1 , typename A2 , typename A3>
|
||||
struct actor<Expr, A0 , A1 , A2 , A3>
|
||||
{
|
||||
typedef
|
||||
typename phoenix::evaluator::
|
||||
impl<
|
||||
Expr const&
|
||||
, vector2<
|
||||
vector5<const ::boost::phoenix::actor<Expr> *, A0 , A1 , A2 , A3> &
|
||||
, default_actions
|
||||
> const &
|
||||
, proto::empty_env
|
||||
>::result_type
|
||||
type;
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
template <typename Expr, typename A0 , typename A1 , typename A2 , typename A3 , typename A4>
|
||||
struct actor<Expr, A0 , A1 , A2 , A3 , A4>
|
||||
{
|
||||
typedef
|
||||
typename phoenix::evaluator::
|
||||
impl<
|
||||
Expr const&
|
||||
, vector2<
|
||||
vector6<const ::boost::phoenix::actor<Expr> *, A0 , A1 , A2 , A3 , A4> &
|
||||
, default_actions
|
||||
> const &
|
||||
, proto::empty_env
|
||||
>::result_type
|
||||
type;
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
template <typename Expr, typename A0 , typename A1 , typename A2 , typename A3 , typename A4 , typename A5>
|
||||
struct actor<Expr, A0 , A1 , A2 , A3 , A4 , A5>
|
||||
{
|
||||
typedef
|
||||
typename phoenix::evaluator::
|
||||
impl<
|
||||
Expr const&
|
||||
, vector2<
|
||||
vector7<const ::boost::phoenix::actor<Expr> *, A0 , A1 , A2 , A3 , A4 , A5> &
|
||||
, default_actions
|
||||
> const &
|
||||
, proto::empty_env
|
||||
>::result_type
|
||||
type;
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
template <typename Expr, typename A0 , typename A1 , typename A2 , typename A3 , typename A4 , typename A5 , typename A6>
|
||||
struct actor<Expr, A0 , A1 , A2 , A3 , A4 , A5 , A6>
|
||||
{
|
||||
typedef
|
||||
typename phoenix::evaluator::
|
||||
impl<
|
||||
Expr const&
|
||||
, vector2<
|
||||
vector8<const ::boost::phoenix::actor<Expr> *, A0 , A1 , A2 , A3 , A4 , A5 , A6> &
|
||||
, default_actions
|
||||
> const &
|
||||
, proto::empty_env
|
||||
>::result_type
|
||||
type;
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
template <typename Expr, typename A0 , typename A1 , typename A2 , typename A3 , typename A4 , typename A5 , typename A6 , typename A7>
|
||||
struct actor<Expr, A0 , A1 , A2 , A3 , A4 , A5 , A6 , A7>
|
||||
{
|
||||
typedef
|
||||
typename phoenix::evaluator::
|
||||
impl<
|
||||
Expr const&
|
||||
, vector2<
|
||||
vector9<const ::boost::phoenix::actor<Expr> *, A0 , A1 , A2 , A3 , A4 , A5 , A6 , A7> &
|
||||
, default_actions
|
||||
> const &
|
||||
, proto::empty_env
|
||||
>::result_type
|
||||
type;
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
template <typename Expr, typename A0 , typename A1 , typename A2 , typename A3 , typename A4 , typename A5 , typename A6 , typename A7 , typename A8>
|
||||
struct actor<Expr, A0 , A1 , A2 , A3 , A4 , A5 , A6 , A7 , A8>
|
||||
{
|
||||
typedef
|
||||
typename phoenix::evaluator::
|
||||
impl<
|
||||
Expr const&
|
||||
, vector2<
|
||||
vector10<const ::boost::phoenix::actor<Expr> *, A0 , A1 , A2 , A3 , A4 , A5 , A6 , A7 , A8> &
|
||||
, default_actions
|
||||
> const &
|
||||
, proto::empty_env
|
||||
>::result_type
|
||||
type;
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
template <typename Expr, typename A0 , typename A1 , typename A2 , typename A3 , typename A4 , typename A5 , typename A6 , typename A7 , typename A8 , typename A9>
|
||||
struct actor<Expr, A0 , A1 , A2 , A3 , A4 , A5 , A6 , A7 , A8 , A9>
|
||||
{
|
||||
typedef
|
||||
typename phoenix::evaluator::
|
||||
impl<
|
||||
Expr const&
|
||||
, vector2<
|
||||
vector11<const ::boost::phoenix::actor<Expr> *, A0 , A1 , A2 , A3 , A4 , A5 , A6 , A7 , A8 , A9> &
|
||||
, default_actions
|
||||
> const &
|
||||
, proto::empty_env
|
||||
>::result_type
|
||||
type;
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
template <typename Expr, typename A0 , typename A1 , typename A2 , typename A3 , typename A4 , typename A5 , typename A6 , typename A7 , typename A8 , typename A9 , typename A10>
|
||||
struct actor<Expr, A0 , A1 , A2 , A3 , A4 , A5 , A6 , A7 , A8 , A9 , A10>
|
||||
{
|
||||
typedef
|
||||
typename phoenix::evaluator::
|
||||
impl<
|
||||
Expr const&
|
||||
, vector2<
|
||||
vector12<const ::boost::phoenix::actor<Expr> *, A0 , A1 , A2 , A3 , A4 , A5 , A6 , A7 , A8 , A9 , A10> &
|
||||
, default_actions
|
||||
> const &
|
||||
, proto::empty_env
|
||||
>::result_type
|
||||
type;
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
template <typename Expr, typename A0 , typename A1 , typename A2 , typename A3 , typename A4 , typename A5 , typename A6 , typename A7 , typename A8 , typename A9 , typename A10 , typename A11>
|
||||
struct actor<Expr, A0 , A1 , A2 , A3 , A4 , A5 , A6 , A7 , A8 , A9 , A10 , A11>
|
||||
{
|
||||
typedef
|
||||
typename phoenix::evaluator::
|
||||
impl<
|
||||
Expr const&
|
||||
, vector2<
|
||||
vector13<const ::boost::phoenix::actor<Expr> *, A0 , A1 , A2 , A3 , A4 , A5 , A6 , A7 , A8 , A9 , A10 , A11> &
|
||||
, default_actions
|
||||
> const &
|
||||
, proto::empty_env
|
||||
>::result_type
|
||||
type;
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
template <typename Expr, typename A0 , typename A1 , typename A2 , typename A3 , typename A4 , typename A5 , typename A6 , typename A7 , typename A8 , typename A9 , typename A10 , typename A11 , typename A12>
|
||||
struct actor<Expr, A0 , A1 , A2 , A3 , A4 , A5 , A6 , A7 , A8 , A9 , A10 , A11 , A12>
|
||||
{
|
||||
typedef
|
||||
typename phoenix::evaluator::
|
||||
impl<
|
||||
Expr const&
|
||||
, vector2<
|
||||
vector14<const ::boost::phoenix::actor<Expr> *, A0 , A1 , A2 , A3 , A4 , A5 , A6 , A7 , A8 , A9 , A10 , A11 , A12> &
|
||||
, default_actions
|
||||
> const &
|
||||
, proto::empty_env
|
||||
>::result_type
|
||||
type;
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
template <typename Expr, typename A0 , typename A1 , typename A2 , typename A3 , typename A4 , typename A5 , typename A6 , typename A7 , typename A8 , typename A9 , typename A10 , typename A11 , typename A12 , typename A13>
|
||||
struct actor<Expr, A0 , A1 , A2 , A3 , A4 , A5 , A6 , A7 , A8 , A9 , A10 , A11 , A12 , A13>
|
||||
{
|
||||
typedef
|
||||
typename phoenix::evaluator::
|
||||
impl<
|
||||
Expr const&
|
||||
, vector2<
|
||||
vector15<const ::boost::phoenix::actor<Expr> *, A0 , A1 , A2 , A3 , A4 , A5 , A6 , A7 , A8 , A9 , A10 , A11 , A12 , A13> &
|
||||
, default_actions
|
||||
> const &
|
||||
, proto::empty_env
|
||||
>::result_type
|
||||
type;
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
template <typename Expr, typename A0 , typename A1 , typename A2 , typename A3 , typename A4 , typename A5 , typename A6 , typename A7 , typename A8 , typename A9 , typename A10 , typename A11 , typename A12 , typename A13 , typename A14>
|
||||
struct actor<Expr, A0 , A1 , A2 , A3 , A4 , A5 , A6 , A7 , A8 , A9 , A10 , A11 , A12 , A13 , A14>
|
||||
{
|
||||
typedef
|
||||
typename phoenix::evaluator::
|
||||
impl<
|
||||
Expr const&
|
||||
, vector2<
|
||||
vector16<const ::boost::phoenix::actor<Expr> *, A0 , A1 , A2 , A3 , A4 , A5 , A6 , A7 , A8 , A9 , A10 , A11 , A12 , A13 , A14> &
|
||||
, default_actions
|
||||
> const &
|
||||
, proto::empty_env
|
||||
>::result_type
|
||||
type;
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
template <typename Expr, typename A0 , typename A1 , typename A2 , typename A3 , typename A4 , typename A5 , typename A6 , typename A7 , typename A8 , typename A9 , typename A10 , typename A11 , typename A12 , typename A13 , typename A14 , typename A15>
|
||||
struct actor<Expr, A0 , A1 , A2 , A3 , A4 , A5 , A6 , A7 , A8 , A9 , A10 , A11 , A12 , A13 , A14 , A15>
|
||||
{
|
||||
typedef
|
||||
typename phoenix::evaluator::
|
||||
impl<
|
||||
Expr const&
|
||||
, vector2<
|
||||
vector17<const ::boost::phoenix::actor<Expr> *, A0 , A1 , A2 , A3 , A4 , A5 , A6 , A7 , A8 , A9 , A10 , A11 , A12 , A13 , A14 , A15> &
|
||||
, default_actions
|
||||
> const &
|
||||
, proto::empty_env
|
||||
>::result_type
|
||||
type;
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
template <typename Expr, typename A0 , typename A1 , typename A2 , typename A3 , typename A4 , typename A5 , typename A6 , typename A7 , typename A8 , typename A9 , typename A10 , typename A11 , typename A12 , typename A13 , typename A14 , typename A15 , typename A16>
|
||||
struct actor<Expr, A0 , A1 , A2 , A3 , A4 , A5 , A6 , A7 , A8 , A9 , A10 , A11 , A12 , A13 , A14 , A15 , A16>
|
||||
{
|
||||
typedef
|
||||
typename phoenix::evaluator::
|
||||
impl<
|
||||
Expr const&
|
||||
, vector2<
|
||||
vector18<const ::boost::phoenix::actor<Expr> *, A0 , A1 , A2 , A3 , A4 , A5 , A6 , A7 , A8 , A9 , A10 , A11 , A12 , A13 , A14 , A15 , A16> &
|
||||
, default_actions
|
||||
> const &
|
||||
, proto::empty_env
|
||||
>::result_type
|
||||
type;
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
template <typename Expr, typename A0 , typename A1 , typename A2 , typename A3 , typename A4 , typename A5 , typename A6 , typename A7 , typename A8 , typename A9 , typename A10 , typename A11 , typename A12 , typename A13 , typename A14 , typename A15 , typename A16 , typename A17>
|
||||
struct actor<Expr, A0 , A1 , A2 , A3 , A4 , A5 , A6 , A7 , A8 , A9 , A10 , A11 , A12 , A13 , A14 , A15 , A16 , A17>
|
||||
{
|
||||
typedef
|
||||
typename phoenix::evaluator::
|
||||
impl<
|
||||
Expr const&
|
||||
, vector2<
|
||||
vector19<const ::boost::phoenix::actor<Expr> *, A0 , A1 , A2 , A3 , A4 , A5 , A6 , A7 , A8 , A9 , A10 , A11 , A12 , A13 , A14 , A15 , A16 , A17> &
|
||||
, default_actions
|
||||
> const &
|
||||
, proto::empty_env
|
||||
>::result_type
|
||||
type;
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
template <typename Expr, typename A0 , typename A1 , typename A2 , typename A3 , typename A4 , typename A5 , typename A6 , typename A7 , typename A8 , typename A9 , typename A10 , typename A11 , typename A12 , typename A13 , typename A14 , typename A15 , typename A16 , typename A17 , typename A18>
|
||||
struct actor<Expr, A0 , A1 , A2 , A3 , A4 , A5 , A6 , A7 , A8 , A9 , A10 , A11 , A12 , A13 , A14 , A15 , A16 , A17 , A18>
|
||||
{
|
||||
typedef
|
||||
typename phoenix::evaluator::
|
||||
impl<
|
||||
Expr const&
|
||||
, vector2<
|
||||
vector20<const ::boost::phoenix::actor<Expr> *, A0 , A1 , A2 , A3 , A4 , A5 , A6 , A7 , A8 , A9 , A10 , A11 , A12 , A13 , A14 , A15 , A16 , A17 , A18> &
|
||||
, default_actions
|
||||
> const &
|
||||
, proto::empty_env
|
||||
>::result_type
|
||||
type;
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
template <typename Expr, typename A0 , typename A1 , typename A2 , typename A3 , typename A4 , typename A5 , typename A6 , typename A7 , typename A8 , typename A9 , typename A10 , typename A11 , typename A12 , typename A13 , typename A14 , typename A15 , typename A16 , typename A17 , typename A18 , typename A19>
|
||||
struct actor<Expr, A0 , A1 , A2 , A3 , A4 , A5 , A6 , A7 , A8 , A9 , A10 , A11 , A12 , A13 , A14 , A15 , A16 , A17 , A18 , A19>
|
||||
{
|
||||
typedef
|
||||
typename phoenix::evaluator::
|
||||
impl<
|
||||
Expr const&
|
||||
, vector2<
|
||||
vector21<const ::boost::phoenix::actor<Expr> *, A0 , A1 , A2 , A3 , A4 , A5 , A6 , A7 , A8 , A9 , A10 , A11 , A12 , A13 , A14 , A15 , A16 , A17 , A18 , A19> &
|
||||
, default_actions
|
||||
> const &
|
||||
, proto::empty_env
|
||||
>::result_type
|
||||
type;
|
||||
};
|
||||
@@ -0,0 +1,25 @@
|
||||
/*==============================================================================
|
||||
Copyright (c) 2016 Kohei Takahashi
|
||||
|
||||
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_PHOENIX_PREPROCESSED_NEW_EXPR)
|
||||
#define BOOST_PHOENIX_PREPROCESSED_NEW_EXPR
|
||||
|
||||
#if BOOST_PHOENIX_LIMIT <= 10
|
||||
#include <boost/phoenix/object/detail/cpp03/preprocessed/new_expr_10.hpp>
|
||||
#elif BOOST_PHOENIX_LIMIT <= 20
|
||||
#include <boost/phoenix/object/detail/cpp03/preprocessed/new_expr_20.hpp>
|
||||
#elif BOOST_PHOENIX_LIMIT <= 30
|
||||
#include <boost/phoenix/object/detail/cpp03/preprocessed/new_expr_30.hpp>
|
||||
#elif BOOST_PHOENIX_LIMIT <= 40
|
||||
#include <boost/phoenix/object/detail/cpp03/preprocessed/new_expr_40.hpp>
|
||||
#elif BOOST_PHOENIX_LIMIT <= 50
|
||||
#include <boost/phoenix/object/detail/cpp03/preprocessed/new_expr_50.hpp>
|
||||
#else
|
||||
#error "BOOST_PHOENIX_LIMIT out of bounds for preprocessed headers"
|
||||
#endif
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,76 @@
|
||||
!subroutine xcor(ss,ipk,nsteps,nsym,lag1,lag2,ccf,ccf0,lagpk,flip,fdot,nrobust)
|
||||
subroutine xcor(ipk,nsteps,nsym,lag1,lag2,ccf,ccf0,lagpk,flip,fdot,nrobust)
|
||||
|
||||
! Computes ccf of a row of ss and the pseudo-random array pr. Returns
|
||||
! peak of the CCF and the lag at which peak occurs. For JT65, the
|
||||
! CCF peak may be either positive or negative, with negative implying
|
||||
! the "OOO" message.
|
||||
|
||||
use jt65_mod
|
||||
parameter (NHMAX=3413) !Max length of power spectra
|
||||
parameter (NSMAX=552) !Max number of quarter-symbol steps
|
||||
real ss(NSMAX,NHMAX) !2d spectrum, stepped by half-symbols
|
||||
real a(NSMAX)
|
||||
! real ccf(-44:118)
|
||||
real ccf(lag1:lag2)
|
||||
data lagmin/0/ !Silence g77 warning
|
||||
! save
|
||||
common/sync/ss
|
||||
|
||||
df=12000.0/8192.
|
||||
! dtstep=0.5/df
|
||||
dtstep=0.25/df
|
||||
fac=dtstep/(60.0*df)
|
||||
do j=1,nsteps
|
||||
ii=nint((j-nsteps/2)*fdot*fac)+ipk
|
||||
if( (ii.ge.1) .and. (ii.le.NHMAX) ) then
|
||||
a(j)=ss(j,ii)
|
||||
endif
|
||||
enddo
|
||||
|
||||
if(nrobust.eq.1) then
|
||||
! use robust correlation estimator to mitigate AGC attack spikes at beginning
|
||||
! this reduces the number of spurious candidates overall
|
||||
call pctile(a,nsteps,50,xmed)
|
||||
do j=1,nsteps
|
||||
if( a(j).ge.xmed ) then
|
||||
a(j)=1
|
||||
else
|
||||
a(j)=-1
|
||||
endif
|
||||
enddo
|
||||
endif
|
||||
|
||||
ccfmax=0.
|
||||
ccfmin=0.
|
||||
do lag=lag1,lag2
|
||||
x=0.
|
||||
do i=1,nsym
|
||||
j=4*i-3+lag
|
||||
if(j.ge.1 .and. j.le.nsteps) x=x+a(j)*pr(i)
|
||||
enddo
|
||||
ccf(lag)=2*x !The 2 is for plotting scale
|
||||
if(ccf(lag).gt.ccfmax) then
|
||||
ccfmax=ccf(lag)
|
||||
lagpk=lag
|
||||
endif
|
||||
|
||||
if(ccf(lag).lt.ccfmin) then
|
||||
ccfmin=ccf(lag)
|
||||
lagmin=lag
|
||||
endif
|
||||
enddo
|
||||
|
||||
ccf0=ccfmax
|
||||
flip=1.0
|
||||
if(-ccfmin.gt.ccfmax) then
|
||||
do lag=lag1,lag2
|
||||
ccf(lag)=-ccf(lag)
|
||||
enddo
|
||||
lagpk=lagmin
|
||||
ccf0=-ccfmin
|
||||
flip=-1.0
|
||||
endif
|
||||
|
||||
return
|
||||
end subroutine xcor
|
||||
@@ -0,0 +1,83 @@
|
||||
// (C) Copyright John Maddock 2007.
|
||||
// Use, modification and distribution are subject to the
|
||||
// Boost Software License, Version 1.0. (See accompanying file
|
||||
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
//
|
||||
// This file is machine generated, do not edit by hand
|
||||
|
||||
// Polynomial evaluation using second order Horners rule
|
||||
#ifndef BOOST_MATH_TOOLS_POLY_EVAL_9_HPP
|
||||
#define BOOST_MATH_TOOLS_POLY_EVAL_9_HPP
|
||||
|
||||
namespace boost{ namespace math{ namespace tools{ namespace detail{
|
||||
|
||||
template <class T, class V>
|
||||
inline V evaluate_polynomial_c_imp(const T*, const V&, const mpl::int_<0>*) BOOST_MATH_NOEXCEPT(V)
|
||||
{
|
||||
return static_cast<V>(0);
|
||||
}
|
||||
|
||||
template <class T, class V>
|
||||
inline V evaluate_polynomial_c_imp(const T* a, const V&, const mpl::int_<1>*) BOOST_MATH_NOEXCEPT(V)
|
||||
{
|
||||
return static_cast<V>(a[0]);
|
||||
}
|
||||
|
||||
template <class T, class V>
|
||||
inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<2>*) BOOST_MATH_NOEXCEPT(V)
|
||||
{
|
||||
return static_cast<V>(a[1] * x + a[0]);
|
||||
}
|
||||
|
||||
template <class T, class V>
|
||||
inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<3>*) BOOST_MATH_NOEXCEPT(V)
|
||||
{
|
||||
return static_cast<V>((a[2] * x + a[1]) * x + a[0]);
|
||||
}
|
||||
|
||||
template <class T, class V>
|
||||
inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<4>*) BOOST_MATH_NOEXCEPT(V)
|
||||
{
|
||||
return static_cast<V>(((a[3] * x + a[2]) * x + a[1]) * x + a[0]);
|
||||
}
|
||||
|
||||
template <class T, class V>
|
||||
inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<5>*) BOOST_MATH_NOEXCEPT(V)
|
||||
{
|
||||
V x2 = x * x;
|
||||
return static_cast<V>((a[4] * x2 + a[2]) * x2 + a[0] + (a[3] * x2 + a[1]) * x);
|
||||
}
|
||||
|
||||
template <class T, class V>
|
||||
inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<6>*) BOOST_MATH_NOEXCEPT(V)
|
||||
{
|
||||
V x2 = x * x;
|
||||
return static_cast<V>(((a[5] * x2 + a[3]) * x2 + a[1]) * x + (a[4] * x2 + a[2]) * x2 + a[0]);
|
||||
}
|
||||
|
||||
template <class T, class V>
|
||||
inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<7>*) BOOST_MATH_NOEXCEPT(V)
|
||||
{
|
||||
V x2 = x * x;
|
||||
return static_cast<V>(((a[6] * x2 + a[4]) * x2 + a[2]) * x2 + a[0] + ((a[5] * x2 + a[3]) * x2 + a[1]) * x);
|
||||
}
|
||||
|
||||
template <class T, class V>
|
||||
inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<8>*) BOOST_MATH_NOEXCEPT(V)
|
||||
{
|
||||
V x2 = x * x;
|
||||
return static_cast<V>((((a[7] * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x + ((a[6] * x2 + a[4]) * x2 + a[2]) * x2 + a[0]);
|
||||
}
|
||||
|
||||
template <class T, class V>
|
||||
inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<9>*) BOOST_MATH_NOEXCEPT(V)
|
||||
{
|
||||
V x2 = x * x;
|
||||
return static_cast<V>((((a[8] * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0] + (((a[7] * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x);
|
||||
}
|
||||
|
||||
|
||||
}}}} // namespaces
|
||||
|
||||
#endif // include guard
|
||||
|
||||
Reference in New Issue
Block a user