Initial Commit
This commit is contained in:
@@ -0,0 +1,180 @@
|
||||
48 128
|
||||
8 3
|
||||
8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8
|
||||
3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3
|
||||
1 17 34 51 66 81 99 113
|
||||
2 18 35 50 67 82 100 114
|
||||
3 19 36 52 68 82 101 115
|
||||
2 20 36 51 69 83 102 116
|
||||
4 19 37 53 66 84 103 117
|
||||
5 21 38 54 70 85 92 114
|
||||
6 22 39 55 66 85 96 118
|
||||
7 23 32 56 71 86 103 119
|
||||
8 20 40 55 72 86 104 120
|
||||
9 19 41 57 73 87 105 121
|
||||
10 24 36 56 74 88 106 122
|
||||
10 17 33 47 75 89 107 119
|
||||
11 21 42 51 76 87 108 123
|
||||
1 25 40 58 74 84 109 124
|
||||
12 22 42 49 77 90 110 122
|
||||
13 26 43 59 68 89 104 113
|
||||
13 22 44 57 75 91 106 125
|
||||
12 23 37 46 78 88 109 113
|
||||
3 27 34 60 65 87 111 126
|
||||
6 27 45 61 79 89 98 114
|
||||
14 28 34 62 72 92 107 125
|
||||
8 27 42 59 71 92 112 117
|
||||
15 20 46 57 79 93 101 117
|
||||
9 29 45 62 74 94 108 127
|
||||
8 30 38 63 73 95 110 125
|
||||
16 29 47 64 69 96 110 128
|
||||
16 23 48 63 76 94 111 121
|
||||
7 25 39 52 70 97 108 116
|
||||
4 26 45 63 67 83 90 126
|
||||
15 28 39 50 76 88 103 115
|
||||
15 26 33 58 65 97 102 127
|
||||
14 31 47 52 77 81 93 121
|
||||
14 24 37 61 71 82 99 116
|
||||
4 31 40 54 80 91 107 122
|
||||
5 32 41 58 77 98 111 120
|
||||
9 18 49 65 79 85 104 123
|
||||
10 30 43 60 69 84 112 123
|
||||
1 18 43 48 73 91 98 119
|
||||
3 21 46 64 67 86 112 118
|
||||
5 24 48 55 75 93 105 128
|
||||
2 32 44 62 80 95 99 124
|
||||
16 28 41 59 80 83 100 118
|
||||
11 33 35 53 72 96 109 115
|
||||
11 25 44 60 78 90 100 128
|
||||
6 31 35 56 70 95 102 126
|
||||
12 17 50 54 68 94 106 120
|
||||
13 29 38 53 78 97 105 124
|
||||
7 30 49 61 64 81 101 127
|
||||
1 14 38
|
||||
2 4 41
|
||||
3 19 39
|
||||
5 29 34
|
||||
6 35 40
|
||||
7 20 45
|
||||
8 28 48
|
||||
9 22 25
|
||||
10 24 36
|
||||
11 12 37
|
||||
13 43 44
|
||||
15 18 46
|
||||
16 17 47
|
||||
21 32 33
|
||||
23 30 31
|
||||
26 27 42
|
||||
1 12 46
|
||||
2 36 38
|
||||
3 5 10
|
||||
4 9 23
|
||||
6 13 39
|
||||
7 15 17
|
||||
8 18 27
|
||||
11 33 40
|
||||
14 28 44
|
||||
16 29 31
|
||||
19 20 22
|
||||
21 30 42
|
||||
24 26 47
|
||||
25 37 48
|
||||
32 34 45
|
||||
8 35 41
|
||||
12 31 43
|
||||
1 19 21
|
||||
2 43 45
|
||||
3 4 11
|
||||
5 18 33
|
||||
6 25 47
|
||||
7 28 30
|
||||
9 14 34
|
||||
10 35 42
|
||||
13 15 22
|
||||
16 37 38
|
||||
17 41 44
|
||||
20 24 29
|
||||
18 23 39
|
||||
12 26 32
|
||||
27 38 40
|
||||
15 36 48
|
||||
2 30 46
|
||||
1 4 13
|
||||
3 28 32
|
||||
5 43 47
|
||||
6 34 46
|
||||
7 9 40
|
||||
8 11 45
|
||||
10 17 23
|
||||
14 31 35
|
||||
16 22 42
|
||||
19 37 44
|
||||
20 33 48
|
||||
21 24 41
|
||||
25 27 29
|
||||
26 39 48
|
||||
19 31 36
|
||||
1 5 7
|
||||
2 29 39
|
||||
3 16 46
|
||||
4 26 37
|
||||
6 28 45
|
||||
8 22 33
|
||||
9 21 43
|
||||
10 25 38
|
||||
11 14 24
|
||||
12 17 40
|
||||
13 27 30
|
||||
15 32 35
|
||||
18 44 47
|
||||
20 23 36
|
||||
34 41 42
|
||||
1 32 48
|
||||
2 3 33
|
||||
4 29 42
|
||||
5 14 37
|
||||
6 7 36
|
||||
8 9 39
|
||||
10 13 19
|
||||
11 18 30
|
||||
12 16 20
|
||||
15 29 44
|
||||
17 34 38
|
||||
6 21 22
|
||||
23 32 40
|
||||
24 27 46
|
||||
25 41 45
|
||||
7 26 43
|
||||
28 31 47
|
||||
20 35 38
|
||||
1 33 41
|
||||
2 42 44
|
||||
3 23 48
|
||||
4 31 45
|
||||
5 8 30
|
||||
9 16 36
|
||||
10 40 47
|
||||
11 17 46
|
||||
12 21 34
|
||||
13 24 28
|
||||
14 18 43
|
||||
15 25 26
|
||||
19 27 35
|
||||
22 37 39
|
||||
1 16 18
|
||||
2 6 20
|
||||
3 30 43
|
||||
4 28 33
|
||||
5 22 23
|
||||
7 39 42
|
||||
8 12 38
|
||||
9 35 46
|
||||
10 27 32
|
||||
11 15 34
|
||||
13 36 37
|
||||
14 41 47
|
||||
17 21 25
|
||||
19 29 45
|
||||
24 31 48
|
||||
26 40 44
|
||||
@@ -0,0 +1,139 @@
|
||||
|
||||
// Copyright Aleksey Gurtovoy 2000-2004
|
||||
//
|
||||
// Distributed under the Boost Software License, Version 1.0.
|
||||
// (See accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
//
|
||||
|
||||
// Preprocessed version of "boost/mpl/apply.hpp" header
|
||||
// -- DO NOT modify by hand!
|
||||
|
||||
namespace boost { namespace mpl {
|
||||
|
||||
template<
|
||||
typename F
|
||||
>
|
||||
struct apply0
|
||||
|
||||
: apply_wrap0<
|
||||
typename lambda<F>::type
|
||||
|
||||
>
|
||||
{
|
||||
};
|
||||
|
||||
template<
|
||||
typename F
|
||||
>
|
||||
struct apply< F,na,na,na,na,na >
|
||||
: apply0<F>
|
||||
{
|
||||
};
|
||||
|
||||
template<
|
||||
typename F, typename T1
|
||||
>
|
||||
struct apply1
|
||||
|
||||
: apply_wrap1<
|
||||
typename lambda<F>::type
|
||||
, T1
|
||||
>
|
||||
{
|
||||
};
|
||||
|
||||
template<
|
||||
typename F, typename T1
|
||||
>
|
||||
struct apply< F,T1,na,na,na,na >
|
||||
: apply1< F,T1 >
|
||||
{
|
||||
};
|
||||
|
||||
template<
|
||||
typename F, typename T1, typename T2
|
||||
>
|
||||
struct apply2
|
||||
|
||||
: apply_wrap2<
|
||||
typename lambda<F>::type
|
||||
, T1, T2
|
||||
>
|
||||
{
|
||||
};
|
||||
|
||||
template<
|
||||
typename F, typename T1, typename T2
|
||||
>
|
||||
struct apply< F,T1,T2,na,na,na >
|
||||
: apply2< F,T1,T2 >
|
||||
{
|
||||
};
|
||||
|
||||
template<
|
||||
typename F, typename T1, typename T2, typename T3
|
||||
>
|
||||
struct apply3
|
||||
|
||||
: apply_wrap3<
|
||||
typename lambda<F>::type
|
||||
, T1, T2, T3
|
||||
>
|
||||
{
|
||||
};
|
||||
|
||||
template<
|
||||
typename F, typename T1, typename T2, typename T3
|
||||
>
|
||||
struct apply< F,T1,T2,T3,na,na >
|
||||
: apply3< F,T1,T2,T3 >
|
||||
{
|
||||
};
|
||||
|
||||
template<
|
||||
typename F, typename T1, typename T2, typename T3, typename T4
|
||||
>
|
||||
struct apply4
|
||||
|
||||
: apply_wrap4<
|
||||
typename lambda<F>::type
|
||||
, T1, T2, T3, T4
|
||||
>
|
||||
{
|
||||
};
|
||||
|
||||
template<
|
||||
typename F, typename T1, typename T2, typename T3, typename T4
|
||||
>
|
||||
struct apply< F,T1,T2,T3,T4,na >
|
||||
: apply4< F,T1,T2,T3,T4 >
|
||||
{
|
||||
};
|
||||
|
||||
template<
|
||||
typename F, typename T1, typename T2, typename T3, typename T4
|
||||
, typename T5
|
||||
>
|
||||
struct apply5
|
||||
|
||||
: apply_wrap5<
|
||||
typename lambda<F>::type
|
||||
, T1, T2, T3, T4, T5
|
||||
>
|
||||
{
|
||||
};
|
||||
|
||||
/// primary template (not a specialization!)
|
||||
|
||||
template<
|
||||
typename F, typename T1, typename T2, typename T3, typename T4
|
||||
, typename T5
|
||||
>
|
||||
struct apply
|
||||
: apply5< F,T1,T2,T3,T4,T5 >
|
||||
{
|
||||
};
|
||||
|
||||
}}
|
||||
|
||||
@@ -0,0 +1,707 @@
|
||||
/*
|
||||
*
|
||||
* Copyright (c) 1998-2009
|
||||
* John Maddock
|
||||
*
|
||||
* Use, modification and distribution are subject to the
|
||||
* Boost Software License, Version 1.0. (See accompanying file
|
||||
* LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
*
|
||||
*/
|
||||
|
||||
/*
|
||||
* LOCATION: see http://www.boost.org for most recent version.
|
||||
* FILE match_results.cpp
|
||||
* VERSION see <boost/version.hpp>
|
||||
* DESCRIPTION: Declares template class match_results.
|
||||
*/
|
||||
|
||||
#ifndef BOOST_REGEX_V4_MATCH_RESULTS_HPP
|
||||
#define BOOST_REGEX_V4_MATCH_RESULTS_HPP
|
||||
|
||||
#ifdef BOOST_MSVC
|
||||
#pragma warning(push)
|
||||
#pragma warning(disable: 4103)
|
||||
#endif
|
||||
#ifdef BOOST_HAS_ABI_HEADERS
|
||||
# include BOOST_ABI_PREFIX
|
||||
#endif
|
||||
#ifdef BOOST_MSVC
|
||||
#pragma warning(pop)
|
||||
#endif
|
||||
|
||||
namespace boost{
|
||||
#ifdef BOOST_MSVC
|
||||
#pragma warning(push)
|
||||
#pragma warning(disable : 4251 4231)
|
||||
# if BOOST_MSVC < 1600
|
||||
# pragma warning(disable : 4660)
|
||||
# endif
|
||||
#endif
|
||||
|
||||
namespace BOOST_REGEX_DETAIL_NS{
|
||||
|
||||
class named_subexpressions;
|
||||
|
||||
}
|
||||
|
||||
template <class BidiIterator, class Allocator>
|
||||
class match_results
|
||||
{
|
||||
private:
|
||||
#ifndef BOOST_NO_STD_ALLOCATOR
|
||||
typedef std::vector<sub_match<BidiIterator>, Allocator> vector_type;
|
||||
#else
|
||||
typedef std::vector<sub_match<BidiIterator> > vector_type;
|
||||
#endif
|
||||
public:
|
||||
typedef sub_match<BidiIterator> value_type;
|
||||
#if !defined(BOOST_NO_STD_ALLOCATOR) && !(defined(BOOST_MSVC) && defined(_STLPORT_VERSION))
|
||||
typedef typename Allocator::const_reference const_reference;
|
||||
#else
|
||||
typedef const value_type& const_reference;
|
||||
#endif
|
||||
typedef const_reference reference;
|
||||
typedef typename vector_type::const_iterator const_iterator;
|
||||
typedef const_iterator iterator;
|
||||
typedef typename BOOST_REGEX_DETAIL_NS::regex_iterator_traits<
|
||||
BidiIterator>::difference_type difference_type;
|
||||
typedef typename Allocator::size_type size_type;
|
||||
typedef Allocator allocator_type;
|
||||
typedef typename BOOST_REGEX_DETAIL_NS::regex_iterator_traits<
|
||||
BidiIterator>::value_type char_type;
|
||||
typedef std::basic_string<char_type> string_type;
|
||||
typedef BOOST_REGEX_DETAIL_NS::named_subexpressions named_sub_type;
|
||||
|
||||
// construct/copy/destroy:
|
||||
explicit match_results(const Allocator& a = Allocator())
|
||||
#ifndef BOOST_NO_STD_ALLOCATOR
|
||||
: m_subs(a), m_base(), m_null(), m_last_closed_paren(0), m_is_singular(true) {}
|
||||
#else
|
||||
: m_subs(), m_base(), m_null(), m_last_closed_paren(0), m_is_singular(true) { (void)a; }
|
||||
#endif
|
||||
//
|
||||
// IMPORTANT: in the code below, the crazy looking checks around m_is_singular are
|
||||
// all required because it is illegal to copy a singular iterator.
|
||||
// See https://svn.boost.org/trac/boost/ticket/3632.
|
||||
//
|
||||
match_results(const match_results& m)
|
||||
: m_subs(m.m_subs), m_named_subs(m.m_named_subs), m_last_closed_paren(m.m_last_closed_paren), m_is_singular(m.m_is_singular)
|
||||
{
|
||||
if(!m_is_singular)
|
||||
{
|
||||
m_base = m.m_base;
|
||||
m_null = m.m_null;
|
||||
}
|
||||
}
|
||||
match_results& operator=(const match_results& m)
|
||||
{
|
||||
m_subs = m.m_subs;
|
||||
m_named_subs = m.m_named_subs;
|
||||
m_last_closed_paren = m.m_last_closed_paren;
|
||||
m_is_singular = m.m_is_singular;
|
||||
if(!m_is_singular)
|
||||
{
|
||||
m_base = m.m_base;
|
||||
m_null = m.m_null;
|
||||
}
|
||||
return *this;
|
||||
}
|
||||
~match_results(){}
|
||||
|
||||
// size:
|
||||
size_type size() const
|
||||
{ return empty() ? 0 : m_subs.size() - 2; }
|
||||
size_type max_size() const
|
||||
{ return m_subs.max_size(); }
|
||||
bool empty() const
|
||||
{ return m_subs.size() < 2; }
|
||||
// element access:
|
||||
difference_type length(int sub = 0) const
|
||||
{
|
||||
if(m_is_singular)
|
||||
raise_logic_error();
|
||||
sub += 2;
|
||||
if((sub < (int)m_subs.size()) && (sub > 0))
|
||||
return m_subs[sub].length();
|
||||
return 0;
|
||||
}
|
||||
difference_type length(const char_type* sub) const
|
||||
{
|
||||
if(m_is_singular)
|
||||
raise_logic_error();
|
||||
const char_type* sub_end = sub;
|
||||
while(*sub_end) ++sub_end;
|
||||
return length(named_subexpression_index(sub, sub_end));
|
||||
}
|
||||
template <class charT>
|
||||
difference_type length(const charT* sub) const
|
||||
{
|
||||
if(m_is_singular)
|
||||
raise_logic_error();
|
||||
const charT* sub_end = sub;
|
||||
while(*sub_end) ++sub_end;
|
||||
return length(named_subexpression_index(sub, sub_end));
|
||||
}
|
||||
template <class charT, class Traits, class A>
|
||||
difference_type length(const std::basic_string<charT, Traits, A>& sub) const
|
||||
{
|
||||
return length(sub.c_str());
|
||||
}
|
||||
difference_type position(size_type sub = 0) const
|
||||
{
|
||||
if(m_is_singular)
|
||||
raise_logic_error();
|
||||
sub += 2;
|
||||
if(sub < m_subs.size())
|
||||
{
|
||||
const sub_match<BidiIterator>& s = m_subs[sub];
|
||||
if(s.matched || (sub == 2))
|
||||
{
|
||||
return ::boost::BOOST_REGEX_DETAIL_NS::distance((BidiIterator)(m_base), (BidiIterator)(s.first));
|
||||
}
|
||||
}
|
||||
return ~static_cast<difference_type>(0);
|
||||
}
|
||||
difference_type position(const char_type* sub) const
|
||||
{
|
||||
const char_type* sub_end = sub;
|
||||
while(*sub_end) ++sub_end;
|
||||
return position(named_subexpression_index(sub, sub_end));
|
||||
}
|
||||
template <class charT>
|
||||
difference_type position(const charT* sub) const
|
||||
{
|
||||
const charT* sub_end = sub;
|
||||
while(*sub_end) ++sub_end;
|
||||
return position(named_subexpression_index(sub, sub_end));
|
||||
}
|
||||
template <class charT, class Traits, class A>
|
||||
difference_type position(const std::basic_string<charT, Traits, A>& sub) const
|
||||
{
|
||||
return position(sub.c_str());
|
||||
}
|
||||
string_type str(int sub = 0) const
|
||||
{
|
||||
if(m_is_singular)
|
||||
raise_logic_error();
|
||||
sub += 2;
|
||||
string_type result;
|
||||
if(sub < (int)m_subs.size() && (sub > 0))
|
||||
{
|
||||
const sub_match<BidiIterator>& s = m_subs[sub];
|
||||
if(s.matched)
|
||||
{
|
||||
result = s.str();
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
string_type str(const char_type* sub) const
|
||||
{
|
||||
return (*this)[sub].str();
|
||||
}
|
||||
template <class Traits, class A>
|
||||
string_type str(const std::basic_string<char_type, Traits, A>& sub) const
|
||||
{
|
||||
return (*this)[sub].str();
|
||||
}
|
||||
template <class charT>
|
||||
string_type str(const charT* sub) const
|
||||
{
|
||||
return (*this)[sub].str();
|
||||
}
|
||||
template <class charT, class Traits, class A>
|
||||
string_type str(const std::basic_string<charT, Traits, A>& sub) const
|
||||
{
|
||||
return (*this)[sub].str();
|
||||
}
|
||||
const_reference operator[](int sub) const
|
||||
{
|
||||
if(m_is_singular && m_subs.empty())
|
||||
raise_logic_error();
|
||||
sub += 2;
|
||||
if(sub < (int)m_subs.size() && (sub >= 0))
|
||||
{
|
||||
return m_subs[sub];
|
||||
}
|
||||
return m_null;
|
||||
}
|
||||
//
|
||||
// Named sub-expressions:
|
||||
//
|
||||
const_reference named_subexpression(const char_type* i, const char_type* j) const
|
||||
{
|
||||
//
|
||||
// Scan for the leftmost *matched* subexpression with the specified named:
|
||||
//
|
||||
if(m_is_singular)
|
||||
raise_logic_error();
|
||||
BOOST_REGEX_DETAIL_NS::named_subexpressions::range_type r = m_named_subs->equal_range(i, j);
|
||||
while((r.first != r.second) && ((*this)[r.first->index].matched == false))
|
||||
++r.first;
|
||||
return r.first != r.second ? (*this)[r.first->index] : m_null;
|
||||
}
|
||||
template <class charT>
|
||||
const_reference named_subexpression(const charT* i, const charT* j) const
|
||||
{
|
||||
BOOST_STATIC_ASSERT(sizeof(charT) <= sizeof(char_type));
|
||||
if(i == j)
|
||||
return m_null;
|
||||
std::vector<char_type> s;
|
||||
while(i != j)
|
||||
s.insert(s.end(), *i++);
|
||||
return named_subexpression(&*s.begin(), &*s.begin() + s.size());
|
||||
}
|
||||
int named_subexpression_index(const char_type* i, const char_type* j) const
|
||||
{
|
||||
//
|
||||
// Scan for the leftmost *matched* subexpression with the specified named.
|
||||
// If none found then return the leftmost expression with that name,
|
||||
// otherwise an invalid index:
|
||||
//
|
||||
if(m_is_singular)
|
||||
raise_logic_error();
|
||||
BOOST_REGEX_DETAIL_NS::named_subexpressions::range_type s, r;
|
||||
s = r = m_named_subs->equal_range(i, j);
|
||||
while((r.first != r.second) && ((*this)[r.first->index].matched == false))
|
||||
++r.first;
|
||||
if(r.first == r.second)
|
||||
r = s;
|
||||
return r.first != r.second ? r.first->index : -20;
|
||||
}
|
||||
template <class charT>
|
||||
int named_subexpression_index(const charT* i, const charT* j) const
|
||||
{
|
||||
BOOST_STATIC_ASSERT(sizeof(charT) <= sizeof(char_type));
|
||||
if(i == j)
|
||||
return -20;
|
||||
std::vector<char_type> s;
|
||||
while(i != j)
|
||||
s.insert(s.end(), *i++);
|
||||
return named_subexpression_index(&*s.begin(), &*s.begin() + s.size());
|
||||
}
|
||||
template <class Traits, class A>
|
||||
const_reference operator[](const std::basic_string<char_type, Traits, A>& s) const
|
||||
{
|
||||
return named_subexpression(s.c_str(), s.c_str() + s.size());
|
||||
}
|
||||
const_reference operator[](const char_type* p) const
|
||||
{
|
||||
const char_type* e = p;
|
||||
while(*e) ++e;
|
||||
return named_subexpression(p, e);
|
||||
}
|
||||
|
||||
template <class charT>
|
||||
const_reference operator[](const charT* p) const
|
||||
{
|
||||
BOOST_STATIC_ASSERT(sizeof(charT) <= sizeof(char_type));
|
||||
if(*p == 0)
|
||||
return m_null;
|
||||
std::vector<char_type> s;
|
||||
while(*p)
|
||||
s.insert(s.end(), *p++);
|
||||
return named_subexpression(&*s.begin(), &*s.begin() + s.size());
|
||||
}
|
||||
template <class charT, class Traits, class A>
|
||||
const_reference operator[](const std::basic_string<charT, Traits, A>& ns) const
|
||||
{
|
||||
BOOST_STATIC_ASSERT(sizeof(charT) <= sizeof(char_type));
|
||||
if(ns.empty())
|
||||
return m_null;
|
||||
std::vector<char_type> s;
|
||||
for(unsigned i = 0; i < ns.size(); ++i)
|
||||
s.insert(s.end(), ns[i]);
|
||||
return named_subexpression(&*s.begin(), &*s.begin() + s.size());
|
||||
}
|
||||
|
||||
const_reference prefix() const
|
||||
{
|
||||
if(m_is_singular)
|
||||
raise_logic_error();
|
||||
return (*this)[-1];
|
||||
}
|
||||
|
||||
const_reference suffix() const
|
||||
{
|
||||
if(m_is_singular)
|
||||
raise_logic_error();
|
||||
return (*this)[-2];
|
||||
}
|
||||
const_iterator begin() const
|
||||
{
|
||||
return (m_subs.size() > 2) ? (m_subs.begin() + 2) : m_subs.end();
|
||||
}
|
||||
const_iterator end() const
|
||||
{
|
||||
return m_subs.end();
|
||||
}
|
||||
// format:
|
||||
template <class OutputIterator, class Functor>
|
||||
OutputIterator format(OutputIterator out,
|
||||
Functor fmt,
|
||||
match_flag_type flags = format_default) const
|
||||
{
|
||||
if(m_is_singular)
|
||||
raise_logic_error();
|
||||
typedef typename BOOST_REGEX_DETAIL_NS::compute_functor_type<Functor, match_results<BidiIterator, Allocator>, OutputIterator>::type F;
|
||||
F func(fmt);
|
||||
return func(*this, out, flags);
|
||||
}
|
||||
template <class Functor>
|
||||
string_type format(Functor fmt, match_flag_type flags = format_default) const
|
||||
{
|
||||
if(m_is_singular)
|
||||
raise_logic_error();
|
||||
std::basic_string<char_type> result;
|
||||
BOOST_REGEX_DETAIL_NS::string_out_iterator<std::basic_string<char_type> > i(result);
|
||||
|
||||
typedef typename BOOST_REGEX_DETAIL_NS::compute_functor_type<Functor, match_results<BidiIterator, Allocator>, BOOST_REGEX_DETAIL_NS::string_out_iterator<std::basic_string<char_type> > >::type F;
|
||||
F func(fmt);
|
||||
|
||||
func(*this, i, flags);
|
||||
return result;
|
||||
}
|
||||
// format with locale:
|
||||
template <class OutputIterator, class Functor, class RegexT>
|
||||
OutputIterator format(OutputIterator out,
|
||||
Functor fmt,
|
||||
match_flag_type flags,
|
||||
const RegexT& re) const
|
||||
{
|
||||
if(m_is_singular)
|
||||
raise_logic_error();
|
||||
typedef ::boost::regex_traits_wrapper<typename RegexT::traits_type> traits_type;
|
||||
typedef typename BOOST_REGEX_DETAIL_NS::compute_functor_type<Functor, match_results<BidiIterator, Allocator>, OutputIterator, traits_type>::type F;
|
||||
F func(fmt);
|
||||
return func(*this, out, flags, re.get_traits());
|
||||
}
|
||||
template <class RegexT, class Functor>
|
||||
string_type format(Functor fmt,
|
||||
match_flag_type flags,
|
||||
const RegexT& re) const
|
||||
{
|
||||
if(m_is_singular)
|
||||
raise_logic_error();
|
||||
typedef ::boost::regex_traits_wrapper<typename RegexT::traits_type> traits_type;
|
||||
std::basic_string<char_type> result;
|
||||
BOOST_REGEX_DETAIL_NS::string_out_iterator<std::basic_string<char_type> > i(result);
|
||||
|
||||
typedef typename BOOST_REGEX_DETAIL_NS::compute_functor_type<Functor, match_results<BidiIterator, Allocator>, BOOST_REGEX_DETAIL_NS::string_out_iterator<std::basic_string<char_type> >, traits_type >::type F;
|
||||
F func(fmt);
|
||||
|
||||
func(*this, i, flags, re.get_traits());
|
||||
return result;
|
||||
}
|
||||
|
||||
const_reference get_last_closed_paren()const
|
||||
{
|
||||
if(m_is_singular)
|
||||
raise_logic_error();
|
||||
return m_last_closed_paren == 0 ? m_null : (*this)[m_last_closed_paren];
|
||||
}
|
||||
|
||||
allocator_type get_allocator() const
|
||||
{
|
||||
#ifndef BOOST_NO_STD_ALLOCATOR
|
||||
return m_subs.get_allocator();
|
||||
#else
|
||||
return allocator_type();
|
||||
#endif
|
||||
}
|
||||
void swap(match_results& that)
|
||||
{
|
||||
std::swap(m_subs, that.m_subs);
|
||||
std::swap(m_named_subs, that.m_named_subs);
|
||||
std::swap(m_last_closed_paren, that.m_last_closed_paren);
|
||||
if(m_is_singular)
|
||||
{
|
||||
if(!that.m_is_singular)
|
||||
{
|
||||
m_base = that.m_base;
|
||||
m_null = that.m_null;
|
||||
}
|
||||
}
|
||||
else if(that.m_is_singular)
|
||||
{
|
||||
that.m_base = m_base;
|
||||
that.m_null = m_null;
|
||||
}
|
||||
else
|
||||
{
|
||||
std::swap(m_base, that.m_base);
|
||||
std::swap(m_null, that.m_null);
|
||||
}
|
||||
std::swap(m_is_singular, that.m_is_singular);
|
||||
}
|
||||
bool operator==(const match_results& that)const
|
||||
{
|
||||
if(m_is_singular)
|
||||
{
|
||||
return that.m_is_singular;
|
||||
}
|
||||
else if(that.m_is_singular)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
return (m_subs == that.m_subs) && (m_base == that.m_base) && (m_last_closed_paren == that.m_last_closed_paren);
|
||||
}
|
||||
bool operator!=(const match_results& that)const
|
||||
{ return !(*this == that); }
|
||||
|
||||
#ifdef BOOST_REGEX_MATCH_EXTRA
|
||||
typedef typename sub_match<BidiIterator>::capture_sequence_type capture_sequence_type;
|
||||
|
||||
const capture_sequence_type& captures(int i)const
|
||||
{
|
||||
if(m_is_singular)
|
||||
raise_logic_error();
|
||||
return (*this)[i].captures();
|
||||
}
|
||||
#endif
|
||||
|
||||
//
|
||||
// private access functions:
|
||||
void BOOST_REGEX_CALL set_second(BidiIterator i)
|
||||
{
|
||||
BOOST_ASSERT(m_subs.size() > 2);
|
||||
m_subs[2].second = i;
|
||||
m_subs[2].matched = true;
|
||||
m_subs[0].first = i;
|
||||
m_subs[0].matched = (m_subs[0].first != m_subs[0].second);
|
||||
m_null.first = i;
|
||||
m_null.second = i;
|
||||
m_null.matched = false;
|
||||
m_is_singular = false;
|
||||
}
|
||||
|
||||
void BOOST_REGEX_CALL set_second(BidiIterator i, size_type pos, bool m = true, bool escape_k = false)
|
||||
{
|
||||
if(pos)
|
||||
m_last_closed_paren = static_cast<int>(pos);
|
||||
pos += 2;
|
||||
BOOST_ASSERT(m_subs.size() > pos);
|
||||
m_subs[pos].second = i;
|
||||
m_subs[pos].matched = m;
|
||||
if((pos == 2) && !escape_k)
|
||||
{
|
||||
m_subs[0].first = i;
|
||||
m_subs[0].matched = (m_subs[0].first != m_subs[0].second);
|
||||
m_null.first = i;
|
||||
m_null.second = i;
|
||||
m_null.matched = false;
|
||||
m_is_singular = false;
|
||||
}
|
||||
}
|
||||
void BOOST_REGEX_CALL set_size(size_type n, BidiIterator i, BidiIterator j)
|
||||
{
|
||||
value_type v(j);
|
||||
size_type len = m_subs.size();
|
||||
if(len > n + 2)
|
||||
{
|
||||
m_subs.erase(m_subs.begin()+n+2, m_subs.end());
|
||||
std::fill(m_subs.begin(), m_subs.end(), v);
|
||||
}
|
||||
else
|
||||
{
|
||||
std::fill(m_subs.begin(), m_subs.end(), v);
|
||||
if(n+2 != len)
|
||||
m_subs.insert(m_subs.end(), n+2-len, v);
|
||||
}
|
||||
m_subs[1].first = i;
|
||||
m_last_closed_paren = 0;
|
||||
}
|
||||
void BOOST_REGEX_CALL set_base(BidiIterator pos)
|
||||
{
|
||||
m_base = pos;
|
||||
}
|
||||
BidiIterator base()const
|
||||
{
|
||||
return m_base;
|
||||
}
|
||||
void BOOST_REGEX_CALL set_first(BidiIterator i)
|
||||
{
|
||||
BOOST_ASSERT(m_subs.size() > 2);
|
||||
// set up prefix:
|
||||
m_subs[1].second = i;
|
||||
m_subs[1].matched = (m_subs[1].first != i);
|
||||
// set up $0:
|
||||
m_subs[2].first = i;
|
||||
// zero out everything else:
|
||||
for(size_type n = 3; n < m_subs.size(); ++n)
|
||||
{
|
||||
m_subs[n].first = m_subs[n].second = m_subs[0].second;
|
||||
m_subs[n].matched = false;
|
||||
}
|
||||
}
|
||||
void BOOST_REGEX_CALL set_first(BidiIterator i, size_type pos, bool escape_k = false)
|
||||
{
|
||||
BOOST_ASSERT(pos+2 < m_subs.size());
|
||||
if(pos || escape_k)
|
||||
{
|
||||
m_subs[pos+2].first = i;
|
||||
if(escape_k)
|
||||
{
|
||||
m_subs[1].second = i;
|
||||
m_subs[1].matched = (m_subs[1].first != m_subs[1].second);
|
||||
}
|
||||
}
|
||||
else
|
||||
set_first(i);
|
||||
}
|
||||
void BOOST_REGEX_CALL maybe_assign(const match_results<BidiIterator, Allocator>& m);
|
||||
|
||||
void BOOST_REGEX_CALL set_named_subs(boost::shared_ptr<named_sub_type> subs)
|
||||
{
|
||||
m_named_subs = subs;
|
||||
}
|
||||
|
||||
private:
|
||||
//
|
||||
// Error handler called when an uninitialized match_results is accessed:
|
||||
//
|
||||
static void raise_logic_error()
|
||||
{
|
||||
std::logic_error e("Attempt to access an uninitialzed boost::match_results<> class.");
|
||||
boost::throw_exception(e);
|
||||
}
|
||||
|
||||
|
||||
vector_type m_subs; // subexpressions
|
||||
BidiIterator m_base; // where the search started from
|
||||
sub_match<BidiIterator> m_null; // a null match
|
||||
boost::shared_ptr<named_sub_type> m_named_subs; // Shared copy of named subs in the regex object
|
||||
int m_last_closed_paren; // Last ) to be seen - used for formatting
|
||||
bool m_is_singular; // True if our stored iterators are singular
|
||||
};
|
||||
|
||||
template <class BidiIterator, class Allocator>
|
||||
void BOOST_REGEX_CALL match_results<BidiIterator, Allocator>::maybe_assign(const match_results<BidiIterator, Allocator>& m)
|
||||
{
|
||||
if(m_is_singular)
|
||||
{
|
||||
*this = m;
|
||||
return;
|
||||
}
|
||||
const_iterator p1, p2;
|
||||
p1 = begin();
|
||||
p2 = m.begin();
|
||||
//
|
||||
// Distances are measured from the start of *this* match, unless this isn't
|
||||
// a valid match in which case we use the start of the whole sequence. Note that
|
||||
// no subsequent match-candidate can ever be to the left of the first match found.
|
||||
// This ensures that when we are using bidirectional iterators, that distances
|
||||
// measured are as short as possible, and therefore as efficient as possible
|
||||
// to compute. Finally note that we don't use the "matched" data member to test
|
||||
// whether a sub-expression is a valid match, because partial matches set this
|
||||
// to false for sub-expression 0.
|
||||
//
|
||||
BidiIterator l_end = this->suffix().second;
|
||||
BidiIterator l_base = (p1->first == l_end) ? this->prefix().first : (*this)[0].first;
|
||||
difference_type len1 = 0;
|
||||
difference_type len2 = 0;
|
||||
difference_type base1 = 0;
|
||||
difference_type base2 = 0;
|
||||
std::size_t i;
|
||||
for(i = 0; i < size(); ++i, ++p1, ++p2)
|
||||
{
|
||||
//
|
||||
// Leftmost takes priority over longest; handle special cases
|
||||
// where distances need not be computed first (an optimisation
|
||||
// for bidirectional iterators: ensure that we don't accidently
|
||||
// compute the length of the whole sequence, as this can be really
|
||||
// expensive).
|
||||
//
|
||||
if(p1->first == l_end)
|
||||
{
|
||||
if(p2->first != l_end)
|
||||
{
|
||||
// p2 must be better than p1, and no need to calculate
|
||||
// actual distances:
|
||||
base1 = 1;
|
||||
base2 = 0;
|
||||
break;
|
||||
}
|
||||
else
|
||||
{
|
||||
// *p1 and *p2 are either unmatched or match end-of sequence,
|
||||
// either way no need to calculate distances:
|
||||
if((p1->matched == false) && (p2->matched == true))
|
||||
break;
|
||||
if((p1->matched == true) && (p2->matched == false))
|
||||
return;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
else if(p2->first == l_end)
|
||||
{
|
||||
// p1 better than p2, and no need to calculate distances:
|
||||
return;
|
||||
}
|
||||
base1 = ::boost::BOOST_REGEX_DETAIL_NS::distance(l_base, p1->first);
|
||||
base2 = ::boost::BOOST_REGEX_DETAIL_NS::distance(l_base, p2->first);
|
||||
BOOST_ASSERT(base1 >= 0);
|
||||
BOOST_ASSERT(base2 >= 0);
|
||||
if(base1 < base2) return;
|
||||
if(base2 < base1) break;
|
||||
|
||||
len1 = ::boost::BOOST_REGEX_DETAIL_NS::distance((BidiIterator)p1->first, (BidiIterator)p1->second);
|
||||
len2 = ::boost::BOOST_REGEX_DETAIL_NS::distance((BidiIterator)p2->first, (BidiIterator)p2->second);
|
||||
BOOST_ASSERT(len1 >= 0);
|
||||
BOOST_ASSERT(len2 >= 0);
|
||||
if((len1 != len2) || ((p1->matched == false) && (p2->matched == true)))
|
||||
break;
|
||||
if((p1->matched == true) && (p2->matched == false))
|
||||
return;
|
||||
}
|
||||
if(i == size())
|
||||
return;
|
||||
if(base2 < base1)
|
||||
*this = m;
|
||||
else if((len2 > len1) || ((p1->matched == false) && (p2->matched == true)) )
|
||||
*this = m;
|
||||
}
|
||||
|
||||
template <class BidiIterator, class Allocator>
|
||||
void swap(match_results<BidiIterator, Allocator>& a, match_results<BidiIterator, Allocator>& b)
|
||||
{
|
||||
a.swap(b);
|
||||
}
|
||||
|
||||
#ifndef BOOST_NO_STD_LOCALE
|
||||
template <class charT, class traits, class BidiIterator, class Allocator>
|
||||
std::basic_ostream<charT, traits>&
|
||||
operator << (std::basic_ostream<charT, traits>& os,
|
||||
const match_results<BidiIterator, Allocator>& s)
|
||||
{
|
||||
return (os << s.str());
|
||||
}
|
||||
#else
|
||||
template <class BidiIterator, class Allocator>
|
||||
std::ostream& operator << (std::ostream& os,
|
||||
const match_results<BidiIterator, Allocator>& s)
|
||||
{
|
||||
return (os << s.str());
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef BOOST_MSVC
|
||||
#pragma warning(pop)
|
||||
#endif
|
||||
} // namespace boost
|
||||
|
||||
#ifdef BOOST_MSVC
|
||||
#pragma warning(push)
|
||||
#pragma warning(disable: 4103)
|
||||
#endif
|
||||
#ifdef BOOST_HAS_ABI_HEADERS
|
||||
# include BOOST_ABI_SUFFIX
|
||||
#endif
|
||||
#ifdef BOOST_MSVC
|
||||
#pragma warning(pop)
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
@@ -0,0 +1,63 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2001-2011 Joel de Guzman
|
||||
|
||||
Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
==============================================================================*/
|
||||
#ifndef BOOST_PP_IS_ITERATING
|
||||
#if !defined(FUSION_MAP_FORWARD_CTOR_07222005_0106)
|
||||
#define FUSION_MAP_FORWARD_CTOR_07222005_0106
|
||||
|
||||
#define FUSION_FORWARD_CTOR_FORWARD(z, n, _) BOOST_FUSION_FWD_ELEM(U##n, _##n)
|
||||
|
||||
#define BOOST_PP_FILENAME_1 \
|
||||
<boost/fusion/container/map/detail/cpp03/map_forward_ctor.hpp>
|
||||
#define BOOST_PP_ITERATION_LIMITS (1, FUSION_MAX_MAP_SIZE)
|
||||
#include BOOST_PP_ITERATE()
|
||||
|
||||
#undef FUSION_FORWARD_CTOR_FORWARD
|
||||
#endif
|
||||
#else // defined(BOOST_PP_IS_ITERATING)
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Preprocessor vertical repetition code
|
||||
//
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#define N BOOST_PP_ITERATION()
|
||||
|
||||
BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
|
||||
#if N == 1
|
||||
explicit
|
||||
#endif
|
||||
map(BOOST_PP_ENUM_BINARY_PARAMS(N, typename detail::call_param<T, >::type arg))
|
||||
: data(BOOST_PP_ENUM_PARAMS(N, arg)) {}
|
||||
|
||||
#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 U)>
|
||||
BOOST_FUSION_GPU_ENABLED
|
||||
#if N == 1
|
||||
explicit
|
||||
#endif
|
||||
map(BOOST_PP_ENUM_BINARY_PARAMS(N, U, && arg)
|
||||
#if defined(__WAVE__) && defined(BOOST_FUSION_CREATE_PREPROCESSED_FILES) && \
|
||||
N == 1
|
||||
// workaround for MSVC 10
|
||||
FUSION_HASH if defined(BOOST_MSVC) && (BOOST_MSVC == 1700)
|
||||
, typename enable_if<is_same<U0, T0> >::type* = 0
|
||||
FUSION_HASH endif
|
||||
#endif
|
||||
)
|
||||
: data(BOOST_PP_ENUM(N, FUSION_FORWARD_CTOR_FORWARD, arg)) {}
|
||||
#endif
|
||||
#if defined(__WAVE__) && defined(BOOST_FUSION_CREATE_PREPROCESSED_FILES)
|
||||
FUSION_HASH endif
|
||||
#endif
|
||||
|
||||
#undef N
|
||||
#endif // defined(BOOST_PP_IS_ITERATING)
|
||||
|
||||
@@ -0,0 +1,62 @@
|
||||
/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8
|
||||
// basic_text_oarchive.ipp:
|
||||
|
||||
// (C) Copyright 2002 Robert Ramey - http://www.rrsd.com .
|
||||
// Use, modification and distribution is subject to the Boost Software
|
||||
// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
// See http://www.boost.org for updates, documentation, and revision history.
|
||||
#include <string>
|
||||
#include <boost/assert.hpp>
|
||||
#include <cstring>
|
||||
|
||||
#include <boost/config.hpp>
|
||||
#if defined(BOOST_NO_STDC_NAMESPACE)
|
||||
namespace std{
|
||||
using ::memcpy;
|
||||
}
|
||||
#endif
|
||||
|
||||
#include <boost/archive/basic_text_oarchive.hpp>
|
||||
|
||||
namespace boost {
|
||||
namespace archive {
|
||||
|
||||
/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8
|
||||
// implementation of basic_text_oarchive
|
||||
|
||||
template<class Archive>
|
||||
BOOST_ARCHIVE_OR_WARCHIVE_DECL void
|
||||
basic_text_oarchive<Archive>::newtoken()
|
||||
{
|
||||
switch(delimiter){
|
||||
default:
|
||||
BOOST_ASSERT(false);
|
||||
break;
|
||||
case eol:
|
||||
this->This()->put('\n');
|
||||
delimiter = space;
|
||||
break;
|
||||
case space:
|
||||
this->This()->put(' ');
|
||||
break;
|
||||
case none:
|
||||
delimiter = space;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
template<class Archive>
|
||||
BOOST_ARCHIVE_OR_WARCHIVE_DECL void
|
||||
basic_text_oarchive<Archive>::init(){
|
||||
// write signature in an archive version independent manner
|
||||
const std::string file_signature(BOOST_ARCHIVE_SIGNATURE());
|
||||
* this->This() << file_signature;
|
||||
// write library version
|
||||
const library_version_type v(BOOST_ARCHIVE_VERSION());
|
||||
* this->This() << v;
|
||||
}
|
||||
|
||||
} // namespace archive
|
||||
} // namespace boost
|
||||
@@ -0,0 +1,205 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// (C) Copyright Olaf Krzikalla 2004-2006.
|
||||
// (C) Copyright Ion Gaztanaga 2006-2013.
|
||||
//
|
||||
// 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/intrusive for documentation.
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef BOOST_INTRUSIVE_RBTREE_NODE_HPP
|
||||
#define BOOST_INTRUSIVE_RBTREE_NODE_HPP
|
||||
|
||||
#ifndef BOOST_CONFIG_HPP
|
||||
# include <boost/config.hpp>
|
||||
#endif
|
||||
|
||||
#if defined(BOOST_HAS_PRAGMA_ONCE)
|
||||
# pragma once
|
||||
#endif
|
||||
|
||||
#include <boost/intrusive/detail/config_begin.hpp>
|
||||
#include <boost/intrusive/detail/workaround.hpp>
|
||||
#include <boost/intrusive/pointer_rebind.hpp>
|
||||
#include <boost/intrusive/rbtree_algorithms.hpp>
|
||||
#include <boost/intrusive/pointer_plus_bits.hpp>
|
||||
#include <boost/intrusive/detail/mpl.hpp>
|
||||
#include <boost/intrusive/detail/tree_node.hpp>
|
||||
|
||||
namespace boost {
|
||||
namespace intrusive {
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// //
|
||||
// Generic node_traits for any pointer type //
|
||||
// //
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
//This is the compact representation: 3 pointers
|
||||
template<class VoidPointer>
|
||||
struct compact_rbtree_node
|
||||
{
|
||||
typedef compact_rbtree_node<VoidPointer> node;
|
||||
typedef typename pointer_rebind<VoidPointer, node >::type node_ptr;
|
||||
typedef typename pointer_rebind<VoidPointer, const node >::type const_node_ptr;
|
||||
enum color { red_t, black_t };
|
||||
node_ptr parent_, left_, right_;
|
||||
};
|
||||
|
||||
//This is the normal representation: 3 pointers + enum
|
||||
template<class VoidPointer>
|
||||
struct rbtree_node
|
||||
{
|
||||
typedef rbtree_node<VoidPointer> node;
|
||||
typedef typename pointer_rebind<VoidPointer, node >::type node_ptr;
|
||||
typedef typename pointer_rebind<VoidPointer, const node >::type const_node_ptr;
|
||||
|
||||
enum color { red_t, black_t };
|
||||
node_ptr parent_, left_, right_;
|
||||
color color_;
|
||||
};
|
||||
|
||||
//This is the default node traits implementation
|
||||
//using a node with 3 generic pointers plus an enum
|
||||
template<class VoidPointer>
|
||||
struct default_rbtree_node_traits_impl
|
||||
{
|
||||
typedef rbtree_node<VoidPointer> node;
|
||||
typedef typename node::node_ptr node_ptr;
|
||||
typedef typename node::const_node_ptr const_node_ptr;
|
||||
|
||||
typedef typename node::color color;
|
||||
|
||||
BOOST_INTRUSIVE_FORCEINLINE static node_ptr get_parent(const const_node_ptr & n)
|
||||
{ return n->parent_; }
|
||||
|
||||
BOOST_INTRUSIVE_FORCEINLINE static node_ptr get_parent(const node_ptr & n)
|
||||
{ return n->parent_; }
|
||||
|
||||
BOOST_INTRUSIVE_FORCEINLINE static void set_parent(const node_ptr & n, const node_ptr & p)
|
||||
{ n->parent_ = p; }
|
||||
|
||||
BOOST_INTRUSIVE_FORCEINLINE static node_ptr get_left(const const_node_ptr & n)
|
||||
{ return n->left_; }
|
||||
|
||||
BOOST_INTRUSIVE_FORCEINLINE static node_ptr get_left(const node_ptr & n)
|
||||
{ return n->left_; }
|
||||
|
||||
BOOST_INTRUSIVE_FORCEINLINE static void set_left(const node_ptr & n, const node_ptr & l)
|
||||
{ n->left_ = l; }
|
||||
|
||||
BOOST_INTRUSIVE_FORCEINLINE static node_ptr get_right(const const_node_ptr & n)
|
||||
{ return n->right_; }
|
||||
|
||||
BOOST_INTRUSIVE_FORCEINLINE static node_ptr get_right(const node_ptr & n)
|
||||
{ return n->right_; }
|
||||
|
||||
BOOST_INTRUSIVE_FORCEINLINE static void set_right(const node_ptr & n, const node_ptr & r)
|
||||
{ n->right_ = r; }
|
||||
|
||||
BOOST_INTRUSIVE_FORCEINLINE static color get_color(const const_node_ptr & n)
|
||||
{ return n->color_; }
|
||||
|
||||
BOOST_INTRUSIVE_FORCEINLINE static color get_color(const node_ptr & n)
|
||||
{ return n->color_; }
|
||||
|
||||
BOOST_INTRUSIVE_FORCEINLINE static void set_color(const node_ptr & n, color c)
|
||||
{ n->color_ = c; }
|
||||
|
||||
BOOST_INTRUSIVE_FORCEINLINE static color black()
|
||||
{ return node::black_t; }
|
||||
|
||||
BOOST_INTRUSIVE_FORCEINLINE static color red()
|
||||
{ return node::red_t; }
|
||||
};
|
||||
|
||||
//This is the compact node traits implementation
|
||||
//using a node with 3 generic pointers
|
||||
template<class VoidPointer>
|
||||
struct compact_rbtree_node_traits_impl
|
||||
{
|
||||
typedef compact_rbtree_node<VoidPointer> node;
|
||||
typedef typename node::node_ptr node_ptr;
|
||||
typedef typename node::const_node_ptr const_node_ptr;
|
||||
|
||||
typedef pointer_plus_bits<node_ptr, 1> ptr_bit;
|
||||
|
||||
typedef typename node::color color;
|
||||
|
||||
BOOST_INTRUSIVE_FORCEINLINE static node_ptr get_parent(const const_node_ptr & n)
|
||||
{ return ptr_bit::get_pointer(n->parent_); }
|
||||
|
||||
BOOST_INTRUSIVE_FORCEINLINE static node_ptr get_parent(const node_ptr & n)
|
||||
{ return ptr_bit::get_pointer(n->parent_); }
|
||||
|
||||
BOOST_INTRUSIVE_FORCEINLINE static void set_parent(const node_ptr & n, const node_ptr & p)
|
||||
{ ptr_bit::set_pointer(n->parent_, p); }
|
||||
|
||||
BOOST_INTRUSIVE_FORCEINLINE static node_ptr get_left(const const_node_ptr & n)
|
||||
{ return n->left_; }
|
||||
|
||||
BOOST_INTRUSIVE_FORCEINLINE static node_ptr get_left(const node_ptr & n)
|
||||
{ return n->left_; }
|
||||
|
||||
BOOST_INTRUSIVE_FORCEINLINE static void set_left(const node_ptr & n, const node_ptr & l)
|
||||
{ n->left_ = l; }
|
||||
|
||||
BOOST_INTRUSIVE_FORCEINLINE static node_ptr get_right(const const_node_ptr & n)
|
||||
{ return n->right_; }
|
||||
|
||||
BOOST_INTRUSIVE_FORCEINLINE static node_ptr get_right(const node_ptr & n)
|
||||
{ return n->right_; }
|
||||
|
||||
BOOST_INTRUSIVE_FORCEINLINE static void set_right(const node_ptr & n, const node_ptr & r)
|
||||
{ n->right_ = r; }
|
||||
|
||||
BOOST_INTRUSIVE_FORCEINLINE static color get_color(const const_node_ptr & n)
|
||||
{ return (color)ptr_bit::get_bits(n->parent_); }
|
||||
|
||||
BOOST_INTRUSIVE_FORCEINLINE static color get_color(const node_ptr & n)
|
||||
{ return (color)ptr_bit::get_bits(n->parent_); }
|
||||
|
||||
BOOST_INTRUSIVE_FORCEINLINE static void set_color(const node_ptr & n, color c)
|
||||
{ ptr_bit::set_bits(n->parent_, c != 0); }
|
||||
|
||||
BOOST_INTRUSIVE_FORCEINLINE static color black()
|
||||
{ return node::black_t; }
|
||||
|
||||
BOOST_INTRUSIVE_FORCEINLINE static color red()
|
||||
{ return node::red_t; }
|
||||
};
|
||||
|
||||
//Dispatches the implementation based on the boolean
|
||||
template<class VoidPointer, bool Compact>
|
||||
struct rbtree_node_traits_dispatch
|
||||
: public default_rbtree_node_traits_impl<VoidPointer>
|
||||
{};
|
||||
|
||||
template<class VoidPointer>
|
||||
struct rbtree_node_traits_dispatch<VoidPointer, true>
|
||||
: public compact_rbtree_node_traits_impl<VoidPointer>
|
||||
{};
|
||||
|
||||
//Inherit from rbtree_node_traits_dispatch depending on the embedding capabilities
|
||||
template<class VoidPointer, bool OptimizeSize = false>
|
||||
struct rbtree_node_traits
|
||||
: public rbtree_node_traits_dispatch
|
||||
< VoidPointer
|
||||
, OptimizeSize &&
|
||||
(max_pointer_plus_bits
|
||||
< VoidPointer
|
||||
, detail::alignment_of<compact_rbtree_node<VoidPointer> >::value
|
||||
>::value >= 1)
|
||||
>
|
||||
{};
|
||||
|
||||
} //namespace intrusive
|
||||
} //namespace boost
|
||||
|
||||
#include <boost/intrusive/detail/config_end.hpp>
|
||||
|
||||
#endif //BOOST_INTRUSIVE_RBTREE_NODE_HPP
|
||||
@@ -0,0 +1,61 @@
|
||||
/*
|
||||
Copyright Rene Rivera 2008-2015
|
||||
Distributed under the Boost Software License, Version 1.0.
|
||||
(See accompanying file LICENSE_1_0.txt or copy at
|
||||
http://www.boost.org/LICENSE_1_0.txt)
|
||||
*/
|
||||
|
||||
#ifndef BOOST_PREDEF_LIBRARY_C_GNU_H
|
||||
#define BOOST_PREDEF_LIBRARY_C_GNU_H
|
||||
|
||||
#include <boost/predef/version_number.h>
|
||||
#include <boost/predef/make.h>
|
||||
|
||||
#include <boost/predef/library/c/_prefix.h>
|
||||
|
||||
#if defined(__STDC__)
|
||||
#include <stddef.h>
|
||||
#elif defined(__cplusplus)
|
||||
#include <cstddef>
|
||||
#endif
|
||||
|
||||
/*`
|
||||
[heading `BOOST_LIB_C_GNU`]
|
||||
|
||||
[@http://en.wikipedia.org/wiki/Glibc GNU glibc] Standard C library.
|
||||
Version number available as major, and minor.
|
||||
|
||||
[table
|
||||
[[__predef_symbol__] [__predef_version__]]
|
||||
|
||||
[[`__GLIBC__`] [__predef_detection__]]
|
||||
[[`__GNU_LIBRARY__`] [__predef_detection__]]
|
||||
|
||||
[[`__GLIBC__`, `__GLIBC_MINOR__`] [V.R.0]]
|
||||
[[`__GNU_LIBRARY__`, `__GNU_LIBRARY_MINOR__`] [V.R.0]]
|
||||
]
|
||||
*/
|
||||
|
||||
#define BOOST_LIB_C_GNU BOOST_VERSION_NUMBER_NOT_AVAILABLE
|
||||
|
||||
#if defined(__GLIBC__) || defined(__GNU_LIBRARY__)
|
||||
# undef BOOST_LIB_C_GNU
|
||||
# if defined(__GLIBC__)
|
||||
# define BOOST_LIB_C_GNU \
|
||||
BOOST_VERSION_NUMBER(__GLIBC__,__GLIBC_MINOR__,0)
|
||||
# else
|
||||
# define BOOST_LIB_C_GNU \
|
||||
BOOST_VERSION_NUMBER(__GNU_LIBRARY__,__GNU_LIBRARY_MINOR__,0)
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#if BOOST_LIB_C_GNU
|
||||
# define BOOST_LIB_C_GNU_AVAILABLE
|
||||
#endif
|
||||
|
||||
#define BOOST_LIB_C_GNU_NAME "GNU"
|
||||
|
||||
#endif
|
||||
|
||||
#include <boost/predef/detail/test.h>
|
||||
BOOST_PREDEF_DECLARE_TEST(BOOST_LIB_C_GNU,BOOST_LIB_C_GNU_NAME)
|
||||
@@ -0,0 +1,283 @@
|
||||
// Copyright Vladimir Prus 2002-2004.
|
||||
// Copyright Bertolt Mildner 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 BOOST_OPTION_DESCRIPTION_VP_2003_05_19
|
||||
#define BOOST_OPTION_DESCRIPTION_VP_2003_05_19
|
||||
|
||||
#include <boost/program_options/config.hpp>
|
||||
#include <boost/program_options/errors.hpp>
|
||||
#include <boost/program_options/value_semantic.hpp>
|
||||
|
||||
#include <boost/function.hpp>
|
||||
#include <boost/shared_ptr.hpp>
|
||||
#include <boost/detail/workaround.hpp>
|
||||
#include <boost/any.hpp>
|
||||
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#include <set>
|
||||
#include <map>
|
||||
#include <stdexcept>
|
||||
|
||||
#include <iosfwd>
|
||||
|
||||
#if defined(BOOST_MSVC)
|
||||
# pragma warning (push)
|
||||
# pragma warning (disable:4251) // class 'boost::shared_ptr<T>' needs to have dll-interface to be used by clients of class 'boost::program_options::option_description'
|
||||
#endif
|
||||
|
||||
|
||||
/** Boost namespace */
|
||||
namespace boost {
|
||||
/** Namespace for the library. */
|
||||
namespace program_options {
|
||||
|
||||
/** Describes one possible command line/config file option. There are two
|
||||
kinds of properties of an option. First describe it syntactically and
|
||||
are used only to validate input. Second affect interpretation of the
|
||||
option, for example default value for it or function that should be
|
||||
called when the value is finally known. Routines which perform parsing
|
||||
never use second kind of properties \-- they are side effect free.
|
||||
@sa options_description
|
||||
*/
|
||||
class BOOST_PROGRAM_OPTIONS_DECL option_description {
|
||||
public:
|
||||
|
||||
option_description();
|
||||
|
||||
/** Initializes the object with the passed data.
|
||||
|
||||
Note: it would be nice to make the second parameter auto_ptr,
|
||||
to explicitly pass ownership. Unfortunately, it's often needed to
|
||||
create objects of types derived from 'value_semantic':
|
||||
options_description d;
|
||||
d.add_options()("a", parameter<int>("n")->default_value(1));
|
||||
Here, the static type returned by 'parameter' should be derived
|
||||
from value_semantic.
|
||||
|
||||
Alas, derived->base conversion for auto_ptr does not really work,
|
||||
see
|
||||
http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2000/n1232.pdf
|
||||
http://www.open-std.org/jtc1/sc22/wg21/docs/cwg_defects.html#84
|
||||
|
||||
So, we have to use plain old pointers. Besides, users are not
|
||||
expected to use the constructor directly.
|
||||
|
||||
|
||||
The 'name' parameter is interpreted by the following rules:
|
||||
- if there's no "," character in 'name', it specifies long name
|
||||
- otherwise, the part before "," specifies long name and the part
|
||||
after \-- short name.
|
||||
*/
|
||||
option_description(const char* name,
|
||||
const value_semantic* s);
|
||||
|
||||
/** Initializes the class with the passed data.
|
||||
*/
|
||||
option_description(const char* name,
|
||||
const value_semantic* s,
|
||||
const char* description);
|
||||
|
||||
virtual ~option_description();
|
||||
|
||||
enum match_result { no_match, full_match, approximate_match };
|
||||
|
||||
/** Given 'option', specified in the input source,
|
||||
returns 'true' if 'option' specifies *this.
|
||||
*/
|
||||
match_result match(const std::string& option, bool approx,
|
||||
bool long_ignore_case, bool short_ignore_case) const;
|
||||
|
||||
/** Returns the key that should identify the option, in
|
||||
particular in the variables_map class.
|
||||
The 'option' parameter is the option spelling from the
|
||||
input source.
|
||||
If option name contains '*', returns 'option'.
|
||||
If long name was specified, it's the long name, otherwise
|
||||
it's a short name with prepended '-'.
|
||||
*/
|
||||
const std::string& key(const std::string& option) const;
|
||||
|
||||
|
||||
/** Returns the canonical name for the option description to enable the user to
|
||||
recognised a matching option.
|
||||
1) For short options ('-', '/'), returns the short name prefixed.
|
||||
2) For long options ('--' / '-') returns the long name prefixed
|
||||
3) All other cases, returns the long name (if present) or the short name,
|
||||
unprefixed.
|
||||
*/
|
||||
std::string canonical_display_name(int canonical_option_style = 0) const;
|
||||
|
||||
const std::string& long_name() const;
|
||||
|
||||
/// Explanation of this option
|
||||
const std::string& description() const;
|
||||
|
||||
/// Semantic of option's value
|
||||
shared_ptr<const value_semantic> semantic() const;
|
||||
|
||||
/// Returns the option name, formatted suitably for usage message.
|
||||
std::string format_name() const;
|
||||
|
||||
/** Returns the parameter name and properties, formatted suitably for
|
||||
usage message. */
|
||||
std::string format_parameter() const;
|
||||
|
||||
private:
|
||||
|
||||
option_description& set_name(const char* name);
|
||||
|
||||
std::string m_short_name, m_long_name, m_description;
|
||||
// shared_ptr is needed to simplify memory management in
|
||||
// copy ctor and destructor.
|
||||
shared_ptr<const value_semantic> m_value_semantic;
|
||||
};
|
||||
|
||||
class options_description;
|
||||
|
||||
/** Class which provides convenient creation syntax to option_description.
|
||||
*/
|
||||
class BOOST_PROGRAM_OPTIONS_DECL options_description_easy_init {
|
||||
public:
|
||||
options_description_easy_init(options_description* owner);
|
||||
|
||||
options_description_easy_init&
|
||||
operator()(const char* name,
|
||||
const char* description);
|
||||
|
||||
options_description_easy_init&
|
||||
operator()(const char* name,
|
||||
const value_semantic* s);
|
||||
|
||||
options_description_easy_init&
|
||||
operator()(const char* name,
|
||||
const value_semantic* s,
|
||||
const char* description);
|
||||
|
||||
private:
|
||||
options_description* owner;
|
||||
};
|
||||
|
||||
|
||||
/** A set of option descriptions. This provides convenient interface for
|
||||
adding new option (the add_options) method, and facilities to search
|
||||
for options by name.
|
||||
|
||||
See @ref a_adding_options "here" for option adding interface discussion.
|
||||
@sa option_description
|
||||
*/
|
||||
class BOOST_PROGRAM_OPTIONS_DECL options_description {
|
||||
public:
|
||||
static const unsigned m_default_line_length;
|
||||
|
||||
/** Creates the instance. */
|
||||
options_description(unsigned line_length = m_default_line_length,
|
||||
unsigned min_description_length = m_default_line_length / 2);
|
||||
/** Creates the instance. The 'caption' parameter gives the name of
|
||||
this 'options_description' instance. Primarily useful for output.
|
||||
The 'description_length' specifies the number of columns that
|
||||
should be reserved for the description text; if the option text
|
||||
encroaches into this, then the description will start on the next
|
||||
line.
|
||||
*/
|
||||
options_description(const std::string& caption,
|
||||
unsigned line_length = m_default_line_length,
|
||||
unsigned min_description_length = m_default_line_length / 2);
|
||||
/** Adds new variable description. Throws duplicate_variable_error if
|
||||
either short or long name matches that of already present one.
|
||||
*/
|
||||
void add(shared_ptr<option_description> desc);
|
||||
/** Adds a group of option description. This has the same
|
||||
effect as adding all option_descriptions in 'desc'
|
||||
individually, except that output operator will show
|
||||
a separate group.
|
||||
Returns *this.
|
||||
*/
|
||||
options_description& add(const options_description& desc);
|
||||
|
||||
/** Find the maximum width of the option column, including options
|
||||
in groups. */
|
||||
unsigned get_option_column_width() const;
|
||||
|
||||
public:
|
||||
/** Returns an object of implementation-defined type suitable for adding
|
||||
options to options_description. The returned object will
|
||||
have overloaded operator() with parameter type matching
|
||||
'option_description' constructors. Calling the operator will create
|
||||
new option_description instance and add it.
|
||||
*/
|
||||
options_description_easy_init add_options();
|
||||
|
||||
const option_description& find(const std::string& name,
|
||||
bool approx,
|
||||
bool long_ignore_case = false,
|
||||
bool short_ignore_case = false) const;
|
||||
|
||||
const option_description* find_nothrow(const std::string& name,
|
||||
bool approx,
|
||||
bool long_ignore_case = false,
|
||||
bool short_ignore_case = false) const;
|
||||
|
||||
|
||||
const std::vector< shared_ptr<option_description> >& options() const;
|
||||
|
||||
/** Produces a human readable output of 'desc', listing options,
|
||||
their descriptions and allowed parameters. Other options_description
|
||||
instances previously passed to add will be output separately. */
|
||||
friend BOOST_PROGRAM_OPTIONS_DECL std::ostream& operator<<(std::ostream& os,
|
||||
const options_description& desc);
|
||||
|
||||
/** Outputs 'desc' to the specified stream, calling 'f' to output each
|
||||
option_description element. */
|
||||
void print(std::ostream& os, unsigned width = 0) const;
|
||||
|
||||
private:
|
||||
#if BOOST_WORKAROUND(BOOST_MSVC, BOOST_TESTED_AT(1800))
|
||||
// prevent warning C4512: assignment operator could not be generated
|
||||
options_description& operator=(const options_description&);
|
||||
#endif
|
||||
|
||||
typedef std::map<std::string, int>::const_iterator name2index_iterator;
|
||||
typedef std::pair<name2index_iterator, name2index_iterator>
|
||||
approximation_range;
|
||||
|
||||
//approximation_range find_approximation(const std::string& prefix) const;
|
||||
|
||||
std::string m_caption;
|
||||
const unsigned m_line_length;
|
||||
const unsigned m_min_description_length;
|
||||
|
||||
// Data organization is chosen because:
|
||||
// - there could be two names for one option
|
||||
// - option_add_proxy needs to know the last added option
|
||||
std::vector< shared_ptr<option_description> > m_options;
|
||||
|
||||
// Whether the option comes from one of declared groups.
|
||||
#if BOOST_WORKAROUND(BOOST_DINKUMWARE_STDLIB, BOOST_TESTED_AT(313))
|
||||
// vector<bool> is buggy there, see
|
||||
// http://support.microsoft.com/default.aspx?scid=kb;en-us;837698
|
||||
std::vector<char> belong_to_group;
|
||||
#else
|
||||
std::vector<bool> belong_to_group;
|
||||
#endif
|
||||
|
||||
std::vector< shared_ptr<options_description> > groups;
|
||||
|
||||
};
|
||||
|
||||
/** Class thrown when duplicate option description is found. */
|
||||
class BOOST_PROGRAM_OPTIONS_DECL duplicate_option_error : public error {
|
||||
public:
|
||||
duplicate_option_error(const std::string& xwhat) : error(xwhat) {}
|
||||
};
|
||||
}}
|
||||
|
||||
#if defined(BOOST_MSVC)
|
||||
# pragma warning (pop)
|
||||
#endif
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,32 @@
|
||||
subroutine grayline(nyear,month,nday,uth,mygrid,nduration,isun)
|
||||
|
||||
character*6 mygrid
|
||||
real LST
|
||||
real lat,lon
|
||||
|
||||
call grid2deg(MyGrid,elon,lat)
|
||||
lon=-elon
|
||||
|
||||
uth0=uth-0.5*nduration/60.0
|
||||
uth1=uth+0.5*nduration/60.0
|
||||
|
||||
call sun(nyear,month,nday,uth0,lon,lat,RASun,DecSun,LST, &
|
||||
AzSun,ElSun0,mjd,day)
|
||||
call sun(nyear,month,nday,uth1,lon,lat,RASun,DecSun,LST, &
|
||||
AzSun,ElSun1,mjd,day)
|
||||
|
||||
elchk=-0.8333
|
||||
isun=-1
|
||||
if(elsun0.lt.elchk .and. elsun1.ge.elchk) then
|
||||
isun=0
|
||||
else if(elsun0.gt.elchk .and. elsun1.le.elchk) then
|
||||
isun=2
|
||||
else if(elsun1.gt.elchk) then
|
||||
isun=1
|
||||
else
|
||||
isun=3
|
||||
endif
|
||||
|
||||
return
|
||||
end subroutine grayline
|
||||
|
||||
@@ -0,0 +1,29 @@
|
||||
// Copyright Daniel Wallin, David Abrahams 2005. 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)
|
||||
|
||||
#ifndef BOOST_PARAMETER_VOID_050329_HPP
|
||||
#define BOOST_PARAMETER_VOID_050329_HPP
|
||||
|
||||
namespace boost { namespace parameter {
|
||||
|
||||
// A placemarker for "no argument passed."
|
||||
// MAINTAINER NOTE: Do not make this into a metafunction
|
||||
struct void_ {};
|
||||
|
||||
namespace aux
|
||||
{
|
||||
|
||||
inline void_& void_reference()
|
||||
{
|
||||
static void_ instance;
|
||||
return instance;
|
||||
}
|
||||
|
||||
} // namespace aux
|
||||
|
||||
}} // namespace boost::parameter
|
||||
|
||||
#endif // BOOST_PARAMETER_VOID_050329_HPP
|
||||
|
||||
@@ -0,0 +1,55 @@
|
||||
integer function savec2(c2name,ntrseconds,f0m1500)
|
||||
|
||||
! Array c0() has complex samples at 1500 Hz sample rate.
|
||||
! WSPR-2: downsample by 1/4 to produce c2, centered at 1500 Hz
|
||||
! WSPR-15: downsample by 1/32 to produce c2, centered at 1612.5 Hz
|
||||
|
||||
parameter (NDMAX=120*1500) !Sample intervals at 1500 Hz rate
|
||||
parameter (MAXFFT=256*1024)
|
||||
|
||||
character*(*) c2name
|
||||
character*14 outfile
|
||||
real*8 f0m1500
|
||||
complex c0
|
||||
complex c1(0:MAXFFT-1)
|
||||
complex c2(0:65535)
|
||||
common/c0com/c0(0:NDMAX-1)
|
||||
|
||||
ntrminutes=ntrseconds/60
|
||||
npts=114*1500
|
||||
nfft1=262144
|
||||
if(ntrminutes.eq.15) then
|
||||
npts=890*1500
|
||||
nfft1=MAXFFT
|
||||
endif
|
||||
df1=1500.0/nfft1
|
||||
fac=1.0/nfft1
|
||||
c1(0:npts-1)=fac*c0(0:npts-1)
|
||||
c1(npts:nfft1-1)=0.
|
||||
|
||||
call four2a(c1,nfft1,1,1,1) !Complex FFT to frequency domain
|
||||
|
||||
! Select the desired frequency range
|
||||
nfft2=65536
|
||||
nh2=nfft2/2
|
||||
if(ntrminutes.eq.2) then
|
||||
c2(0:nh2)=c1(0:nh2)
|
||||
c2(nh2+1:nfft2-1)=c1(nfft1-nh2+1:nfft1-1)
|
||||
else
|
||||
i0=nint(112.5/df1)
|
||||
c2(0:nh2)=c1(i0:i0+nh2)
|
||||
c2(nh2+1:nfft2-1)=c1(i0-nh2+1:i0-1)
|
||||
endif
|
||||
|
||||
call four2a(c2,nfft2,1,-1,1) !Shorter complex FFT, back to time domain
|
||||
|
||||
! Write complex time-domain data to disk.
|
||||
i1=index(c2name,'.c2')
|
||||
outfile=c2name(i1-11:i1+2)
|
||||
open(18,file=c2name,status='unknown',access='stream', iostat=ioerr)
|
||||
if (ioerr.eq.0) then
|
||||
write(18) outfile,ntrminutes,f0m1500,c2(0:45000-1)
|
||||
close(18)
|
||||
endif
|
||||
savec2 = ioerr
|
||||
end function savec2
|
||||
@@ -0,0 +1,26 @@
|
||||
subroutine twkfreq(c3,c4,npts,fsample,a)
|
||||
|
||||
complex c3(npts)
|
||||
complex c4(npts)
|
||||
complex w,wstep
|
||||
real a(3)
|
||||
data twopi/6.283185307/
|
||||
|
||||
! Mix the complex signal
|
||||
w=1.0
|
||||
wstep=1.0
|
||||
x0=0.5*(npts+1)
|
||||
s=2.0/npts
|
||||
do i=1,npts
|
||||
x=s*(i-x0)
|
||||
p2=1.5*x*x - 0.5
|
||||
! p3=2.5*(x**3) - 1.5*x
|
||||
! p4=4.375*(x**4) - 3.75*(x**2) + 0.375
|
||||
dphi=(a(1) + x*a(2) + p2*a(3)) * (twopi/fsample)
|
||||
wstep=cmplx(cos(dphi),sin(dphi))
|
||||
w=w*wstep
|
||||
c4(i)=w*c3(i)
|
||||
enddo
|
||||
|
||||
return
|
||||
end subroutine twkfreq
|
||||
@@ -0,0 +1,40 @@
|
||||
/* Copyright 2003-2013 Joaquin M Lopez Munoz.
|
||||
* Distributed under the Boost Software License, Version 1.0.
|
||||
* (See accompanying file LICENSE_1_0.txt or copy at
|
||||
* http://www.boost.org/LICENSE_1_0.txt)
|
||||
*
|
||||
* See http://www.boost.org/libs/multi_index for library home page.
|
||||
*/
|
||||
|
||||
#ifndef BOOST_MULTI_INDEX_DETAIL_IS_INDEX_LIST_HPP
|
||||
#define BOOST_MULTI_INDEX_DETAIL_IS_INDEX_LIST_HPP
|
||||
|
||||
#if defined(_MSC_VER)
|
||||
#pragma once
|
||||
#endif
|
||||
|
||||
#include <boost/config.hpp> /* keep it first to prevent nasty warns in MSVC */
|
||||
#include <boost/mpl/empty.hpp>
|
||||
#include <boost/mpl/is_sequence.hpp>
|
||||
|
||||
namespace boost{
|
||||
|
||||
namespace multi_index{
|
||||
|
||||
namespace detail{
|
||||
|
||||
template<typename T>
|
||||
struct is_index_list
|
||||
{
|
||||
BOOST_STATIC_CONSTANT(bool,mpl_sequence=mpl::is_sequence<T>::value);
|
||||
BOOST_STATIC_CONSTANT(bool,non_empty=!mpl::empty<T>::value);
|
||||
BOOST_STATIC_CONSTANT(bool,value=mpl_sequence&&non_empty);
|
||||
};
|
||||
|
||||
} /* namespace multi_index::detail */
|
||||
|
||||
} /* namespace multi_index */
|
||||
|
||||
} /* namespace boost */
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,35 @@
|
||||
|
||||
#ifndef BOOST_MPL_AUX_NTTP_DECL_HPP_INCLUDED
|
||||
#define BOOST_MPL_AUX_NTTP_DECL_HPP_INCLUDED
|
||||
|
||||
// Copyright Aleksey Gurtovoy 2001-2004
|
||||
//
|
||||
// Distributed under the Boost Software License, Version 1.0.
|
||||
// (See accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
//
|
||||
// See http://www.boost.org/libs/mpl for documentation.
|
||||
|
||||
// $Id$
|
||||
// $Date$
|
||||
// $Revision$
|
||||
|
||||
#include <boost/mpl/aux_/config/nttp.hpp>
|
||||
|
||||
#if defined(BOOST_MPL_CFG_NTTP_BUG)
|
||||
|
||||
typedef bool _mpl_nttp_bool;
|
||||
typedef int _mpl_nttp_int;
|
||||
typedef unsigned _mpl_nttp_unsigned;
|
||||
typedef long _mpl_nttp_long;
|
||||
|
||||
# include <boost/preprocessor/cat.hpp>
|
||||
# define BOOST_MPL_AUX_NTTP_DECL(T, x) BOOST_PP_CAT(_mpl_nttp_,T) x /**/
|
||||
|
||||
#else
|
||||
|
||||
# define BOOST_MPL_AUX_NTTP_DECL(T, x) T x /**/
|
||||
|
||||
#endif
|
||||
|
||||
#endif // BOOST_MPL_AUX_NTTP_DECL_HPP_INCLUDED
|
||||
@@ -0,0 +1,272 @@
|
||||
//
|
||||
// Copyright (c) Antony Polukhin, 2013-2015.
|
||||
//
|
||||
//
|
||||
// Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
//
|
||||
|
||||
#ifndef BOOST_TYPE_INDEX_STL_TYPE_INDEX_HPP
|
||||
#define BOOST_TYPE_INDEX_STL_TYPE_INDEX_HPP
|
||||
|
||||
/// \file stl_type_index.hpp
|
||||
/// \brief Contains boost::typeindex::stl_type_index class.
|
||||
///
|
||||
/// boost::typeindex::stl_type_index class can be used as a drop-in replacement
|
||||
/// for std::type_index.
|
||||
///
|
||||
/// It is used in situations when RTTI is enabled or typeid() method is available.
|
||||
/// When typeid() is disabled or BOOST_TYPE_INDEX_FORCE_NO_RTTI_COMPATIBILITY macro
|
||||
/// is defined boost::typeindex::ctti is usually used instead of boost::typeindex::stl_type_index.
|
||||
|
||||
#include <boost/type_index/type_index_facade.hpp>
|
||||
|
||||
// MSVC is capable of calling typeid(T) even when RTTI is off
|
||||
#if defined(BOOST_NO_RTTI) && !defined(BOOST_MSVC)
|
||||
#error "File boost/type_index/stl_type_index.ipp is not usable when typeid() is not available."
|
||||
#endif
|
||||
|
||||
#include <typeinfo>
|
||||
#include <cstring> // std::strcmp, std::strlen, std::strstr
|
||||
#include <stdexcept>
|
||||
#include <boost/static_assert.hpp>
|
||||
#include <boost/throw_exception.hpp>
|
||||
#include <boost/core/demangle.hpp>
|
||||
#include <boost/type_traits/is_const.hpp>
|
||||
#include <boost/type_traits/is_reference.hpp>
|
||||
#include <boost/type_traits/is_volatile.hpp>
|
||||
#include <boost/type_traits/remove_cv.hpp>
|
||||
#include <boost/type_traits/remove_reference.hpp>
|
||||
#include <boost/mpl/if.hpp>
|
||||
#include <boost/mpl/or.hpp>
|
||||
|
||||
#if (defined(__EDG_VERSION__) && __EDG_VERSION__ < 245) \
|
||||
|| (defined(__sgi) && defined(_COMPILER_VERSION) && _COMPILER_VERSION <= 744)
|
||||
# include <boost/type_traits/is_signed.hpp>
|
||||
# include <boost/type_traits/make_signed.hpp>
|
||||
# include <boost/mpl/identity.hpp>
|
||||
#endif
|
||||
|
||||
#ifdef BOOST_HAS_PRAGMA_ONCE
|
||||
# pragma once
|
||||
#endif
|
||||
|
||||
namespace boost { namespace typeindex {
|
||||
|
||||
/// \class stl_type_index
|
||||
/// This class is a wrapper around std::type_info, that workarounds issues and provides
|
||||
/// much more rich interface. \b For \b description \b of \b functions \b see type_index_facade.
|
||||
///
|
||||
/// This class requires typeid() to work. For cases when RTTI is disabled see ctti_type_index.
|
||||
class stl_type_index
|
||||
: public type_index_facade<
|
||||
stl_type_index,
|
||||
#ifdef BOOST_NO_STD_TYPEINFO
|
||||
type_info
|
||||
#else
|
||||
std::type_info
|
||||
#endif
|
||||
>
|
||||
{
|
||||
public:
|
||||
#ifdef BOOST_NO_STD_TYPEINFO
|
||||
typedef type_info type_info_t;
|
||||
#else
|
||||
typedef std::type_info type_info_t;
|
||||
#endif
|
||||
|
||||
private:
|
||||
const type_info_t* data_;
|
||||
|
||||
public:
|
||||
inline stl_type_index() BOOST_NOEXCEPT
|
||||
: data_(&typeid(void))
|
||||
{}
|
||||
|
||||
inline stl_type_index(const type_info_t& data) BOOST_NOEXCEPT
|
||||
: data_(&data)
|
||||
{}
|
||||
|
||||
inline const type_info_t& type_info() const BOOST_NOEXCEPT;
|
||||
|
||||
inline const char* raw_name() const BOOST_NOEXCEPT;
|
||||
inline const char* name() const BOOST_NOEXCEPT;
|
||||
inline std::string pretty_name() const;
|
||||
|
||||
inline std::size_t hash_code() const BOOST_NOEXCEPT;
|
||||
inline bool equal(const stl_type_index& rhs) const BOOST_NOEXCEPT;
|
||||
inline bool before(const stl_type_index& rhs) const BOOST_NOEXCEPT;
|
||||
|
||||
template <class T>
|
||||
inline static stl_type_index type_id() BOOST_NOEXCEPT;
|
||||
|
||||
template <class T>
|
||||
inline static stl_type_index type_id_with_cvr() BOOST_NOEXCEPT;
|
||||
|
||||
template <class T>
|
||||
inline static stl_type_index type_id_runtime(const T& value) BOOST_NOEXCEPT;
|
||||
};
|
||||
|
||||
inline const stl_type_index::type_info_t& stl_type_index::type_info() const BOOST_NOEXCEPT {
|
||||
return *data_;
|
||||
}
|
||||
|
||||
|
||||
inline const char* stl_type_index::raw_name() const BOOST_NOEXCEPT {
|
||||
#ifdef _MSC_VER
|
||||
return data_->raw_name();
|
||||
#else
|
||||
return data_->name();
|
||||
#endif
|
||||
}
|
||||
|
||||
inline const char* stl_type_index::name() const BOOST_NOEXCEPT {
|
||||
return data_->name();
|
||||
}
|
||||
|
||||
inline std::string stl_type_index::pretty_name() const {
|
||||
static const char cvr_saver_name[] = "boost::typeindex::detail::cvr_saver<";
|
||||
static BOOST_CONSTEXPR_OR_CONST std::string::size_type cvr_saver_name_len = sizeof(cvr_saver_name) - 1;
|
||||
|
||||
// In case of MSVC demangle() is a no-op, and name() already returns demangled name.
|
||||
// In case of GCC and Clang (on non-Windows systems) name() returns mangled name and demangle() undecorates it.
|
||||
const boost::core::scoped_demangled_name demangled_name(data_->name());
|
||||
|
||||
const char* begin = demangled_name.get();
|
||||
if (!begin) {
|
||||
boost::throw_exception(std::runtime_error("Type name demangling failed"));
|
||||
}
|
||||
|
||||
const std::string::size_type len = std::strlen(begin);
|
||||
const char* end = begin + len;
|
||||
|
||||
if (len > cvr_saver_name_len) {
|
||||
const char* b = std::strstr(begin, cvr_saver_name);
|
||||
if (b) {
|
||||
b += cvr_saver_name_len;
|
||||
|
||||
// Trim leading spaces
|
||||
while (*b == ' ') { // the string is zero terminated, we won't exceed the buffer size
|
||||
++ b;
|
||||
}
|
||||
|
||||
// Skip the closing angle bracket
|
||||
const char* e = end - 1;
|
||||
while (e > b && *e != '>') {
|
||||
-- e;
|
||||
}
|
||||
|
||||
// Trim trailing spaces
|
||||
while (e > b && *(e - 1) == ' ') {
|
||||
-- e;
|
||||
}
|
||||
|
||||
if (b < e) {
|
||||
// Parsing seems to have succeeded, the type name is not empty
|
||||
begin = b;
|
||||
end = e;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return std::string(begin, end);
|
||||
}
|
||||
|
||||
|
||||
inline std::size_t stl_type_index::hash_code() const BOOST_NOEXCEPT {
|
||||
#if _MSC_VER > 1600 || (__GNUC__ == 4 && __GNUC_MINOR__ > 5 && defined(__GXX_EXPERIMENTAL_CXX0X__))
|
||||
return data_->hash_code();
|
||||
#else
|
||||
return boost::hash_range(raw_name(), raw_name() + std::strlen(raw_name()));
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
/// @cond
|
||||
|
||||
// for this compiler at least, cross-shared-library type_info
|
||||
// comparisons don't work, so we are using typeid(x).name() instead.
|
||||
# if (defined(__GNUC__) && (__GNUC__ < 4 || (__GNUC__ == 4 && __GNUC_MINOR__ < 5))) \
|
||||
|| defined(_AIX) \
|
||||
|| (defined(__sgi) && defined(__host_mips)) \
|
||||
|| (defined(__hpux) && defined(__HP_aCC)) \
|
||||
|| (defined(linux) && defined(__INTEL_COMPILER) && defined(__ICC))
|
||||
# define BOOST_CLASSINFO_COMPARE_BY_NAMES
|
||||
# endif
|
||||
|
||||
/// @endcond
|
||||
|
||||
inline bool stl_type_index::equal(const stl_type_index& rhs) const BOOST_NOEXCEPT {
|
||||
#ifdef BOOST_CLASSINFO_COMPARE_BY_NAMES
|
||||
return raw_name() == rhs.raw_name() || !std::strcmp(raw_name(), rhs.raw_name());
|
||||
#else
|
||||
return !!(*data_ == *rhs.data_);
|
||||
#endif
|
||||
}
|
||||
|
||||
inline bool stl_type_index::before(const stl_type_index& rhs) const BOOST_NOEXCEPT {
|
||||
#ifdef BOOST_CLASSINFO_COMPARE_BY_NAMES
|
||||
return raw_name() != rhs.raw_name() && std::strcmp(raw_name(), rhs.raw_name()) < 0;
|
||||
#else
|
||||
return !!data_->before(*rhs.data_);
|
||||
#endif
|
||||
}
|
||||
|
||||
#ifdef BOOST_CLASSINFO_COMPARE_BY_NAMES
|
||||
#undef BOOST_CLASSINFO_COMPARE_BY_NAMES
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
template <class T>
|
||||
inline stl_type_index stl_type_index::type_id() BOOST_NOEXCEPT {
|
||||
typedef BOOST_DEDUCED_TYPENAME boost::remove_reference<T>::type no_ref_t;
|
||||
typedef BOOST_DEDUCED_TYPENAME boost::remove_cv<no_ref_t>::type no_cvr_prefinal_t;
|
||||
|
||||
# if (defined(__EDG_VERSION__) && __EDG_VERSION__ < 245) \
|
||||
|| (defined(__sgi) && defined(_COMPILER_VERSION) && _COMPILER_VERSION <= 744)
|
||||
|
||||
// Old EDG-based compilers seem to mistakenly distinguish 'integral' from 'signed integral'
|
||||
// in typeid() expressions. Full template specialization for 'integral' fixes that issue:
|
||||
typedef BOOST_DEDUCED_TYPENAME boost::mpl::if_<
|
||||
boost::is_signed<no_cvr_prefinal_t>,
|
||||
boost::make_signed<no_cvr_prefinal_t>,
|
||||
boost::mpl::identity<no_cvr_prefinal_t>
|
||||
>::type no_cvr_prefinal_lazy_t;
|
||||
|
||||
typedef BOOST_DEDUCED_TYPENAME no_cvr_prefinal_t::type no_cvr_t;
|
||||
#else
|
||||
typedef no_cvr_prefinal_t no_cvr_t;
|
||||
#endif
|
||||
|
||||
return typeid(no_cvr_t);
|
||||
}
|
||||
|
||||
namespace detail {
|
||||
template <class T> class cvr_saver{};
|
||||
}
|
||||
|
||||
template <class T>
|
||||
inline stl_type_index stl_type_index::type_id_with_cvr() BOOST_NOEXCEPT {
|
||||
typedef BOOST_DEDUCED_TYPENAME boost::mpl::if_<
|
||||
boost::mpl::or_<boost::is_reference<T>, boost::is_const<T>, boost::is_volatile<T> >,
|
||||
detail::cvr_saver<T>,
|
||||
T
|
||||
>::type type;
|
||||
|
||||
return typeid(type);
|
||||
}
|
||||
|
||||
|
||||
template <class T>
|
||||
inline stl_type_index stl_type_index::type_id_runtime(const T& value) BOOST_NOEXCEPT {
|
||||
#ifdef BOOST_NO_RTTI
|
||||
return value.boost_type_index_type_id_runtime_();
|
||||
#else
|
||||
return typeid(value);
|
||||
#endif
|
||||
}
|
||||
|
||||
}} // namespace boost::typeindex
|
||||
|
||||
#endif // BOOST_TYPE_INDEX_STL_TYPE_INDEX_HPP
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,295 @@
|
||||
|
||||
// Copyright Aleksey Gurtovoy 2000-2004
|
||||
//
|
||||
// Distributed under the Boost Software License, Version 1.0.
|
||||
// (See accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
//
|
||||
|
||||
// Preprocessed version of "boost/mpl/aux_/reverse_iter_fold_impl.hpp" header
|
||||
// -- DO NOT modify by hand!
|
||||
|
||||
namespace boost { namespace mpl { namespace aux {
|
||||
|
||||
/// forward declaration
|
||||
|
||||
template<
|
||||
long N
|
||||
, typename First
|
||||
, typename Last
|
||||
, typename State
|
||||
, typename BackwardOp
|
||||
, typename ForwardOp
|
||||
>
|
||||
struct reverse_iter_fold_impl;
|
||||
|
||||
template< long N >
|
||||
struct reverse_iter_fold_chunk;
|
||||
|
||||
template<> struct reverse_iter_fold_chunk<0>
|
||||
{
|
||||
template<
|
||||
typename First
|
||||
, typename Last
|
||||
, typename State
|
||||
, typename BackwardOp
|
||||
, typename ForwardOp
|
||||
>
|
||||
struct result_
|
||||
{
|
||||
typedef First iter0;
|
||||
typedef State fwd_state0;
|
||||
typedef fwd_state0 bkwd_state0;
|
||||
typedef bkwd_state0 state;
|
||||
typedef iter0 iterator;
|
||||
};
|
||||
};
|
||||
|
||||
template<> struct reverse_iter_fold_chunk<1>
|
||||
{
|
||||
template<
|
||||
typename First
|
||||
, typename Last
|
||||
, typename State
|
||||
, typename BackwardOp
|
||||
, typename ForwardOp
|
||||
>
|
||||
struct result_
|
||||
{
|
||||
typedef First iter0;
|
||||
typedef State fwd_state0;
|
||||
typedef typename apply2< ForwardOp,fwd_state0,iter0 >::type fwd_state1;
|
||||
typedef typename mpl::next<iter0>::type iter1;
|
||||
|
||||
|
||||
typedef fwd_state1 bkwd_state1;
|
||||
typedef typename apply2< BackwardOp,bkwd_state1,iter0 >::type bkwd_state0;
|
||||
typedef bkwd_state0 state;
|
||||
typedef iter1 iterator;
|
||||
};
|
||||
};
|
||||
|
||||
template<> struct reverse_iter_fold_chunk<2>
|
||||
{
|
||||
template<
|
||||
typename First
|
||||
, typename Last
|
||||
, typename State
|
||||
, typename BackwardOp
|
||||
, typename ForwardOp
|
||||
>
|
||||
struct result_
|
||||
{
|
||||
typedef First iter0;
|
||||
typedef State fwd_state0;
|
||||
typedef typename apply2< ForwardOp,fwd_state0,iter0 >::type fwd_state1;
|
||||
typedef typename mpl::next<iter0>::type iter1;
|
||||
typedef typename apply2< ForwardOp,fwd_state1,iter1 >::type fwd_state2;
|
||||
typedef typename mpl::next<iter1>::type iter2;
|
||||
|
||||
|
||||
typedef fwd_state2 bkwd_state2;
|
||||
typedef typename apply2< BackwardOp,bkwd_state2,iter1 >::type bkwd_state1;
|
||||
typedef typename apply2< BackwardOp,bkwd_state1,iter0 >::type bkwd_state0;
|
||||
|
||||
|
||||
typedef bkwd_state0 state;
|
||||
typedef iter2 iterator;
|
||||
};
|
||||
};
|
||||
|
||||
template<> struct reverse_iter_fold_chunk<3>
|
||||
{
|
||||
template<
|
||||
typename First
|
||||
, typename Last
|
||||
, typename State
|
||||
, typename BackwardOp
|
||||
, typename ForwardOp
|
||||
>
|
||||
struct result_
|
||||
{
|
||||
typedef First iter0;
|
||||
typedef State fwd_state0;
|
||||
typedef typename apply2< ForwardOp,fwd_state0,iter0 >::type fwd_state1;
|
||||
typedef typename mpl::next<iter0>::type iter1;
|
||||
typedef typename apply2< ForwardOp,fwd_state1,iter1 >::type fwd_state2;
|
||||
typedef typename mpl::next<iter1>::type iter2;
|
||||
typedef typename apply2< ForwardOp,fwd_state2,iter2 >::type fwd_state3;
|
||||
typedef typename mpl::next<iter2>::type iter3;
|
||||
|
||||
|
||||
typedef fwd_state3 bkwd_state3;
|
||||
typedef typename apply2< BackwardOp,bkwd_state3,iter2 >::type bkwd_state2;
|
||||
typedef typename apply2< BackwardOp,bkwd_state2,iter1 >::type bkwd_state1;
|
||||
typedef typename apply2< BackwardOp,bkwd_state1,iter0 >::type bkwd_state0;
|
||||
|
||||
|
||||
typedef bkwd_state0 state;
|
||||
typedef iter3 iterator;
|
||||
};
|
||||
};
|
||||
|
||||
template<> struct reverse_iter_fold_chunk<4>
|
||||
{
|
||||
template<
|
||||
typename First
|
||||
, typename Last
|
||||
, typename State
|
||||
, typename BackwardOp
|
||||
, typename ForwardOp
|
||||
>
|
||||
struct result_
|
||||
{
|
||||
typedef First iter0;
|
||||
typedef State fwd_state0;
|
||||
typedef typename apply2< ForwardOp,fwd_state0,iter0 >::type fwd_state1;
|
||||
typedef typename mpl::next<iter0>::type iter1;
|
||||
typedef typename apply2< ForwardOp,fwd_state1,iter1 >::type fwd_state2;
|
||||
typedef typename mpl::next<iter1>::type iter2;
|
||||
typedef typename apply2< ForwardOp,fwd_state2,iter2 >::type fwd_state3;
|
||||
typedef typename mpl::next<iter2>::type iter3;
|
||||
typedef typename apply2< ForwardOp,fwd_state3,iter3 >::type fwd_state4;
|
||||
typedef typename mpl::next<iter3>::type iter4;
|
||||
|
||||
|
||||
typedef fwd_state4 bkwd_state4;
|
||||
typedef typename apply2< BackwardOp,bkwd_state4,iter3 >::type bkwd_state3;
|
||||
typedef typename apply2< BackwardOp,bkwd_state3,iter2 >::type bkwd_state2;
|
||||
typedef typename apply2< BackwardOp,bkwd_state2,iter1 >::type bkwd_state1;
|
||||
typedef typename apply2< BackwardOp,bkwd_state1,iter0 >::type bkwd_state0;
|
||||
|
||||
|
||||
typedef bkwd_state0 state;
|
||||
typedef iter4 iterator;
|
||||
};
|
||||
};
|
||||
|
||||
template< long N >
|
||||
struct reverse_iter_fold_chunk
|
||||
{
|
||||
template<
|
||||
typename First
|
||||
, typename Last
|
||||
, typename State
|
||||
, typename BackwardOp
|
||||
, typename ForwardOp
|
||||
>
|
||||
struct result_
|
||||
{
|
||||
typedef First iter0;
|
||||
typedef State fwd_state0;
|
||||
typedef typename apply2< ForwardOp,fwd_state0,iter0 >::type fwd_state1;
|
||||
typedef typename mpl::next<iter0>::type iter1;
|
||||
typedef typename apply2< ForwardOp,fwd_state1,iter1 >::type fwd_state2;
|
||||
typedef typename mpl::next<iter1>::type iter2;
|
||||
typedef typename apply2< ForwardOp,fwd_state2,iter2 >::type fwd_state3;
|
||||
typedef typename mpl::next<iter2>::type iter3;
|
||||
typedef typename apply2< ForwardOp,fwd_state3,iter3 >::type fwd_state4;
|
||||
typedef typename mpl::next<iter3>::type iter4;
|
||||
|
||||
|
||||
typedef reverse_iter_fold_impl<
|
||||
( (N - 4) < 0 ? 0 : N - 4 )
|
||||
, iter4
|
||||
, Last
|
||||
, fwd_state4
|
||||
, BackwardOp
|
||||
, ForwardOp
|
||||
> nested_chunk;
|
||||
|
||||
typedef typename nested_chunk::state bkwd_state4;
|
||||
typedef typename apply2< BackwardOp,bkwd_state4,iter3 >::type bkwd_state3;
|
||||
typedef typename apply2< BackwardOp,bkwd_state3,iter2 >::type bkwd_state2;
|
||||
typedef typename apply2< BackwardOp,bkwd_state2,iter1 >::type bkwd_state1;
|
||||
typedef typename apply2< BackwardOp,bkwd_state1,iter0 >::type bkwd_state0;
|
||||
|
||||
|
||||
typedef bkwd_state0 state;
|
||||
typedef typename nested_chunk::iterator iterator;
|
||||
};
|
||||
};
|
||||
|
||||
template<
|
||||
typename First
|
||||
, typename Last
|
||||
, typename State
|
||||
, typename BackwardOp
|
||||
, typename ForwardOp
|
||||
>
|
||||
struct reverse_iter_fold_step;
|
||||
|
||||
template<
|
||||
typename Last
|
||||
, typename State
|
||||
>
|
||||
struct reverse_iter_fold_null_step
|
||||
{
|
||||
typedef Last iterator;
|
||||
typedef State state;
|
||||
};
|
||||
|
||||
template<>
|
||||
struct reverse_iter_fold_chunk< -1 >
|
||||
{
|
||||
template<
|
||||
typename First
|
||||
, typename Last
|
||||
, typename State
|
||||
, typename BackwardOp
|
||||
, typename ForwardOp
|
||||
>
|
||||
struct result_
|
||||
{
|
||||
typedef typename if_<
|
||||
typename is_same< First,Last >::type
|
||||
, reverse_iter_fold_null_step< Last,State >
|
||||
, reverse_iter_fold_step< First,Last,State,BackwardOp,ForwardOp >
|
||||
>::type res_;
|
||||
|
||||
typedef typename res_::state state;
|
||||
typedef typename res_::iterator iterator;
|
||||
};
|
||||
};
|
||||
|
||||
template<
|
||||
typename First
|
||||
, typename Last
|
||||
, typename State
|
||||
, typename BackwardOp
|
||||
, typename ForwardOp
|
||||
>
|
||||
struct reverse_iter_fold_step
|
||||
{
|
||||
typedef reverse_iter_fold_chunk< -1 >::template result_<
|
||||
typename mpl::next<First>::type
|
||||
, Last
|
||||
, typename apply2< ForwardOp,State,First >::type
|
||||
, BackwardOp
|
||||
, ForwardOp
|
||||
> nested_step;
|
||||
|
||||
typedef typename apply2<
|
||||
BackwardOp
|
||||
, typename nested_step::state
|
||||
, First
|
||||
>::type state;
|
||||
|
||||
typedef typename nested_step::iterator iterator;
|
||||
};
|
||||
|
||||
template<
|
||||
long N
|
||||
, typename First
|
||||
, typename Last
|
||||
, typename State
|
||||
, typename BackwardOp
|
||||
, typename ForwardOp
|
||||
>
|
||||
struct reverse_iter_fold_impl
|
||||
: reverse_iter_fold_chunk<N>
|
||||
::template result_< First,Last,State,BackwardOp,ForwardOp >
|
||||
{
|
||||
};
|
||||
|
||||
}}}
|
||||
@@ -0,0 +1,161 @@
|
||||
// (C) Copyright 2008-10 Anthony Williams
|
||||
// (C) Copyright 2011-2015 Vicente J. Botet Escriba
|
||||
//
|
||||
// Distributed under the Boost Software License, Version 1.0. (See
|
||||
// accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
#ifndef BOOST_THREAD_FUTURES_WAIT_FOR_ANY_HPP
|
||||
#define BOOST_THREAD_FUTURES_WAIT_FOR_ANY_HPP
|
||||
|
||||
#include <boost/thread/detail/config.hpp>
|
||||
|
||||
#include <boost/thread/detail/move.hpp>
|
||||
#include <boost/thread/futures/is_future_type.hpp>
|
||||
#include <boost/thread/lock_algorithms.hpp>
|
||||
#include <boost/thread/mutex.hpp>
|
||||
|
||||
#include <boost/core/enable_if.hpp>
|
||||
#include <boost/next_prior.hpp>
|
||||
#include <boost/scoped_array.hpp>
|
||||
|
||||
#include <iterator>
|
||||
#include <vector>
|
||||
|
||||
namespace boost
|
||||
{
|
||||
namespace detail
|
||||
{
|
||||
template <class Future>
|
||||
class waiter_for_any_in_seq
|
||||
{
|
||||
struct registered_waiter;
|
||||
typedef std::vector<int>::size_type count_type;
|
||||
|
||||
struct registered_waiter
|
||||
{
|
||||
typedef Future future_type;
|
||||
future_type* future_;
|
||||
typedef typename Future::notify_when_ready_handle notify_when_ready_handle;
|
||||
notify_when_ready_handle handle;
|
||||
count_type index;
|
||||
|
||||
registered_waiter(future_type & a_future,
|
||||
notify_when_ready_handle handle_, count_type index_) :
|
||||
future_(&a_future), handle(handle_), index(index_)
|
||||
{
|
||||
}
|
||||
};
|
||||
|
||||
struct all_futures_lock
|
||||
{
|
||||
#ifdef _MANAGED
|
||||
typedef std::ptrdiff_t count_type_portable;
|
||||
#else
|
||||
typedef count_type count_type_portable;
|
||||
#endif
|
||||
count_type_portable count;
|
||||
boost::scoped_array<boost::unique_lock<boost::mutex> > locks;
|
||||
|
||||
all_futures_lock(std::vector<registered_waiter>& waiters) :
|
||||
count(waiters.size()), locks(new boost::unique_lock<boost::mutex>[count])
|
||||
{
|
||||
for (count_type_portable i = 0; i < count; ++i)
|
||||
{
|
||||
locks[i] = BOOST_THREAD_MAKE_RV_REF(boost::unique_lock<boost::mutex>(waiters[i].future_->mutex()));
|
||||
}
|
||||
}
|
||||
|
||||
void lock()
|
||||
{
|
||||
boost::lock(locks.get(), locks.get() + count);
|
||||
}
|
||||
|
||||
void unlock()
|
||||
{
|
||||
for (count_type_portable i = 0; i < count; ++i)
|
||||
{
|
||||
locks[i].unlock();
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
boost::condition_variable_any cv;
|
||||
std::vector<registered_waiter> waiters_;
|
||||
count_type future_count;
|
||||
|
||||
public:
|
||||
waiter_for_any_in_seq() :
|
||||
future_count(0)
|
||||
{
|
||||
}
|
||||
|
||||
template <typename F>
|
||||
void add(F& f)
|
||||
{
|
||||
if (f.valid())
|
||||
{
|
||||
registered_waiter waiter(f, f.notify_when_ready(cv), future_count);
|
||||
try
|
||||
{
|
||||
waiters_.push_back(waiter);
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
f.future_->unnotify_when_ready(waiter.handle);
|
||||
throw;
|
||||
}
|
||||
++future_count;
|
||||
}
|
||||
}
|
||||
|
||||
#ifndef BOOST_NO_CXX11_VARIADIC_TEMPLATES
|
||||
template <typename F1, typename ... Fs>
|
||||
void add(F1& f1, Fs&... fs)
|
||||
{
|
||||
add(f1);
|
||||
add(fs...);
|
||||
}
|
||||
#endif
|
||||
|
||||
count_type wait()
|
||||
{
|
||||
all_futures_lock lk(waiters_);
|
||||
for (;;)
|
||||
{
|
||||
for (count_type i = 0; i < waiters_.size(); ++i)
|
||||
{
|
||||
if (waiters_[i].future_->is_ready(lk.locks[i]))
|
||||
{
|
||||
return waiters_[i].index;
|
||||
}
|
||||
}
|
||||
cv.wait(lk);
|
||||
}
|
||||
}
|
||||
|
||||
~waiter_for_any_in_seq()
|
||||
{
|
||||
for (count_type i = 0; i < waiters_.size(); ++i)
|
||||
{
|
||||
waiters_[i].future_->unnotify_when_ready(waiters_[i].handle);
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
template <typename Iterator>
|
||||
typename boost::disable_if<is_future_type<Iterator> , Iterator>::type wait_for_any(Iterator begin, Iterator end)
|
||||
{
|
||||
if (begin == end) return end;
|
||||
|
||||
detail::waiter_for_any_in_seq<typename std::iterator_traits<Iterator>::value_type> waiter;
|
||||
for (Iterator current = begin; current != end; ++current)
|
||||
{
|
||||
waiter.add(*current);
|
||||
}
|
||||
return boost::next(begin, waiter.wait());
|
||||
}
|
||||
}
|
||||
|
||||
#endif // header
|
||||
@@ -0,0 +1,62 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2001-2011 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(FUSION_DISTANCE_IMPL_13122005_2139)
|
||||
#define FUSION_DISTANCE_IMPL_13122005_2139
|
||||
|
||||
#include <boost/fusion/support/config.hpp>
|
||||
#include <boost/fusion/iterator/distance.hpp>
|
||||
|
||||
namespace boost { namespace fusion {
|
||||
|
||||
struct transform_view_iterator_tag;
|
||||
struct transform_view_iterator2_tag;
|
||||
|
||||
namespace extension
|
||||
{
|
||||
template<typename Tag>
|
||||
struct distance_impl;
|
||||
|
||||
// Unary Version
|
||||
template<>
|
||||
struct distance_impl<transform_view_iterator_tag>
|
||||
{
|
||||
template<typename First, typename Last>
|
||||
struct apply
|
||||
: result_of::distance<typename First::first_type, typename Last::first_type>
|
||||
{
|
||||
BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
|
||||
static
|
||||
typename result_of::distance<typename First::first_type, typename Last::first_type>::type
|
||||
call(First const& first, Last const& last)
|
||||
{
|
||||
return boost::fusion::distance(first.first, last.first);
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
// Binary Version
|
||||
template<>
|
||||
struct distance_impl<transform_view_iterator2_tag>
|
||||
{
|
||||
template<typename First, typename Last>
|
||||
struct apply
|
||||
: result_of::distance<typename First::first1_type, typename Last::first1_type>
|
||||
{
|
||||
BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
|
||||
static
|
||||
typename result_of::distance<typename First::first1_type, typename Last::first1_type>::type
|
||||
call(First const& first, Last const& last)
|
||||
{
|
||||
return boost::fusion::distance(first.first1, last.first1);
|
||||
}
|
||||
};
|
||||
};
|
||||
}
|
||||
}}
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,712 @@
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// Copyright 2013 John Maddock
|
||||
// Distributed under the Boost
|
||||
// Software License, Version 1.0. (See accompanying file
|
||||
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
#ifndef BOOST_MATH_BERNOULLI_DETAIL_HPP
|
||||
#define BOOST_MATH_BERNOULLI_DETAIL_HPP
|
||||
|
||||
#include <boost/config.hpp>
|
||||
#include <boost/detail/lightweight_mutex.hpp>
|
||||
#include <boost/utility/enable_if.hpp>
|
||||
#include <boost/math/tools/toms748_solve.hpp>
|
||||
#include <vector>
|
||||
|
||||
#ifdef BOOST_HAS_THREADS
|
||||
|
||||
#ifndef BOOST_NO_CXX11_HDR_ATOMIC
|
||||
# include <atomic>
|
||||
# define BOOST_MATH_ATOMIC_NS std
|
||||
#if ATOMIC_INT_LOCK_FREE == 2
|
||||
typedef std::atomic<int> atomic_counter_type;
|
||||
typedef int atomic_integer_type;
|
||||
#elif ATOMIC_SHORT_LOCK_FREE == 2
|
||||
typedef std::atomic<short> atomic_counter_type;
|
||||
typedef short atomic_integer_type;
|
||||
#elif ATOMIC_LONG_LOCK_FREE == 2
|
||||
typedef std::atomic<long> atomic_counter_type;
|
||||
typedef long atomic_integer_type;
|
||||
#elif ATOMIC_LLONG_LOCK_FREE == 2
|
||||
typedef std::atomic<long long> atomic_counter_type;
|
||||
typedef long long atomic_integer_type;
|
||||
#else
|
||||
# define BOOST_MATH_NO_ATOMIC_INT
|
||||
#endif
|
||||
|
||||
#else // BOOST_NO_CXX11_HDR_ATOMIC
|
||||
//
|
||||
// We need Boost.Atomic, but on any platform that supports auto-linking we do
|
||||
// not need to link against a separate library:
|
||||
//
|
||||
#define BOOST_ATOMIC_NO_LIB
|
||||
#include <boost/atomic.hpp>
|
||||
# define BOOST_MATH_ATOMIC_NS boost
|
||||
|
||||
namespace boost{ namespace math{ namespace detail{
|
||||
|
||||
//
|
||||
// We need a type to use as an atomic counter:
|
||||
//
|
||||
#if BOOST_ATOMIC_INT_LOCK_FREE == 2
|
||||
typedef boost::atomic<int> atomic_counter_type;
|
||||
typedef int atomic_integer_type;
|
||||
#elif BOOST_ATOMIC_SHORT_LOCK_FREE == 2
|
||||
typedef boost::atomic<short> atomic_counter_type;
|
||||
typedef short atomic_integer_type;
|
||||
#elif BOOST_ATOMIC_LONG_LOCK_FREE == 2
|
||||
typedef boost::atomic<long> atomic_counter_type;
|
||||
typedef long atomic_integer_type;
|
||||
#elif BOOST_ATOMIC_LLONG_LOCK_FREE == 2
|
||||
typedef boost::atomic<long long> atomic_counter_type;
|
||||
typedef long long atomic_integer_type;
|
||||
#else
|
||||
# define BOOST_MATH_NO_ATOMIC_INT
|
||||
#endif
|
||||
|
||||
}}} // namespaces
|
||||
|
||||
#endif // BOOST_NO_CXX11_HDR_ATOMIC
|
||||
|
||||
#endif // BOOST_HAS_THREADS
|
||||
|
||||
namespace boost{ namespace math{ namespace detail{
|
||||
//
|
||||
// Asymptotic expansion for B2n due to
|
||||
// Luschny LogB3 formula (http://www.luschny.de/math/primes/bernincl.html)
|
||||
//
|
||||
template <class T, class Policy>
|
||||
T b2n_asymptotic(int n)
|
||||
{
|
||||
BOOST_MATH_STD_USING
|
||||
const T nx = static_cast<T>(n);
|
||||
const T nx2(nx * nx);
|
||||
|
||||
const T approximate_log_of_bernoulli_bn =
|
||||
((boost::math::constants::half<T>() + nx) * log(nx))
|
||||
+ ((boost::math::constants::half<T>() - nx) * log(boost::math::constants::pi<T>()))
|
||||
+ (((T(3) / 2) - nx) * boost::math::constants::ln_two<T>())
|
||||
+ ((nx * (T(2) - (nx2 * 7) * (1 + ((nx2 * 30) * ((nx2 * 12) - 1))))) / (((nx2 * nx2) * nx2) * 2520));
|
||||
return ((n / 2) & 1 ? 1 : -1) * (approximate_log_of_bernoulli_bn > tools::log_max_value<T>()
|
||||
? policies::raise_overflow_error<T>("boost::math::bernoulli_b2n<%1%>(std::size_t)", 0, nx, Policy())
|
||||
: static_cast<T>(exp(approximate_log_of_bernoulli_bn)));
|
||||
}
|
||||
|
||||
template <class T, class Policy>
|
||||
T t2n_asymptotic(int n)
|
||||
{
|
||||
BOOST_MATH_STD_USING
|
||||
// Just get B2n and convert to a Tangent number:
|
||||
T t2n = fabs(b2n_asymptotic<T, Policy>(2 * n)) / (2 * n);
|
||||
T p2 = ldexp(T(1), n);
|
||||
if(tools::max_value<T>() / p2 < t2n)
|
||||
return policies::raise_overflow_error<T>("boost::math::tangent_t2n<%1%>(std::size_t)", 0, T(n), Policy());
|
||||
t2n *= p2;
|
||||
p2 -= 1;
|
||||
if(tools::max_value<T>() / p2 < t2n)
|
||||
return policies::raise_overflow_error<T>("boost::math::tangent_t2n<%1%>(std::size_t)", 0, Policy());
|
||||
t2n *= p2;
|
||||
return t2n;
|
||||
}
|
||||
//
|
||||
// We need to know the approximate value of /n/ which will
|
||||
// cause bernoulli_b2n<T>(n) to return infinity - this allows
|
||||
// us to elude a great deal of runtime checking for values below
|
||||
// n, and only perform the full overflow checks when we know that we're
|
||||
// getting close to the point where our calculations will overflow.
|
||||
// We use Luschny's LogB3 formula (http://www.luschny.de/math/primes/bernincl.html)
|
||||
// to find the limit, and since we're dealing with the log of the Bernoulli numbers
|
||||
// we need only perform the calculation at double precision and not with T
|
||||
// (which may be a multiprecision type). The limit returned is within 1 of the true
|
||||
// limit for all the types tested. Note that although the code below is basically
|
||||
// the same as b2n_asymptotic above, it has been recast as a continuous real-valued
|
||||
// function as this makes the root finding go smoother/faster. It also omits the
|
||||
// sign of the Bernoulli number.
|
||||
//
|
||||
struct max_bernoulli_root_functor
|
||||
{
|
||||
max_bernoulli_root_functor(long long t) : target(static_cast<double>(t)) {}
|
||||
double operator()(double n)
|
||||
{
|
||||
BOOST_MATH_STD_USING
|
||||
|
||||
// Luschny LogB3(n) formula.
|
||||
|
||||
const double nx2(n * n);
|
||||
|
||||
const double approximate_log_of_bernoulli_bn
|
||||
= ((boost::math::constants::half<double>() + n) * log(n))
|
||||
+ ((boost::math::constants::half<double>() - n) * log(boost::math::constants::pi<double>()))
|
||||
+ (((double(3) / 2) - n) * boost::math::constants::ln_two<double>())
|
||||
+ ((n * (2 - (nx2 * 7) * (1 + ((nx2 * 30) * ((nx2 * 12) - 1))))) / (((nx2 * nx2) * nx2) * 2520));
|
||||
|
||||
return approximate_log_of_bernoulli_bn - target;
|
||||
}
|
||||
private:
|
||||
double target;
|
||||
};
|
||||
|
||||
template <class T, class Policy>
|
||||
inline std::size_t find_bernoulli_overflow_limit(const mpl::false_&)
|
||||
{
|
||||
long long t = lltrunc(boost::math::tools::log_max_value<T>());
|
||||
max_bernoulli_root_functor fun(t);
|
||||
boost::math::tools::equal_floor tol;
|
||||
boost::uintmax_t max_iter = boost::math::policies::get_max_root_iterations<Policy>();
|
||||
return static_cast<std::size_t>(boost::math::tools::toms748_solve(fun, sqrt(double(t)), double(t), tol, max_iter).first) / 2;
|
||||
}
|
||||
|
||||
template <class T, class Policy>
|
||||
inline std::size_t find_bernoulli_overflow_limit(const mpl::true_&)
|
||||
{
|
||||
return max_bernoulli_index<bernoulli_imp_variant<T>::value>::value;
|
||||
}
|
||||
|
||||
template <class T, class Policy>
|
||||
std::size_t b2n_overflow_limit()
|
||||
{
|
||||
// This routine is called at program startup if it's called at all:
|
||||
// that guarantees safe initialization of the static variable.
|
||||
typedef mpl::bool_<(bernoulli_imp_variant<T>::value >= 1) && (bernoulli_imp_variant<T>::value <= 3)> tag_type;
|
||||
static const std::size_t lim = find_bernoulli_overflow_limit<T, Policy>(tag_type());
|
||||
return lim;
|
||||
}
|
||||
|
||||
//
|
||||
// The tangent numbers grow larger much more rapidly than the Bernoulli numbers do....
|
||||
// so to compute the Bernoulli numbers from the tangent numbers, we need to avoid spurious
|
||||
// overflow in the calculation, we can do this by scaling all the tangent number by some scale factor:
|
||||
//
|
||||
template <class T>
|
||||
inline typename enable_if_c<std::numeric_limits<T>::is_specialized && (std::numeric_limits<T>::radix == 2), T>::type tangent_scale_factor()
|
||||
{
|
||||
BOOST_MATH_STD_USING
|
||||
return ldexp(T(1), std::numeric_limits<T>::min_exponent + 5);
|
||||
}
|
||||
template <class T>
|
||||
inline typename disable_if_c<std::numeric_limits<T>::is_specialized && (std::numeric_limits<T>::radix == 2), T>::type tangent_scale_factor()
|
||||
{
|
||||
return tools::min_value<T>() * 16;
|
||||
}
|
||||
//
|
||||
// Initializer: ensure all our constants are initialized prior to the first call of main:
|
||||
//
|
||||
template <class T, class Policy>
|
||||
struct bernoulli_initializer
|
||||
{
|
||||
struct init
|
||||
{
|
||||
init()
|
||||
{
|
||||
//
|
||||
// We call twice, once to initialize our static table, and once to
|
||||
// initialize our dymanic table:
|
||||
//
|
||||
boost::math::bernoulli_b2n<T>(2, Policy());
|
||||
#ifndef BOOST_NO_EXCEPTIONS
|
||||
try{
|
||||
#endif
|
||||
boost::math::bernoulli_b2n<T>(max_bernoulli_b2n<T>::value + 1, Policy());
|
||||
#ifndef BOOST_NO_EXCEPTIONS
|
||||
} catch(const std::overflow_error&){}
|
||||
#endif
|
||||
boost::math::tangent_t2n<T>(2, Policy());
|
||||
}
|
||||
void force_instantiate()const{}
|
||||
};
|
||||
static const init initializer;
|
||||
static void force_instantiate()
|
||||
{
|
||||
initializer.force_instantiate();
|
||||
}
|
||||
};
|
||||
|
||||
template <class T, class Policy>
|
||||
const typename bernoulli_initializer<T, Policy>::init bernoulli_initializer<T, Policy>::initializer;
|
||||
|
||||
//
|
||||
// We need something to act as a cache for our calculated Bernoulli numbers. In order to
|
||||
// ensure both fast access and thread safety, we need a stable table which may be extended
|
||||
// in size, but which never reallocates: that way values already calculated may be accessed
|
||||
// concurrently with another thread extending the table with new values.
|
||||
//
|
||||
// Very very simple vector class that will never allocate more than once, we could use
|
||||
// boost::container::static_vector here, but that allocates on the stack, which may well
|
||||
// cause issues for the amount of memory we want in the extreme case...
|
||||
//
|
||||
template <class T>
|
||||
struct fixed_vector : private std::allocator<T>
|
||||
{
|
||||
typedef unsigned size_type;
|
||||
typedef T* iterator;
|
||||
typedef const T* const_iterator;
|
||||
fixed_vector() : m_used(0)
|
||||
{
|
||||
std::size_t overflow_limit = 5 + b2n_overflow_limit<T, policies::policy<> >();
|
||||
m_capacity = static_cast<unsigned>((std::min)(overflow_limit, static_cast<std::size_t>(100000u)));
|
||||
m_data = this->allocate(m_capacity);
|
||||
}
|
||||
~fixed_vector()
|
||||
{
|
||||
for(unsigned i = 0; i < m_used; ++i)
|
||||
this->destroy(&m_data[i]);
|
||||
this->deallocate(m_data, m_capacity);
|
||||
}
|
||||
T& operator[](unsigned n) { BOOST_ASSERT(n < m_used); return m_data[n]; }
|
||||
const T& operator[](unsigned n)const { BOOST_ASSERT(n < m_used); return m_data[n]; }
|
||||
unsigned size()const { return m_used; }
|
||||
unsigned size() { return m_used; }
|
||||
void resize(unsigned n, const T& val)
|
||||
{
|
||||
if(n > m_capacity)
|
||||
{
|
||||
BOOST_THROW_EXCEPTION(std::runtime_error("Exhausted storage for Bernoulli numbers."));
|
||||
}
|
||||
for(unsigned i = m_used; i < n; ++i)
|
||||
new (m_data + i) T(val);
|
||||
m_used = n;
|
||||
}
|
||||
void resize(unsigned n) { resize(n, T()); }
|
||||
T* begin() { return m_data; }
|
||||
T* end() { return m_data + m_used; }
|
||||
T* begin()const { return m_data; }
|
||||
T* end()const { return m_data + m_used; }
|
||||
unsigned capacity()const { return m_capacity; }
|
||||
void clear() { m_used = 0; }
|
||||
private:
|
||||
T* m_data;
|
||||
unsigned m_used, m_capacity;
|
||||
};
|
||||
|
||||
template <class T, class Policy>
|
||||
class bernoulli_numbers_cache
|
||||
{
|
||||
public:
|
||||
bernoulli_numbers_cache() : m_overflow_limit((std::numeric_limits<std::size_t>::max)())
|
||||
#if defined(BOOST_HAS_THREADS) && !defined(BOOST_MATH_NO_ATOMIC_INT)
|
||||
, m_counter(0)
|
||||
#endif
|
||||
, m_current_precision(boost::math::tools::digits<T>())
|
||||
{}
|
||||
|
||||
typedef fixed_vector<T> container_type;
|
||||
|
||||
void tangent(std::size_t m)
|
||||
{
|
||||
static const std::size_t min_overflow_index = b2n_overflow_limit<T, Policy>() - 1;
|
||||
tn.resize(static_cast<typename container_type::size_type>(m), T(0U));
|
||||
|
||||
BOOST_MATH_INSTRUMENT_VARIABLE(min_overflow_index);
|
||||
|
||||
std::size_t prev_size = m_intermediates.size();
|
||||
m_intermediates.resize(m, T(0U));
|
||||
|
||||
if(prev_size == 0)
|
||||
{
|
||||
m_intermediates[1] = tangent_scale_factor<T>() /*T(1U)*/;
|
||||
tn[0U] = T(0U);
|
||||
tn[1U] = tangent_scale_factor<T>()/* T(1U)*/;
|
||||
BOOST_MATH_INSTRUMENT_VARIABLE(tn[0]);
|
||||
BOOST_MATH_INSTRUMENT_VARIABLE(tn[1]);
|
||||
}
|
||||
|
||||
for(std::size_t i = std::max<size_t>(2, prev_size); i < m; i++)
|
||||
{
|
||||
bool overflow_check = false;
|
||||
if(i >= min_overflow_index && (boost::math::tools::max_value<T>() / (i-1) < m_intermediates[1]) )
|
||||
{
|
||||
std::fill(tn.begin() + i, tn.end(), boost::math::tools::max_value<T>());
|
||||
break;
|
||||
}
|
||||
m_intermediates[1] = m_intermediates[1] * (i-1);
|
||||
for(std::size_t j = 2; j <= i; j++)
|
||||
{
|
||||
overflow_check =
|
||||
(i >= min_overflow_index) && (
|
||||
(boost::math::tools::max_value<T>() / (i - j) < m_intermediates[j])
|
||||
|| (boost::math::tools::max_value<T>() / (i - j + 2) < m_intermediates[j-1])
|
||||
|| (boost::math::tools::max_value<T>() - m_intermediates[j] * (i - j) < m_intermediates[j-1] * (i - j + 2))
|
||||
|| ((boost::math::isinf)(m_intermediates[j]))
|
||||
);
|
||||
|
||||
if(overflow_check)
|
||||
{
|
||||
std::fill(tn.begin() + i, tn.end(), boost::math::tools::max_value<T>());
|
||||
break;
|
||||
}
|
||||
m_intermediates[j] = m_intermediates[j] * (i - j) + m_intermediates[j-1] * (i - j + 2);
|
||||
}
|
||||
if(overflow_check)
|
||||
break; // already filled the tn...
|
||||
tn[static_cast<typename container_type::size_type>(i)] = m_intermediates[i];
|
||||
BOOST_MATH_INSTRUMENT_VARIABLE(i);
|
||||
BOOST_MATH_INSTRUMENT_VARIABLE(tn[static_cast<typename container_type::size_type>(i)]);
|
||||
}
|
||||
}
|
||||
|
||||
void tangent_numbers_series(const std::size_t m)
|
||||
{
|
||||
BOOST_MATH_STD_USING
|
||||
static const std::size_t min_overflow_index = b2n_overflow_limit<T, Policy>() - 1;
|
||||
|
||||
typename container_type::size_type old_size = bn.size();
|
||||
|
||||
tangent(m);
|
||||
bn.resize(static_cast<typename container_type::size_type>(m));
|
||||
|
||||
if(!old_size)
|
||||
{
|
||||
bn[0] = 1;
|
||||
old_size = 1;
|
||||
}
|
||||
|
||||
T power_two(ldexp(T(1), static_cast<int>(2 * old_size)));
|
||||
|
||||
for(std::size_t i = old_size; i < m; i++)
|
||||
{
|
||||
T b(static_cast<T>(i * 2));
|
||||
//
|
||||
// Not only do we need to take care to avoid spurious over/under flow in
|
||||
// the calculation, but we also need to avoid overflow altogether in case
|
||||
// we're calculating with a type where "bad things" happen in that case:
|
||||
//
|
||||
b = b / (power_two * tangent_scale_factor<T>());
|
||||
b /= (power_two - 1);
|
||||
bool overflow_check = (i >= min_overflow_index) && (tools::max_value<T>() / tn[static_cast<typename container_type::size_type>(i)] < b);
|
||||
if(overflow_check)
|
||||
{
|
||||
m_overflow_limit = i;
|
||||
while(i < m)
|
||||
{
|
||||
b = std::numeric_limits<T>::has_infinity ? std::numeric_limits<T>::infinity() : tools::max_value<T>();
|
||||
bn[static_cast<typename container_type::size_type>(i)] = ((i % 2U) ? b : T(-b));
|
||||
++i;
|
||||
}
|
||||
break;
|
||||
}
|
||||
else
|
||||
{
|
||||
b *= tn[static_cast<typename container_type::size_type>(i)];
|
||||
}
|
||||
|
||||
power_two = ldexp(power_two, 2);
|
||||
|
||||
const bool b_neg = i % 2 == 0;
|
||||
|
||||
bn[static_cast<typename container_type::size_type>(i)] = ((!b_neg) ? b : T(-b));
|
||||
}
|
||||
}
|
||||
|
||||
template <class OutputIterator>
|
||||
OutputIterator copy_bernoulli_numbers(OutputIterator out, std::size_t start, std::size_t n, const Policy& pol)
|
||||
{
|
||||
//
|
||||
// There are basically 3 thread safety options:
|
||||
//
|
||||
// 1) There are no threads (BOOST_HAS_THREADS is not defined).
|
||||
// 2) There are threads, but we do not have a true atomic integer type,
|
||||
// in this case we just use a mutex to guard against race conditions.
|
||||
// 3) There are threads, and we have an atomic integer: in this case we can
|
||||
// use the double-checked locking pattern to avoid thread synchronisation
|
||||
// when accessing values already in the cache.
|
||||
//
|
||||
// First off handle the common case for overflow and/or asymptotic expansion:
|
||||
//
|
||||
if(start + n > bn.capacity())
|
||||
{
|
||||
if(start < bn.capacity())
|
||||
{
|
||||
out = copy_bernoulli_numbers(out, start, bn.capacity() - start, pol);
|
||||
n -= bn.capacity() - start;
|
||||
start = static_cast<std::size_t>(bn.capacity());
|
||||
}
|
||||
if(start < b2n_overflow_limit<T, Policy>() + 2u)
|
||||
{
|
||||
for(; n; ++start, --n)
|
||||
{
|
||||
*out = b2n_asymptotic<T, Policy>(static_cast<typename container_type::size_type>(start * 2U));
|
||||
++out;
|
||||
}
|
||||
}
|
||||
for(; n; ++start, --n)
|
||||
{
|
||||
*out = policies::raise_overflow_error<T>("boost::math::bernoulli_b2n<%1%>(std::size_t)", 0, T(start), pol);
|
||||
++out;
|
||||
}
|
||||
return out;
|
||||
}
|
||||
#if !defined(BOOST_HAS_THREADS)
|
||||
//
|
||||
// Single threaded code, very simple:
|
||||
//
|
||||
if(m_current_precision < boost::math::tools::digits<T>())
|
||||
{
|
||||
bn.clear();
|
||||
tn.clear();
|
||||
m_intermediates.clear();
|
||||
m_current_precision = boost::math::tools::digits<T>();
|
||||
}
|
||||
if(start + n >= bn.size())
|
||||
{
|
||||
std::size_t new_size = (std::min)((std::max)((std::max)(std::size_t(start + n), std::size_t(bn.size() + 20)), std::size_t(50)), std::size_t(bn.capacity()));
|
||||
tangent_numbers_series(new_size);
|
||||
}
|
||||
|
||||
for(std::size_t i = (std::max)(std::size_t(max_bernoulli_b2n<T>::value + 1), start); i < start + n; ++i)
|
||||
{
|
||||
*out = (i >= m_overflow_limit) ? policies::raise_overflow_error<T>("boost::math::bernoulli_b2n<%1%>(std::size_t)", 0, T(i), pol) : bn[i];
|
||||
++out;
|
||||
}
|
||||
#elif defined(BOOST_MATH_NO_ATOMIC_INT)
|
||||
//
|
||||
// We need to grab a mutex every time we get here, for both readers and writers:
|
||||
//
|
||||
boost::detail::lightweight_mutex::scoped_lock l(m_mutex);
|
||||
if(m_current_precision < boost::math::tools::digits<T>())
|
||||
{
|
||||
bn.clear();
|
||||
tn.clear();
|
||||
m_intermediates.clear();
|
||||
m_current_precision = boost::math::tools::digits<T>();
|
||||
}
|
||||
if(start + n >= bn.size())
|
||||
{
|
||||
std::size_t new_size = (std::min)((std::max)((std::max)(std::size_t(start + n), std::size_t(bn.size() + 20)), std::size_t(50)), std::size_t(bn.capacity()));
|
||||
tangent_numbers_series(new_size);
|
||||
}
|
||||
|
||||
for(std::size_t i = (std::max)(std::size_t(max_bernoulli_b2n<T>::value + 1), start); i < start + n; ++i)
|
||||
{
|
||||
*out = (i >= m_overflow_limit) ? policies::raise_overflow_error<T>("boost::math::bernoulli_b2n<%1%>(std::size_t)", 0, T(i), pol) : bn[i];
|
||||
++out;
|
||||
}
|
||||
|
||||
#else
|
||||
//
|
||||
// Double-checked locking pattern, lets us access cached already cached values
|
||||
// without locking:
|
||||
//
|
||||
// Get the counter and see if we need to calculate more constants:
|
||||
//
|
||||
if((static_cast<std::size_t>(m_counter.load(BOOST_MATH_ATOMIC_NS::memory_order_consume)) < start + n)
|
||||
|| (static_cast<int>(m_current_precision.load(BOOST_MATH_ATOMIC_NS::memory_order_consume)) < boost::math::tools::digits<T>()))
|
||||
{
|
||||
boost::detail::lightweight_mutex::scoped_lock l(m_mutex);
|
||||
|
||||
if((static_cast<std::size_t>(m_counter.load(BOOST_MATH_ATOMIC_NS::memory_order_consume)) < start + n)
|
||||
|| (static_cast<int>(m_current_precision.load(BOOST_MATH_ATOMIC_NS::memory_order_consume)) < boost::math::tools::digits<T>()))
|
||||
{
|
||||
if(static_cast<int>(m_current_precision.load(BOOST_MATH_ATOMIC_NS::memory_order_consume)) < boost::math::tools::digits<T>())
|
||||
{
|
||||
bn.clear();
|
||||
tn.clear();
|
||||
m_intermediates.clear();
|
||||
m_counter.store(0, BOOST_MATH_ATOMIC_NS::memory_order_release);
|
||||
m_current_precision = boost::math::tools::digits<T>();
|
||||
}
|
||||
if(start + n >= bn.size())
|
||||
{
|
||||
std::size_t new_size = (std::min)((std::max)((std::max)(std::size_t(start + n), std::size_t(bn.size() + 20)), std::size_t(50)), std::size_t(bn.capacity()));
|
||||
tangent_numbers_series(new_size);
|
||||
}
|
||||
m_counter.store(static_cast<atomic_integer_type>(bn.size()), BOOST_MATH_ATOMIC_NS::memory_order_release);
|
||||
}
|
||||
}
|
||||
|
||||
for(std::size_t i = (std::max)(static_cast<std::size_t>(max_bernoulli_b2n<T>::value + 1), start); i < start + n; ++i)
|
||||
{
|
||||
*out = (i >= m_overflow_limit) ? policies::raise_overflow_error<T>("boost::math::bernoulli_b2n<%1%>(std::size_t)", 0, T(i), pol) : bn[static_cast<typename container_type::size_type>(i)];
|
||||
++out;
|
||||
}
|
||||
|
||||
#endif
|
||||
return out;
|
||||
}
|
||||
|
||||
template <class OutputIterator>
|
||||
OutputIterator copy_tangent_numbers(OutputIterator out, std::size_t start, std::size_t n, const Policy& pol)
|
||||
{
|
||||
//
|
||||
// There are basically 3 thread safety options:
|
||||
//
|
||||
// 1) There are no threads (BOOST_HAS_THREADS is not defined).
|
||||
// 2) There are threads, but we do not have a true atomic integer type,
|
||||
// in this case we just use a mutex to guard against race conditions.
|
||||
// 3) There are threads, and we have an atomic integer: in this case we can
|
||||
// use the double-checked locking pattern to avoid thread synchronisation
|
||||
// when accessing values already in the cache.
|
||||
//
|
||||
//
|
||||
// First off handle the common case for overflow and/or asymptotic expansion:
|
||||
//
|
||||
if(start + n > bn.capacity())
|
||||
{
|
||||
if(start < bn.capacity())
|
||||
{
|
||||
out = copy_tangent_numbers(out, start, bn.capacity() - start, pol);
|
||||
n -= bn.capacity() - start;
|
||||
start = static_cast<std::size_t>(bn.capacity());
|
||||
}
|
||||
if(start < b2n_overflow_limit<T, Policy>() + 2u)
|
||||
{
|
||||
for(; n; ++start, --n)
|
||||
{
|
||||
*out = t2n_asymptotic<T, Policy>(static_cast<typename container_type::size_type>(start));
|
||||
++out;
|
||||
}
|
||||
}
|
||||
for(; n; ++start, --n)
|
||||
{
|
||||
*out = policies::raise_overflow_error<T>("boost::math::bernoulli_b2n<%1%>(std::size_t)", 0, T(start), pol);
|
||||
++out;
|
||||
}
|
||||
return out;
|
||||
}
|
||||
#if !defined(BOOST_HAS_THREADS)
|
||||
//
|
||||
// Single threaded code, very simple:
|
||||
//
|
||||
if(m_current_precision < boost::math::tools::digits<T>())
|
||||
{
|
||||
bn.clear();
|
||||
tn.clear();
|
||||
m_intermediates.clear();
|
||||
m_current_precision = boost::math::tools::digits<T>();
|
||||
}
|
||||
if(start + n >= bn.size())
|
||||
{
|
||||
std::size_t new_size = (std::min)((std::max)((std::max)(start + n, std::size_t(bn.size() + 20)), std::size_t(50)), std::size_t(bn.capacity()));
|
||||
tangent_numbers_series(new_size);
|
||||
}
|
||||
|
||||
for(std::size_t i = start; i < start + n; ++i)
|
||||
{
|
||||
if(i >= m_overflow_limit)
|
||||
*out = policies::raise_overflow_error<T>("boost::math::bernoulli_b2n<%1%>(std::size_t)", 0, T(i), pol);
|
||||
else
|
||||
{
|
||||
if(tools::max_value<T>() * tangent_scale_factor<T>() < tn[static_cast<typename container_type::size_type>(i)])
|
||||
*out = policies::raise_overflow_error<T>("boost::math::bernoulli_b2n<%1%>(std::size_t)", 0, T(i), pol);
|
||||
else
|
||||
*out = tn[static_cast<typename container_type::size_type>(i)] / tangent_scale_factor<T>();
|
||||
}
|
||||
++out;
|
||||
}
|
||||
#elif defined(BOOST_MATH_NO_ATOMIC_INT)
|
||||
//
|
||||
// We need to grab a mutex every time we get here, for both readers and writers:
|
||||
//
|
||||
boost::detail::lightweight_mutex::scoped_lock l(m_mutex);
|
||||
if(m_current_precision < boost::math::tools::digits<T>())
|
||||
{
|
||||
bn.clear();
|
||||
tn.clear();
|
||||
m_intermediates.clear();
|
||||
m_current_precision = boost::math::tools::digits<T>();
|
||||
}
|
||||
if(start + n >= bn.size())
|
||||
{
|
||||
std::size_t new_size = (std::min)((std::max)((std::max)(start + n, std::size_t(bn.size() + 20)), std::size_t(50)), std::size_t(bn.capacity()));
|
||||
tangent_numbers_series(new_size);
|
||||
}
|
||||
|
||||
for(std::size_t i = start; i < start + n; ++i)
|
||||
{
|
||||
if(i >= m_overflow_limit)
|
||||
*out = policies::raise_overflow_error<T>("boost::math::bernoulli_b2n<%1%>(std::size_t)", 0, T(i), pol);
|
||||
else
|
||||
{
|
||||
if(tools::max_value<T>() * tangent_scale_factor<T>() < tn[static_cast<typename container_type::size_type>(i)])
|
||||
*out = policies::raise_overflow_error<T>("boost::math::bernoulli_b2n<%1%>(std::size_t)", 0, T(i), pol);
|
||||
else
|
||||
*out = tn[static_cast<typename container_type::size_type>(i)] / tangent_scale_factor<T>();
|
||||
}
|
||||
++out;
|
||||
}
|
||||
|
||||
#else
|
||||
//
|
||||
// Double-checked locking pattern, lets us access cached already cached values
|
||||
// without locking:
|
||||
//
|
||||
// Get the counter and see if we need to calculate more constants:
|
||||
//
|
||||
if((static_cast<std::size_t>(m_counter.load(BOOST_MATH_ATOMIC_NS::memory_order_consume)) < start + n)
|
||||
|| (static_cast<int>(m_current_precision.load(BOOST_MATH_ATOMIC_NS::memory_order_consume)) < boost::math::tools::digits<T>()))
|
||||
{
|
||||
boost::detail::lightweight_mutex::scoped_lock l(m_mutex);
|
||||
|
||||
if((static_cast<std::size_t>(m_counter.load(BOOST_MATH_ATOMIC_NS::memory_order_consume)) < start + n)
|
||||
|| (static_cast<int>(m_current_precision.load(BOOST_MATH_ATOMIC_NS::memory_order_consume)) < boost::math::tools::digits<T>()))
|
||||
{
|
||||
if(static_cast<int>(m_current_precision.load(BOOST_MATH_ATOMIC_NS::memory_order_consume)) < boost::math::tools::digits<T>())
|
||||
{
|
||||
bn.clear();
|
||||
tn.clear();
|
||||
m_intermediates.clear();
|
||||
m_counter.store(0, BOOST_MATH_ATOMIC_NS::memory_order_release);
|
||||
m_current_precision = boost::math::tools::digits<T>();
|
||||
}
|
||||
if(start + n >= bn.size())
|
||||
{
|
||||
std::size_t new_size = (std::min)((std::max)((std::max)(start + n, std::size_t(bn.size() + 20)), std::size_t(50)), std::size_t(bn.capacity()));
|
||||
tangent_numbers_series(new_size);
|
||||
}
|
||||
m_counter.store(static_cast<atomic_integer_type>(bn.size()), BOOST_MATH_ATOMIC_NS::memory_order_release);
|
||||
}
|
||||
}
|
||||
|
||||
for(std::size_t i = start; i < start + n; ++i)
|
||||
{
|
||||
if(i >= m_overflow_limit)
|
||||
*out = policies::raise_overflow_error<T>("boost::math::bernoulli_b2n<%1%>(std::size_t)", 0, T(i), pol);
|
||||
else
|
||||
{
|
||||
if(tools::max_value<T>() * tangent_scale_factor<T>() < tn[static_cast<typename container_type::size_type>(i)])
|
||||
*out = policies::raise_overflow_error<T>("boost::math::bernoulli_b2n<%1%>(std::size_t)", 0, T(i), pol);
|
||||
else
|
||||
*out = tn[static_cast<typename container_type::size_type>(i)] / tangent_scale_factor<T>();
|
||||
}
|
||||
++out;
|
||||
}
|
||||
|
||||
#endif
|
||||
return out;
|
||||
}
|
||||
|
||||
private:
|
||||
//
|
||||
// The caches for Bernoulli and tangent numbers, once allocated,
|
||||
// these must NEVER EVER reallocate as it breaks our thread
|
||||
// safety guarantees:
|
||||
//
|
||||
fixed_vector<T> bn, tn;
|
||||
std::vector<T> m_intermediates;
|
||||
// The value at which we know overflow has already occurred for the Bn:
|
||||
std::size_t m_overflow_limit;
|
||||
#if !defined(BOOST_HAS_THREADS)
|
||||
int m_current_precision;
|
||||
#elif defined(BOOST_MATH_NO_ATOMIC_INT)
|
||||
boost::detail::lightweight_mutex m_mutex;
|
||||
int m_current_precision;
|
||||
#else
|
||||
boost::detail::lightweight_mutex m_mutex;
|
||||
atomic_counter_type m_counter, m_current_precision;
|
||||
#endif
|
||||
};
|
||||
|
||||
template <class T, class Policy>
|
||||
inline bernoulli_numbers_cache<T, Policy>& get_bernoulli_numbers_cache()
|
||||
{
|
||||
//
|
||||
// Force this function to be called at program startup so all the static variables
|
||||
// get initailzed then (thread safety).
|
||||
//
|
||||
bernoulli_initializer<T, Policy>::force_instantiate();
|
||||
static bernoulli_numbers_cache<T, Policy> data;
|
||||
return data;
|
||||
}
|
||||
|
||||
}}}
|
||||
|
||||
#endif // BOOST_MATH_BERNOULLI_DETAIL_HPP
|
||||
@@ -0,0 +1,30 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2001-2011 Joel de Guzman
|
||||
|
||||
Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
==============================================================================*/
|
||||
#if !defined(FUSION_DEREF_IMPL_05062005_0905)
|
||||
#define FUSION_DEREF_IMPL_05062005_0905
|
||||
|
||||
#include <boost/fusion/support/config.hpp>
|
||||
#include <boost/fusion/iterator/detail/adapt_deref_traits.hpp>
|
||||
|
||||
namespace boost { namespace fusion
|
||||
{
|
||||
struct filter_view_iterator_tag;
|
||||
|
||||
namespace extension
|
||||
{
|
||||
template <typename Tag>
|
||||
struct deref_impl;
|
||||
|
||||
template <>
|
||||
struct deref_impl<filter_view_iterator_tag>
|
||||
: detail::adapt_deref_traits {};
|
||||
}
|
||||
}}
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
@@ -0,0 +1,13 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2001-2007 Joel de Guzman
|
||||
|
||||
Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
==============================================================================*/
|
||||
#if !defined(FUSION_INCLUDE_PRIOR)
|
||||
#define FUSION_INCLUDE_PRIOR
|
||||
|
||||
#include <boost/fusion/support/config.hpp>
|
||||
#include <boost/fusion/iterator/prior.hpp>
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,105 @@
|
||||
#if !defined(BOOST_PROTO_DONT_USE_PREPROCESSED_FILES)
|
||||
|
||||
#include <boost/proto/detail/preprocessed/make_expr_.hpp>
|
||||
|
||||
#elif !defined(BOOST_PP_IS_ITERATING)
|
||||
|
||||
#if defined(__WAVE__) && defined(BOOST_PROTO_CREATE_PREPROCESSED_FILES)
|
||||
#pragma wave option(preserve: 2, line: 0, output: "preprocessed/make_expr_.hpp")
|
||||
#endif
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
/// \file make_expr_.hpp
|
||||
/// Contains definition of make_expr_\<\> class template.
|
||||
//
|
||||
// Copyright 2008 Eric Niebler. Distributed under the Boost
|
||||
// Software License, Version 1.0. (See accompanying file
|
||||
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
#if defined(__WAVE__) && defined(BOOST_PROTO_CREATE_PREPROCESSED_FILES)
|
||||
#pragma wave option(preserve: 1)
|
||||
#endif
|
||||
|
||||
template<
|
||||
typename Tag
|
||||
, typename Domain
|
||||
BOOST_PP_ENUM_TRAILING_BINARY_PARAMS(
|
||||
BOOST_PROTO_MAX_ARITY
|
||||
, typename A
|
||||
, = void BOOST_PP_INTERCEPT
|
||||
)
|
||||
, typename _ = void
|
||||
>
|
||||
struct make_expr_
|
||||
{};
|
||||
|
||||
template<typename Domain, typename A>
|
||||
struct make_expr_<tag::terminal, Domain, A
|
||||
BOOST_PP_ENUM_TRAILING_PARAMS(BOOST_PROTO_MAX_ARITY, void BOOST_PP_INTERCEPT)>
|
||||
{
|
||||
typedef typename proto::detail::protoify<A, Domain>::result_type result_type;
|
||||
|
||||
BOOST_FORCEINLINE
|
||||
result_type operator()(typename add_reference<A>::type a) const
|
||||
{
|
||||
return proto::detail::protoify<A, Domain>()(a);
|
||||
}
|
||||
};
|
||||
|
||||
template<typename A>
|
||||
struct make_expr_<tag::terminal, deduce_domain, A
|
||||
BOOST_PP_ENUM_TRAILING_PARAMS(BOOST_PROTO_MAX_ARITY, void BOOST_PP_INTERCEPT)>
|
||||
: make_expr_<tag::terminal, default_domain, A>
|
||||
{};
|
||||
|
||||
#define BOOST_PP_ITERATION_PARAMS_1 \
|
||||
(3, (1, BOOST_PROTO_MAX_ARITY, <boost/proto/detail/make_expr_.hpp>))
|
||||
#include BOOST_PP_ITERATE()
|
||||
|
||||
#if defined(__WAVE__) && defined(BOOST_PROTO_CREATE_PREPROCESSED_FILES)
|
||||
#pragma wave option(output: null)
|
||||
#endif
|
||||
|
||||
#else // BOOST_PP_IS_ITERATING
|
||||
|
||||
#define N BOOST_PP_ITERATION()
|
||||
#define M BOOST_PP_SUB(BOOST_PROTO_MAX_ARITY, N)
|
||||
|
||||
template<typename Tag, typename Domain BOOST_PP_ENUM_TRAILING_PARAMS(N, typename A)>
|
||||
struct make_expr_<Tag, Domain BOOST_PP_ENUM_TRAILING_PARAMS(N, A)
|
||||
BOOST_PP_ENUM_TRAILING_PARAMS(M, void BOOST_PP_INTERCEPT), void>
|
||||
{
|
||||
typedef
|
||||
BOOST_PP_CAT(list, N)<
|
||||
BOOST_PP_ENUM(N, BOOST_PROTO_AS_CHILD_TYPE, (A, ~, Domain))
|
||||
>
|
||||
proto_args;
|
||||
|
||||
typedef typename base_expr<Domain, Tag, proto_args>::type expr_type;
|
||||
typedef typename Domain::proto_generator proto_generator;
|
||||
typedef typename proto_generator::template result<proto_generator(expr_type)>::type result_type;
|
||||
|
||||
BOOST_FORCEINLINE
|
||||
result_type operator()(BOOST_PP_ENUM_BINARY_PARAMS(N, typename add_reference<A, >::type a)) const
|
||||
{
|
||||
expr_type const that = {
|
||||
BOOST_PP_ENUM(N, BOOST_PROTO_AS_CHILD, (A, a, Domain))
|
||||
};
|
||||
return proto_generator()(that);
|
||||
}
|
||||
};
|
||||
|
||||
template<typename Tag BOOST_PP_ENUM_TRAILING_PARAMS(N, typename A)>
|
||||
struct make_expr_<Tag, deduce_domain BOOST_PP_ENUM_TRAILING_PARAMS(N, A)
|
||||
BOOST_PP_ENUM_TRAILING_PARAMS(M, void BOOST_PP_INTERCEPT), void>
|
||||
: make_expr_<
|
||||
Tag
|
||||
, typename BOOST_PP_CAT(deduce_domain, N)<BOOST_PP_ENUM_PARAMS(N, A)>::type
|
||||
BOOST_PP_ENUM_TRAILING_PARAMS(N, A)
|
||||
>
|
||||
{};
|
||||
|
||||
#undef N
|
||||
#undef M
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,156 @@
|
||||
// boost sinhc.hpp header file
|
||||
|
||||
// (C) Copyright Hubert Holin 2001.
|
||||
// Distributed under the Boost Software License, Version 1.0. (See
|
||||
// accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
// See http://www.boost.org for updates, documentation, and revision history.
|
||||
|
||||
#ifndef BOOST_SINHC_HPP
|
||||
#define BOOST_SINHC_HPP
|
||||
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#pragma once
|
||||
#endif
|
||||
|
||||
#include <boost/math/tools/config.hpp>
|
||||
#include <boost/math/tools/precision.hpp>
|
||||
#include <boost/math/special_functions/math_fwd.hpp>
|
||||
#include <boost/config/no_tr1/cmath.hpp>
|
||||
#include <boost/limits.hpp>
|
||||
#include <string>
|
||||
#include <stdexcept>
|
||||
|
||||
#include <boost/config.hpp>
|
||||
|
||||
|
||||
// These are the the "Hyperbolic Sinus Cardinal" functions.
|
||||
|
||||
namespace boost
|
||||
{
|
||||
namespace math
|
||||
{
|
||||
namespace detail
|
||||
{
|
||||
// This is the "Hyperbolic Sinus Cardinal" of index Pi.
|
||||
|
||||
template<typename T>
|
||||
inline T sinhc_pi_imp(const T x)
|
||||
{
|
||||
#if defined(BOOST_NO_STDC_NAMESPACE) && !defined(__SUNPRO_CC)
|
||||
using ::abs;
|
||||
using ::sinh;
|
||||
using ::sqrt;
|
||||
#else /* BOOST_NO_STDC_NAMESPACE */
|
||||
using ::std::abs;
|
||||
using ::std::sinh;
|
||||
using ::std::sqrt;
|
||||
#endif /* BOOST_NO_STDC_NAMESPACE */
|
||||
|
||||
static T const taylor_0_bound = tools::epsilon<T>();
|
||||
static T const taylor_2_bound = sqrt(taylor_0_bound);
|
||||
static T const taylor_n_bound = sqrt(taylor_2_bound);
|
||||
|
||||
if (abs(x) >= taylor_n_bound)
|
||||
{
|
||||
return(sinh(x)/x);
|
||||
}
|
||||
else
|
||||
{
|
||||
// approximation by taylor series in x at 0 up to order 0
|
||||
T result = static_cast<T>(1);
|
||||
|
||||
if (abs(x) >= taylor_0_bound)
|
||||
{
|
||||
T x2 = x*x;
|
||||
|
||||
// approximation by taylor series in x at 0 up to order 2
|
||||
result += x2/static_cast<T>(6);
|
||||
|
||||
if (abs(x) >= taylor_2_bound)
|
||||
{
|
||||
// approximation by taylor series in x at 0 up to order 4
|
||||
result += (x2*x2)/static_cast<T>(120);
|
||||
}
|
||||
}
|
||||
|
||||
return(result);
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace detail
|
||||
|
||||
template <class T>
|
||||
inline typename tools::promote_args<T>::type sinhc_pi(T x)
|
||||
{
|
||||
typedef typename tools::promote_args<T>::type result_type;
|
||||
return detail::sinhc_pi_imp(static_cast<result_type>(x));
|
||||
}
|
||||
|
||||
template <class T, class Policy>
|
||||
inline typename tools::promote_args<T>::type sinhc_pi(T x, const Policy&)
|
||||
{
|
||||
return boost::math::sinhc_pi(x);
|
||||
}
|
||||
|
||||
#ifdef BOOST_NO_TEMPLATE_TEMPLATES
|
||||
#else /* BOOST_NO_TEMPLATE_TEMPLATES */
|
||||
template<typename T, template<typename> class U>
|
||||
inline U<T> sinhc_pi(const U<T> x)
|
||||
{
|
||||
#if defined(BOOST_FUNCTION_SCOPE_USING_DECLARATION_BREAKS_ADL) || defined(__GNUC__)
|
||||
using namespace std;
|
||||
#elif defined(BOOST_NO_STDC_NAMESPACE) && !defined(__SUNPRO_CC)
|
||||
using ::abs;
|
||||
using ::sinh;
|
||||
using ::sqrt;
|
||||
#else /* BOOST_NO_STDC_NAMESPACE */
|
||||
using ::std::abs;
|
||||
using ::std::sinh;
|
||||
using ::std::sqrt;
|
||||
#endif /* BOOST_NO_STDC_NAMESPACE */
|
||||
|
||||
using ::std::numeric_limits;
|
||||
|
||||
static T const taylor_0_bound = tools::epsilon<T>();
|
||||
static T const taylor_2_bound = sqrt(taylor_0_bound);
|
||||
static T const taylor_n_bound = sqrt(taylor_2_bound);
|
||||
|
||||
if (abs(x) >= taylor_n_bound)
|
||||
{
|
||||
return(sinh(x)/x);
|
||||
}
|
||||
else
|
||||
{
|
||||
// approximation by taylor series in x at 0 up to order 0
|
||||
#ifdef __MWERKS__
|
||||
U<T> result = static_cast<U<T> >(1);
|
||||
#else
|
||||
U<T> result = U<T>(1);
|
||||
#endif
|
||||
|
||||
if (abs(x) >= taylor_0_bound)
|
||||
{
|
||||
U<T> x2 = x*x;
|
||||
|
||||
// approximation by taylor series in x at 0 up to order 2
|
||||
result += x2/static_cast<T>(6);
|
||||
|
||||
if (abs(x) >= taylor_2_bound)
|
||||
{
|
||||
// approximation by taylor series in x at 0 up to order 4
|
||||
result += (x2*x2)/static_cast<T>(120);
|
||||
}
|
||||
}
|
||||
|
||||
return(result);
|
||||
}
|
||||
}
|
||||
#endif /* BOOST_NO_TEMPLATE_TEMPLATES */
|
||||
}
|
||||
}
|
||||
|
||||
#endif /* BOOST_SINHC_HPP */
|
||||
|
||||
@@ -0,0 +1,100 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>CAboutDlg</class>
|
||||
<widget class="QDialog" name="CAboutDlg">
|
||||
<property name="windowModality">
|
||||
<enum>Qt::NonModal</enum>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>About WSJT-X</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
||||
<item>
|
||||
<widget class="QLabel" name="labelTxt">
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignCenter</set>
|
||||
</property>
|
||||
<property name="openExternalLinks">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="verticalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>40</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||
<item>
|
||||
<spacer name="horizontalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="okButton">
|
||||
<property name="text">
|
||||
<string>OK</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer_2">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<resources/>
|
||||
<connections>
|
||||
<connection>
|
||||
<sender>okButton</sender>
|
||||
<signal>clicked()</signal>
|
||||
<receiver>CAboutDlg</receiver>
|
||||
<slot>accept()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>321</x>
|
||||
<y>120</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>186</x>
|
||||
<y>71</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
</connections>
|
||||
</ui>
|
||||
@@ -0,0 +1,160 @@
|
||||
// (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_11_HPP
|
||||
#define BOOST_MATH_TOOLS_RAT_EVAL_11_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;
|
||||
return static_cast<V>(((a[4] * x2 + a[2]) * x2 + a[0] + (a[3] * x2 + a[1]) * x) / ((b[4] * x2 + b[2]) * x2 + b[0] + (b[3] * x2 + b[1]) * x));
|
||||
}
|
||||
else
|
||||
{
|
||||
V z = 1 / x;
|
||||
V z2 = 1 / (x * x);
|
||||
return static_cast<V>(((a[0] * z2 + a[2]) * z2 + a[4] + (a[1] * z2 + a[3]) * z) / ((b[0] * z2 + b[2]) * z2 + b[4] + (b[1] * z2 + b[3]) * z));
|
||||
}
|
||||
}
|
||||
|
||||
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;
|
||||
return static_cast<V>((((a[5] * x2 + a[3]) * x2 + a[1]) * x + (a[4] * x2 + a[2]) * x2 + a[0]) / (((b[5] * x2 + b[3]) * x2 + b[1]) * x + (b[4] * x2 + b[2]) * x2 + b[0]));
|
||||
}
|
||||
else
|
||||
{
|
||||
V z = 1 / x;
|
||||
V z2 = 1 / (x * x);
|
||||
return static_cast<V>((((a[0] * z2 + a[2]) * z2 + a[4]) * z + (a[1] * z2 + a[3]) * z2 + a[5]) / (((b[0] * z2 + b[2]) * z2 + b[4]) * z + (b[1] * z2 + b[3]) * z2 + b[5]));
|
||||
}
|
||||
}
|
||||
|
||||
template <class T, class U, class V>
|
||||
inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<7>*) BOOST_MATH_NOEXCEPT(V)
|
||||
{
|
||||
if(x <= 1)
|
||||
{
|
||||
V x2 = x * x;
|
||||
return static_cast<V>((((a[6] * x2 + a[4]) * x2 + a[2]) * x2 + a[0] + ((a[5] * x2 + a[3]) * x2 + a[1]) * x) / (((b[6] * x2 + b[4]) * x2 + b[2]) * x2 + b[0] + ((b[5] * x2 + b[3]) * x2 + b[1]) * x));
|
||||
}
|
||||
else
|
||||
{
|
||||
V z = 1 / x;
|
||||
V z2 = 1 / (x * x);
|
||||
return static_cast<V>((((a[0] * z2 + a[2]) * z2 + a[4]) * z2 + a[6] + ((a[1] * z2 + a[3]) * z2 + a[5]) * z) / (((b[0] * z2 + b[2]) * z2 + b[4]) * z2 + b[6] + ((b[1] * z2 + b[3]) * z2 + b[5]) * z));
|
||||
}
|
||||
}
|
||||
|
||||
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;
|
||||
return static_cast<V>(((((a[7] * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x + ((a[6] * x2 + a[4]) * x2 + a[2]) * x2 + a[0]) / ((((b[7] * x2 + b[5]) * x2 + b[3]) * x2 + b[1]) * x + ((b[6] * x2 + b[4]) * x2 + b[2]) * x2 + b[0]));
|
||||
}
|
||||
else
|
||||
{
|
||||
V z = 1 / x;
|
||||
V z2 = 1 / (x * x);
|
||||
return static_cast<V>(((((a[0] * z2 + a[2]) * z2 + a[4]) * z2 + a[6]) * z + ((a[1] * z2 + a[3]) * z2 + a[5]) * z2 + a[7]) / ((((b[0] * z2 + b[2]) * z2 + b[4]) * z2 + b[6]) * z + ((b[1] * z2 + b[3]) * z2 + b[5]) * z2 + b[7]));
|
||||
}
|
||||
}
|
||||
|
||||
template <class T, class U, class V>
|
||||
inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<9>*) BOOST_MATH_NOEXCEPT(V)
|
||||
{
|
||||
if(x <= 1)
|
||||
{
|
||||
V x2 = x * x;
|
||||
return static_cast<V>(((((a[8] * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0] + (((a[7] * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x) / ((((b[8] * x2 + b[6]) * x2 + b[4]) * x2 + b[2]) * x2 + b[0] + (((b[7] * x2 + b[5]) * x2 + b[3]) * x2 + b[1]) * x));
|
||||
}
|
||||
else
|
||||
{
|
||||
V z = 1 / x;
|
||||
V z2 = 1 / (x * x);
|
||||
return static_cast<V>(((((a[0] * z2 + a[2]) * z2 + a[4]) * z2 + a[6]) * z2 + a[8] + (((a[1] * z2 + a[3]) * z2 + a[5]) * z2 + a[7]) * z) / ((((b[0] * z2 + b[2]) * z2 + b[4]) * z2 + b[6]) * z2 + b[8] + (((b[1] * z2 + b[3]) * z2 + b[5]) * z2 + b[7]) * z));
|
||||
}
|
||||
}
|
||||
|
||||
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;
|
||||
return static_cast<V>((((((a[9] * x2 + a[7]) * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x + (((a[8] * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0]) / (((((b[9] * x2 + b[7]) * x2 + b[5]) * x2 + b[3]) * x2 + b[1]) * x + (((b[8] * x2 + b[6]) * x2 + b[4]) * x2 + b[2]) * x2 + b[0]));
|
||||
}
|
||||
else
|
||||
{
|
||||
V z = 1 / x;
|
||||
V z2 = 1 / (x * x);
|
||||
return static_cast<V>((((((a[0] * z2 + a[2]) * z2 + a[4]) * z2 + a[6]) * z2 + a[8]) * z + (((a[1] * z2 + a[3]) * z2 + a[5]) * z2 + a[7]) * z2 + a[9]) / (((((b[0] * z2 + b[2]) * z2 + b[4]) * z2 + b[6]) * z2 + b[8]) * z + (((b[1] * z2 + b[3]) * z2 + b[5]) * z2 + b[7]) * z2 + b[9]));
|
||||
}
|
||||
}
|
||||
|
||||
template <class T, class U, class V>
|
||||
inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<11>*) BOOST_MATH_NOEXCEPT(V)
|
||||
{
|
||||
if(x <= 1)
|
||||
{
|
||||
V x2 = x * x;
|
||||
return static_cast<V>((((((a[10] * x2 + a[8]) * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0] + ((((a[9] * x2 + a[7]) * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x) / (((((b[10] * x2 + b[8]) * x2 + b[6]) * x2 + b[4]) * x2 + b[2]) * x2 + b[0] + ((((b[9] * x2 + b[7]) * x2 + b[5]) * x2 + b[3]) * x2 + b[1]) * x));
|
||||
}
|
||||
else
|
||||
{
|
||||
V z = 1 / x;
|
||||
V z2 = 1 / (x * x);
|
||||
return static_cast<V>((((((a[0] * z2 + a[2]) * z2 + a[4]) * z2 + a[6]) * z2 + a[8]) * z2 + a[10] + ((((a[1] * z2 + a[3]) * z2 + a[5]) * z2 + a[7]) * z2 + a[9]) * z) / (((((b[0] * z2 + b[2]) * z2 + b[4]) * z2 + b[6]) * z2 + b[8]) * z2 + b[10] + ((((b[1] * z2 + b[3]) * z2 + b[5]) * z2 + b[7]) * z2 + b[9]) * z));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}}}} // namespaces
|
||||
|
||||
#endif // include guard
|
||||
|
||||
@@ -0,0 +1,6 @@
|
||||
@CMAKE_PROJECT_NAME@ (@wsjtx_VERSION@) experimental; urgency=low
|
||||
|
||||
* wsjtx Debian maintainer and upstream author are identical.
|
||||
Therefore see also normal changelog file for Debian changes.
|
||||
|
||||
-- @PROJECT_CONTACT@ @ts@
|
||||
Reference in New Issue
Block a user