Initial Commit
This commit is contained in:
@@ -0,0 +1,40 @@
|
||||
// (C) Copyright 2009-2011 Frederic Bron.
|
||||
//
|
||||
// Use, modification and distribution are subject to the Boost Software License,
|
||||
// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt).
|
||||
//
|
||||
// See http://www.boost.org/libs/type_traits for most recent version including documentation.
|
||||
|
||||
#ifndef BOOST_TT_HAS_MULTIPLIES_HPP_INCLUDED
|
||||
#define BOOST_TT_HAS_MULTIPLIES_HPP_INCLUDED
|
||||
|
||||
#define BOOST_TT_TRAIT_NAME has_multiplies
|
||||
#define BOOST_TT_TRAIT_OP *
|
||||
#define BOOST_TT_FORBIDDEN_IF\
|
||||
/* pointer with pointer or fundamental */\
|
||||
(\
|
||||
(\
|
||||
::boost::is_pointer< Lhs_noref >::value && \
|
||||
(\
|
||||
::boost::is_fundamental< Rhs_nocv >::value || \
|
||||
::boost::is_pointer< Rhs_noref >::value\
|
||||
)\
|
||||
)||\
|
||||
(\
|
||||
::boost::is_pointer< Rhs_noref >::value && \
|
||||
(\
|
||||
::boost::is_fundamental< Lhs_nocv >::value || \
|
||||
::boost::is_pointer< Lhs_noref >::value\
|
||||
)\
|
||||
)\
|
||||
)
|
||||
|
||||
|
||||
#include <boost/type_traits/detail/has_binary_operator.hpp>
|
||||
|
||||
#undef BOOST_TT_TRAIT_NAME
|
||||
#undef BOOST_TT_TRAIT_OP
|
||||
#undef BOOST_TT_FORBIDDEN_IF
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,336 @@
|
||||
// (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
|
||||
|
||||
// Unrolled polynomial evaluation using second order Horners rule
|
||||
#ifndef BOOST_MATH_TOOLS_POLY_EVAL_16_HPP
|
||||
#define BOOST_MATH_TOOLS_POLY_EVAL_16_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;
|
||||
V t[2];
|
||||
t[0] = static_cast<V>(a[4] * x2 + a[2]);
|
||||
t[1] = static_cast<V>(a[3] * x2 + a[1]);
|
||||
t[0] *= x2;
|
||||
t[0] += static_cast<V>(a[0]);
|
||||
t[1] *= x;
|
||||
return t[0] + t[1];
|
||||
}
|
||||
|
||||
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;
|
||||
V t[2];
|
||||
t[0] = a[5] * x2 + a[3];
|
||||
t[1] = a[4] * x2 + a[2];
|
||||
t[0] *= x2;
|
||||
t[1] *= x2;
|
||||
t[0] += static_cast<V>(a[1]);
|
||||
t[1] += static_cast<V>(a[0]);
|
||||
t[0] *= x;
|
||||
return t[0] + t[1];
|
||||
}
|
||||
|
||||
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;
|
||||
V t[2];
|
||||
t[0] = static_cast<V>(a[6] * x2 + a[4]);
|
||||
t[1] = static_cast<V>(a[5] * x2 + a[3]);
|
||||
t[0] *= x2;
|
||||
t[1] *= x2;
|
||||
t[0] += static_cast<V>(a[2]);
|
||||
t[1] += static_cast<V>(a[1]);
|
||||
t[0] *= x2;
|
||||
t[0] += static_cast<V>(a[0]);
|
||||
t[1] *= x;
|
||||
return t[0] + t[1];
|
||||
}
|
||||
|
||||
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;
|
||||
V t[2];
|
||||
t[0] = a[7] * x2 + a[5];
|
||||
t[1] = a[6] * x2 + a[4];
|
||||
t[0] *= x2;
|
||||
t[1] *= x2;
|
||||
t[0] += static_cast<V>(a[3]);
|
||||
t[1] += static_cast<V>(a[2]);
|
||||
t[0] *= x2;
|
||||
t[1] *= x2;
|
||||
t[0] += static_cast<V>(a[1]);
|
||||
t[1] += static_cast<V>(a[0]);
|
||||
t[0] *= x;
|
||||
return t[0] + t[1];
|
||||
}
|
||||
|
||||
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;
|
||||
V t[2];
|
||||
t[0] = static_cast<V>(a[8] * x2 + a[6]);
|
||||
t[1] = static_cast<V>(a[7] * x2 + a[5]);
|
||||
t[0] *= x2;
|
||||
t[1] *= x2;
|
||||
t[0] += static_cast<V>(a[4]);
|
||||
t[1] += static_cast<V>(a[3]);
|
||||
t[0] *= x2;
|
||||
t[1] *= x2;
|
||||
t[0] += static_cast<V>(a[2]);
|
||||
t[1] += static_cast<V>(a[1]);
|
||||
t[0] *= x2;
|
||||
t[0] += static_cast<V>(a[0]);
|
||||
t[1] *= x;
|
||||
return t[0] + t[1];
|
||||
}
|
||||
|
||||
template <class T, class V>
|
||||
inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<10>*) BOOST_MATH_NOEXCEPT(V)
|
||||
{
|
||||
V x2 = x * x;
|
||||
V t[2];
|
||||
t[0] = a[9] * x2 + a[7];
|
||||
t[1] = a[8] * x2 + a[6];
|
||||
t[0] *= x2;
|
||||
t[1] *= x2;
|
||||
t[0] += static_cast<V>(a[5]);
|
||||
t[1] += static_cast<V>(a[4]);
|
||||
t[0] *= x2;
|
||||
t[1] *= x2;
|
||||
t[0] += static_cast<V>(a[3]);
|
||||
t[1] += static_cast<V>(a[2]);
|
||||
t[0] *= x2;
|
||||
t[1] *= x2;
|
||||
t[0] += static_cast<V>(a[1]);
|
||||
t[1] += static_cast<V>(a[0]);
|
||||
t[0] *= x;
|
||||
return t[0] + t[1];
|
||||
}
|
||||
|
||||
template <class T, class V>
|
||||
inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<11>*) BOOST_MATH_NOEXCEPT(V)
|
||||
{
|
||||
V x2 = x * x;
|
||||
V t[2];
|
||||
t[0] = static_cast<V>(a[10] * x2 + a[8]);
|
||||
t[1] = static_cast<V>(a[9] * x2 + a[7]);
|
||||
t[0] *= x2;
|
||||
t[1] *= x2;
|
||||
t[0] += static_cast<V>(a[6]);
|
||||
t[1] += static_cast<V>(a[5]);
|
||||
t[0] *= x2;
|
||||
t[1] *= x2;
|
||||
t[0] += static_cast<V>(a[4]);
|
||||
t[1] += static_cast<V>(a[3]);
|
||||
t[0] *= x2;
|
||||
t[1] *= x2;
|
||||
t[0] += static_cast<V>(a[2]);
|
||||
t[1] += static_cast<V>(a[1]);
|
||||
t[0] *= x2;
|
||||
t[0] += static_cast<V>(a[0]);
|
||||
t[1] *= x;
|
||||
return t[0] + t[1];
|
||||
}
|
||||
|
||||
template <class T, class V>
|
||||
inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<12>*) BOOST_MATH_NOEXCEPT(V)
|
||||
{
|
||||
V x2 = x * x;
|
||||
V t[2];
|
||||
t[0] = a[11] * x2 + a[9];
|
||||
t[1] = a[10] * x2 + a[8];
|
||||
t[0] *= x2;
|
||||
t[1] *= x2;
|
||||
t[0] += static_cast<V>(a[7]);
|
||||
t[1] += static_cast<V>(a[6]);
|
||||
t[0] *= x2;
|
||||
t[1] *= x2;
|
||||
t[0] += static_cast<V>(a[5]);
|
||||
t[1] += static_cast<V>(a[4]);
|
||||
t[0] *= x2;
|
||||
t[1] *= x2;
|
||||
t[0] += static_cast<V>(a[3]);
|
||||
t[1] += static_cast<V>(a[2]);
|
||||
t[0] *= x2;
|
||||
t[1] *= x2;
|
||||
t[0] += static_cast<V>(a[1]);
|
||||
t[1] += static_cast<V>(a[0]);
|
||||
t[0] *= x;
|
||||
return t[0] + t[1];
|
||||
}
|
||||
|
||||
template <class T, class V>
|
||||
inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<13>*) BOOST_MATH_NOEXCEPT(V)
|
||||
{
|
||||
V x2 = x * x;
|
||||
V t[2];
|
||||
t[0] = static_cast<V>(a[12] * x2 + a[10]);
|
||||
t[1] = static_cast<V>(a[11] * x2 + a[9]);
|
||||
t[0] *= x2;
|
||||
t[1] *= x2;
|
||||
t[0] += static_cast<V>(a[8]);
|
||||
t[1] += static_cast<V>(a[7]);
|
||||
t[0] *= x2;
|
||||
t[1] *= x2;
|
||||
t[0] += static_cast<V>(a[6]);
|
||||
t[1] += static_cast<V>(a[5]);
|
||||
t[0] *= x2;
|
||||
t[1] *= x2;
|
||||
t[0] += static_cast<V>(a[4]);
|
||||
t[1] += static_cast<V>(a[3]);
|
||||
t[0] *= x2;
|
||||
t[1] *= x2;
|
||||
t[0] += static_cast<V>(a[2]);
|
||||
t[1] += static_cast<V>(a[1]);
|
||||
t[0] *= x2;
|
||||
t[0] += static_cast<V>(a[0]);
|
||||
t[1] *= x;
|
||||
return t[0] + t[1];
|
||||
}
|
||||
|
||||
template <class T, class V>
|
||||
inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<14>*) BOOST_MATH_NOEXCEPT(V)
|
||||
{
|
||||
V x2 = x * x;
|
||||
V t[2];
|
||||
t[0] = a[13] * x2 + a[11];
|
||||
t[1] = a[12] * x2 + a[10];
|
||||
t[0] *= x2;
|
||||
t[1] *= x2;
|
||||
t[0] += static_cast<V>(a[9]);
|
||||
t[1] += static_cast<V>(a[8]);
|
||||
t[0] *= x2;
|
||||
t[1] *= x2;
|
||||
t[0] += static_cast<V>(a[7]);
|
||||
t[1] += static_cast<V>(a[6]);
|
||||
t[0] *= x2;
|
||||
t[1] *= x2;
|
||||
t[0] += static_cast<V>(a[5]);
|
||||
t[1] += static_cast<V>(a[4]);
|
||||
t[0] *= x2;
|
||||
t[1] *= x2;
|
||||
t[0] += static_cast<V>(a[3]);
|
||||
t[1] += static_cast<V>(a[2]);
|
||||
t[0] *= x2;
|
||||
t[1] *= x2;
|
||||
t[0] += static_cast<V>(a[1]);
|
||||
t[1] += static_cast<V>(a[0]);
|
||||
t[0] *= x;
|
||||
return t[0] + t[1];
|
||||
}
|
||||
|
||||
template <class T, class V>
|
||||
inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<15>*) BOOST_MATH_NOEXCEPT(V)
|
||||
{
|
||||
V x2 = x * x;
|
||||
V t[2];
|
||||
t[0] = static_cast<V>(a[14] * x2 + a[12]);
|
||||
t[1] = static_cast<V>(a[13] * x2 + a[11]);
|
||||
t[0] *= x2;
|
||||
t[1] *= x2;
|
||||
t[0] += static_cast<V>(a[10]);
|
||||
t[1] += static_cast<V>(a[9]);
|
||||
t[0] *= x2;
|
||||
t[1] *= x2;
|
||||
t[0] += static_cast<V>(a[8]);
|
||||
t[1] += static_cast<V>(a[7]);
|
||||
t[0] *= x2;
|
||||
t[1] *= x2;
|
||||
t[0] += static_cast<V>(a[6]);
|
||||
t[1] += static_cast<V>(a[5]);
|
||||
t[0] *= x2;
|
||||
t[1] *= x2;
|
||||
t[0] += static_cast<V>(a[4]);
|
||||
t[1] += static_cast<V>(a[3]);
|
||||
t[0] *= x2;
|
||||
t[1] *= x2;
|
||||
t[0] += static_cast<V>(a[2]);
|
||||
t[1] += static_cast<V>(a[1]);
|
||||
t[0] *= x2;
|
||||
t[0] += static_cast<V>(a[0]);
|
||||
t[1] *= x;
|
||||
return t[0] + t[1];
|
||||
}
|
||||
|
||||
template <class T, class V>
|
||||
inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<16>*) BOOST_MATH_NOEXCEPT(V)
|
||||
{
|
||||
V x2 = x * x;
|
||||
V t[2];
|
||||
t[0] = a[15] * x2 + a[13];
|
||||
t[1] = a[14] * x2 + a[12];
|
||||
t[0] *= x2;
|
||||
t[1] *= x2;
|
||||
t[0] += static_cast<V>(a[11]);
|
||||
t[1] += static_cast<V>(a[10]);
|
||||
t[0] *= x2;
|
||||
t[1] *= x2;
|
||||
t[0] += static_cast<V>(a[9]);
|
||||
t[1] += static_cast<V>(a[8]);
|
||||
t[0] *= x2;
|
||||
t[1] *= x2;
|
||||
t[0] += static_cast<V>(a[7]);
|
||||
t[1] += static_cast<V>(a[6]);
|
||||
t[0] *= x2;
|
||||
t[1] *= x2;
|
||||
t[0] += static_cast<V>(a[5]);
|
||||
t[1] += static_cast<V>(a[4]);
|
||||
t[0] *= x2;
|
||||
t[1] *= x2;
|
||||
t[0] += static_cast<V>(a[3]);
|
||||
t[1] += static_cast<V>(a[2]);
|
||||
t[0] *= x2;
|
||||
t[1] *= x2;
|
||||
t[0] += static_cast<V>(a[1]);
|
||||
t[1] += static_cast<V>(a[0]);
|
||||
t[0] *= x;
|
||||
return t[0] + t[1];
|
||||
}
|
||||
|
||||
|
||||
}}}} // namespaces
|
||||
|
||||
#endif // include guard
|
||||
|
||||
@@ -0,0 +1,65 @@
|
||||
subroutine gen9(msg0,ichk,msgsent,i4tone,itype)
|
||||
|
||||
! Encodes a JT9 message and returns msgsent, the message as it will
|
||||
! be decoded, and an integer array i4tone(85) of 9-FSK tone values
|
||||
! in the range 0-8.
|
||||
|
||||
use packjt
|
||||
character*22 msg0
|
||||
character*22 message !Message to be generated
|
||||
character*22 msgsent !Message as it will be received
|
||||
integer*4 i4Msg6BitWords(13) !72-bit message as 6-bit words
|
||||
integer*1 i1Msg8BitBytes(13) !72 bits and zero tail as 8-bit bytes
|
||||
integer*1 i1EncodedBits(207) !Encoded information-carrying bits
|
||||
integer*1 i1ScrambledBits(207) !Encoded bits after interleaving
|
||||
integer*4 i4DataSymbols(69) !Data symbols (values 0-7)
|
||||
integer*4 i4GrayCodedSymbols(69) !Gray-coded symbols (values 0-7)
|
||||
integer*4 i4tone(85) !Tone #s, data and sync (values 0-8)
|
||||
include 'jt9sync.f90'
|
||||
save
|
||||
|
||||
if(msg0(1:1).eq.'@') then
|
||||
read(msg0(2:5),*,end=1,err=1) nfreq
|
||||
go to 2
|
||||
1 nfreq=1000
|
||||
2 i4tone(1)=nfreq
|
||||
else
|
||||
message=msg0
|
||||
do i=1,22
|
||||
if(ichar(message(i:i)).eq.0) then
|
||||
message(i:)=' '
|
||||
exit
|
||||
endif
|
||||
enddo
|
||||
|
||||
do i=1,22 !Strip leading blanks
|
||||
if(message(1:1).ne.' ') exit
|
||||
message=message(i+1:)
|
||||
enddo
|
||||
|
||||
call packmsg(message,i4Msg6BitWords,itype,.false.) !Pack into 12 6-bit bytes
|
||||
call unpackmsg(i4Msg6BitWords,msgsent,.false.,' ') !Unpack to get msgsent
|
||||
if(ichk.ne.0) go to 999
|
||||
call entail(i4Msg6BitWords,i1Msg8BitBytes) !Add tail, make 8-bit bytes
|
||||
nsym2=206
|
||||
call encode232(i1Msg8BitBytes,nsym2,i1EncodedBits) !Encode K=32, r=1/2
|
||||
i1EncodedBits(207)=0
|
||||
call interleave9(i1EncodedBits,1,i1ScrambledBits) !Interleave bits
|
||||
i1ScrambledBits(207)=0
|
||||
call packbits(i1ScrambledBits,69,3,i4DataSymbols) !Pk 3-bits into words
|
||||
call graycode(i4DataSymbols,69,1,i4GrayCodedSymbols) !Apply Gray code
|
||||
|
||||
! Insert sync symbols at ntone=0 and add 1 to the data-tone numbers.
|
||||
j=0
|
||||
do i=1,85
|
||||
if(isync(i).eq.1) then
|
||||
i4tone(i)=0
|
||||
else
|
||||
j=j+1
|
||||
i4tone(i)=i4GrayCodedSymbols(j)+1
|
||||
endif
|
||||
enddo
|
||||
endif
|
||||
|
||||
999 return
|
||||
end subroutine gen9
|
||||
@@ -0,0 +1,114 @@
|
||||
// (C) Copyright John Maddock 2007.
|
||||
// Use, modification and distribution are subject to the
|
||||
// Boost Software License, Version 1.0. (See accompanying file
|
||||
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
//
|
||||
// This file is machine generated, do not edit by hand
|
||||
|
||||
// Polynomial evaluation using Horners rule
|
||||
#ifndef BOOST_MATH_TOOLS_POLY_EVAL_15_HPP
|
||||
#define BOOST_MATH_TOOLS_POLY_EVAL_15_HPP
|
||||
|
||||
namespace boost{ namespace math{ namespace tools{ namespace detail{
|
||||
|
||||
template <class T, class V>
|
||||
inline V evaluate_polynomial_c_imp(const T*, const V&, const mpl::int_<0>*) BOOST_MATH_NOEXCEPT(V)
|
||||
{
|
||||
return static_cast<V>(0);
|
||||
}
|
||||
|
||||
template <class T, class V>
|
||||
inline V evaluate_polynomial_c_imp(const T* a, const V&, const mpl::int_<1>*) BOOST_MATH_NOEXCEPT(V)
|
||||
{
|
||||
return static_cast<V>(a[0]);
|
||||
}
|
||||
|
||||
template <class T, class V>
|
||||
inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<2>*) BOOST_MATH_NOEXCEPT(V)
|
||||
{
|
||||
return static_cast<V>(a[1] * x + a[0]);
|
||||
}
|
||||
|
||||
template <class T, class V>
|
||||
inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<3>*) BOOST_MATH_NOEXCEPT(V)
|
||||
{
|
||||
return static_cast<V>((a[2] * x + a[1]) * x + a[0]);
|
||||
}
|
||||
|
||||
template <class T, class V>
|
||||
inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<4>*) BOOST_MATH_NOEXCEPT(V)
|
||||
{
|
||||
return static_cast<V>(((a[3] * x + a[2]) * x + a[1]) * x + a[0]);
|
||||
}
|
||||
|
||||
template <class T, class V>
|
||||
inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<5>*) BOOST_MATH_NOEXCEPT(V)
|
||||
{
|
||||
return static_cast<V>((((a[4] * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]);
|
||||
}
|
||||
|
||||
template <class T, class V>
|
||||
inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<6>*) BOOST_MATH_NOEXCEPT(V)
|
||||
{
|
||||
return static_cast<V>(((((a[5] * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]);
|
||||
}
|
||||
|
||||
template <class T, class V>
|
||||
inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<7>*) BOOST_MATH_NOEXCEPT(V)
|
||||
{
|
||||
return static_cast<V>((((((a[6] * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]);
|
||||
}
|
||||
|
||||
template <class T, class V>
|
||||
inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<8>*) BOOST_MATH_NOEXCEPT(V)
|
||||
{
|
||||
return static_cast<V>(((((((a[7] * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]);
|
||||
}
|
||||
|
||||
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)
|
||||
{
|
||||
return static_cast<V>((((((((a[8] * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]);
|
||||
}
|
||||
|
||||
template <class T, class V>
|
||||
inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<10>*) BOOST_MATH_NOEXCEPT(V)
|
||||
{
|
||||
return static_cast<V>(((((((((a[9] * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]);
|
||||
}
|
||||
|
||||
template <class T, class V>
|
||||
inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<11>*) BOOST_MATH_NOEXCEPT(V)
|
||||
{
|
||||
return static_cast<V>((((((((((a[10] * x + a[9]) * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]);
|
||||
}
|
||||
|
||||
template <class T, class V>
|
||||
inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<12>*) BOOST_MATH_NOEXCEPT(V)
|
||||
{
|
||||
return static_cast<V>(((((((((((a[11] * x + a[10]) * x + a[9]) * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]);
|
||||
}
|
||||
|
||||
template <class T, class V>
|
||||
inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<13>*) BOOST_MATH_NOEXCEPT(V)
|
||||
{
|
||||
return static_cast<V>((((((((((((a[12] * x + a[11]) * x + a[10]) * x + a[9]) * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]);
|
||||
}
|
||||
|
||||
template <class T, class V>
|
||||
inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<14>*) BOOST_MATH_NOEXCEPT(V)
|
||||
{
|
||||
return static_cast<V>(((((((((((((a[13] * x + a[12]) * x + a[11]) * x + a[10]) * x + a[9]) * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]);
|
||||
}
|
||||
|
||||
template <class T, class V>
|
||||
inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<15>*) BOOST_MATH_NOEXCEPT(V)
|
||||
{
|
||||
return static_cast<V>((((((((((((((a[14] * x + a[13]) * x + a[12]) * x + a[11]) * x + a[10]) * x + a[9]) * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]);
|
||||
}
|
||||
|
||||
|
||||
}}}} // namespaces
|
||||
|
||||
#endif // include guard
|
||||
|
||||
@@ -0,0 +1,75 @@
|
||||
#ifndef HAMLIB_TRANSCEIVER_HPP_
|
||||
#define HAMLIB_TRANSCEIVER_HPP_
|
||||
|
||||
#include <tuple>
|
||||
|
||||
#include <QString>
|
||||
|
||||
#include <hamlib/rig.h>
|
||||
|
||||
#include "TransceiverFactory.hpp"
|
||||
#include "PollingTransceiver.hpp"
|
||||
|
||||
extern "C"
|
||||
{
|
||||
typedef struct rig RIG;
|
||||
struct rig_caps;
|
||||
typedef int vfo_t;
|
||||
}
|
||||
|
||||
// hamlib transceiver and PTT mostly delegated directly to hamlib Rig class
|
||||
class HamlibTransceiver final
|
||||
: public PollingTransceiver
|
||||
{
|
||||
Q_OBJECT; // for translation context
|
||||
|
||||
public:
|
||||
static void register_transceivers (TransceiverFactory::Transceivers *);
|
||||
static void unregister_transceivers ();
|
||||
|
||||
explicit HamlibTransceiver (int model_number, TransceiverFactory::ParameterPack const&,
|
||||
QObject * parent = nullptr);
|
||||
explicit HamlibTransceiver (TransceiverFactory::PTTMethod ptt_type, QString const& ptt_port,
|
||||
QObject * parent = nullptr);
|
||||
|
||||
private:
|
||||
int do_start () override;
|
||||
void do_stop () override;
|
||||
void do_frequency (Frequency, MODE, bool no_ignore) override;
|
||||
void do_tx_frequency (Frequency, MODE, bool no_ignore) override;
|
||||
void do_mode (MODE) override;
|
||||
void do_ptt (bool) override;
|
||||
|
||||
void poll () override;
|
||||
|
||||
void error_check (int ret_code, QString const& doing) const;
|
||||
void set_conf (char const * item, char const * value);
|
||||
QByteArray get_conf (char const * item);
|
||||
Transceiver::MODE map_mode (rmode_t) const;
|
||||
rmode_t map_mode (Transceiver::MODE mode) const;
|
||||
std::tuple<vfo_t, vfo_t> get_vfos (bool for_split) const;
|
||||
|
||||
struct RIGDeleter {static void cleanup (RIG *);};
|
||||
QScopedPointer<RIG, RIGDeleter> rig_;
|
||||
|
||||
bool back_ptt_port_;
|
||||
bool one_VFO_;
|
||||
bool is_dummy_;
|
||||
|
||||
// these are saved on destruction so we can start new instances
|
||||
// where the last one left off
|
||||
static freq_t dummy_frequency_;
|
||||
static rmode_t dummy_mode_;
|
||||
|
||||
bool mutable reversed_;
|
||||
|
||||
bool freq_query_works_;
|
||||
bool mode_query_works_;
|
||||
bool split_query_works_;
|
||||
bool tickle_hamlib_; // Hamlib requires a
|
||||
// rig_set_split_vfo() call to
|
||||
// establish the Tx VFO
|
||||
bool get_vfo_works_; // Net rigctl promises what it can't deliver
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,40 @@
|
||||
This folder contains the sources of WSJT-X documentation. To build
|
||||
these you will need the asciidoctor tool installed.
|
||||
|
||||
If you do not wish to build the documentation, it is possible to skip
|
||||
this directory in the WSJT-X build by setting the CMake option
|
||||
WSJT_GENERATE_DOCS to OFF in your build tree.
|
||||
|
||||
|
||||
On Linux
|
||||
========
|
||||
|
||||
You will probably have these installed already if you are building the
|
||||
WSJT-X manpages, if you are not you will just need to install
|
||||
asciidoc:
|
||||
|
||||
sudo apt-get install asciidoctor
|
||||
|
||||
or
|
||||
|
||||
sudo yum install asciidoctor
|
||||
|
||||
or whatever your distribution and package management requires.
|
||||
|
||||
|
||||
On Mac OS X
|
||||
===========
|
||||
|
||||
I recommend MacPorts:
|
||||
|
||||
sudo port install rb-rubygems
|
||||
sudo gem install asciidoctor
|
||||
|
||||
|
||||
On Windows
|
||||
==========
|
||||
|
||||
The asciidoctor tool is a Ruby script so you will need to install a
|
||||
version of Ruby. The gem tool is a good way to install asciidoctor:
|
||||
|
||||
gem install asciidoctor
|
||||
@@ -0,0 +1,59 @@
|
||||
/*
|
||||
*
|
||||
* Copyright (c) 2003-2005
|
||||
* John Maddock
|
||||
*
|
||||
* Use, modification and distribution are subject to the
|
||||
* Boost Software License, Version 1.0. (See accompanying file
|
||||
* LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
*
|
||||
*/
|
||||
|
||||
/*
|
||||
* LOCATION: see http://www.boost.org for most recent version.
|
||||
* FILE error_type.hpp
|
||||
* VERSION see <boost/version.hpp>
|
||||
* DESCRIPTION: Declares regular expression error type enumerator.
|
||||
*/
|
||||
|
||||
#ifndef BOOST_REGEX_ERROR_TYPE_HPP
|
||||
#define BOOST_REGEX_ERROR_TYPE_HPP
|
||||
|
||||
#ifdef __cplusplus
|
||||
namespace boost{
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
namespace regex_constants{
|
||||
|
||||
enum error_type{
|
||||
|
||||
error_ok = 0, /* not used */
|
||||
error_no_match = 1, /* not used */
|
||||
error_bad_pattern = 2,
|
||||
error_collate = 3,
|
||||
error_ctype = 4,
|
||||
error_escape = 5,
|
||||
error_backref = 6,
|
||||
error_brack = 7,
|
||||
error_paren = 8,
|
||||
error_brace = 9,
|
||||
error_badbrace = 10,
|
||||
error_range = 11,
|
||||
error_space = 12,
|
||||
error_badrepeat = 13,
|
||||
error_end = 14, /* not used */
|
||||
error_size = 15,
|
||||
error_right_paren = 16, /* not used */
|
||||
error_empty = 17,
|
||||
error_complexity = 18,
|
||||
error_stack = 19,
|
||||
error_perl_extension = 20,
|
||||
error_unknown = 21
|
||||
};
|
||||
|
||||
}
|
||||
}
|
||||
#endif /* __cplusplus */
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,46 @@
|
||||
|
||||
// (C) Copyright Dave Abrahams, Steve Cleary, Beman Dawes, Howard
|
||||
// Hinnant & John Maddock 2000.
|
||||
// Use, modification and distribution are subject to the Boost Software License,
|
||||
// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt).
|
||||
//
|
||||
// See http://www.boost.org/libs/type_traits for most recent version including documentation.
|
||||
|
||||
#ifndef BOOST_TT_ADD_CONST_HPP_INCLUDED
|
||||
#define BOOST_TT_ADD_CONST_HPP_INCLUDED
|
||||
|
||||
#include <boost/type_traits/detail/config.hpp>
|
||||
|
||||
namespace boost {
|
||||
|
||||
// * convert a type T to const type - add_const<T>
|
||||
// this is not required since the result is always
|
||||
// the same as "T const", but it does suppress warnings
|
||||
// from some compilers:
|
||||
|
||||
#if defined(BOOST_MSVC)
|
||||
// This bogus warning will appear when add_const is applied to a
|
||||
// const volatile reference because we can't detect const volatile
|
||||
// references with MSVC6.
|
||||
# pragma warning(push)
|
||||
# pragma warning(disable:4181) // warning C4181: qualifier applied to reference type ignored
|
||||
#endif
|
||||
|
||||
template <class T> struct add_const
|
||||
{
|
||||
typedef T const type;
|
||||
};
|
||||
|
||||
#if defined(BOOST_MSVC)
|
||||
# pragma warning(pop)
|
||||
#endif
|
||||
|
||||
template <class T> struct add_const<T&>
|
||||
{
|
||||
typedef T& type;
|
||||
};
|
||||
|
||||
} // namespace boost
|
||||
|
||||
#endif // BOOST_TT_ADD_CONST_HPP_INCLUDED
|
||||
@@ -0,0 +1,89 @@
|
||||
#ifndef BOOST_SMART_PTR_ENABLE_SHARED_FROM_THIS_HPP_INCLUDED
|
||||
#define BOOST_SMART_PTR_ENABLE_SHARED_FROM_THIS_HPP_INCLUDED
|
||||
|
||||
//
|
||||
// enable_shared_from_this.hpp
|
||||
//
|
||||
// Copyright 2002, 2009 Peter Dimov
|
||||
//
|
||||
// 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
|
||||
//
|
||||
// http://www.boost.org/libs/smart_ptr/enable_shared_from_this.html
|
||||
//
|
||||
|
||||
#include <boost/smart_ptr/weak_ptr.hpp>
|
||||
#include <boost/smart_ptr/shared_ptr.hpp>
|
||||
#include <boost/assert.hpp>
|
||||
#include <boost/config.hpp>
|
||||
|
||||
namespace boost
|
||||
{
|
||||
|
||||
template<class T> class enable_shared_from_this
|
||||
{
|
||||
protected:
|
||||
|
||||
enable_shared_from_this() BOOST_NOEXCEPT
|
||||
{
|
||||
}
|
||||
|
||||
enable_shared_from_this(enable_shared_from_this const &) BOOST_NOEXCEPT
|
||||
{
|
||||
}
|
||||
|
||||
enable_shared_from_this & operator=(enable_shared_from_this const &) BOOST_NOEXCEPT
|
||||
{
|
||||
return *this;
|
||||
}
|
||||
|
||||
~enable_shared_from_this() BOOST_NOEXCEPT // ~weak_ptr<T> newer throws, so this call also must not throw
|
||||
{
|
||||
}
|
||||
|
||||
public:
|
||||
|
||||
shared_ptr<T> shared_from_this()
|
||||
{
|
||||
shared_ptr<T> p( weak_this_ );
|
||||
BOOST_ASSERT( p.get() == this );
|
||||
return p;
|
||||
}
|
||||
|
||||
shared_ptr<T const> shared_from_this() const
|
||||
{
|
||||
shared_ptr<T const> p( weak_this_ );
|
||||
BOOST_ASSERT( p.get() == this );
|
||||
return p;
|
||||
}
|
||||
|
||||
weak_ptr<T> weak_from_this() BOOST_NOEXCEPT
|
||||
{
|
||||
return weak_this_;
|
||||
}
|
||||
|
||||
weak_ptr<T const> weak_from_this() const BOOST_NOEXCEPT
|
||||
{
|
||||
return weak_this_;
|
||||
}
|
||||
|
||||
public: // actually private, but avoids compiler template friendship issues
|
||||
|
||||
// Note: invoked automatically by shared_ptr; do not call
|
||||
template<class X, class Y> void _internal_accept_owner( shared_ptr<X> const * ppx, Y * py ) const
|
||||
{
|
||||
if( weak_this_.expired() )
|
||||
{
|
||||
weak_this_ = shared_ptr<T>( *ppx, py );
|
||||
}
|
||||
}
|
||||
|
||||
private:
|
||||
|
||||
mutable weak_ptr<T> weak_this_;
|
||||
};
|
||||
|
||||
} // namespace boost
|
||||
|
||||
#endif // #ifndef BOOST_SMART_PTR_ENABLE_SHARED_FROM_THIS_HPP_INCLUDED
|
||||
@@ -0,0 +1,82 @@
|
||||
// Copyright (c) 2007 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)
|
||||
|
||||
#ifndef BOOST_MATH_COS_PI_HPP
|
||||
#define BOOST_MATH_COS_PI_HPP
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#pragma once
|
||||
#endif
|
||||
|
||||
#include <boost/math/special_functions/math_fwd.hpp>
|
||||
#include <boost/config/no_tr1/cmath.hpp>
|
||||
#include <boost/math/tools/config.hpp>
|
||||
#include <boost/math/special_functions/trunc.hpp>
|
||||
#include <boost/math/tools/promotion.hpp>
|
||||
#include <boost/math/constants/constants.hpp>
|
||||
|
||||
namespace boost{ namespace math{ namespace detail{
|
||||
|
||||
template <class T, class Policy>
|
||||
T cos_pi_imp(T x, const Policy& pol)
|
||||
{
|
||||
BOOST_MATH_STD_USING // ADL of std names
|
||||
// cos of pi*x:
|
||||
bool invert = false;
|
||||
if(fabs(x) < 0.25)
|
||||
return cos(constants::pi<T>() * x);
|
||||
|
||||
if(x < 0)
|
||||
{
|
||||
x = -x;
|
||||
}
|
||||
T rem = floor(x);
|
||||
if(itrunc(rem, pol) & 1)
|
||||
invert = !invert;
|
||||
rem = x - rem;
|
||||
if(rem > 0.5f)
|
||||
{
|
||||
rem = 1 - rem;
|
||||
invert = !invert;
|
||||
}
|
||||
if(rem == 0.5f)
|
||||
return 0;
|
||||
|
||||
if(rem > 0.25f)
|
||||
{
|
||||
rem = 0.5f - rem;
|
||||
rem = sin(constants::pi<T>() * rem);
|
||||
}
|
||||
else
|
||||
rem = cos(constants::pi<T>() * rem);
|
||||
return invert ? T(-rem) : rem;
|
||||
}
|
||||
|
||||
} // namespace detail
|
||||
|
||||
template <class T, class Policy>
|
||||
inline typename tools::promote_args<T>::type cos_pi(T x, const Policy&)
|
||||
{
|
||||
typedef typename tools::promote_args<T>::type result_type;
|
||||
typedef typename policies::evaluation<result_type, Policy>::type value_type;
|
||||
typedef typename policies::normalise<
|
||||
Policy,
|
||||
policies::promote_float<false>,
|
||||
policies::promote_double<false>,
|
||||
policies::discrete_quantile<>,
|
||||
policies::assert_undefined<> >::type forwarding_policy;
|
||||
return policies::checked_narrowing_cast<result_type, forwarding_policy>(boost::math::detail::cos_pi_imp<value_type>(x, forwarding_policy()), "cos_pi");
|
||||
}
|
||||
|
||||
template <class T>
|
||||
inline typename tools::promote_args<T>::type cos_pi(T x)
|
||||
{
|
||||
return boost::math::cos_pi(x, policies::policy<>());
|
||||
}
|
||||
|
||||
} // namespace math
|
||||
} // namespace boost
|
||||
#endif
|
||||
|
||||
@@ -0,0 +1,154 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2001-2011 Joel de Guzman
|
||||
|
||||
Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
This is an auto-generated file. Do not edit!
|
||||
==============================================================================*/
|
||||
namespace boost { namespace fusion { namespace detail
|
||||
{
|
||||
template <typename T0 , typename T1 , typename T2 , typename T3 , typename T4 , typename T5 , typename T6 , typename T7 , typename T8 , typename T9 , typename T10 , typename T11 , typename T12 , typename T13 , typename T14 , typename T15 , typename T16 , typename T17 , typename T18 , typename T19>
|
||||
struct vector_n_chooser
|
||||
{
|
||||
typedef vector20<T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13 , T14 , T15 , T16 , T17 , T18 , T19> type;
|
||||
};
|
||||
template <>
|
||||
struct vector_n_chooser<void_ , void_ , void_ , void_ , void_ , void_ , void_ , void_ , void_ , void_ , void_ , void_ , void_ , void_ , void_ , void_ , void_ , void_ , void_ , void_>
|
||||
{
|
||||
typedef vector0<> type;
|
||||
};
|
||||
template <typename T0>
|
||||
struct vector_n_chooser<
|
||||
T0
|
||||
, void_ , void_ , void_ , void_ , void_ , void_ , void_ , void_ , void_ , void_ , void_ , void_ , void_ , void_ , void_ , void_ , void_ , void_ , void_>
|
||||
{
|
||||
typedef vector1<T0> type;
|
||||
};
|
||||
template <typename T0 , typename T1>
|
||||
struct vector_n_chooser<
|
||||
T0 , T1
|
||||
, void_ , void_ , void_ , void_ , void_ , void_ , void_ , void_ , void_ , void_ , void_ , void_ , void_ , void_ , void_ , void_ , void_ , void_>
|
||||
{
|
||||
typedef vector2<T0 , T1> type;
|
||||
};
|
||||
template <typename T0 , typename T1 , typename T2>
|
||||
struct vector_n_chooser<
|
||||
T0 , T1 , T2
|
||||
, void_ , void_ , void_ , void_ , void_ , void_ , void_ , void_ , void_ , void_ , void_ , void_ , void_ , void_ , void_ , void_ , void_>
|
||||
{
|
||||
typedef vector3<T0 , T1 , T2> type;
|
||||
};
|
||||
template <typename T0 , typename T1 , typename T2 , typename T3>
|
||||
struct vector_n_chooser<
|
||||
T0 , T1 , T2 , T3
|
||||
, void_ , void_ , void_ , void_ , void_ , void_ , void_ , void_ , void_ , void_ , void_ , void_ , void_ , void_ , void_ , void_>
|
||||
{
|
||||
typedef vector4<T0 , T1 , T2 , T3> type;
|
||||
};
|
||||
template <typename T0 , typename T1 , typename T2 , typename T3 , typename T4>
|
||||
struct vector_n_chooser<
|
||||
T0 , T1 , T2 , T3 , T4
|
||||
, void_ , void_ , void_ , void_ , void_ , void_ , void_ , void_ , void_ , void_ , void_ , void_ , void_ , void_ , void_>
|
||||
{
|
||||
typedef vector5<T0 , T1 , T2 , T3 , T4> type;
|
||||
};
|
||||
template <typename T0 , typename T1 , typename T2 , typename T3 , typename T4 , typename T5>
|
||||
struct vector_n_chooser<
|
||||
T0 , T1 , T2 , T3 , T4 , T5
|
||||
, void_ , void_ , void_ , void_ , void_ , void_ , void_ , void_ , void_ , void_ , void_ , void_ , void_ , void_>
|
||||
{
|
||||
typedef vector6<T0 , T1 , T2 , T3 , T4 , T5> type;
|
||||
};
|
||||
template <typename T0 , typename T1 , typename T2 , typename T3 , typename T4 , typename T5 , typename T6>
|
||||
struct vector_n_chooser<
|
||||
T0 , T1 , T2 , T3 , T4 , T5 , T6
|
||||
, void_ , void_ , void_ , void_ , void_ , void_ , void_ , void_ , void_ , void_ , void_ , void_ , void_>
|
||||
{
|
||||
typedef vector7<T0 , T1 , T2 , T3 , T4 , T5 , T6> type;
|
||||
};
|
||||
template <typename T0 , typename T1 , typename T2 , typename T3 , typename T4 , typename T5 , typename T6 , typename T7>
|
||||
struct vector_n_chooser<
|
||||
T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7
|
||||
, void_ , void_ , void_ , void_ , void_ , void_ , void_ , void_ , void_ , void_ , void_ , void_>
|
||||
{
|
||||
typedef vector8<T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7> type;
|
||||
};
|
||||
template <typename T0 , typename T1 , typename T2 , typename T3 , typename T4 , typename T5 , typename T6 , typename T7 , typename T8>
|
||||
struct vector_n_chooser<
|
||||
T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8
|
||||
, void_ , void_ , void_ , void_ , void_ , void_ , void_ , void_ , void_ , void_ , void_>
|
||||
{
|
||||
typedef vector9<T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8> type;
|
||||
};
|
||||
template <typename T0 , typename T1 , typename T2 , typename T3 , typename T4 , typename T5 , typename T6 , typename T7 , typename T8 , typename T9>
|
||||
struct vector_n_chooser<
|
||||
T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9
|
||||
, void_ , void_ , void_ , void_ , void_ , void_ , void_ , void_ , void_ , void_>
|
||||
{
|
||||
typedef vector10<T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9> type;
|
||||
};
|
||||
template <typename T0 , typename T1 , typename T2 , typename T3 , typename T4 , typename T5 , typename T6 , typename T7 , typename T8 , typename T9 , typename T10>
|
||||
struct vector_n_chooser<
|
||||
T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10
|
||||
, void_ , void_ , void_ , void_ , void_ , void_ , void_ , void_ , void_>
|
||||
{
|
||||
typedef vector11<T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10> type;
|
||||
};
|
||||
template <typename T0 , typename T1 , typename T2 , typename T3 , typename T4 , typename T5 , typename T6 , typename T7 , typename T8 , typename T9 , typename T10 , typename T11>
|
||||
struct vector_n_chooser<
|
||||
T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11
|
||||
, void_ , void_ , void_ , void_ , void_ , void_ , void_ , void_>
|
||||
{
|
||||
typedef vector12<T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11> type;
|
||||
};
|
||||
template <typename T0 , typename T1 , typename T2 , typename T3 , typename T4 , typename T5 , typename T6 , typename T7 , typename T8 , typename T9 , typename T10 , typename T11 , typename T12>
|
||||
struct vector_n_chooser<
|
||||
T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12
|
||||
, void_ , void_ , void_ , void_ , void_ , void_ , void_>
|
||||
{
|
||||
typedef vector13<T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12> type;
|
||||
};
|
||||
template <typename T0 , typename T1 , typename T2 , typename T3 , typename T4 , typename T5 , typename T6 , typename T7 , typename T8 , typename T9 , typename T10 , typename T11 , typename T12 , typename T13>
|
||||
struct vector_n_chooser<
|
||||
T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13
|
||||
, void_ , void_ , void_ , void_ , void_ , void_>
|
||||
{
|
||||
typedef vector14<T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13> type;
|
||||
};
|
||||
template <typename T0 , typename T1 , typename T2 , typename T3 , typename T4 , typename T5 , typename T6 , typename T7 , typename T8 , typename T9 , typename T10 , typename T11 , typename T12 , typename T13 , typename T14>
|
||||
struct vector_n_chooser<
|
||||
T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13 , T14
|
||||
, void_ , void_ , void_ , void_ , void_>
|
||||
{
|
||||
typedef vector15<T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13 , T14> type;
|
||||
};
|
||||
template <typename T0 , typename T1 , typename T2 , typename T3 , typename T4 , typename T5 , typename T6 , typename T7 , typename T8 , typename T9 , typename T10 , typename T11 , typename T12 , typename T13 , typename T14 , typename T15>
|
||||
struct vector_n_chooser<
|
||||
T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13 , T14 , T15
|
||||
, void_ , void_ , void_ , void_>
|
||||
{
|
||||
typedef vector16<T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13 , T14 , T15> type;
|
||||
};
|
||||
template <typename T0 , typename T1 , typename T2 , typename T3 , typename T4 , typename T5 , typename T6 , typename T7 , typename T8 , typename T9 , typename T10 , typename T11 , typename T12 , typename T13 , typename T14 , typename T15 , typename T16>
|
||||
struct vector_n_chooser<
|
||||
T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13 , T14 , T15 , T16
|
||||
, void_ , void_ , void_>
|
||||
{
|
||||
typedef vector17<T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13 , T14 , T15 , T16> type;
|
||||
};
|
||||
template <typename T0 , typename T1 , typename T2 , typename T3 , typename T4 , typename T5 , typename T6 , typename T7 , typename T8 , typename T9 , typename T10 , typename T11 , typename T12 , typename T13 , typename T14 , typename T15 , typename T16 , typename T17>
|
||||
struct vector_n_chooser<
|
||||
T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13 , T14 , T15 , T16 , T17
|
||||
, void_ , void_>
|
||||
{
|
||||
typedef vector18<T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13 , T14 , T15 , T16 , T17> type;
|
||||
};
|
||||
template <typename T0 , typename T1 , typename T2 , typename T3 , typename T4 , typename T5 , typename T6 , typename T7 , typename T8 , typename T9 , typename T10 , typename T11 , typename T12 , typename T13 , typename T14 , typename T15 , typename T16 , typename T17 , typename T18>
|
||||
struct vector_n_chooser<
|
||||
T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13 , T14 , T15 , T16 , T17 , T18
|
||||
, void_>
|
||||
{
|
||||
typedef vector19<T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13 , T14 , T15 , T16 , T17 , T18> type;
|
||||
};
|
||||
}}}
|
||||
@@ -0,0 +1,48 @@
|
||||
# /* **************************************************************************
|
||||
# * *
|
||||
# * (C) Copyright Paul Mensonides 2002.
|
||||
# * Distributed under the Boost Software License, Version 1.0. (See
|
||||
# * accompanying file LICENSE_1_0.txt or copy at
|
||||
# * http://www.boost.org/LICENSE_1_0.txt)
|
||||
# * *
|
||||
# ************************************************************************** */
|
||||
#
|
||||
# /* See http://www.boost.org for most recent version. */
|
||||
#
|
||||
# ifndef BOOST_PREPROCESSOR_DETAIL_CHECK_HPP
|
||||
# define BOOST_PREPROCESSOR_DETAIL_CHECK_HPP
|
||||
#
|
||||
# include <boost/preprocessor/cat.hpp>
|
||||
# include <boost/preprocessor/config/config.hpp>
|
||||
#
|
||||
# /* BOOST_PP_CHECK */
|
||||
#
|
||||
# if ~BOOST_PP_CONFIG_FLAGS() & BOOST_PP_CONFIG_MWCC()
|
||||
# define BOOST_PP_CHECK(x, type) BOOST_PP_CHECK_D(x, type)
|
||||
# else
|
||||
# define BOOST_PP_CHECK(x, type) BOOST_PP_CHECK_OO((x, type))
|
||||
# define BOOST_PP_CHECK_OO(par) BOOST_PP_CHECK_D ## par
|
||||
# endif
|
||||
#
|
||||
# if ~BOOST_PP_CONFIG_FLAGS() & BOOST_PP_CONFIG_MSVC() && ~BOOST_PP_CONFIG_FLAGS() & BOOST_PP_CONFIG_DMC()
|
||||
# define BOOST_PP_CHECK_D(x, type) BOOST_PP_CHECK_1(BOOST_PP_CAT(BOOST_PP_CHECK_RESULT_, type x))
|
||||
# define BOOST_PP_CHECK_1(chk) BOOST_PP_CHECK_2(chk)
|
||||
# define BOOST_PP_CHECK_2(res, _) res
|
||||
# elif BOOST_PP_CONFIG_FLAGS() & BOOST_PP_CONFIG_MSVC()
|
||||
# define BOOST_PP_CHECK_D(x, type) BOOST_PP_CHECK_1(type x)
|
||||
# define BOOST_PP_CHECK_1(chk) BOOST_PP_CHECK_2(chk)
|
||||
# define BOOST_PP_CHECK_2(chk) BOOST_PP_CHECK_3((BOOST_PP_CHECK_RESULT_ ## chk))
|
||||
# define BOOST_PP_CHECK_3(im) BOOST_PP_CHECK_5(BOOST_PP_CHECK_4 im)
|
||||
# define BOOST_PP_CHECK_4(res, _) res
|
||||
# define BOOST_PP_CHECK_5(res) res
|
||||
# else /* DMC */
|
||||
# define BOOST_PP_CHECK_D(x, type) BOOST_PP_CHECK_OO((type x))
|
||||
# define BOOST_PP_CHECK_OO(par) BOOST_PP_CHECK_0 ## par
|
||||
# define BOOST_PP_CHECK_0(chk) BOOST_PP_CHECK_1(BOOST_PP_CAT(BOOST_PP_CHECK_RESULT_, chk))
|
||||
# define BOOST_PP_CHECK_1(chk) BOOST_PP_CHECK_2(chk)
|
||||
# define BOOST_PP_CHECK_2(res, _) res
|
||||
# endif
|
||||
#
|
||||
# define BOOST_PP_CHECK_RESULT_1 1, BOOST_PP_NIL
|
||||
#
|
||||
# endif
|
||||
@@ -0,0 +1,48 @@
|
||||
# /* **************************************************************************
|
||||
# * *
|
||||
# * (C) Copyright Paul Mensonides 2002.
|
||||
# * Distributed under the Boost Software License, Version 1.0. (See
|
||||
# * accompanying file LICENSE_1_0.txt or copy at
|
||||
# * http://www.boost.org/LICENSE_1_0.txt)
|
||||
# * *
|
||||
# ************************************************************************** */
|
||||
#
|
||||
# /* See http://www.boost.org for most recent version. */
|
||||
#
|
||||
# ifndef BOOST_PREPROCESSOR_SEQ_TRANSFORM_HPP
|
||||
# define BOOST_PREPROCESSOR_SEQ_TRANSFORM_HPP
|
||||
#
|
||||
# include <boost/preprocessor/config/config.hpp>
|
||||
# include <boost/preprocessor/seq/fold_left.hpp>
|
||||
# include <boost/preprocessor/seq/seq.hpp>
|
||||
# include <boost/preprocessor/tuple/elem.hpp>
|
||||
# include <boost/preprocessor/tuple/rem.hpp>
|
||||
#
|
||||
# /* BOOST_PP_SEQ_TRANSFORM */
|
||||
#
|
||||
# if ~BOOST_PP_CONFIG_FLAGS() & BOOST_PP_CONFIG_EDG()
|
||||
# define BOOST_PP_SEQ_TRANSFORM(op, data, seq) BOOST_PP_SEQ_TAIL(BOOST_PP_TUPLE_ELEM(3, 2, BOOST_PP_SEQ_FOLD_LEFT(BOOST_PP_SEQ_TRANSFORM_O, (op, data, (nil)), seq)))
|
||||
# else
|
||||
# define BOOST_PP_SEQ_TRANSFORM(op, data, seq) BOOST_PP_SEQ_TRANSFORM_I(op, data, seq)
|
||||
# define BOOST_PP_SEQ_TRANSFORM_I(op, data, seq) BOOST_PP_SEQ_TAIL(BOOST_PP_TUPLE_ELEM(3, 2, BOOST_PP_SEQ_FOLD_LEFT(BOOST_PP_SEQ_TRANSFORM_O, (op, data, (nil)), seq)))
|
||||
# endif
|
||||
#
|
||||
# if BOOST_PP_CONFIG_FLAGS() & BOOST_PP_CONFIG_STRICT()
|
||||
# define BOOST_PP_SEQ_TRANSFORM_O(s, state, elem) BOOST_PP_SEQ_TRANSFORM_O_IM(s, BOOST_PP_TUPLE_REM_3 state, elem)
|
||||
# define BOOST_PP_SEQ_TRANSFORM_O_IM(s, im, elem) BOOST_PP_SEQ_TRANSFORM_O_I(s, im, elem)
|
||||
# else
|
||||
# define BOOST_PP_SEQ_TRANSFORM_O(s, state, elem) BOOST_PP_SEQ_TRANSFORM_O_I(s, BOOST_PP_TUPLE_ELEM(3, 0, state), BOOST_PP_TUPLE_ELEM(3, 1, state), BOOST_PP_TUPLE_ELEM(3, 2, state), elem)
|
||||
# endif
|
||||
#
|
||||
# define BOOST_PP_SEQ_TRANSFORM_O_I(s, op, data, res, elem) (op, data, res (op(s, data, elem)))
|
||||
#
|
||||
# /* BOOST_PP_SEQ_TRANSFORM_S */
|
||||
#
|
||||
# if ~BOOST_PP_CONFIG_FLAGS() & BOOST_PP_CONFIG_EDG()
|
||||
# define BOOST_PP_SEQ_TRANSFORM_S(s, op, data, seq) BOOST_PP_SEQ_TAIL(BOOST_PP_TUPLE_ELEM(3, 2, BOOST_PP_SEQ_FOLD_LEFT_ ## s(BOOST_PP_SEQ_TRANSFORM_O, (op, data, (nil)), seq)))
|
||||
# else
|
||||
# define BOOST_PP_SEQ_TRANSFORM_S(s, op, data, seq) BOOST_PP_SEQ_TRANSFORM_S_I(s, op, data, seq)
|
||||
# define BOOST_PP_SEQ_TRANSFORM_S_I(s, op, data, seq) BOOST_PP_SEQ_TAIL(BOOST_PP_TUPLE_ELEM(3, 2, BOOST_PP_SEQ_FOLD_LEFT_ ## s(BOOST_PP_SEQ_TRANSFORM_O, (op, data, (nil)), seq)))
|
||||
# endif
|
||||
#
|
||||
# endif
|
||||
@@ -0,0 +1,227 @@
|
||||
// Copyright Kevlin Henney, 2000-2005.
|
||||
// Copyright Alexander Nasonov, 2006-2010.
|
||||
// Copyright Antony Polukhin, 2011-2016.
|
||||
//
|
||||
// Distributed under the Boost Software License, Version 1.0. (See
|
||||
// accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
//
|
||||
// what: lexical_cast custom keyword cast
|
||||
// who: contributed by Kevlin Henney,
|
||||
// enhanced with contributions from Terje Slettebo,
|
||||
// with additional fixes and suggestions from Gennaro Prota,
|
||||
// Beman Dawes, Dave Abrahams, Daryle Walker, Peter Dimov,
|
||||
// Alexander Nasonov, Antony Polukhin, Justin Viiret, Michael Hofmann,
|
||||
// Cheng Yang, Matthew Bradbury, David W. Birdsall, Pavel Korzh and other Boosters
|
||||
// when: November 2000, March 2003, June 2005, June 2006, March 2011 - 2014
|
||||
|
||||
#ifndef BOOST_LEXICAL_CAST_TRY_LEXICAL_CONVERT_HPP
|
||||
#define BOOST_LEXICAL_CAST_TRY_LEXICAL_CONVERT_HPP
|
||||
|
||||
#include <boost/config.hpp>
|
||||
#ifdef BOOST_HAS_PRAGMA_ONCE
|
||||
# pragma once
|
||||
#endif
|
||||
|
||||
#if defined(__clang__) || (defined(__GNUC__) && \
|
||||
!(defined(__INTEL_COMPILER) || defined(__ICL) || defined(__ICC) || defined(__ECC)) && \
|
||||
(__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 6)))
|
||||
#pragma GCC diagnostic push
|
||||
#pragma GCC diagnostic ignored "-Wuninitialized"
|
||||
#endif
|
||||
|
||||
#include <string>
|
||||
#include <boost/mpl/bool.hpp>
|
||||
#include <boost/mpl/identity.hpp>
|
||||
#include <boost/mpl/if.hpp>
|
||||
#include <boost/type_traits/is_same.hpp>
|
||||
#include <boost/type_traits/is_arithmetic.hpp>
|
||||
|
||||
#include <boost/lexical_cast/detail/is_character.hpp>
|
||||
#include <boost/lexical_cast/detail/converter_numeric.hpp>
|
||||
#include <boost/lexical_cast/detail/converter_lexical.hpp>
|
||||
|
||||
#include <boost/range/iterator_range_core.hpp>
|
||||
#include <boost/container/container_fwd.hpp>
|
||||
|
||||
namespace boost {
|
||||
namespace detail
|
||||
{
|
||||
template<typename T>
|
||||
struct is_stdstring
|
||||
: boost::false_type
|
||||
{};
|
||||
|
||||
template<typename CharT, typename Traits, typename Alloc>
|
||||
struct is_stdstring< std::basic_string<CharT, Traits, Alloc> >
|
||||
: boost::true_type
|
||||
{};
|
||||
|
||||
// Sun Studio has problem with partial specialization of templates differing only in namespace.
|
||||
// We workaround that by making `is_booststring` trait, instead of specializing `is_stdstring` for `boost::container::basic_string`.
|
||||
template<typename T>
|
||||
struct is_booststring
|
||||
: boost::false_type
|
||||
{};
|
||||
|
||||
template<typename CharT, typename Traits, typename Alloc>
|
||||
struct is_booststring< boost::container::basic_string<CharT, Traits, Alloc> >
|
||||
: boost::true_type
|
||||
{};
|
||||
|
||||
template<typename Target, typename Source>
|
||||
struct is_arithmetic_and_not_xchars
|
||||
{
|
||||
typedef boost::mpl::bool_<
|
||||
!(boost::detail::is_character<Target>::value) &&
|
||||
!(boost::detail::is_character<Source>::value) &&
|
||||
boost::is_arithmetic<Source>::value &&
|
||||
boost::is_arithmetic<Target>::value
|
||||
> type;
|
||||
|
||||
BOOST_STATIC_CONSTANT(bool, value = (
|
||||
type::value
|
||||
));
|
||||
};
|
||||
|
||||
/*
|
||||
* is_xchar_to_xchar<Target, Source>::value is true,
|
||||
* Target and Souce are char types of the same size 1 (char, signed char, unsigned char).
|
||||
*/
|
||||
template<typename Target, typename Source>
|
||||
struct is_xchar_to_xchar
|
||||
{
|
||||
typedef boost::mpl::bool_<
|
||||
sizeof(Source) == sizeof(Target) &&
|
||||
sizeof(Source) == sizeof(char) &&
|
||||
boost::detail::is_character<Target>::value &&
|
||||
boost::detail::is_character<Source>::value
|
||||
> type;
|
||||
|
||||
BOOST_STATIC_CONSTANT(bool, value = (
|
||||
type::value
|
||||
));
|
||||
};
|
||||
|
||||
template<typename Target, typename Source>
|
||||
struct is_char_array_to_stdstring
|
||||
: boost::false_type
|
||||
{};
|
||||
|
||||
template<typename CharT, typename Traits, typename Alloc>
|
||||
struct is_char_array_to_stdstring< std::basic_string<CharT, Traits, Alloc>, CharT* >
|
||||
: boost::true_type
|
||||
{};
|
||||
|
||||
template<typename CharT, typename Traits, typename Alloc>
|
||||
struct is_char_array_to_stdstring< std::basic_string<CharT, Traits, Alloc>, const CharT* >
|
||||
: boost::true_type
|
||||
{};
|
||||
|
||||
// Sun Studio has problem with partial specialization of templates differing only in namespace.
|
||||
// We workaround that by making `is_char_array_to_booststring` trait, instead of specializing `is_char_array_to_stdstring` for `boost::container::basic_string`.
|
||||
template<typename Target, typename Source>
|
||||
struct is_char_array_to_booststring
|
||||
: boost::false_type
|
||||
{};
|
||||
|
||||
template<typename CharT, typename Traits, typename Alloc>
|
||||
struct is_char_array_to_booststring< boost::container::basic_string<CharT, Traits, Alloc>, CharT* >
|
||||
: boost::true_type
|
||||
{};
|
||||
|
||||
template<typename CharT, typename Traits, typename Alloc>
|
||||
struct is_char_array_to_booststring< boost::container::basic_string<CharT, Traits, Alloc>, const CharT* >
|
||||
: boost::true_type
|
||||
{};
|
||||
|
||||
template <typename Target, typename Source>
|
||||
struct copy_converter_impl
|
||||
{
|
||||
// MSVC fail to forward an array (DevDiv#555157 "SILENT BAD CODEGEN triggered by perfect forwarding",
|
||||
// fixed in 2013 RTM).
|
||||
#if !defined(BOOST_NO_CXX11_RVALUE_REFERENCES) && (!defined(BOOST_MSVC) || BOOST_MSVC >= 1800)
|
||||
template <class T>
|
||||
static inline bool try_convert(T&& arg, Target& result) {
|
||||
result = static_cast<T&&>(arg); // eqaul to `result = std::forward<T>(arg);`
|
||||
return true;
|
||||
}
|
||||
#else
|
||||
static inline bool try_convert(const Source& arg, Target& result) {
|
||||
result = arg;
|
||||
return true;
|
||||
}
|
||||
#endif
|
||||
};
|
||||
}
|
||||
|
||||
namespace conversion { namespace detail {
|
||||
|
||||
template <typename Target, typename Source>
|
||||
inline bool try_lexical_convert(const Source& arg, Target& result)
|
||||
{
|
||||
typedef BOOST_DEDUCED_TYPENAME boost::detail::array_to_pointer_decay<Source>::type src;
|
||||
|
||||
typedef boost::mpl::bool_<
|
||||
boost::detail::is_xchar_to_xchar<Target, src >::value ||
|
||||
boost::detail::is_char_array_to_stdstring<Target, src >::value ||
|
||||
boost::detail::is_char_array_to_booststring<Target, src >::value ||
|
||||
(
|
||||
boost::is_same<Target, src >::value &&
|
||||
(boost::detail::is_stdstring<Target >::value || boost::detail::is_booststring<Target >::value)
|
||||
) ||
|
||||
(
|
||||
boost::is_same<Target, src >::value &&
|
||||
boost::detail::is_character<Target >::value
|
||||
)
|
||||
> shall_we_copy_t;
|
||||
|
||||
typedef boost::detail::is_arithmetic_and_not_xchars<Target, src >
|
||||
shall_we_copy_with_dynamic_check_t;
|
||||
|
||||
// We do evaluate second `if_` lazily to avoid unnecessary instantiations
|
||||
// of `shall_we_copy_with_dynamic_check_t` and improve compilation times.
|
||||
typedef BOOST_DEDUCED_TYPENAME boost::mpl::if_c<
|
||||
shall_we_copy_t::value,
|
||||
boost::mpl::identity<boost::detail::copy_converter_impl<Target, src > >,
|
||||
boost::mpl::if_<
|
||||
shall_we_copy_with_dynamic_check_t,
|
||||
boost::detail::dynamic_num_converter_impl<Target, src >,
|
||||
boost::detail::lexical_converter_impl<Target, src >
|
||||
>
|
||||
>::type caster_type_lazy;
|
||||
|
||||
typedef BOOST_DEDUCED_TYPENAME caster_type_lazy::type caster_type;
|
||||
|
||||
return caster_type::try_convert(arg, result);
|
||||
}
|
||||
|
||||
template <typename Target, typename CharacterT>
|
||||
inline bool try_lexical_convert(const CharacterT* chars, std::size_t count, Target& result)
|
||||
{
|
||||
BOOST_STATIC_ASSERT_MSG(
|
||||
boost::detail::is_character<CharacterT>::value,
|
||||
"This overload of try_lexical_convert is meant to be used only with arrays of characters."
|
||||
);
|
||||
return ::boost::conversion::detail::try_lexical_convert(
|
||||
::boost::iterator_range<const CharacterT*>(chars, chars + count), result
|
||||
);
|
||||
}
|
||||
|
||||
}} // namespace conversion::detail
|
||||
|
||||
namespace conversion {
|
||||
// ADL barrier
|
||||
using ::boost::conversion::detail::try_lexical_convert;
|
||||
}
|
||||
|
||||
} // namespace boost
|
||||
|
||||
#if defined(__clang__) || (defined(__GNUC__) && \
|
||||
!(defined(__INTEL_COMPILER) || defined(__ICL) || defined(__ICC) || defined(__ECC)) && \
|
||||
(__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 6)))
|
||||
#pragma GCC diagnostic pop
|
||||
#endif
|
||||
|
||||
#endif // BOOST_LEXICAL_CAST_TRY_LEXICAL_CONVERT_HPP
|
||||
|
||||
@@ -0,0 +1,258 @@
|
||||
// (C) Copyright John Maddock 2007.
|
||||
// Use, modification and distribution are subject to the
|
||||
// Boost Software License, Version 1.0. (See accompanying file
|
||||
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
//
|
||||
// This file is machine generated, do not edit by hand
|
||||
|
||||
// Polynomial evaluation using Horners rule
|
||||
#ifndef BOOST_MATH_TOOLS_POLY_RAT_20_HPP
|
||||
#define BOOST_MATH_TOOLS_POLY_RAT_20_HPP
|
||||
|
||||
namespace boost{ namespace math{ namespace tools{ namespace detail{
|
||||
|
||||
template <class T, class U, class V>
|
||||
inline V evaluate_rational_c_imp(const T*, const U*, const V&, const mpl::int_<0>*) BOOST_MATH_NOEXCEPT(V)
|
||||
{
|
||||
return static_cast<V>(0);
|
||||
}
|
||||
|
||||
template <class T, class U, class V>
|
||||
inline V evaluate_rational_c_imp(const T* a, const U* b, const V&, const mpl::int_<1>*) BOOST_MATH_NOEXCEPT(V)
|
||||
{
|
||||
return static_cast<V>(a[0]) / static_cast<V>(b[0]);
|
||||
}
|
||||
|
||||
template <class T, class U, class V>
|
||||
inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<2>*) BOOST_MATH_NOEXCEPT(V)
|
||||
{
|
||||
if(x <= 1)
|
||||
return static_cast<V>((a[1] * x + a[0]) / (b[1] * x + b[0]));
|
||||
else
|
||||
{
|
||||
V z = 1 / x;
|
||||
return static_cast<V>((a[0] * z + a[1]) / (b[0] * z + b[1]));
|
||||
}
|
||||
}
|
||||
|
||||
template <class T, class U, class V>
|
||||
inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<3>*) BOOST_MATH_NOEXCEPT(V)
|
||||
{
|
||||
if(x <= 1)
|
||||
return static_cast<V>(((a[2] * x + a[1]) * x + a[0]) / ((b[2] * x + b[1]) * x + b[0]));
|
||||
else
|
||||
{
|
||||
V z = 1 / x;
|
||||
return static_cast<V>(((a[0] * z + a[1]) * z + a[2]) / ((b[0] * z + b[1]) * z + b[2]));
|
||||
}
|
||||
}
|
||||
|
||||
template <class T, class U, class V>
|
||||
inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<4>*) BOOST_MATH_NOEXCEPT(V)
|
||||
{
|
||||
if(x <= 1)
|
||||
return static_cast<V>((((a[3] * x + a[2]) * x + a[1]) * x + a[0]) / (((b[3] * x + b[2]) * x + b[1]) * x + b[0]));
|
||||
else
|
||||
{
|
||||
V z = 1 / x;
|
||||
return static_cast<V>((((a[0] * z + a[1]) * z + a[2]) * z + a[3]) / (((b[0] * z + b[1]) * z + b[2]) * z + b[3]));
|
||||
}
|
||||
}
|
||||
|
||||
template <class T, class U, class V>
|
||||
inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<5>*) BOOST_MATH_NOEXCEPT(V)
|
||||
{
|
||||
if(x <= 1)
|
||||
return static_cast<V>(((((a[4] * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / ((((b[4] * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0]));
|
||||
else
|
||||
{
|
||||
V z = 1 / x;
|
||||
return static_cast<V>(((((a[0] * z + a[1]) * z + a[2]) * z + a[3]) * z + a[4]) / ((((b[0] * z + b[1]) * z + b[2]) * z + b[3]) * z + b[4]));
|
||||
}
|
||||
}
|
||||
|
||||
template <class T, class U, class V>
|
||||
inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<6>*) BOOST_MATH_NOEXCEPT(V)
|
||||
{
|
||||
if(x <= 1)
|
||||
return static_cast<V>((((((a[5] * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / (((((b[5] * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0]));
|
||||
else
|
||||
{
|
||||
V z = 1 / x;
|
||||
return static_cast<V>((((((a[0] * z + a[1]) * z + a[2]) * z + a[3]) * z + a[4]) * z + a[5]) / (((((b[0] * z + b[1]) * z + b[2]) * z + b[3]) * z + b[4]) * z + b[5]));
|
||||
}
|
||||
}
|
||||
|
||||
template <class T, class U, class V>
|
||||
inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<7>*) BOOST_MATH_NOEXCEPT(V)
|
||||
{
|
||||
if(x <= 1)
|
||||
return static_cast<V>(((((((a[6] * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / ((((((b[6] * x + b[5]) * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0]));
|
||||
else
|
||||
{
|
||||
V z = 1 / x;
|
||||
return static_cast<V>(((((((a[0] * z + a[1]) * z + a[2]) * z + a[3]) * z + a[4]) * z + a[5]) * z + a[6]) / ((((((b[0] * z + b[1]) * z + b[2]) * z + b[3]) * z + b[4]) * z + b[5]) * z + b[6]));
|
||||
}
|
||||
}
|
||||
|
||||
template <class T, class U, class V>
|
||||
inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<8>*) BOOST_MATH_NOEXCEPT(V)
|
||||
{
|
||||
if(x <= 1)
|
||||
return static_cast<V>((((((((a[7] * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / (((((((b[7] * x + b[6]) * x + b[5]) * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0]));
|
||||
else
|
||||
{
|
||||
V z = 1 / x;
|
||||
return static_cast<V>((((((((a[0] * z + a[1]) * z + a[2]) * z + a[3]) * z + a[4]) * z + a[5]) * z + a[6]) * z + a[7]) / (((((((b[0] * z + b[1]) * z + b[2]) * z + b[3]) * z + b[4]) * z + b[5]) * z + b[6]) * z + b[7]));
|
||||
}
|
||||
}
|
||||
|
||||
template <class T, class U, class V>
|
||||
inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<9>*) BOOST_MATH_NOEXCEPT(V)
|
||||
{
|
||||
if(x <= 1)
|
||||
return static_cast<V>(((((((((a[8] * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / ((((((((b[8] * x + b[7]) * x + b[6]) * x + b[5]) * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0]));
|
||||
else
|
||||
{
|
||||
V z = 1 / x;
|
||||
return static_cast<V>(((((((((a[0] * z + a[1]) * z + a[2]) * z + a[3]) * z + a[4]) * z + a[5]) * z + a[6]) * z + a[7]) * z + a[8]) / ((((((((b[0] * z + b[1]) * z + b[2]) * z + b[3]) * z + b[4]) * z + b[5]) * z + b[6]) * z + b[7]) * z + b[8]));
|
||||
}
|
||||
}
|
||||
|
||||
template <class T, class U, class V>
|
||||
inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<10>*) BOOST_MATH_NOEXCEPT(V)
|
||||
{
|
||||
if(x <= 1)
|
||||
return static_cast<V>((((((((((a[9] * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / (((((((((b[9] * x + b[8]) * x + b[7]) * x + b[6]) * x + b[5]) * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0]));
|
||||
else
|
||||
{
|
||||
V z = 1 / x;
|
||||
return static_cast<V>((((((((((a[0] * z + a[1]) * z + a[2]) * z + a[3]) * z + a[4]) * z + a[5]) * z + a[6]) * z + a[7]) * z + a[8]) * z + a[9]) / (((((((((b[0] * z + b[1]) * z + b[2]) * z + b[3]) * z + b[4]) * z + b[5]) * z + b[6]) * z + b[7]) * z + b[8]) * z + b[9]));
|
||||
}
|
||||
}
|
||||
|
||||
template <class T, class U, class V>
|
||||
inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<11>*) BOOST_MATH_NOEXCEPT(V)
|
||||
{
|
||||
if(x <= 1)
|
||||
return static_cast<V>(((((((((((a[10] * x + a[9]) * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / ((((((((((b[10] * x + b[9]) * x + b[8]) * x + b[7]) * x + b[6]) * x + b[5]) * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0]));
|
||||
else
|
||||
{
|
||||
V z = 1 / x;
|
||||
return static_cast<V>(((((((((((a[0] * z + a[1]) * z + a[2]) * z + a[3]) * z + a[4]) * z + a[5]) * z + a[6]) * z + a[7]) * z + a[8]) * z + a[9]) * z + a[10]) / ((((((((((b[0] * z + b[1]) * z + b[2]) * z + b[3]) * z + b[4]) * z + b[5]) * z + b[6]) * z + b[7]) * z + b[8]) * z + b[9]) * z + b[10]));
|
||||
}
|
||||
}
|
||||
|
||||
template <class T, class U, class V>
|
||||
inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<12>*) BOOST_MATH_NOEXCEPT(V)
|
||||
{
|
||||
if(x <= 1)
|
||||
return static_cast<V>((((((((((((a[11] * x + a[10]) * x + a[9]) * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / (((((((((((b[11] * x + b[10]) * x + b[9]) * x + b[8]) * x + b[7]) * x + b[6]) * x + b[5]) * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0]));
|
||||
else
|
||||
{
|
||||
V z = 1 / x;
|
||||
return static_cast<V>((((((((((((a[0] * z + a[1]) * z + a[2]) * z + a[3]) * z + a[4]) * z + a[5]) * z + a[6]) * z + a[7]) * z + a[8]) * z + a[9]) * z + a[10]) * z + a[11]) / (((((((((((b[0] * z + b[1]) * z + b[2]) * z + b[3]) * z + b[4]) * z + b[5]) * z + b[6]) * z + b[7]) * z + b[8]) * z + b[9]) * z + b[10]) * z + b[11]));
|
||||
}
|
||||
}
|
||||
|
||||
template <class T, class U, class V>
|
||||
inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<13>*) BOOST_MATH_NOEXCEPT(V)
|
||||
{
|
||||
if(x <= 1)
|
||||
return static_cast<V>(((((((((((((a[12] * x + a[11]) * x + a[10]) * x + a[9]) * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / ((((((((((((b[12] * x + b[11]) * x + b[10]) * x + b[9]) * x + b[8]) * x + b[7]) * x + b[6]) * x + b[5]) * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0]));
|
||||
else
|
||||
{
|
||||
V z = 1 / x;
|
||||
return static_cast<V>(((((((((((((a[0] * z + a[1]) * z + a[2]) * z + a[3]) * z + a[4]) * z + a[5]) * z + a[6]) * z + a[7]) * z + a[8]) * z + a[9]) * z + a[10]) * z + a[11]) * z + a[12]) / ((((((((((((b[0] * z + b[1]) * z + b[2]) * z + b[3]) * z + b[4]) * z + b[5]) * z + b[6]) * z + b[7]) * z + b[8]) * z + b[9]) * z + b[10]) * z + b[11]) * z + b[12]));
|
||||
}
|
||||
}
|
||||
|
||||
template <class T, class U, class V>
|
||||
inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<14>*) BOOST_MATH_NOEXCEPT(V)
|
||||
{
|
||||
if(x <= 1)
|
||||
return static_cast<V>((((((((((((((a[13] * x + a[12]) * x + a[11]) * x + a[10]) * x + a[9]) * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / (((((((((((((b[13] * x + b[12]) * x + b[11]) * x + b[10]) * x + b[9]) * x + b[8]) * x + b[7]) * x + b[6]) * x + b[5]) * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0]));
|
||||
else
|
||||
{
|
||||
V z = 1 / x;
|
||||
return static_cast<V>((((((((((((((a[0] * z + a[1]) * z + a[2]) * z + a[3]) * z + a[4]) * z + a[5]) * z + a[6]) * z + a[7]) * z + a[8]) * z + a[9]) * z + a[10]) * z + a[11]) * z + a[12]) * z + a[13]) / (((((((((((((b[0] * z + b[1]) * z + b[2]) * z + b[3]) * z + b[4]) * z + b[5]) * z + b[6]) * z + b[7]) * z + b[8]) * z + b[9]) * z + b[10]) * z + b[11]) * z + b[12]) * z + b[13]));
|
||||
}
|
||||
}
|
||||
|
||||
template <class T, class U, class V>
|
||||
inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<15>*) BOOST_MATH_NOEXCEPT(V)
|
||||
{
|
||||
if(x <= 1)
|
||||
return static_cast<V>(((((((((((((((a[14] * x + a[13]) * x + a[12]) * x + a[11]) * x + a[10]) * x + a[9]) * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / ((((((((((((((b[14] * x + b[13]) * x + b[12]) * x + b[11]) * x + b[10]) * x + b[9]) * x + b[8]) * x + b[7]) * x + b[6]) * x + b[5]) * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0]));
|
||||
else
|
||||
{
|
||||
V z = 1 / x;
|
||||
return static_cast<V>(((((((((((((((a[0] * z + a[1]) * z + a[2]) * z + a[3]) * z + a[4]) * z + a[5]) * z + a[6]) * z + a[7]) * z + a[8]) * z + a[9]) * z + a[10]) * z + a[11]) * z + a[12]) * z + a[13]) * z + a[14]) / ((((((((((((((b[0] * z + b[1]) * z + b[2]) * z + b[3]) * z + b[4]) * z + b[5]) * z + b[6]) * z + b[7]) * z + b[8]) * z + b[9]) * z + b[10]) * z + b[11]) * z + b[12]) * z + b[13]) * z + b[14]));
|
||||
}
|
||||
}
|
||||
|
||||
template <class T, class U, class V>
|
||||
inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<16>*) BOOST_MATH_NOEXCEPT(V)
|
||||
{
|
||||
if(x <= 1)
|
||||
return static_cast<V>((((((((((((((((a[15] * x + a[14]) * x + a[13]) * x + a[12]) * x + a[11]) * x + a[10]) * x + a[9]) * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / (((((((((((((((b[15] * x + b[14]) * x + b[13]) * x + b[12]) * x + b[11]) * x + b[10]) * x + b[9]) * x + b[8]) * x + b[7]) * x + b[6]) * x + b[5]) * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0]));
|
||||
else
|
||||
{
|
||||
V z = 1 / x;
|
||||
return static_cast<V>((((((((((((((((a[0] * z + a[1]) * z + a[2]) * z + a[3]) * z + a[4]) * z + a[5]) * z + a[6]) * z + a[7]) * z + a[8]) * z + a[9]) * z + a[10]) * z + a[11]) * z + a[12]) * z + a[13]) * z + a[14]) * z + a[15]) / (((((((((((((((b[0] * z + b[1]) * z + b[2]) * z + b[3]) * z + b[4]) * z + b[5]) * z + b[6]) * z + b[7]) * z + b[8]) * z + b[9]) * z + b[10]) * z + b[11]) * z + b[12]) * z + b[13]) * z + b[14]) * z + b[15]));
|
||||
}
|
||||
}
|
||||
|
||||
template <class T, class U, class V>
|
||||
inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<17>*) BOOST_MATH_NOEXCEPT(V)
|
||||
{
|
||||
if(x <= 1)
|
||||
return static_cast<V>(((((((((((((((((a[16] * x + a[15]) * x + a[14]) * x + a[13]) * x + a[12]) * x + a[11]) * x + a[10]) * x + a[9]) * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / ((((((((((((((((b[16] * x + b[15]) * x + b[14]) * x + b[13]) * x + b[12]) * x + b[11]) * x + b[10]) * x + b[9]) * x + b[8]) * x + b[7]) * x + b[6]) * x + b[5]) * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0]));
|
||||
else
|
||||
{
|
||||
V z = 1 / x;
|
||||
return static_cast<V>(((((((((((((((((a[0] * z + a[1]) * z + a[2]) * z + a[3]) * z + a[4]) * z + a[5]) * z + a[6]) * z + a[7]) * z + a[8]) * z + a[9]) * z + a[10]) * z + a[11]) * z + a[12]) * z + a[13]) * z + a[14]) * z + a[15]) * z + a[16]) / ((((((((((((((((b[0] * z + b[1]) * z + b[2]) * z + b[3]) * z + b[4]) * z + b[5]) * z + b[6]) * z + b[7]) * z + b[8]) * z + b[9]) * z + b[10]) * z + b[11]) * z + b[12]) * z + b[13]) * z + b[14]) * z + b[15]) * z + b[16]));
|
||||
}
|
||||
}
|
||||
|
||||
template <class T, class U, class V>
|
||||
inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<18>*) BOOST_MATH_NOEXCEPT(V)
|
||||
{
|
||||
if(x <= 1)
|
||||
return static_cast<V>((((((((((((((((((a[17] * x + a[16]) * x + a[15]) * x + a[14]) * x + a[13]) * x + a[12]) * x + a[11]) * x + a[10]) * x + a[9]) * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / (((((((((((((((((b[17] * x + b[16]) * x + b[15]) * x + b[14]) * x + b[13]) * x + b[12]) * x + b[11]) * x + b[10]) * x + b[9]) * x + b[8]) * x + b[7]) * x + b[6]) * x + b[5]) * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0]));
|
||||
else
|
||||
{
|
||||
V z = 1 / x;
|
||||
return static_cast<V>((((((((((((((((((a[0] * z + a[1]) * z + a[2]) * z + a[3]) * z + a[4]) * z + a[5]) * z + a[6]) * z + a[7]) * z + a[8]) * z + a[9]) * z + a[10]) * z + a[11]) * z + a[12]) * z + a[13]) * z + a[14]) * z + a[15]) * z + a[16]) * z + a[17]) / (((((((((((((((((b[0] * z + b[1]) * z + b[2]) * z + b[3]) * z + b[4]) * z + b[5]) * z + b[6]) * z + b[7]) * z + b[8]) * z + b[9]) * z + b[10]) * z + b[11]) * z + b[12]) * z + b[13]) * z + b[14]) * z + b[15]) * z + b[16]) * z + b[17]));
|
||||
}
|
||||
}
|
||||
|
||||
template <class T, class U, class V>
|
||||
inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<19>*) BOOST_MATH_NOEXCEPT(V)
|
||||
{
|
||||
if(x <= 1)
|
||||
return static_cast<V>(((((((((((((((((((a[18] * x + a[17]) * x + a[16]) * x + a[15]) * x + a[14]) * x + a[13]) * x + a[12]) * x + a[11]) * x + a[10]) * x + a[9]) * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / ((((((((((((((((((b[18] * x + b[17]) * x + b[16]) * x + b[15]) * x + b[14]) * x + b[13]) * x + b[12]) * x + b[11]) * x + b[10]) * x + b[9]) * x + b[8]) * x + b[7]) * x + b[6]) * x + b[5]) * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0]));
|
||||
else
|
||||
{
|
||||
V z = 1 / x;
|
||||
return static_cast<V>(((((((((((((((((((a[0] * z + a[1]) * z + a[2]) * z + a[3]) * z + a[4]) * z + a[5]) * z + a[6]) * z + a[7]) * z + a[8]) * z + a[9]) * z + a[10]) * z + a[11]) * z + a[12]) * z + a[13]) * z + a[14]) * z + a[15]) * z + a[16]) * z + a[17]) * z + a[18]) / ((((((((((((((((((b[0] * z + b[1]) * z + b[2]) * z + b[3]) * z + b[4]) * z + b[5]) * z + b[6]) * z + b[7]) * z + b[8]) * z + b[9]) * z + b[10]) * z + b[11]) * z + b[12]) * z + b[13]) * z + b[14]) * z + b[15]) * z + b[16]) * z + b[17]) * z + b[18]));
|
||||
}
|
||||
}
|
||||
|
||||
template <class T, class U, class V>
|
||||
inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<20>*) BOOST_MATH_NOEXCEPT(V)
|
||||
{
|
||||
if(x <= 1)
|
||||
return static_cast<V>((((((((((((((((((((a[19] * x + a[18]) * x + a[17]) * x + a[16]) * x + a[15]) * x + a[14]) * x + a[13]) * x + a[12]) * x + a[11]) * x + a[10]) * x + a[9]) * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / (((((((((((((((((((b[19] * x + b[18]) * x + b[17]) * x + b[16]) * x + b[15]) * x + b[14]) * x + b[13]) * x + b[12]) * x + b[11]) * x + b[10]) * x + b[9]) * x + b[8]) * x + b[7]) * x + b[6]) * x + b[5]) * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0]));
|
||||
else
|
||||
{
|
||||
V z = 1 / x;
|
||||
return static_cast<V>((((((((((((((((((((a[0] * z + a[1]) * z + a[2]) * z + a[3]) * z + a[4]) * z + a[5]) * z + a[6]) * z + a[7]) * z + a[8]) * z + a[9]) * z + a[10]) * z + a[11]) * z + a[12]) * z + a[13]) * z + a[14]) * z + a[15]) * z + a[16]) * z + a[17]) * z + a[18]) * z + a[19]) / (((((((((((((((((((b[0] * z + b[1]) * z + b[2]) * z + b[3]) * z + b[4]) * z + b[5]) * z + b[6]) * z + b[7]) * z + b[8]) * z + b[9]) * z + b[10]) * z + b[11]) * z + b[12]) * z + b[13]) * z + b[14]) * z + b[15]) * z + b[16]) * z + b[17]) * z + b[18]) * z + b[19]));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}}}} // namespaces
|
||||
|
||||
#endif // include guard
|
||||
|
||||
@@ -0,0 +1,83 @@
|
||||
subroutine ft8b(s,nfqso,f1,xdt,nharderrors,dmin,nbadcrc,message)
|
||||
|
||||
use timer_module, only: timer
|
||||
include 'ft8_params.f90'
|
||||
parameter(NRECENT=10)
|
||||
character*12 recent_calls(NRECENT)
|
||||
character message*22
|
||||
real s(NH1,NHSYM)
|
||||
real s1(0:7,ND)
|
||||
real ps(0:7)
|
||||
real rxdata(3*ND),llr(3*ND) !Soft symbols
|
||||
integer*1 decoded(KK),apmask(3*ND),cw(3*ND)
|
||||
|
||||
max_iterations=40
|
||||
norder=2
|
||||
! if(abs(nfqso-f1).lt.10.0) norder=3
|
||||
tstep=0.5*NSPS/12000.0
|
||||
df=12000.0/NFFT1
|
||||
|
||||
i0=max(1,nint(f1/df))
|
||||
j0=nint(xdt/tstep)
|
||||
|
||||
j=0
|
||||
ia=i0
|
||||
ib=i0+14
|
||||
do k=1,NN
|
||||
if(k.le.7) cycle
|
||||
if(k.ge.37 .and. k.le.43) cycle
|
||||
if(k.gt.72) cycle
|
||||
n=j0+2*(k-1)+1
|
||||
if(n.lt.1) cycle
|
||||
j=j+1
|
||||
s1(0:7,j)=s(ia:ib:2,n)
|
||||
enddo
|
||||
do j=1,ND
|
||||
ps=s1(0:7,j)
|
||||
where (ps.gt.0.0) ps=log(ps)
|
||||
r1=max(ps(1),ps(3),ps(5),ps(7))-max(ps(0),ps(2),ps(4),ps(6))
|
||||
r2=max(ps(2),ps(3),ps(6),ps(7))-max(ps(0),ps(1),ps(4),ps(5))
|
||||
r4=max(ps(4),ps(5),ps(6),ps(7))-max(ps(0),ps(1),ps(2),ps(3))
|
||||
rxdata(3*j-2)=r4
|
||||
rxdata(3*j-1)=r2
|
||||
rxdata(3*j)=r1
|
||||
enddo
|
||||
|
||||
rxav=sum(rxdata)/(3.0*ND)
|
||||
rx2av=sum(rxdata*rxdata)/(3.0*ND)
|
||||
var=rx2av-rxav*rxav
|
||||
if( var .gt. 0.0 ) then
|
||||
rxsig=sqrt(var)
|
||||
else
|
||||
rxsig=sqrt(rx2av)
|
||||
endif
|
||||
rxdata=rxdata/rxsig
|
||||
ss=0.84
|
||||
llr=2.0*rxdata/(ss*ss)
|
||||
apmask=0
|
||||
cw=0
|
||||
! cw will be needed for subtraction.
|
||||
! dmin is the correlation discrepancy of a returned codeword - it is
|
||||
! used to select the best codeword within osd174.
|
||||
call timer('bpd174 ',0)
|
||||
call bpdecode174(llr,apmask,max_iterations,decoded,cw,nharderrors)
|
||||
call timer('bpd174 ',1)
|
||||
dmin=0.0
|
||||
if(nharderrors.lt.0) then
|
||||
call timer('osd174 ',0)
|
||||
call osd174(llr,norder,decoded,cw,nharderrors,dmin)
|
||||
call timer('osd174 ',1)
|
||||
! This threshold needs to be tuned. 99.0 should pass everything.
|
||||
if( dmin .gt. 99.0 ) nharderrors=-1
|
||||
endif
|
||||
nbadcrc=1
|
||||
message=' '
|
||||
if(count(cw.eq.0).eq.174) go to 900 !Reject the all-zero codeword
|
||||
if(nharderrors.ge.0) call chkcrc12a(decoded,nbadcrc)
|
||||
if(nbadcrc.eq.0) then
|
||||
call extractmessage174(decoded,message,ncrcflag,recent_calls,nrecent)
|
||||
endif
|
||||
900 continue
|
||||
|
||||
return
|
||||
end subroutine ft8b
|
||||
@@ -0,0 +1,13 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2001-2007 Joel de Guzman
|
||||
|
||||
Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
==============================================================================*/
|
||||
#if !defined(FUSION_INCLUDE_ALL)
|
||||
#define FUSION_INCLUDE_ALL
|
||||
|
||||
#include <boost/fusion/support/config.hpp>
|
||||
#include <boost/fusion/algorithm/query/all.hpp>
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,2 @@
|
||||
C:\JTSDK-QT\fftw3f\fftwf-wisdom -o fftwf_wisdom.dat -t 1 -m rif672000 cif77175 cib77175 rif16384 rif884736 cib2048 rif8192 rif512 rib512 cib512
|
||||
|
||||
@@ -0,0 +1,52 @@
|
||||
|
||||
// (C) Copyright Tobias Schwinger
|
||||
//
|
||||
// Use modification and distribution are subject to the boost Software License,
|
||||
// Version 1.0. (See http://www.boost.org/LICENSE_1_0.txt).
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
// no include guards, this file is intended for multiple inclusion
|
||||
|
||||
// input: BOOST_FT_syntax type macro to use
|
||||
// input: BOOST_FT_cc empty or cc specifier
|
||||
// input: BOOST_FT_ell empty or "..."
|
||||
// input: BOOST_FT_cv empty or cv qualifiers
|
||||
// input: BOOST_FT_flags single decimal integer encoding the flags
|
||||
// output: BOOST_FT_n number of component types (arity+1)
|
||||
// output: BOOST_FT_arity current arity
|
||||
// output: BOOST_FT_type macro that expands to the type
|
||||
// output: BOOST_FT_tplargs(p) template arguments with given prefix
|
||||
// output: BOOST_FT_params(p) parameters with given prefix
|
||||
|
||||
template< typename R , typename T0 >
|
||||
typename encode_charr<BOOST_FT_flags,BOOST_FT_cc_id,1> ::type
|
||||
classifier_impl(BOOST_FT_syntax(BOOST_FT_cc, BOOST_PP_EMPTY) ( BOOST_FT_ell) BOOST_FT_cv);
|
||||
template< typename R , typename T0 , typename T1 >
|
||||
typename encode_charr<BOOST_FT_flags,BOOST_FT_cc_id,2> ::type
|
||||
classifier_impl(BOOST_FT_syntax(BOOST_FT_cc, BOOST_PP_EMPTY) (T1 BOOST_FT_ell) BOOST_FT_cv);
|
||||
template< typename R , typename T0 , typename T1 , typename T2 >
|
||||
typename encode_charr<BOOST_FT_flags,BOOST_FT_cc_id,3> ::type
|
||||
classifier_impl(BOOST_FT_syntax(BOOST_FT_cc, BOOST_PP_EMPTY) (T1 , T2 BOOST_FT_ell) BOOST_FT_cv);
|
||||
template< typename R , typename T0 , typename T1 , typename T2 , typename T3 >
|
||||
typename encode_charr<BOOST_FT_flags,BOOST_FT_cc_id,4> ::type
|
||||
classifier_impl(BOOST_FT_syntax(BOOST_FT_cc, BOOST_PP_EMPTY) (T1 , T2 , T3 BOOST_FT_ell) BOOST_FT_cv);
|
||||
template< typename R , typename T0 , typename T1 , typename T2 , typename T3 , typename T4 >
|
||||
typename encode_charr<BOOST_FT_flags,BOOST_FT_cc_id,5> ::type
|
||||
classifier_impl(BOOST_FT_syntax(BOOST_FT_cc, BOOST_PP_EMPTY) (T1 , T2 , T3 , T4 BOOST_FT_ell) BOOST_FT_cv);
|
||||
template< typename R , typename T0 , typename T1 , typename T2 , typename T3 , typename T4 , typename T5 >
|
||||
typename encode_charr<BOOST_FT_flags,BOOST_FT_cc_id,6> ::type
|
||||
classifier_impl(BOOST_FT_syntax(BOOST_FT_cc, BOOST_PP_EMPTY) (T1 , T2 , T3 , T4 , T5 BOOST_FT_ell) BOOST_FT_cv);
|
||||
template< typename R , typename T0 , typename T1 , typename T2 , typename T3 , typename T4 , typename T5 , typename T6 >
|
||||
typename encode_charr<BOOST_FT_flags,BOOST_FT_cc_id,7> ::type
|
||||
classifier_impl(BOOST_FT_syntax(BOOST_FT_cc, BOOST_PP_EMPTY) (T1 , T2 , T3 , T4 , T5 , T6 BOOST_FT_ell) BOOST_FT_cv);
|
||||
template< typename R , typename T0 , typename T1 , typename T2 , typename T3 , typename T4 , typename T5 , typename T6 , typename T7 >
|
||||
typename encode_charr<BOOST_FT_flags,BOOST_FT_cc_id,8> ::type
|
||||
classifier_impl(BOOST_FT_syntax(BOOST_FT_cc, BOOST_PP_EMPTY) (T1 , T2 , T3 , T4 , T5 , T6 , T7 BOOST_FT_ell) BOOST_FT_cv);
|
||||
template< typename R , typename T0 , typename T1 , typename T2 , typename T3 , typename T4 , typename T5 , typename T6 , typename T7 , typename T8 >
|
||||
typename encode_charr<BOOST_FT_flags,BOOST_FT_cc_id,9> ::type
|
||||
classifier_impl(BOOST_FT_syntax(BOOST_FT_cc, BOOST_PP_EMPTY) (T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 BOOST_FT_ell) BOOST_FT_cv);
|
||||
template< typename R , typename T0 , typename T1 , typename T2 , typename T3 , typename T4 , typename T5 , typename T6 , typename T7 , typename T8 , typename T9 >
|
||||
typename encode_charr<BOOST_FT_flags,BOOST_FT_cc_id,10> ::type
|
||||
classifier_impl(BOOST_FT_syntax(BOOST_FT_cc, BOOST_PP_EMPTY) (T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 BOOST_FT_ell) BOOST_FT_cv);
|
||||
|
||||
@@ -0,0 +1,67 @@
|
||||
/* boost random/detail/ptr_helper.hpp header file
|
||||
*
|
||||
* Copyright Jens Maurer 2002
|
||||
* Distributed under the Boost Software License, Version 1.0. (See
|
||||
* accompanying file LICENSE_1_0.txt or copy at
|
||||
* http://www.boost.org/LICENSE_1_0.txt)
|
||||
*
|
||||
* See http://www.boost.org for most recent version including documentation.
|
||||
*
|
||||
* $Id$
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef BOOST_RANDOM_DETAIL_PTR_HELPER_HPP
|
||||
#define BOOST_RANDOM_DETAIL_PTR_HELPER_HPP
|
||||
|
||||
#include <boost/config.hpp>
|
||||
|
||||
|
||||
namespace boost {
|
||||
namespace random {
|
||||
namespace detail {
|
||||
|
||||
// type_traits could help here, but I don't want to depend on type_traits.
|
||||
template<class T>
|
||||
struct ptr_helper
|
||||
{
|
||||
typedef T value_type;
|
||||
typedef T& reference_type;
|
||||
typedef const T& rvalue_type;
|
||||
static reference_type ref(T& r) { return r; }
|
||||
static const T& ref(const T& r) { return r; }
|
||||
};
|
||||
|
||||
template<class T>
|
||||
struct ptr_helper<T&>
|
||||
{
|
||||
typedef T value_type;
|
||||
typedef T& reference_type;
|
||||
typedef T& rvalue_type;
|
||||
static reference_type ref(T& r) { return r; }
|
||||
static const T& ref(const T& r) { return r; }
|
||||
};
|
||||
|
||||
template<class T>
|
||||
struct ptr_helper<T*>
|
||||
{
|
||||
typedef T value_type;
|
||||
typedef T& reference_type;
|
||||
typedef T* rvalue_type;
|
||||
static reference_type ref(T * p) { return *p; }
|
||||
static const T& ref(const T * p) { return *p; }
|
||||
};
|
||||
|
||||
} // namespace detail
|
||||
} // namespace random
|
||||
} // namespace boost
|
||||
|
||||
//
|
||||
// BOOST_RANDOM_PTR_HELPER_SPEC --
|
||||
//
|
||||
// Helper macro for broken compilers defines specializations of
|
||||
// ptr_helper.
|
||||
//
|
||||
# define BOOST_RANDOM_PTR_HELPER_SPEC(T)
|
||||
|
||||
#endif // BOOST_RANDOM_DETAIL_PTR_HELPER_HPP
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 2.5 KiB |
@@ -0,0 +1,7 @@
|
||||
#ifndef WSPR_TX_SCHEDULER_H_
|
||||
#define WSPR_TX_SCHEDULER_H_
|
||||
|
||||
int next_tx_state (int pctx);
|
||||
int next_hopping_band();
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,75 @@
|
||||
// (C) Copyright 2005 Matthias Troyer
|
||||
|
||||
// Use, modification and distribution is subject to the Boost Software
|
||||
// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
// Authors: Matthias Troyer
|
||||
|
||||
#ifndef BOOST_MPI_DETAIL_MPI_DATATYPE_OARCHIVE_HPP
|
||||
#define BOOST_MPI_DETAIL_MPI_DATATYPE_OARCHIVE_HPP
|
||||
|
||||
#include <boost/type_traits/is_enum.hpp>
|
||||
#include <boost/mpl/bool.hpp>
|
||||
#include <boost/archive/detail/oserializer.hpp>
|
||||
#include <boost/archive/detail/auto_link_archive.hpp>
|
||||
#include <boost/archive/basic_archive.hpp>
|
||||
#include <boost/mpi/detail/ignore_skeleton_oarchive.hpp>
|
||||
#include <boost/mpi/detail/mpi_datatype_primitive.hpp>
|
||||
#include <boost/mpi/datatype_fwd.hpp>
|
||||
#include <boost/mpl/assert.hpp>
|
||||
#include <boost/static_assert.hpp>
|
||||
#include <boost/integer.hpp>
|
||||
#include <boost/archive/detail/register_archive.hpp>
|
||||
|
||||
namespace boost { namespace mpi { namespace detail {
|
||||
|
||||
|
||||
// an archive wrapper that stores only the data members but not the
|
||||
// special types defined by the serialization library
|
||||
// to define the data skeletons (classes, pointers, container sizes, ...)
|
||||
|
||||
class mpi_datatype_oarchive
|
||||
: public mpi_datatype_primitive,
|
||||
public ignore_skeleton_oarchive<mpi_datatype_oarchive>
|
||||
{
|
||||
public:
|
||||
template <class T>
|
||||
mpi_datatype_oarchive(const T& x)
|
||||
: mpi_datatype_primitive(&x) // register address
|
||||
{
|
||||
BOOST_MPL_ASSERT((is_mpi_datatype<T>));
|
||||
*this << x; // serialize the object
|
||||
}
|
||||
|
||||
template<class T>
|
||||
void save_override(T const& t)
|
||||
{
|
||||
save_enum(t,boost::is_enum<T>());
|
||||
}
|
||||
|
||||
template<class T>
|
||||
void save_enum(T const& t, mpl::false_)
|
||||
{
|
||||
ignore_skeleton_oarchive<mpi_datatype_oarchive>::save_override(t);
|
||||
}
|
||||
|
||||
template<class T>
|
||||
void save_enum(T const& t, mpl::true_)
|
||||
{
|
||||
// select the right sized integer for the enum
|
||||
typedef typename boost::uint_t<8*sizeof(T)>::least int_type;
|
||||
BOOST_STATIC_ASSERT((sizeof(T)==sizeof(int_type)));
|
||||
this->save(*reinterpret_cast<int_type const*>(&t));
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
} } } // end namespace boost::mpi::detail
|
||||
|
||||
// required by export
|
||||
BOOST_SERIALIZATION_REGISTER_ARCHIVE(boost::mpi::detail::mpi_datatype_oarchive)
|
||||
BOOST_SERIALIZATION_REGISTER_ARCHIVE(boost::mpi::detail::ignore_skeleton_oarchive<boost::mpi::detail::mpi_datatype_oarchive>)
|
||||
BOOST_SERIALIZATION_USE_ARRAY_OPTIMIZATION(boost::mpi::detail::mpi_datatype_oarchive)
|
||||
|
||||
#endif // BOOST_MPI_DETAIL_MPI_DATATYPE_OARCHIVE_HPP
|
||||
@@ -0,0 +1,55 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 1999-2003 Jaakko Jarvi
|
||||
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_GREATER_EQUAL_05052005_1142)
|
||||
#define FUSION_GREATER_EQUAL_05052005_1142
|
||||
|
||||
#include <boost/fusion/support/config.hpp>
|
||||
#include <boost/mpl/bool.hpp>
|
||||
#include <boost/fusion/iterator/deref.hpp>
|
||||
#include <boost/fusion/iterator/next.hpp>
|
||||
#include <boost/fusion/iterator/equal_to.hpp>
|
||||
#include <boost/fusion/support/as_const.hpp>
|
||||
|
||||
namespace boost { namespace fusion { namespace detail
|
||||
{
|
||||
template <typename Seq1, typename Seq2>
|
||||
struct sequence_greater_equal
|
||||
{
|
||||
typedef typename result_of::end<Seq1>::type end1_type;
|
||||
typedef typename result_of::end<Seq2>::type end2_type;
|
||||
|
||||
template <typename I1, typename I2>
|
||||
BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
|
||||
static bool
|
||||
call(I1 const&, I2 const&, mpl::true_)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
template <typename I1, typename I2>
|
||||
BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
|
||||
static bool
|
||||
call(I1 const& a, I2 const& b, mpl::false_)
|
||||
{
|
||||
return extension::as_const(*a) >= extension::as_const(*b)
|
||||
&& (!(extension::as_const(*b) >= extension::as_const(*a)) ||
|
||||
call(fusion::next(a), fusion::next(b)));
|
||||
}
|
||||
|
||||
template <typename I1, typename I2>
|
||||
BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
|
||||
static bool
|
||||
call(I1 const& a, I2 const& b)
|
||||
{
|
||||
typename result_of::equal_to<I1, end1_type>::type eq;
|
||||
return call(a, b, eq);
|
||||
}
|
||||
};
|
||||
}}}
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,103 @@
|
||||
#include "echograph.h"
|
||||
#include "commons.h"
|
||||
#include <QSettings>
|
||||
#include <QApplication>
|
||||
#include "echoplot.h"
|
||||
#include "ui_echograph.h"
|
||||
#include "moc_echograph.cpp"
|
||||
|
||||
#define NSMAX2 1366
|
||||
|
||||
EchoGraph::EchoGraph(QSettings * settings, QWidget *parent) :
|
||||
QDialog {parent, Qt::Window | Qt::WindowTitleHint | Qt::WindowCloseButtonHint | Qt::WindowMinimizeButtonHint},
|
||||
m_settings (settings),
|
||||
ui(new Ui::EchoGraph)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
setWindowTitle (QApplication::applicationName () + " - " + tr ("Echo Graph"));
|
||||
installEventFilter(parent); //Installing the filter
|
||||
ui->echoPlot->setCursor(Qt::CrossCursor);
|
||||
setMaximumWidth(2048);
|
||||
setMaximumHeight(880);
|
||||
ui->echoPlot->setMaximumHeight(800);
|
||||
|
||||
//Restore user's settings
|
||||
m_settings->beginGroup("EchoGraph");
|
||||
restoreGeometry (m_settings->value ("geometry", saveGeometry ()).toByteArray ());
|
||||
ui->echoPlot->setPlotZero(m_settings->value("PlotZero", 0).toInt());
|
||||
ui->echoPlot->setPlotGain(m_settings->value("PlotGain", 0).toInt());
|
||||
ui->zeroSlider->setValue(ui->echoPlot->getPlotZero());
|
||||
ui->gainSlider->setValue(ui->echoPlot->getPlotGain());
|
||||
int n=m_settings->value("Smooth",0).toInt();
|
||||
ui->echoPlot->m_smooth=n;
|
||||
ui->smoothSpinBox->setValue(n);
|
||||
n=m_settings->value("EchoBPP",1).toInt();
|
||||
ui->echoPlot->m_binsPerPixel=n;
|
||||
ui->binsPerPixelSpinBox->setValue(n);
|
||||
ui->echoPlot->m_blue=m_settings->value("BlueCurve",false).toBool();
|
||||
m_nColor=m_settings->value("EchoColors",0).toInt();
|
||||
m_settings->endGroup();
|
||||
ui->echoPlot->setColors(m_nColor);
|
||||
}
|
||||
|
||||
EchoGraph::~EchoGraph()
|
||||
{
|
||||
saveSettings();
|
||||
}
|
||||
|
||||
void EchoGraph::closeEvent (QCloseEvent * e)
|
||||
{
|
||||
saveSettings ();
|
||||
QDialog::closeEvent (e);
|
||||
}
|
||||
|
||||
void EchoGraph::saveSettings()
|
||||
{
|
||||
//Save user's settings
|
||||
m_settings->beginGroup("EchoGraph");
|
||||
m_settings->setValue ("geometry", saveGeometry ());
|
||||
m_settings->setValue("PlotZero",ui->echoPlot->m_plotZero);
|
||||
m_settings->setValue("PlotGain",ui->echoPlot->m_plotGain);
|
||||
m_settings->setValue("Smooth",ui->echoPlot->m_smooth);
|
||||
m_settings->setValue("EchoBPP",ui->echoPlot->m_binsPerPixel);
|
||||
m_settings->setValue("BlueCurve",ui->echoPlot->m_blue);
|
||||
m_settings->setValue("EchoColors",m_nColor);
|
||||
m_settings->endGroup();
|
||||
}
|
||||
|
||||
void EchoGraph::plotSpec()
|
||||
{
|
||||
ui->echoPlot->draw();
|
||||
ui->nsum_label->setText("N: " + QString::number(echocom_.nsum));
|
||||
}
|
||||
|
||||
void EchoGraph::on_smoothSpinBox_valueChanged(int n)
|
||||
{
|
||||
ui->echoPlot->setSmooth(n);
|
||||
ui->echoPlot->draw();
|
||||
}
|
||||
|
||||
void EchoGraph::on_gainSlider_valueChanged(int value)
|
||||
{
|
||||
ui->echoPlot->setPlotGain(value);
|
||||
ui->echoPlot->draw();
|
||||
}
|
||||
|
||||
void EchoGraph::on_zeroSlider_valueChanged(int value)
|
||||
{
|
||||
ui->echoPlot->setPlotZero(value);
|
||||
ui->echoPlot->draw();
|
||||
}
|
||||
|
||||
void EchoGraph::on_binsPerPixelSpinBox_valueChanged(int n)
|
||||
{
|
||||
ui->echoPlot->m_binsPerPixel=n;
|
||||
ui->echoPlot->DrawOverlay();
|
||||
ui->echoPlot->draw();
|
||||
}
|
||||
|
||||
void EchoGraph::on_pbColors_clicked()
|
||||
{
|
||||
m_nColor = (m_nColor+1) % 6;
|
||||
ui->echoPlot->setColors(m_nColor);
|
||||
}
|
||||
@@ -0,0 +1,51 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2005-2012 Joel de Guzman
|
||||
Copyright (c) 2005-2006 Dan Marsden
|
||||
|
||||
Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
==============================================================================*/
|
||||
#if !defined(BOOST_FUSION_FRONT_EXTENDED_DEQUE_26112006_2209)
|
||||
#define BOOST_FUSION_FRONT_EXTENDED_DEQUE_26112006_2209
|
||||
|
||||
#include <boost/fusion/support/config.hpp>
|
||||
#include <boost/mpl/int.hpp>
|
||||
#include <boost/fusion/support/sequence_base.hpp>
|
||||
#include <boost/fusion/sequence/intrinsic/size.hpp>
|
||||
#include <boost/fusion/container/deque/detail/keyed_element.hpp>
|
||||
|
||||
namespace boost { namespace fusion
|
||||
{
|
||||
template <typename Deque, typename T>
|
||||
struct front_extended_deque
|
||||
: detail::keyed_element<typename Deque::next_down, T, Deque>
|
||||
, sequence_base<front_extended_deque<Deque, T> >
|
||||
{
|
||||
typedef detail::keyed_element<typename Deque::next_down, T, Deque> base;
|
||||
typedef mpl::int_<(Deque::next_down::value - 1)> next_down;
|
||||
typedef typename Deque::next_up next_up;
|
||||
typedef mpl::int_<(result_of::size<Deque>::value + 1)> size;
|
||||
|
||||
template <typename Arg>
|
||||
BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
|
||||
front_extended_deque(Deque const& deque, Arg const& val)
|
||||
: base(val, deque)
|
||||
{}
|
||||
|
||||
#if defined(BOOST_NO_CXX11_RVALUE_REFERENCES)
|
||||
template <typename Arg>
|
||||
BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
|
||||
front_extended_deque(Deque const& deque, Arg& val)
|
||||
: base(val, deque)
|
||||
{}
|
||||
#else
|
||||
template <typename Arg>
|
||||
BOOST_CXX14_CONSTEXPR BOOST_FUSION_GPU_ENABLED
|
||||
front_extended_deque(Deque const& deque, Arg&& val)
|
||||
: base(BOOST_FUSION_FWD_ELEM(Arg, val), deque)
|
||||
{}
|
||||
#endif
|
||||
};
|
||||
}}
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,76 @@
|
||||
/*
|
||||
This file is part of wsprd.
|
||||
|
||||
File name: mettab.c
|
||||
Description: Metric table for sequential Fano decoder.
|
||||
|
||||
Copyright 2008-2015, Joseph Taylor, K1JT
|
||||
License: GNU GPL v3
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
int mettab[2][256]={
|
||||
5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
|
||||
5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
|
||||
5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
|
||||
5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
|
||||
5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
|
||||
5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
|
||||
5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
|
||||
5, 5, 5, 5, 5, 5, 5, 5, 5, 4,
|
||||
4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
|
||||
4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
|
||||
3, 3, 3, 3, 3, 3, 3, 3, 3, 2,
|
||||
2, 2, 2, 2, 1, 1, 1, 1, 0, 0,
|
||||
-1, -1, -1, -2, -2, -3, -4, -4, -5, -6,
|
||||
-7, -7, -8, -9, -10, -11, -12, -12, -13, -14,
|
||||
-15, -16, -17, -17, -18, -19, -20, -21, -22, -22,
|
||||
-23, -24, -25, -26, -26, -27, -28, -29, -30, -30,
|
||||
-31, -32, -33, -33, -34, -35, -36, -36, -37, -38,
|
||||
-38, -39, -40, -41, -41, -42, -43, -43, -44, -45,
|
||||
-45, -46, -47, -47, -48, -49, -49, -50, -51, -51,
|
||||
-52, -53, -53, -54, -54, -55, -56, -56, -57, -57,
|
||||
-58, -59, -59, -60, -60, -61, -62, -62, -62, -63,
|
||||
-64, -64, -65, -65, -66, -67, -67, -67, -68, -69,
|
||||
-69, -70, -70, -71, -72, -72, -72, -72, -73, -74,
|
||||
-75, -75, -75, -77, -76, -76, -78, -78, -80, -81,
|
||||
-80, -79, -83, -82, -81, -82, -82, -83, -84, -84,
|
||||
-84, -87, -86, -87, -88,-105, -94,-105, -88, -87,
|
||||
-86, -87, -84, -84, -84, -83, -82, -82, -81, -82,
|
||||
-83, -79, -80, -81, -80, -78, -78, -76, -76, -77,
|
||||
-75, -75, -75, -74, -73, -72, -72, -72, -72, -71,
|
||||
-70, -70, -69, -69, -68, -67, -67, -67, -66, -65,
|
||||
-65, -64, -64, -63, -62, -62, -62, -61, -60, -60,
|
||||
-59, -59, -58, -57, -57, -56, -56, -55, -54, -54,
|
||||
-53, -53, -52, -51, -51, -50, -49, -49, -48, -47,
|
||||
-47, -46, -45, -45, -44, -43, -43, -42, -41, -41,
|
||||
-40, -39, -38, -38, -37, -36, -36, -35, -34, -33,
|
||||
-33, -32, -31, -30, -30, -29, -28, -27, -26, -26,
|
||||
-25, -24, -23, -22, -22, -21, -20, -19, -18, -17,
|
||||
-17, -16, -15, -14, -13, -12, -12, -11, -10, -9,
|
||||
-8, -7, -7, -6, -5, -4, -4, -3, -2, -2,
|
||||
-1, -1, -1, 0, 0, 1, 1, 1, 1, 2,
|
||||
2, 2, 2, 2, 3, 3, 3, 3, 3, 3,
|
||||
3, 3, 3, 4, 4, 4, 4, 4, 4, 4,
|
||||
4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
|
||||
4, 4, 4, 4, 5, 5, 5, 5, 5, 5,
|
||||
5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
|
||||
5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
|
||||
5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
|
||||
5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
|
||||
5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
|
||||
5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
|
||||
5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
|
||||
5, 5 };
|
||||
@@ -0,0 +1,245 @@
|
||||
// (C) Copyright John Maddock 2005.
|
||||
// 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_MATH_COMPLEX_ACOS_INCLUDED
|
||||
#define BOOST_MATH_COMPLEX_ACOS_INCLUDED
|
||||
|
||||
#ifndef BOOST_MATH_COMPLEX_DETAILS_INCLUDED
|
||||
# include <boost/math/complex/details.hpp>
|
||||
#endif
|
||||
#ifndef BOOST_MATH_LOG1P_INCLUDED
|
||||
# include <boost/math/special_functions/log1p.hpp>
|
||||
#endif
|
||||
#include <boost/assert.hpp>
|
||||
|
||||
#ifdef BOOST_NO_STDC_NAMESPACE
|
||||
namespace std{ using ::sqrt; using ::fabs; using ::acos; using ::asin; using ::atan; using ::atan2; }
|
||||
#endif
|
||||
|
||||
namespace boost{ namespace math{
|
||||
|
||||
template<class T>
|
||||
std::complex<T> acos(const std::complex<T>& z)
|
||||
{
|
||||
//
|
||||
// This implementation is a transcription of the pseudo-code in:
|
||||
//
|
||||
// "Implementing the Complex Arcsine and Arccosine Functions using Exception Handling."
|
||||
// T E Hull, Thomas F Fairgrieve and Ping Tak Peter Tang.
|
||||
// ACM Transactions on Mathematical Software, Vol 23, No 3, Sept 1997.
|
||||
//
|
||||
|
||||
//
|
||||
// These static constants should really be in a maths constants library,
|
||||
// note that we have tweaked a_crossover as per: https://svn.boost.org/trac/boost/ticket/7290
|
||||
//
|
||||
static const T one = static_cast<T>(1);
|
||||
//static const T two = static_cast<T>(2);
|
||||
static const T half = static_cast<T>(0.5L);
|
||||
static const T a_crossover = static_cast<T>(10);
|
||||
static const T b_crossover = static_cast<T>(0.6417L);
|
||||
static const T s_pi = boost::math::constants::pi<T>();
|
||||
static const T half_pi = s_pi / 2;
|
||||
static const T log_two = boost::math::constants::ln_two<T>();
|
||||
static const T quarter_pi = s_pi / 4;
|
||||
|
||||
#ifdef BOOST_MSVC
|
||||
#pragma warning(push)
|
||||
#pragma warning(disable:4127)
|
||||
#endif
|
||||
//
|
||||
// Get real and imaginary parts, discard the signs as we can
|
||||
// figure out the sign of the result later:
|
||||
//
|
||||
T x = std::fabs(z.real());
|
||||
T y = std::fabs(z.imag());
|
||||
|
||||
T real, imag; // these hold our result
|
||||
|
||||
//
|
||||
// Handle special cases specified by the C99 standard,
|
||||
// many of these special cases aren't really needed here,
|
||||
// but doing it this way prevents overflow/underflow arithmetic
|
||||
// in the main body of the logic, which may trip up some machines:
|
||||
//
|
||||
if((boost::math::isinf)(x))
|
||||
{
|
||||
if((boost::math::isinf)(y))
|
||||
{
|
||||
real = quarter_pi;
|
||||
imag = std::numeric_limits<T>::infinity();
|
||||
}
|
||||
else if((boost::math::isnan)(y))
|
||||
{
|
||||
return std::complex<T>(y, -std::numeric_limits<T>::infinity());
|
||||
}
|
||||
else
|
||||
{
|
||||
// y is not infinity or nan:
|
||||
real = 0;
|
||||
imag = std::numeric_limits<T>::infinity();
|
||||
}
|
||||
}
|
||||
else if((boost::math::isnan)(x))
|
||||
{
|
||||
if((boost::math::isinf)(y))
|
||||
return std::complex<T>(x, ((boost::math::signbit)(z.imag())) ? std::numeric_limits<T>::infinity() : -std::numeric_limits<T>::infinity());
|
||||
return std::complex<T>(x, x);
|
||||
}
|
||||
else if((boost::math::isinf)(y))
|
||||
{
|
||||
real = half_pi;
|
||||
imag = std::numeric_limits<T>::infinity();
|
||||
}
|
||||
else if((boost::math::isnan)(y))
|
||||
{
|
||||
return std::complex<T>((x == 0) ? half_pi : y, y);
|
||||
}
|
||||
else
|
||||
{
|
||||
//
|
||||
// What follows is the regular Hull et al code,
|
||||
// begin with the special case for real numbers:
|
||||
//
|
||||
if((y == 0) && (x <= one))
|
||||
return std::complex<T>((x == 0) ? half_pi : std::acos(z.real()), (boost::math::changesign)(z.imag()));
|
||||
//
|
||||
// Figure out if our input is within the "safe area" identified by Hull et al.
|
||||
// This would be more efficient with portable floating point exception handling;
|
||||
// fortunately the quantities M and u identified by Hull et al (figure 3),
|
||||
// match with the max and min methods of numeric_limits<T>.
|
||||
//
|
||||
T safe_max = detail::safe_max(static_cast<T>(8));
|
||||
T safe_min = detail::safe_min(static_cast<T>(4));
|
||||
|
||||
T xp1 = one + x;
|
||||
T xm1 = x - one;
|
||||
|
||||
if((x < safe_max) && (x > safe_min) && (y < safe_max) && (y > safe_min))
|
||||
{
|
||||
T yy = y * y;
|
||||
T r = std::sqrt(xp1*xp1 + yy);
|
||||
T s = std::sqrt(xm1*xm1 + yy);
|
||||
T a = half * (r + s);
|
||||
T b = x / a;
|
||||
|
||||
if(b <= b_crossover)
|
||||
{
|
||||
real = std::acos(b);
|
||||
}
|
||||
else
|
||||
{
|
||||
T apx = a + x;
|
||||
if(x <= one)
|
||||
{
|
||||
real = std::atan(std::sqrt(half * apx * (yy /(r + xp1) + (s-xm1)))/x);
|
||||
}
|
||||
else
|
||||
{
|
||||
real = std::atan((y * std::sqrt(half * (apx/(r + xp1) + apx/(s+xm1))))/x);
|
||||
}
|
||||
}
|
||||
|
||||
if(a <= a_crossover)
|
||||
{
|
||||
T am1;
|
||||
if(x < one)
|
||||
{
|
||||
am1 = half * (yy/(r + xp1) + yy/(s - xm1));
|
||||
}
|
||||
else
|
||||
{
|
||||
am1 = half * (yy/(r + xp1) + (s + xm1));
|
||||
}
|
||||
imag = boost::math::log1p(am1 + std::sqrt(am1 * (a + one)));
|
||||
}
|
||||
else
|
||||
{
|
||||
imag = std::log(a + std::sqrt(a*a - one));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
//
|
||||
// This is the Hull et al exception handling code from Fig 6 of their paper:
|
||||
//
|
||||
if(y <= (std::numeric_limits<T>::epsilon() * std::fabs(xm1)))
|
||||
{
|
||||
if(x < one)
|
||||
{
|
||||
real = std::acos(x);
|
||||
imag = y / std::sqrt(xp1*(one-x));
|
||||
}
|
||||
else
|
||||
{
|
||||
// This deviates from Hull et al's paper as per https://svn.boost.org/trac/boost/ticket/7290
|
||||
if(((std::numeric_limits<T>::max)() / xp1) > xm1)
|
||||
{
|
||||
// xp1 * xm1 won't overflow:
|
||||
real = y / std::sqrt(xm1*xp1);
|
||||
imag = boost::math::log1p(xm1 + std::sqrt(xp1*xm1));
|
||||
}
|
||||
else
|
||||
{
|
||||
real = y / x;
|
||||
imag = log_two + std::log(x);
|
||||
}
|
||||
}
|
||||
}
|
||||
else if(y <= safe_min)
|
||||
{
|
||||
// There is an assumption in Hull et al's analysis that
|
||||
// if we get here then x == 1. This is true for all "good"
|
||||
// machines where :
|
||||
//
|
||||
// E^2 > 8*sqrt(u); with:
|
||||
//
|
||||
// E = std::numeric_limits<T>::epsilon()
|
||||
// u = (std::numeric_limits<T>::min)()
|
||||
//
|
||||
// Hull et al provide alternative code for "bad" machines
|
||||
// but we have no way to test that here, so for now just assert
|
||||
// on the assumption:
|
||||
//
|
||||
BOOST_ASSERT(x == 1);
|
||||
real = std::sqrt(y);
|
||||
imag = std::sqrt(y);
|
||||
}
|
||||
else if(std::numeric_limits<T>::epsilon() * y - one >= x)
|
||||
{
|
||||
real = half_pi;
|
||||
imag = log_two + std::log(y);
|
||||
}
|
||||
else if(x > one)
|
||||
{
|
||||
real = std::atan(y/x);
|
||||
T xoy = x/y;
|
||||
imag = log_two + std::log(y) + half * boost::math::log1p(xoy*xoy);
|
||||
}
|
||||
else
|
||||
{
|
||||
real = half_pi;
|
||||
T a = std::sqrt(one + y*y);
|
||||
imag = half * boost::math::log1p(static_cast<T>(2)*y*(y+a));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// Finish off by working out the sign of the result:
|
||||
//
|
||||
if((boost::math::signbit)(z.real()))
|
||||
real = s_pi - real;
|
||||
if(!(boost::math::signbit)(z.imag()))
|
||||
imag = (boost::math::changesign)(imag);
|
||||
|
||||
return std::complex<T>(real, imag);
|
||||
#ifdef BOOST_MSVC
|
||||
#pragma warning(pop)
|
||||
#endif
|
||||
}
|
||||
|
||||
} } // namespaces
|
||||
|
||||
#endif // BOOST_MATH_COMPLEX_ACOS_INCLUDED
|
||||
@@ -0,0 +1,285 @@
|
||||
program wsprlfsim
|
||||
|
||||
! Simulate characteristics of a potential "WSPR-LF" mode using LDPC (300,60)
|
||||
! code, OQPSK modulation, and 5 minute T/R sequences.
|
||||
|
||||
! Reception and Demodulation algorithm:
|
||||
! 1. Compute coarse spectrum; find fc1 = approx carrier freq
|
||||
! 2. Mix from fc1 to 0; LPF at +/- 0.75*R
|
||||
! 3. Square, FFT; find peaks near -R/2 and +R/2 to get fc2
|
||||
! 4. Mix from fc2 to 0
|
||||
! 5. Fit cb13 (central part of csync) to c -> lag, phase
|
||||
! 6. Fit complex ploynomial for channel equalization
|
||||
! 7. Get soft bits from equalized data
|
||||
|
||||
include 'wsprlf_params.f90'
|
||||
|
||||
! Q: Would it be better for central Sync array to use both I and Q channels?
|
||||
|
||||
character*8 arg
|
||||
complex cbb(0:NZ-1) !Complex baseband waveform
|
||||
complex csync(0:NZ-1) !Sync symbols only, from cbb
|
||||
complex c(0:NZ-1) !Complex waveform
|
||||
complex c0(0:NZ-1) !Complex waveform
|
||||
complex c1(0:NZ-1) !Complex waveform
|
||||
complex zz(NS+ND) !Complex symbol values (intermediate)
|
||||
complex z
|
||||
real xnoise(0:NZ-1) !Generated random noise
|
||||
real ynoise(0:NZ-1) !Generated random noise
|
||||
real rxdata(ND),llr(ND) !Soft symbols
|
||||
real pp(2*NSPS) !Shaped pulse for OQPSK
|
||||
real a(5) !For twkfreq1
|
||||
real aa(20),bb(20) !Fitted polyco's
|
||||
real t(11)
|
||||
character*12 label(11)
|
||||
integer*8 count0,count1,count2,count3,clkfreq
|
||||
integer nc(11)
|
||||
integer id(NS+ND) !NRZ values (+/-1) for Sync and Data
|
||||
integer ierror(NS+ND)
|
||||
integer icw(NN)
|
||||
integer itone(NN)
|
||||
integer*1 msgbits(KK),decoded(KK),apmask(ND),cw(ND)
|
||||
! integer*1 codeword(ND)
|
||||
data msgbits/0,0,1,0,0,1,1,1,1,0,0,1,0,0,0,0,0,0,0,0,1,0,0,0,1,1,0,0,0,1, &
|
||||
1,1,1,0,1,1,1,1,1,1,1,0,0,1,0,0,1,1,0,1,1,0,1,0,1,1,0,0,1,1/
|
||||
data label/'genwsprlf','twkfreq1 a','watterson','noise gen','getfc1w', &
|
||||
'getfc2w','twkfreq1 b','xdt loop','cpolyfitw','msksoftsym', &
|
||||
'bpdecode300'/
|
||||
|
||||
nargs=iargc()
|
||||
if(nargs.ne.6) then
|
||||
print*,'Usage: wsprlfsim f0(Hz) delay(ms) fspread(Hz) maxn iters snr(dB)'
|
||||
print*,'Example: wsprlfsim 0 0 0 5 10 -20'
|
||||
print*,'Set snr=0 to cycle through a range'
|
||||
go to 999
|
||||
endif
|
||||
call getarg(1,arg)
|
||||
read(arg,*) f0 !Generated carrier frequency
|
||||
call getarg(2,arg)
|
||||
read(arg,*) delay !Delta_t (ms) for Watterson model
|
||||
call getarg(3,arg)
|
||||
read(arg,*) fspread !Fspread (Hz) for Watterson model
|
||||
call getarg(4,arg)
|
||||
read(arg,*) maxn !Max nterms for polyfit
|
||||
call getarg(5,arg)
|
||||
read(arg,*) iters !Iterations at each SNR
|
||||
call getarg(6,arg)
|
||||
read(arg,*) snrdb !Specified SNR_2500
|
||||
|
||||
nc=0
|
||||
twopi=8.0*atan(1.0)
|
||||
fs=NSPS*12000.0/NSPS0 !Sample rate = 22.2222... Hz
|
||||
dt=1.0/fs !Sample interval (s)
|
||||
tt=NSPS*dt !Duration of "itone" symbols (s)
|
||||
ts=2*NSPS*dt !Duration of OQPSK symbols (s)
|
||||
baud=1.0/tt !Keying rate for "itone" symbols (baud)
|
||||
txt=NZ*dt !Transmission length (s)
|
||||
bandwidth_ratio=2500.0/(fs/2.0)
|
||||
write(*,1000) fs,f0,delay,fspread,maxn,baud,3*baud,txt,iters
|
||||
1000 format('fs:',f10.3,' f0:',f5.1,' Delay:',f4.1,' fSpread:',f5.2, &
|
||||
' maxn:',i3,/'Baud:',f8.3,' BW:',f5.1,' TxT:',f6.1,' iters:',i4/)
|
||||
write(*,1004)
|
||||
1004 format(/' SNR sync data ser ber fer fsigma tsigma', &
|
||||
' tsec'/68('-'))
|
||||
|
||||
do i=1,N2 !Half-sine pulse shape
|
||||
pp(i)=sin(0.5*(i-1)*twopi/(2*NSPS))
|
||||
enddo
|
||||
|
||||
t=0.
|
||||
call system_clock(count0,clkfreq)
|
||||
call genwsprlf(msgbits,id,icw,cbb,csync,itone)!Generate baseband waveform
|
||||
call system_clock(count1,clkfreq)
|
||||
t(1)=float(count1-count0)/float(clkfreq)
|
||||
nc(1)=nc(1)+1
|
||||
do i=0,NZ-1
|
||||
write(40,4001) i,cbb(i),csync(i)
|
||||
4001 format(i8,4f12.6)
|
||||
enddo
|
||||
|
||||
call system_clock(count0,clkfreq)
|
||||
a=0.
|
||||
a(1)=f0
|
||||
call twkfreq1(cbb,NZ,fs,a,c0) !Mix baseband to specified frequency
|
||||
call system_clock(count1,clkfreq)
|
||||
t(2)=float(count1-count0)/float(clkfreq)
|
||||
nc(2)=nc(2)+1
|
||||
|
||||
isna=-20
|
||||
isnb=-40
|
||||
if(snrdb.ne.0.0) then
|
||||
isna=nint(snrdb)
|
||||
isnb=isna
|
||||
endif
|
||||
do isnr=isna,isnb,-1 !Loop over SNR range
|
||||
if(isna.ne.isnb) snrdb=isnr
|
||||
sig=sqrt(bandwidth_ratio) * 10.0**(0.05*snrdb)
|
||||
if(snrdb.gt.90.0) sig=1.0
|
||||
nhard=0
|
||||
nhardsync=0
|
||||
nfe=0
|
||||
sqf=0.
|
||||
sqt=0.
|
||||
|
||||
call system_clock(count2,clkfreq)
|
||||
do iter=1,iters !Loop over requested iterations
|
||||
c=c0
|
||||
|
||||
call system_clock(count0,clkfreq)
|
||||
if(delay.ne.0.0 .or. fspread.ne.0.0) then
|
||||
call watterson(c,NZ,fs,delay,fspread)
|
||||
endif
|
||||
call system_clock(count1,clkfreq)
|
||||
t(3)=t(3)+float(count1-count0)/float(clkfreq)
|
||||
nc(3)=nc(3)+1
|
||||
|
||||
call system_clock(count0,clkfreq)
|
||||
c=sig*c !Scale to requested SNR
|
||||
if(snrdb.lt.90) then
|
||||
do i=0,NZ-1 !Generate gaussian noise
|
||||
xnoise(i)=gran()
|
||||
ynoise(i)=gran()
|
||||
enddo
|
||||
c=c + cmplx(xnoise,ynoise) !Add AWGN noise
|
||||
endif
|
||||
call system_clock(count1,clkfreq)
|
||||
t(4)=t(4)+float(count1-count0)/float(clkfreq)
|
||||
nc(4)=nc(4)+1
|
||||
|
||||
call system_clock(count0,clkfreq)
|
||||
call getfc1w(c,fs,fc1) !First approx for freq
|
||||
call system_clock(count1,clkfreq)
|
||||
t(5)=t(5)+float(count1-count0)/float(clkfreq)
|
||||
nc(5)=nc(5)+1
|
||||
|
||||
call system_clock(count0,clkfreq)
|
||||
call getfc2w(c,csync,fs,fc1,fc2,fc3) !Refined freq
|
||||
call system_clock(count1,clkfreq)
|
||||
t(6)=t(6)+float(count1-count0)/float(clkfreq)
|
||||
nc(6)=nc(6)+1
|
||||
sqf=sqf + (fc1+fc2-f0)**2
|
||||
|
||||
call system_clock(count0,clkfreq)
|
||||
!NB: Measured performance is about equally good using fc2 or fc3 here:
|
||||
a(1)=-(fc1+fc2)
|
||||
a(2:5)=0.
|
||||
call twkfreq1(c,NZ,fs,a,c) !Mix c down by fc1+fc2
|
||||
call system_clock(count1,clkfreq)
|
||||
t(7)=t(7)+float(count1-count0)/float(clkfreq)
|
||||
nc(7)=nc(7)+1
|
||||
|
||||
! The following may not be necessary?
|
||||
! z=sum(c(3088:3503)*cb13)/208.0 !Get phase from Barker 13 vector
|
||||
! z0=z/abs(z)
|
||||
! c=c*conjg(z0)
|
||||
|
||||
call system_clock(count0,clkfreq)
|
||||
!---------------------------------------------------------------- DT
|
||||
! Not presently used:
|
||||
amax=0.
|
||||
jpk=0
|
||||
iaa=0
|
||||
ibb=NZ-1
|
||||
do j=-20*NSPS,20*NSPS,NSPS/8
|
||||
ia=j
|
||||
ib=NZ-1+j
|
||||
if(ia.lt.0) then
|
||||
ia=0
|
||||
iaa=-j
|
||||
else
|
||||
iaa=0
|
||||
endif
|
||||
if(ib.gt.NZ-1) then
|
||||
ib=NZ-1
|
||||
ibb=NZ-1-j
|
||||
endif
|
||||
z=sum(c(ia:ib)*conjg(csync(iaa:ibb)))
|
||||
if(abs(z).gt.amax) then
|
||||
amax=abs(z)
|
||||
jpk=j
|
||||
endif
|
||||
enddo
|
||||
xdt=jpk/fs
|
||||
sqt=sqt + xdt**2
|
||||
call system_clock(count1,clkfreq)
|
||||
t(8)=t(8)+float(count1-count0)/float(clkfreq)
|
||||
nc(8)=nc(8)+1
|
||||
|
||||
!-----------------------------------------------------------------
|
||||
|
||||
nterms=maxn
|
||||
c1=c
|
||||
do itry=1,20
|
||||
idf=itry/2
|
||||
if(mod(itry,2).eq.0) idf=-idf
|
||||
nhard0=0
|
||||
nhardsync0=0
|
||||
ifer=1
|
||||
a(1)=idf*0.00085
|
||||
a(2:5)=0.
|
||||
call system_clock(count0,clkfreq)
|
||||
call twkfreq1(c1,NZ,fs,a,c) !Mix c1 into c
|
||||
call cpolyfitw(c,pp,id,maxn,aa,bb,zz,nhs)
|
||||
call system_clock(count1,clkfreq)
|
||||
t(9)=t(9)+float(count1-count0)/float(clkfreq)
|
||||
nc(9)=nc(9)+1
|
||||
|
||||
call system_clock(count0,clkfreq)
|
||||
call msksoftsymw(zz,aa,bb,id,nterms,ierror,rxdata,nhard0,nhardsync0)
|
||||
call system_clock(count1,clkfreq)
|
||||
t(10)=t(10)+float(count1-count0)/float(clkfreq)
|
||||
nc(10)=nc(10)+1
|
||||
|
||||
if(nhardsync0.gt.35) cycle
|
||||
rxav=sum(rxdata)/ND
|
||||
rx2av=sum(rxdata*rxdata)/ND
|
||||
rxsig=sqrt(rx2av-rxav*rxav)
|
||||
rxdata=rxdata/rxsig
|
||||
ss=0.84
|
||||
llr=2.0*rxdata/(ss*ss)
|
||||
apmask=0
|
||||
max_iterations=40
|
||||
ifer=0
|
||||
call system_clock(count0,clkfreq)
|
||||
call bpdecode300(llr,apmask,max_iterations,decoded,niterations,cw)
|
||||
call system_clock(count1,clkfreq)
|
||||
t(11)=t(11)+float(count1-count0)/float(clkfreq)
|
||||
nc(11)=nc(11)+1
|
||||
nbadcrc=0
|
||||
if(niterations.ge.0) call chkcrc10(decoded,nbadcrc)
|
||||
if(niterations.lt.0 .or. count(msgbits.ne.decoded).gt.0 .or. &
|
||||
nbadcrc.ne.0) ifer=1
|
||||
if(ifer.eq.0) exit
|
||||
enddo !Freq dither loop
|
||||
nhard=nhard+nhard0
|
||||
nhardsync=nhardsync+nhardsync0
|
||||
nfe=nfe+ifer
|
||||
if(nhardsync0+nhard0+niterations+ifer.gt.0) write(42,1045) snrdb, &
|
||||
nhardsync0,nhard0,niterations,ifer,xdt
|
||||
1045 format(f6.1,4i6,f8.2)
|
||||
enddo
|
||||
call system_clock(count3,clkfreq)
|
||||
tsec=float(count3-count2)/float(clkfreq)
|
||||
|
||||
fsigma=sqrt(sqf/iters)
|
||||
tsigma=sqrt(sqt/iters)
|
||||
ser=float(nhardsync)/(NS*iters)
|
||||
ber=float(nhard)/(ND*iters)
|
||||
fer=float(nfe)/iters
|
||||
write(*,1050) snrdb,nhardsync,nhard,ser,ber,fer,fsigma,tsigma,tsec
|
||||
1050 format(f6.1,2i7,2f8.4,f7.3,2f8.2f8.3)
|
||||
enddo
|
||||
|
||||
write(*,1060) NS*iters,ND*iters
|
||||
1060 format(68('-')/6x,2i7)
|
||||
|
||||
write(*,1065)
|
||||
1065 format(/'Timing sec frac calls'/39('-'))
|
||||
do i=1,11
|
||||
write(*,1070) label(i),t(i),t(i)/sum(t),nc(i)
|
||||
1070 format(a12,2f9.3,i8)
|
||||
enddo
|
||||
write(*,1072) sum(t),1.0
|
||||
1072 format(39('-')/12x,2f10.3)
|
||||
|
||||
999 end program wsprlfsim
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,620 @@
|
||||
// -*- Mode: C++ -*-
|
||||
#ifndef MAINWINDOW_H
|
||||
#define MAINWINDOW_H
|
||||
#ifdef QT5
|
||||
#include <QtWidgets>
|
||||
#else
|
||||
#include <QtGui>
|
||||
#endif
|
||||
#include <QThread>
|
||||
#include <QTimer>
|
||||
#include <QDateTime>
|
||||
#include <QList>
|
||||
#include <QAudioDeviceInfo>
|
||||
#include <QScopedPointer>
|
||||
#include <QDir>
|
||||
#include <QProgressDialog>
|
||||
#include <QAbstractSocket>
|
||||
#include <QHostAddress>
|
||||
#include <QPointer>
|
||||
#include <QSet>
|
||||
#include <QVector>
|
||||
#include <QFuture>
|
||||
#include <QFutureWatcher>
|
||||
|
||||
#include "AudioDevice.hpp"
|
||||
#include "commons.h"
|
||||
#include "Radio.hpp"
|
||||
#include "Modes.hpp"
|
||||
#include "FrequencyList.hpp"
|
||||
#include "Configuration.hpp"
|
||||
#include "WSPRBandHopping.hpp"
|
||||
#include "Transceiver.hpp"
|
||||
#include "DisplayManual.hpp"
|
||||
#include "psk_reporter.h"
|
||||
#include "logbook/logbook.h"
|
||||
#include "decodedtext.h"
|
||||
#include "commons.h"
|
||||
#include "astro.h"
|
||||
#include "MessageBox.hpp"
|
||||
#include "NetworkAccessManager.hpp"
|
||||
|
||||
#define NUM_JT4_SYMBOLS 206 //(72+31)*2, embedded sync
|
||||
#define NUM_JT65_SYMBOLS 126 //63 data + 63 sync
|
||||
#define NUM_JT9_SYMBOLS 85 //69 data + 16 sync
|
||||
#define NUM_WSPR_SYMBOLS 162 //(50+31)*2, embedded sync
|
||||
#define NUM_WSPR_LF_SYMBOLS 412 //300 data + 109 sync + 3 ramp
|
||||
#define NUM_ISCAT_SYMBOLS 1291 //30*11025/256
|
||||
#define NUM_MSK144_SYMBOLS 144 //s8 + d48 + s8 + d80
|
||||
#define NUM_QRA64_SYMBOLS 84 //63 data + 21 sync
|
||||
#define NUM_FT8_SYMBOLS 79
|
||||
#define NUM_CW_SYMBOLS 250
|
||||
#define TX_SAMPLE_RATE 48000
|
||||
#define N_WIDGETS 24
|
||||
|
||||
extern int volatile itone[NUM_ISCAT_SYMBOLS]; //Audio tones for all Tx symbols
|
||||
extern int volatile icw[NUM_CW_SYMBOLS]; //Dits for CW ID
|
||||
|
||||
//--------------------------------------------------------------- MainWindow
|
||||
namespace Ui {
|
||||
class MainWindow;
|
||||
}
|
||||
|
||||
class QSettings;
|
||||
class QLineEdit;
|
||||
class QFont;
|
||||
class QHostInfo;
|
||||
class EchoGraph;
|
||||
class FastGraph;
|
||||
class WideGraph;
|
||||
class LogQSO;
|
||||
class Transceiver;
|
||||
class MessageAveraging;
|
||||
class MessageClient;
|
||||
class QTime;
|
||||
class WSPRBandHopping;
|
||||
class HelpTextWindow;
|
||||
class WSPRNet;
|
||||
class SoundOutput;
|
||||
class Modulator;
|
||||
class SoundInput;
|
||||
class Detector;
|
||||
class SampleDownloader;
|
||||
class MultiSettings;
|
||||
class PhaseEqualizationDialog;
|
||||
|
||||
class MainWindow : public QMainWindow
|
||||
{
|
||||
Q_OBJECT;
|
||||
|
||||
public:
|
||||
using Frequency = Radio::Frequency;
|
||||
using FrequencyDelta = Radio::FrequencyDelta;
|
||||
using Mode = Modes::Mode;
|
||||
|
||||
explicit MainWindow(QDir const& temp_directory, bool multiple, MultiSettings *,
|
||||
QSharedMemory *shdmem, unsigned downSampleFactor,
|
||||
QSplashScreen *,
|
||||
QWidget *parent = nullptr);
|
||||
~MainWindow();
|
||||
|
||||
public slots:
|
||||
void showSoundInError(const QString& errorMsg);
|
||||
void showSoundOutError(const QString& errorMsg);
|
||||
void showStatusMessage(const QString& statusMsg);
|
||||
void dataSink(qint64 frames);
|
||||
void fastSink(qint64 frames);
|
||||
void diskDat();
|
||||
void freezeDecode(int n);
|
||||
void guiUpdate();
|
||||
void doubleClickOnCall(bool shift, bool ctrl);
|
||||
void doubleClickOnCall2(bool shift, bool ctrl);
|
||||
void readFromStdout();
|
||||
void p1ReadFromStdout();
|
||||
void setXIT(int n, Frequency base = 0u);
|
||||
void setFreq4(int rxFreq, int txFreq);
|
||||
void msgAvgDecode2();
|
||||
void fastPick(int x0, int x1, int y);
|
||||
|
||||
protected:
|
||||
void keyPressEvent (QKeyEvent *) override;
|
||||
void closeEvent(QCloseEvent *) override;
|
||||
void childEvent(QChildEvent *) override;
|
||||
bool eventFilter(QObject *, QEvent *) override;
|
||||
|
||||
private slots:
|
||||
void on_tx1_editingFinished();
|
||||
void on_tx2_editingFinished();
|
||||
void on_tx3_editingFinished();
|
||||
void on_tx4_editingFinished();
|
||||
void on_tx5_currentTextChanged (QString const&);
|
||||
void on_tx6_editingFinished();
|
||||
void on_actionSettings_triggered();
|
||||
void on_monitorButton_clicked (bool);
|
||||
void on_actionAbout_triggered();
|
||||
void on_autoButton_clicked (bool);
|
||||
void on_stopTxButton_clicked();
|
||||
void on_stopButton_clicked();
|
||||
void on_actionRelease_Notes_triggered ();
|
||||
void on_actionOnline_User_Guide_triggered();
|
||||
void on_actionLocal_User_Guide_triggered();
|
||||
void on_actionWide_Waterfall_triggered();
|
||||
void on_actionOpen_triggered();
|
||||
void on_actionOpen_next_in_directory_triggered();
|
||||
void on_actionDecode_remaining_files_in_directory_triggered();
|
||||
void on_actionDelete_all_wav_files_in_SaveDir_triggered();
|
||||
void on_actionOpen_log_directory_triggered ();
|
||||
void on_actionNone_triggered();
|
||||
void on_actionSave_all_triggered();
|
||||
void on_actionKeyboard_shortcuts_triggered();
|
||||
void on_actionSpecial_mouse_commands_triggered();
|
||||
void on_DecodeButton_clicked (bool);
|
||||
void decode();
|
||||
void decodeBusy(bool b);
|
||||
void on_EraseButton_clicked();
|
||||
void on_txb1_clicked();
|
||||
void on_txFirstCheckBox_stateChanged(int arg1);
|
||||
void set_dateTimeQSO(int m_ntx);
|
||||
void set_ntx(int n);
|
||||
void on_txrb1_toggled(bool status);
|
||||
void on_txrb2_toggled(bool status);
|
||||
void on_txrb3_toggled(bool status);
|
||||
void on_txb2_clicked();
|
||||
void on_txb3_clicked();
|
||||
void on_txb4_clicked();
|
||||
void on_txb5_clicked();
|
||||
void on_txb6_clicked();
|
||||
void on_lookupButton_clicked();
|
||||
void on_addButton_clicked();
|
||||
void on_dxCallEntry_textChanged (QString const&);
|
||||
void on_dxGridEntry_textChanged (QString const&);
|
||||
void on_dxCallEntry_returnPressed ();
|
||||
void on_genStdMsgsPushButton_clicked();
|
||||
void on_logQSOButton_clicked();
|
||||
void on_actionJT9_triggered();
|
||||
void on_actionJT65_triggered();
|
||||
void on_actionJT9_JT65_triggered();
|
||||
void on_actionJT4_triggered();
|
||||
void on_actionFT8_triggered();
|
||||
void on_TxFreqSpinBox_valueChanged(int arg1);
|
||||
void on_actionSave_decoded_triggered();
|
||||
void on_actionQuickDecode_toggled (bool);
|
||||
void on_actionMediumDecode_toggled (bool);
|
||||
void on_actionDeepestDecode_toggled (bool);
|
||||
void on_inGain_valueChanged(int n);
|
||||
void bumpFqso(int n);
|
||||
void on_actionErase_ALL_TXT_triggered();
|
||||
void on_actionErase_wsjtx_log_adi_triggered();
|
||||
void startTx2();
|
||||
void startP1();
|
||||
void stopTx();
|
||||
void stopTx2();
|
||||
void on_pbCallCQ_clicked();
|
||||
void on_pbAnswerCaller_clicked();
|
||||
void on_pbSendRRR_clicked();
|
||||
void on_pbAnswerCQ_clicked();
|
||||
void on_pbSendReport_clicked();
|
||||
void on_pbSend73_clicked();
|
||||
void on_rbGenMsg_clicked(bool checked);
|
||||
void on_rbFreeText_clicked(bool checked);
|
||||
void on_freeTextMsg_currentTextChanged (QString const&);
|
||||
void on_rptSpinBox_valueChanged(int n);
|
||||
void killFile();
|
||||
void on_tuneButton_clicked (bool);
|
||||
void on_pbR2T_clicked();
|
||||
void on_pbT2R_clicked();
|
||||
void acceptQSO2(QDateTime const&, QString const& call, QString const& grid
|
||||
, Frequency dial_freq, QString const& mode
|
||||
, QString const& rpt_sent, QString const& rpt_received
|
||||
, QString const& tx_power, QString const& comments
|
||||
, QString const& name, QDateTime const&);
|
||||
void on_bandComboBox_currentIndexChanged (int index);
|
||||
void on_bandComboBox_activated (int index);
|
||||
void on_readFreq_clicked();
|
||||
void on_pbTxMode_clicked();
|
||||
void on_RxFreqSpinBox_valueChanged(int n);
|
||||
void on_cbTxLock_clicked(bool checked);
|
||||
void on_outAttenuation_valueChanged (int);
|
||||
void rigOpen ();
|
||||
void handle_transceiver_update (Transceiver::TransceiverState const&);
|
||||
void handle_transceiver_failure (QString const& reason);
|
||||
void on_actionAstronomical_data_toggled (bool);
|
||||
void on_actionShort_list_of_add_on_prefixes_and_suffixes_triggered();
|
||||
void band_changed (Frequency);
|
||||
void monitor (bool);
|
||||
void stop_tuning ();
|
||||
void stopTuneATU();
|
||||
void auto_tx_mode(bool);
|
||||
void on_actionMessage_averaging_triggered();
|
||||
void on_actionInclude_averaging_toggled (bool);
|
||||
void on_actionInclude_correlation_toggled (bool);
|
||||
void on_actionEnable_AP_DXcall_toggled (bool);
|
||||
void VHF_features_enabled(bool b);
|
||||
void on_sbSubmode_valueChanged(int n);
|
||||
void on_cbShMsgs_toggled(bool b);
|
||||
void on_cbSWL_toggled(bool b);
|
||||
void on_cbTx6_toggled(bool b);
|
||||
void on_cbMenus_toggled(bool b);
|
||||
void networkError (QString const&);
|
||||
void on_ClrAvgButton_clicked();
|
||||
void on_actionWSPR_triggered();
|
||||
void on_actionWSPR_LF_triggered();
|
||||
void on_syncSpinBox_valueChanged(int n);
|
||||
void on_TxPowerComboBox_currentIndexChanged(const QString &arg1);
|
||||
void on_sbTxPercent_valueChanged(int n);
|
||||
void on_cbUploadWSPR_Spots_toggled(bool b);
|
||||
void WSPR_config(bool b);
|
||||
void uploadSpots();
|
||||
void TxAgain();
|
||||
void uploadResponse(QString response);
|
||||
void on_WSPRfreqSpinBox_valueChanged(int n);
|
||||
void on_pbTxNext_clicked(bool b);
|
||||
void on_actionEcho_Graph_triggered();
|
||||
void on_actionEcho_triggered();
|
||||
void on_actionISCAT_triggered();
|
||||
void on_actionFast_Graph_triggered();
|
||||
void on_actionHide_Controls_toggled (bool chaecked);
|
||||
void fast_decode_done();
|
||||
void on_actionMeasure_reference_spectrum_triggered();
|
||||
void on_actionErase_reference_spectrum_triggered();
|
||||
void on_actionMeasure_phase_response_triggered();
|
||||
void on_sbTR_valueChanged (int);
|
||||
void on_sbFtol_valueChanged (int);
|
||||
void on_cbFast9_clicked(bool b);
|
||||
void on_sbCQTxFreq_valueChanged(int n);
|
||||
void on_cbCQTx_toggled(bool b);
|
||||
void on_actionMSK144_triggered();
|
||||
void on_actionQRA64_triggered();
|
||||
void on_actionFreqCal_triggered();
|
||||
void splash_done ();
|
||||
|
||||
private:
|
||||
Q_SIGNAL void initializeAudioOutputStream (QAudioDeviceInfo,
|
||||
unsigned channels, unsigned msBuffered) const;
|
||||
Q_SIGNAL void stopAudioOutputStream () const;
|
||||
Q_SIGNAL void startAudioInputStream (QAudioDeviceInfo const&,
|
||||
int framesPerBuffer, AudioDevice * sink,
|
||||
unsigned downSampleFactor, AudioDevice::Channel) const;
|
||||
Q_SIGNAL void suspendAudioInputStream () const;
|
||||
Q_SIGNAL void resumeAudioInputStream () const;
|
||||
Q_SIGNAL void startDetector (AudioDevice::Channel) const;
|
||||
Q_SIGNAL void FFTSize (unsigned) const;
|
||||
Q_SIGNAL void detectorClose () const;
|
||||
Q_SIGNAL void finished () const;
|
||||
Q_SIGNAL void transmitFrequency (double) const;
|
||||
Q_SIGNAL void endTransmitMessage (bool quick = false) const;
|
||||
Q_SIGNAL void tune (bool = true) const;
|
||||
Q_SIGNAL void sendMessage (unsigned symbolsLength, double framesPerSymbol,
|
||||
double frequency, double toneSpacing,
|
||||
SoundOutput *, AudioDevice::Channel = AudioDevice::Mono,
|
||||
bool synchronize = true, bool fastMode = false, double dBSNR = 99.,
|
||||
int TRperiod=60) const;
|
||||
Q_SIGNAL void outAttenuationChanged (qreal) const;
|
||||
Q_SIGNAL void toggleShorthand () const;
|
||||
|
||||
private:
|
||||
void astroUpdate ();
|
||||
void writeAllTxt(QString message);
|
||||
void FT8_AutoSeq(QString message);
|
||||
|
||||
NetworkAccessManager m_network_manager;
|
||||
bool m_valid;
|
||||
QSplashScreen * m_splash;
|
||||
QDir m_dataDir;
|
||||
QString m_revision;
|
||||
bool m_multiple;
|
||||
MultiSettings * m_multi_settings;
|
||||
QPushButton * m_configurations_button;
|
||||
QSettings * m_settings;
|
||||
QScopedPointer<Ui::MainWindow> ui;
|
||||
|
||||
// other windows
|
||||
Configuration m_config;
|
||||
WSPRBandHopping m_WSPR_band_hopping;
|
||||
bool m_WSPR_tx_next;
|
||||
MessageBox m_rigErrorMessageBox;
|
||||
QScopedPointer<SampleDownloader> m_sampleDownloader;
|
||||
QScopedPointer<PhaseEqualizationDialog> m_phaseEqualizationDialog;
|
||||
|
||||
QScopedPointer<WideGraph> m_wideGraph;
|
||||
QScopedPointer<EchoGraph> m_echoGraph;
|
||||
QScopedPointer<FastGraph> m_fastGraph;
|
||||
QScopedPointer<LogQSO> m_logDlg;
|
||||
QScopedPointer<Astro> m_astroWidget;
|
||||
QScopedPointer<HelpTextWindow> m_shortcuts;
|
||||
QScopedPointer<HelpTextWindow> m_prefixes;
|
||||
QScopedPointer<HelpTextWindow> m_mouseCmnds;
|
||||
QScopedPointer<MessageAveraging> m_msgAvgWidget;
|
||||
|
||||
Transceiver::TransceiverState m_rigState;
|
||||
Frequency m_lastDialFreq;
|
||||
QString m_lastBand;
|
||||
Frequency m_dialFreqRxWSPR; // best guess at WSPR QRG
|
||||
|
||||
Detector * m_detector;
|
||||
unsigned m_FFTSize;
|
||||
SoundInput * m_soundInput;
|
||||
Modulator * m_modulator;
|
||||
SoundOutput * m_soundOutput;
|
||||
QThread m_audioThread;
|
||||
|
||||
qint64 m_msErase;
|
||||
qint64 m_secBandChanged;
|
||||
qint64 m_freqMoon;
|
||||
Frequency m_freqNominal;
|
||||
Frequency m_freqTxNominal;
|
||||
Astro::Correction m_astroCorrection;
|
||||
|
||||
double m_s6;
|
||||
double m_tRemaining;
|
||||
|
||||
float m_DTtol;
|
||||
float m_t0;
|
||||
float m_t1;
|
||||
float m_t0Pick;
|
||||
float m_t1Pick;
|
||||
float m_fCPUmskrtd;
|
||||
|
||||
qint32 m_waterfallAvg;
|
||||
qint32 m_ntx;
|
||||
bool m_gen_message_is_cq;
|
||||
qint32 m_timeout;
|
||||
qint32 m_XIT;
|
||||
qint32 m_setftx;
|
||||
qint32 m_ndepth;
|
||||
qint32 m_sec0;
|
||||
qint32 m_RxLog;
|
||||
qint32 m_nutc0;
|
||||
qint32 m_ntr;
|
||||
qint32 m_tx;
|
||||
qint32 m_hsym;
|
||||
qint32 m_TRperiod;
|
||||
qint32 m_nsps;
|
||||
qint32 m_hsymStop;
|
||||
qint32 m_inGain;
|
||||
qint32 m_ncw;
|
||||
qint32 m_secID;
|
||||
qint32 m_idleMinutes;
|
||||
qint32 m_nSubMode;
|
||||
qint32 m_nclearave;
|
||||
qint32 m_minSync;
|
||||
qint32 m_dBm;
|
||||
qint32 m_pctx;
|
||||
qint32 m_nseq;
|
||||
qint32 m_nWSPRdecodes;
|
||||
qint32 m_k0;
|
||||
qint32 m_kdone;
|
||||
qint32 m_nPick;
|
||||
FrequencyList::const_iterator m_frequency_list_fcal_iter;
|
||||
qint32 m_nTx73;
|
||||
qint32 m_UTCdisk;
|
||||
qint32 m_wait;
|
||||
|
||||
bool m_btxok; //True if OK to transmit
|
||||
bool m_diskData;
|
||||
bool m_loopall;
|
||||
bool m_decoderBusy;
|
||||
bool m_txFirst;
|
||||
bool m_auto;
|
||||
bool m_restart;
|
||||
bool m_startAnother;
|
||||
bool m_saveDecoded;
|
||||
bool m_saveAll;
|
||||
bool m_widebandDecode;
|
||||
bool m_call3Modified;
|
||||
bool m_dataAvailable;
|
||||
bool m_bDecoded;
|
||||
bool m_noSuffix;
|
||||
bool m_blankLine;
|
||||
bool m_decodedText2;
|
||||
bool m_freeText;
|
||||
bool m_sentFirst73;
|
||||
int m_currentMessageType;
|
||||
QString m_currentMessage;
|
||||
int m_lastMessageType;
|
||||
QString m_lastMessageSent;
|
||||
bool m_lockTxFreq;
|
||||
bool m_bShMsgs;
|
||||
bool m_bSWL;
|
||||
bool m_uploadSpots;
|
||||
bool m_uploading;
|
||||
bool m_txNext;
|
||||
bool m_grid6;
|
||||
bool m_tuneup;
|
||||
bool m_bTxTime;
|
||||
bool m_rxDone;
|
||||
bool m_bSimplex; // not using split even if it is available
|
||||
bool m_bEchoTxOK;
|
||||
bool m_bTransmittedEcho;
|
||||
bool m_bEchoTxed;
|
||||
bool m_bFastMode;
|
||||
bool m_bFast9;
|
||||
bool m_bFastDecodeCalled;
|
||||
bool m_bDoubleClickAfterCQnnn;
|
||||
bool m_bRefSpec;
|
||||
bool m_bClearRefSpec;
|
||||
bool m_bTrain;
|
||||
bool m_bUseRef;
|
||||
bool m_bFastDone;
|
||||
bool m_bAltV;
|
||||
bool m_bNoMoreFiles;
|
||||
bool m_bQRAsyncWarned;
|
||||
bool m_bDoubleClicked;
|
||||
|
||||
int m_ihsym;
|
||||
int m_nzap;
|
||||
int m_npts8;
|
||||
float m_px;
|
||||
float m_pxmax;
|
||||
float m_df3;
|
||||
int m_iptt0;
|
||||
bool m_btxok0;
|
||||
int m_nsendingsh;
|
||||
double m_onAirFreq0;
|
||||
bool m_first_error;
|
||||
|
||||
char m_msg[100][80];
|
||||
|
||||
// labels in status bar
|
||||
QLabel tx_status_label;
|
||||
QLabel config_label;
|
||||
QLabel mode_label;
|
||||
QLabel last_tx_label;
|
||||
QLabel auto_tx_label;
|
||||
QLabel band_hopping_label;
|
||||
QProgressBar progressBar;
|
||||
QLabel watchdog_label;
|
||||
|
||||
QFuture<void> m_wav_future;
|
||||
QFutureWatcher<void> m_wav_future_watcher;
|
||||
QFutureWatcher<void> watcher3;
|
||||
QFutureWatcher<QString> m_saveWAVWatcher;
|
||||
|
||||
QProcess proc_jt9;
|
||||
QProcess p1;
|
||||
QProcess p3;
|
||||
|
||||
WSPRNet *wsprNet;
|
||||
|
||||
QTimer m_guiTimer;
|
||||
QTimer ptt1Timer; //StartTx delay
|
||||
QTimer ptt0Timer; //StopTx delay
|
||||
QTimer logQSOTimer;
|
||||
QTimer killFileTimer;
|
||||
QTimer tuneButtonTimer;
|
||||
QTimer uploadTimer;
|
||||
QTimer tuneATU_Timer;
|
||||
QTimer TxAgainTimer;
|
||||
QTimer minuteTimer;
|
||||
QTimer splashTimer;
|
||||
QTimer p1Timer;
|
||||
|
||||
QString m_path;
|
||||
QString m_baseCall;
|
||||
QString m_hisCall;
|
||||
QString m_hisGrid;
|
||||
QString m_appDir;
|
||||
QString m_palette;
|
||||
QString m_dateTime;
|
||||
QString m_mode;
|
||||
QString m_modeTx;
|
||||
QString m_fnameWE; // save path without extension
|
||||
QString m_rpt;
|
||||
QString m_rptSent;
|
||||
QString m_rptRcvd;
|
||||
QString m_qsoStart;
|
||||
QString m_qsoStop;
|
||||
QString m_cmnd;
|
||||
QString m_cmndP1;
|
||||
QString m_msgSent0;
|
||||
QString m_fileToSave;
|
||||
QString m_calls;
|
||||
|
||||
QSet<QString> m_pfx;
|
||||
QSet<QString> m_sfx;
|
||||
|
||||
QDateTime m_dateTimeQSOOn;
|
||||
QDateTime m_dateTimeQSOOff;
|
||||
QDateTime m_dateTimeDefault;
|
||||
|
||||
QSharedMemory *mem_jt9;
|
||||
LogBook m_logBook;
|
||||
DecodedText m_QSOText;
|
||||
unsigned m_msAudioOutputBuffered;
|
||||
unsigned m_framesAudioInputBuffered;
|
||||
unsigned m_downSampleFactor;
|
||||
QThread::Priority m_audioThreadPriority;
|
||||
bool m_bandEdited;
|
||||
bool m_splitMode;
|
||||
bool m_monitoring;
|
||||
bool m_tx_when_ready;
|
||||
bool m_transmitting;
|
||||
bool m_tune;
|
||||
bool m_tx_watchdog; // true when watchdog triggered
|
||||
bool m_block_pwr_tooltip;
|
||||
bool m_PwrBandSetOK;
|
||||
bool m_bVHFwarned;
|
||||
Frequency m_lastMonitoredFrequency;
|
||||
double m_toneSpacing;
|
||||
int m_firstDecode;
|
||||
QProgressDialog m_optimizingProgress;
|
||||
QTimer m_heartbeat;
|
||||
MessageClient * m_messageClient;
|
||||
PSK_Reporter *psk_Reporter;
|
||||
DisplayManual m_manual;
|
||||
QHash<QString, QVariant> m_pwrBandTxMemory; // Remembers power level by band
|
||||
QHash<QString, QVariant> m_pwrBandTuneMemory; // Remembers power level by band for tuning
|
||||
QByteArray m_geometryNoControls;
|
||||
QVector<double> m_phaseEqCoefficients;
|
||||
|
||||
//---------------------------------------------------- private functions
|
||||
void readSettings();
|
||||
void setDecodedTextFont (QFont const&);
|
||||
void writeSettings();
|
||||
void createStatusBar();
|
||||
void updateStatusBar();
|
||||
void genStdMsgs(QString rpt);
|
||||
void genCQMsg();
|
||||
void clearDX ();
|
||||
void lookup();
|
||||
void ba2msg(QByteArray ba, char* message);
|
||||
void msgtype(QString t, QLineEdit* tx);
|
||||
void stub();
|
||||
void statusChanged();
|
||||
void fixStop();
|
||||
bool shortList(QString callsign);
|
||||
void transmit (double snr = 99.);
|
||||
void rigFailure (QString const& reason);
|
||||
void pskSetLocal ();
|
||||
void pskPost(DecodedText decodedtext);
|
||||
void displayDialFrequency ();
|
||||
void transmitDisplay (bool);
|
||||
void processMessage(QString const& messages, qint32 position, bool ctrl);
|
||||
void replyToCQ (QTime, qint32 snr, float delta_time, quint32 delta_frequency, QString const& mode, QString const& message_text);
|
||||
void replayDecodes ();
|
||||
void postDecode (bool is_new, QString const& message);
|
||||
void postWSPRDecode (bool is_new, QStringList message_parts);
|
||||
void enable_DXCC_entity (bool on);
|
||||
void switch_mode (Mode);
|
||||
void WSPR_scheduling ();
|
||||
void freqCalStep();
|
||||
void setRig (Frequency = 0); // zero frequency means no change
|
||||
void WSPR_history(Frequency dialFreq, int ndecodes);
|
||||
QString WSPR_hhmm(int n);
|
||||
void fast_config(bool b);
|
||||
void CQTxFreq();
|
||||
QString save_wave_file (QString const& name
|
||||
, short const * data
|
||||
, int seconds
|
||||
, QString const& my_callsign
|
||||
, QString const& my_grid
|
||||
, QString const& mode
|
||||
, qint32 sub_mode
|
||||
, Frequency frequency
|
||||
, QString const& his_call
|
||||
, QString const& his_grid) const;
|
||||
void read_wav_file (QString const& fname);
|
||||
void decodeDone ();
|
||||
void subProcessFailed (QProcess *, int exit_code, QProcess::ExitStatus);
|
||||
void subProcessError (QProcess *, QProcess::ProcessError);
|
||||
void statusUpdate () const;
|
||||
void update_watchdog_label ();
|
||||
void on_the_minute ();
|
||||
void add_child_to_event_filter (QObject *);
|
||||
void remove_child_from_event_filter (QObject *);
|
||||
void setup_status_bar (bool vhf);
|
||||
void tx_watchdog (bool triggered);
|
||||
int nWidgets(QString t);
|
||||
void displayWidgets(int n);
|
||||
void vhfWarning();
|
||||
QChar current_submode () const; // returns QChar {0} if sub mode is
|
||||
// not appropriate
|
||||
};
|
||||
|
||||
extern int killbyname(const char* progName);
|
||||
extern void getDev(int* numDevices,char hostAPI_DeviceName[][50],
|
||||
int minChan[], int maxChan[],
|
||||
int minSpeed[], int maxSpeed[]);
|
||||
extern int next_tx_state(int pctx);
|
||||
|
||||
#endif // MAINWINDOW_H
|
||||
@@ -0,0 +1,150 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 1998-2003 Joel de Guzman
|
||||
Copyright (c) 2001 Daniel Nuffer
|
||||
Copyright (c) 2002 Hartmut Kaiser
|
||||
http://spirit.sourceforge.net/
|
||||
|
||||
Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
=============================================================================*/
|
||||
#if !defined(BOOST_SPIRIT_DIFFERENCE_HPP)
|
||||
#define BOOST_SPIRIT_DIFFERENCE_HPP
|
||||
|
||||
#include <boost/spirit/home/classic/namespace.hpp>
|
||||
#include <boost/spirit/home/classic/core/parser.hpp>
|
||||
#include <boost/spirit/home/classic/core/primitives/primitives.hpp>
|
||||
#include <boost/spirit/home/classic/core/composite/composite.hpp>
|
||||
#include <boost/spirit/home/classic/meta/as_parser.hpp>
|
||||
|
||||
namespace boost { namespace spirit {
|
||||
|
||||
BOOST_SPIRIT_CLASSIC_NAMESPACE_BEGIN
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// difference: a - b; Matches a but not b
|
||||
//
|
||||
// Handles expressions of the form:
|
||||
//
|
||||
// a - b
|
||||
//
|
||||
// where a and b are parsers. The expression returns a composite
|
||||
// parser that matches a but not b. One (not both) of the operands
|
||||
// may be a literal char, wchar_t or a primitive string char const*,
|
||||
// wchar_t const*.
|
||||
//
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
struct difference_parser_gen;
|
||||
|
||||
#if BOOST_WORKAROUND(BOOST_MSVC, >= 1400)
|
||||
#pragma warning(push)
|
||||
#pragma warning(disable:4512) //assignment operator could not be generated
|
||||
#endif
|
||||
|
||||
template <typename A, typename B>
|
||||
struct difference
|
||||
: public binary<A, B, parser<difference<A, B> > >
|
||||
{
|
||||
typedef difference<A, B> self_t;
|
||||
typedef binary_parser_category parser_category_t;
|
||||
typedef difference_parser_gen parser_generator_t;
|
||||
typedef binary<A, B, parser<self_t> > base_t;
|
||||
|
||||
difference(A const& a, B const& b)
|
||||
: base_t(a, b) {}
|
||||
|
||||
template <typename ScannerT>
|
||||
typename parser_result<self_t, ScannerT>::type
|
||||
parse(ScannerT const& scan) const
|
||||
{
|
||||
typedef typename parser_result<self_t, ScannerT>::type result_t;
|
||||
typedef typename ScannerT::iterator_t iterator_t;
|
||||
iterator_t save = scan.first;
|
||||
if (result_t hl = this->left().parse(scan))
|
||||
{
|
||||
std::swap(save, scan.first);
|
||||
result_t hr = this->right().parse(scan);
|
||||
if (!hr || (hr.length() < hl.length()))
|
||||
{
|
||||
scan.first = save;
|
||||
return hl;
|
||||
}
|
||||
}
|
||||
|
||||
return scan.no_match();
|
||||
}
|
||||
};
|
||||
|
||||
#if BOOST_WORKAROUND(BOOST_MSVC, >= 1400)
|
||||
#pragma warning(pop)
|
||||
#endif
|
||||
|
||||
struct difference_parser_gen
|
||||
{
|
||||
template <typename A, typename B>
|
||||
struct result
|
||||
{
|
||||
typedef
|
||||
difference<
|
||||
typename as_parser<A>::type
|
||||
, typename as_parser<B>::type
|
||||
>
|
||||
type;
|
||||
};
|
||||
|
||||
template <typename A, typename B>
|
||||
static difference<
|
||||
typename as_parser<A>::type
|
||||
, typename as_parser<B>::type
|
||||
>
|
||||
generate(A const& a, B const& b)
|
||||
{
|
||||
return difference<BOOST_DEDUCED_TYPENAME as_parser<A>::type,
|
||||
BOOST_DEDUCED_TYPENAME as_parser<B>::type>
|
||||
(as_parser<A>::convert(a), as_parser<B>::convert(b));
|
||||
}
|
||||
};
|
||||
|
||||
template <typename A, typename B>
|
||||
difference<A, B>
|
||||
operator-(parser<A> const& a, parser<B> const& b);
|
||||
|
||||
template <typename A>
|
||||
difference<A, chlit<char> >
|
||||
operator-(parser<A> const& a, char b);
|
||||
|
||||
template <typename B>
|
||||
difference<chlit<char>, B>
|
||||
operator-(char a, parser<B> const& b);
|
||||
|
||||
template <typename A>
|
||||
difference<A, strlit<char const*> >
|
||||
operator-(parser<A> const& a, char const* b);
|
||||
|
||||
template <typename B>
|
||||
difference<strlit<char const*>, B>
|
||||
operator-(char const* a, parser<B> const& b);
|
||||
|
||||
template <typename A>
|
||||
difference<A, chlit<wchar_t> >
|
||||
operator-(parser<A> const& a, wchar_t b);
|
||||
|
||||
template <typename B>
|
||||
difference<chlit<wchar_t>, B>
|
||||
operator-(wchar_t a, parser<B> const& b);
|
||||
|
||||
template <typename A>
|
||||
difference<A, strlit<wchar_t const*> >
|
||||
operator-(parser<A> const& a, wchar_t const* b);
|
||||
|
||||
template <typename B>
|
||||
difference<strlit<wchar_t const*>, B>
|
||||
operator-(wchar_t const* a, parser<B> const& b);
|
||||
|
||||
BOOST_SPIRIT_CLASSIC_NAMESPACE_END
|
||||
|
||||
}} // namespace BOOST_SPIRIT_CLASSIC_NS
|
||||
|
||||
#endif
|
||||
|
||||
#include <boost/spirit/home/classic/core/composite/impl/difference.ipp>
|
||||
@@ -0,0 +1,21 @@
|
||||
|
||||
#ifndef BOOST_MPL_EQUAL_TO_HPP_INCLUDED
|
||||
#define BOOST_MPL_EQUAL_TO_HPP_INCLUDED
|
||||
|
||||
// Copyright Aleksey Gurtovoy 2000-2004
|
||||
//
|
||||
// Distributed under the Boost Software License, Version 1.0.
|
||||
// (See accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
//
|
||||
// See http://www.boost.org/libs/mpl for documentation.
|
||||
|
||||
// $Id$
|
||||
// $Date$
|
||||
// $Revision$
|
||||
|
||||
#define AUX778076_OP_NAME equal_to
|
||||
#define AUX778076_OP_TOKEN ==
|
||||
#include <boost/mpl/aux_/comparison_op.hpp>
|
||||
|
||||
#endif // BOOST_MPL_EQUAL_TO_HPP_INCLUDED
|
||||
@@ -0,0 +1,254 @@
|
||||
/* boost random/lognormal_distribution.hpp header file
|
||||
*
|
||||
* Copyright Jens Maurer 2000-2001
|
||||
* Copyright Steven Watanabe 2011
|
||||
* Distributed under the Boost Software License, Version 1.0. (See
|
||||
* accompanying file LICENSE_1_0.txt or copy at
|
||||
* http://www.boost.org/LICENSE_1_0.txt)
|
||||
*
|
||||
* See http://www.boost.org for most recent version including documentation.
|
||||
*
|
||||
* $Id$
|
||||
*
|
||||
* Revision history
|
||||
* 2001-02-18 moved to individual header files
|
||||
*/
|
||||
|
||||
#ifndef BOOST_RANDOM_LOGNORMAL_DISTRIBUTION_HPP
|
||||
#define BOOST_RANDOM_LOGNORMAL_DISTRIBUTION_HPP
|
||||
|
||||
#include <boost/config/no_tr1/cmath.hpp> // std::exp, std::sqrt
|
||||
#include <cassert>
|
||||
#include <iosfwd>
|
||||
#include <istream>
|
||||
#include <boost/limits.hpp>
|
||||
#include <boost/random/detail/config.hpp>
|
||||
#include <boost/random/detail/operators.hpp>
|
||||
#include <boost/random/normal_distribution.hpp>
|
||||
|
||||
namespace boost {
|
||||
namespace random {
|
||||
|
||||
/**
|
||||
* Instantiations of class template lognormal_distribution model a
|
||||
* \random_distribution. Such a distribution produces random numbers
|
||||
* with \f$\displaystyle p(x) = \frac{1}{x s \sqrt{2\pi}} e^{\frac{-\left(\log(x)-m\right)^2}{2s^2}}\f$
|
||||
* for x > 0.
|
||||
*
|
||||
* @xmlwarning
|
||||
* This distribution has been updated to match the C++ standard.
|
||||
* Its behavior has changed from the original
|
||||
* boost::lognormal_distribution. A backwards compatible
|
||||
* version is provided in namespace boost.
|
||||
* @endxmlwarning
|
||||
*/
|
||||
template<class RealType = double>
|
||||
class lognormal_distribution
|
||||
{
|
||||
public:
|
||||
typedef typename normal_distribution<RealType>::input_type input_type;
|
||||
typedef RealType result_type;
|
||||
|
||||
class param_type
|
||||
{
|
||||
public:
|
||||
|
||||
typedef lognormal_distribution distribution_type;
|
||||
|
||||
/** Constructs the parameters of a lognormal_distribution. */
|
||||
explicit param_type(RealType m_arg = RealType(0.0),
|
||||
RealType s_arg = RealType(1.0))
|
||||
: _m(m_arg), _s(s_arg) {}
|
||||
|
||||
/** Returns the "m" parameter of the distribution. */
|
||||
RealType m() const { return _m; }
|
||||
|
||||
/** Returns the "s" parameter of the distribution. */
|
||||
RealType s() const { return _s; }
|
||||
|
||||
/** Writes the parameters to a std::ostream. */
|
||||
BOOST_RANDOM_DETAIL_OSTREAM_OPERATOR(os, param_type, parm)
|
||||
{
|
||||
os << parm._m << " " << parm._s;
|
||||
return os;
|
||||
}
|
||||
|
||||
/** Reads the parameters from a std::istream. */
|
||||
BOOST_RANDOM_DETAIL_ISTREAM_OPERATOR(is, param_type, parm)
|
||||
{
|
||||
is >> parm._m >> std::ws >> parm._s;
|
||||
return is;
|
||||
}
|
||||
|
||||
/** Returns true if the two sets of parameters are equal. */
|
||||
BOOST_RANDOM_DETAIL_EQUALITY_OPERATOR(param_type, lhs, rhs)
|
||||
{ return lhs._m == rhs._m && lhs._s == rhs._s; }
|
||||
|
||||
/** Returns true if the two sets of parameters are different. */
|
||||
BOOST_RANDOM_DETAIL_INEQUALITY_OPERATOR(param_type)
|
||||
|
||||
private:
|
||||
RealType _m;
|
||||
RealType _s;
|
||||
};
|
||||
|
||||
/**
|
||||
* Constructs a lognormal_distribution. @c m and @c s are the
|
||||
* parameters of the distribution.
|
||||
*/
|
||||
explicit lognormal_distribution(RealType m_arg = RealType(0.0),
|
||||
RealType s_arg = RealType(1.0))
|
||||
: _normal(m_arg, s_arg) {}
|
||||
|
||||
/**
|
||||
* Constructs a lognormal_distribution from its parameters.
|
||||
*/
|
||||
explicit lognormal_distribution(const param_type& parm)
|
||||
: _normal(parm.m(), parm.s()) {}
|
||||
|
||||
// compiler-generated copy ctor and assignment operator are fine
|
||||
|
||||
/** Returns the m parameter of the distribution. */
|
||||
RealType m() const { return _normal.mean(); }
|
||||
/** Returns the s parameter of the distribution. */
|
||||
RealType s() const { return _normal.sigma(); }
|
||||
|
||||
/** Returns the smallest value that the distribution can produce. */
|
||||
RealType min BOOST_PREVENT_MACRO_SUBSTITUTION () const
|
||||
{ return RealType(0); }
|
||||
/** Returns the largest value that the distribution can produce. */
|
||||
RealType max BOOST_PREVENT_MACRO_SUBSTITUTION () const
|
||||
{ return (std::numeric_limits<RealType>::infinity)(); }
|
||||
|
||||
/** Returns the parameters of the distribution. */
|
||||
param_type param() const { return param_type(m(), s()); }
|
||||
/** Sets the parameters of the distribution. */
|
||||
void param(const param_type& parm)
|
||||
{
|
||||
typedef normal_distribution<RealType> normal_type;
|
||||
typename normal_type::param_type normal_param(parm.m(), parm.s());
|
||||
_normal.param(normal_param);
|
||||
}
|
||||
|
||||
/**
|
||||
* Effects: Subsequent uses of the distribution do not depend
|
||||
* on values produced by any engine prior to invoking reset.
|
||||
*/
|
||||
void reset() { _normal.reset(); }
|
||||
|
||||
/**
|
||||
* Returns a random variate distributed according to the
|
||||
* lognormal distribution.
|
||||
*/
|
||||
template<class Engine>
|
||||
result_type operator()(Engine& eng)
|
||||
{
|
||||
using std::exp;
|
||||
return exp(_normal(eng));
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a random variate distributed according to the
|
||||
* lognormal distribution with parameters specified by param.
|
||||
*/
|
||||
template<class Engine>
|
||||
result_type operator()(Engine& eng, const param_type& parm)
|
||||
{ return lognormal_distribution(parm)(eng); }
|
||||
|
||||
/** Writes the distribution to a @c std::ostream. */
|
||||
BOOST_RANDOM_DETAIL_OSTREAM_OPERATOR(os, lognormal_distribution, ld)
|
||||
{
|
||||
os << ld._normal;
|
||||
return os;
|
||||
}
|
||||
|
||||
/** Reads the distribution from a @c std::istream. */
|
||||
BOOST_RANDOM_DETAIL_ISTREAM_OPERATOR(is, lognormal_distribution, ld)
|
||||
{
|
||||
is >> ld._normal;
|
||||
return is;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns true if the two distributions will produce identical
|
||||
* sequences of values given equal generators.
|
||||
*/
|
||||
BOOST_RANDOM_DETAIL_EQUALITY_OPERATOR(lognormal_distribution, lhs, rhs)
|
||||
{ return lhs._normal == rhs._normal; }
|
||||
|
||||
/**
|
||||
* Returns true if the two distributions may produce different
|
||||
* sequences of values given equal generators.
|
||||
*/
|
||||
BOOST_RANDOM_DETAIL_INEQUALITY_OPERATOR(lognormal_distribution)
|
||||
|
||||
private:
|
||||
normal_distribution<result_type> _normal;
|
||||
};
|
||||
|
||||
} // namespace random
|
||||
|
||||
/// \cond show_deprecated
|
||||
|
||||
/**
|
||||
* Provided for backwards compatibility. This class is
|
||||
* deprecated. It provides the old behavior of lognormal_distribution with
|
||||
* \f$\displaystyle p(x) = \frac{1}{x \sigma_N \sqrt{2\pi}} e^{\frac{-\left(\log(x)-\mu_N\right)^2}{2\sigma_N^2}}\f$
|
||||
* for x > 0, where \f$\displaystyle \mu_N = \log\left(\frac{\mu^2}{\sqrt{\sigma^2 + \mu^2}}\right)\f$ and
|
||||
* \f$\displaystyle \sigma_N = \sqrt{\log\left(1 + \frac{\sigma^2}{\mu^2}\right)}\f$.
|
||||
*/
|
||||
template<class RealType = double>
|
||||
class lognormal_distribution
|
||||
{
|
||||
public:
|
||||
typedef typename normal_distribution<RealType>::input_type input_type;
|
||||
typedef RealType result_type;
|
||||
|
||||
lognormal_distribution(RealType mean_arg = RealType(1.0),
|
||||
RealType sigma_arg = RealType(1.0))
|
||||
: _mean(mean_arg), _sigma(sigma_arg)
|
||||
{
|
||||
init();
|
||||
}
|
||||
RealType mean() const { return _mean; }
|
||||
RealType sigma() const { return _sigma; }
|
||||
void reset() { _normal.reset(); }
|
||||
template<class Engine>
|
||||
RealType operator()(Engine& eng)
|
||||
{
|
||||
using std::exp;
|
||||
return exp(_normal(eng) * _nsigma + _nmean);
|
||||
}
|
||||
BOOST_RANDOM_DETAIL_OSTREAM_OPERATOR(os, lognormal_distribution, ld)
|
||||
{
|
||||
os << ld._normal << " " << ld._mean << " " << ld._sigma;
|
||||
return os;
|
||||
}
|
||||
BOOST_RANDOM_DETAIL_ISTREAM_OPERATOR(is, lognormal_distribution, ld)
|
||||
{
|
||||
is >> ld._normal >> std::ws >> ld._mean >> std::ws >> ld._sigma;
|
||||
ld.init();
|
||||
return is;
|
||||
}
|
||||
private:
|
||||
/// \cond show_private
|
||||
void init()
|
||||
{
|
||||
using std::log;
|
||||
using std::sqrt;
|
||||
_nmean = log(_mean*_mean/sqrt(_sigma*_sigma + _mean*_mean));
|
||||
_nsigma = sqrt(log(_sigma*_sigma/_mean/_mean+result_type(1)));
|
||||
}
|
||||
RealType _mean;
|
||||
RealType _sigma;
|
||||
RealType _nmean;
|
||||
RealType _nsigma;
|
||||
normal_distribution<RealType> _normal;
|
||||
/// \endcond
|
||||
};
|
||||
|
||||
/// \endcond
|
||||
|
||||
} // namespace boost
|
||||
|
||||
#endif // BOOST_RANDOM_LOGNORMAL_DISTRIBUTION_HPP
|
||||
Reference in New Issue
Block a user