Initial Commit
This commit is contained in:
@@ -0,0 +1,42 @@
|
||||
subroutine spec64(c0,npts2,mode64,jpk,s3,LL,NN)
|
||||
|
||||
parameter (NSPS=3456) !Samples per symbol at 6000 Hz
|
||||
complex c0(0:360000) !Complex spectrum of dd()
|
||||
complex cs(0:NSPS-1) !Complex symbol spectrum
|
||||
real s3(LL,NN) !Synchronized symbol spectra
|
||||
real xbase0(LL),xbase(LL)
|
||||
|
||||
nfft=nsps
|
||||
fac=1.0/nfft
|
||||
do j=1,NN
|
||||
jj=j+7 !Skip first Costas array
|
||||
if(j.ge.33) jj=j+14 !Skip middle Costas array
|
||||
ja=jpk + (jj-1)*nfft
|
||||
jb=ja+nfft-1
|
||||
cs(0:nfft-1)=fac*c0(ja:jb)
|
||||
call four2a(cs,nfft,1,-1,1)
|
||||
do ii=1,LL
|
||||
i=ii-65
|
||||
if(i.lt.0) i=i+nfft
|
||||
s3(ii,j)=real(cs(i))**2 + aimag(cs(i))**2
|
||||
enddo
|
||||
enddo
|
||||
|
||||
df=6000.0/nfft
|
||||
do i=1,LL
|
||||
call pctile(s3(i,1:NN),NN,45,xbase0(i)) !Get baseline for passband shape
|
||||
enddo
|
||||
|
||||
nh=25
|
||||
xbase(1:nh-1)=sum(xbase0(1:nh-1))/(nh-1.0)
|
||||
xbase(LL-nh+1:LL)=sum(xbase0(LL-nh+1:LL))/(nh-1.0)
|
||||
do i=nh,LL-nh
|
||||
xbase(i)=sum(xbase0(i-nh+1:i+nh))/(2*nh+1) !Smoothed passband shape
|
||||
enddo
|
||||
|
||||
do i=1,LL
|
||||
s3(i,1:NN)=s3(i,1:NN)/(xbase(i)+0.001) !Apply frequency equalization
|
||||
enddo
|
||||
|
||||
return
|
||||
end subroutine spec64
|
||||
@@ -0,0 +1,118 @@
|
||||
//---------------------------------------------------------------------------//
|
||||
// Copyright (c) 2013 Kyle Lutz <kyle.r.lutz@gmail.com>
|
||||
//
|
||||
// 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://boostorg.github.com/compute for more information.
|
||||
//---------------------------------------------------------------------------//
|
||||
|
||||
#ifndef BOOST_COMPUTE_DETAIL_IS_CONTIGUOUS_ITERATOR_HPP
|
||||
#define BOOST_COMPUTE_DETAIL_IS_CONTIGUOUS_ITERATOR_HPP
|
||||
|
||||
#include <vector>
|
||||
#include <valarray>
|
||||
|
||||
#include <boost/config.hpp>
|
||||
#include <boost/type_traits.hpp>
|
||||
#include <boost/utility/enable_if.hpp>
|
||||
|
||||
namespace boost {
|
||||
namespace compute {
|
||||
namespace detail {
|
||||
|
||||
// default = false
|
||||
template<class Iterator, class Enable = void>
|
||||
struct _is_contiguous_iterator : public boost::false_type {};
|
||||
|
||||
// std::vector<T>::iterator = true
|
||||
template<class Iterator>
|
||||
struct _is_contiguous_iterator<
|
||||
Iterator,
|
||||
typename boost::enable_if<
|
||||
typename boost::is_same<
|
||||
Iterator,
|
||||
typename std::vector<typename Iterator::value_type>::iterator
|
||||
>::type
|
||||
>::type
|
||||
> : public boost::true_type {};
|
||||
|
||||
// std::vector<T>::const_iterator = true
|
||||
template<class Iterator>
|
||||
struct _is_contiguous_iterator<
|
||||
Iterator,
|
||||
typename boost::enable_if<
|
||||
typename boost::is_same<
|
||||
Iterator,
|
||||
typename std::vector<typename Iterator::value_type>::const_iterator
|
||||
>::type
|
||||
>::type
|
||||
> : public boost::true_type {};
|
||||
|
||||
// std::valarray<T>::iterator = true
|
||||
template<class Iterator>
|
||||
struct _is_contiguous_iterator<
|
||||
Iterator,
|
||||
typename boost::enable_if<
|
||||
typename boost::is_same<
|
||||
Iterator,
|
||||
typename std::valarray<typename Iterator::value_type>::iterator
|
||||
>::type
|
||||
>::type
|
||||
> : public boost::true_type {};
|
||||
|
||||
// std::valarray<T>::const_iterator = true
|
||||
template<class Iterator>
|
||||
struct _is_contiguous_iterator<
|
||||
Iterator,
|
||||
typename boost::enable_if<
|
||||
typename boost::is_same<
|
||||
Iterator,
|
||||
typename std::valarray<typename Iterator::value_type>::const_iterator
|
||||
>::type
|
||||
>::type
|
||||
> : public boost::true_type {};
|
||||
|
||||
// T* = true
|
||||
template<class Iterator>
|
||||
struct _is_contiguous_iterator<
|
||||
Iterator,
|
||||
typename boost::enable_if<
|
||||
boost::is_pointer<Iterator>
|
||||
>::type
|
||||
> : public boost::true_type {};
|
||||
|
||||
// the is_contiguous_iterator meta-function returns true if Iterator points
|
||||
// to a range of contiguous values. examples of contiguous iterators are
|
||||
// std::vector<>::iterator and float*. examples of non-contiguous iterators
|
||||
// are std::set<>::iterator and std::insert_iterator<>.
|
||||
//
|
||||
// the implementation consists of two phases. the first checks that value_type
|
||||
// for the iterator is not void. this must be done as for many containers void
|
||||
// is not a valid value_type (ex. std::vector<void>::iterator is not valid).
|
||||
// after ensuring a non-void value_type, the _is_contiguous_iterator function
|
||||
// is invoked. it has specializations retuning true for all (known) contiguous
|
||||
// iterators types and a default value of false.
|
||||
template<class Iterator, class Enable = void>
|
||||
struct is_contiguous_iterator :
|
||||
public _is_contiguous_iterator<
|
||||
typename boost::remove_cv<Iterator>::type
|
||||
> {};
|
||||
|
||||
// value_type of void = false
|
||||
template<class Iterator>
|
||||
struct is_contiguous_iterator<
|
||||
Iterator,
|
||||
typename boost::enable_if<
|
||||
typename boost::is_void<
|
||||
typename Iterator::value_type
|
||||
>::type
|
||||
>::type
|
||||
> : public boost::false_type {};
|
||||
|
||||
} // end detail namespace
|
||||
} // end compute namespace
|
||||
} // end boost namespace
|
||||
|
||||
#endif // BOOST_COMPUTE_DETAIL_IS_CONTIGUOUS_ITERATOR_HPP
|
||||
@@ -0,0 +1,396 @@
|
||||
// (C) Copyright John Maddock 2007.
|
||||
// Use, modification and distribution are subject to the
|
||||
// Boost Software License, Version 1.0. (See accompanying file
|
||||
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
//
|
||||
// This file is machine generated, do not edit by hand
|
||||
|
||||
// Polynomial evaluation using second order Horners rule
|
||||
#ifndef BOOST_MATH_TOOLS_RAT_EVAL_10_HPP
|
||||
#define BOOST_MATH_TOOLS_RAT_EVAL_10_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)
|
||||
{
|
||||
return static_cast<V>((a[1] * x + a[0]) / (b[1] * x + 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_<3>*) BOOST_MATH_NOEXCEPT(V)
|
||||
{
|
||||
return static_cast<V>(((a[2] * x + a[1]) * x + a[0]) / ((b[2] * x + b[1]) * x + 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_<4>*) BOOST_MATH_NOEXCEPT(V)
|
||||
{
|
||||
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]));
|
||||
}
|
||||
|
||||
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)
|
||||
{
|
||||
V x2 = x * x;
|
||||
V t[4];
|
||||
t[0] = a[4] * x2 + a[2];
|
||||
t[1] = a[3] * x2 + a[1];
|
||||
t[2] = b[4] * x2 + b[2];
|
||||
t[3] = b[3] * x2 + b[1];
|
||||
t[0] *= x2;
|
||||
t[2] *= x2;
|
||||
t[0] += static_cast<V>(a[0]);
|
||||
t[2] += static_cast<V>(b[0]);
|
||||
t[1] *= x;
|
||||
t[3] *= x;
|
||||
return (t[0] + t[1]) / (t[2] + t[3]);
|
||||
}
|
||||
else
|
||||
{
|
||||
V z = 1 / x;
|
||||
V z2 = 1 / (x * x);
|
||||
V t[4];
|
||||
t[0] = a[0] * z2 + a[2];
|
||||
t[1] = a[1] * z2 + a[3];
|
||||
t[2] = b[0] * z2 + b[2];
|
||||
t[3] = b[1] * z2 + b[3];
|
||||
t[0] *= z2;
|
||||
t[2] *= z2;
|
||||
t[0] += static_cast<V>(a[4]);
|
||||
t[2] += static_cast<V>(b[4]);
|
||||
t[1] *= z;
|
||||
t[3] *= z;
|
||||
return (t[0] + t[1]) / (t[2] + t[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_<6>*) BOOST_MATH_NOEXCEPT(V)
|
||||
{
|
||||
if(x <= 1)
|
||||
{
|
||||
V x2 = x * x;
|
||||
V t[4];
|
||||
t[0] = a[5] * x2 + a[3];
|
||||
t[1] = a[4] * x2 + a[2];
|
||||
t[2] = b[5] * x2 + b[3];
|
||||
t[3] = b[4] * x2 + b[2];
|
||||
t[0] *= x2;
|
||||
t[1] *= x2;
|
||||
t[2] *= x2;
|
||||
t[3] *= x2;
|
||||
t[0] += static_cast<V>(a[1]);
|
||||
t[1] += static_cast<V>(a[0]);
|
||||
t[2] += static_cast<V>(b[1]);
|
||||
t[3] += static_cast<V>(b[0]);
|
||||
t[0] *= x;
|
||||
t[2] *= x;
|
||||
return (t[0] + t[1]) / (t[2] + t[3]);
|
||||
}
|
||||
else
|
||||
{
|
||||
V z = 1 / x;
|
||||
V z2 = 1 / (x * x);
|
||||
V t[4];
|
||||
t[0] = a[0] * z2 + a[2];
|
||||
t[1] = a[1] * z2 + a[3];
|
||||
t[2] = b[0] * z2 + b[2];
|
||||
t[3] = b[1] * z2 + b[3];
|
||||
t[0] *= z2;
|
||||
t[1] *= z2;
|
||||
t[2] *= z2;
|
||||
t[3] *= z2;
|
||||
t[0] += static_cast<V>(a[4]);
|
||||
t[1] += static_cast<V>(a[5]);
|
||||
t[2] += static_cast<V>(b[4]);
|
||||
t[3] += static_cast<V>(b[5]);
|
||||
t[0] *= z;
|
||||
t[2] *= z;
|
||||
return (t[0] + t[1]) / (t[2] + t[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_<7>*) BOOST_MATH_NOEXCEPT(V)
|
||||
{
|
||||
if(x <= 1)
|
||||
{
|
||||
V x2 = x * x;
|
||||
V t[4];
|
||||
t[0] = a[6] * x2 + a[4];
|
||||
t[1] = a[5] * x2 + a[3];
|
||||
t[2] = b[6] * x2 + b[4];
|
||||
t[3] = b[5] * x2 + b[3];
|
||||
t[0] *= x2;
|
||||
t[1] *= x2;
|
||||
t[2] *= x2;
|
||||
t[3] *= x2;
|
||||
t[0] += static_cast<V>(a[2]);
|
||||
t[1] += static_cast<V>(a[1]);
|
||||
t[2] += static_cast<V>(b[2]);
|
||||
t[3] += static_cast<V>(b[1]);
|
||||
t[0] *= x2;
|
||||
t[2] *= x2;
|
||||
t[0] += static_cast<V>(a[0]);
|
||||
t[2] += static_cast<V>(b[0]);
|
||||
t[1] *= x;
|
||||
t[3] *= x;
|
||||
return (t[0] + t[1]) / (t[2] + t[3]);
|
||||
}
|
||||
else
|
||||
{
|
||||
V z = 1 / x;
|
||||
V z2 = 1 / (x * x);
|
||||
V t[4];
|
||||
t[0] = a[0] * z2 + a[2];
|
||||
t[1] = a[1] * z2 + a[3];
|
||||
t[2] = b[0] * z2 + b[2];
|
||||
t[3] = b[1] * z2 + b[3];
|
||||
t[0] *= z2;
|
||||
t[1] *= z2;
|
||||
t[2] *= z2;
|
||||
t[3] *= z2;
|
||||
t[0] += static_cast<V>(a[4]);
|
||||
t[1] += static_cast<V>(a[5]);
|
||||
t[2] += static_cast<V>(b[4]);
|
||||
t[3] += static_cast<V>(b[5]);
|
||||
t[0] *= z2;
|
||||
t[2] *= z2;
|
||||
t[0] += static_cast<V>(a[6]);
|
||||
t[2] += static_cast<V>(b[6]);
|
||||
t[1] *= z;
|
||||
t[3] *= z;
|
||||
return (t[0] + t[1]) / (t[2] + t[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_<8>*) BOOST_MATH_NOEXCEPT(V)
|
||||
{
|
||||
if(x <= 1)
|
||||
{
|
||||
V x2 = x * x;
|
||||
V t[4];
|
||||
t[0] = a[7] * x2 + a[5];
|
||||
t[1] = a[6] * x2 + a[4];
|
||||
t[2] = b[7] * x2 + b[5];
|
||||
t[3] = b[6] * x2 + b[4];
|
||||
t[0] *= x2;
|
||||
t[1] *= x2;
|
||||
t[2] *= x2;
|
||||
t[3] *= x2;
|
||||
t[0] += static_cast<V>(a[3]);
|
||||
t[1] += static_cast<V>(a[2]);
|
||||
t[2] += static_cast<V>(b[3]);
|
||||
t[3] += static_cast<V>(b[2]);
|
||||
t[0] *= x2;
|
||||
t[1] *= x2;
|
||||
t[2] *= x2;
|
||||
t[3] *= x2;
|
||||
t[0] += static_cast<V>(a[1]);
|
||||
t[1] += static_cast<V>(a[0]);
|
||||
t[2] += static_cast<V>(b[1]);
|
||||
t[3] += static_cast<V>(b[0]);
|
||||
t[0] *= x;
|
||||
t[2] *= x;
|
||||
return (t[0] + t[1]) / (t[2] + t[3]);
|
||||
}
|
||||
else
|
||||
{
|
||||
V z = 1 / x;
|
||||
V z2 = 1 / (x * x);
|
||||
V t[4];
|
||||
t[0] = a[0] * z2 + a[2];
|
||||
t[1] = a[1] * z2 + a[3];
|
||||
t[2] = b[0] * z2 + b[2];
|
||||
t[3] = b[1] * z2 + b[3];
|
||||
t[0] *= z2;
|
||||
t[1] *= z2;
|
||||
t[2] *= z2;
|
||||
t[3] *= z2;
|
||||
t[0] += static_cast<V>(a[4]);
|
||||
t[1] += static_cast<V>(a[5]);
|
||||
t[2] += static_cast<V>(b[4]);
|
||||
t[3] += static_cast<V>(b[5]);
|
||||
t[0] *= z2;
|
||||
t[1] *= z2;
|
||||
t[2] *= z2;
|
||||
t[3] *= z2;
|
||||
t[0] += static_cast<V>(a[6]);
|
||||
t[1] += static_cast<V>(a[7]);
|
||||
t[2] += static_cast<V>(b[6]);
|
||||
t[3] += static_cast<V>(b[7]);
|
||||
t[0] *= z;
|
||||
t[2] *= z;
|
||||
return (t[0] + t[1]) / (t[2] + t[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_<9>*) BOOST_MATH_NOEXCEPT(V)
|
||||
{
|
||||
if(x <= 1)
|
||||
{
|
||||
V x2 = x * x;
|
||||
V t[4];
|
||||
t[0] = a[8] * x2 + a[6];
|
||||
t[1] = a[7] * x2 + a[5];
|
||||
t[2] = b[8] * x2 + b[6];
|
||||
t[3] = b[7] * x2 + b[5];
|
||||
t[0] *= x2;
|
||||
t[1] *= x2;
|
||||
t[2] *= x2;
|
||||
t[3] *= x2;
|
||||
t[0] += static_cast<V>(a[4]);
|
||||
t[1] += static_cast<V>(a[3]);
|
||||
t[2] += static_cast<V>(b[4]);
|
||||
t[3] += static_cast<V>(b[3]);
|
||||
t[0] *= x2;
|
||||
t[1] *= x2;
|
||||
t[2] *= x2;
|
||||
t[3] *= x2;
|
||||
t[0] += static_cast<V>(a[2]);
|
||||
t[1] += static_cast<V>(a[1]);
|
||||
t[2] += static_cast<V>(b[2]);
|
||||
t[3] += static_cast<V>(b[1]);
|
||||
t[0] *= x2;
|
||||
t[2] *= x2;
|
||||
t[0] += static_cast<V>(a[0]);
|
||||
t[2] += static_cast<V>(b[0]);
|
||||
t[1] *= x;
|
||||
t[3] *= x;
|
||||
return (t[0] + t[1]) / (t[2] + t[3]);
|
||||
}
|
||||
else
|
||||
{
|
||||
V z = 1 / x;
|
||||
V z2 = 1 / (x * x);
|
||||
V t[4];
|
||||
t[0] = a[0] * z2 + a[2];
|
||||
t[1] = a[1] * z2 + a[3];
|
||||
t[2] = b[0] * z2 + b[2];
|
||||
t[3] = b[1] * z2 + b[3];
|
||||
t[0] *= z2;
|
||||
t[1] *= z2;
|
||||
t[2] *= z2;
|
||||
t[3] *= z2;
|
||||
t[0] += static_cast<V>(a[4]);
|
||||
t[1] += static_cast<V>(a[5]);
|
||||
t[2] += static_cast<V>(b[4]);
|
||||
t[3] += static_cast<V>(b[5]);
|
||||
t[0] *= z2;
|
||||
t[1] *= z2;
|
||||
t[2] *= z2;
|
||||
t[3] *= z2;
|
||||
t[0] += static_cast<V>(a[6]);
|
||||
t[1] += static_cast<V>(a[7]);
|
||||
t[2] += static_cast<V>(b[6]);
|
||||
t[3] += static_cast<V>(b[7]);
|
||||
t[0] *= z2;
|
||||
t[2] *= z2;
|
||||
t[0] += static_cast<V>(a[8]);
|
||||
t[2] += static_cast<V>(b[8]);
|
||||
t[1] *= z;
|
||||
t[3] *= z;
|
||||
return (t[0] + t[1]) / (t[2] + t[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_<10>*) BOOST_MATH_NOEXCEPT(V)
|
||||
{
|
||||
if(x <= 1)
|
||||
{
|
||||
V x2 = x * x;
|
||||
V t[4];
|
||||
t[0] = a[9] * x2 + a[7];
|
||||
t[1] = a[8] * x2 + a[6];
|
||||
t[2] = b[9] * x2 + b[7];
|
||||
t[3] = b[8] * x2 + b[6];
|
||||
t[0] *= x2;
|
||||
t[1] *= x2;
|
||||
t[2] *= x2;
|
||||
t[3] *= x2;
|
||||
t[0] += static_cast<V>(a[5]);
|
||||
t[1] += static_cast<V>(a[4]);
|
||||
t[2] += static_cast<V>(b[5]);
|
||||
t[3] += static_cast<V>(b[4]);
|
||||
t[0] *= x2;
|
||||
t[1] *= x2;
|
||||
t[2] *= x2;
|
||||
t[3] *= x2;
|
||||
t[0] += static_cast<V>(a[3]);
|
||||
t[1] += static_cast<V>(a[2]);
|
||||
t[2] += static_cast<V>(b[3]);
|
||||
t[3] += static_cast<V>(b[2]);
|
||||
t[0] *= x2;
|
||||
t[1] *= x2;
|
||||
t[2] *= x2;
|
||||
t[3] *= x2;
|
||||
t[0] += static_cast<V>(a[1]);
|
||||
t[1] += static_cast<V>(a[0]);
|
||||
t[2] += static_cast<V>(b[1]);
|
||||
t[3] += static_cast<V>(b[0]);
|
||||
t[0] *= x;
|
||||
t[2] *= x;
|
||||
return (t[0] + t[1]) / (t[2] + t[3]);
|
||||
}
|
||||
else
|
||||
{
|
||||
V z = 1 / x;
|
||||
V z2 = 1 / (x * x);
|
||||
V t[4];
|
||||
t[0] = a[0] * z2 + a[2];
|
||||
t[1] = a[1] * z2 + a[3];
|
||||
t[2] = b[0] * z2 + b[2];
|
||||
t[3] = b[1] * z2 + b[3];
|
||||
t[0] *= z2;
|
||||
t[1] *= z2;
|
||||
t[2] *= z2;
|
||||
t[3] *= z2;
|
||||
t[0] += static_cast<V>(a[4]);
|
||||
t[1] += static_cast<V>(a[5]);
|
||||
t[2] += static_cast<V>(b[4]);
|
||||
t[3] += static_cast<V>(b[5]);
|
||||
t[0] *= z2;
|
||||
t[1] *= z2;
|
||||
t[2] *= z2;
|
||||
t[3] *= z2;
|
||||
t[0] += static_cast<V>(a[6]);
|
||||
t[1] += static_cast<V>(a[7]);
|
||||
t[2] += static_cast<V>(b[6]);
|
||||
t[3] += static_cast<V>(b[7]);
|
||||
t[0] *= z2;
|
||||
t[1] *= z2;
|
||||
t[2] *= z2;
|
||||
t[3] *= z2;
|
||||
t[0] += static_cast<V>(a[8]);
|
||||
t[1] += static_cast<V>(a[9]);
|
||||
t[2] += static_cast<V>(b[8]);
|
||||
t[3] += static_cast<V>(b[9]);
|
||||
t[0] *= z;
|
||||
t[2] *= z;
|
||||
return (t[0] + t[1]) / (t[2] + t[3]);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}}}} // namespaces
|
||||
|
||||
#endif // include guard
|
||||
|
||||
@@ -0,0 +1,169 @@
|
||||
subroutine msk40decodeframe(c,mycall,hiscall,xsnr,bswl,nhasharray, &
|
||||
recent_calls,nrecent,msgreceived,nsuccess)
|
||||
! use timer_module, only: timer
|
||||
|
||||
parameter (NSPM=240)
|
||||
character*4 rpt(0:15)
|
||||
character*6 mycall,hiscall,mycall0,hiscall0
|
||||
character*22 hashmsg,msgreceived
|
||||
character*12 recent_calls(nrecent)
|
||||
complex cb(42)
|
||||
complex cfac,cca
|
||||
complex c(NSPM)
|
||||
integer*1 cw(32)
|
||||
integer*1 decoded(16)
|
||||
integer s8r(8),hardbits(40)
|
||||
integer nhasharray(nrecent,nrecent)
|
||||
real*8 dt, fs, pi, twopi
|
||||
real cbi(42),cbq(42)
|
||||
real pp(12)
|
||||
real softbits(40)
|
||||
real llr(32)
|
||||
logical first
|
||||
logical*1 bswl
|
||||
data first/.true./
|
||||
data s8r/1,0,1,1,0,0,0,1/
|
||||
data mycall0/'dummy'/,hiscall0/'dummy'/
|
||||
data rpt/"-03 ","+00 ","+03 ","+06 ","+10 ","+13 ","+16 ", &
|
||||
"R-03","R+00","R+03","R+06","R+10","R+13","R+16", &
|
||||
"RRR ","73 "/
|
||||
save first,cb,fs,pi,twopi,dt,s8r,pp,rpt,mycall0,hiscall0,ihash
|
||||
|
||||
if(first) then
|
||||
! define half-sine pulse and raised-cosine edge window
|
||||
pi=4d0*datan(1d0)
|
||||
twopi=8d0*datan(1d0)
|
||||
fs=12000.0
|
||||
dt=1.0/fs
|
||||
|
||||
do i=1,12
|
||||
angle=(i-1)*pi/12.0
|
||||
pp(i)=sin(angle)
|
||||
enddo
|
||||
|
||||
! define the sync word waveforms
|
||||
s8r=2*s8r-1
|
||||
cbq(1:6)=pp(7:12)*s8r(1)
|
||||
cbq(7:18)=pp*s8r(3)
|
||||
cbq(19:30)=pp*s8r(5)
|
||||
cbq(31:42)=pp*s8r(7)
|
||||
cbi(1:12)=pp*s8r(2)
|
||||
cbi(13:24)=pp*s8r(4)
|
||||
cbi(25:36)=pp*s8r(6)
|
||||
cbi(37:42)=pp(1:6)*s8r(8)
|
||||
cb=cmplx(cbi,cbq)
|
||||
first=.false.
|
||||
endif
|
||||
|
||||
if(mycall.ne.mycall0 .or. hiscall.ne.hiscall0) then
|
||||
hashmsg=trim(mycall)//' '//trim(hiscall)
|
||||
if( hashmsg .ne. ' ' .and. hiscall .ne. '' ) then ! protect against blank mycall/hiscall
|
||||
call fmtmsg(hashmsg,iz)
|
||||
call hash(hashmsg,22,ihash)
|
||||
ihash=iand(ihash,4095)
|
||||
else
|
||||
ihash=9999 ! so that it can never match a received hash
|
||||
endif
|
||||
mycall0=mycall
|
||||
hiscall0=hiscall
|
||||
endif
|
||||
|
||||
nsuccess=0
|
||||
msgreceived=' '
|
||||
|
||||
! Estimate carrier phase.
|
||||
cca=sum(c(1:1+41)*conjg(cb))
|
||||
phase0=atan2(imag(cca),real(cca))
|
||||
|
||||
! Remove phase error - want constellation rotated so that sample points lie on I/Q axes
|
||||
cfac=cmplx(cos(phase0),sin(phase0))
|
||||
c=c*conjg(cfac)
|
||||
|
||||
! Matched filter.
|
||||
softbits(1)=sum(imag(c(1:6))*pp(7:12))+sum(imag(c(NSPM-5:NSPM))*pp(1:6))
|
||||
softbits(2)=sum(real(c(1:12))*pp)
|
||||
do i=2,20
|
||||
softbits(2*i-1)=sum(imag(c(1+(i-1)*12-6:1+(i-1)*12+5))*pp)
|
||||
softbits(2*i)=sum(real(c(7+(i-1)*12-6:7+(i-1)*12+5))*pp)
|
||||
enddo
|
||||
|
||||
! Sync word hard error weight is used to reject frames that
|
||||
! are unlikely to decode.
|
||||
hardbits=0
|
||||
do i=1,40
|
||||
if( softbits(i) .ge. 0.0 ) then
|
||||
hardbits(i)=1
|
||||
endif
|
||||
enddo
|
||||
nbadsync1=(8-sum( (2*hardbits(1:8)-1)*s8r ) )/2
|
||||
nbadsync=nbadsync1
|
||||
if( nbadsync .gt. 3 ) then
|
||||
return
|
||||
endif
|
||||
|
||||
! Normalize the softsymbols before submitting to decoder.
|
||||
sav=sum(softbits)/40
|
||||
s2av=sum(softbits*softbits)/40
|
||||
ssig=sqrt(s2av-sav*sav)
|
||||
softbits=softbits/ssig
|
||||
|
||||
sigma=0.75
|
||||
! if(xsnr.lt.0.0) sigma=0.75-0.0875*xsnr
|
||||
if(xsnr.lt.0.0) sigma=0.75-0.11*xsnr
|
||||
llr(1:32)=softbits(9:40)
|
||||
llr=2.0*llr/(sigma*sigma)
|
||||
|
||||
max_iterations=5
|
||||
call bpdecode40(llr,max_iterations,decoded,niterations)
|
||||
|
||||
if( niterations .ge. 0.0 ) then
|
||||
call encode_msk40(decoded,cw)
|
||||
nhammd=0
|
||||
cord=0.0
|
||||
do i=1,32
|
||||
if( cw(i) .ne. hardbits(i+8) ) then
|
||||
nhammd=nhammd+1
|
||||
cord=cord+abs(softbits(i+8))
|
||||
endif
|
||||
enddo
|
||||
|
||||
imsg=0
|
||||
do i=1,16
|
||||
imsg=ishft(imsg,1)+iand(1,decoded(17-i))
|
||||
enddo
|
||||
nrxrpt=iand(imsg,15)
|
||||
nrxhash=(imsg-nrxrpt)/16
|
||||
|
||||
if(nhammd.le.4 .and. cord .lt. 0.65 .and. &
|
||||
nrxhash.eq.ihash .and. nrxrpt.ge.7) then
|
||||
!write(*,*) 'decodeframe 1',nbadsync,nhammd,cord,nrxhash,nrxrpt,ihash,xsnr,sigma
|
||||
nsuccess=1
|
||||
write(msgreceived,'(a1,a,1x,a,a1,1x,a4)') "<",trim(mycall), &
|
||||
trim(hiscall),">",rpt(nrxrpt)
|
||||
return
|
||||
elseif(bswl .and. nhammd.le.4 .and. cord.lt.0.65 .and. nrxrpt.ge.7 ) then
|
||||
do i=1,nrecent
|
||||
do j=i+1,nrecent
|
||||
if( nrxhash .eq. nhasharray(i,j) ) then
|
||||
nsuccess=2
|
||||
write(msgreceived,'(a1,a,1x,a,a1,1x,a4)') "<",trim(recent_calls(i)), &
|
||||
trim(recent_calls(j)),">",rpt(nrxrpt)
|
||||
!write(*,*) 'decodeframe 2',nbadsync,nhammd,cord,nrxhash,nrxrpt,ihash,xsnr,sigma
|
||||
elseif( nrxhash .eq. nhasharray(j,i) ) then
|
||||
nsuccess=2
|
||||
write(msgreceived,'(a1,a,1x,a,a1,1x,a4)') "<",trim(recent_calls(j)), &
|
||||
trim(recent_calls(i)),">",rpt(nrxrpt)
|
||||
!write(*,*) 'decodeframe 3',nbadsync,nhammd,cord,nrxhash,nrxrpt,ihash,xsnr,sigma
|
||||
endif
|
||||
enddo
|
||||
enddo
|
||||
if(nsuccess.eq.0) then
|
||||
nsuccess=3
|
||||
!write(*,*) 'decodeframe 4',bswl,nbadsync,nhammd,cord,nrxhash,nrxrpt,ihash,xsnr,sigma,nsuccess
|
||||
write(msgreceived,'(a1,i4.4,a1,1x,a4)') "<",nrxhash,">",rpt(nrxrpt)
|
||||
endif
|
||||
endif
|
||||
endif
|
||||
|
||||
return
|
||||
end subroutine msk40decodeframe
|
||||
@@ -0,0 +1,72 @@
|
||||
|
||||
#ifndef BOOST_MPL_MAX_ELEMENT_HPP_INCLUDED
|
||||
#define BOOST_MPL_MAX_ELEMENT_HPP_INCLUDED
|
||||
|
||||
// Copyright Aleksey Gurtovoy 2000-2004
|
||||
//
|
||||
// Distributed under the Boost Software License, Version 1.0.
|
||||
// (See accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
//
|
||||
// See http://www.boost.org/libs/mpl for documentation.
|
||||
|
||||
// $Id$
|
||||
// $Date$
|
||||
// $Revision$
|
||||
|
||||
#include <boost/mpl/less.hpp>
|
||||
#include <boost/mpl/iter_fold.hpp>
|
||||
#include <boost/mpl/begin_end.hpp>
|
||||
#include <boost/mpl/if.hpp>
|
||||
#include <boost/mpl/deref.hpp>
|
||||
#include <boost/mpl/apply.hpp>
|
||||
#include <boost/mpl/aux_/common_name_wknd.hpp>
|
||||
#include <boost/mpl/aux_/na_spec.hpp>
|
||||
|
||||
namespace boost { namespace mpl {
|
||||
|
||||
BOOST_MPL_AUX_COMMON_NAME_WKND(max_element)
|
||||
|
||||
namespace aux {
|
||||
|
||||
template< typename Predicate >
|
||||
struct select_max
|
||||
{
|
||||
template< typename OldIterator, typename Iterator >
|
||||
struct apply
|
||||
{
|
||||
typedef typename apply2<
|
||||
Predicate
|
||||
, typename deref<OldIterator>::type
|
||||
, typename deref<Iterator>::type
|
||||
>::type condition_;
|
||||
|
||||
typedef typename if_<
|
||||
condition_
|
||||
, Iterator
|
||||
, OldIterator
|
||||
>::type type;
|
||||
};
|
||||
};
|
||||
|
||||
} // namespace aux
|
||||
|
||||
|
||||
template<
|
||||
typename BOOST_MPL_AUX_NA_PARAM(Sequence)
|
||||
, typename Predicate = less<_,_>
|
||||
>
|
||||
struct max_element
|
||||
: iter_fold<
|
||||
Sequence
|
||||
, typename begin<Sequence>::type
|
||||
, protect< aux::select_max<Predicate> >
|
||||
>
|
||||
{
|
||||
};
|
||||
|
||||
BOOST_MPL_AUX_NA_SPEC(1, max_element)
|
||||
|
||||
}}
|
||||
|
||||
#endif // BOOST_MPL_MAX_ELEMENT_HPP_INCLUDED
|
||||
@@ -0,0 +1,51 @@
|
||||
|
||||
// (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 inclusions
|
||||
|
||||
// Type encoding:
|
||||
//
|
||||
// bit 0: callable builtin
|
||||
// bit 1: non member
|
||||
// bit 2: naked function
|
||||
// bit 3: pointer
|
||||
// bit 4: reference
|
||||
// bit 5: member pointer
|
||||
// bit 6: member function pointer
|
||||
// bit 7: member object pointer
|
||||
|
||||
#define BOOST_FT_type_mask 0x000000ff // 1111 1111
|
||||
#define BOOST_FT_callable_builtin 0x00000001 // 0000 0001
|
||||
#define BOOST_FT_non_member 0x00000002 // 0000 0010
|
||||
#define BOOST_FT_function 0x00000007 // 0000 0111
|
||||
#define BOOST_FT_pointer 0x0000000b // 0000 1011
|
||||
#define BOOST_FT_reference 0x00000013 // 0001 0011
|
||||
#define BOOST_FT_non_member_callable_builtin 0x00000003 // 0000 0011
|
||||
#define BOOST_FT_member_pointer 0x00000020 // 0010 0000
|
||||
#define BOOST_FT_member_function_pointer 0x00000061 // 0110 0001
|
||||
#define BOOST_FT_member_object_pointer 0x000000a3 // 1010 0001
|
||||
#define BOOST_FT_member_object_pointer_flags 0x000002a3
|
||||
|
||||
#define BOOST_FT_variadic 0x00000100
|
||||
#define BOOST_FT_non_variadic 0x00000200
|
||||
#define BOOST_FT_variadic_mask 0x00000300
|
||||
|
||||
#define BOOST_FT_const 0x00000400
|
||||
#define BOOST_FT_volatile 0x00000800
|
||||
|
||||
#define BOOST_FT_default_cc 0x00008000
|
||||
#define BOOST_FT_cc_mask 0x00ff8000
|
||||
|
||||
#define BOOST_FT_kind_mask 0x000000fc
|
||||
|
||||
#define BOOST_FT_flags_mask 0x00000fff
|
||||
#define BOOST_FT_full_mask 0x00ff0fff
|
||||
|
||||
#define BOOST_FT_arity_shift 24
|
||||
#define BOOST_FT_arity_mask 0x7f000000
|
||||
|
||||
@@ -0,0 +1,22 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2001-2011 Joel de Guzman
|
||||
|
||||
Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
This is an auto-generated file. Do not edit!
|
||||
==============================================================================*/
|
||||
|
||||
#if FUSION_MAX_LIST_SIZE <= 10
|
||||
#include <boost/fusion/container/list/detail/cpp03/preprocessed/list_to_cons10.hpp>
|
||||
#elif FUSION_MAX_LIST_SIZE <= 20
|
||||
#include <boost/fusion/container/list/detail/cpp03/preprocessed/list_to_cons20.hpp>
|
||||
#elif FUSION_MAX_LIST_SIZE <= 30
|
||||
#include <boost/fusion/container/list/detail/cpp03/preprocessed/list_to_cons30.hpp>
|
||||
#elif FUSION_MAX_LIST_SIZE <= 40
|
||||
#include <boost/fusion/container/list/detail/cpp03/preprocessed/list_to_cons40.hpp>
|
||||
#elif FUSION_MAX_LIST_SIZE <= 50
|
||||
#include <boost/fusion/container/list/detail/cpp03/preprocessed/list_to_cons50.hpp>
|
||||
#else
|
||||
#error "FUSION_MAX_LIST_SIZE out of bounds for preprocessed headers"
|
||||
#endif
|
||||
@@ -0,0 +1,135 @@
|
||||
|
||||
#ifndef BOOST_MPL_IF_HPP_INCLUDED
|
||||
#define BOOST_MPL_IF_HPP_INCLUDED
|
||||
|
||||
// Copyright Aleksey Gurtovoy 2000-2004
|
||||
//
|
||||
// Distributed under the Boost Software License, Version 1.0.
|
||||
// (See accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
//
|
||||
// See http://www.boost.org/libs/mpl for documentation.
|
||||
|
||||
// $Id$
|
||||
// $Date$
|
||||
// $Revision$
|
||||
|
||||
#include <boost/mpl/aux_/value_wknd.hpp>
|
||||
#include <boost/mpl/aux_/static_cast.hpp>
|
||||
#include <boost/mpl/aux_/na_spec.hpp>
|
||||
#include <boost/mpl/aux_/lambda_support.hpp>
|
||||
#include <boost/mpl/aux_/config/integral.hpp>
|
||||
#include <boost/mpl/aux_/config/ctps.hpp>
|
||||
#include <boost/mpl/aux_/config/workaround.hpp>
|
||||
|
||||
namespace boost { namespace mpl {
|
||||
|
||||
#if !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION)
|
||||
|
||||
template<
|
||||
bool C
|
||||
, typename T1
|
||||
, typename T2
|
||||
>
|
||||
struct if_c
|
||||
{
|
||||
typedef T1 type;
|
||||
};
|
||||
|
||||
template<
|
||||
typename T1
|
||||
, typename T2
|
||||
>
|
||||
struct if_c<false,T1,T2>
|
||||
{
|
||||
typedef T2 type;
|
||||
};
|
||||
|
||||
// agurt, 05/sep/04: nondescriptive parameter names for the sake of DigitalMars
|
||||
// (and possibly MWCW < 8.0); see http://article.gmane.org/gmane.comp.lib.boost.devel/108959
|
||||
template<
|
||||
typename BOOST_MPL_AUX_NA_PARAM(T1)
|
||||
, typename BOOST_MPL_AUX_NA_PARAM(T2)
|
||||
, typename BOOST_MPL_AUX_NA_PARAM(T3)
|
||||
>
|
||||
struct if_
|
||||
{
|
||||
private:
|
||||
// agurt, 02/jan/03: two-step 'type' definition for the sake of aCC
|
||||
typedef if_c<
|
||||
#if defined(BOOST_MPL_CFG_BCC_INTEGRAL_CONSTANTS)
|
||||
BOOST_MPL_AUX_VALUE_WKND(T1)::value
|
||||
#else
|
||||
BOOST_MPL_AUX_STATIC_CAST(bool, BOOST_MPL_AUX_VALUE_WKND(T1)::value)
|
||||
#endif
|
||||
, T2
|
||||
, T3
|
||||
> almost_type_;
|
||||
|
||||
public:
|
||||
typedef typename almost_type_::type type;
|
||||
|
||||
BOOST_MPL_AUX_LAMBDA_SUPPORT(3,if_,(T1,T2,T3))
|
||||
};
|
||||
|
||||
#else
|
||||
|
||||
// no partial class template specialization
|
||||
|
||||
namespace aux {
|
||||
|
||||
template< bool C >
|
||||
struct if_impl
|
||||
{
|
||||
template< typename T1, typename T2 > struct result_
|
||||
{
|
||||
typedef T1 type;
|
||||
};
|
||||
};
|
||||
|
||||
template<>
|
||||
struct if_impl<false>
|
||||
{
|
||||
template< typename T1, typename T2 > struct result_
|
||||
{
|
||||
typedef T2 type;
|
||||
};
|
||||
};
|
||||
|
||||
} // namespace aux
|
||||
|
||||
template<
|
||||
bool C_
|
||||
, typename T1
|
||||
, typename T2
|
||||
>
|
||||
struct if_c
|
||||
{
|
||||
typedef typename aux::if_impl< C_ >
|
||||
::template result_<T1,T2>::type type;
|
||||
};
|
||||
|
||||
// (almost) copy & paste in order to save one more
|
||||
// recursively nested template instantiation to user
|
||||
template<
|
||||
typename BOOST_MPL_AUX_NA_PARAM(C_)
|
||||
, typename BOOST_MPL_AUX_NA_PARAM(T1)
|
||||
, typename BOOST_MPL_AUX_NA_PARAM(T2)
|
||||
>
|
||||
struct if_
|
||||
{
|
||||
enum { msvc_wknd_ = BOOST_MPL_AUX_MSVC_VALUE_WKND(C_)::value };
|
||||
|
||||
typedef typename aux::if_impl< BOOST_MPL_AUX_STATIC_CAST(bool, msvc_wknd_) >
|
||||
::template result_<T1,T2>::type type;
|
||||
|
||||
BOOST_MPL_AUX_LAMBDA_SUPPORT(3,if_,(C_,T1,T2))
|
||||
};
|
||||
|
||||
#endif // BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
|
||||
|
||||
BOOST_MPL_AUX_NA_SPEC(3, if_)
|
||||
|
||||
}}
|
||||
|
||||
#endif // BOOST_MPL_IF_HPP_INCLUDED
|
||||
@@ -0,0 +1,68 @@
|
||||
64
|
||||
16
|
||||
48
|
||||
14
|
||||
5
|
||||
3 1 3 6 1 4 1 1 1 1 2 1 1 1 1 6 6 2 2 1 1 2 2 1 2 6 2 6 1 1 2 1 1 6 3 2 6 2 1 1 6 1 1 2 1 1 1 7 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
|
||||
4 2 4 9 3 6 2 2 3 2 4 2 3 3 3 7 9 6 4 3 2 6 6 2 4 9 6 7 2 2 4 3 3 7 4 4 7 4 3 3 7 2 2 6 3 2 2 8 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
|
||||
6 3 6 10 4 9 4 4 4 4 5 4 4 4 4 8 10 8 5 4 3 7 7 4 6 13 9 9 4 4 5 4 4 8 6 5 8 5 4 4 9 4 4 8 4 3 4 9 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
|
||||
7 4 12 12 6 12 5 5 6 5 6 5 5 6 6 9 11 9 6 5 4 11 9 5 7 0 10 10 5 5 6 6 5 9 8 6 11 6 5 5 11 5 5 9 6 4 5 10 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
|
||||
9 5 16 15 9 15 6 6 7 6 7 6 6 9 7 10 12 11 8 6 5 13 13 6 8 0 11 11 6 6 9 8 6 11 11 8 12 7 6 6 13 6 6 12 10 5 6 11 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
|
||||
10 6 0 16 11 16 8 7 9 8 8 7 7 12 8 11 13 13 9 11 6 14 14 8 9 0 13 12 8 9 11 9 7 12 12 10 13 8 8 7 0 8 7 15 12 6 8 12 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
|
||||
13 8 0 0 13 0 10 8 13 9 10 10 9 13 9 12 14 15 11 13 7 16 16 9 13 0 15 13 10 11 16 11 11 13 16 12 14 9 11 10 0 9 11 0 13 12 9 13 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
|
||||
15 12 0 0 14 0 11 10 15 11 12 11 10 15 11 13 15 0 13 14 12 0 0 12 14 0 0 14 14 13 0 14 13 0 0 15 0 11 12 13 0 10 12 0 15 13 10 14 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
|
||||
0 13 0 0 15 0 12 12 16 12 14 14 14 16 14 14 0 0 15 15 14 0 0 13 0 0 0 15 15 15 0 15 14 0 0 16 0 13 13 14 0 12 14 0 16 14 11 15 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
|
||||
0 15 0 0 16 0 14 14 0 13 15 0 16 0 16 16 0 0 16 16 15 0 0 14 0 0 0 16 0 16 0 16 16 0 0 0 0 14 15 16 0 14 15 0 0 15 12 16 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
|
||||
0 16 0 0 0 0 15 15 0 15 16 0 0 0 0 0 0 0 0 0 16 0 0 15 0 0 0 0 0 0 0 0 0 0 0 0 0 15 16 0 0 15 0 0 0 16 13 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
|
||||
0 0 0 0 0 0 16 0 0 16 0 0 0 0 0 0 0 0 0 0 0 0 0 16 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 16 0 0 0 0 14 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
|
||||
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 15 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
|
||||
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 16 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
|
||||
1 9 49 58 64
|
||||
2 39 50 59 0
|
||||
3 6 51 57 63
|
||||
4 6 52 58 0
|
||||
5 20 53 57 0
|
||||
4 37 48 60 0
|
||||
7 36 49 59 62
|
||||
8 29 55 60 0
|
||||
9 14 55 60 0
|
||||
10 30 56 60 0
|
||||
11 31 48 61 64
|
||||
12 24 48 62 0
|
||||
13 40 57 61 0
|
||||
1 35 48 62 0
|
||||
15 32 55 63 0
|
||||
16 28 56 63 0
|
||||
17 28 55 64 0
|
||||
18 27 56 58 0
|
||||
19 31 56 61 63
|
||||
5 32 56 61 0
|
||||
21 43 51 59 64
|
||||
22 23 57 59 0
|
||||
22 44 48 58 0
|
||||
12 43 58 60 63
|
||||
25 38 53 59 63
|
||||
26 41 55 59 0
|
||||
18 44 59 60 61
|
||||
17 27 50 60 62
|
||||
29 42 57 60 64
|
||||
8 30 48 63 0
|
||||
19 38 55 62 64
|
||||
15 45 48 64 0
|
||||
20 33 55 63 0
|
||||
34 41 56 60 0
|
||||
14 45 57 58 0
|
||||
11 36 55 62 0
|
||||
34 37 57 62 0
|
||||
7 47 57 61 0
|
||||
2 46 56 62 0
|
||||
33 40 58 59 0
|
||||
3 35 56 59 0
|
||||
10 47 58 62 0
|
||||
21 46 55 61 0
|
||||
23 25 52 56 64
|
||||
13 39 48 64 0
|
||||
26 54 57 61 0
|
||||
24 42 58 61 0
|
||||
16 48 54 63 0
|
||||
49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64
|
||||
@@ -0,0 +1,72 @@
|
||||
/*=============================================================================
|
||||
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_PP_IS_ITERATING)
|
||||
#if !defined(BOOST_FUSION_SEQUENCE_DEQUE_DETAIL_DEQUE_KEYED_VALUES_CALL_04122006_2211)
|
||||
#define BOOST_FUSION_SEQUENCE_DEQUE_DETAIL_DEQUE_KEYED_VALUES_CALL_04122006_2211
|
||||
|
||||
#if defined(BOOST_FUSION_HAS_VARIADIC_DEQUE)
|
||||
#error "C++03 only! This file should not have been included"
|
||||
#endif
|
||||
|
||||
#include <boost/preprocessor/iterate.hpp>
|
||||
#include <boost/preprocessor/repetition/enum_shifted_params.hpp>
|
||||
#include <boost/preprocessor/repetition/enum_shifted.hpp>
|
||||
#include <boost/preprocessor/repetition/enum_binary_params.hpp>
|
||||
|
||||
#define FUSION_HASH #
|
||||
#define FUSION_DEQUE_KEYED_VALUES_FORWARD(z, n, _) \
|
||||
BOOST_FUSION_FWD_ELEM(BOOST_PP_CAT(T_, n), BOOST_PP_CAT(t, n))
|
||||
|
||||
#define BOOST_PP_FILENAME_1 \
|
||||
<boost/fusion/container/deque/detail/cpp03/deque_keyed_values_call.hpp>
|
||||
#define BOOST_PP_ITERATION_LIMITS (1, FUSION_MAX_DEQUE_SIZE)
|
||||
#include BOOST_PP_ITERATE()
|
||||
|
||||
#undef FUSION_DEQUE_KEYED_VALUES_FORWARD
|
||||
#undef FUSION_HASH
|
||||
#endif
|
||||
#else
|
||||
|
||||
#define N BOOST_PP_ITERATION()
|
||||
|
||||
BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
|
||||
static type construct(BOOST_PP_ENUM_BINARY_PARAMS(N, typename detail::call_param<T, >::type t))
|
||||
{
|
||||
return type(t0,
|
||||
deque_keyed_values_impl<
|
||||
next_index
|
||||
#if N > 1
|
||||
, BOOST_PP_ENUM_SHIFTED_PARAMS(N, T)
|
||||
#endif
|
||||
>::construct(BOOST_PP_ENUM_SHIFTED_PARAMS(N, t)));
|
||||
}
|
||||
|
||||
#if defined(__WAVE__) && defined(BOOST_FUSION_CREATE_PREPROCESSED_FILES)
|
||||
FUSION_HASH if !defined(BOOST_NO_CXX11_RVALUE_REFERENCES)
|
||||
#endif
|
||||
#if !defined(BOOST_NO_CXX11_RVALUE_REFERENCES) || \
|
||||
(defined(__WAVE__) && defined(BOOST_FUSION_CREATE_PREPROCESSED_FILES))
|
||||
template <BOOST_PP_ENUM_PARAMS(N, typename T_)>
|
||||
BOOST_CXX14_CONSTEXPR BOOST_FUSION_GPU_ENABLED
|
||||
static type forward_(BOOST_PP_ENUM_BINARY_PARAMS(N, T_, && t))
|
||||
{
|
||||
return type(BOOST_FUSION_FWD_ELEM(T_0, t0),
|
||||
deque_keyed_values_impl<
|
||||
next_index
|
||||
#if N > 1
|
||||
, BOOST_PP_ENUM_SHIFTED_PARAMS(N, T_)
|
||||
#endif
|
||||
>::forward_(BOOST_PP_ENUM_SHIFTED(N, FUSION_DEQUE_KEYED_VALUES_FORWARD, _)));
|
||||
}
|
||||
#endif
|
||||
#if defined(__WAVE__) && defined(BOOST_FUSION_CREATE_PREPROCESSED_FILES)
|
||||
FUSION_HASH endif
|
||||
#endif
|
||||
|
||||
#undef N
|
||||
#endif
|
||||
@@ -0,0 +1,15 @@
|
||||
|
||||
// (C) Copyright 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_ALIGNMENT_TRAITS_HPP_INCLUDED
|
||||
#define BOOST_TT_ALIGNMENT_TRAITS_HPP_INCLUDED
|
||||
|
||||
#include <boost/type_traits/alignment_of.hpp>
|
||||
#include <boost/type_traits/type_with_alignment.hpp>
|
||||
|
||||
#endif // BOOST_TT_ALIGNMENT_TRAITS_HPP_INCLUDED
|
||||
@@ -0,0 +1,18 @@
|
||||
/* ALLOC.H - Interface to memory allocation procedure. */
|
||||
|
||||
/* Copyright (c) 1995-2012 by Radford M. Neal.
|
||||
*
|
||||
* Permission is granted for anyone to copy, use, modify, and distribute
|
||||
* these programs and accompanying documents for any purpose, provided
|
||||
* this copyright notice is retained and prominently displayed, and note
|
||||
* is made of any changes made to these programs. These programs and
|
||||
* documents are distributed without any warranty, express or implied.
|
||||
* As the programs were written for research purposes only, they have not
|
||||
* been tested to the degree that would be advisable in any important
|
||||
* application. All use of these programs is entirely at the user's own
|
||||
* risk.
|
||||
*/
|
||||
|
||||
|
||||
void *chk_alloc (unsigned, unsigned); /* Calls 'calloc' and exits with error
|
||||
if it fails */
|
||||
@@ -0,0 +1,302 @@
|
||||
// Copyright (c) 2006 Xiaogang Zhang, 2015 John Maddock
|
||||
// Use, modification and distribution are subject to the
|
||||
// Boost Software License, Version 1.0. (See accompanying file
|
||||
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
//
|
||||
// History:
|
||||
// XZ wrote the original of this file as part of the Google
|
||||
// Summer of Code 2006. JM modified it to fit into the
|
||||
// Boost.Math conceptual framework better, and to correctly
|
||||
// handle the p < 0 case.
|
||||
// Updated 2015 to use Carlson's latest methods.
|
||||
//
|
||||
|
||||
#ifndef BOOST_MATH_ELLINT_RJ_HPP
|
||||
#define BOOST_MATH_ELLINT_RJ_HPP
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#pragma once
|
||||
#endif
|
||||
|
||||
#include <boost/math/special_functions/math_fwd.hpp>
|
||||
#include <boost/math/tools/config.hpp>
|
||||
#include <boost/math/policies/error_handling.hpp>
|
||||
#include <boost/math/special_functions/ellint_rc.hpp>
|
||||
#include <boost/math/special_functions/ellint_rf.hpp>
|
||||
#include <boost/math/special_functions/ellint_rd.hpp>
|
||||
|
||||
// Carlson's elliptic integral of the third kind
|
||||
// R_J(x, y, z, p) = 1.5 * \int_{0}^{\infty} (t+p)^{-1} [(t+x)(t+y)(t+z)]^{-1/2} dt
|
||||
// Carlson, Numerische Mathematik, vol 33, 1 (1979)
|
||||
|
||||
namespace boost { namespace math { namespace detail{
|
||||
|
||||
template <typename T, typename Policy>
|
||||
T ellint_rc1p_imp(T y, const Policy& pol)
|
||||
{
|
||||
using namespace boost::math;
|
||||
// Calculate RC(1, 1 + x)
|
||||
BOOST_MATH_STD_USING
|
||||
|
||||
static const char* function = "boost::math::ellint_rc<%1%>(%1%,%1%)";
|
||||
|
||||
if(y == -1)
|
||||
{
|
||||
return policies::raise_domain_error<T>(function,
|
||||
"Argument y must not be zero but got %1%", y, pol);
|
||||
}
|
||||
|
||||
// for 1 + y < 0, the integral is singular, return Cauchy principal value
|
||||
T result;
|
||||
if(y < -1)
|
||||
{
|
||||
result = sqrt(1 / -y) * detail::ellint_rc_imp(T(-y), T(-1 - y), pol);
|
||||
}
|
||||
else if(y == 0)
|
||||
{
|
||||
result = 1;
|
||||
}
|
||||
else if(y > 0)
|
||||
{
|
||||
result = atan(sqrt(y)) / sqrt(y);
|
||||
}
|
||||
else
|
||||
{
|
||||
if(y > -0.5)
|
||||
{
|
||||
T arg = sqrt(-y);
|
||||
result = (boost::math::log1p(arg) - boost::math::log1p(-arg)) / (2 * sqrt(-y));
|
||||
}
|
||||
else
|
||||
{
|
||||
result = log((1 + sqrt(-y)) / sqrt(1 + y)) / sqrt(-y);
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
template <typename T, typename Policy>
|
||||
T ellint_rj_imp(T x, T y, T z, T p, const Policy& pol)
|
||||
{
|
||||
BOOST_MATH_STD_USING
|
||||
|
||||
static const char* function = "boost::math::ellint_rj<%1%>(%1%,%1%,%1%)";
|
||||
|
||||
if(x < 0)
|
||||
{
|
||||
return policies::raise_domain_error<T>(function,
|
||||
"Argument x must be non-negative, but got x = %1%", x, pol);
|
||||
}
|
||||
if(y < 0)
|
||||
{
|
||||
return policies::raise_domain_error<T>(function,
|
||||
"Argument y must be non-negative, but got y = %1%", y, pol);
|
||||
}
|
||||
if(z < 0)
|
||||
{
|
||||
return policies::raise_domain_error<T>(function,
|
||||
"Argument z must be non-negative, but got z = %1%", z, pol);
|
||||
}
|
||||
if(p == 0)
|
||||
{
|
||||
return policies::raise_domain_error<T>(function,
|
||||
"Argument p must not be zero, but got p = %1%", p, pol);
|
||||
}
|
||||
if(x + y == 0 || y + z == 0 || z + x == 0)
|
||||
{
|
||||
return policies::raise_domain_error<T>(function,
|
||||
"At most one argument can be zero, "
|
||||
"only possible result is %1%.", std::numeric_limits<T>::quiet_NaN(), pol);
|
||||
}
|
||||
|
||||
// for p < 0, the integral is singular, return Cauchy principal value
|
||||
if(p < 0)
|
||||
{
|
||||
//
|
||||
// We must ensure that x < y < z.
|
||||
// Since the integral is symmetrical in x, y and z
|
||||
// we can just permute the values:
|
||||
//
|
||||
if(x > y)
|
||||
std::swap(x, y);
|
||||
if(y > z)
|
||||
std::swap(y, z);
|
||||
if(x > y)
|
||||
std::swap(x, y);
|
||||
|
||||
BOOST_ASSERT(x <= y);
|
||||
BOOST_ASSERT(y <= z);
|
||||
|
||||
T q = -p;
|
||||
p = (z * (x + y + q) - x * y) / (z + q);
|
||||
|
||||
BOOST_ASSERT(p >= 0);
|
||||
|
||||
T value = (p - z) * ellint_rj_imp(x, y, z, p, pol);
|
||||
value -= 3 * ellint_rf_imp(x, y, z, pol);
|
||||
value += 3 * sqrt((x * y * z) / (x * y + p * q)) * ellint_rc_imp(T(x * y + p * q), T(p * q), pol);
|
||||
value /= (z + q);
|
||||
return value;
|
||||
}
|
||||
|
||||
//
|
||||
// Special cases from http://dlmf.nist.gov/19.20#iii
|
||||
//
|
||||
if(x == y)
|
||||
{
|
||||
if(x == z)
|
||||
{
|
||||
if(x == p)
|
||||
{
|
||||
// All values equal:
|
||||
return 1 / (x * sqrt(x));
|
||||
}
|
||||
else
|
||||
{
|
||||
// x = y = z:
|
||||
return 3 * (ellint_rc_imp(x, p, pol) - 1 / sqrt(x)) / (x - p);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// x = y only, permute so y = z:
|
||||
using std::swap;
|
||||
swap(x, z);
|
||||
if(y == p)
|
||||
{
|
||||
return ellint_rd_imp(x, y, y, pol);
|
||||
}
|
||||
else if((std::max)(y, p) / (std::min)(y, p) > 1.2)
|
||||
{
|
||||
return 3 * (ellint_rc_imp(x, y, pol) - ellint_rc_imp(x, p, pol)) / (p - y);
|
||||
}
|
||||
// Otherwise fall through to normal method, special case above will suffer too much cancellation...
|
||||
}
|
||||
}
|
||||
if(y == z)
|
||||
{
|
||||
if(y == p)
|
||||
{
|
||||
// y = z = p:
|
||||
return ellint_rd_imp(x, y, y, pol);
|
||||
}
|
||||
else if((std::max)(y, p) / (std::min)(y, p) > 1.2)
|
||||
{
|
||||
// y = z:
|
||||
return 3 * (ellint_rc_imp(x, y, pol) - ellint_rc_imp(x, p, pol)) / (p - y);
|
||||
}
|
||||
// Otherwise fall through to normal method, special case above will suffer too much cancellation...
|
||||
}
|
||||
if(z == p)
|
||||
{
|
||||
return ellint_rd_imp(x, y, z, pol);
|
||||
}
|
||||
|
||||
T xn = x;
|
||||
T yn = y;
|
||||
T zn = z;
|
||||
T pn = p;
|
||||
T An = (x + y + z + 2 * p) / 5;
|
||||
T A0 = An;
|
||||
T delta = (p - x) * (p - y) * (p - z);
|
||||
T Q = pow(tools::epsilon<T>() / 5, -T(1) / 8) * (std::max)((std::max)(fabs(An - x), fabs(An - y)), (std::max)(fabs(An - z), fabs(An - p)));
|
||||
|
||||
unsigned n;
|
||||
T lambda;
|
||||
T Dn;
|
||||
T En;
|
||||
T rx, ry, rz, rp;
|
||||
T fmn = 1; // 4^-n
|
||||
T RC_sum = 0;
|
||||
|
||||
for(n = 0; n < policies::get_max_series_iterations<Policy>(); ++n)
|
||||
{
|
||||
rx = sqrt(xn);
|
||||
ry = sqrt(yn);
|
||||
rz = sqrt(zn);
|
||||
rp = sqrt(pn);
|
||||
Dn = (rp + rx) * (rp + ry) * (rp + rz);
|
||||
En = delta / Dn;
|
||||
En /= Dn;
|
||||
if((En < -0.5) && (En > -1.5))
|
||||
{
|
||||
//
|
||||
// Occationally En ~ -1, we then have no means of calculating
|
||||
// RC(1, 1+En) without terrible cancellation error, so we
|
||||
// need to get to 1+En directly. By substitution we have
|
||||
//
|
||||
// 1+E_0 = 1 + (p-x)*(p-y)*(p-z)/((sqrt(p) + sqrt(x))*(sqrt(p)+sqrt(y))*(sqrt(p)+sqrt(z)))^2
|
||||
// = 2*sqrt(p)*(p+sqrt(x) * (sqrt(y)+sqrt(z)) + sqrt(y)*sqrt(z)) / ((sqrt(p) + sqrt(x))*(sqrt(p) + sqrt(y)*(sqrt(p)+sqrt(z))))
|
||||
//
|
||||
// And since this is just an application of the duplication formula for RJ, the same
|
||||
// expression works for 1+En if we use x,y,z,p_n etc.
|
||||
// This branch is taken only once or twice at the start of iteration,
|
||||
// after than En reverts to it's usual very small values.
|
||||
//
|
||||
T b = 2 * rp * (pn + rx * (ry + rz) + ry * rz) / Dn;
|
||||
RC_sum += fmn / Dn * detail::ellint_rc_imp(T(1), b, pol);
|
||||
}
|
||||
else
|
||||
{
|
||||
RC_sum += fmn / Dn * ellint_rc1p_imp(En, pol);
|
||||
}
|
||||
lambda = rx * ry + rx * rz + ry * rz;
|
||||
|
||||
// From here on we move to n+1:
|
||||
An = (An + lambda) / 4;
|
||||
fmn /= 4;
|
||||
|
||||
if(fmn * Q < An)
|
||||
break;
|
||||
|
||||
xn = (xn + lambda) / 4;
|
||||
yn = (yn + lambda) / 4;
|
||||
zn = (zn + lambda) / 4;
|
||||
pn = (pn + lambda) / 4;
|
||||
delta /= 64;
|
||||
}
|
||||
|
||||
T X = fmn * (A0 - x) / An;
|
||||
T Y = fmn * (A0 - y) / An;
|
||||
T Z = fmn * (A0 - z) / An;
|
||||
T P = (-X - Y - Z) / 2;
|
||||
T E2 = X * Y + X * Z + Y * Z - 3 * P * P;
|
||||
T E3 = X * Y * Z + 2 * E2 * P + 4 * P * P * P;
|
||||
T E4 = (2 * X * Y * Z + E2 * P + 3 * P * P * P) * P;
|
||||
T E5 = X * Y * Z * P * P;
|
||||
T result = fmn * pow(An, T(-3) / 2) *
|
||||
(1 - 3 * E2 / 14 + E3 / 6 + 9 * E2 * E2 / 88 - 3 * E4 / 22 - 9 * E2 * E3 / 52 + 3 * E5 / 26 - E2 * E2 * E2 / 16
|
||||
+ 3 * E3 * E3 / 40 + 3 * E2 * E4 / 20 + 45 * E2 * E2 * E3 / 272 - 9 * (E3 * E4 + E2 * E5) / 68);
|
||||
|
||||
result += 6 * RC_sum;
|
||||
return result;
|
||||
}
|
||||
|
||||
} // namespace detail
|
||||
|
||||
template <class T1, class T2, class T3, class T4, class Policy>
|
||||
inline typename tools::promote_args<T1, T2, T3, T4>::type
|
||||
ellint_rj(T1 x, T2 y, T3 z, T4 p, const Policy& pol)
|
||||
{
|
||||
typedef typename tools::promote_args<T1, T2, T3, T4>::type result_type;
|
||||
typedef typename policies::evaluation<result_type, Policy>::type value_type;
|
||||
return policies::checked_narrowing_cast<result_type, Policy>(
|
||||
detail::ellint_rj_imp(
|
||||
static_cast<value_type>(x),
|
||||
static_cast<value_type>(y),
|
||||
static_cast<value_type>(z),
|
||||
static_cast<value_type>(p),
|
||||
pol), "boost::math::ellint_rj<%1%>(%1%,%1%,%1%,%1%)");
|
||||
}
|
||||
|
||||
template <class T1, class T2, class T3, class T4>
|
||||
inline typename tools::promote_args<T1, T2, T3, T4>::type
|
||||
ellint_rj(T1 x, T2 y, T3 z, T4 p)
|
||||
{
|
||||
return ellint_rj(x, y, z, p, policies::policy<>());
|
||||
}
|
||||
|
||||
}} // namespaces
|
||||
|
||||
#endif // BOOST_MATH_ELLINT_RJ_HPP
|
||||
|
||||
@@ -0,0 +1,43 @@
|
||||
// filesystem/string_file.hpp --------------------------------------------------------//
|
||||
|
||||
// Copyright Beman Dawes 2015
|
||||
|
||||
// Distributed under the Boost Software License, Version 1.0.
|
||||
// See http://www.boost.org/LICENSE_1_0.txt
|
||||
|
||||
// Library home page: http://www.boost.org/libs/filesystem
|
||||
|
||||
#ifndef BOOST_FILESYSTEM_STRING_FILE_HPP
|
||||
#define BOOST_FILESYSTEM_STRING_FILE_HPP
|
||||
|
||||
#include <string>
|
||||
#include <boost/filesystem/fstream.hpp>
|
||||
#include <boost/filesystem/operations.hpp>
|
||||
|
||||
namespace boost
|
||||
{
|
||||
namespace filesystem
|
||||
{
|
||||
inline
|
||||
void save_string_file(const path& p, const std::string& str)
|
||||
{
|
||||
ofstream file;
|
||||
file.exceptions(std::ofstream::failbit | std::ofstream::badbit);
|
||||
file.open(p, std::ios_base::binary);
|
||||
file.write(str.c_str(), str.size());
|
||||
}
|
||||
|
||||
inline
|
||||
void load_string_file(const path& p, std::string& str)
|
||||
{
|
||||
ifstream file;
|
||||
file.exceptions(std::ifstream::failbit | std::ifstream::badbit);
|
||||
file.open(p, std::ios_base::binary);
|
||||
std::size_t sz = static_cast<std::size_t>(file_size(p));
|
||||
str.resize(sz, '\0');
|
||||
file.read(&str[0], sz);
|
||||
}
|
||||
} // namespace filesystem
|
||||
} // namespace boost
|
||||
|
||||
#endif // include guard
|
||||
@@ -0,0 +1,56 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2001-2011 Joel de Guzman
|
||||
|
||||
Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
==============================================================================*/
|
||||
#if !defined(BOOST_FUSION_END_IMPL_09272006_0721)
|
||||
#define BOOST_FUSION_END_IMPL_09272006_0721
|
||||
|
||||
#include <boost/fusion/support/config.hpp>
|
||||
#include <boost/fusion/adapted/boost_tuple/boost_tuple_iterator.hpp>
|
||||
#include <boost/mpl/if.hpp>
|
||||
#include <boost/type_traits/is_const.hpp>
|
||||
|
||||
namespace boost { namespace tuples
|
||||
{
|
||||
struct null_type;
|
||||
}}
|
||||
|
||||
namespace boost { namespace fusion
|
||||
{
|
||||
struct boost_tuple_tag;
|
||||
|
||||
namespace extension
|
||||
{
|
||||
template <typename Tag>
|
||||
struct end_impl;
|
||||
|
||||
template <>
|
||||
struct end_impl<boost_tuple_tag>
|
||||
{
|
||||
template <typename Sequence>
|
||||
struct apply
|
||||
{
|
||||
typedef
|
||||
boost_tuple_iterator<
|
||||
typename mpl::if_<
|
||||
is_const<Sequence>
|
||||
, tuples::null_type const
|
||||
, tuples::null_type
|
||||
>::type
|
||||
>
|
||||
type;
|
||||
|
||||
BOOST_FUSION_GPU_ENABLED
|
||||
static type
|
||||
call(Sequence& seq)
|
||||
{
|
||||
return type(seq);
|
||||
}
|
||||
};
|
||||
};
|
||||
}
|
||||
}}
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,37 @@
|
||||
// Copyright Neil Groves 2010. Use, modification and
|
||||
// distribution is subject to the Boost Software License, Version
|
||||
// 1.0. (See accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
//
|
||||
//
|
||||
// For more information, see http://www.boost.org/libs/range/
|
||||
//
|
||||
#ifndef BOOST_RANGE_ISTREAM_RANGE_HPP_INCLUDED
|
||||
#define BOOST_RANGE_ISTREAM_RANGE_HPP_INCLUDED
|
||||
|
||||
/*!
|
||||
* \file istream_range.hpp
|
||||
*/
|
||||
|
||||
#include <iterator>
|
||||
#include <iosfwd>
|
||||
#include <boost/config.hpp>
|
||||
#include <boost/range/iterator_range.hpp>
|
||||
|
||||
namespace boost
|
||||
{
|
||||
namespace range
|
||||
{
|
||||
template<class Type, class Elem, class Traits> inline
|
||||
iterator_range<std::istream_iterator<Type, Elem, Traits> >
|
||||
istream_range(std::basic_istream<Elem, Traits>& in)
|
||||
{
|
||||
return iterator_range<std::istream_iterator<Type, Elem, Traits> >(
|
||||
std::istream_iterator<Type, Elem, Traits>(in),
|
||||
std::istream_iterator<Type, Elem, Traits>());
|
||||
}
|
||||
} // namespace range
|
||||
using range::istream_range;
|
||||
} // namespace boost
|
||||
|
||||
#endif // include guard
|
||||
@@ -0,0 +1,34 @@
|
||||
// Copyright David Abrahams 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)
|
||||
#ifndef UNWRAP_WRAPPER_DWA2004723_HPP
|
||||
# define UNWRAP_WRAPPER_DWA2004723_HPP
|
||||
|
||||
# include <boost/python/detail/prefix.hpp>
|
||||
# include <boost/python/detail/is_wrapper.hpp>
|
||||
# include <boost/mpl/eval_if.hpp>
|
||||
# include <boost/mpl/identity.hpp>
|
||||
|
||||
namespace boost { namespace python { namespace detail {
|
||||
|
||||
template <class T>
|
||||
struct unwrap_wrapper_helper
|
||||
{
|
||||
typedef typename T::_wrapper_wrapped_type_ type;
|
||||
};
|
||||
|
||||
template <class T>
|
||||
struct unwrap_wrapper_
|
||||
: mpl::eval_if<is_wrapper<T>,unwrap_wrapper_helper<T>,mpl::identity<T> >
|
||||
{};
|
||||
|
||||
template <class T>
|
||||
typename unwrap_wrapper_<T>::type*
|
||||
unwrap_wrapper(T*)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
}}} // namespace boost::python::detail
|
||||
|
||||
#endif // UNWRAP_WRAPPER_DWA2004723_HPP
|
||||
@@ -0,0 +1,27 @@
|
||||
#ifndef DOUBLE_CLICKABLE_PUSH_BUTTON_HPP_
|
||||
#define DOUBLE_CLICKABLE_PUSH_BUTTON_HPP_
|
||||
|
||||
#include <QPushButton>
|
||||
|
||||
//
|
||||
// DoubleClickablePushButton - QPushButton that emits a mouse double
|
||||
// click signal
|
||||
//
|
||||
// Clients should be aware of the QWidget::mouseDoubleClickEvent()
|
||||
// notes about receipt of mouse press and mouse release events.
|
||||
//
|
||||
class DoubleClickablePushButton
|
||||
: public QPushButton
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
DoubleClickablePushButton (QWidget * = nullptr);
|
||||
|
||||
Q_SIGNAL void doubleClicked ();
|
||||
|
||||
protected:
|
||||
void mouseDoubleClickEvent (QMouseEvent *) override;
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,209 @@
|
||||
// (C) Copyright John Maddock 2001 - 2003.
|
||||
// (C) Copyright Jens Maurer 2001.
|
||||
// (C) Copyright Peter Dimov 2001.
|
||||
// (C) Copyright David Abrahams 2002.
|
||||
// (C) Copyright Guillaume Melquiond 2003.
|
||||
// Use, modification and distribution are subject to the
|
||||
// Boost Software License, Version 1.0. (See accompanying file
|
||||
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
// See http://www.boost.org for most recent version.
|
||||
|
||||
// Dinkumware standard library config:
|
||||
|
||||
#if !defined(_YVALS) && !defined(_CPPLIB_VER)
|
||||
#include <boost/config/no_tr1/utility.hpp>
|
||||
#if !defined(_YVALS) && !defined(_CPPLIB_VER)
|
||||
#error This is not the Dinkumware lib!
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
||||
#if defined(_CPPLIB_VER) && (_CPPLIB_VER >= 306)
|
||||
// full dinkumware 3.06 and above
|
||||
// fully conforming provided the compiler supports it:
|
||||
# if !(defined(_GLOBAL_USING) && (_GLOBAL_USING+0 > 0)) && !defined(__BORLANDC__) && !defined(_STD) && !(defined(__ICC) && (__ICC >= 700)) // can be defined in yvals.h
|
||||
# define BOOST_NO_STDC_NAMESPACE
|
||||
# endif
|
||||
# if !(defined(_HAS_MEMBER_TEMPLATES_REBIND) && (_HAS_MEMBER_TEMPLATES_REBIND+0 > 0)) && !(defined(_MSC_VER) && (_MSC_VER > 1300)) && defined(BOOST_MSVC)
|
||||
# define BOOST_NO_STD_ALLOCATOR
|
||||
# endif
|
||||
# define BOOST_HAS_PARTIAL_STD_ALLOCATOR
|
||||
# if defined(BOOST_MSVC) && (BOOST_MSVC < 1300)
|
||||
// if this lib version is set up for vc6 then there is no std::use_facet:
|
||||
# define BOOST_NO_STD_USE_FACET
|
||||
# define BOOST_HAS_TWO_ARG_USE_FACET
|
||||
// C lib functions aren't in namespace std either:
|
||||
# define BOOST_NO_STDC_NAMESPACE
|
||||
// and nor is <exception>
|
||||
# define BOOST_NO_EXCEPTION_STD_NAMESPACE
|
||||
# endif
|
||||
// There's no numeric_limits<long long> support unless _LONGLONG is defined:
|
||||
# if !defined(_LONGLONG) && (_CPPLIB_VER <= 310)
|
||||
# define BOOST_NO_MS_INT64_NUMERIC_LIMITS
|
||||
# endif
|
||||
// 3.06 appears to have (non-sgi versions of) <hash_set> & <hash_map>,
|
||||
// and no <slist> at all
|
||||
#else
|
||||
# define BOOST_MSVC_STD_ITERATOR 1
|
||||
# define BOOST_NO_STD_ITERATOR
|
||||
# define BOOST_NO_TEMPLATED_ITERATOR_CONSTRUCTORS
|
||||
# define BOOST_NO_STD_ALLOCATOR
|
||||
# define BOOST_NO_STDC_NAMESPACE
|
||||
# define BOOST_NO_STD_USE_FACET
|
||||
# define BOOST_NO_STD_OUTPUT_ITERATOR_ASSIGN
|
||||
# define BOOST_HAS_MACRO_USE_FACET
|
||||
# ifndef _CPPLIB_VER
|
||||
// Updated Dinkum library defines this, and provides
|
||||
// its own min and max definitions, as does MTA version.
|
||||
# ifndef __MTA__
|
||||
# define BOOST_NO_STD_MIN_MAX
|
||||
# endif
|
||||
# define BOOST_NO_MS_INT64_NUMERIC_LIMITS
|
||||
# endif
|
||||
#endif
|
||||
|
||||
//
|
||||
// std extension namespace is stdext for vc7.1 and later,
|
||||
// the same applies to other compilers that sit on top
|
||||
// of vc7.1 (Intel and Comeau):
|
||||
//
|
||||
#if defined(_MSC_VER) && (_MSC_VER >= 1310) && !defined(__BORLANDC__)
|
||||
# define BOOST_STD_EXTENSION_NAMESPACE stdext
|
||||
#endif
|
||||
|
||||
|
||||
#if (defined(_MSC_VER) && (_MSC_VER <= 1300) && !defined(__BORLANDC__)) || !defined(_CPPLIB_VER) || (_CPPLIB_VER < 306)
|
||||
// if we're using a dinkum lib that's
|
||||
// been configured for VC6/7 then there is
|
||||
// no iterator traits (true even for icl)
|
||||
# define BOOST_NO_STD_ITERATOR_TRAITS
|
||||
#endif
|
||||
|
||||
#if defined(__ICL) && (__ICL < 800) && defined(_CPPLIB_VER) && (_CPPLIB_VER <= 310)
|
||||
// Intel C++ chokes over any non-trivial use of <locale>
|
||||
// this may be an overly restrictive define, but regex fails without it:
|
||||
# define BOOST_NO_STD_LOCALE
|
||||
#endif
|
||||
|
||||
// Fix for VC++ 8.0 on up ( I do not have a previous version to test )
|
||||
// or clang-cl. If exceptions are off you must manually include the
|
||||
// <exception> header before including the <typeinfo> header. Admittedly
|
||||
// trying to use Boost libraries or the standard C++ libraries without
|
||||
// exception support is not suggested but currently clang-cl ( v 3.4 )
|
||||
// does not support exceptions and must be compiled with exceptions off.
|
||||
#if !_HAS_EXCEPTIONS && ((defined(BOOST_MSVC) && BOOST_MSVC >= 1400) || (defined(__clang__) && defined(_MSC_VER)))
|
||||
#include <exception>
|
||||
#endif
|
||||
#include <typeinfo>
|
||||
#if ( (!_HAS_EXCEPTIONS && !defined(__ghs__)) || (!_HAS_NAMESPACE && defined(__ghs__)) ) && !defined(__TI_COMPILER_VERSION__) && !defined(__VISUALDSPVERSION__)
|
||||
# define BOOST_NO_STD_TYPEINFO
|
||||
#endif
|
||||
|
||||
// C++0x headers implemented in 520 (as shipped by Microsoft)
|
||||
//
|
||||
#if !defined(_CPPLIB_VER) || _CPPLIB_VER < 520
|
||||
# define BOOST_NO_CXX11_HDR_ARRAY
|
||||
# define BOOST_NO_CXX11_HDR_CODECVT
|
||||
# define BOOST_NO_CXX11_HDR_FORWARD_LIST
|
||||
# define BOOST_NO_CXX11_HDR_INITIALIZER_LIST
|
||||
# define BOOST_NO_CXX11_HDR_RANDOM
|
||||
# define BOOST_NO_CXX11_HDR_REGEX
|
||||
# define BOOST_NO_CXX11_HDR_SYSTEM_ERROR
|
||||
# define BOOST_NO_CXX11_HDR_UNORDERED_MAP
|
||||
# define BOOST_NO_CXX11_HDR_UNORDERED_SET
|
||||
# define BOOST_NO_CXX11_HDR_TUPLE
|
||||
# define BOOST_NO_CXX11_HDR_TYPEINDEX
|
||||
# define BOOST_NO_CXX11_HDR_FUNCTIONAL
|
||||
# define BOOST_NO_CXX11_NUMERIC_LIMITS
|
||||
# define BOOST_NO_CXX11_SMART_PTR
|
||||
#endif
|
||||
|
||||
#if ((!defined(_HAS_TR1_IMPORTS) || (_HAS_TR1_IMPORTS+0 == 0)) && !defined(BOOST_NO_CXX11_HDR_TUPLE)) \
|
||||
&& (!defined(_CPPLIB_VER) || _CPPLIB_VER < 610)
|
||||
# define BOOST_NO_CXX11_HDR_TUPLE
|
||||
#endif
|
||||
|
||||
// C++0x headers implemented in 540 (as shipped by Microsoft)
|
||||
//
|
||||
#if !defined(_CPPLIB_VER) || _CPPLIB_VER < 540
|
||||
# define BOOST_NO_CXX11_HDR_TYPE_TRAITS
|
||||
# define BOOST_NO_CXX11_HDR_CHRONO
|
||||
# define BOOST_NO_CXX11_HDR_CONDITION_VARIABLE
|
||||
# define BOOST_NO_CXX11_HDR_FUTURE
|
||||
# define BOOST_NO_CXX11_HDR_MUTEX
|
||||
# define BOOST_NO_CXX11_HDR_RATIO
|
||||
# define BOOST_NO_CXX11_HDR_THREAD
|
||||
# define BOOST_NO_CXX11_ATOMIC_SMART_PTR
|
||||
#endif
|
||||
|
||||
// C++0x headers implemented in 610 (as shipped by Microsoft)
|
||||
//
|
||||
#if !defined(_CPPLIB_VER) || _CPPLIB_VER < 610
|
||||
# define BOOST_NO_CXX11_HDR_INITIALIZER_LIST
|
||||
# define BOOST_NO_CXX11_HDR_ATOMIC
|
||||
# define BOOST_NO_CXX11_ALLOCATOR
|
||||
// 540 has std::align but it is not a conforming implementation
|
||||
# define BOOST_NO_CXX11_STD_ALIGN
|
||||
#endif
|
||||
|
||||
#if defined(__has_include)
|
||||
#if !__has_include(<shared_mutex>)
|
||||
# define BOOST_NO_CXX14_HDR_SHARED_MUTEX
|
||||
#elif (__cplusplus < 201402) && !defined(_MSC_VER)
|
||||
# define BOOST_NO_CXX14_HDR_SHARED_MUTEX
|
||||
#endif
|
||||
#elif !defined(_CPPLIB_VER) || (_CPPLIB_VER < 650)
|
||||
# define BOOST_NO_CXX14_HDR_SHARED_MUTEX
|
||||
#endif
|
||||
|
||||
// C++14 features
|
||||
#if !defined(_CPPLIB_VER) || (_CPPLIB_VER < 650)
|
||||
# define BOOST_NO_CXX14_STD_EXCHANGE
|
||||
#endif
|
||||
|
||||
// C++17 features
|
||||
# define BOOST_NO_CXX17_STD_APPLY
|
||||
#if !defined(_CPPLIB_VER) || (_CPPLIB_VER < 650)
|
||||
# define BOOST_NO_CXX17_STD_INVOKE
|
||||
#endif
|
||||
|
||||
#if defined(BOOST_INTEL) && (BOOST_INTEL <= 1400)
|
||||
// Intel's compiler can't handle this header yet:
|
||||
# define BOOST_NO_CXX11_HDR_ATOMIC
|
||||
#endif
|
||||
|
||||
|
||||
// 520..610 have std::addressof, but it doesn't support functions
|
||||
//
|
||||
#if !defined(_CPPLIB_VER) || _CPPLIB_VER < 650
|
||||
# define BOOST_NO_CXX11_ADDRESSOF
|
||||
#endif
|
||||
|
||||
// Bug specific to VC14,
|
||||
// See https://connect.microsoft.com/VisualStudio/feedback/details/1348277/link-error-when-using-std-codecvt-utf8-utf16-char16-t
|
||||
// and discussion here: http://blogs.msdn.com/b/vcblog/archive/2014/11/12/visual-studio-2015-preview-now-available.aspx?PageIndex=2
|
||||
#if defined(_CPPLIB_VER) && (_CPPLIB_VER == 650)
|
||||
# define BOOST_NO_CXX11_HDR_CODECVT
|
||||
#endif
|
||||
|
||||
#if defined(_CPPLIB_VER) && (_CPPLIB_VER >= 650)
|
||||
// If _HAS_AUTO_PTR_ETC is defined to 0, std::auto_ptr is not available.
|
||||
// See https://www.visualstudio.com/en-us/news/vs2015-vs.aspx#C++
|
||||
// and http://blogs.msdn.com/b/vcblog/archive/2015/06/19/c-11-14-17-features-in-vs-2015-rtm.aspx
|
||||
# if defined(_HAS_AUTO_PTR_ETC) && (_HAS_AUTO_PTR_ETC == 0)
|
||||
# define BOOST_NO_AUTO_PTR
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#ifdef _CPPLIB_VER
|
||||
# define BOOST_DINKUMWARE_STDLIB _CPPLIB_VER
|
||||
#else
|
||||
# define BOOST_DINKUMWARE_STDLIB 1
|
||||
#endif
|
||||
|
||||
#ifdef _CPPLIB_VER
|
||||
# define BOOST_STDLIB "Dinkumware standard library version " BOOST_STRINGIZE(_CPPLIB_VER)
|
||||
#else
|
||||
# define BOOST_STDLIB "Dinkumware standard library version 1.x"
|
||||
#endif
|
||||
@@ -0,0 +1,189 @@
|
||||
/*=============================================================================
|
||||
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_DEQUE_26112006_1649)
|
||||
#define BOOST_FUSION_DEQUE_26112006_1649
|
||||
|
||||
# include <boost/fusion/container/deque/deque_fwd.hpp>
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// Without variadics, we will use the PP version
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
#if !defined(BOOST_FUSION_HAS_VARIADIC_DEQUE)
|
||||
# include <boost/fusion/container/deque/detail/cpp03/deque.hpp>
|
||||
#else
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// C++11 interface
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
#include <boost/fusion/support/sequence_base.hpp>
|
||||
#include <boost/fusion/support/void.hpp>
|
||||
#include <boost/fusion/support/detail/enabler.hpp>
|
||||
#include <boost/fusion/support/detail/access.hpp>
|
||||
#include <boost/fusion/support/is_sequence.hpp>
|
||||
#include <boost/fusion/container/deque/detail/keyed_element.hpp>
|
||||
#include <boost/fusion/container/deque/detail/deque_keyed_values.hpp>
|
||||
#include <boost/fusion/container/deque/deque_fwd.hpp>
|
||||
#include <boost/fusion/container/deque/detail/value_at_impl.hpp>
|
||||
#include <boost/fusion/container/deque/detail/at_impl.hpp>
|
||||
#include <boost/fusion/container/deque/detail/begin_impl.hpp>
|
||||
#include <boost/fusion/container/deque/detail/end_impl.hpp>
|
||||
#include <boost/fusion/container/deque/detail/is_sequence_impl.hpp>
|
||||
#include <boost/fusion/sequence/intrinsic/begin.hpp>
|
||||
#include <boost/fusion/sequence/intrinsic/empty.hpp>
|
||||
|
||||
#include <boost/mpl/int.hpp>
|
||||
#include <boost/mpl/and.hpp>
|
||||
#include <boost/utility/enable_if.hpp>
|
||||
#include <boost/type_traits/is_convertible.hpp>
|
||||
|
||||
namespace boost { namespace fusion
|
||||
{
|
||||
struct deque_tag;
|
||||
|
||||
template <typename ...Elements>
|
||||
struct deque : detail::nil_keyed_element
|
||||
{
|
||||
typedef deque_tag fusion_tag;
|
||||
typedef bidirectional_traversal_tag category;
|
||||
typedef mpl::int_<0> size;
|
||||
typedef mpl::int_<0> next_up;
|
||||
typedef mpl::int_<-1> next_down;
|
||||
typedef mpl::false_ is_view;
|
||||
|
||||
template <typename Sequence>
|
||||
BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
|
||||
deque(Sequence const&,
|
||||
typename enable_if<
|
||||
mpl::and_<
|
||||
traits::is_sequence<Sequence>
|
||||
, result_of::empty<Sequence>>, detail::enabler_>::type = detail::enabler) BOOST_NOEXCEPT
|
||||
{}
|
||||
|
||||
BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
|
||||
deque() BOOST_NOEXCEPT {}
|
||||
};
|
||||
|
||||
template <typename Head, typename ...Tail>
|
||||
struct deque<Head, Tail...>
|
||||
: detail::deque_keyed_values<Head, Tail...>::type
|
||||
, sequence_base<deque<Head, Tail...>>
|
||||
{
|
||||
typedef deque_tag fusion_tag;
|
||||
typedef bidirectional_traversal_tag category;
|
||||
typedef typename detail::deque_keyed_values<Head, Tail...>::type base;
|
||||
typedef mpl::int_<(sizeof ...(Tail) + 1)> size;
|
||||
typedef mpl::int_<size::value> next_up;
|
||||
typedef mpl::int_<-1> next_down;
|
||||
typedef mpl::false_ is_view;
|
||||
|
||||
BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
|
||||
deque()
|
||||
{}
|
||||
|
||||
template <typename Head_, typename ...Tail_, typename =
|
||||
typename enable_if<is_convertible<Head_, Head> >::type
|
||||
>
|
||||
BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
|
||||
deque(deque<Head_, Tail_...> const& seq)
|
||||
: base(seq)
|
||||
{}
|
||||
|
||||
template <typename Head_, typename ...Tail_, typename =
|
||||
typename enable_if<is_convertible<Head_, Head> >::type
|
||||
>
|
||||
BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
|
||||
deque(deque<Head_, Tail_...>& seq)
|
||||
: base(seq)
|
||||
{}
|
||||
|
||||
#if !defined(BOOST_NO_CXX11_RVALUE_REFERENCES)
|
||||
template <typename Head_, typename ...Tail_, typename =
|
||||
typename enable_if<is_convertible<Head_, Head> >::type
|
||||
>
|
||||
BOOST_CXX14_CONSTEXPR BOOST_FUSION_GPU_ENABLED
|
||||
deque(deque<Head_, Tail_...>&& seq)
|
||||
: base(std::forward<deque<Head_, Tail_...>>(seq))
|
||||
{}
|
||||
#endif
|
||||
|
||||
BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
|
||||
deque(deque const& seq)
|
||||
: base(seq)
|
||||
{}
|
||||
|
||||
#if !defined(BOOST_NO_CXX11_RVALUE_REFERENCES)
|
||||
BOOST_CXX14_CONSTEXPR BOOST_FUSION_GPU_ENABLED
|
||||
deque(deque&& seq)
|
||||
: base(std::forward<deque>(seq))
|
||||
{}
|
||||
#endif
|
||||
|
||||
BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
|
||||
explicit deque(typename detail::call_param<Head>::type head
|
||||
, typename detail::call_param<Tail>::type... tail)
|
||||
: base(detail::deque_keyed_values<Head, Tail...>::construct(head, tail...))
|
||||
{}
|
||||
|
||||
#if !defined(BOOST_NO_CXX11_RVALUE_REFERENCES)
|
||||
template <typename Head_, typename ...Tail_, typename =
|
||||
typename enable_if<is_convertible<Head_, Head> >::type
|
||||
>
|
||||
BOOST_CXX14_CONSTEXPR BOOST_FUSION_GPU_ENABLED
|
||||
explicit deque(Head_&& head, Tail_&&... tail)
|
||||
: base(detail::deque_keyed_values<Head, Tail...>
|
||||
::forward_(BOOST_FUSION_FWD_ELEM(Head_, head), BOOST_FUSION_FWD_ELEM(Tail_, tail)...))
|
||||
{}
|
||||
#else
|
||||
template <typename Head_, typename ...Tail_, typename =
|
||||
typename enable_if<is_convertible<Head_, Head> >::type
|
||||
>
|
||||
BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
|
||||
explicit deque(Head_ const& head, Tail_ const&... tail)
|
||||
: base(detail::deque_keyed_values<Head_, Tail_...>::construct(head, tail...))
|
||||
{}
|
||||
#endif
|
||||
|
||||
template <typename Sequence>
|
||||
BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
|
||||
explicit deque(Sequence const& seq
|
||||
, typename disable_if<is_convertible<Sequence, Head>, detail::enabler_>::type = detail::enabler
|
||||
, typename enable_if<traits::is_sequence<Sequence>, detail::enabler_>::type = detail::enabler)
|
||||
: base(base::from_iterator(fusion::begin(seq)))
|
||||
{}
|
||||
|
||||
template <typename ...Elements>
|
||||
BOOST_CXX14_CONSTEXPR BOOST_FUSION_GPU_ENABLED
|
||||
deque& operator=(deque<Elements...> const& rhs)
|
||||
{
|
||||
base::operator=(rhs);
|
||||
return *this;
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
BOOST_CXX14_CONSTEXPR BOOST_FUSION_GPU_ENABLED
|
||||
deque& operator=(T const& rhs)
|
||||
{
|
||||
base::operator=(rhs);
|
||||
return *this;
|
||||
}
|
||||
|
||||
#if !defined(BOOST_NO_CXX11_RVALUE_REFERENCES)
|
||||
template <typename T>
|
||||
BOOST_CXX14_CONSTEXPR BOOST_FUSION_GPU_ENABLED
|
||||
deque& operator=(T&& rhs)
|
||||
{
|
||||
base::operator=(BOOST_FUSION_FWD_ELEM(T, rhs));
|
||||
return *this;
|
||||
}
|
||||
#endif
|
||||
|
||||
};
|
||||
}}
|
||||
|
||||
#endif
|
||||
#endif
|
||||
@@ -0,0 +1,223 @@
|
||||
/*=============================================================================
|
||||
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
|
||||
{
|
||||
BOOST_FUSION_BARRIER_BEGIN
|
||||
template <bool is_assoc>
|
||||
struct as_map<1, is_assoc>
|
||||
{
|
||||
template <typename I0>
|
||||
struct apply
|
||||
{
|
||||
|
||||
typedef pair_from<I0, is_assoc> D0; typedef typename D0::type T0;
|
||||
typedef map<T0> type;
|
||||
};
|
||||
template <typename Iterator>
|
||||
BOOST_CXX14_CONSTEXPR BOOST_FUSION_GPU_ENABLED
|
||||
static typename apply<Iterator>::type
|
||||
call(Iterator const& i0)
|
||||
{
|
||||
typedef apply<Iterator> gen;
|
||||
typedef typename gen::type result;
|
||||
|
||||
return result(gen::D0::call(i0));
|
||||
}
|
||||
};
|
||||
template <bool is_assoc>
|
||||
struct as_map<2, is_assoc>
|
||||
{
|
||||
template <typename I0>
|
||||
struct apply
|
||||
{
|
||||
typedef typename fusion::result_of::next<I0>::type I1;
|
||||
typedef pair_from<I0, is_assoc> D0; typedef typename D0::type T0; typedef pair_from<I1, is_assoc> D1; typedef typename D1::type T1;
|
||||
typedef map<T0 , T1> type;
|
||||
};
|
||||
template <typename Iterator>
|
||||
BOOST_CXX14_CONSTEXPR BOOST_FUSION_GPU_ENABLED
|
||||
static typename apply<Iterator>::type
|
||||
call(Iterator const& i0)
|
||||
{
|
||||
typedef apply<Iterator> gen;
|
||||
typedef typename gen::type result;
|
||||
typename gen::I1 i1 = fusion::next(i0);
|
||||
return result(gen::D0::call(i0) , gen::D1::call(i1));
|
||||
}
|
||||
};
|
||||
template <bool is_assoc>
|
||||
struct as_map<3, is_assoc>
|
||||
{
|
||||
template <typename I0>
|
||||
struct apply
|
||||
{
|
||||
typedef typename fusion::result_of::next<I0>::type I1; typedef typename fusion::result_of::next<I1>::type I2;
|
||||
typedef pair_from<I0, is_assoc> D0; typedef typename D0::type T0; typedef pair_from<I1, is_assoc> D1; typedef typename D1::type T1; typedef pair_from<I2, is_assoc> D2; typedef typename D2::type T2;
|
||||
typedef map<T0 , T1 , T2> type;
|
||||
};
|
||||
template <typename Iterator>
|
||||
BOOST_CXX14_CONSTEXPR BOOST_FUSION_GPU_ENABLED
|
||||
static typename apply<Iterator>::type
|
||||
call(Iterator const& i0)
|
||||
{
|
||||
typedef apply<Iterator> gen;
|
||||
typedef typename gen::type result;
|
||||
typename gen::I1 i1 = fusion::next(i0); typename gen::I2 i2 = fusion::next(i1);
|
||||
return result(gen::D0::call(i0) , gen::D1::call(i1) , gen::D2::call(i2));
|
||||
}
|
||||
};
|
||||
template <bool is_assoc>
|
||||
struct as_map<4, is_assoc>
|
||||
{
|
||||
template <typename I0>
|
||||
struct apply
|
||||
{
|
||||
typedef typename fusion::result_of::next<I0>::type I1; typedef typename fusion::result_of::next<I1>::type I2; typedef typename fusion::result_of::next<I2>::type I3;
|
||||
typedef pair_from<I0, is_assoc> D0; typedef typename D0::type T0; typedef pair_from<I1, is_assoc> D1; typedef typename D1::type T1; typedef pair_from<I2, is_assoc> D2; typedef typename D2::type T2; typedef pair_from<I3, is_assoc> D3; typedef typename D3::type T3;
|
||||
typedef map<T0 , T1 , T2 , T3> type;
|
||||
};
|
||||
template <typename Iterator>
|
||||
BOOST_CXX14_CONSTEXPR BOOST_FUSION_GPU_ENABLED
|
||||
static typename apply<Iterator>::type
|
||||
call(Iterator const& i0)
|
||||
{
|
||||
typedef apply<Iterator> gen;
|
||||
typedef typename gen::type result;
|
||||
typename gen::I1 i1 = fusion::next(i0); typename gen::I2 i2 = fusion::next(i1); typename gen::I3 i3 = fusion::next(i2);
|
||||
return result(gen::D0::call(i0) , gen::D1::call(i1) , gen::D2::call(i2) , gen::D3::call(i3));
|
||||
}
|
||||
};
|
||||
template <bool is_assoc>
|
||||
struct as_map<5, is_assoc>
|
||||
{
|
||||
template <typename I0>
|
||||
struct apply
|
||||
{
|
||||
typedef typename fusion::result_of::next<I0>::type I1; typedef typename fusion::result_of::next<I1>::type I2; typedef typename fusion::result_of::next<I2>::type I3; typedef typename fusion::result_of::next<I3>::type I4;
|
||||
typedef pair_from<I0, is_assoc> D0; typedef typename D0::type T0; typedef pair_from<I1, is_assoc> D1; typedef typename D1::type T1; typedef pair_from<I2, is_assoc> D2; typedef typename D2::type T2; typedef pair_from<I3, is_assoc> D3; typedef typename D3::type T3; typedef pair_from<I4, is_assoc> D4; typedef typename D4::type T4;
|
||||
typedef map<T0 , T1 , T2 , T3 , T4> type;
|
||||
};
|
||||
template <typename Iterator>
|
||||
BOOST_CXX14_CONSTEXPR BOOST_FUSION_GPU_ENABLED
|
||||
static typename apply<Iterator>::type
|
||||
call(Iterator const& i0)
|
||||
{
|
||||
typedef apply<Iterator> gen;
|
||||
typedef typename gen::type result;
|
||||
typename gen::I1 i1 = fusion::next(i0); typename gen::I2 i2 = fusion::next(i1); typename gen::I3 i3 = fusion::next(i2); typename gen::I4 i4 = fusion::next(i3);
|
||||
return result(gen::D0::call(i0) , gen::D1::call(i1) , gen::D2::call(i2) , gen::D3::call(i3) , gen::D4::call(i4));
|
||||
}
|
||||
};
|
||||
template <bool is_assoc>
|
||||
struct as_map<6, is_assoc>
|
||||
{
|
||||
template <typename I0>
|
||||
struct apply
|
||||
{
|
||||
typedef typename fusion::result_of::next<I0>::type I1; typedef typename fusion::result_of::next<I1>::type I2; typedef typename fusion::result_of::next<I2>::type I3; typedef typename fusion::result_of::next<I3>::type I4; typedef typename fusion::result_of::next<I4>::type I5;
|
||||
typedef pair_from<I0, is_assoc> D0; typedef typename D0::type T0; typedef pair_from<I1, is_assoc> D1; typedef typename D1::type T1; typedef pair_from<I2, is_assoc> D2; typedef typename D2::type T2; typedef pair_from<I3, is_assoc> D3; typedef typename D3::type T3; typedef pair_from<I4, is_assoc> D4; typedef typename D4::type T4; typedef pair_from<I5, is_assoc> D5; typedef typename D5::type T5;
|
||||
typedef map<T0 , T1 , T2 , T3 , T4 , T5> type;
|
||||
};
|
||||
template <typename Iterator>
|
||||
BOOST_CXX14_CONSTEXPR BOOST_FUSION_GPU_ENABLED
|
||||
static typename apply<Iterator>::type
|
||||
call(Iterator const& i0)
|
||||
{
|
||||
typedef apply<Iterator> gen;
|
||||
typedef typename gen::type result;
|
||||
typename gen::I1 i1 = fusion::next(i0); typename gen::I2 i2 = fusion::next(i1); typename gen::I3 i3 = fusion::next(i2); typename gen::I4 i4 = fusion::next(i3); typename gen::I5 i5 = fusion::next(i4);
|
||||
return result(gen::D0::call(i0) , gen::D1::call(i1) , gen::D2::call(i2) , gen::D3::call(i3) , gen::D4::call(i4) , gen::D5::call(i5));
|
||||
}
|
||||
};
|
||||
template <bool is_assoc>
|
||||
struct as_map<7, is_assoc>
|
||||
{
|
||||
template <typename I0>
|
||||
struct apply
|
||||
{
|
||||
typedef typename fusion::result_of::next<I0>::type I1; typedef typename fusion::result_of::next<I1>::type I2; typedef typename fusion::result_of::next<I2>::type I3; typedef typename fusion::result_of::next<I3>::type I4; typedef typename fusion::result_of::next<I4>::type I5; typedef typename fusion::result_of::next<I5>::type I6;
|
||||
typedef pair_from<I0, is_assoc> D0; typedef typename D0::type T0; typedef pair_from<I1, is_assoc> D1; typedef typename D1::type T1; typedef pair_from<I2, is_assoc> D2; typedef typename D2::type T2; typedef pair_from<I3, is_assoc> D3; typedef typename D3::type T3; typedef pair_from<I4, is_assoc> D4; typedef typename D4::type T4; typedef pair_from<I5, is_assoc> D5; typedef typename D5::type T5; typedef pair_from<I6, is_assoc> D6; typedef typename D6::type T6;
|
||||
typedef map<T0 , T1 , T2 , T3 , T4 , T5 , T6> type;
|
||||
};
|
||||
template <typename Iterator>
|
||||
BOOST_CXX14_CONSTEXPR BOOST_FUSION_GPU_ENABLED
|
||||
static typename apply<Iterator>::type
|
||||
call(Iterator const& i0)
|
||||
{
|
||||
typedef apply<Iterator> gen;
|
||||
typedef typename gen::type result;
|
||||
typename gen::I1 i1 = fusion::next(i0); typename gen::I2 i2 = fusion::next(i1); typename gen::I3 i3 = fusion::next(i2); typename gen::I4 i4 = fusion::next(i3); typename gen::I5 i5 = fusion::next(i4); typename gen::I6 i6 = fusion::next(i5);
|
||||
return result(gen::D0::call(i0) , gen::D1::call(i1) , gen::D2::call(i2) , gen::D3::call(i3) , gen::D4::call(i4) , gen::D5::call(i5) , gen::D6::call(i6));
|
||||
}
|
||||
};
|
||||
template <bool is_assoc>
|
||||
struct as_map<8, is_assoc>
|
||||
{
|
||||
template <typename I0>
|
||||
struct apply
|
||||
{
|
||||
typedef typename fusion::result_of::next<I0>::type I1; typedef typename fusion::result_of::next<I1>::type I2; typedef typename fusion::result_of::next<I2>::type I3; typedef typename fusion::result_of::next<I3>::type I4; typedef typename fusion::result_of::next<I4>::type I5; typedef typename fusion::result_of::next<I5>::type I6; typedef typename fusion::result_of::next<I6>::type I7;
|
||||
typedef pair_from<I0, is_assoc> D0; typedef typename D0::type T0; typedef pair_from<I1, is_assoc> D1; typedef typename D1::type T1; typedef pair_from<I2, is_assoc> D2; typedef typename D2::type T2; typedef pair_from<I3, is_assoc> D3; typedef typename D3::type T3; typedef pair_from<I4, is_assoc> D4; typedef typename D4::type T4; typedef pair_from<I5, is_assoc> D5; typedef typename D5::type T5; typedef pair_from<I6, is_assoc> D6; typedef typename D6::type T6; typedef pair_from<I7, is_assoc> D7; typedef typename D7::type T7;
|
||||
typedef map<T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7> type;
|
||||
};
|
||||
template <typename Iterator>
|
||||
BOOST_CXX14_CONSTEXPR BOOST_FUSION_GPU_ENABLED
|
||||
static typename apply<Iterator>::type
|
||||
call(Iterator const& i0)
|
||||
{
|
||||
typedef apply<Iterator> gen;
|
||||
typedef typename gen::type result;
|
||||
typename gen::I1 i1 = fusion::next(i0); typename gen::I2 i2 = fusion::next(i1); typename gen::I3 i3 = fusion::next(i2); typename gen::I4 i4 = fusion::next(i3); typename gen::I5 i5 = fusion::next(i4); typename gen::I6 i6 = fusion::next(i5); typename gen::I7 i7 = fusion::next(i6);
|
||||
return result(gen::D0::call(i0) , gen::D1::call(i1) , gen::D2::call(i2) , gen::D3::call(i3) , gen::D4::call(i4) , gen::D5::call(i5) , gen::D6::call(i6) , gen::D7::call(i7));
|
||||
}
|
||||
};
|
||||
template <bool is_assoc>
|
||||
struct as_map<9, is_assoc>
|
||||
{
|
||||
template <typename I0>
|
||||
struct apply
|
||||
{
|
||||
typedef typename fusion::result_of::next<I0>::type I1; typedef typename fusion::result_of::next<I1>::type I2; typedef typename fusion::result_of::next<I2>::type I3; typedef typename fusion::result_of::next<I3>::type I4; typedef typename fusion::result_of::next<I4>::type I5; typedef typename fusion::result_of::next<I5>::type I6; typedef typename fusion::result_of::next<I6>::type I7; typedef typename fusion::result_of::next<I7>::type I8;
|
||||
typedef pair_from<I0, is_assoc> D0; typedef typename D0::type T0; typedef pair_from<I1, is_assoc> D1; typedef typename D1::type T1; typedef pair_from<I2, is_assoc> D2; typedef typename D2::type T2; typedef pair_from<I3, is_assoc> D3; typedef typename D3::type T3; typedef pair_from<I4, is_assoc> D4; typedef typename D4::type T4; typedef pair_from<I5, is_assoc> D5; typedef typename D5::type T5; typedef pair_from<I6, is_assoc> D6; typedef typename D6::type T6; typedef pair_from<I7, is_assoc> D7; typedef typename D7::type T7; typedef pair_from<I8, is_assoc> D8; typedef typename D8::type T8;
|
||||
typedef map<T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8> type;
|
||||
};
|
||||
template <typename Iterator>
|
||||
BOOST_CXX14_CONSTEXPR BOOST_FUSION_GPU_ENABLED
|
||||
static typename apply<Iterator>::type
|
||||
call(Iterator const& i0)
|
||||
{
|
||||
typedef apply<Iterator> gen;
|
||||
typedef typename gen::type result;
|
||||
typename gen::I1 i1 = fusion::next(i0); typename gen::I2 i2 = fusion::next(i1); typename gen::I3 i3 = fusion::next(i2); typename gen::I4 i4 = fusion::next(i3); typename gen::I5 i5 = fusion::next(i4); typename gen::I6 i6 = fusion::next(i5); typename gen::I7 i7 = fusion::next(i6); typename gen::I8 i8 = fusion::next(i7);
|
||||
return result(gen::D0::call(i0) , gen::D1::call(i1) , gen::D2::call(i2) , gen::D3::call(i3) , gen::D4::call(i4) , gen::D5::call(i5) , gen::D6::call(i6) , gen::D7::call(i7) , gen::D8::call(i8));
|
||||
}
|
||||
};
|
||||
template <bool is_assoc>
|
||||
struct as_map<10, is_assoc>
|
||||
{
|
||||
template <typename I0>
|
||||
struct apply
|
||||
{
|
||||
typedef typename fusion::result_of::next<I0>::type I1; typedef typename fusion::result_of::next<I1>::type I2; typedef typename fusion::result_of::next<I2>::type I3; typedef typename fusion::result_of::next<I3>::type I4; typedef typename fusion::result_of::next<I4>::type I5; typedef typename fusion::result_of::next<I5>::type I6; typedef typename fusion::result_of::next<I6>::type I7; typedef typename fusion::result_of::next<I7>::type I8; typedef typename fusion::result_of::next<I8>::type I9;
|
||||
typedef pair_from<I0, is_assoc> D0; typedef typename D0::type T0; typedef pair_from<I1, is_assoc> D1; typedef typename D1::type T1; typedef pair_from<I2, is_assoc> D2; typedef typename D2::type T2; typedef pair_from<I3, is_assoc> D3; typedef typename D3::type T3; typedef pair_from<I4, is_assoc> D4; typedef typename D4::type T4; typedef pair_from<I5, is_assoc> D5; typedef typename D5::type T5; typedef pair_from<I6, is_assoc> D6; typedef typename D6::type T6; typedef pair_from<I7, is_assoc> D7; typedef typename D7::type T7; typedef pair_from<I8, is_assoc> D8; typedef typename D8::type T8; typedef pair_from<I9, is_assoc> D9; typedef typename D9::type T9;
|
||||
typedef map<T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9> type;
|
||||
};
|
||||
template <typename Iterator>
|
||||
BOOST_CXX14_CONSTEXPR BOOST_FUSION_GPU_ENABLED
|
||||
static typename apply<Iterator>::type
|
||||
call(Iterator const& i0)
|
||||
{
|
||||
typedef apply<Iterator> gen;
|
||||
typedef typename gen::type result;
|
||||
typename gen::I1 i1 = fusion::next(i0); typename gen::I2 i2 = fusion::next(i1); typename gen::I3 i3 = fusion::next(i2); typename gen::I4 i4 = fusion::next(i3); typename gen::I5 i5 = fusion::next(i4); typename gen::I6 i6 = fusion::next(i5); typename gen::I7 i7 = fusion::next(i6); typename gen::I8 i8 = fusion::next(i7); typename gen::I9 i9 = fusion::next(i8);
|
||||
return result(gen::D0::call(i0) , gen::D1::call(i1) , gen::D2::call(i2) , gen::D3::call(i3) , gen::D4::call(i4) , gen::D5::call(i5) , gen::D6::call(i6) , gen::D7::call(i7) , gen::D8::call(i8) , gen::D9::call(i9));
|
||||
}
|
||||
};
|
||||
BOOST_FUSION_BARRIER_END
|
||||
}}}
|
||||
@@ -0,0 +1,75 @@
|
||||
/*==============================================================================
|
||||
Copyright (c) 2001-2010 Joel de Guzman
|
||||
Copyright (c) 2010 Thomas Heller
|
||||
|
||||
Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
==============================================================================*/
|
||||
#ifndef BOOST_PHOENIX_STATEMENT_DO_WHILE_HPP
|
||||
#define BOOST_PHOENIX_STATEMENT_DO_WHILE_HPP
|
||||
|
||||
#include <boost/phoenix/core/limits.hpp>
|
||||
#include <boost/phoenix/core/call.hpp>
|
||||
#include <boost/phoenix/core/expression.hpp>
|
||||
#include <boost/phoenix/core/meta_grammar.hpp>
|
||||
|
||||
BOOST_PHOENIX_DEFINE_EXPRESSION(
|
||||
(boost)(phoenix)(do_while)
|
||||
, (meta_grammar) // Cond
|
||||
(meta_grammar) // Do
|
||||
)
|
||||
|
||||
namespace boost { namespace phoenix
|
||||
{
|
||||
struct do_while_eval
|
||||
{
|
||||
typedef void result_type;
|
||||
|
||||
template <typename Cond, typename Do, typename Context>
|
||||
result_type
|
||||
operator()(Cond const& cond, Do const& do_it, Context const & ctx) const
|
||||
{
|
||||
do
|
||||
boost::phoenix::eval(do_it, ctx);
|
||||
while (boost::phoenix::eval(cond, ctx));
|
||||
}
|
||||
};
|
||||
|
||||
template <typename Dummy>
|
||||
struct default_actions::when<rule::do_while, Dummy>
|
||||
: call<do_while_eval, Dummy>
|
||||
{};
|
||||
|
||||
template <typename Do>
|
||||
struct do_while_gen
|
||||
{
|
||||
do_while_gen(Do const& do_it)
|
||||
: do_(do_it) {}
|
||||
|
||||
template <typename Cond>
|
||||
typename expression::do_while<Cond, Do>::type const
|
||||
while_(Cond const& cond) const
|
||||
{
|
||||
return expression::do_while<Cond, Do>::make(cond, do_);
|
||||
}
|
||||
|
||||
Do const& do_;
|
||||
};
|
||||
|
||||
struct do_gen
|
||||
{
|
||||
template <typename Do>
|
||||
do_while_gen<Do> const
|
||||
operator[](Do const& do_) const
|
||||
{
|
||||
return do_while_gen<Do>(do_);
|
||||
}
|
||||
};
|
||||
|
||||
#ifndef BOOST_PHOENIX_NO_PREDEFINED_TERMINALS
|
||||
do_gen const do_ = {};
|
||||
#endif
|
||||
|
||||
}}
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,56 @@
|
||||
/*
|
||||
[auto_generated]
|
||||
boost/numeric/odeint/util/same_instance.hpp
|
||||
|
||||
[begin_description]
|
||||
Basic check if two variables are the same instance
|
||||
[end_description]
|
||||
|
||||
Copyright 2012 Karsten Ahnert
|
||||
Copyright 2012 Mario Mulansky
|
||||
|
||||
Distributed under the Boost Software License, Version 1.0.
|
||||
(See accompanying file LICENSE_1_0.txt or
|
||||
copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
*/
|
||||
|
||||
|
||||
#ifndef BOOST_NUMERIC_ODEINT_UTIL_SAME_INSTANCE_HPP_INCLUDED
|
||||
#define BOOST_NUMERIC_ODEINT_UTIL_SAME_INSTANCE_HPP_INCLUDED
|
||||
|
||||
namespace boost {
|
||||
namespace numeric {
|
||||
namespace odeint {
|
||||
|
||||
template< class T1 , class T2 , class Enabler=void >
|
||||
struct same_instance_impl
|
||||
{
|
||||
static bool same_instance( const T1& /* x1 */ , const T2& /* x2 */ )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
};
|
||||
|
||||
template< class T >
|
||||
struct same_instance_impl< T , T >
|
||||
{
|
||||
static bool same_instance( const T &x1 , const T &x2 )
|
||||
{
|
||||
// check pointers
|
||||
return (&x1 == &x2);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
template< class T1 , class T2 >
|
||||
bool same_instance( const T1 &x1 , const T2 &x2 )
|
||||
{
|
||||
return same_instance_impl< T1 , T2 >::same_instance( x1 , x2 );
|
||||
}
|
||||
|
||||
|
||||
} // namespace odeint
|
||||
} // namespace numeric
|
||||
} // namespace boost
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,217 @@
|
||||
//---------------------------------------------------------------------------//
|
||||
// Copyright (c) 2013-2014 Kyle Lutz <kyle.r.lutz@gmail.com>
|
||||
//
|
||||
// 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://boostorg.github.com/compute for more information.
|
||||
//---------------------------------------------------------------------------//
|
||||
|
||||
#ifndef BOOST_COMPUTE_UTILITY_WAIT_LIST_HPP
|
||||
#define BOOST_COMPUTE_UTILITY_WAIT_LIST_HPP
|
||||
|
||||
#include <vector>
|
||||
|
||||
#include <boost/compute/config.hpp>
|
||||
|
||||
#ifndef BOOST_COMPUTE_NO_HDR_INITIALIZER_LIST
|
||||
#include <initializer_list>
|
||||
#endif
|
||||
|
||||
#include <boost/compute/event.hpp>
|
||||
|
||||
namespace boost {
|
||||
namespace compute {
|
||||
|
||||
template<class T> class future;
|
||||
|
||||
/// \class wait_list
|
||||
/// \brief Stores a list of events.
|
||||
///
|
||||
/// The wait_list class stores a set of event objects and can be used to
|
||||
/// specify dependencies for OpenCL operations or to wait on the host until
|
||||
/// all of the events have completed.
|
||||
///
|
||||
/// This class also provides convenience functions for interacting with
|
||||
/// OpenCL APIs which typically accept event dependencies as a \c cl_event*
|
||||
/// pointer and a \c cl_uint size. For example:
|
||||
/// \code
|
||||
/// wait_list events = ...;
|
||||
///
|
||||
/// clEnqueueNDRangeKernel(..., events.get_event_ptr(), events.size(), ...);
|
||||
/// \endcode
|
||||
///
|
||||
/// \see event, \ref future "future<T>"
|
||||
class wait_list
|
||||
{
|
||||
public:
|
||||
typedef std::vector<event>::iterator iterator;
|
||||
typedef std::vector<event>::const_iterator const_iterator;
|
||||
|
||||
/// Creates an empty wait-list.
|
||||
wait_list()
|
||||
{
|
||||
}
|
||||
|
||||
/// Creates a wait-list containing \p event.
|
||||
wait_list(const event &event)
|
||||
{
|
||||
insert(event);
|
||||
}
|
||||
|
||||
/// Creates a new wait-list as a copy of \p other.
|
||||
wait_list(const wait_list &other)
|
||||
: m_events(other.m_events)
|
||||
{
|
||||
}
|
||||
|
||||
#ifndef BOOST_COMPUTE_NO_HDR_INITIALIZER_LIST
|
||||
/// Creates a wait-list from \p events
|
||||
wait_list(std::initializer_list<event> events)
|
||||
: m_events(events)
|
||||
{
|
||||
}
|
||||
#endif // BOOST_COMPUTE_NO_HDR_INITIALIZER_LIST
|
||||
|
||||
/// Copies the events in the wait-list from \p other.
|
||||
wait_list& operator=(const wait_list &other)
|
||||
{
|
||||
if(this != &other){
|
||||
m_events = other.m_events;
|
||||
}
|
||||
|
||||
return *this;
|
||||
}
|
||||
|
||||
#ifndef BOOST_COMPUTE_NO_RVALUE_REFERENCES
|
||||
/// Move-constructs a new wait list object from \p other.
|
||||
wait_list(wait_list&& other)
|
||||
: m_events(std::move(other.m_events))
|
||||
{
|
||||
}
|
||||
|
||||
/// Move-assigns the wait list from \p other to \c *this.
|
||||
wait_list& operator=(wait_list&& other)
|
||||
{
|
||||
m_events = std::move(other.m_events);
|
||||
|
||||
return *this;
|
||||
}
|
||||
#endif // BOOST_COMPUTE_NO_RVALUE_REFERENCES
|
||||
|
||||
/// Destroys the wait-list.
|
||||
~wait_list()
|
||||
{
|
||||
}
|
||||
|
||||
/// Returns \c true if the wait-list is empty.
|
||||
bool empty() const
|
||||
{
|
||||
return m_events.empty();
|
||||
}
|
||||
|
||||
/// Returns the number of events in the wait-list.
|
||||
uint_ size() const
|
||||
{
|
||||
return static_cast<uint_>(m_events.size());
|
||||
}
|
||||
|
||||
/// Removes all of the events from the wait-list.
|
||||
void clear()
|
||||
{
|
||||
m_events.clear();
|
||||
}
|
||||
|
||||
/// Returns a cl_event pointer to the first event in the wait-list.
|
||||
/// Returns \c 0 if the wait-list is empty.
|
||||
///
|
||||
/// This can be used to pass the wait-list to OpenCL functions which
|
||||
/// expect a \c cl_event pointer to refer to a list of events.
|
||||
const cl_event* get_event_ptr() const
|
||||
{
|
||||
if(empty()){
|
||||
return 0;
|
||||
}
|
||||
|
||||
return reinterpret_cast<const cl_event *>(&m_events[0]);
|
||||
}
|
||||
|
||||
/// Reserves a minimum length of storage for the wait list object.
|
||||
void reserve(size_t new_capacity) {
|
||||
m_events.reserve(new_capacity);
|
||||
}
|
||||
|
||||
/// Inserts \p event into the wait-list.
|
||||
void insert(const event &event)
|
||||
{
|
||||
m_events.push_back(event);
|
||||
}
|
||||
|
||||
/// Inserts the event from \p future into the wait-list.
|
||||
template<class T>
|
||||
void insert(const future<T> &future)
|
||||
{
|
||||
insert(future.get_event());
|
||||
}
|
||||
|
||||
/// Blocks until all of the events in the wait-list have completed.
|
||||
///
|
||||
/// Does nothing if the wait-list is empty.
|
||||
void wait() const
|
||||
{
|
||||
if(!empty()){
|
||||
BOOST_COMPUTE_ASSERT_CL_SUCCESS(
|
||||
clWaitForEvents(size(), get_event_ptr())
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
/// Returns a reference to the event at specified location \p pos.
|
||||
const event& operator[](size_t pos) const {
|
||||
return m_events[pos];
|
||||
}
|
||||
|
||||
/// Returns a reference to the event at specified location \p pos.
|
||||
event& operator[](size_t pos) {
|
||||
return m_events[pos];
|
||||
}
|
||||
|
||||
/// Returns an iterator to the first element of the wait-list.
|
||||
iterator begin() {
|
||||
return m_events.begin();
|
||||
}
|
||||
|
||||
/// Returns an iterator to the first element of the wait-list.
|
||||
const_iterator begin() const {
|
||||
return m_events.begin();
|
||||
}
|
||||
|
||||
/// Returns an iterator to the first element of the wait-list.
|
||||
const_iterator cbegin() const {
|
||||
return m_events.begin();
|
||||
}
|
||||
|
||||
/// Returns an iterator to the element following the last element of the wait-list.
|
||||
iterator end() {
|
||||
return m_events.end();
|
||||
}
|
||||
|
||||
/// Returns an iterator to the element following the last element of the wait-list.
|
||||
const_iterator end() const {
|
||||
return m_events.end();
|
||||
}
|
||||
|
||||
/// Returns an iterator to the element following the last element of the wait-list.
|
||||
const_iterator cend() const {
|
||||
return m_events.end();
|
||||
}
|
||||
|
||||
private:
|
||||
std::vector<event> m_events;
|
||||
};
|
||||
|
||||
} // end compute namespace
|
||||
} // end boost namespace
|
||||
|
||||
#endif // BOOST_COMPUTE_UTILITY_WAIT_LIST_HPP
|
||||
@@ -0,0 +1,34 @@
|
||||
|
||||
#ifndef BOOST_MPL_AUX_POP_BACK_IMPL_HPP_INCLUDED
|
||||
#define BOOST_MPL_AUX_POP_BACK_IMPL_HPP_INCLUDED
|
||||
|
||||
// Copyright Aleksey Gurtovoy 2000-2004
|
||||
//
|
||||
// Distributed under the Boost Software License, Version 1.0.
|
||||
// (See accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
//
|
||||
// See http://www.boost.org/libs/mpl for documentation.
|
||||
|
||||
// $Id$
|
||||
// $Date$
|
||||
// $Revision$
|
||||
|
||||
#include <boost/mpl/pop_back_fwd.hpp>
|
||||
#include <boost/mpl/aux_/traits_lambda_spec.hpp>
|
||||
|
||||
namespace boost { namespace mpl {
|
||||
|
||||
// no default implementation; the definition is needed to make MSVC happy
|
||||
|
||||
template< typename Tag >
|
||||
struct pop_back_impl
|
||||
{
|
||||
template< typename Sequence > struct apply;
|
||||
};
|
||||
|
||||
BOOST_MPL_ALGORITM_TRAITS_LAMBDA_SPEC(1, pop_back_impl)
|
||||
|
||||
}}
|
||||
|
||||
#endif // BOOST_MPL_AUX_POP_BACK_IMPL_HPP_INCLUDED
|
||||
@@ -0,0 +1,58 @@
|
||||
|
||||
# Set paths
|
||||
EXE_DIR = ..\\..\\wsjtx_install
|
||||
QT_DIR = C:/wsjt-env/Qt5/5.2.1/mingw48_32
|
||||
FFTW3_DIR = ..
|
||||
|
||||
INCPATH = -I${QT_DIR}/include/QtCore -I${QT_DIR}/include
|
||||
|
||||
# Compilers
|
||||
CC = gcc
|
||||
CXX = g++
|
||||
FC = gfortran
|
||||
AR = ar cr
|
||||
RANLIB = ranlib
|
||||
MKDIR = mkdir -p
|
||||
CP = cp
|
||||
RM = rm -f
|
||||
|
||||
FFLAGS = -O2 -fbounds-check -Wall -Wno-conversion
|
||||
CFLAGS = -O2 -I.
|
||||
|
||||
# Default rules
|
||||
%.o: %.c
|
||||
${CC} ${CFLAGS} -c $<
|
||||
%.o: %.f
|
||||
${FC} ${FFLAGS} -c $<
|
||||
%.o: %.F
|
||||
${FC} ${FFLAGS} -c $<
|
||||
%.o: %.f90
|
||||
${FC} ${FFLAGS} -c $<
|
||||
%.o: %.F90
|
||||
${FC} ${FFLAGS} -c $<
|
||||
|
||||
all: jt9w
|
||||
|
||||
OBJS1 = jt9w.o smo.o sync9w.o pctile.o shell.o lorentzian.o fchisq0.o \
|
||||
softsym9w.o four2a.o interleave9.o jt9fano.o fano232.o packjt.o \
|
||||
deg2grid.o grid2deg.o fmtmsg.o db.o decode9w.o
|
||||
|
||||
jt9w: $(OBJS1)
|
||||
$(FC) -o jt9w $(OBJS1) -lfftw3f
|
||||
|
||||
OBJS2 = t1.o four2a.o db.o
|
||||
t1: $(OBJS2)
|
||||
$(FC) -o t1 $(OBJS2) -lfftw3f
|
||||
|
||||
OBJS3 = t2.o four2a.o db.o
|
||||
t2: $(OBJS3)
|
||||
$(FC) -o t2 $(OBJS3) -lfftw3f
|
||||
|
||||
OBJS4 = t3.o
|
||||
t3: $(OBJS4)
|
||||
$(FC) -o t3 $(OBJS4) -L. -ljt9 C:\JTSDK\fftw3f\libfftw3f-3.dll
|
||||
|
||||
.PHONY : clean
|
||||
|
||||
clean:
|
||||
$(RM) *.o JTMSKcode JTMSKcode.exe
|
||||
@@ -0,0 +1,35 @@
|
||||
// Copyright David Abrahams 2002.
|
||||
// Distributed under the Boost Software License, Version 1.0. (See
|
||||
// accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
#ifndef VOID_PTR_DWA200239_HPP
|
||||
# define VOID_PTR_DWA200239_HPP
|
||||
|
||||
# include <boost/type_traits/remove_cv.hpp>
|
||||
|
||||
namespace boost { namespace python { namespace detail {
|
||||
|
||||
template <class U>
|
||||
inline U& void_ptr_to_reference(void const volatile* p, U&(*)())
|
||||
{
|
||||
return *(U*)p;
|
||||
}
|
||||
|
||||
template <class T>
|
||||
inline void write_void_ptr(void const volatile* storage, void* ptr, T*)
|
||||
{
|
||||
*(T**)storage = (T*)ptr;
|
||||
}
|
||||
|
||||
// writes U(ptr) into the storage
|
||||
template <class U>
|
||||
inline void write_void_ptr_reference(void const volatile* storage, void* ptr, U&(*)())
|
||||
{
|
||||
// stripping CV qualification suppresses warnings on older EDGs
|
||||
typedef typename remove_cv<U>::type u_stripped;
|
||||
write_void_ptr(storage, ptr, u_stripped(0));
|
||||
}
|
||||
|
||||
}}} // namespace boost::python::detail
|
||||
|
||||
#endif // VOID_PTR_DWA200239_HPP
|
||||
@@ -0,0 +1,40 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2011 Eric Niebler
|
||||
|
||||
Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
==============================================================================*/
|
||||
|
||||
#if !defined(BOOST_FUSION_SINGLE_VIEW_ITERATOR_JUL_07_2011_1348PM)
|
||||
#define BOOST_FUSION_SINGLE_VIEW_ITERATOR_JUL_07_2011_1348PM
|
||||
|
||||
#include <boost/fusion/support/config.hpp>
|
||||
#include <boost/mpl/assert.hpp>
|
||||
#include <boost/mpl/equal_to.hpp>
|
||||
#include <boost/type_traits/is_same.hpp>
|
||||
#include <boost/type_traits/add_const.hpp>
|
||||
|
||||
namespace boost { namespace fusion
|
||||
{
|
||||
struct single_view_iterator_tag;
|
||||
|
||||
namespace extension
|
||||
{
|
||||
template<typename Tag>
|
||||
struct equal_to_impl;
|
||||
|
||||
template<>
|
||||
struct equal_to_impl<single_view_iterator_tag>
|
||||
{
|
||||
template<typename It1, typename It2>
|
||||
struct apply
|
||||
: mpl::equal_to<typename It1::position, typename It2::position>
|
||||
{
|
||||
BOOST_MPL_ASSERT((is_same<typename add_const<typename It1::single_view_type>::type,
|
||||
typename add_const<typename It2::single_view_type>::type>));
|
||||
};
|
||||
};
|
||||
}
|
||||
}}
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,76 @@
|
||||
program t3
|
||||
|
||||
parameter (NBLK=3456,NZ=10*NBLK)
|
||||
real x0(NZ)
|
||||
real x1(NZ)
|
||||
|
||||
twopi=8.0*atan(1.0)
|
||||
dphi=twopi*1000.0/12000.0
|
||||
phi=0.
|
||||
do i=1,NZ
|
||||
phi=phi+dphi
|
||||
x0(i)=sin(phi)
|
||||
if(mod(i,10007).eq.100) x0(i)=2.0
|
||||
enddo
|
||||
|
||||
do j=1,10
|
||||
ib=j*NBLK
|
||||
ia=ib-NBLK+1
|
||||
call filter(x0(ia:ib),x1(ia:ib))
|
||||
enddo
|
||||
|
||||
x1(1:NZ-NBLK)=x1(NBLK+1:NZ)
|
||||
do i=1,NZ-NBLK
|
||||
write(13,1001) i,x0(i),x1(i),x1(i)-x0(i)
|
||||
1001 format(i6,3f13.9)
|
||||
enddo
|
||||
|
||||
end program t3
|
||||
|
||||
subroutine filter(x0,x1)
|
||||
|
||||
! Process time-domain data sequentially, optionally using a frequency-domain
|
||||
! filter to alter the spectrum.
|
||||
|
||||
! NB: uses a sin^2 window with 50% overlap.
|
||||
|
||||
parameter (NFFT=6912,NH=NFFT/2)
|
||||
real x0(0:NH-1) !Input samples
|
||||
real x1(0:NH-1) !Output samples (delayed by one block)
|
||||
real x0s(0:NH-1) !Saved upper half of input samples
|
||||
real x1s(0:NH-1) !Saved upper half of output samples
|
||||
real x(0:NFFT-1) !Work array
|
||||
real*4 w(0:NFFT-1) !Window function
|
||||
real f(0:NH) !Filter to be applied
|
||||
real*4 s(0:NH) !Average spectrum
|
||||
logical first
|
||||
complex cx(0:NH) !Complex frequency-domain work array
|
||||
equivalence (x,cx)
|
||||
data first/.true./
|
||||
save
|
||||
|
||||
if(first) then
|
||||
pi=4.0*atan(1.0)
|
||||
do i=0,NFFT-1
|
||||
ww=sin(i*pi/NFFT)
|
||||
w(i)=ww*ww/NFFT
|
||||
enddo
|
||||
s=0.0
|
||||
f=1.0
|
||||
x0s=0.
|
||||
x1s=0.
|
||||
first=.false.
|
||||
endif
|
||||
|
||||
x(0:NH-1)=x0s !Previous 2nd half to new 1st half
|
||||
x(NH:NFFT-1)=x0 !New 2nd half
|
||||
x0s=x0 !Save the new 2nd half
|
||||
x=w*x !Apply window
|
||||
call four2a(x,NFFT,1,-1,0) !r2c FFT (to frequency domain)
|
||||
cx=f*cx
|
||||
call four2a(cx,NFFT,1,1,-1) !c2r FFT (back to time domain)
|
||||
x1=x1s + x(0:NH-1) !Add previous segment's 2nd half
|
||||
x1s=x(NH:NFFT-1) !Save the new 2nd half
|
||||
|
||||
return
|
||||
end subroutine filter
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,37 @@
|
||||
//-----------------------------------------------------------------------------
|
||||
// boost variant/detail/has_result_type.hpp header file
|
||||
// See http://www.boost.org for updates, documentation, and revision history.
|
||||
//-----------------------------------------------------------------------------
|
||||
//
|
||||
// Copyright (c) 2014-2015 Antony Polukhin
|
||||
//
|
||||
// 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_VARIANT_DETAIL_HAS_RESULT_TYPE_HPP
|
||||
#define BOOST_VARIANT_DETAIL_HAS_RESULT_TYPE_HPP
|
||||
|
||||
#include <boost/config.hpp>
|
||||
#include <boost/type_traits/remove_reference.hpp>
|
||||
|
||||
|
||||
namespace boost { namespace detail { namespace variant {
|
||||
|
||||
template <typename T >
|
||||
struct has_result_type {
|
||||
private:
|
||||
typedef char yes;
|
||||
typedef struct { char array[2]; } no;
|
||||
|
||||
template<typename C> static yes test(typename boost::remove_reference<typename C::result_type>::type*);
|
||||
template<typename C> static no test(...);
|
||||
|
||||
public:
|
||||
BOOST_STATIC_CONSTANT(bool, value = sizeof(test<T>(0)) == sizeof(yes));
|
||||
};
|
||||
|
||||
}}} // namespace boost::detail::variant
|
||||
|
||||
#endif // BOOST_VARIANT_DETAIL_HAS_RESULT_TYPE_HPP
|
||||
|
||||
@@ -0,0 +1,188 @@
|
||||
/* DISTRIB.C - Procedures for handling distributions over numbers. */
|
||||
|
||||
/* Copyright (c) 1995-2012 by Radford M. Neal and Peter Junteng Liu.
|
||||
*
|
||||
* Permission is granted for anyone to copy, use, modify, and distribute
|
||||
* these programs and accompanying documents for any purpose, provided
|
||||
* this copyright notice is retained and prominently displayed, and note
|
||||
* is made of any changes made to these programs. These programs and
|
||||
* documents are distributed without any warranty, express or implied.
|
||||
* As the programs were written for research purposes only, they have not
|
||||
* been tested to the degree that would be advisable in any important
|
||||
* application. All use of these programs is entirely at the user's own
|
||||
* risk.
|
||||
*/
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <math.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "alloc.h"
|
||||
#include "distrib.h"
|
||||
|
||||
|
||||
/* CREATE A DISTRIBUTION AS SPECIFIED IN A STRING. Space for the distribution
|
||||
is allocated; the string is not freed.
|
||||
|
||||
The string must consist either of a single positive integer, representing
|
||||
the distribution over just that number, or have a form such as the
|
||||
following:
|
||||
|
||||
5x2/3.5x1/1.5x4
|
||||
|
||||
This specifies a distribution over 3 numbers, 2, 1, and 4, specified by
|
||||
the second number in each pair, with proportions of 0.5, 0.35, and 0.15,
|
||||
respectively, specified by the first number in each pair. The actual
|
||||
proportions are found by dividing the first number in each pair by the sum
|
||||
of these numbers.
|
||||
|
||||
The distrib type represents the distribution list. It stores a pointer to
|
||||
an array of distrib_entry elements along with the length of this array.
|
||||
Each distrib_entry contains a (number,proportion) pair.
|
||||
*/
|
||||
|
||||
distrib *distrib_create
|
||||
( char *c /* String describing distribution over numbers */
|
||||
)
|
||||
{
|
||||
distrib *d;
|
||||
char *str, *tstr;
|
||||
int i, n, scan_num, size;
|
||||
double prop, sum;
|
||||
char junk;
|
||||
|
||||
/* Check for special case of a single number. */
|
||||
|
||||
if (sscanf(c,"%d%c",&n,&junk)==1 && n>0)
|
||||
{ tstr = chk_alloc ( (int)(4.1+log10(n)), sizeof(*tstr));
|
||||
sprintf(tstr,"1x%d",n);
|
||||
d = distrib_create(tstr);
|
||||
free(tstr);
|
||||
return d;
|
||||
}
|
||||
|
||||
/* Initial scan of string for size and proper usage. */
|
||||
|
||||
str = c;
|
||||
size = 0;
|
||||
sum = 0;
|
||||
|
||||
d = chk_alloc(1, sizeof *d);
|
||||
|
||||
for (;;)
|
||||
{
|
||||
scan_num = sscanf(str, "%lgx%d%c", &prop, &n, &junk);
|
||||
|
||||
if ((scan_num!=2 && scan_num!=3) || prop<=0 || n<=0)
|
||||
{ return 0;
|
||||
}
|
||||
if (scan_num==3 && junk!='/')
|
||||
{ return 0;
|
||||
}
|
||||
|
||||
size += 1;
|
||||
sum += prop;
|
||||
|
||||
if (scan_num==2)
|
||||
{ break;
|
||||
}
|
||||
else
|
||||
{ str = (char*)strchr(str, '/') + 1;
|
||||
}
|
||||
}
|
||||
|
||||
/* Allocate memory for the list and fill it in */
|
||||
|
||||
d->size = size;
|
||||
d->list = chk_alloc (size, sizeof(distrib_entry));
|
||||
|
||||
i = 0;
|
||||
str = c;
|
||||
|
||||
for (;;)
|
||||
{
|
||||
scan_num = sscanf(str, "%lgx%d%c", &prop, &n, &junk);
|
||||
|
||||
d->list[i].prop = prop/sum;
|
||||
d->list[i].num = n;
|
||||
i += 1;
|
||||
|
||||
if (scan_num==2)
|
||||
{ break;
|
||||
}
|
||||
else if (scan_num==3)
|
||||
{ str = (char*)strchr(str, '/') + 1;
|
||||
}
|
||||
else
|
||||
{ abort();
|
||||
}
|
||||
}
|
||||
|
||||
return d;
|
||||
}
|
||||
|
||||
|
||||
/* FREE SPACE OCCUPIED A DISTRIBUTION LIST. */
|
||||
|
||||
void distrib_free
|
||||
( distrib *d /* List to free */
|
||||
)
|
||||
{ free(d->list);
|
||||
free(d);
|
||||
}
|
||||
|
||||
|
||||
/* RETURN THE MAXIMUM NUMBER IN A DISTRIBUTION LIST. Returns 0 if the list
|
||||
pointer is 0. */
|
||||
|
||||
int distrib_max
|
||||
( distrib *d /* List to examine */
|
||||
)
|
||||
{
|
||||
int i;
|
||||
int cur;
|
||||
|
||||
if (d==0) return 0;
|
||||
|
||||
cur = 0;
|
||||
|
||||
for (i = 1; i<d->size; i++)
|
||||
{ if (d->list[i].num > d->list[cur].num)
|
||||
{ cur = i;
|
||||
}
|
||||
}
|
||||
|
||||
return d->list[cur].num;
|
||||
}
|
||||
|
||||
|
||||
/* TEST PROGRAM. */
|
||||
|
||||
#ifdef TEST_DISTRIB
|
||||
|
||||
main
|
||||
( int argc,
|
||||
char **argv
|
||||
)
|
||||
{
|
||||
distrib *d;
|
||||
int i, j;
|
||||
|
||||
for (i = 1; i<argc; i++)
|
||||
{ d = distrib_create(argv[i]);
|
||||
if (d==0)
|
||||
{ printf("Error\n\n");
|
||||
}
|
||||
else
|
||||
{ for (j = 0; j<distrib_size(d); j++)
|
||||
{ printf("%.3f %d\n",distrib_prop(d,j),distrib_num(d,j));
|
||||
}
|
||||
printf("\n");
|
||||
}
|
||||
}
|
||||
|
||||
exit(0);
|
||||
}
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user