Initial Commit
This commit is contained in:
@@ -0,0 +1,433 @@
|
||||
//=======================================================================
|
||||
// Copyright 1997, 1998, 1999, 2000 University of Notre Dame.
|
||||
// Copyright 2010 Thomas Claveirole
|
||||
// Authors: Andrew Lumsdaine, Lie-Quan Lee, Jeremy G. Siek, Thomas Claveirole
|
||||
//
|
||||
// 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_GRAPH_ADJACENCY_LIST_HPP
|
||||
#define BOOST_GRAPH_ADJACENCY_LIST_HPP
|
||||
|
||||
|
||||
#include <boost/config.hpp>
|
||||
|
||||
#include <vector>
|
||||
#include <list>
|
||||
#include <set>
|
||||
|
||||
#include <boost/unordered_set.hpp>
|
||||
|
||||
#include <boost/scoped_ptr.hpp>
|
||||
|
||||
#include <boost/graph/graph_traits.hpp>
|
||||
#include <boost/graph/graph_mutability_traits.hpp>
|
||||
#include <boost/graph/graph_selectors.hpp>
|
||||
#include <boost/property_map/property_map.hpp>
|
||||
#include <boost/mpl/if.hpp>
|
||||
#include <boost/mpl/and.hpp>
|
||||
#include <boost/mpl/not.hpp>
|
||||
#include <boost/mpl/bool.hpp>
|
||||
#include <boost/graph/detail/edge.hpp>
|
||||
#include <boost/type_traits/is_same.hpp>
|
||||
#include <boost/detail/workaround.hpp>
|
||||
#include <boost/graph/properties.hpp>
|
||||
#include <boost/graph/named_graph.hpp>
|
||||
|
||||
namespace boost {
|
||||
|
||||
//===========================================================================
|
||||
// Selectors for the VertexList and EdgeList template parameters of
|
||||
// adjacency_list, and the container_gen traits class which is used
|
||||
// to map the selectors to the container type used to implement the
|
||||
// graph.
|
||||
|
||||
struct vecS { };
|
||||
struct listS { };
|
||||
struct setS { };
|
||||
struct mapS { };
|
||||
struct multisetS { };
|
||||
struct multimapS { };
|
||||
struct hash_setS { };
|
||||
struct hash_mapS { };
|
||||
struct hash_multisetS { };
|
||||
struct hash_multimapS { };
|
||||
|
||||
template <class Selector, class ValueType>
|
||||
struct container_gen { };
|
||||
|
||||
template <class ValueType>
|
||||
struct container_gen<listS, ValueType> {
|
||||
typedef std::list<ValueType> type;
|
||||
};
|
||||
|
||||
template <class ValueType>
|
||||
struct container_gen<vecS, ValueType> {
|
||||
typedef std::vector<ValueType> type;
|
||||
};
|
||||
|
||||
template <class ValueType>
|
||||
struct container_gen<mapS, ValueType> {
|
||||
typedef std::set<ValueType> type;
|
||||
};
|
||||
|
||||
template <class ValueType>
|
||||
struct container_gen<setS, ValueType> {
|
||||
typedef std::set<ValueType> type;
|
||||
};
|
||||
|
||||
template <class ValueType>
|
||||
struct container_gen<multisetS, ValueType> {
|
||||
typedef std::multiset<ValueType> type;
|
||||
};
|
||||
|
||||
template <class ValueType>
|
||||
struct container_gen<multimapS, ValueType> {
|
||||
typedef std::multiset<ValueType> type;
|
||||
};
|
||||
|
||||
template <class ValueType>
|
||||
struct container_gen<hash_setS, ValueType> {
|
||||
typedef boost::unordered_set<ValueType> type;
|
||||
};
|
||||
|
||||
template <class ValueType>
|
||||
struct container_gen<hash_mapS, ValueType> {
|
||||
typedef boost::unordered_set<ValueType> type;
|
||||
};
|
||||
|
||||
template <class ValueType>
|
||||
struct container_gen<hash_multisetS, ValueType> {
|
||||
typedef boost::unordered_multiset<ValueType> type;
|
||||
};
|
||||
|
||||
template <class ValueType>
|
||||
struct container_gen<hash_multimapS, ValueType> {
|
||||
typedef boost::unordered_multiset<ValueType> type;
|
||||
};
|
||||
|
||||
template <class StorageSelector>
|
||||
struct parallel_edge_traits { };
|
||||
|
||||
template <>
|
||||
struct parallel_edge_traits<vecS> {
|
||||
typedef allow_parallel_edge_tag type; };
|
||||
|
||||
template <>
|
||||
struct parallel_edge_traits<listS> {
|
||||
typedef allow_parallel_edge_tag type; };
|
||||
|
||||
template <>
|
||||
struct parallel_edge_traits<setS> {
|
||||
typedef disallow_parallel_edge_tag type; };
|
||||
|
||||
template <>
|
||||
struct parallel_edge_traits<multisetS> {
|
||||
typedef allow_parallel_edge_tag type; };
|
||||
|
||||
template <>
|
||||
struct parallel_edge_traits<hash_setS> {
|
||||
typedef disallow_parallel_edge_tag type;
|
||||
};
|
||||
|
||||
// mapS is obsolete, replaced with setS
|
||||
template <>
|
||||
struct parallel_edge_traits<mapS> {
|
||||
typedef disallow_parallel_edge_tag type; };
|
||||
|
||||
template <>
|
||||
struct parallel_edge_traits<hash_mapS> {
|
||||
typedef disallow_parallel_edge_tag type;
|
||||
};
|
||||
|
||||
template <>
|
||||
struct parallel_edge_traits<hash_multisetS> {
|
||||
typedef allow_parallel_edge_tag type;
|
||||
};
|
||||
|
||||
template <>
|
||||
struct parallel_edge_traits<hash_multimapS> {
|
||||
typedef allow_parallel_edge_tag type;
|
||||
};
|
||||
|
||||
namespace detail {
|
||||
template <class Directed> struct is_random_access {
|
||||
enum { value = false};
|
||||
typedef mpl::false_ type;
|
||||
};
|
||||
template <>
|
||||
struct is_random_access<vecS> {
|
||||
enum { value = true };
|
||||
typedef mpl::true_ type;
|
||||
};
|
||||
|
||||
} // namespace detail
|
||||
|
||||
template <typename Selector> struct is_distributed_selector: mpl::false_ {};
|
||||
|
||||
|
||||
//===========================================================================
|
||||
// The adjacency_list_traits class, which provides a way to access
|
||||
// some of the associated types of an adjacency_list type without
|
||||
// having to first create the adjacency_list type. This is useful
|
||||
// when trying to create interior vertex or edge properties who's
|
||||
// value type is a vertex or edge descriptor.
|
||||
|
||||
template <class OutEdgeListS = vecS,
|
||||
class VertexListS = vecS,
|
||||
class DirectedS = directedS,
|
||||
class EdgeListS = listS>
|
||||
struct adjacency_list_traits
|
||||
{
|
||||
typedef typename detail::is_random_access<VertexListS>::type
|
||||
is_rand_access;
|
||||
typedef typename DirectedS::is_bidir_t is_bidir;
|
||||
typedef typename DirectedS::is_directed_t is_directed;
|
||||
|
||||
typedef typename mpl::if_<is_bidir,
|
||||
bidirectional_tag,
|
||||
typename mpl::if_<is_directed,
|
||||
directed_tag, undirected_tag
|
||||
>::type
|
||||
>::type directed_category;
|
||||
|
||||
typedef typename parallel_edge_traits<OutEdgeListS>::type
|
||||
edge_parallel_category;
|
||||
|
||||
typedef std::size_t vertices_size_type;
|
||||
typedef void* vertex_ptr;
|
||||
typedef typename mpl::if_<is_rand_access,
|
||||
vertices_size_type, vertex_ptr>::type vertex_descriptor;
|
||||
typedef detail::edge_desc_impl<directed_category, vertex_descriptor>
|
||||
edge_descriptor;
|
||||
|
||||
private:
|
||||
// Logic to figure out the edges_size_type
|
||||
struct dummy {};
|
||||
typedef typename container_gen<EdgeListS, dummy>::type EdgeContainer;
|
||||
typedef typename DirectedS::is_bidir_t BidirectionalT;
|
||||
typedef typename DirectedS::is_directed_t DirectedT;
|
||||
typedef typename mpl::and_<DirectedT,
|
||||
typename mpl::not_<BidirectionalT>::type >::type on_edge_storage;
|
||||
public:
|
||||
typedef typename mpl::if_<on_edge_storage,
|
||||
std::size_t, typename EdgeContainer::size_type
|
||||
>::type edges_size_type;
|
||||
|
||||
};
|
||||
|
||||
} // namespace boost
|
||||
|
||||
#include <boost/graph/detail/adjacency_list.hpp>
|
||||
|
||||
namespace boost {
|
||||
|
||||
//===========================================================================
|
||||
// The adjacency_list class.
|
||||
//
|
||||
|
||||
template <class OutEdgeListS = vecS, // a Sequence or an AssociativeContainer
|
||||
class VertexListS = vecS, // a Sequence or a RandomAccessContainer
|
||||
class DirectedS = directedS,
|
||||
class VertexProperty = no_property,
|
||||
class EdgeProperty = no_property,
|
||||
class GraphProperty = no_property,
|
||||
class EdgeListS = listS>
|
||||
class adjacency_list
|
||||
: public detail::adj_list_gen<
|
||||
adjacency_list<OutEdgeListS,VertexListS,DirectedS,
|
||||
VertexProperty,EdgeProperty,GraphProperty,EdgeListS>,
|
||||
VertexListS, OutEdgeListS, DirectedS,
|
||||
VertexProperty, EdgeProperty,
|
||||
GraphProperty, EdgeListS>::type,
|
||||
// Support for named vertices
|
||||
public graph::maybe_named_graph<
|
||||
adjacency_list<OutEdgeListS,VertexListS,DirectedS,
|
||||
VertexProperty,EdgeProperty,GraphProperty,EdgeListS>,
|
||||
typename adjacency_list_traits<OutEdgeListS, VertexListS, DirectedS,
|
||||
EdgeListS>::vertex_descriptor,
|
||||
VertexProperty>
|
||||
{
|
||||
public:
|
||||
typedef GraphProperty graph_property_type;
|
||||
typedef typename lookup_one_property<GraphProperty, graph_bundle_t>::type graph_bundled;
|
||||
|
||||
typedef VertexProperty vertex_property_type;
|
||||
typedef typename lookup_one_property<VertexProperty, vertex_bundle_t>::type vertex_bundled;
|
||||
|
||||
typedef EdgeProperty edge_property_type;
|
||||
typedef typename lookup_one_property<EdgeProperty, edge_bundle_t>::type edge_bundled;
|
||||
|
||||
private:
|
||||
typedef adjacency_list self;
|
||||
typedef typename detail::adj_list_gen<
|
||||
self, VertexListS, OutEdgeListS, DirectedS,
|
||||
vertex_property_type, edge_property_type, GraphProperty, EdgeListS
|
||||
>::type Base;
|
||||
|
||||
public:
|
||||
typedef typename Base::stored_vertex stored_vertex;
|
||||
typedef typename Base::vertices_size_type vertices_size_type;
|
||||
typedef typename Base::edges_size_type edges_size_type;
|
||||
typedef typename Base::degree_size_type degree_size_type;
|
||||
typedef typename Base::vertex_descriptor vertex_descriptor;
|
||||
typedef typename Base::edge_descriptor edge_descriptor;
|
||||
typedef OutEdgeListS out_edge_list_selector;
|
||||
typedef VertexListS vertex_list_selector;
|
||||
typedef DirectedS directed_selector;
|
||||
typedef EdgeListS edge_list_selector;
|
||||
|
||||
|
||||
adjacency_list(const GraphProperty& p = GraphProperty())
|
||||
: m_property(new graph_property_type(p))
|
||||
{ }
|
||||
|
||||
adjacency_list(const adjacency_list& x)
|
||||
: Base(x), m_property(new graph_property_type(*x.m_property))
|
||||
{ }
|
||||
|
||||
adjacency_list& operator=(const adjacency_list& x) {
|
||||
// TBD: probably should give the strong guarantee
|
||||
if (&x != this) {
|
||||
Base::operator=(x);
|
||||
|
||||
// Copy/swap the ptr since we can't just assign it...
|
||||
property_ptr p(new graph_property_type(*x.m_property));
|
||||
m_property.swap(p);
|
||||
}
|
||||
return *this;
|
||||
}
|
||||
|
||||
// Required by Mutable Graph
|
||||
adjacency_list(vertices_size_type num_vertices,
|
||||
const GraphProperty& p = GraphProperty())
|
||||
: Base(num_vertices), m_property(new graph_property_type(p))
|
||||
{ }
|
||||
|
||||
// Required by Iterator Constructible Graph
|
||||
template <class EdgeIterator>
|
||||
adjacency_list(EdgeIterator first, EdgeIterator last,
|
||||
vertices_size_type n,
|
||||
edges_size_type = 0,
|
||||
const GraphProperty& p = GraphProperty())
|
||||
: Base(n, first, last), m_property(new graph_property_type(p))
|
||||
{ }
|
||||
|
||||
template <class EdgeIterator, class EdgePropertyIterator>
|
||||
adjacency_list(EdgeIterator first, EdgeIterator last,
|
||||
EdgePropertyIterator ep_iter,
|
||||
vertices_size_type n,
|
||||
edges_size_type = 0,
|
||||
const GraphProperty& p = GraphProperty())
|
||||
: Base(n, first, last, ep_iter), m_property(new graph_property_type(p))
|
||||
{ }
|
||||
|
||||
void swap(adjacency_list& x) {
|
||||
// Is there a more efficient way to do this?
|
||||
adjacency_list tmp(x);
|
||||
x = *this;
|
||||
*this = tmp;
|
||||
}
|
||||
|
||||
void clear()
|
||||
{
|
||||
this->clearing_graph();
|
||||
Base::clear();
|
||||
}
|
||||
|
||||
#ifndef BOOST_GRAPH_NO_BUNDLED_PROPERTIES
|
||||
// Directly access a vertex or edge bundle
|
||||
vertex_bundled& operator[](vertex_descriptor v)
|
||||
{ return get(vertex_bundle, *this)[v]; }
|
||||
|
||||
const vertex_bundled& operator[](vertex_descriptor v) const
|
||||
{ return get(vertex_bundle, *this)[v]; }
|
||||
|
||||
edge_bundled& operator[](edge_descriptor e)
|
||||
{ return get(edge_bundle, *this)[e]; }
|
||||
|
||||
const edge_bundled& operator[](edge_descriptor e) const
|
||||
{ return get(edge_bundle, *this)[e]; }
|
||||
|
||||
graph_bundled& operator[](graph_bundle_t)
|
||||
{ return get_property(*this); }
|
||||
|
||||
graph_bundled const& operator[](graph_bundle_t) const
|
||||
{ return get_property(*this); }
|
||||
#endif
|
||||
|
||||
// protected: (would be protected if friends were more portable)
|
||||
typedef scoped_ptr<graph_property_type> property_ptr;
|
||||
property_ptr m_property;
|
||||
};
|
||||
|
||||
#define ADJLIST_PARAMS \
|
||||
typename OEL, typename VL, typename D, typename VP, typename EP, \
|
||||
typename GP, typename EL
|
||||
#define ADJLIST adjacency_list<OEL,VL,D,VP,EP,GP,EL>
|
||||
|
||||
template<ADJLIST_PARAMS, typename Tag, typename Value>
|
||||
inline void set_property(ADJLIST& g, Tag tag, Value const& value) {
|
||||
get_property_value(*g.m_property, tag) = value;
|
||||
}
|
||||
|
||||
template<ADJLIST_PARAMS, typename Tag>
|
||||
inline typename graph_property<ADJLIST, Tag>::type&
|
||||
get_property(ADJLIST& g, Tag tag) {
|
||||
return get_property_value(*g.m_property, tag);
|
||||
}
|
||||
|
||||
template<ADJLIST_PARAMS, typename Tag>
|
||||
inline typename graph_property<ADJLIST, Tag>::type const&
|
||||
get_property(ADJLIST const& g, Tag tag) {
|
||||
return get_property_value(*g.m_property, tag);
|
||||
}
|
||||
|
||||
// dwa 09/25/00 - needed to be more explicit so reverse_graph would work.
|
||||
template <class Directed, class Vertex,
|
||||
class OutEdgeListS,
|
||||
class VertexListS,
|
||||
class DirectedS,
|
||||
class VertexProperty,
|
||||
class EdgeProperty,
|
||||
class GraphProperty, class EdgeListS>
|
||||
inline Vertex
|
||||
source(const detail::edge_base<Directed,Vertex>& e,
|
||||
const adjacency_list<OutEdgeListS, VertexListS, DirectedS,
|
||||
VertexProperty, EdgeProperty, GraphProperty, EdgeListS>&)
|
||||
{
|
||||
return e.m_source;
|
||||
}
|
||||
|
||||
template <class Directed, class Vertex, class OutEdgeListS,
|
||||
class VertexListS, class DirectedS, class VertexProperty,
|
||||
class EdgeProperty, class GraphProperty, class EdgeListS>
|
||||
inline Vertex
|
||||
target(const detail::edge_base<Directed,Vertex>& e,
|
||||
const adjacency_list<OutEdgeListS, VertexListS, DirectedS,
|
||||
VertexProperty, EdgeProperty, GraphProperty, EdgeListS>&)
|
||||
{
|
||||
return e.m_target;
|
||||
}
|
||||
|
||||
// Mutability Traits
|
||||
template <ADJLIST_PARAMS>
|
||||
struct graph_mutability_traits<ADJLIST> {
|
||||
typedef mutable_property_graph_tag category;
|
||||
};
|
||||
|
||||
// Can't remove vertices from adjacency lists with VL==vecS
|
||||
template <typename OEL, typename D, typename VP, typename EP, typename GP, typename EL>
|
||||
struct graph_mutability_traits< adjacency_list<OEL,vecS,D,VP,EP,GP,EL> > {
|
||||
typedef add_only_property_graph_tag category;
|
||||
};
|
||||
#undef ADJLIST_PARAMS
|
||||
#undef ADJLIST
|
||||
|
||||
|
||||
} // namespace boost
|
||||
|
||||
|
||||
#endif // BOOST_GRAPH_ADJACENCY_LIST_HPP
|
||||
@@ -0,0 +1,29 @@
|
||||
#include "HelpTextWindow.hpp"
|
||||
|
||||
#include <QApplication>
|
||||
#include <QString>
|
||||
#include <QPalette>
|
||||
#include <QFile>
|
||||
#include <QTextStream>
|
||||
|
||||
#include "qt_helpers.hpp"
|
||||
#include <MessageBox.hpp>
|
||||
|
||||
HelpTextWindow::HelpTextWindow (QString const& title, QString const& file_name, QFont const& font, QWidget * parent)
|
||||
: QLabel {parent, Qt::WindowCloseButtonHint | Qt::WindowMinimizeButtonHint}
|
||||
{
|
||||
QFile source {file_name};
|
||||
if (!source.open (QIODevice::ReadOnly | QIODevice::Text))
|
||||
{
|
||||
MessageBox::warning_message (this, tr ("Help file error")
|
||||
, tr ("Cannot open \"%1\" for reading").arg (source.fileName ())
|
||||
, tr ("Error: %1").arg (source.errorString ()));
|
||||
return;
|
||||
}
|
||||
setText (QTextStream {&source}.readAll ());
|
||||
setWindowTitle(QApplication::applicationName () + " - " + title);
|
||||
setMargin (10);
|
||||
setBackgroundRole (QPalette::Base);
|
||||
setAutoFillBackground (true);
|
||||
setStyleSheet (font_as_stylesheet (font));
|
||||
}
|
||||
@@ -0,0 +1,53 @@
|
||||
/*=============================================================================
|
||||
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_CONVERT_IMPL_09232005_1215)
|
||||
#define FUSION_CONVERT_IMPL_09232005_1215
|
||||
|
||||
#include <boost/fusion/support/config.hpp>
|
||||
#include <boost/fusion/container/list/cons.hpp>
|
||||
#include <boost/fusion/container/list/detail/build_cons.hpp>
|
||||
#include <boost/fusion/sequence/intrinsic/empty.hpp>
|
||||
#include <boost/fusion/sequence/intrinsic/begin.hpp>
|
||||
#include <boost/fusion/sequence/intrinsic/end.hpp>
|
||||
|
||||
namespace boost { namespace fusion
|
||||
{
|
||||
struct cons_tag;
|
||||
|
||||
namespace extension
|
||||
{
|
||||
template <typename T>
|
||||
struct convert_impl;
|
||||
|
||||
template <>
|
||||
struct convert_impl<cons_tag>
|
||||
{
|
||||
template <typename Sequence>
|
||||
struct apply
|
||||
{
|
||||
typedef typename
|
||||
detail::build_cons<
|
||||
typename result_of::begin<Sequence>::type
|
||||
, typename result_of::end<Sequence>::type
|
||||
>
|
||||
build_cons;
|
||||
|
||||
typedef typename build_cons::type type;
|
||||
|
||||
BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
|
||||
static type
|
||||
call(Sequence& seq)
|
||||
{
|
||||
return build_cons::call(fusion::begin(seq), fusion::end(seq));
|
||||
}
|
||||
};
|
||||
};
|
||||
}
|
||||
}}
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,24 @@
|
||||
# /* Copyright (C) 2001
|
||||
# * Housemarque Oy
|
||||
# * http://www.housemarque.com
|
||||
# *
|
||||
# * Distributed under the Boost Software License, Version 1.0. (See
|
||||
# * accompanying file LICENSE_1_0.txt or copy at
|
||||
# * http://www.boost.org/LICENSE_1_0.txt)
|
||||
# */
|
||||
#
|
||||
# /* Revised by Paul Mensonides (2002) */
|
||||
#
|
||||
# /* See http://www.boost.org for most recent version. */
|
||||
#
|
||||
# ifndef BOOST_PREPROCESSOR_REPETITION_ENUM_PARAMS_WITH_DEFAULTS_HPP
|
||||
# define BOOST_PREPROCESSOR_REPETITION_ENUM_PARAMS_WITH_DEFAULTS_HPP
|
||||
#
|
||||
# include <boost/preprocessor/config/config.hpp>
|
||||
# include <boost/preprocessor/repetition/enum_binary_params.hpp>
|
||||
#
|
||||
# /* BOOST_PP_ENUM_PARAMS_WITH_DEFAULTS */
|
||||
#
|
||||
# define BOOST_PP_ENUM_PARAMS_WITH_DEFAULTS(count, param, def) BOOST_PP_ENUM_BINARY_PARAMS(count, param, = def)
|
||||
#
|
||||
# endif
|
||||
@@ -0,0 +1,474 @@
|
||||
// qracodes.c
|
||||
// Q-ary RA codes encoding/decoding functions
|
||||
//
|
||||
// (c) 2016 - Nico Palermo, IV3NWV - Microtelecom Srl, Italy
|
||||
// ------------------------------------------------------------------------------
|
||||
// This file is part of the qracodes project, a Forward Error Control
|
||||
// encoding/decoding package based on Q-ary RA (Repeat and Accumulate) LDPC codes.
|
||||
//
|
||||
// qracodes is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
// qracodes is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with qracodes source distribution.
|
||||
// If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
#include <stdio.h>
|
||||
#include <math.h>
|
||||
|
||||
#include "npfwht.h"
|
||||
#include "pdmath.h"
|
||||
|
||||
#include "qracodes.h"
|
||||
|
||||
int qra_encode(const qracode *pcode, int *y, const int *x)
|
||||
{
|
||||
int k,j,kk,jj;
|
||||
int t, chk = 0;
|
||||
|
||||
const int K = pcode->K;
|
||||
const int M = pcode->M;
|
||||
const int NC= pcode->NC;
|
||||
const int a = pcode->a;
|
||||
const int *acc_input_idx = pcode->acc_input_idx;
|
||||
const int *acc_input_wlog = pcode->acc_input_wlog;
|
||||
const int *gflog = pcode->gflog;
|
||||
const int *gfexp = pcode->gfexp;
|
||||
|
||||
// copy the systematic symbols to destination
|
||||
memcpy(y,x,K*sizeof(int));
|
||||
|
||||
y = y+K; // point to check symbols
|
||||
|
||||
// compute the code check symbols as a weighted accumulation of a permutated
|
||||
// sequence of the (repeated) systematic input symbols:
|
||||
// chk(k+1) = x(idx(k))*alfa^(logw(k)) + chk(k)
|
||||
// (all operations performed over GF(M))
|
||||
|
||||
if (a==1) { // grouping factor = 1
|
||||
for (k=0;k<NC;k++) {
|
||||
t = x[acc_input_idx[k]];
|
||||
if (t) {
|
||||
// multiply input by weight[k] and xor it with previous check
|
||||
t = (gflog[t] + acc_input_wlog[k])%(M-1);
|
||||
t = gfexp[t];
|
||||
chk ^=t;
|
||||
}
|
||||
y[k] = chk;
|
||||
}
|
||||
|
||||
#ifdef QRA_DEBUG
|
||||
// verify that the encoder accumulator is terminated to 0
|
||||
// (we designed the code this way so that Iex = 1 when Ia = 1)
|
||||
t = x[acc_input_idx[k]];
|
||||
if (t) {
|
||||
t = (gflog[t] + acc_input_wlog[k])%(M-1);
|
||||
t = gfexp[t];
|
||||
// accumulation
|
||||
chk ^=t;
|
||||
}
|
||||
return (chk==0);
|
||||
#else
|
||||
return 1;
|
||||
#endif // QRA_DEBUG
|
||||
}
|
||||
else { // grouping factor > 1
|
||||
for (k=0;k<NC;k++) {
|
||||
kk = a*k;
|
||||
for (j=0;j<a;j++) {
|
||||
jj = kk+j;
|
||||
// irregular grouping support
|
||||
if (acc_input_idx[jj]<0)
|
||||
continue;
|
||||
t = x[acc_input_idx[jj]];
|
||||
if (t) {
|
||||
// multiply input by weight[k] and xor it with previous check
|
||||
t = (gflog[t] + acc_input_wlog[jj])%(M-1);
|
||||
t = gfexp[t];
|
||||
chk ^=t;
|
||||
}
|
||||
}
|
||||
y[k] = chk;
|
||||
}
|
||||
#ifdef QRA_DEBUG
|
||||
// verify that the encoder accumulator is terminated to 0
|
||||
// (we designed the code this way so that Iex = 1 when Ia = 1)
|
||||
kk = a*k;
|
||||
for (j=0;j<a;j++) {
|
||||
jj = kk+j;
|
||||
if (acc_input_idx[jj]<0)
|
||||
continue;
|
||||
t = x[acc_input_idx[jj]];
|
||||
if (t) {
|
||||
// multiply input by weight[k] and xor it with previous check
|
||||
t = (gflog[t] + acc_input_wlog[jj])%(M-1);
|
||||
t = gfexp[t];
|
||||
chk ^=t;
|
||||
}
|
||||
}
|
||||
return (chk==0);
|
||||
#else
|
||||
return 1;
|
||||
#endif // QRA_DEBUG
|
||||
}
|
||||
}
|
||||
|
||||
static void qra_ioapprox(float *src, float C, int nitems)
|
||||
{
|
||||
// In place approximation of the modified bessel function I0(x*C)
|
||||
// Computes src[k] = Io(src[k]*C) where Io() is the modified Bessel function of first kind and order 0
|
||||
|
||||
float v;
|
||||
float vsq;
|
||||
|
||||
while (nitems--) {
|
||||
v = src[nitems]*C;
|
||||
|
||||
// rational approximation of log(Io(v))
|
||||
vsq = v*v;
|
||||
v = vsq*(v+0.039f)/(vsq*.9931f+v*2.6936f+0.5185f);
|
||||
|
||||
if (v>80.f) // avoid floating point exp() overflows
|
||||
v=80.f;
|
||||
|
||||
src[nitems] = (float)exp(v);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
float qra_mfskbesselmetric(float *pix, const float *rsq, const int m, const int N, float EsNoMetric)
|
||||
{
|
||||
// Computes the codeword symbols intrinsic probabilities
|
||||
// given the square of the received input amplitudes.
|
||||
|
||||
// The input vector rqs must be a linear array of size M*N, where M=2^m,
|
||||
// containing the squared amplitudes (rp*rp+rq*rq) of the input samples
|
||||
|
||||
// First symbol amplitudes should be stored in the first M positions,
|
||||
// second symbol amplitudes stored at positions [M ... 2*M-1], and so on.
|
||||
|
||||
// Output vector is the intrinsic symbol metric (the probability distribution)
|
||||
// assuming that symbols are transmitted using a M-FSK modulation
|
||||
// and incoherent demodulation.
|
||||
|
||||
// As the input Es/No is generally unknown (as it cannot be exstimated accurately
|
||||
// when the codeword length is few tens symbols) but an exact metric requires it
|
||||
// we simply fix it to a predefined EsNoMetric value so that the metric is what
|
||||
// expected at that specific value.
|
||||
// The metric computed in this way is optimal only at this predefined Es/No value,
|
||||
// nevertheless it is usually better than a generic parameter-free metric which
|
||||
// makes no assumptions on the input Es/No.
|
||||
|
||||
// returns the estimated noise standard deviation
|
||||
|
||||
int k;
|
||||
float rsum = 0.f;
|
||||
float sigmaest, cmetric;
|
||||
|
||||
const int M = 1<<m;
|
||||
const int nsamples = M*N;
|
||||
|
||||
// compute total power and modulus of input signal
|
||||
for (k=0;k<nsamples;k++) {
|
||||
rsum = rsum+rsq[k];
|
||||
pix[k] = (float)sqrt(rsq[k]);
|
||||
}
|
||||
|
||||
rsum = rsum/nsamples; // average S+N
|
||||
|
||||
// IMPORTANT NOTE: in computing the noise stdev it is assumed that
|
||||
// in the input amplitudes there's no strong interference!
|
||||
// A more robust estimation can be done evaluating the histogram of the input amplitudes
|
||||
|
||||
sigmaest = (float)sqrt(rsum/(1.0f+EsNoMetric/M)/2); // estimated noise stdev
|
||||
cmetric = (float)sqrt(2*EsNoMetric)/sigmaest;
|
||||
|
||||
for (k=0;k<N;k++) {
|
||||
// compute bessel metric for each symbol in the codeword
|
||||
qra_ioapprox(PD_ROWADDR(pix,M,k),cmetric,M);
|
||||
// normalize to a probability distribution
|
||||
pd_norm(PD_ROWADDR(pix,M,k),m);
|
||||
}
|
||||
|
||||
return sigmaest;
|
||||
}
|
||||
|
||||
|
||||
#ifdef QRA_DEBUG
|
||||
void pd_print(int imsg,float *ppd,int size)
|
||||
{
|
||||
int k;
|
||||
printf("imsg=%d\n",imsg);
|
||||
for (k=0;k<size;k++)
|
||||
printf("%7.1e ",ppd[k]);
|
||||
printf("\n");
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
#define ADDRMSG(fp, msgidx) PD_ROWADDR(fp,qra_M,msgidx)
|
||||
#define C2VMSG(msgidx) PD_ROWADDR(qra_c2vmsg,qra_M,msgidx)
|
||||
#define V2CMSG(msgidx) PD_ROWADDR(qra_v2cmsg,qra_M,msgidx)
|
||||
#define MSGPERM(logw) PD_ROWADDR(qra_pmat,qra_M,logw)
|
||||
|
||||
#define QRACODE_MAX_M 256 // Maximum alphabet size handled by qra_extrinsic
|
||||
|
||||
int qra_extrinsic(const qracode *pcode,
|
||||
float *pex,
|
||||
const float *pix,
|
||||
int maxiter,
|
||||
float *qra_v2cmsg,
|
||||
float *qra_c2vmsg)
|
||||
{
|
||||
const int qra_M = pcode->M;
|
||||
const int qra_m = pcode->m;
|
||||
const int qra_V = pcode->V;
|
||||
const int qra_MAXVDEG = pcode->MAXVDEG;
|
||||
const int *qra_vdeg = pcode->vdeg;
|
||||
const int qra_C = pcode->C;
|
||||
const int qra_MAXCDEG = pcode->MAXCDEG;
|
||||
const int *qra_cdeg = pcode->cdeg;
|
||||
const int *qra_v2cmidx = pcode->v2cmidx;
|
||||
const int *qra_c2vmidx = pcode->c2vmidx;
|
||||
const int *qra_pmat = pcode->gfpmat;
|
||||
const int *qra_msgw = pcode->msgw;
|
||||
|
||||
// float msgout[qra_M]; // buffer to store temporary results
|
||||
float msgout[QRACODE_MAX_M]; // we use a fixed size in order to avoid mallocs
|
||||
|
||||
float totex; // total extrinsic information
|
||||
int nit; // current iteration
|
||||
int nv; // current variable
|
||||
int nc; // current check
|
||||
int k,kk; // loop indexes
|
||||
|
||||
int ndeg; // current node degree
|
||||
int msgbase; // current offset in the table of msg indexes
|
||||
int imsg; // current message index
|
||||
int wmsg; // current message weight
|
||||
|
||||
int rc = -1; // rc>=0 extrinsic converged to 1 at iteration rc (rc=0..maxiter-1)
|
||||
// rc=-1 no convergence in the given number of iterations
|
||||
// rc=-2 error in the code tables (code checks degrees must be >1)
|
||||
// rc=-3 M is larger than QRACODE_MAX_M
|
||||
|
||||
|
||||
|
||||
if (qra_M>QRACODE_MAX_M)
|
||||
return -3;
|
||||
|
||||
// message initialization -------------------------------------------------------
|
||||
|
||||
// init c->v variable intrinsic msgs
|
||||
pd_init(C2VMSG(0),pix,qra_M*qra_V);
|
||||
|
||||
// init the v->c messages directed to code factors (k=1..ndeg) with the intrinsic info
|
||||
for (nv=0;nv<qra_V;nv++) {
|
||||
|
||||
ndeg = qra_vdeg[nv]; // degree of current node
|
||||
msgbase = nv*qra_MAXVDEG; // base to msg index row for the current node
|
||||
|
||||
// copy intrinsics on v->c
|
||||
for (k=1;k<ndeg;k++) {
|
||||
imsg = qra_v2cmidx[msgbase+k];
|
||||
pd_init(V2CMSG(imsg),ADDRMSG(pix,nv),qra_M);
|
||||
}
|
||||
}
|
||||
|
||||
// message passing algorithm iterations ------------------------------
|
||||
|
||||
for (nit=0;nit<maxiter;nit++) {
|
||||
|
||||
// c->v step -----------------------------------------------------
|
||||
// Computes messages from code checks to code variables.
|
||||
// As the first qra_V checks are associated with intrinsic information
|
||||
// (the code tables have been constructed in this way)
|
||||
// we need to do this step only for code checks in the range [qra_V..qra_C)
|
||||
|
||||
// The convolutions of probability distributions over the alphabet of a finite field GF(qra_M)
|
||||
// are performed with a fast convolution algorithm over the given field.
|
||||
//
|
||||
// I.e. given the code check x1+x2+x3 = 0 (with x1,x2,x3 in GF(2^m))
|
||||
// and given Prob(x2) and Prob(x3), we have that:
|
||||
// Prob(x1=X1) = Prob((x2+x3)=X1) = sum((Prob(x2=X2)*Prob(x3=(X1+X2))) for all the X2s in the field
|
||||
// This translates to Prob(x1) = IWHT(WHT(Prob(x2))*WHT(Prob(x3)))
|
||||
// where WHT and IWHT are the direct and inverse Walsh-Hadamard transforms of the argument.
|
||||
// Note that the WHT and the IWHF differs only by a multiplicative coefficent and since in this step
|
||||
// we don't need that the output distribution is normalized we use the relationship
|
||||
// Prob(x1) =(proportional to) WH(WH(Prob(x2))*WH(Prob(x3)))
|
||||
|
||||
// In general given the check code x1+x2+x3+..+xm = 0
|
||||
// the output distribution of a variable given the distributions of the other m-1 variables
|
||||
// is the inverse WHT of the product of the WHTs of the distribution of the other m-1 variables
|
||||
// The complexity of this algorithm scales with M*log2(M) instead of the M^2 complexity of
|
||||
// the brute force approach (M=size of the alphabet)
|
||||
|
||||
for (nc=qra_V;nc<qra_C;nc++) {
|
||||
|
||||
ndeg = qra_cdeg[nc]; // degree of current node
|
||||
|
||||
if (ndeg==1) // this should never happen (code factors must have deg>1)
|
||||
return -2; // bad code tables
|
||||
|
||||
msgbase = nc*qra_MAXCDEG; // base to msg index row for the current node
|
||||
|
||||
// transforms inputs in the Walsh-Hadamard "frequency" domain
|
||||
// v->c -> fwht(v->c)
|
||||
for (k=0;k<ndeg;k++) {
|
||||
imsg = qra_c2vmidx[msgbase+k]; // msg index
|
||||
np_fwht(qra_m,V2CMSG(imsg),V2CMSG(imsg)); // compute fwht
|
||||
}
|
||||
|
||||
// compute products and transform them back in the WH "time" domain
|
||||
for (k=0;k<ndeg;k++) {
|
||||
|
||||
// init output message to uniform distribution
|
||||
pd_init(msgout,pd_uniform(qra_m),qra_M);
|
||||
|
||||
// c->v = prod(fwht(v->c))
|
||||
// TODO: we assume that checks degrees are not larger than three but
|
||||
// if they are larger the products can be computed more efficiently
|
||||
for (kk=0;kk<ndeg;kk++)
|
||||
if (kk!=k) {
|
||||
imsg = qra_c2vmidx[msgbase+kk];
|
||||
pd_imul(msgout,V2CMSG(imsg),qra_m);
|
||||
}
|
||||
|
||||
// transform product back in the WH "time" domain
|
||||
|
||||
// Very important trick:
|
||||
// we bias WHT[0] so that the sum of output pd components is always strictly positive
|
||||
// this helps avoiding the effects of underflows in the v->c steps when multipling
|
||||
// small fp numbers
|
||||
msgout[0]+=1E-7f; // TODO: define the bias accordingly to the field size
|
||||
|
||||
np_fwht(qra_m,msgout,msgout);
|
||||
|
||||
// inverse weight and output
|
||||
imsg = qra_c2vmidx[msgbase+k]; // current output msg index
|
||||
wmsg = qra_msgw[imsg]; // current msg weight
|
||||
|
||||
if (wmsg==0)
|
||||
pd_init(C2VMSG(imsg),msgout,qra_M);
|
||||
else
|
||||
// output p(alfa^(-w)*x)
|
||||
pd_bwdperm(C2VMSG(imsg),msgout, MSGPERM(wmsg), qra_M);
|
||||
|
||||
} // for (k=0;k<ndeg;k++)
|
||||
|
||||
} // for (nc=qra_V;nc<qra_C;nc++)
|
||||
|
||||
// v->c step -----------------------------------------------------
|
||||
for (nv=0;nv<qra_V;nv++) {
|
||||
|
||||
ndeg = qra_vdeg[nv]; // degree of current node
|
||||
msgbase = nv*qra_MAXVDEG; // base to msg index row for the current node
|
||||
|
||||
for (k=0;k<ndeg;k++) {
|
||||
// init output message to uniform distribution
|
||||
pd_init(msgout,pd_uniform(qra_m),qra_M);
|
||||
|
||||
// v->c msg = prod(c->v)
|
||||
// TODO: factor factors to reduce the number of computations for high degree nodes
|
||||
for (kk=0;kk<ndeg;kk++)
|
||||
if (kk!=k) {
|
||||
imsg = qra_v2cmidx[msgbase+kk];
|
||||
pd_imul(msgout,C2VMSG(imsg),qra_m);
|
||||
}
|
||||
|
||||
#ifdef QRA_DEBUG
|
||||
// normalize and check if product of messages v->c are null
|
||||
// normalize output to a probability distribution
|
||||
if (pd_norm(msgout,qra_m)<=0) {
|
||||
// dump msgin;
|
||||
printf("warning: v->c pd with invalid norm. nit=%d nv=%d k=%d\n",nit,nv,k);
|
||||
for (kk=0;kk<ndeg;kk++) {
|
||||
imsg = qra_v2cmidx[msgbase+kk];
|
||||
pd_print(imsg,C2VMSG(imsg),qra_M);
|
||||
}
|
||||
printf("-----------------\n");
|
||||
}
|
||||
#else
|
||||
// normalize the result to a probability distribution
|
||||
pd_norm(msgout,qra_m);
|
||||
#endif
|
||||
// weight and output
|
||||
imsg = qra_v2cmidx[msgbase+k]; // current output msg index
|
||||
wmsg = qra_msgw[imsg]; // current msg weight
|
||||
|
||||
if (wmsg==0) {
|
||||
pd_init(V2CMSG(imsg),msgout,qra_M);
|
||||
}
|
||||
else {
|
||||
// output p(alfa^w*x)
|
||||
pd_fwdperm(V2CMSG(imsg),msgout, MSGPERM(wmsg), qra_M);
|
||||
}
|
||||
|
||||
} // for (k=0;k<ndeg;k++)
|
||||
} // for (nv=0;nv<qra_V;nv++)
|
||||
|
||||
// check extrinsic information ------------------------------
|
||||
// We assume that decoding is successful if each of the extrinsic
|
||||
// symbol probability is close to ej, where ej = [0 0 0 1(j-th position) 0 0 0 ]
|
||||
// Therefore, for each symbol k in the codeword we compute max(prob(Xk))
|
||||
// and we stop the iterations if sum(max(prob(xk)) is close to the codeword length
|
||||
// Note: this is a more restrictive criterium than that of computing the a
|
||||
// posteriori probability of each symbol, making a hard decision and then check
|
||||
// if the codeword syndrome is null.
|
||||
// WARNING: this is tricky and probably works only for the particular class of RA codes
|
||||
// we are coping with (we designed the code weights so that for any input symbol the
|
||||
// sum of its weigths is always 0, thus terminating the accumulator trellis to zero
|
||||
// for every combination of the systematic symbols).
|
||||
// More generally we should instead compute the max a posteriori probabilities
|
||||
// (as a product of the intrinsic and extrinsic information), make a symbol by symbol hard
|
||||
// decision and then check that the syndrome of the result is indeed null.
|
||||
|
||||
totex = 0;
|
||||
for (nv=0;nv<qra_V;nv++)
|
||||
totex += pd_max(V2CMSG(nv),qra_M);
|
||||
|
||||
if (totex>(1.*(qra_V)-0.01)) {
|
||||
// the total maximum extrinsic information of each symbol in the codeword
|
||||
// is very close to one. This means that we have reached the (1,1) point in the
|
||||
// code EXIT chart(s) and we have successfully decoded the input.
|
||||
rc = nit;
|
||||
break; // remove the break to evaluate the decoder speed performance as a function of the max iterations number)
|
||||
}
|
||||
|
||||
} // for (nit=0;nit<maxiter;nit++)
|
||||
|
||||
// copy extrinsic information to output to do the actual max a posteriori prob decoding
|
||||
pd_init(pex,V2CMSG(0),(qra_M*qra_V));
|
||||
return rc;
|
||||
}
|
||||
|
||||
void qra_mapdecode(const qracode *pcode, int *xdec, float *pex, const float *pix)
|
||||
{
|
||||
// Maximum a posteriori probability decoding.
|
||||
// Given the intrinsic information (pix) and extrinsic information (pex) (computed with qra_extrinsic(...))
|
||||
// compute pmap = pex*pix and decode each (information) symbol of the received codeword
|
||||
// as the symbol which maximizes pmap
|
||||
|
||||
// Returns:
|
||||
// xdec[k] = decoded (information) symbols k=[0..qra_K-1]
|
||||
|
||||
// Note: pex is destroyed and overwritten with mapp
|
||||
|
||||
const int qra_M = pcode->M;
|
||||
const int qra_m = pcode->m;
|
||||
const int qra_K = pcode->K;
|
||||
|
||||
int k;
|
||||
|
||||
for (k=0;k<qra_K;k++) {
|
||||
// compute a posteriori prob
|
||||
pd_imul(PD_ROWADDR(pex,qra_M,k),PD_ROWADDR(pix,qra_M,k),qra_m);
|
||||
xdec[k]=pd_argmax(NULL, PD_ROWADDR(pex,qra_M,k), qra_M);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,45 @@
|
||||
/*
|
||||
[auto_generated]
|
||||
boost/numeric/odeint/algebra/detail/norm_inf.hpp
|
||||
|
||||
[begin_description]
|
||||
Default reduce implementation.
|
||||
[end_description]
|
||||
|
||||
Copyright 2013 Karsten Ahnert
|
||||
Copyright 2013 Mario Mulansky
|
||||
|
||||
Distributed under the Boost Software License, Version 1.0.
|
||||
(See accompanying file LICENSE_1_0.txt or
|
||||
copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
*/
|
||||
|
||||
|
||||
#ifndef BOOST_NUMERIC_ODEINT_ALGEBRA_DETAIL_NORM_INF_HPP_INCLUDED
|
||||
#define BOOST_NUMERIC_ODEINT_ALGEBRA_DETAIL_NORM_INF_HPP_INCLUDED
|
||||
|
||||
#include <cmath>
|
||||
|
||||
namespace boost {
|
||||
namespace numeric {
|
||||
namespace odeint {
|
||||
namespace detail {
|
||||
|
||||
template< typename Value , class Iterator1 >
|
||||
inline Value norm_inf( Iterator1 first1 , Iterator1 last1 , Value init )
|
||||
{
|
||||
using std::max;
|
||||
using std::abs;
|
||||
for( ; first1 != last1 ; )
|
||||
init = max( init , abs( *first1++ ) );
|
||||
return init;
|
||||
}
|
||||
|
||||
|
||||
} // detail
|
||||
} // odeint
|
||||
} // numeric
|
||||
} // boost
|
||||
|
||||
|
||||
#endif // BOOST_NUMERIC_ODEINT_ALGEBRA_DETAIL_NORM_INF_HPP_INCLUDED
|
||||
@@ -0,0 +1,47 @@
|
||||
/*
|
||||
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_STD_LIBCOMO_H
|
||||
#define BOOST_PREDEF_LIBRARY_STD_LIBCOMO_H
|
||||
|
||||
#include <boost/predef/library/std/_prefix.h>
|
||||
|
||||
#include <boost/predef/version_number.h>
|
||||
#include <boost/predef/make.h>
|
||||
|
||||
/*`
|
||||
[heading `BOOST_LIB_STD_COMO`]
|
||||
|
||||
[@http://www.comeaucomputing.com/libcomo/ Comeau Computing] Standard C++ Library.
|
||||
Version number available as major.
|
||||
|
||||
[table
|
||||
[[__predef_symbol__] [__predef_version__]]
|
||||
|
||||
[[`__LIBCOMO__`] [__predef_detection__]]
|
||||
|
||||
[[`__LIBCOMO_VERSION__`] [V.0.0]]
|
||||
]
|
||||
*/
|
||||
|
||||
#define BOOST_LIB_STD_COMO BOOST_VERSION_NUMBER_NOT_AVAILABLE
|
||||
|
||||
#if defined(__LIBCOMO__)
|
||||
# undef BOOST_LIB_STD_COMO
|
||||
# define BOOST_LIB_STD_COMO BOOST_VERSION_NUMBER(__LIBCOMO_VERSION__,0,0)
|
||||
#endif
|
||||
|
||||
#if BOOST_LIB_STD_COMO
|
||||
# define BOOST_LIB_STD_COMO_AVAILABLE
|
||||
#endif
|
||||
|
||||
#define BOOST_LIB_STD_COMO_NAME "Comeau Computing"
|
||||
|
||||
#endif
|
||||
|
||||
#include <boost/predef/detail/test.h>
|
||||
BOOST_PREDEF_DECLARE_TEST(BOOST_LIB_STD_COMO,BOOST_LIB_STD_COMO_NAME)
|
||||
@@ -0,0 +1,125 @@
|
||||
subroutine symspec(shared_data,k,ntrperiod,nsps,ingain,nminw,pxdb,s, &
|
||||
df3,ihsym,npts8,pxdbmax)
|
||||
|
||||
! Input:
|
||||
! k pointer to the most recent new data
|
||||
! ntrperiod T/R sequence length, minutes
|
||||
! nsps samples per symbol, at 12000 Hz
|
||||
! ndiskdat 0/1 to indicate if data from disk
|
||||
! nb 0/1 status of noise blanker (off/on)
|
||||
! nbslider NB setting, 0-100
|
||||
|
||||
! Output:
|
||||
! pxdb raw power (0-90 dB)
|
||||
! s() current spectrum for waterfall display
|
||||
! ihsym index number of this half-symbol (1-184) for 60 s modes
|
||||
|
||||
! jt9com
|
||||
! ss() JT9 symbol spectra at half-symbol steps
|
||||
! savg() average spectra for waterfall display
|
||||
|
||||
use, intrinsic :: iso_c_binding, only: c_int, c_short, c_float, c_char
|
||||
include 'jt9com.f90'
|
||||
|
||||
type(dec_data) :: shared_data
|
||||
real*4 w3(MAXFFT3)
|
||||
real*4 s(NSMAX)
|
||||
real*4 ssum(NSMAX)
|
||||
real*4 xc(0:MAXFFT3-1)
|
||||
real*4 tmp(NSMAX)
|
||||
complex cx(0:MAXFFT3/2)
|
||||
integer nch(7)
|
||||
|
||||
common/spectra/syellow(NSMAX),ref(0:3456),filter(0:3456)
|
||||
data k0/99999999/,nfft3z/0/
|
||||
data nch/1,2,4,9,18,36,72/
|
||||
equivalence (xc,cx)
|
||||
save
|
||||
|
||||
if(ntrperiod.eq.-999) stop !Silence compiler warning
|
||||
nfft3=16384 !df=12000.0/16384 = 0.732422
|
||||
jstep=nsps/2 !Step size = half-symbol in id2()
|
||||
if(k.gt.NMAX) go to 900
|
||||
if(k.lt.2048) then !(2048 was nfft3) (Any need for this ???)
|
||||
ihsym=0
|
||||
go to 900 !Wait for enough samples to start
|
||||
endif
|
||||
|
||||
if(nfft3.ne.nfft3z) then
|
||||
! Compute new window
|
||||
pi=4.0*atan(1.0)
|
||||
width=0.25*nsps
|
||||
do i=1,nfft3
|
||||
z=(i-nfft3/2)/width
|
||||
w3(i)=exp(-z*z)
|
||||
enddo
|
||||
nfft3z=nfft3
|
||||
endif
|
||||
|
||||
if(k.lt.k0) then !Start a new data block
|
||||
ja=0
|
||||
ssum=0.
|
||||
ihsym=0
|
||||
if(.not. shared_data%params%ndiskdat) shared_data%id2(k+1:)=0 !Needed to prevent "ghosts". Not sure why.
|
||||
endif
|
||||
gain=10.0**(0.1*ingain)
|
||||
sq=0.
|
||||
pxmax=0.;
|
||||
do i=k0+1,k
|
||||
x1=shared_data%id2(i)
|
||||
if (abs(x1).gt.pxmax) pxmax = abs(x1);
|
||||
sq=sq + x1*x1
|
||||
enddo
|
||||
pxdb = 0.
|
||||
if(sq.gt.0.0) pxdb=10*log10(sq/(k-k0))
|
||||
pxdbmax=0.
|
||||
if(pxmax.gt.0) pxdbmax = 20*log10(pxmax)
|
||||
|
||||
k0=k
|
||||
ja=ja+jstep !Index of first sample
|
||||
|
||||
fac0=0.1
|
||||
do i=0,nfft3-1 !Copy data into cx
|
||||
j=ja+i-(nfft3-1)
|
||||
xc(i)=0.
|
||||
if(j.ge.1 .and.j.le.NMAX) xc(i)=fac0*shared_data%id2(j)
|
||||
enddo
|
||||
ihsym=ihsym+1
|
||||
|
||||
xc(0:nfft3-1)=w3(1:nfft3)*xc(0:nfft3-1) !Apply window w3
|
||||
call four2a(xc,nfft3,1,-1,0) !Real-to-complex FFT
|
||||
|
||||
df3=12000.0/nfft3 !JT9-1: 0.732 Hz = 0.42 * tone spacing
|
||||
iz=min(NSMAX,nint(5000.0/df3))
|
||||
fac=(1.0/nfft3)**2
|
||||
do i=1,iz
|
||||
j=i-1
|
||||
if(j.lt.0) j=j+nfft3
|
||||
sx=fac*(real(cx(j))**2 + aimag(cx(j))**2)
|
||||
if(ihsym.le.184) shared_data%ss(ihsym,i)=sx
|
||||
ssum(i)=ssum(i) + sx
|
||||
s(i)=1000.0*gain*sx
|
||||
enddo
|
||||
|
||||
shared_data%savg=ssum/ihsym
|
||||
|
||||
if(mod(ihsym,10).eq.0) then
|
||||
mode4=nch(nminw+1)
|
||||
nsmo=min(10*mode4,150)
|
||||
nsmo=4*nsmo
|
||||
call flat1(shared_data%savg,iz,nsmo,syellow)
|
||||
if(mode4.ge.2) call smo(syellow,iz,tmp,mode4)
|
||||
if(mode4.ge.2) call smo(syellow,iz,tmp,mode4)
|
||||
syellow(1:250)=0.
|
||||
ia=500./df3
|
||||
ib=2700.0/df3
|
||||
smin=minval(syellow(ia:ib))
|
||||
smax=maxval(syellow(1:iz))
|
||||
syellow=(50.0/(smax-smin))*(syellow-smin)
|
||||
where(syellow<0) syellow=0.
|
||||
endif
|
||||
|
||||
900 npts8=k/8
|
||||
|
||||
return
|
||||
end subroutine symspec
|
||||
@@ -0,0 +1,133 @@
|
||||
// Copyright (c) 2006 Xiaogang Zhang
|
||||
// Use, modification and distribution are subject to the
|
||||
// Boost Software License, Version 1.0. (See accompanying file
|
||||
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
#ifndef BOOST_MATH_BESSEL_JN_HPP
|
||||
#define BOOST_MATH_BESSEL_JN_HPP
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#pragma once
|
||||
#endif
|
||||
|
||||
#include <boost/math/special_functions/detail/bessel_j0.hpp>
|
||||
#include <boost/math/special_functions/detail/bessel_j1.hpp>
|
||||
#include <boost/math/special_functions/detail/bessel_jy.hpp>
|
||||
#include <boost/math/special_functions/detail/bessel_jy_asym.hpp>
|
||||
#include <boost/math/special_functions/detail/bessel_jy_series.hpp>
|
||||
|
||||
// Bessel function of the first kind of integer order
|
||||
// J_n(z) is the minimal solution
|
||||
// n < abs(z), forward recurrence stable and usable
|
||||
// n >= abs(z), forward recurrence unstable, use Miller's algorithm
|
||||
|
||||
namespace boost { namespace math { namespace detail{
|
||||
|
||||
template <typename T, typename Policy>
|
||||
T bessel_jn(int n, T x, const Policy& pol)
|
||||
{
|
||||
T value(0), factor, current, prev, next;
|
||||
|
||||
BOOST_MATH_STD_USING
|
||||
|
||||
//
|
||||
// Reflection has to come first:
|
||||
//
|
||||
if (n < 0)
|
||||
{
|
||||
factor = static_cast<T>((n & 0x1) ? -1 : 1); // J_{-n}(z) = (-1)^n J_n(z)
|
||||
n = -n;
|
||||
}
|
||||
else
|
||||
{
|
||||
factor = 1;
|
||||
}
|
||||
if(x < 0)
|
||||
{
|
||||
factor *= (n & 0x1) ? -1 : 1; // J_{n}(-z) = (-1)^n J_n(z)
|
||||
x = -x;
|
||||
}
|
||||
//
|
||||
// Special cases:
|
||||
//
|
||||
if(asymptotic_bessel_large_x_limit(T(n), x))
|
||||
return factor * asymptotic_bessel_j_large_x_2<T>(T(n), x);
|
||||
if (n == 0)
|
||||
{
|
||||
return factor * bessel_j0(x);
|
||||
}
|
||||
if (n == 1)
|
||||
{
|
||||
return factor * bessel_j1(x);
|
||||
}
|
||||
|
||||
if (x == 0) // n >= 2
|
||||
{
|
||||
return static_cast<T>(0);
|
||||
}
|
||||
|
||||
BOOST_ASSERT(n > 1);
|
||||
T scale = 1;
|
||||
if (n < abs(x)) // forward recurrence
|
||||
{
|
||||
prev = bessel_j0(x);
|
||||
current = bessel_j1(x);
|
||||
policies::check_series_iterations<T>("boost::math::bessel_j_n<%1%>(%1%,%1%)", n, pol);
|
||||
for (int k = 1; k < n; k++)
|
||||
{
|
||||
T fact = 2 * k / x;
|
||||
//
|
||||
// rescale if we would overflow or underflow:
|
||||
//
|
||||
if((fabs(fact) > 1) && ((tools::max_value<T>() - fabs(prev)) / fabs(fact) < fabs(current)))
|
||||
{
|
||||
scale /= current;
|
||||
prev /= current;
|
||||
current = 1;
|
||||
}
|
||||
value = fact * current - prev;
|
||||
prev = current;
|
||||
current = value;
|
||||
}
|
||||
}
|
||||
else if((x < 1) || (n > x * x / 4) || (x < 5))
|
||||
{
|
||||
return factor * bessel_j_small_z_series(T(n), x, pol);
|
||||
}
|
||||
else // backward recurrence
|
||||
{
|
||||
T fn; int s; // fn = J_(n+1) / J_n
|
||||
// |x| <= n, fast convergence for continued fraction CF1
|
||||
boost::math::detail::CF1_jy(static_cast<T>(n), x, &fn, &s, pol);
|
||||
prev = fn;
|
||||
current = 1;
|
||||
// Check recursion won't go on too far:
|
||||
policies::check_series_iterations<T>("boost::math::bessel_j_n<%1%>(%1%,%1%)", n, pol);
|
||||
for (int k = n; k > 0; k--)
|
||||
{
|
||||
T fact = 2 * k / x;
|
||||
if((fabs(fact) > 1) && ((tools::max_value<T>() - fabs(prev)) / fabs(fact) < fabs(current)))
|
||||
{
|
||||
prev /= current;
|
||||
scale /= current;
|
||||
current = 1;
|
||||
}
|
||||
next = fact * current - prev;
|
||||
prev = current;
|
||||
current = next;
|
||||
}
|
||||
value = bessel_j0(x) / current; // normalization
|
||||
scale = 1 / scale;
|
||||
}
|
||||
value *= factor;
|
||||
|
||||
if(tools::max_value<T>() * scale < fabs(value))
|
||||
return policies::raise_overflow_error<T>("boost::math::bessel_jn<%1%>(%1%,%1%)", 0, pol);
|
||||
|
||||
return value / scale;
|
||||
}
|
||||
|
||||
}}} // namespaces
|
||||
|
||||
#endif // BOOST_MATH_BESSEL_JN_HPP
|
||||
|
||||
@@ -0,0 +1,97 @@
|
||||
|
||||
// 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 the main "advance_backward.hpp" header
|
||||
// -- DO NOT modify by hand!
|
||||
|
||||
namespace boost { namespace mpl { namespace aux {
|
||||
|
||||
template< long N > struct advance_backward;
|
||||
template<>
|
||||
struct advance_backward<0>
|
||||
{
|
||||
template< typename Iterator > struct apply
|
||||
{
|
||||
typedef Iterator iter0;
|
||||
typedef iter0 type;
|
||||
};
|
||||
};
|
||||
|
||||
template<>
|
||||
struct advance_backward<1>
|
||||
{
|
||||
template< typename Iterator > struct apply
|
||||
{
|
||||
typedef Iterator iter0;
|
||||
typedef typename prior<iter0>::type iter1;
|
||||
typedef iter1 type;
|
||||
};
|
||||
};
|
||||
|
||||
template<>
|
||||
struct advance_backward<2>
|
||||
{
|
||||
template< typename Iterator > struct apply
|
||||
{
|
||||
typedef Iterator iter0;
|
||||
typedef typename prior<iter0>::type iter1;
|
||||
typedef typename prior<iter1>::type iter2;
|
||||
typedef iter2 type;
|
||||
};
|
||||
};
|
||||
|
||||
template<>
|
||||
struct advance_backward<3>
|
||||
{
|
||||
template< typename Iterator > struct apply
|
||||
{
|
||||
typedef Iterator iter0;
|
||||
typedef typename prior<iter0>::type iter1;
|
||||
typedef typename prior<iter1>::type iter2;
|
||||
typedef typename prior<iter2>::type iter3;
|
||||
typedef iter3 type;
|
||||
};
|
||||
};
|
||||
|
||||
template<>
|
||||
struct advance_backward<4>
|
||||
{
|
||||
template< typename Iterator > struct apply
|
||||
{
|
||||
typedef Iterator iter0;
|
||||
typedef typename prior<iter0>::type iter1;
|
||||
typedef typename prior<iter1>::type iter2;
|
||||
typedef typename prior<iter2>::type iter3;
|
||||
typedef typename prior<iter3>::type iter4;
|
||||
typedef iter4 type;
|
||||
};
|
||||
};
|
||||
|
||||
template< long N >
|
||||
struct advance_backward
|
||||
{
|
||||
template< typename Iterator > struct apply
|
||||
{
|
||||
typedef typename apply_wrap1<
|
||||
advance_backward<4>
|
||||
, Iterator
|
||||
>::type chunk_result_;
|
||||
|
||||
typedef typename apply_wrap1<
|
||||
advance_backward<(
|
||||
(N - 4) < 0
|
||||
? 0
|
||||
: N - 4
|
||||
)>
|
||||
, chunk_result_
|
||||
>::type type;
|
||||
};
|
||||
};
|
||||
|
||||
}}}
|
||||
|
||||
@@ -0,0 +1,293 @@
|
||||
// ratio.hpp ---------------------------------------------------------------//
|
||||
|
||||
// Copyright 2008 Howard Hinnant
|
||||
// Copyright 2008 Beman Dawes
|
||||
// Copyright 2009 Vicente J. Botet Escriba
|
||||
|
||||
// Distributed under the Boost Software License, Version 1.0.
|
||||
// See http://www.boost.org/LICENSE_1_0.txt
|
||||
|
||||
/*
|
||||
|
||||
This code was derived by Beman Dawes from Howard Hinnant's time2_demo prototype.
|
||||
Many thanks to Howard for making his code available under the Boost license.
|
||||
The original code was modified to conform to Boost conventions and to section
|
||||
20.4 Compile-time rational arithmetic [ratio], of the C++ committee working
|
||||
paper N2798.
|
||||
See http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2008/n2798.pdf.
|
||||
|
||||
time2_demo contained this comment:
|
||||
|
||||
Much thanks to Andrei Alexandrescu,
|
||||
Walter Brown,
|
||||
Peter Dimov,
|
||||
Jeff Garland,
|
||||
Terry Golubiewski,
|
||||
Daniel Krugler,
|
||||
Anthony Williams.
|
||||
*/
|
||||
|
||||
// The way overflow is managed for ratio_less is taken from llvm/libcxx/include/ratio
|
||||
|
||||
#ifndef BOOST_RATIO_RATIO_HPP
|
||||
#define BOOST_RATIO_RATIO_HPP
|
||||
|
||||
#include <boost/ratio/config.hpp>
|
||||
#include <boost/ratio/detail/mpl/abs.hpp>
|
||||
#include <boost/ratio/detail/mpl/sign.hpp>
|
||||
#include <boost/ratio/detail/mpl/gcd.hpp>
|
||||
#include <boost/ratio/detail/mpl/lcm.hpp>
|
||||
#include <cstdlib>
|
||||
#include <climits>
|
||||
#include <limits>
|
||||
#include <boost/cstdint.hpp>
|
||||
#include <boost/type_traits/integral_constant.hpp>
|
||||
#include <boost/core/enable_if.hpp>
|
||||
#include <boost/integer_traits.hpp>
|
||||
#include <boost/ratio/ratio_fwd.hpp>
|
||||
#include <boost/ratio/detail/overflow_helpers.hpp>
|
||||
#ifdef BOOST_RATIO_EXTENSIONS
|
||||
#include <boost/rational.hpp>
|
||||
#include <boost/ratio/mpl/rational_c_tag.hpp>
|
||||
#endif
|
||||
|
||||
//
|
||||
// We simply cannot include this header on gcc without getting copious warnings of the kind:
|
||||
//
|
||||
// boost/integer.hpp:77:30: warning: use of C99 long long integer constant
|
||||
//
|
||||
// And yet there is no other reasonable implementation, so we declare this a system header
|
||||
// to suppress these warnings.
|
||||
//
|
||||
#if defined(__GNUC__) && (__GNUC__ >= 4)
|
||||
#pragma GCC system_header
|
||||
#endif
|
||||
|
||||
namespace boost
|
||||
{
|
||||
|
||||
|
||||
//----------------------------------------------------------------------------//
|
||||
// //
|
||||
// 20.6.1 Class template ratio [ratio.ratio] //
|
||||
// //
|
||||
//----------------------------------------------------------------------------//
|
||||
|
||||
template <boost::intmax_t N, boost::intmax_t D>
|
||||
class ratio
|
||||
{
|
||||
static const boost::intmax_t ABS_N = mpl::abs_c<boost::intmax_t, N>::value;
|
||||
static const boost::intmax_t ABS_D = mpl::abs_c<boost::intmax_t, D>::value;
|
||||
BOOST_RATIO_STATIC_ASSERT(ABS_N >= 0, BOOST_RATIO_NUMERATOR_IS_OUT_OF_RANGE, ());
|
||||
BOOST_RATIO_STATIC_ASSERT(ABS_D > 0, BOOST_RATIO_DENOMINATOR_IS_OUT_OF_RANGE, ());
|
||||
BOOST_RATIO_STATIC_ASSERT(D != 0, BOOST_RATIO_DIVIDE_BY_0 , ());
|
||||
static const boost::intmax_t SIGN_N = mpl::sign_c<boost::intmax_t,N>::value
|
||||
* mpl::sign_c<boost::intmax_t,D>::value;
|
||||
static const boost::intmax_t GCD = mpl::gcd_c<boost::intmax_t, ABS_N, ABS_D>::value;
|
||||
public:
|
||||
BOOST_STATIC_CONSTEXPR boost::intmax_t num = SIGN_N * ABS_N / GCD;
|
||||
BOOST_STATIC_CONSTEXPR boost::intmax_t den = ABS_D / GCD;
|
||||
|
||||
#ifdef BOOST_RATIO_EXTENSIONS
|
||||
typedef mpl::rational_c_tag tag;
|
||||
typedef boost::rational<boost::intmax_t> value_type;
|
||||
typedef boost::intmax_t num_type;
|
||||
typedef boost::intmax_t den_type;
|
||||
ratio()
|
||||
{}
|
||||
template <boost::intmax_t _N2, boost::intmax_t _D2>
|
||||
ratio(const ratio<_N2, _D2>&,
|
||||
typename enable_if_c
|
||||
<
|
||||
(ratio<_N2, _D2>::num == num &&
|
||||
ratio<_N2, _D2>::den == den)
|
||||
>::type* = 0)
|
||||
{}
|
||||
|
||||
template <boost::intmax_t _N2, boost::intmax_t _D2>
|
||||
typename enable_if_c
|
||||
<
|
||||
(ratio<_N2, _D2>::num == num &&
|
||||
ratio<_N2, _D2>::den == den),
|
||||
ratio&
|
||||
>::type
|
||||
operator=(const ratio<_N2, _D2>&) {return *this;}
|
||||
|
||||
static value_type value() {return value_type(num,den);}
|
||||
value_type operator()() const {return value();}
|
||||
#endif
|
||||
typedef ratio<num, den> type;
|
||||
};
|
||||
|
||||
#if defined(BOOST_NO_CXX11_CONSTEXPR)
|
||||
template <boost::intmax_t N, boost::intmax_t D>
|
||||
const boost::intmax_t ratio<N, D>::num;
|
||||
template <boost::intmax_t N, boost::intmax_t D>
|
||||
const boost::intmax_t ratio<N, D>::den;
|
||||
#endif
|
||||
|
||||
//----------------------------------------------------------------------------//
|
||||
// //
|
||||
// 20.6.2 Arithmetic on ratio types [ratio.arithmetic] //
|
||||
// //
|
||||
//----------------------------------------------------------------------------//
|
||||
|
||||
template <class R1, class R2>
|
||||
struct ratio_add
|
||||
: boost::ratio_detail::ratio_add<R1, R2>::type
|
||||
{
|
||||
};
|
||||
|
||||
template <class R1, class R2>
|
||||
struct ratio_subtract
|
||||
: boost::ratio_detail::ratio_subtract<R1, R2>::type
|
||||
{
|
||||
};
|
||||
|
||||
template <class R1, class R2>
|
||||
struct ratio_multiply
|
||||
: boost::ratio_detail::ratio_multiply<R1, R2>::type
|
||||
{
|
||||
};
|
||||
|
||||
template <class R1, class R2>
|
||||
struct ratio_divide
|
||||
: boost::ratio_detail::ratio_divide<R1, R2>::type
|
||||
{
|
||||
};
|
||||
|
||||
//----------------------------------------------------------------------------//
|
||||
// //
|
||||
// 20.6.3 Comparision of ratio types [ratio.comparison] //
|
||||
// //
|
||||
//----------------------------------------------------------------------------//
|
||||
|
||||
// ratio_equal
|
||||
|
||||
template <class R1, class R2>
|
||||
struct ratio_equal
|
||||
: public boost::integral_constant<bool,
|
||||
(R1::num == R2::num && R1::den == R2::den)>
|
||||
{};
|
||||
|
||||
template <class R1, class R2>
|
||||
struct ratio_not_equal
|
||||
: public boost::integral_constant<bool, !ratio_equal<R1, R2>::value>
|
||||
{};
|
||||
|
||||
// ratio_less
|
||||
|
||||
template <class R1, class R2>
|
||||
struct ratio_less
|
||||
: boost::integral_constant<bool, boost::ratio_detail::ratio_less<R1, R2>::value>
|
||||
{};
|
||||
|
||||
template <class R1, class R2>
|
||||
struct ratio_less_equal
|
||||
: boost::integral_constant<bool, !ratio_less<R2, R1>::value>
|
||||
{};
|
||||
|
||||
template <class R1, class R2>
|
||||
struct ratio_greater
|
||||
: boost::integral_constant<bool, ratio_less<R2, R1>::value>
|
||||
{};
|
||||
|
||||
template <class R1, class R2>
|
||||
struct ratio_greater_equal
|
||||
: boost::integral_constant<bool, !ratio_less<R1, R2>::value>
|
||||
{};
|
||||
|
||||
template <class R1, class R2>
|
||||
struct ratio_gcd :
|
||||
ratio<mpl::gcd_c<boost::intmax_t, R1::num, R2::num>::value,
|
||||
mpl::lcm_c<boost::intmax_t, R1::den, R2::den>::value>::type
|
||||
{
|
||||
};
|
||||
|
||||
//----------------------------------------------------------------------------//
|
||||
// //
|
||||
// More arithmetic on ratio types [ratio.arithmetic] //
|
||||
// //
|
||||
//----------------------------------------------------------------------------//
|
||||
|
||||
#ifdef BOOST_RATIO_EXTENSIONS
|
||||
template <class R>
|
||||
struct ratio_negate
|
||||
: ratio<-R::num, R::den>::type
|
||||
{
|
||||
};
|
||||
template <class R>
|
||||
struct ratio_abs
|
||||
: ratio<mpl::abs_c<boost::intmax_t, R::num>::value, R::den>::type
|
||||
{
|
||||
};
|
||||
template <class R>
|
||||
struct ratio_sign
|
||||
: mpl::sign_c<boost::intmax_t, R::num>
|
||||
{
|
||||
};
|
||||
|
||||
template <class R>
|
||||
struct ratio_inverse
|
||||
: ratio<R::den, R::num>::type
|
||||
{
|
||||
};
|
||||
|
||||
|
||||
template <class R1, class R2>
|
||||
struct ratio_lcm :
|
||||
ratio<mpl::lcm_c<boost::intmax_t, R1::num, R2::num>::value,
|
||||
mpl::gcd_c<boost::intmax_t, R1::den, R2::den>::value>::type
|
||||
{
|
||||
};
|
||||
|
||||
template <class R1, class R2>
|
||||
struct ratio_modulo :
|
||||
ratio<(R1::num * R2::den) % (R2::num * R1::den), R1::den * R2::den>::type
|
||||
{
|
||||
};
|
||||
|
||||
namespace detail {
|
||||
template <class R1, class R2, bool r1ltr2>
|
||||
struct ratio_min : R1 {};
|
||||
template <class R1, class R2>
|
||||
struct ratio_min<R1,R2,false> : R2 {};
|
||||
|
||||
template <class R1, class R2, bool r1ltr2>
|
||||
struct ratio_max : R2 {};
|
||||
template <class R1, class R2>
|
||||
struct ratio_max<R1,R2,false> : R1 {};
|
||||
}
|
||||
|
||||
template <class R1, class R2>
|
||||
struct ratio_min : detail::ratio_min<R1, R2, ratio_less<R1,R2>::value>::type
|
||||
{
|
||||
};
|
||||
|
||||
template <class R1, class R2>
|
||||
struct ratio_max : detail::ratio_max<R1, R2, ratio_less<R1,R2>::value>::type
|
||||
{
|
||||
};
|
||||
|
||||
template<typename R, int p>
|
||||
struct ratio_power :
|
||||
ratio_multiply<
|
||||
typename ratio_power<R, p%2>::type,
|
||||
typename ratio_power<typename ratio_multiply<R, R>::type, p/2>::type
|
||||
>::type
|
||||
{};
|
||||
|
||||
template<typename R>
|
||||
struct ratio_power<R, 0> : ratio<1>::type {};
|
||||
|
||||
template<typename R>
|
||||
struct ratio_power<R, 1> : R {};
|
||||
|
||||
template<typename R>
|
||||
struct ratio_power<R, -1> : ratio_divide<ratio<1>, R>::type {};
|
||||
|
||||
#endif
|
||||
} // namespace boost
|
||||
|
||||
|
||||
#endif // BOOST_RATIO_RATIO_HPP
|
||||
@@ -0,0 +1,22 @@
|
||||
// Boost.Range library
|
||||
//
|
||||
// Copyright Neil Groves 2014
|
||||
// Use, modification and distribution is subject to the Boost Software
|
||||
// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
//
|
||||
// For more information, see http://www.boost.org/libs/range/
|
||||
//
|
||||
#include <boost/range/iterator_range_core.hpp>
|
||||
#include <boost/functional/hash.hpp>
|
||||
|
||||
namespace boost
|
||||
{
|
||||
|
||||
template<class T>
|
||||
std::size_t hash_value(const iterator_range<T>& rng)
|
||||
{
|
||||
return boost::hash_range(rng.begin(), rng.end());
|
||||
}
|
||||
|
||||
} // namespace boost
|
||||
@@ -0,0 +1,74 @@
|
||||
/* 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_HASHED_INDEX_FWD_HPP
|
||||
#define BOOST_MULTI_INDEX_HASHED_INDEX_FWD_HPP
|
||||
|
||||
#if defined(_MSC_VER)
|
||||
#pragma once
|
||||
#endif
|
||||
|
||||
#include <boost/multi_index/detail/hash_index_args.hpp>
|
||||
|
||||
namespace boost{
|
||||
|
||||
namespace multi_index{
|
||||
|
||||
namespace detail{
|
||||
|
||||
template<
|
||||
typename KeyFromValue,typename Hash,typename Pred,
|
||||
typename SuperMeta,typename TagList,typename Category
|
||||
>
|
||||
class hashed_index;
|
||||
|
||||
template<
|
||||
typename KeyFromValue,typename Hash,typename Pred,
|
||||
typename SuperMeta,typename TagList,typename Category
|
||||
>
|
||||
bool operator==(
|
||||
const hashed_index<KeyFromValue,Hash,Pred,SuperMeta,TagList,Category>& x,
|
||||
const hashed_index<KeyFromValue,Hash,Pred,SuperMeta,TagList,Category>& y);
|
||||
|
||||
template<
|
||||
typename KeyFromValue,typename Hash,typename Pred,
|
||||
typename SuperMeta,typename TagList,typename Category
|
||||
>
|
||||
bool operator!=(
|
||||
const hashed_index<KeyFromValue,Hash,Pred,SuperMeta,TagList,Category>& x,
|
||||
const hashed_index<KeyFromValue,Hash,Pred,SuperMeta,TagList,Category>& y);
|
||||
|
||||
template<
|
||||
typename KeyFromValue,typename Hash,typename Pred,
|
||||
typename SuperMeta,typename TagList,typename Category
|
||||
>
|
||||
void swap(
|
||||
hashed_index<KeyFromValue,Hash,Pred,SuperMeta,TagList,Category>& x,
|
||||
hashed_index<KeyFromValue,Hash,Pred,SuperMeta,TagList,Category>& y);
|
||||
|
||||
} /* namespace multi_index::detail */
|
||||
|
||||
/* hashed_index specifiers */
|
||||
|
||||
template<
|
||||
typename Arg1,typename Arg2=mpl::na,
|
||||
typename Arg3=mpl::na,typename Arg4=mpl::na
|
||||
>
|
||||
struct hashed_unique;
|
||||
|
||||
template<
|
||||
typename Arg1,typename Arg2=mpl::na,
|
||||
typename Arg3=mpl::na,typename Arg4=mpl::na
|
||||
>
|
||||
struct hashed_non_unique;
|
||||
|
||||
} /* namespace multi_index */
|
||||
|
||||
} /* namespace boost */
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,24 @@
|
||||
|
||||
#ifndef BOOST_MPL_ERASE_KEY_FWD_HPP_INCLUDED
|
||||
#define BOOST_MPL_ERASE_KEY_FWD_HPP_INCLUDED
|
||||
|
||||
// Copyright Aleksey Gurtovoy 2000-2004
|
||||
//
|
||||
// Distributed under the Boost Software License, Version 1.0.
|
||||
// (See accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
//
|
||||
// See http://www.boost.org/libs/mpl for documentation.
|
||||
|
||||
// $Id$
|
||||
// $Date$
|
||||
// $Revision$
|
||||
|
||||
namespace boost { namespace mpl {
|
||||
|
||||
template< typename Tag > struct erase_key_impl;
|
||||
template< typename Sequence, typename Key > struct erase_key;
|
||||
|
||||
}}
|
||||
|
||||
#endif // BOOST_MPL_ERASE_KEY_FWD_HPP_INCLUDED
|
||||
@@ -0,0 +1,142 @@
|
||||
/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8
|
||||
// xml_oarchive_impl.ipp:
|
||||
|
||||
// (C) Copyright 2002 Robert Ramey - http://www.rrsd.com .
|
||||
// Distributed under the Boost Software License, Version 1.0. (See
|
||||
// accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
#include <ostream>
|
||||
#include <iomanip>
|
||||
#include <algorithm> // std::copy
|
||||
#include <string>
|
||||
#include <exception>
|
||||
|
||||
#include <cstring> // strlen
|
||||
#include <boost/config.hpp> // msvc 6.0 needs this to suppress warnings
|
||||
#if defined(BOOST_NO_STDC_NAMESPACE)
|
||||
namespace std{
|
||||
using ::strlen;
|
||||
} // namespace std
|
||||
#endif
|
||||
|
||||
#include <boost/archive/iterators/xml_escape.hpp>
|
||||
#include <boost/archive/iterators/ostream_iterator.hpp>
|
||||
|
||||
#ifndef BOOST_NO_CWCHAR
|
||||
#include <boost/archive/wcslen.hpp>
|
||||
#include <boost/archive/iterators/mb_from_wchar.hpp>
|
||||
#endif
|
||||
|
||||
namespace boost {
|
||||
namespace archive {
|
||||
|
||||
/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8
|
||||
// implemenations of functions specific to char archives
|
||||
|
||||
// wide char stuff used by char archives
|
||||
#ifndef BOOST_NO_CWCHAR
|
||||
// copy chars to output escaping to xml and translating wide chars to mb chars
|
||||
template<class InputIterator>
|
||||
void save_iterator(std::ostream &os, InputIterator begin, InputIterator end){
|
||||
typedef boost::archive::iterators::mb_from_wchar<
|
||||
boost::archive::iterators::xml_escape<InputIterator>
|
||||
> translator;
|
||||
std::copy(
|
||||
translator(begin),
|
||||
translator(end),
|
||||
boost::archive::iterators::ostream_iterator<char>(os)
|
||||
);
|
||||
}
|
||||
|
||||
#ifndef BOOST_NO_STD_WSTRING
|
||||
template<class Archive>
|
||||
BOOST_ARCHIVE_DECL void
|
||||
xml_oarchive_impl<Archive>::save(const std::wstring & ws){
|
||||
// at least one library doesn't typedef value_type for strings
|
||||
// so rather than using string directly make a pointer iterator out of it
|
||||
// save_iterator(os, ws.data(), ws.data() + std::wcslen(ws.data()));
|
||||
save_iterator(os, ws.data(), ws.data() + ws.size());
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifndef BOOST_NO_INTRINSIC_WCHAR_T
|
||||
template<class Archive>
|
||||
BOOST_ARCHIVE_DECL void
|
||||
xml_oarchive_impl<Archive>::save(const wchar_t * ws){
|
||||
save_iterator(os, ws, ws + std::wcslen(ws));
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif // BOOST_NO_CWCHAR
|
||||
|
||||
template<class Archive>
|
||||
BOOST_ARCHIVE_DECL void
|
||||
xml_oarchive_impl<Archive>::save(const std::string & s){
|
||||
// at least one library doesn't typedef value_type for strings
|
||||
// so rather than using string directly make a pointer iterator out of it
|
||||
typedef boost::archive::iterators::xml_escape<
|
||||
const char *
|
||||
> xml_escape_translator;
|
||||
std::copy(
|
||||
xml_escape_translator(s.data()),
|
||||
xml_escape_translator(s.data()+ s.size()),
|
||||
boost::archive::iterators::ostream_iterator<char>(os)
|
||||
);
|
||||
}
|
||||
|
||||
template<class Archive>
|
||||
BOOST_ARCHIVE_DECL void
|
||||
xml_oarchive_impl<Archive>::save(const char * s){
|
||||
typedef boost::archive::iterators::xml_escape<
|
||||
const char *
|
||||
> xml_escape_translator;
|
||||
std::copy(
|
||||
xml_escape_translator(s),
|
||||
xml_escape_translator(s + std::strlen(s)),
|
||||
boost::archive::iterators::ostream_iterator<char>(os)
|
||||
);
|
||||
}
|
||||
|
||||
template<class Archive>
|
||||
BOOST_ARCHIVE_DECL
|
||||
xml_oarchive_impl<Archive>::xml_oarchive_impl(
|
||||
std::ostream & os_,
|
||||
unsigned int flags
|
||||
) :
|
||||
basic_text_oprimitive<std::ostream>(
|
||||
os_,
|
||||
0 != (flags & no_codecvt)
|
||||
),
|
||||
basic_xml_oarchive<Archive>(flags)
|
||||
{
|
||||
if(0 == (flags & no_header))
|
||||
this->init();
|
||||
}
|
||||
|
||||
template<class Archive>
|
||||
BOOST_ARCHIVE_DECL void
|
||||
xml_oarchive_impl<Archive>::save_binary(const void *address, std::size_t count){
|
||||
this->end_preamble();
|
||||
#if ! defined(__MWERKS__)
|
||||
this->basic_text_oprimitive<std::ostream>::save_binary(
|
||||
#else
|
||||
this->basic_text_oprimitive::save_binary(
|
||||
#endif
|
||||
address,
|
||||
count
|
||||
);
|
||||
this->indent_next = true;
|
||||
}
|
||||
|
||||
template<class Archive>
|
||||
BOOST_ARCHIVE_DECL
|
||||
xml_oarchive_impl<Archive>::~xml_oarchive_impl(){
|
||||
if(std::uncaught_exception())
|
||||
return;
|
||||
if(0 == (this->get_flags() & no_header))
|
||||
this->windup();
|
||||
}
|
||||
|
||||
} // namespace archive
|
||||
} // namespace boost
|
||||
@@ -0,0 +1,390 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 1998-2003 Joel de Guzman
|
||||
Copyright (c) 2003 Martin Wille
|
||||
http://spirit.sourceforge.net/
|
||||
|
||||
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)
|
||||
=============================================================================*/
|
||||
#if !defined(BOOST_SPIRIT_PRIMITIVES_IPP)
|
||||
#define BOOST_SPIRIT_PRIMITIVES_IPP
|
||||
|
||||
#include <cctype>
|
||||
#if !defined(BOOST_NO_CWCTYPE)
|
||||
#include <cwctype>
|
||||
#endif
|
||||
|
||||
#include <string> // char_traits
|
||||
|
||||
#if defined(BOOST_MSVC)
|
||||
# pragma warning (push)
|
||||
# pragma warning(disable:4800)
|
||||
#endif
|
||||
|
||||
namespace boost { namespace spirit {
|
||||
|
||||
BOOST_SPIRIT_CLASSIC_NAMESPACE_BEGIN
|
||||
|
||||
template <typename DrivedT> struct char_parser;
|
||||
|
||||
namespace impl
|
||||
{
|
||||
template <typename IteratorT>
|
||||
inline IteratorT
|
||||
get_last(IteratorT first)
|
||||
{
|
||||
while (*first)
|
||||
first++;
|
||||
return first;
|
||||
}
|
||||
|
||||
template<
|
||||
typename RT,
|
||||
typename IteratorT,
|
||||
typename ScannerT>
|
||||
inline RT
|
||||
string_parser_parse(
|
||||
IteratorT str_first,
|
||||
IteratorT str_last,
|
||||
ScannerT& scan)
|
||||
{
|
||||
typedef typename ScannerT::iterator_t iterator_t;
|
||||
iterator_t saved = scan.first;
|
||||
std::size_t slen = str_last - str_first;
|
||||
|
||||
while (str_first != str_last)
|
||||
{
|
||||
if (scan.at_end() || (*str_first != *scan))
|
||||
return scan.no_match();
|
||||
++str_first;
|
||||
++scan;
|
||||
}
|
||||
|
||||
return scan.create_match(slen, nil_t(), saved, scan.first);
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Conversion from char_type to int_type
|
||||
//
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
|
||||
// Use char_traits for char and wchar_t only, as these are the only
|
||||
// specializations provided in the standard. Other types are on their
|
||||
// own.
|
||||
//
|
||||
// For UDT, one may override:
|
||||
//
|
||||
// isalnum
|
||||
// isalpha
|
||||
// iscntrl
|
||||
// isdigit
|
||||
// isgraph
|
||||
// islower
|
||||
// isprint
|
||||
// ispunct
|
||||
// isspace
|
||||
// isupper
|
||||
// isxdigit
|
||||
// isblank
|
||||
// isupper
|
||||
// tolower
|
||||
// toupper
|
||||
//
|
||||
// in a namespace suitable for Argument Dependent lookup or in
|
||||
// namespace std (disallowed by the standard).
|
||||
|
||||
template <typename CharT>
|
||||
struct char_type_char_traits_helper
|
||||
{
|
||||
typedef CharT char_type;
|
||||
typedef typename std::char_traits<CharT>::int_type int_type;
|
||||
|
||||
static int_type to_int_type(CharT c)
|
||||
{
|
||||
return std::char_traits<CharT>::to_int_type(c);
|
||||
}
|
||||
|
||||
static char_type to_char_type(int_type i)
|
||||
{
|
||||
return std::char_traits<CharT>::to_char_type(i);
|
||||
}
|
||||
};
|
||||
|
||||
template <typename CharT>
|
||||
struct char_traits_helper
|
||||
{
|
||||
typedef CharT char_type;
|
||||
typedef CharT int_type;
|
||||
|
||||
static CharT & to_int_type(CharT & c)
|
||||
{
|
||||
return c;
|
||||
}
|
||||
|
||||
static CharT & to_char_type(CharT & c)
|
||||
{
|
||||
return c;
|
||||
}
|
||||
};
|
||||
|
||||
template <>
|
||||
struct char_traits_helper<char>
|
||||
: char_type_char_traits_helper<char>
|
||||
{
|
||||
};
|
||||
|
||||
#if !defined(BOOST_NO_CWCTYPE)
|
||||
|
||||
template <>
|
||||
struct char_traits_helper<wchar_t>
|
||||
: char_type_char_traits_helper<wchar_t>
|
||||
{
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
template <typename CharT>
|
||||
inline typename char_traits_helper<CharT>::int_type
|
||||
to_int_type(CharT c)
|
||||
{
|
||||
return char_traits_helper<CharT>::to_int_type(c);
|
||||
}
|
||||
|
||||
template <typename CharT>
|
||||
inline CharT
|
||||
to_char_type(typename char_traits_helper<CharT>::int_type c)
|
||||
{
|
||||
return char_traits_helper<CharT>::to_char_type(c);
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Convenience functions
|
||||
//
|
||||
///////////////////////////////////////////////////////////////////////
|
||||
|
||||
template <typename CharT>
|
||||
inline bool
|
||||
isalnum_(CharT c)
|
||||
{
|
||||
using namespace std;
|
||||
return isalnum(to_int_type(c)) ? true : false;
|
||||
}
|
||||
|
||||
template <typename CharT>
|
||||
inline bool
|
||||
isalpha_(CharT c)
|
||||
{
|
||||
using namespace std;
|
||||
return isalpha(to_int_type(c)) ? true : false;
|
||||
}
|
||||
|
||||
template <typename CharT>
|
||||
inline bool
|
||||
iscntrl_(CharT c)
|
||||
{
|
||||
using namespace std;
|
||||
return iscntrl(to_int_type(c)) ? true : false;
|
||||
}
|
||||
|
||||
template <typename CharT>
|
||||
inline bool
|
||||
isdigit_(CharT c)
|
||||
{
|
||||
using namespace std;
|
||||
return isdigit(to_int_type(c)) ? true : false;
|
||||
}
|
||||
|
||||
template <typename CharT>
|
||||
inline bool
|
||||
isgraph_(CharT c)
|
||||
{
|
||||
using namespace std;
|
||||
return isgraph(to_int_type(c)) ? true : false;
|
||||
}
|
||||
|
||||
template <typename CharT>
|
||||
inline bool
|
||||
islower_(CharT c)
|
||||
{
|
||||
using namespace std;
|
||||
return islower(to_int_type(c)) ? true : false;
|
||||
}
|
||||
|
||||
template <typename CharT>
|
||||
inline bool
|
||||
isprint_(CharT c)
|
||||
{
|
||||
using namespace std;
|
||||
return isprint(to_int_type(c)) ? true : false;
|
||||
}
|
||||
|
||||
template <typename CharT>
|
||||
inline bool
|
||||
ispunct_(CharT c)
|
||||
{
|
||||
using namespace std;
|
||||
return ispunct(to_int_type(c)) ? true : false;
|
||||
}
|
||||
|
||||
template <typename CharT>
|
||||
inline bool
|
||||
isspace_(CharT c)
|
||||
{
|
||||
using namespace std;
|
||||
return isspace(to_int_type(c)) ? true : false;
|
||||
}
|
||||
|
||||
template <typename CharT>
|
||||
inline bool
|
||||
isupper_(CharT c)
|
||||
{
|
||||
using namespace std;
|
||||
return isupper(to_int_type(c)) ? true : false;
|
||||
}
|
||||
|
||||
template <typename CharT>
|
||||
inline bool
|
||||
isxdigit_(CharT c)
|
||||
{
|
||||
using namespace std;
|
||||
return isxdigit(to_int_type(c)) ? true : false;
|
||||
}
|
||||
|
||||
template <typename CharT>
|
||||
inline bool
|
||||
isblank_(CharT c)
|
||||
{
|
||||
return (c == ' ' || c == '\t');
|
||||
}
|
||||
|
||||
template <typename CharT>
|
||||
inline CharT
|
||||
tolower_(CharT c)
|
||||
{
|
||||
using namespace std;
|
||||
return to_char_type<CharT>(tolower(to_int_type(c)));
|
||||
}
|
||||
|
||||
template <typename CharT>
|
||||
inline CharT
|
||||
toupper_(CharT c)
|
||||
{
|
||||
using namespace std;
|
||||
return to_char_type<CharT>(toupper(to_int_type(c)));
|
||||
}
|
||||
|
||||
#if !defined(BOOST_NO_CWCTYPE)
|
||||
|
||||
inline bool
|
||||
isalnum_(wchar_t c)
|
||||
{
|
||||
using namespace std;
|
||||
return iswalnum(to_int_type(c)) ? true : false;
|
||||
}
|
||||
|
||||
inline bool
|
||||
isalpha_(wchar_t c)
|
||||
{
|
||||
using namespace std;
|
||||
return iswalpha(to_int_type(c)) ? true : false;
|
||||
}
|
||||
|
||||
inline bool
|
||||
iscntrl_(wchar_t c)
|
||||
{
|
||||
using namespace std;
|
||||
return iswcntrl(to_int_type(c)) ? true : false;
|
||||
}
|
||||
|
||||
inline bool
|
||||
isdigit_(wchar_t c)
|
||||
{
|
||||
using namespace std;
|
||||
return iswdigit(to_int_type(c)) ? true : false;
|
||||
}
|
||||
|
||||
inline bool
|
||||
isgraph_(wchar_t c)
|
||||
{
|
||||
using namespace std;
|
||||
return iswgraph(to_int_type(c)) ? true : false;
|
||||
}
|
||||
|
||||
inline bool
|
||||
islower_(wchar_t c)
|
||||
{
|
||||
using namespace std;
|
||||
return iswlower(to_int_type(c)) ? true : false;
|
||||
}
|
||||
|
||||
inline bool
|
||||
isprint_(wchar_t c)
|
||||
{
|
||||
using namespace std;
|
||||
return iswprint(to_int_type(c)) ? true : false;
|
||||
}
|
||||
|
||||
inline bool
|
||||
ispunct_(wchar_t c)
|
||||
{
|
||||
using namespace std;
|
||||
return iswpunct(to_int_type(c)) ? true : false;
|
||||
}
|
||||
|
||||
inline bool
|
||||
isspace_(wchar_t c)
|
||||
{
|
||||
using namespace std;
|
||||
return iswspace(to_int_type(c)) ? true : false;
|
||||
}
|
||||
|
||||
inline bool
|
||||
isupper_(wchar_t c)
|
||||
{
|
||||
using namespace std;
|
||||
return iswupper(to_int_type(c)) ? true : false;
|
||||
}
|
||||
|
||||
inline bool
|
||||
isxdigit_(wchar_t c)
|
||||
{
|
||||
using namespace std;
|
||||
return iswxdigit(to_int_type(c)) ? true : false;
|
||||
}
|
||||
|
||||
inline bool
|
||||
isblank_(wchar_t c)
|
||||
{
|
||||
return (c == L' ' || c == L'\t');
|
||||
}
|
||||
|
||||
inline wchar_t
|
||||
tolower_(wchar_t c)
|
||||
{
|
||||
using namespace std;
|
||||
return to_char_type<wchar_t>(towlower(to_int_type(c)));
|
||||
}
|
||||
|
||||
inline wchar_t
|
||||
toupper_(wchar_t c)
|
||||
{
|
||||
using namespace std;
|
||||
return to_char_type<wchar_t>(towupper(to_int_type(c)));
|
||||
}
|
||||
|
||||
#endif // !defined(BOOST_NO_CWCTYPE)
|
||||
|
||||
}
|
||||
|
||||
BOOST_SPIRIT_CLASSIC_NAMESPACE_END
|
||||
|
||||
}} // namespace boost::spirit::impl
|
||||
|
||||
#ifdef BOOST_MSVC
|
||||
#pragma warning (pop)
|
||||
#endif
|
||||
|
||||
#endif
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,55 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2014-2015 Kohei Takahashi
|
||||
|
||||
Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
==============================================================================*/
|
||||
#ifndef FUSION_MAKE_SET_11112014_2255
|
||||
#define FUSION_MAKE_SET_11112014_2255
|
||||
|
||||
#include <boost/fusion/support/config.hpp>
|
||||
#include <boost/fusion/container/set/set.hpp>
|
||||
|
||||
#if !defined(BOOST_FUSION_HAS_VARIADIC_SET)
|
||||
# include <boost/fusion/container/generation/detail/pp_make_set.hpp>
|
||||
#else
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// C++11 variadic interface
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include <boost/fusion/support/detail/as_fusion_element.hpp>
|
||||
#include <boost/type_traits/remove_reference.hpp>
|
||||
#include <boost/type_traits/remove_const.hpp>
|
||||
#include <utility>
|
||||
|
||||
namespace boost { namespace fusion
|
||||
{
|
||||
namespace result_of
|
||||
{
|
||||
template <typename ...T>
|
||||
struct make_set
|
||||
{
|
||||
typedef set<
|
||||
typename detail::as_fusion_element<
|
||||
typename remove_const<
|
||||
typename remove_reference<T>::type
|
||||
>::type
|
||||
>::type...
|
||||
> type;
|
||||
};
|
||||
}
|
||||
|
||||
template <typename ...T>
|
||||
BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
|
||||
inline typename result_of::make_set<T...>::type
|
||||
make_set(T&&... arg)
|
||||
{
|
||||
return typename result_of::make_set<T...>::type(std::forward<T>(arg)...);
|
||||
}
|
||||
}}
|
||||
|
||||
|
||||
#endif
|
||||
#endif
|
||||
|
||||
@@ -0,0 +1,48 @@
|
||||
subroutine timefft_opts(npatience,nthreads,linplace,lcomplex,nfft, &
|
||||
problem,nflags)
|
||||
|
||||
use FFTW3
|
||||
|
||||
logical linplace,lcomplex
|
||||
character problem*9,arg*12
|
||||
|
||||
nargs=iargc()
|
||||
if(nargs.lt.3) then
|
||||
print*,'Usage: timefft npatience maxthreads [[o|i][r|c]]nfft'
|
||||
print*,' npatience - 0 to 4'
|
||||
print*,' maxthreads - suggest #CPUs or #CPUs-1'
|
||||
print*,' o,i - out-of-place or in-place (default=in-place)'
|
||||
print*,' r,c - real or complex (default=complex)'
|
||||
print*,' '
|
||||
print*,'Examples:'
|
||||
print*,' timefft 1 1 32768 (1 thread, in-place, complex)'
|
||||
print*,' timefft 2 3 or32768 (more patient, 3 threads,'
|
||||
print*,' out-of-place, real)'
|
||||
stop
|
||||
endif
|
||||
|
||||
call getarg(1,arg)
|
||||
read(arg,*) npatience
|
||||
call getarg(2,arg)
|
||||
read(arg,*) nthreads
|
||||
call getarg(3,arg)
|
||||
linplace=arg(1:1).ne.'o' .and. arg(2:2).ne.'o'
|
||||
lcomplex=arg(1:1).ne.'r' .and. arg(2:2).ne.'r'
|
||||
k=3
|
||||
if(ichar(arg(2:2)).ge.48 .and. ichar(arg(2:2)).le.57) k=2
|
||||
if(ichar(arg(1:1)).ge.48 .and. ichar(arg(1:1)).le.57) k=1
|
||||
read(arg(k:),*) nfft
|
||||
|
||||
write(problem,'(i9)') nfft
|
||||
problem='ic'//adjustl(problem)
|
||||
if(.not.linplace) problem(1:1)='o'
|
||||
if(.not.lcomplex) problem(2:2)='r'
|
||||
|
||||
nflags=FFTW_ESTIMATE
|
||||
if(npatience.eq.1) nflags=FFTW_ESTIMATE_PATIENT
|
||||
if(npatience.eq.2) nflags=FFTW_MEASURE
|
||||
if(npatience.eq.3) nflags=FFTW_PATIENT
|
||||
if(npatience.eq.4) nflags=FFTW_EXHAUSTIVE
|
||||
|
||||
return
|
||||
end subroutine timefft_opts
|
||||
@@ -0,0 +1,121 @@
|
||||
/*
|
||||
* 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)
|
||||
*
|
||||
* Copyright (c) 2009 Helge Bahmann
|
||||
* Copyright (c) 2014 Andrey Semashev
|
||||
*/
|
||||
/*!
|
||||
* \file atomic/detail/platform.hpp
|
||||
*
|
||||
* This header defines macros for the target platform detection
|
||||
*/
|
||||
|
||||
#ifndef BOOST_ATOMIC_DETAIL_PLATFORM_HPP_INCLUDED_
|
||||
#define BOOST_ATOMIC_DETAIL_PLATFORM_HPP_INCLUDED_
|
||||
|
||||
#include <boost/atomic/detail/config.hpp>
|
||||
|
||||
#ifdef BOOST_HAS_PRAGMA_ONCE
|
||||
#pragma once
|
||||
#endif
|
||||
|
||||
#if !defined(BOOST_ATOMIC_FORCE_FALLBACK)
|
||||
|
||||
// Compiler-based backends
|
||||
#if (defined(__ibmxl__) || defined(__IBMCPP__)) && defined(__PPC__)
|
||||
|
||||
// IBM XL C++ Compiler has to be checked before GCC/Clang as it pretends to be one but does not support __atomic* intrinsics.
|
||||
// It does support GCC inline assembler though.
|
||||
#define BOOST_ATOMIC_DETAIL_PLATFORM gcc_ppc
|
||||
|
||||
#elif ((defined(__GNUC__) && ((__GNUC__ * 100 + __GNUC_MINOR__) >= 407)) ||\
|
||||
(defined(BOOST_CLANG) && ((__clang_major__ * 100 + __clang_minor__) >= 302))) &&\
|
||||
(\
|
||||
(__GCC_ATOMIC_BOOL_LOCK_FREE + 0) == 2 ||\
|
||||
(__GCC_ATOMIC_CHAR_LOCK_FREE + 0) == 2 ||\
|
||||
(__GCC_ATOMIC_SHORT_LOCK_FREE + 0) == 2 ||\
|
||||
(__GCC_ATOMIC_INT_LOCK_FREE + 0) == 2 ||\
|
||||
(__GCC_ATOMIC_LONG_LOCK_FREE + 0) == 2 ||\
|
||||
(__GCC_ATOMIC_LLONG_LOCK_FREE + 0) == 2\
|
||||
)
|
||||
|
||||
#define BOOST_ATOMIC_DETAIL_PLATFORM gcc_atomic
|
||||
|
||||
#elif (defined(__GNUC__) || defined(__SUNPRO_CC)) && (defined(__i386__) || defined(__x86_64__))
|
||||
|
||||
#define BOOST_ATOMIC_DETAIL_PLATFORM gcc_x86
|
||||
|
||||
#elif defined(__GNUC__) && (defined(__POWERPC__) || defined(__PPC__))
|
||||
|
||||
#define BOOST_ATOMIC_DETAIL_PLATFORM gcc_ppc
|
||||
|
||||
// This list of ARM architecture versions comes from Apple's arm/arch.h header.
|
||||
// I don't know how complete it is.
|
||||
#elif defined(__GNUC__) &&\
|
||||
(\
|
||||
defined(__ARM_ARCH_6__) || defined(__ARM_ARCH_6J__) ||\
|
||||
defined(__ARM_ARCH_6K__) || defined(__ARM_ARCH_6Z__) ||\
|
||||
defined(__ARM_ARCH_6ZK__) ||\
|
||||
defined(__ARM_ARCH_7__) || defined(__ARM_ARCH_7A__) ||\
|
||||
defined(__ARM_ARCH_7R__) || defined(__ARM_ARCH_7M__) ||\
|
||||
defined(__ARM_ARCH_7EM__) || defined(__ARM_ARCH_7S__)\
|
||||
)
|
||||
|
||||
#define BOOST_ATOMIC_DETAIL_PLATFORM gcc_arm
|
||||
|
||||
#elif (defined(__GNUC__) || defined(__SUNPRO_CC)) && (defined(__sparcv8plus) || defined(__sparc_v9__))
|
||||
|
||||
#define BOOST_ATOMIC_DETAIL_PLATFORM gcc_sparc
|
||||
|
||||
#elif defined(__GNUC__) && defined(__alpha__)
|
||||
|
||||
#define BOOST_ATOMIC_DETAIL_PLATFORM gcc_alpha
|
||||
|
||||
#elif defined(__GNUC__) && ((__GNUC__ * 100 + __GNUC_MINOR__) >= 401) &&\
|
||||
(\
|
||||
defined(__GCC_HAVE_SYNC_COMPARE_AND_SWAP_1) ||\
|
||||
defined(__GCC_HAVE_SYNC_COMPARE_AND_SWAP_2) ||\
|
||||
defined(__GCC_HAVE_SYNC_COMPARE_AND_SWAP_4) ||\
|
||||
defined(__GCC_HAVE_SYNC_COMPARE_AND_SWAP_8) ||\
|
||||
defined(__GCC_HAVE_SYNC_COMPARE_AND_SWAP_16)\
|
||||
)
|
||||
|
||||
#define BOOST_ATOMIC_DETAIL_PLATFORM gcc_sync
|
||||
|
||||
#elif defined(_MSC_VER) && (defined(_M_IX86) || defined(_M_X64))
|
||||
|
||||
#define BOOST_ATOMIC_DETAIL_PLATFORM msvc_x86
|
||||
|
||||
#elif defined(_MSC_VER) && _MSC_VER >= 1700 && defined(_M_ARM)
|
||||
|
||||
#define BOOST_ATOMIC_DETAIL_PLATFORM msvc_arm
|
||||
|
||||
#endif
|
||||
|
||||
// OS-based backends
|
||||
#if !defined(BOOST_ATOMIC_DETAIL_PLATFORM)
|
||||
|
||||
#if defined(__linux__) && defined(__arm__)
|
||||
|
||||
#define BOOST_ATOMIC_DETAIL_PLATFORM linux_arm
|
||||
|
||||
#elif defined(BOOST_WINDOWS) || defined(_WIN32_CE)
|
||||
|
||||
#define BOOST_ATOMIC_DETAIL_PLATFORM windows
|
||||
|
||||
#endif
|
||||
|
||||
#endif // !defined(BOOST_ATOMIC_DETAIL_PLATFORM)
|
||||
|
||||
#endif // !defined(BOOST_ATOMIC_FORCE_FALLBACK)
|
||||
|
||||
#if !defined(BOOST_ATOMIC_DETAIL_PLATFORM)
|
||||
#define BOOST_ATOMIC_DETAIL_PLATFORM emulated
|
||||
#define BOOST_ATOMIC_EMULATED
|
||||
#endif
|
||||
|
||||
#define BOOST_ATOMIC_DETAIL_HEADER(prefix) <BOOST_JOIN(prefix, BOOST_ATOMIC_DETAIL_PLATFORM).hpp>
|
||||
|
||||
#endif // BOOST_ATOMIC_DETAIL_PLATFORM_HPP_INCLUDED_
|
||||
@@ -0,0 +1,33 @@
|
||||
// Boost string_algo library yes_no_type.hpp header file ---------------------------//
|
||||
|
||||
// Copyright Pavol Droba 2002-2003.
|
||||
//
|
||||
// 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_STRING_YES_NO_TYPE_DETAIL_HPP
|
||||
#define BOOST_STRING_YES_NO_TYPE_DETAIL_HPP
|
||||
|
||||
namespace boost {
|
||||
namespace algorithm {
|
||||
|
||||
// taken from boost mailing-list
|
||||
// when yes_no_type will become officially
|
||||
// a part of boost distribution, this header
|
||||
// will be deprecated
|
||||
template<int I> struct size_descriptor
|
||||
{
|
||||
typedef char (& type)[I];
|
||||
};
|
||||
|
||||
typedef size_descriptor<1>::type yes_type;
|
||||
typedef size_descriptor<2>::type no_type;
|
||||
|
||||
} // namespace algorithm
|
||||
} // namespace boost
|
||||
|
||||
|
||||
#endif // BOOST_STRING_YES_NO_TYPE_DETAIL_HPP
|
||||
@@ -0,0 +1,168 @@
|
||||
#ifndef BOOST_PROPERTY_TREE_DETAIL_JSON_PARSER_NARROW_ENCODING_HPP
|
||||
#define BOOST_PROPERTY_TREE_DETAIL_JSON_PARSER_NARROW_ENCODING_HPP
|
||||
|
||||
#include <boost/assert.hpp>
|
||||
#include <boost/range/iterator_range_core.hpp>
|
||||
|
||||
#include <utility>
|
||||
|
||||
namespace boost { namespace property_tree {
|
||||
namespace json_parser { namespace detail
|
||||
{
|
||||
|
||||
struct external_ascii_superset_encoding
|
||||
{
|
||||
typedef char external_char;
|
||||
|
||||
bool is_nl(char c) const { return c == '\n'; }
|
||||
bool is_ws(char c) const {
|
||||
return c == ' ' || c == '\t' || c == '\n' || c == '\r';
|
||||
}
|
||||
|
||||
bool is_minus(char c) const { return c == '-'; }
|
||||
bool is_plusminus(char c) const { return c == '+' || c == '-'; }
|
||||
bool is_dot(char c) const { return c == '.'; }
|
||||
bool is_eE(char c) const { return c == 'e' || c == 'E'; }
|
||||
bool is_0(char c) const { return c == '0'; }
|
||||
bool is_digit(char c) const { return c >= '0' && c <= '9'; }
|
||||
bool is_digit0(char c) const { return c >= '1' && c <= '9'; }
|
||||
|
||||
bool is_quote(char c) const { return c == '"'; }
|
||||
bool is_backslash(char c) const { return c == '\\'; }
|
||||
bool is_slash(char c) const { return c == '/'; }
|
||||
|
||||
bool is_comma(char c) const { return c == ','; }
|
||||
bool is_open_bracket(char c) const { return c == '['; }
|
||||
bool is_close_bracket(char c) const { return c == ']'; }
|
||||
bool is_colon(char c) const { return c == ':'; }
|
||||
bool is_open_brace(char c) const { return c == '{'; }
|
||||
bool is_close_brace(char c) const { return c == '}'; }
|
||||
|
||||
bool is_a(char c) const { return c == 'a'; }
|
||||
bool is_b(char c) const { return c == 'b'; }
|
||||
bool is_e(char c) const { return c == 'e'; }
|
||||
bool is_f(char c) const { return c == 'f'; }
|
||||
bool is_l(char c) const { return c == 'l'; }
|
||||
bool is_n(char c) const { return c == 'n'; }
|
||||
bool is_r(char c) const { return c == 'r'; }
|
||||
bool is_s(char c) const { return c == 's'; }
|
||||
bool is_t(char c) const { return c == 't'; }
|
||||
bool is_u(char c) const { return c == 'u'; }
|
||||
|
||||
int decode_hexdigit(char c) {
|
||||
if (c >= '0' && c <= '9') return c - '0';
|
||||
if (c >= 'A' && c <= 'F') return c - 'A' + 10;
|
||||
if (c >= 'a' && c <= 'f') return c - 'a' + 10;
|
||||
return -1;
|
||||
}
|
||||
};
|
||||
|
||||
struct utf8_utf8_encoding : external_ascii_superset_encoding
|
||||
{
|
||||
typedef char internal_char;
|
||||
|
||||
template <typename Iterator>
|
||||
boost::iterator_range<Iterator>
|
||||
to_internal(Iterator first, Iterator last) const {
|
||||
return boost::make_iterator_range(first, last);
|
||||
}
|
||||
|
||||
char to_internal_trivial(char c) const {
|
||||
BOOST_ASSERT(static_cast<unsigned char>(c) <= 0x7f);
|
||||
return c;
|
||||
}
|
||||
|
||||
template <typename Iterator, typename Sentinel,
|
||||
typename EncodingErrorFn>
|
||||
void skip_codepoint(Iterator& cur, Sentinel end,
|
||||
EncodingErrorFn error_fn) const {
|
||||
transcode_codepoint(cur, end, DoNothing(), error_fn);
|
||||
}
|
||||
|
||||
template <typename Iterator, typename Sentinel, typename TranscodedFn,
|
||||
typename EncodingErrorFn>
|
||||
void transcode_codepoint(Iterator& cur, Sentinel end,
|
||||
TranscodedFn transcoded_fn, EncodingErrorFn error_fn) const {
|
||||
unsigned char c = *cur;
|
||||
++cur;
|
||||
if (c <= 0x7f) {
|
||||
// Solo byte, filter out disallowed codepoints.
|
||||
if (c < 0x20) {
|
||||
error_fn();
|
||||
}
|
||||
transcoded_fn(c);
|
||||
return;
|
||||
}
|
||||
int trailing = trail_table(c);
|
||||
if (trailing == -1) {
|
||||
// Standalone trailing byte or overly long sequence.
|
||||
error_fn();
|
||||
}
|
||||
transcoded_fn(c);
|
||||
for (int i = 0; i < trailing; ++i) {
|
||||
if (cur == end || !is_trail(*cur)) {
|
||||
error_fn();
|
||||
}
|
||||
transcoded_fn(*cur);
|
||||
++cur;
|
||||
}
|
||||
}
|
||||
|
||||
template <typename TranscodedFn>
|
||||
void feed_codepoint(unsigned codepoint,
|
||||
TranscodedFn transcoded_fn) const {
|
||||
if (codepoint <= 0x7f) {
|
||||
transcoded_fn(static_cast<char>(codepoint));
|
||||
} else if (codepoint <= 0x7ff) {
|
||||
transcoded_fn(static_cast<char>(0xc0 | (codepoint >> 6)));
|
||||
transcoded_fn(trail(codepoint));
|
||||
} else if (codepoint <= 0xffff) {
|
||||
transcoded_fn(static_cast<char>(0xe0 | (codepoint >> 12)));
|
||||
transcoded_fn(trail(codepoint >> 6));
|
||||
transcoded_fn(trail(codepoint));
|
||||
} else if (codepoint <= 0x10ffff) {
|
||||
transcoded_fn(static_cast<char>(0xf0 | (codepoint >> 18)));
|
||||
transcoded_fn(trail(codepoint >> 12));
|
||||
transcoded_fn(trail(codepoint >> 6));
|
||||
transcoded_fn(trail(codepoint));
|
||||
}
|
||||
}
|
||||
|
||||
template <typename Iterator, typename Sentinel>
|
||||
void skip_introduction(Iterator& cur, Sentinel end) const {
|
||||
if (cur != end && static_cast<unsigned char>(*cur) == 0xef) {
|
||||
if (++cur == end) return;
|
||||
if (++cur == end) return;
|
||||
if (++cur == end) return;
|
||||
}
|
||||
}
|
||||
|
||||
private:
|
||||
struct DoNothing {
|
||||
void operator ()(char) const {}
|
||||
};
|
||||
|
||||
bool is_trail(unsigned char c) const {
|
||||
return (c & 0xc0) == 0x80;
|
||||
}
|
||||
|
||||
int trail_table(unsigned char c) const {
|
||||
static const signed char table[] = {
|
||||
/* not a lead byte */
|
||||
/* 0x10???sss */ -1, -1, -1, -1, -1, -1, -1, -1,
|
||||
/* 0x110??sss */ 1, 1, 1, 1, /* 1 trailing byte */
|
||||
/* 0x1110?sss */ 2, 2, /* 2 trailing bytes */
|
||||
/* 0x11110sss */ 3, /* 3 trailing bytes */
|
||||
/* 0x11111sss */ -1 /* 4 or 5 trailing bytes, disallowed */
|
||||
};
|
||||
return table[(c & 0x7f) >> 3];
|
||||
}
|
||||
|
||||
char trail(unsigned unmasked) const {
|
||||
return static_cast<char>(0x80 | (unmasked & 0x3f));
|
||||
}
|
||||
};
|
||||
|
||||
}}}}
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,357 @@
|
||||
// Boost Lambda Library - lambda_functors.hpp -------------------------------
|
||||
|
||||
// Copyright (C) 1999, 2000 Jaakko Jarvi (jaakko.jarvi@cs.utu.fi)
|
||||
//
|
||||
// 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)
|
||||
//
|
||||
// For more information, see http://www.boost.org
|
||||
|
||||
// ------------------------------------------------
|
||||
|
||||
#ifndef BOOST_LAMBDA_LAMBDA_FUNCTORS_HPP
|
||||
#define BOOST_LAMBDA_LAMBDA_FUNCTORS_HPP
|
||||
|
||||
#include <boost/config.hpp>
|
||||
#include <boost/detail/workaround.hpp>
|
||||
#include <boost/utility/result_of.hpp>
|
||||
|
||||
#if BOOST_WORKAROUND(BOOST_MSVC, == 1310)
|
||||
|
||||
#include <boost/mpl/or.hpp>
|
||||
#include <boost/utility/enable_if.hpp>
|
||||
#include <boost/type_traits/is_array.hpp>
|
||||
|
||||
#define BOOST_LAMBDA_DISABLE_IF_ARRAY1(A1, R1)\
|
||||
typename lazy_disable_if<is_array<A1>, typename R1 >::type
|
||||
#define BOOST_LAMBDA_DISABLE_IF_ARRAY2(A1, A2, R1, R2) \
|
||||
typename lazy_disable_if<mpl::or_<is_array<A1>, is_array<A2> >, typename R1, R2 >::type
|
||||
#define BOOST_LAMBDA_DISABLE_IF_ARRAY3(A1, A2, A3, R1, R2, R3) \
|
||||
typename lazy_disable_if<mpl::or_<is_array<A1>, is_array<A2>, is_array<A3> >, typename R1, R2, R3 >::type
|
||||
|
||||
#else
|
||||
|
||||
#define BOOST_LAMBDA_DISABLE_IF_ARRAY1(A1, R1) typename R1::type
|
||||
#define BOOST_LAMBDA_DISABLE_IF_ARRAY2(A1, A2, R1, R2) typename R1, R2::type
|
||||
#define BOOST_LAMBDA_DISABLE_IF_ARRAY3(A1, A2, A3, R1, R2, R3) typename R1, R2, R3::type
|
||||
|
||||
#endif
|
||||
|
||||
namespace boost {
|
||||
namespace lambda {
|
||||
|
||||
// -- lambda_functor --------------------------------------------
|
||||
// --------------------------------------------------------------
|
||||
|
||||
//inline const null_type const_null_type() { return null_type(); }
|
||||
|
||||
namespace detail {
|
||||
namespace {
|
||||
|
||||
static const null_type constant_null_type = null_type();
|
||||
|
||||
} // unnamed
|
||||
} // detail
|
||||
|
||||
class unused {};
|
||||
|
||||
#define cnull_type() detail::constant_null_type
|
||||
|
||||
// -- free variables types --------------------------------------------------
|
||||
|
||||
// helper to work around the case where the nullary return type deduction
|
||||
// is always performed, even though the functor is not nullary
|
||||
namespace detail {
|
||||
template<int N, class Tuple> struct get_element_or_null_type {
|
||||
typedef typename
|
||||
detail::tuple_element_as_reference<N, Tuple>::type type;
|
||||
};
|
||||
template<int N> struct get_element_or_null_type<N, null_type> {
|
||||
typedef null_type type;
|
||||
};
|
||||
}
|
||||
|
||||
template <int I> struct placeholder;
|
||||
|
||||
template<> struct placeholder<FIRST> {
|
||||
|
||||
template<class SigArgs> struct sig {
|
||||
typedef typename detail::get_element_or_null_type<0, SigArgs>::type type;
|
||||
};
|
||||
|
||||
template<class RET, CALL_TEMPLATE_ARGS>
|
||||
RET call(CALL_FORMAL_ARGS) const {
|
||||
BOOST_STATIC_ASSERT(boost::is_reference<RET>::value);
|
||||
CALL_USE_ARGS; // does nothing, prevents warnings for unused args
|
||||
return a;
|
||||
}
|
||||
};
|
||||
|
||||
template<> struct placeholder<SECOND> {
|
||||
|
||||
template<class SigArgs> struct sig {
|
||||
typedef typename detail::get_element_or_null_type<1, SigArgs>::type type;
|
||||
};
|
||||
|
||||
template<class RET, CALL_TEMPLATE_ARGS>
|
||||
RET call(CALL_FORMAL_ARGS) const { CALL_USE_ARGS; return b; }
|
||||
};
|
||||
|
||||
template<> struct placeholder<THIRD> {
|
||||
|
||||
template<class SigArgs> struct sig {
|
||||
typedef typename detail::get_element_or_null_type<2, SigArgs>::type type;
|
||||
};
|
||||
|
||||
template<class RET, CALL_TEMPLATE_ARGS>
|
||||
RET call(CALL_FORMAL_ARGS) const { CALL_USE_ARGS; return c; }
|
||||
};
|
||||
|
||||
template<> struct placeholder<EXCEPTION> {
|
||||
|
||||
template<class SigArgs> struct sig {
|
||||
typedef typename detail::get_element_or_null_type<3, SigArgs>::type type;
|
||||
};
|
||||
|
||||
template<class RET, CALL_TEMPLATE_ARGS>
|
||||
RET call(CALL_FORMAL_ARGS) const { CALL_USE_ARGS; return env; }
|
||||
};
|
||||
|
||||
typedef const lambda_functor<placeholder<FIRST> > placeholder1_type;
|
||||
typedef const lambda_functor<placeholder<SECOND> > placeholder2_type;
|
||||
typedef const lambda_functor<placeholder<THIRD> > placeholder3_type;
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
// free variables are lambda_functors. This is to allow uniform handling with
|
||||
// other lambda_functors.
|
||||
// -------------------------------------------------------------------
|
||||
|
||||
#if BOOST_WORKAROUND(BOOST_MSVC, >= 1400)
|
||||
#pragma warning(push)
|
||||
#pragma warning(disable:4512) //assignment operator could not be generated
|
||||
#endif
|
||||
|
||||
// -- lambda_functor NONE ------------------------------------------------
|
||||
template <class T>
|
||||
class lambda_functor : public T
|
||||
{
|
||||
|
||||
BOOST_STATIC_CONSTANT(int, arity_bits = get_arity<T>::value);
|
||||
|
||||
public:
|
||||
typedef T inherited;
|
||||
|
||||
lambda_functor() {}
|
||||
lambda_functor(const lambda_functor& l) : inherited(l) {}
|
||||
|
||||
lambda_functor(const T& t) : inherited(t) {}
|
||||
|
||||
template <class SigArgs> struct sig {
|
||||
typedef typename inherited::template
|
||||
sig<typename SigArgs::tail_type>::type type;
|
||||
};
|
||||
|
||||
// Note that this return type deduction template is instantiated, even
|
||||
// if the nullary
|
||||
// operator() is not called at all. One must make sure that it does not fail.
|
||||
typedef typename
|
||||
inherited::template sig<null_type>::type
|
||||
nullary_return_type;
|
||||
|
||||
// Support for boost::result_of.
|
||||
template <class Sig> struct result;
|
||||
template <class F>
|
||||
struct result<F()> {
|
||||
typedef nullary_return_type type;
|
||||
};
|
||||
template <class F, class A>
|
||||
struct result<F(A)> {
|
||||
typedef typename sig<tuple<F, A> >::type type;
|
||||
};
|
||||
template <class F, class A, class B>
|
||||
struct result<F(A, B)> {
|
||||
typedef typename sig<tuple<F, A, B> >::type type;
|
||||
};
|
||||
template <class F, class A, class B, class C>
|
||||
struct result<F(A, B, C)> {
|
||||
typedef typename sig<tuple<F, A, B, C> >::type type;
|
||||
};
|
||||
|
||||
nullary_return_type operator()() const {
|
||||
return inherited::template
|
||||
call<nullary_return_type>
|
||||
(cnull_type(), cnull_type(), cnull_type(), cnull_type());
|
||||
}
|
||||
|
||||
template<class A>
|
||||
typename inherited::template sig<tuple<A&> >::type
|
||||
operator()(A& a) const {
|
||||
return inherited::template call<
|
||||
typename inherited::template sig<tuple<A&> >::type
|
||||
>(a, cnull_type(), cnull_type(), cnull_type());
|
||||
}
|
||||
|
||||
template<class A>
|
||||
BOOST_LAMBDA_DISABLE_IF_ARRAY1(A, inherited::template sig<tuple<A const&> >)
|
||||
operator()(A const& a) const {
|
||||
return inherited::template call<
|
||||
typename inherited::template sig<tuple<A const&> >::type
|
||||
>(a, cnull_type(), cnull_type(), cnull_type());
|
||||
}
|
||||
|
||||
template<class A, class B>
|
||||
typename inherited::template sig<tuple<A&, B&> >::type
|
||||
operator()(A& a, B& b) const {
|
||||
return inherited::template call<
|
||||
typename inherited::template sig<tuple<A&, B&> >::type
|
||||
>(a, b, cnull_type(), cnull_type());
|
||||
}
|
||||
|
||||
template<class A, class B>
|
||||
BOOST_LAMBDA_DISABLE_IF_ARRAY2(A, B, inherited::template sig<tuple<A const&, B&> >)
|
||||
operator()(A const& a, B& b) const {
|
||||
return inherited::template call<
|
||||
typename inherited::template sig<tuple<A const&, B&> >::type
|
||||
>(a, b, cnull_type(), cnull_type());
|
||||
}
|
||||
|
||||
template<class A, class B>
|
||||
BOOST_LAMBDA_DISABLE_IF_ARRAY2(A, B, inherited::template sig<tuple<A&, B const&> >)
|
||||
operator()(A& a, B const& b) const {
|
||||
return inherited::template call<
|
||||
typename inherited::template sig<tuple<A&, B const&> >::type
|
||||
>(a, b, cnull_type(), cnull_type());
|
||||
}
|
||||
|
||||
template<class A, class B>
|
||||
BOOST_LAMBDA_DISABLE_IF_ARRAY2(A, B, inherited::template sig<tuple<A const&, B const&> >)
|
||||
operator()(A const& a, B const& b) const {
|
||||
return inherited::template call<
|
||||
typename inherited::template sig<tuple<A const&, B const&> >::type
|
||||
>(a, b, cnull_type(), cnull_type());
|
||||
}
|
||||
|
||||
template<class A, class B, class C>
|
||||
typename inherited::template sig<tuple<A&, B&, C&> >::type
|
||||
operator()(A& a, B& b, C& c) const
|
||||
{
|
||||
return inherited::template call<
|
||||
typename inherited::template sig<tuple<A&, B&, C&> >::type
|
||||
>(a, b, c, cnull_type());
|
||||
}
|
||||
|
||||
template<class A, class B, class C>
|
||||
BOOST_LAMBDA_DISABLE_IF_ARRAY3(A, B, C, inherited::template sig<tuple<A const&, B const&, C const&> >)
|
||||
operator()(A const& a, B const& b, C const& c) const
|
||||
{
|
||||
return inherited::template call<
|
||||
typename inherited::template sig<tuple<A const&, B const&, C const&> >::type
|
||||
>(a, b, c, cnull_type());
|
||||
}
|
||||
|
||||
// for internal calls with env
|
||||
template<CALL_TEMPLATE_ARGS>
|
||||
typename inherited::template sig<tuple<CALL_REFERENCE_TYPES> >::type
|
||||
internal_call(CALL_FORMAL_ARGS) const {
|
||||
return inherited::template
|
||||
call<typename inherited::template
|
||||
sig<tuple<CALL_REFERENCE_TYPES> >::type>(CALL_ACTUAL_ARGS);
|
||||
}
|
||||
|
||||
template<class A>
|
||||
const lambda_functor<lambda_functor_base<
|
||||
other_action<assignment_action>,
|
||||
boost::tuple<lambda_functor,
|
||||
typename const_copy_argument <const A>::type> > >
|
||||
operator=(const A& a) const {
|
||||
return lambda_functor_base<
|
||||
other_action<assignment_action>,
|
||||
boost::tuple<lambda_functor,
|
||||
typename const_copy_argument <const A>::type> >
|
||||
( boost::tuple<lambda_functor,
|
||||
typename const_copy_argument <const A>::type>(*this, a) );
|
||||
}
|
||||
|
||||
template<class A>
|
||||
const lambda_functor<lambda_functor_base<
|
||||
other_action<subscript_action>,
|
||||
boost::tuple<lambda_functor,
|
||||
typename const_copy_argument <const A>::type> > >
|
||||
operator[](const A& a) const {
|
||||
return lambda_functor_base<
|
||||
other_action<subscript_action>,
|
||||
boost::tuple<lambda_functor,
|
||||
typename const_copy_argument <const A>::type> >
|
||||
( boost::tuple<lambda_functor,
|
||||
typename const_copy_argument <const A>::type>(*this, a ) );
|
||||
}
|
||||
};
|
||||
|
||||
#if BOOST_WORKAROUND(BOOST_MSVC, >= 1400)
|
||||
#pragma warning(pop)
|
||||
#endif
|
||||
|
||||
} // namespace lambda
|
||||
} // namespace boost
|
||||
|
||||
namespace boost {
|
||||
|
||||
#if !defined(BOOST_RESULT_OF_USE_DECLTYPE) || defined(BOOST_NO_CXX11_DECLTYPE)
|
||||
|
||||
template<class T>
|
||||
struct result_of<boost::lambda::lambda_functor<T>()>
|
||||
{
|
||||
typedef typename boost::lambda::lambda_functor<T>::nullary_return_type type;
|
||||
};
|
||||
|
||||
template<class T>
|
||||
struct result_of<const boost::lambda::lambda_functor<T>()>
|
||||
{
|
||||
typedef typename boost::lambda::lambda_functor<T>::nullary_return_type type;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
template<class T>
|
||||
struct tr1_result_of<boost::lambda::lambda_functor<T>()>
|
||||
{
|
||||
typedef typename boost::lambda::lambda_functor<T>::nullary_return_type type;
|
||||
};
|
||||
|
||||
template<class T>
|
||||
struct tr1_result_of<const boost::lambda::lambda_functor<T>()>
|
||||
{
|
||||
typedef typename boost::lambda::lambda_functor<T>::nullary_return_type type;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
// is_placeholder
|
||||
|
||||
#include <boost/is_placeholder.hpp>
|
||||
|
||||
namespace boost
|
||||
{
|
||||
|
||||
template<> struct is_placeholder< lambda::lambda_functor< lambda::placeholder<lambda::FIRST> > >
|
||||
{
|
||||
enum _vt { value = 1 };
|
||||
};
|
||||
|
||||
template<> struct is_placeholder< lambda::lambda_functor< lambda::placeholder<lambda::SECOND> > >
|
||||
{
|
||||
enum _vt { value = 2 };
|
||||
};
|
||||
|
||||
template<> struct is_placeholder< lambda::lambda_functor< lambda::placeholder<lambda::THIRD> > >
|
||||
{
|
||||
enum _vt { value = 3 };
|
||||
};
|
||||
|
||||
} // namespace boost
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,33 @@
|
||||
|
||||
#ifndef BOOST_MPL_AUX_RANGE_C_FRONT_HPP_INCLUDED
|
||||
#define BOOST_MPL_AUX_RANGE_C_FRONT_HPP_INCLUDED
|
||||
|
||||
// Copyright Aleksey Gurtovoy 2000-2004
|
||||
//
|
||||
// Distributed under the Boost Software License, Version 1.0.
|
||||
// (See accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
//
|
||||
// See http://www.boost.org/libs/mpl for documentation.
|
||||
|
||||
// $Id$
|
||||
// $Date$
|
||||
// $Revision$
|
||||
|
||||
#include <boost/mpl/front_fwd.hpp>
|
||||
#include <boost/mpl/aux_/range_c/tag.hpp>
|
||||
|
||||
namespace boost { namespace mpl {
|
||||
|
||||
template<>
|
||||
struct front_impl< aux::half_open_range_tag >
|
||||
{
|
||||
template< typename Range > struct apply
|
||||
{
|
||||
typedef typename Range::start type;
|
||||
};
|
||||
};
|
||||
|
||||
}}
|
||||
|
||||
#endif // BOOST_MPL_AUX_RANGE_C_FRONT_HPP_INCLUDED
|
||||
@@ -0,0 +1,51 @@
|
||||
/*=============================================================================
|
||||
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_LIST_FORWARD_07172005_0224)
|
||||
#define FUSION_LIST_FORWARD_07172005_0224
|
||||
|
||||
#include <boost/fusion/support/config.hpp>
|
||||
#include <boost/fusion/container/list/detail/cpp03/limits.hpp>
|
||||
#include <boost/preprocessor/repetition/enum_params_with_a_default.hpp>
|
||||
|
||||
#if !defined(BOOST_FUSION_DONT_USE_PREPROCESSED_FILES)
|
||||
#include <boost/fusion/container/list/detail/cpp03/preprocessed/list_fwd.hpp>
|
||||
#else
|
||||
#if defined(__WAVE__) && defined(BOOST_FUSION_CREATE_PREPROCESSED_FILES)
|
||||
#pragma wave option(preserve: 2, line: 0, output: "preprocessed/list" FUSION_MAX_LIST_SIZE_STR "_fwd.hpp")
|
||||
#endif
|
||||
|
||||
/*=============================================================================
|
||||
Copyright (c) 2001-2011 Joel de Guzman
|
||||
|
||||
Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
This is an auto-generated file. Do not edit!
|
||||
==============================================================================*/
|
||||
|
||||
#if defined(__WAVE__) && defined(BOOST_FUSION_CREATE_PREPROCESSED_FILES)
|
||||
#pragma wave option(preserve: 1)
|
||||
#endif
|
||||
|
||||
namespace boost { namespace fusion
|
||||
{
|
||||
struct void_;
|
||||
|
||||
template <
|
||||
BOOST_PP_ENUM_PARAMS_WITH_A_DEFAULT(
|
||||
FUSION_MAX_LIST_SIZE, typename T, void_)
|
||||
>
|
||||
struct list;
|
||||
}}
|
||||
|
||||
#if defined(__WAVE__) && defined(BOOST_FUSION_CREATE_PREPROCESSED_FILES)
|
||||
#pragma wave option(output: null)
|
||||
#endif
|
||||
|
||||
#endif // BOOST_FUSION_DONT_USE_PREPROCESSED_FILES
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,34 @@
|
||||
|
||||
#ifndef BOOST_MPL_AUX_RANGE_C_BACK_HPP_INCLUDED
|
||||
#define BOOST_MPL_AUX_RANGE_C_BACK_HPP_INCLUDED
|
||||
|
||||
// Copyright Aleksey Gurtovoy 2000-2004
|
||||
//
|
||||
// Distributed under the Boost Software License, Version 1.0.
|
||||
// (See accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
//
|
||||
// See http://www.boost.org/libs/mpl for documentation.
|
||||
|
||||
// $Id$
|
||||
// $Date$
|
||||
// $Revision$
|
||||
|
||||
#include <boost/mpl/back_fwd.hpp>
|
||||
#include <boost/mpl/prior.hpp>
|
||||
#include <boost/mpl/aux_/range_c/tag.hpp>
|
||||
|
||||
namespace boost { namespace mpl {
|
||||
|
||||
template<>
|
||||
struct back_impl< aux::half_open_range_tag >
|
||||
{
|
||||
template< typename Range > struct apply
|
||||
{
|
||||
typedef typename prior< typename Range::finish >::type type;
|
||||
};
|
||||
};
|
||||
|
||||
}}
|
||||
|
||||
#endif // BOOST_MPL_AUX_RANGE_C_BACK_HPP_INCLUDED
|
||||
Reference in New Issue
Block a user