Initial Commit
This commit is contained in:
@@ -0,0 +1,41 @@
|
||||
// Boost Lambda Library - lambda_config.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 www.boost.org
|
||||
|
||||
// ---------------------------------------------------------------
|
||||
|
||||
#ifndef BOOST_LAMBDA_LAMBDA_CONFIG_HPP
|
||||
#define BOOST_LAMBDA_LAMBDA_CONFIG_HPP
|
||||
|
||||
// add to boost/config.hpp
|
||||
// for now
|
||||
|
||||
|
||||
# if defined __GNUC__
|
||||
# if (__GNUC__ == 3 && __GNUC_MINOR__ >= 4)
|
||||
# define BOOST_REF_TO_FUNC_CONFLICTS_WITH_REF_TO_T
|
||||
# define BOOST_LAMBDA_INCORRECT_BIND_OVERLOADING
|
||||
# endif
|
||||
# endif // __GNUC__
|
||||
|
||||
|
||||
#if defined __KCC
|
||||
|
||||
#define BOOST_NO_FDECL_TEMPLATES_AS_TEMPLATE_TEMPLATE_PARAMS
|
||||
|
||||
#endif // __KCC
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,267 @@
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
/// \file debug.hpp
|
||||
/// Utilities for debugging Proto expression trees
|
||||
//
|
||||
// Copyright 2008 Eric Niebler. Distributed under the Boost
|
||||
// Software License, Version 1.0. (See accompanying file
|
||||
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
#ifndef BOOST_PROTO_DEBUG_HPP_EAN_12_31_2006
|
||||
#define BOOST_PROTO_DEBUG_HPP_EAN_12_31_2006
|
||||
|
||||
#include <iostream>
|
||||
#include <boost/preprocessor/stringize.hpp>
|
||||
#include <boost/ref.hpp>
|
||||
#include <boost/mpl/assert.hpp>
|
||||
#include <boost/proto/proto_fwd.hpp>
|
||||
#include <boost/proto/traits.hpp>
|
||||
#include <boost/proto/matches.hpp>
|
||||
#include <boost/proto/fusion.hpp>
|
||||
#include <boost/fusion/algorithm/iteration/for_each.hpp>
|
||||
#include <boost/detail/sp_typeinfo.hpp>
|
||||
|
||||
namespace boost { namespace proto
|
||||
{
|
||||
namespace tagns_ { namespace tag
|
||||
{
|
||||
#define BOOST_PROTO_DEFINE_TAG_INSERTION(Tag) \
|
||||
/** \brief INTERNAL ONLY */ \
|
||||
inline std::ostream &operator <<(std::ostream &sout, Tag const &) \
|
||||
{ \
|
||||
return sout << BOOST_PP_STRINGIZE(Tag); \
|
||||
} \
|
||||
/**/
|
||||
|
||||
BOOST_PROTO_DEFINE_TAG_INSERTION(terminal)
|
||||
BOOST_PROTO_DEFINE_TAG_INSERTION(unary_plus)
|
||||
BOOST_PROTO_DEFINE_TAG_INSERTION(negate)
|
||||
BOOST_PROTO_DEFINE_TAG_INSERTION(dereference)
|
||||
BOOST_PROTO_DEFINE_TAG_INSERTION(complement)
|
||||
BOOST_PROTO_DEFINE_TAG_INSERTION(address_of)
|
||||
BOOST_PROTO_DEFINE_TAG_INSERTION(logical_not)
|
||||
BOOST_PROTO_DEFINE_TAG_INSERTION(pre_inc)
|
||||
BOOST_PROTO_DEFINE_TAG_INSERTION(pre_dec)
|
||||
BOOST_PROTO_DEFINE_TAG_INSERTION(post_inc)
|
||||
BOOST_PROTO_DEFINE_TAG_INSERTION(post_dec)
|
||||
BOOST_PROTO_DEFINE_TAG_INSERTION(shift_left)
|
||||
BOOST_PROTO_DEFINE_TAG_INSERTION(shift_right)
|
||||
BOOST_PROTO_DEFINE_TAG_INSERTION(multiplies)
|
||||
BOOST_PROTO_DEFINE_TAG_INSERTION(divides)
|
||||
BOOST_PROTO_DEFINE_TAG_INSERTION(modulus)
|
||||
BOOST_PROTO_DEFINE_TAG_INSERTION(plus)
|
||||
BOOST_PROTO_DEFINE_TAG_INSERTION(minus)
|
||||
BOOST_PROTO_DEFINE_TAG_INSERTION(less)
|
||||
BOOST_PROTO_DEFINE_TAG_INSERTION(greater)
|
||||
BOOST_PROTO_DEFINE_TAG_INSERTION(less_equal)
|
||||
BOOST_PROTO_DEFINE_TAG_INSERTION(greater_equal)
|
||||
BOOST_PROTO_DEFINE_TAG_INSERTION(equal_to)
|
||||
BOOST_PROTO_DEFINE_TAG_INSERTION(not_equal_to)
|
||||
BOOST_PROTO_DEFINE_TAG_INSERTION(logical_or)
|
||||
BOOST_PROTO_DEFINE_TAG_INSERTION(logical_and)
|
||||
BOOST_PROTO_DEFINE_TAG_INSERTION(bitwise_and)
|
||||
BOOST_PROTO_DEFINE_TAG_INSERTION(bitwise_or)
|
||||
BOOST_PROTO_DEFINE_TAG_INSERTION(bitwise_xor)
|
||||
BOOST_PROTO_DEFINE_TAG_INSERTION(comma)
|
||||
BOOST_PROTO_DEFINE_TAG_INSERTION(mem_ptr)
|
||||
BOOST_PROTO_DEFINE_TAG_INSERTION(assign)
|
||||
BOOST_PROTO_DEFINE_TAG_INSERTION(shift_left_assign)
|
||||
BOOST_PROTO_DEFINE_TAG_INSERTION(shift_right_assign)
|
||||
BOOST_PROTO_DEFINE_TAG_INSERTION(multiplies_assign)
|
||||
BOOST_PROTO_DEFINE_TAG_INSERTION(divides_assign)
|
||||
BOOST_PROTO_DEFINE_TAG_INSERTION(modulus_assign)
|
||||
BOOST_PROTO_DEFINE_TAG_INSERTION(plus_assign)
|
||||
BOOST_PROTO_DEFINE_TAG_INSERTION(minus_assign)
|
||||
BOOST_PROTO_DEFINE_TAG_INSERTION(bitwise_and_assign)
|
||||
BOOST_PROTO_DEFINE_TAG_INSERTION(bitwise_or_assign)
|
||||
BOOST_PROTO_DEFINE_TAG_INSERTION(bitwise_xor_assign)
|
||||
BOOST_PROTO_DEFINE_TAG_INSERTION(subscript)
|
||||
BOOST_PROTO_DEFINE_TAG_INSERTION(member)
|
||||
BOOST_PROTO_DEFINE_TAG_INSERTION(if_else_)
|
||||
BOOST_PROTO_DEFINE_TAG_INSERTION(function)
|
||||
|
||||
#undef BOOST_PROTO_DEFINE_TAG_INSERTION
|
||||
}}
|
||||
|
||||
namespace hidden_detail_
|
||||
{
|
||||
struct ostream_wrapper
|
||||
{
|
||||
ostream_wrapper(std::ostream &sout)
|
||||
: sout_(sout)
|
||||
{}
|
||||
|
||||
std::ostream &sout_;
|
||||
|
||||
private:
|
||||
ostream_wrapper &operator =(ostream_wrapper const &);
|
||||
};
|
||||
|
||||
struct named_any
|
||||
{
|
||||
template<typename T>
|
||||
named_any(T const &)
|
||||
: name_(BOOST_SP_TYPEID(T).name())
|
||||
{}
|
||||
|
||||
char const *name_;
|
||||
};
|
||||
|
||||
inline std::ostream &operator <<(ostream_wrapper sout_wrap, named_any t)
|
||||
{
|
||||
return sout_wrap.sout_ << t.name_;
|
||||
}
|
||||
}
|
||||
|
||||
namespace detail
|
||||
{
|
||||
struct display_expr_impl
|
||||
{
|
||||
explicit display_expr_impl(std::ostream &sout, int depth = 0)
|
||||
: depth_(depth)
|
||||
, first_(true)
|
||||
, sout_(sout)
|
||||
{}
|
||||
|
||||
template<typename Expr>
|
||||
void operator()(Expr const &expr) const
|
||||
{
|
||||
this->impl(expr, mpl::long_<arity_of<Expr>::value>());
|
||||
}
|
||||
|
||||
private:
|
||||
display_expr_impl(display_expr_impl const &);
|
||||
display_expr_impl &operator =(display_expr_impl const &);
|
||||
|
||||
template<typename Expr>
|
||||
void impl(Expr const &expr, mpl::long_<0>) const
|
||||
{
|
||||
using namespace hidden_detail_;
|
||||
typedef typename tag_of<Expr>::type tag;
|
||||
this->sout_.width(this->depth_);
|
||||
this->sout_ << (this->first_? "" : ", ");
|
||||
this->sout_ << tag() << "(" << proto::value(expr) << ")\n";
|
||||
this->first_ = false;
|
||||
}
|
||||
|
||||
template<typename Expr, typename Arity>
|
||||
void impl(Expr const &expr, Arity) const
|
||||
{
|
||||
using namespace hidden_detail_;
|
||||
typedef typename tag_of<Expr>::type tag;
|
||||
this->sout_.width(this->depth_);
|
||||
this->sout_ << (this->first_? "" : ", ");
|
||||
this->sout_ << tag() << "(\n";
|
||||
display_expr_impl display(this->sout_, this->depth_ + 4);
|
||||
fusion::for_each(expr, display);
|
||||
this->sout_.width(this->depth_);
|
||||
this->sout_ << "" << ")\n";
|
||||
this->first_ = false;
|
||||
}
|
||||
|
||||
int depth_;
|
||||
mutable bool first_;
|
||||
std::ostream &sout_;
|
||||
};
|
||||
}
|
||||
|
||||
namespace functional
|
||||
{
|
||||
/// \brief Pretty-print a Proto expression tree.
|
||||
///
|
||||
/// A PolymorphicFunctionObject which accepts a Proto expression
|
||||
/// tree and pretty-prints it to an \c ostream for debugging
|
||||
/// purposes.
|
||||
struct display_expr
|
||||
{
|
||||
BOOST_PROTO_CALLABLE()
|
||||
|
||||
typedef void result_type;
|
||||
|
||||
/// \param sout The \c ostream to which the expression tree
|
||||
/// will be written.
|
||||
/// \param depth The starting indentation depth for this node.
|
||||
/// Children nodes will be displayed at a starting
|
||||
/// depth of <tt>depth+4</tt>.
|
||||
explicit display_expr(std::ostream &sout = std::cout, int depth = 0)
|
||||
: depth_(depth)
|
||||
, sout_(sout)
|
||||
{}
|
||||
|
||||
/// \brief Pretty-print the current node in a Proto expression
|
||||
/// tree.
|
||||
template<typename Expr>
|
||||
void operator()(Expr const &expr) const
|
||||
{
|
||||
detail::display_expr_impl(this->sout_, this->depth_)(expr);
|
||||
}
|
||||
|
||||
private:
|
||||
int depth_;
|
||||
reference_wrapper<std::ostream> sout_;
|
||||
};
|
||||
}
|
||||
|
||||
/// \brief Pretty-print a Proto expression tree.
|
||||
///
|
||||
/// \note Equivalent to <tt>functional::display_expr(0, sout)(expr)</tt>
|
||||
/// \param expr The Proto expression tree to pretty-print
|
||||
/// \param sout The \c ostream to which the output should be
|
||||
/// written. If not specified, defaults to
|
||||
/// <tt>std::cout</tt>.
|
||||
template<typename Expr>
|
||||
void display_expr(Expr const &expr, std::ostream &sout)
|
||||
{
|
||||
functional::display_expr(sout, 0)(expr);
|
||||
}
|
||||
|
||||
/// \overload
|
||||
///
|
||||
template<typename Expr>
|
||||
void display_expr(Expr const &expr)
|
||||
{
|
||||
functional::display_expr()(expr);
|
||||
}
|
||||
|
||||
/// \brief Assert at compile time that a particular expression
|
||||
/// matches the specified grammar.
|
||||
///
|
||||
/// \note Equivalent to <tt>BOOST_MPL_ASSERT((proto::matches\<Expr, Grammar\>))</tt>
|
||||
/// \param expr The Proto expression to check againts <tt>Grammar</tt>
|
||||
template<typename Grammar, typename Expr>
|
||||
void assert_matches(Expr const & /*expr*/)
|
||||
{
|
||||
BOOST_MPL_ASSERT((proto::matches<Expr, Grammar>));
|
||||
}
|
||||
|
||||
/// \brief Assert at compile time that a particular expression
|
||||
/// does not match the specified grammar.
|
||||
///
|
||||
/// \note Equivalent to <tt>BOOST_MPL_ASSERT_NOT((proto::matches\<Expr, Grammar\>))</tt>
|
||||
/// \param expr The Proto expression to check againts <tt>Grammar</tt>
|
||||
template<typename Grammar, typename Expr>
|
||||
void assert_matches_not(Expr const & /*expr*/)
|
||||
{
|
||||
BOOST_MPL_ASSERT_NOT((proto::matches<Expr, Grammar>));
|
||||
}
|
||||
|
||||
/// \brief Assert at compile time that a particular expression
|
||||
/// matches the specified grammar.
|
||||
///
|
||||
/// \note Equivalent to <tt>proto::assert_matches\<Grammar\>(Expr)</tt>
|
||||
/// \param Expr The Proto expression to check againts <tt>Grammar</tt>
|
||||
/// \param Grammar The grammar used to validate Expr.
|
||||
#define BOOST_PROTO_ASSERT_MATCHES(Expr, Grammar) \
|
||||
(true ? (void)0 : boost::proto::assert_matches<Grammar>(Expr))
|
||||
|
||||
/// \brief Assert at compile time that a particular expression
|
||||
/// does not match the specified grammar.
|
||||
///
|
||||
/// \note Equivalent to <tt>proto::assert_matches_not\<Grammar\>(Expr)</tt>
|
||||
/// \param Expr The Proto expression to check againts <tt>Grammar</tt>
|
||||
/// \param Grammar The grammar used to validate Expr.
|
||||
#define BOOST_PROTO_ASSERT_MATCHES_NOT(Expr, Grammar) \
|
||||
(true ? (void)0 : boost::proto::assert_matches_not<Grammar>(Expr))
|
||||
|
||||
}}
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,94 @@
|
||||
|
||||
// Copyright Aleksey Gurtovoy 2000-2004
|
||||
//
|
||||
// Distributed under the Boost Software License, Version 1.0.
|
||||
// (See accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
//
|
||||
|
||||
// Preprocessed version of "boost/mpl/less_equal.hpp" header
|
||||
// -- DO NOT modify by hand!
|
||||
|
||||
namespace boost { namespace mpl {
|
||||
|
||||
template<
|
||||
typename Tag1
|
||||
, typename Tag2
|
||||
>
|
||||
struct less_equal_impl
|
||||
: if_c<
|
||||
( BOOST_MPL_AUX_NESTED_VALUE_WKND(int, Tag1)
|
||||
> BOOST_MPL_AUX_NESTED_VALUE_WKND(int, Tag2)
|
||||
)
|
||||
|
||||
, aux::cast2nd_impl< less_equal_impl< Tag1,Tag1 >,Tag1, Tag2 >
|
||||
, aux::cast1st_impl< less_equal_impl< Tag2,Tag2 >,Tag1, Tag2 >
|
||||
>::type
|
||||
{
|
||||
};
|
||||
|
||||
/// for Digital Mars C++/compilers with no CTPS/TTP support
|
||||
template<> struct less_equal_impl< na,na >
|
||||
{
|
||||
template< typename U1, typename U2 > struct apply
|
||||
{
|
||||
typedef apply type;
|
||||
BOOST_STATIC_CONSTANT(int, value = 0);
|
||||
};
|
||||
};
|
||||
|
||||
template<> struct less_equal_impl< na,integral_c_tag >
|
||||
{
|
||||
template< typename U1, typename U2 > struct apply
|
||||
{
|
||||
typedef apply type;
|
||||
BOOST_STATIC_CONSTANT(int, value = 0);
|
||||
};
|
||||
};
|
||||
|
||||
template<> struct less_equal_impl< integral_c_tag,na >
|
||||
{
|
||||
template< typename U1, typename U2 > struct apply
|
||||
{
|
||||
typedef apply type;
|
||||
BOOST_STATIC_CONSTANT(int, value = 0);
|
||||
};
|
||||
};
|
||||
|
||||
template< typename T > struct less_equal_tag
|
||||
{
|
||||
typedef typename T::tag type;
|
||||
};
|
||||
|
||||
template<
|
||||
typename BOOST_MPL_AUX_NA_PARAM(N1)
|
||||
, typename BOOST_MPL_AUX_NA_PARAM(N2)
|
||||
>
|
||||
struct less_equal
|
||||
|
||||
: less_equal_impl<
|
||||
typename less_equal_tag<N1>::type
|
||||
, typename less_equal_tag<N2>::type
|
||||
>::template apply< N1,N2 >::type
|
||||
{
|
||||
BOOST_MPL_AUX_LAMBDA_SUPPORT(2, less_equal, (N1, N2))
|
||||
|
||||
};
|
||||
|
||||
BOOST_MPL_AUX_NA_SPEC2(2, 2, less_equal)
|
||||
|
||||
}}
|
||||
|
||||
namespace boost { namespace mpl {
|
||||
|
||||
template<>
|
||||
struct less_equal_impl< integral_c_tag,integral_c_tag >
|
||||
{
|
||||
template< typename N1, typename N2 > struct apply
|
||||
|
||||
: bool_< ( BOOST_MPL_AUX_VALUE_WKND(N1)::value <= BOOST_MPL_AUX_VALUE_WKND(N2)::value ) >
|
||||
{
|
||||
};
|
||||
};
|
||||
|
||||
}}
|
||||
@@ -0,0 +1,66 @@
|
||||
subroutine genmsk_short(msg,msgsent,ichk,itone,itype)
|
||||
|
||||
use hashing
|
||||
character*22 msg,msgsent
|
||||
character*3 crpt,rpt(0:7)
|
||||
logical first
|
||||
integer itone(35)
|
||||
integer ig24(0:4096-1) !Codewords for Golay (24,12) code
|
||||
integer b11(11)
|
||||
data b11/1,1,1,0,0,0,1,0,0,1,0/ !Barker 11 code
|
||||
data rpt /'26 ','27 ','28 ','R26','R27','R28','RRR','73 '/
|
||||
data first/.true./
|
||||
save first,ig24
|
||||
|
||||
if(first) then
|
||||
call golay24_table(ig24) !Define the Golay(24,12) codewords
|
||||
first=.false.
|
||||
endif
|
||||
|
||||
itype=-1
|
||||
msgsent='*** bad message ***'
|
||||
itone=0
|
||||
i1=index(msg,'>')
|
||||
if(i1.lt.9) go to 900
|
||||
call fmtmsg(msg,iz)
|
||||
crpt=msg(i1+2:i1+5)
|
||||
do i=0,7
|
||||
if(crpt.eq.rpt(i)) go to 10
|
||||
enddo
|
||||
go to 900
|
||||
|
||||
10 irpt=i !Report index, 0-7
|
||||
if(ichk.lt.10000) then
|
||||
call hash(msg(2:i1-1),i1-2,ihash)
|
||||
ihash=iand(ihash,511) !9-bit hash for the two callsigns
|
||||
ig=8*ihash + irpt !12-bit message information
|
||||
else
|
||||
ig=ichk-10000
|
||||
endif
|
||||
ncodeword=ig24(ig)
|
||||
itone(1:11)=b11 !Insert the Barker-11 code
|
||||
n=2**24
|
||||
do i=12,35 !Insert codeword into itone array
|
||||
n=n/2
|
||||
itone(i)=0
|
||||
if(iand(ncodeword,n).ne.0) itone(i)=1
|
||||
enddo
|
||||
msgsent=msg
|
||||
itype=7
|
||||
|
||||
n=count(itone(1:35).eq.0)
|
||||
if(mod(n,2).ne.0) stop 'Parity error in genmsk_short.'
|
||||
|
||||
900 return
|
||||
end subroutine genmsk_short
|
||||
|
||||
subroutine hash_calls(calls,ih9)
|
||||
|
||||
use hashing
|
||||
character*(*) calls
|
||||
i1=index(calls,'>')
|
||||
call hash(calls(2:i1-1),i1-2,ih9)
|
||||
ih9=iand(ih9,511) !9-bit hash for the two callsigns
|
||||
|
||||
return
|
||||
end subroutine hash_calls
|
||||
@@ -0,0 +1,25 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2001-2003 Joel de Guzman
|
||||
http://spirit.sourceforge.net/
|
||||
|
||||
Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
=============================================================================*/
|
||||
#if !defined(BOOST_SPIRIT_NIL_HPP)
|
||||
#define BOOST_SPIRIT_NIL_HPP
|
||||
|
||||
#include <boost/spirit/home/classic/namespace.hpp>
|
||||
|
||||
namespace boost { namespace spirit {
|
||||
|
||||
BOOST_SPIRIT_CLASSIC_NAMESPACE_BEGIN
|
||||
|
||||
struct nil_t {};
|
||||
|
||||
BOOST_SPIRIT_CLASSIC_NAMESPACE_END
|
||||
|
||||
}}
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
@@ -0,0 +1,126 @@
|
||||
/**
|
||||
* -*- c++ -*-
|
||||
*
|
||||
* \file iterator_type.hpp
|
||||
*
|
||||
* \brief Iterator to a given container type.
|
||||
*
|
||||
* Copyright (c) 2009, Marco Guazzone
|
||||
*
|
||||
* 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)
|
||||
*
|
||||
* \author Marco Guazzone, marco.guazzone@gmail.com
|
||||
*/
|
||||
|
||||
|
||||
#ifndef BOOST_NUMERIC_UBLAS_TRAITS_ITERATOR_TYPE_HPP
|
||||
#define BOOST_NUMERIC_UBLAS_TRAITS_ITERATOR_TYPE_HPP
|
||||
|
||||
|
||||
#include <boost/numeric/ublas/fwd.hpp>
|
||||
#include <boost/numeric/ublas/traits.hpp>
|
||||
#include <boost/numeric/ublas/tags.hpp>
|
||||
|
||||
|
||||
namespace boost { namespace numeric { namespace ublas {
|
||||
|
||||
namespace detail {
|
||||
|
||||
/**
|
||||
* \brief Auxiliary class for retrieving the iterator to the given
|
||||
* matrix expression according its orientation and to the given dimension tag.
|
||||
* \tparam MatrixT A model of MatrixExpression.
|
||||
* \tparam TagT A dimension tag type (e.g., tag::major).
|
||||
* \tparam OrientationT An orientation category type (e.g., row_major_tag).
|
||||
*/
|
||||
template <typename MatrixT, typename TagT, typename OrientationT>
|
||||
struct iterator_type_impl;
|
||||
|
||||
|
||||
/// \brief Specialization of \c iterator_type_impl for row-major oriented
|
||||
/// matrices and over the major dimension.
|
||||
template <typename MatrixT>
|
||||
struct iterator_type_impl<MatrixT,tag::major,row_major_tag>
|
||||
{
|
||||
typedef typename matrix_traits<MatrixT>::iterator1 type;
|
||||
};
|
||||
|
||||
|
||||
/// \brief Specialization of \c iterator_type_impl for column-major oriented
|
||||
/// matrices and over the major dimension.
|
||||
template <typename MatrixT>
|
||||
struct iterator_type_impl<MatrixT,tag::major,column_major_tag>
|
||||
{
|
||||
typedef typename matrix_traits<MatrixT>::iterator2 type;
|
||||
};
|
||||
|
||||
|
||||
/// \brief Specialization of \c iterator_type_impl for row-major oriented
|
||||
/// matrices and over the minor dimension.
|
||||
template <typename MatrixT>
|
||||
struct iterator_type_impl<MatrixT,tag::minor,row_major_tag>
|
||||
{
|
||||
typedef typename matrix_traits<MatrixT>::iterator2 type;
|
||||
};
|
||||
|
||||
|
||||
/// \brief Specialization of \c iterator_type_impl for column-major oriented
|
||||
/// matrices and over the minor dimension.
|
||||
template <typename MatrixT>
|
||||
struct iterator_type_impl<MatrixT,tag::minor,column_major_tag>
|
||||
{
|
||||
typedef typename matrix_traits<MatrixT>::iterator1 type;
|
||||
};
|
||||
|
||||
} // Namespace detail
|
||||
|
||||
|
||||
/**
|
||||
* \brief A iterator for the given container type over the given dimension.
|
||||
* \tparam ContainerT A container expression type.
|
||||
* \tparam TagT A dimension tag type (e.g., tag::major).
|
||||
*/
|
||||
template <typename ContainerT, typename TagT=void>
|
||||
struct iterator_type;
|
||||
|
||||
|
||||
/**
|
||||
* \brief Specialization of \c iterator_type for vector expressions.
|
||||
* \tparam VectorT A model of VectorExpression type.
|
||||
*/
|
||||
template <typename VectorT>
|
||||
struct iterator_type<VectorT, void>
|
||||
{
|
||||
typedef typename vector_traits<VectorT>::iterator type;
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* \brief Specialization of \c iterator_type for matrix expressions and
|
||||
* over the major dimension.
|
||||
* \tparam MatrixT A model of MatrixExpression type.
|
||||
*/
|
||||
template <typename MatrixT>
|
||||
struct iterator_type<MatrixT,tag::major>
|
||||
{
|
||||
typedef typename detail::iterator_type_impl<MatrixT,tag::major,typename matrix_traits<MatrixT>::orientation_category>::type type;
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* \brief Specialization of \c iterator_type for matrix expressions and
|
||||
* over the minor dimension.
|
||||
* \tparam MatrixT A model of MatrixExpression type.
|
||||
*/
|
||||
template <typename MatrixT>
|
||||
struct iterator_type<MatrixT,tag::minor>
|
||||
{
|
||||
typedef typename detail::iterator_type_impl<MatrixT,tag::minor,typename matrix_traits<MatrixT>::orientation_category>::type type;
|
||||
};
|
||||
|
||||
}}} // Namespace boost::numeric::ublas
|
||||
|
||||
|
||||
#endif // BOOST_NUMERIC_UBLAS_TRAITS_ITERATOR_TYPE_HPP
|
||||
@@ -0,0 +1,440 @@
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// Copyright Christopher Kormanyos 2014.
|
||||
// Copyright John Maddock 2014.
|
||||
// Copyright Paul Bristow 2014.
|
||||
// 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)
|
||||
//
|
||||
|
||||
// Implement the types for floating-point typedefs having specified widths.
|
||||
|
||||
#ifndef _BOOST_CSTDFLOAT_TYPES_2014_01_09_HPP_
|
||||
#define _BOOST_CSTDFLOAT_TYPES_2014_01_09_HPP_
|
||||
|
||||
#include <float.h>
|
||||
#include <limits>
|
||||
#include <boost/static_assert.hpp>
|
||||
#include <boost/math/tools/config.hpp>
|
||||
|
||||
// This is the beginning of the preamble.
|
||||
|
||||
// In this preamble, the preprocessor is used to query certain
|
||||
// preprocessor definitions from <float.h>. Based on the results
|
||||
// of these queries, an attempt is made to automatically detect
|
||||
// the presence of built-in floating-point types having specified
|
||||
// widths. These are *thought* to be conformant with IEEE-754,
|
||||
// whereby an unequivocal test based on std::numeric_limits<>
|
||||
// follows below.
|
||||
|
||||
// In addition, various macros that are used for initializing
|
||||
// floating-point literal values having specified widths and
|
||||
// some basic min/max values are defined.
|
||||
|
||||
// First, we will pre-load certain preprocessor definitions
|
||||
// with a dummy value.
|
||||
|
||||
#define BOOST_CSTDFLOAT_MAXIMUM_AVAILABLE_WIDTH 0
|
||||
|
||||
#define BOOST_CSTDFLOAT_HAS_FLOAT16_NATIVE_TYPE 0
|
||||
#define BOOST_CSTDFLOAT_HAS_FLOAT32_NATIVE_TYPE 0
|
||||
#define BOOST_CSTDFLOAT_HAS_FLOAT64_NATIVE_TYPE 0
|
||||
#define BOOST_CSTDFLOAT_HAS_FLOAT80_NATIVE_TYPE 0
|
||||
#define BOOST_CSTDFLOAT_HAS_FLOAT128_NATIVE_TYPE 0
|
||||
|
||||
// Ensure that the compiler has a radix-2 floating-point representation.
|
||||
#if (!defined(FLT_RADIX) || ((defined(FLT_RADIX) && (FLT_RADIX != 2))))
|
||||
#error The compiler does not support any radix-2 floating-point types required for <boost/cstdfloat.hpp>.
|
||||
#endif
|
||||
|
||||
// Check if built-in float is equivalent to float16_t, float32_t, float64_t, float80_t, or float128_t.
|
||||
#if(defined(FLT_MANT_DIG) && defined(FLT_MAX_EXP))
|
||||
#if ((FLT_MANT_DIG == 11) && (FLT_MAX_EXP == 16) && (BOOST_CSTDFLOAT_HAS_FLOAT16_NATIVE_TYPE == 0))
|
||||
#define BOOST_CSTDFLOAT_FLOAT16_NATIVE_TYPE float
|
||||
#undef BOOST_CSTDFLOAT_MAXIMUM_AVAILABLE_WIDTH
|
||||
#define BOOST_CSTDFLOAT_MAXIMUM_AVAILABLE_WIDTH 16
|
||||
#undef BOOST_CSTDFLOAT_HAS_FLOAT16_NATIVE_TYPE
|
||||
#define BOOST_CSTDFLOAT_HAS_FLOAT16_NATIVE_TYPE 1
|
||||
#define BOOST_FLOAT16_C(x) (x ## F)
|
||||
#define BOOST_CSTDFLOAT_FLOAT_16_MIN FLT_MIN
|
||||
#define BOOST_CSTDFLOAT_FLOAT_16_MAX FLT_MAX
|
||||
#elif((FLT_MANT_DIG == 24) && (FLT_MAX_EXP == 128) && (BOOST_CSTDFLOAT_HAS_FLOAT32_NATIVE_TYPE == 0))
|
||||
#define BOOST_CSTDFLOAT_FLOAT32_NATIVE_TYPE float
|
||||
#undef BOOST_CSTDFLOAT_MAXIMUM_AVAILABLE_WIDTH
|
||||
#define BOOST_CSTDFLOAT_MAXIMUM_AVAILABLE_WIDTH 32
|
||||
#undef BOOST_CSTDFLOAT_HAS_FLOAT32_NATIVE_TYPE
|
||||
#define BOOST_CSTDFLOAT_HAS_FLOAT32_NATIVE_TYPE 1
|
||||
#define BOOST_FLOAT32_C(x) (x ## F)
|
||||
#define BOOST_CSTDFLOAT_FLOAT_32_MIN FLT_MIN
|
||||
#define BOOST_CSTDFLOAT_FLOAT_32_MAX FLT_MAX
|
||||
#elif((FLT_MANT_DIG == 53) && (FLT_MAX_EXP == 1024) && (BOOST_CSTDFLOAT_HAS_FLOAT64_NATIVE_TYPE == 0))
|
||||
#define BOOST_CSTDFLOAT_FLOAT64_NATIVE_TYPE float
|
||||
#undef BOOST_CSTDFLOAT_MAXIMUM_AVAILABLE_WIDTH
|
||||
#define BOOST_CSTDFLOAT_MAXIMUM_AVAILABLE_WIDTH 64
|
||||
#undef BOOST_CSTDFLOAT_HAS_FLOAT64_NATIVE_TYPE
|
||||
#define BOOST_CSTDFLOAT_HAS_FLOAT64_NATIVE_TYPE 1
|
||||
#define BOOST_FLOAT64_C(x) (x ## F)
|
||||
#define BOOST_CSTDFLOAT_FLOAT_64_MIN FLT_MIN
|
||||
#define BOOST_CSTDFLOAT_FLOAT_64_MAX FLT_MAX
|
||||
#elif((FLT_MANT_DIG == 64) && (FLT_MAX_EXP == 16384) && (BOOST_CSTDFLOAT_HAS_FLOAT80_NATIVE_TYPE == 0))
|
||||
#define BOOST_CSTDFLOAT_FLOAT80_NATIVE_TYPE float
|
||||
#undef BOOST_CSTDFLOAT_MAXIMUM_AVAILABLE_WIDTH
|
||||
#define BOOST_CSTDFLOAT_MAXIMUM_AVAILABLE_WIDTH 80
|
||||
#undef BOOST_CSTDFLOAT_HAS_FLOAT80_NATIVE_TYPE
|
||||
#define BOOST_CSTDFLOAT_HAS_FLOAT80_NATIVE_TYPE 1
|
||||
#define BOOST_FLOAT80_C(x) (x ## F)
|
||||
#define BOOST_CSTDFLOAT_FLOAT_80_MIN FLT_MIN
|
||||
#define BOOST_CSTDFLOAT_FLOAT_80_MAX FLT_MAX
|
||||
#elif((FLT_MANT_DIG == 113) && (FLT_MAX_EXP == 16384) && (BOOST_CSTDFLOAT_HAS_FLOAT128_NATIVE_TYPE == 0))
|
||||
#define BOOST_CSTDFLOAT_FLOAT128_NATIVE_TYPE float
|
||||
#undef BOOST_CSTDFLOAT_MAXIMUM_AVAILABLE_WIDTH
|
||||
#define BOOST_CSTDFLOAT_MAXIMUM_AVAILABLE_WIDTH 128
|
||||
#undef BOOST_CSTDFLOAT_HAS_FLOAT128_NATIVE_TYPE
|
||||
#define BOOST_CSTDFLOAT_HAS_FLOAT128_NATIVE_TYPE 1
|
||||
#define BOOST_FLOAT128_C(x) (x ## F)
|
||||
#define BOOST_CSTDFLOAT_FLOAT_128_MIN FLT_MIN
|
||||
#define BOOST_CSTDFLOAT_FLOAT_128_MAX FLT_MAX
|
||||
#endif
|
||||
#endif
|
||||
|
||||
// Check if built-in double is equivalent to float16_t, float32_t, float64_t, float80_t, or float128_t.
|
||||
#if(defined(DBL_MANT_DIG) && defined(DBL_MAX_EXP))
|
||||
#if ((DBL_MANT_DIG == 11) && (DBL_MAX_EXP == 16) && (BOOST_CSTDFLOAT_HAS_FLOAT16_NATIVE_TYPE == 0))
|
||||
#define BOOST_CSTDFLOAT_FLOAT16_NATIVE_TYPE double
|
||||
#undef BOOST_CSTDFLOAT_MAXIMUM_AVAILABLE_WIDTH
|
||||
#define BOOST_CSTDFLOAT_MAXIMUM_AVAILABLE_WIDTH 16
|
||||
#undef BOOST_CSTDFLOAT_HAS_FLOAT16_NATIVE_TYPE
|
||||
#define BOOST_CSTDFLOAT_HAS_FLOAT16_NATIVE_TYPE 1
|
||||
#define BOOST_FLOAT16_C(x) (x)
|
||||
#define BOOST_CSTDFLOAT_FLOAT_16_MIN DBL_MIN
|
||||
#define BOOST_CSTDFLOAT_FLOAT_16_MAX DBL_MAX
|
||||
#elif((DBL_MANT_DIG == 24) && (DBL_MAX_EXP == 128) && (BOOST_CSTDFLOAT_HAS_FLOAT32_NATIVE_TYPE == 0))
|
||||
#define BOOST_CSTDFLOAT_FLOAT32_NATIVE_TYPE double
|
||||
#undef BOOST_CSTDFLOAT_MAXIMUM_AVAILABLE_WIDTH
|
||||
#define BOOST_CSTDFLOAT_MAXIMUM_AVAILABLE_WIDTH 32
|
||||
#undef BOOST_CSTDFLOAT_HAS_FLOAT32_NATIVE_TYPE
|
||||
#define BOOST_CSTDFLOAT_HAS_FLOAT32_NATIVE_TYPE 1
|
||||
#define BOOST_FLOAT32_C(x) (x)
|
||||
#define BOOST_CSTDFLOAT_FLOAT_32_MIN DBL_MIN
|
||||
#define BOOST_CSTDFLOAT_FLOAT_32_MAX DBL_MAX
|
||||
#elif((DBL_MANT_DIG == 53) && (DBL_MAX_EXP == 1024) && (BOOST_CSTDFLOAT_HAS_FLOAT64_NATIVE_TYPE == 0))
|
||||
#define BOOST_CSTDFLOAT_FLOAT64_NATIVE_TYPE double
|
||||
#undef BOOST_CSTDFLOAT_MAXIMUM_AVAILABLE_WIDTH
|
||||
#define BOOST_CSTDFLOAT_MAXIMUM_AVAILABLE_WIDTH 64
|
||||
#undef BOOST_CSTDFLOAT_HAS_FLOAT64_NATIVE_TYPE
|
||||
#define BOOST_CSTDFLOAT_HAS_FLOAT64_NATIVE_TYPE 1
|
||||
#define BOOST_FLOAT64_C(x) (x)
|
||||
#define BOOST_CSTDFLOAT_FLOAT_64_MIN DBL_MIN
|
||||
#define BOOST_CSTDFLOAT_FLOAT_64_MAX DBL_MAX
|
||||
#elif((DBL_MANT_DIG == 64) && (DBL_MAX_EXP == 16384) && (BOOST_CSTDFLOAT_HAS_FLOAT80_NATIVE_TYPE == 0))
|
||||
#define BOOST_CSTDFLOAT_FLOAT80_NATIVE_TYPE double
|
||||
#undef BOOST_CSTDFLOAT_MAXIMUM_AVAILABLE_WIDTH
|
||||
#define BOOST_CSTDFLOAT_MAXIMUM_AVAILABLE_WIDTH 80
|
||||
#undef BOOST_CSTDFLOAT_HAS_FLOAT80_NATIVE_TYPE
|
||||
#define BOOST_CSTDFLOAT_HAS_FLOAT80_NATIVE_TYPE 1
|
||||
#define BOOST_FLOAT80_C(x) (x)
|
||||
#define BOOST_CSTDFLOAT_FLOAT_80_MIN DBL_MIN
|
||||
#define BOOST_CSTDFLOAT_FLOAT_80_MAX DBL_MAX
|
||||
#elif((DBL_MANT_DIG == 113) && (DBL_MAX_EXP == 16384) && (BOOST_CSTDFLOAT_HAS_FLOAT128_NATIVE_TYPE == 0))
|
||||
#define BOOST_CSTDFLOAT_FLOAT128_NATIVE_TYPE double
|
||||
#undef BOOST_CSTDFLOAT_MAXIMUM_AVAILABLE_WIDTH
|
||||
#define BOOST_CSTDFLOAT_MAXIMUM_AVAILABLE_WIDTH 128
|
||||
#undef BOOST_CSTDFLOAT_HAS_FLOAT128_NATIVE_TYPE
|
||||
#define BOOST_CSTDFLOAT_HAS_FLOAT128_NATIVE_TYPE 1
|
||||
#define BOOST_FLOAT128_C(x) (x)
|
||||
#define BOOST_CSTDFLOAT_FLOAT_128_MIN DBL_MIN
|
||||
#define BOOST_CSTDFLOAT_FLOAT_128_MAX DBL_MAX
|
||||
#endif
|
||||
#endif
|
||||
|
||||
// Disable check long double capability even if supported by compiler since some math runtime
|
||||
// implementations are broken for long double.
|
||||
#ifndef BOOST_MATH_NO_LONG_DOUBLE_MATH_FUNCTIONS
|
||||
// Check if built-in long double is equivalent to float16_t, float32_t, float64_t, float80_t, or float128_t.
|
||||
#if(defined(LDBL_MANT_DIG) && defined(LDBL_MAX_EXP))
|
||||
#if ((LDBL_MANT_DIG == 11) && (LDBL_MAX_EXP == 16) && (BOOST_CSTDFLOAT_HAS_FLOAT16_NATIVE_TYPE == 0))
|
||||
#define BOOST_CSTDFLOAT_FLOAT16_NATIVE_TYPE long double
|
||||
#undef BOOST_CSTDFLOAT_MAXIMUM_AVAILABLE_WIDTH
|
||||
#define BOOST_CSTDFLOAT_MAXIMUM_AVAILABLE_WIDTH 16
|
||||
#undef BOOST_CSTDFLOAT_HAS_FLOAT16_NATIVE_TYPE
|
||||
#define BOOST_CSTDFLOAT_HAS_FLOAT16_NATIVE_TYPE 1
|
||||
#define BOOST_FLOAT16_C(x) (x ## L)
|
||||
#define BOOST_CSTDFLOAT_FLOAT_16_MIN LDBL_MIN
|
||||
#define BOOST_CSTDFLOAT_FLOAT_16_MAX LDBL_MAX
|
||||
#elif((LDBL_MANT_DIG == 24) && (LDBL_MAX_EXP == 128) && (BOOST_CSTDFLOAT_HAS_FLOAT32_NATIVE_TYPE == 0))
|
||||
#define BOOST_CSTDFLOAT_FLOAT32_NATIVE_TYPE long double
|
||||
#undef BOOST_CSTDFLOAT_MAXIMUM_AVAILABLE_WIDTH
|
||||
#define BOOST_CSTDFLOAT_MAXIMUM_AVAILABLE_WIDTH 32
|
||||
#undef BOOST_CSTDFLOAT_HAS_FLOAT32_NATIVE_TYPE
|
||||
#define BOOST_CSTDFLOAT_HAS_FLOAT32_NATIVE_TYPE 1
|
||||
#define BOOST_FLOAT32_C(x) (x ## L)
|
||||
#define BOOST_CSTDFLOAT_FLOAT_32_MIN LDBL_MIN
|
||||
#define BOOST_CSTDFLOAT_FLOAT_32_MAX LDBL_MAX
|
||||
#elif((LDBL_MANT_DIG == 53) && (LDBL_MAX_EXP == 1024) && (BOOST_CSTDFLOAT_HAS_FLOAT64_NATIVE_TYPE == 0))
|
||||
#define BOOST_CSTDFLOAT_FLOAT64_NATIVE_TYPE long double
|
||||
#undef BOOST_CSTDFLOAT_MAXIMUM_AVAILABLE_WIDTH
|
||||
#define BOOST_CSTDFLOAT_MAXIMUM_AVAILABLE_WIDTH 64
|
||||
#undef BOOST_CSTDFLOAT_HAS_FLOAT64_NATIVE_TYPE
|
||||
#define BOOST_CSTDFLOAT_HAS_FLOAT64_NATIVE_TYPE 1
|
||||
#define BOOST_FLOAT64_C(x) (x ## L)
|
||||
#define BOOST_CSTDFLOAT_FLOAT_64_MIN LDBL_MIN
|
||||
#define BOOST_CSTDFLOAT_FLOAT_64_MAX LDBL_MAX
|
||||
#elif((LDBL_MANT_DIG == 64) && (LDBL_MAX_EXP == 16384) && (BOOST_CSTDFLOAT_HAS_FLOAT80_NATIVE_TYPE == 0))
|
||||
#define BOOST_CSTDFLOAT_FLOAT80_NATIVE_TYPE long double
|
||||
#undef BOOST_CSTDFLOAT_MAXIMUM_AVAILABLE_WIDTH
|
||||
#define BOOST_CSTDFLOAT_MAXIMUM_AVAILABLE_WIDTH 80
|
||||
#undef BOOST_CSTDFLOAT_HAS_FLOAT80_NATIVE_TYPE
|
||||
#define BOOST_CSTDFLOAT_HAS_FLOAT80_NATIVE_TYPE 1
|
||||
#define BOOST_FLOAT80_C(x) (x ## L)
|
||||
#define BOOST_CSTDFLOAT_FLOAT_80_MIN LDBL_MIN
|
||||
#define BOOST_CSTDFLOAT_FLOAT_80_MAX LDBL_MAX
|
||||
#elif((LDBL_MANT_DIG == 113) && (LDBL_MAX_EXP == 16384) && (BOOST_CSTDFLOAT_HAS_FLOAT128_NATIVE_TYPE == 0))
|
||||
#define BOOST_CSTDFLOAT_FLOAT128_NATIVE_TYPE long double
|
||||
#undef BOOST_CSTDFLOAT_MAXIMUM_AVAILABLE_WIDTH
|
||||
#define BOOST_CSTDFLOAT_MAXIMUM_AVAILABLE_WIDTH 128
|
||||
#undef BOOST_CSTDFLOAT_HAS_FLOAT128_NATIVE_TYPE
|
||||
#define BOOST_CSTDFLOAT_HAS_FLOAT128_NATIVE_TYPE 1
|
||||
#define BOOST_FLOAT128_C(x) (x ## L)
|
||||
#define BOOST_CSTDFLOAT_FLOAT_128_MIN LDBL_MIN
|
||||
#define BOOST_CSTDFLOAT_FLOAT_128_MAX LDBL_MAX
|
||||
#endif
|
||||
#endif
|
||||
#endif
|
||||
|
||||
// Check if quadruple-precision is supported. Here, we are checking
|
||||
// for the presence of __float128 from GCC's quadmath.h or _Quad
|
||||
// from ICC's /Qlong-double flag). To query these, we use the
|
||||
// BOOST_MATH_USE_FLOAT128 pre-processor definition from
|
||||
// <boost/math/tools/config.hpp>.
|
||||
|
||||
#if (BOOST_CSTDFLOAT_HAS_FLOAT128_NATIVE_TYPE == 0) && defined(BOOST_MATH_USE_FLOAT128) && !defined(BOOST_CSTDFLOAT_NO_LIBQUADMATH_SUPPORT)
|
||||
|
||||
// Specify the underlying name of the internal 128-bit floating-point type definition.
|
||||
namespace boost { namespace math { namespace cstdfloat { namespace detail {
|
||||
#if defined(__GNUC__)
|
||||
typedef __float128 float_internal128_t;
|
||||
#elif defined(BOOST_INTEL)
|
||||
typedef _Quad float_internal128_t;
|
||||
#else
|
||||
#error "Sorry, the compiler is neither GCC, nor Intel, I don't know how to configure <boost/cstdfloat.hpp>."
|
||||
#endif
|
||||
} } } } // boost::math::cstdfloat::detail
|
||||
|
||||
#define BOOST_CSTDFLOAT_FLOAT128_NATIVE_TYPE boost::math::cstdfloat::detail::float_internal128_t
|
||||
#undef BOOST_CSTDFLOAT_MAXIMUM_AVAILABLE_WIDTH
|
||||
#define BOOST_CSTDFLOAT_MAXIMUM_AVAILABLE_WIDTH 128
|
||||
#undef BOOST_CSTDFLOAT_HAS_FLOAT128_NATIVE_TYPE
|
||||
#define BOOST_CSTDFLOAT_HAS_FLOAT128_NATIVE_TYPE 1
|
||||
#define BOOST_FLOAT128_C(x) (x ## Q)
|
||||
#define BOOST_CSTDFLOAT_FLOAT128_MIN 3.36210314311209350626267781732175260e-4932Q
|
||||
#define BOOST_CSTDFLOAT_FLOAT128_MAX 1.18973149535723176508575932662800702e+4932Q
|
||||
#define BOOST_CSTDFLOAT_FLOAT128_EPS 1.92592994438723585305597794258492732e-0034Q
|
||||
|
||||
#endif // Not BOOST_CSTDFLOAT_NO_LIBQUADMATH_SUPPORT (i.e., the user would like to have libquadmath support)
|
||||
|
||||
// This is the end of the preamble, and also the end of the
|
||||
// sections providing support for the C++ standard library
|
||||
// for quadruple-precision.
|
||||
|
||||
// Now we use the results of the queries that have been obtained
|
||||
// in the preamble (far above) for the final type definitions in
|
||||
// the namespace boost.
|
||||
|
||||
// Make sure that the compiler has any floating-point type(s) whatsoever.
|
||||
#if ( (BOOST_CSTDFLOAT_HAS_FLOAT16_NATIVE_TYPE == 0) \
|
||||
&& (BOOST_CSTDFLOAT_HAS_FLOAT32_NATIVE_TYPE == 0) \
|
||||
&& (BOOST_CSTDFLOAT_HAS_FLOAT64_NATIVE_TYPE == 0) \
|
||||
&& (BOOST_CSTDFLOAT_HAS_FLOAT80_NATIVE_TYPE == 0) \
|
||||
&& (BOOST_CSTDFLOAT_HAS_FLOAT128_NATIVE_TYPE == 0))
|
||||
#error The compiler does not support any of the floating-point types required for <boost/cstdfloat.hpp>.
|
||||
#endif
|
||||
|
||||
// The following section contains the various min/max macros
|
||||
// for the *leastN and *fastN types.
|
||||
|
||||
#if(BOOST_CSTDFLOAT_HAS_FLOAT16_NATIVE_TYPE == 1)
|
||||
#define BOOST_FLOAT_FAST16_MIN BOOST_CSTDFLOAT_FLOAT_16_MIN
|
||||
#define BOOST_FLOAT_LEAST16_MIN BOOST_CSTDFLOAT_FLOAT_16_MIN
|
||||
#define BOOST_FLOAT_FAST16_MAX BOOST_CSTDFLOAT_FLOAT_16_MAX
|
||||
#define BOOST_FLOAT_LEAST16_MAX BOOST_CSTDFLOAT_FLOAT_16_MAX
|
||||
#endif
|
||||
|
||||
#if(BOOST_CSTDFLOAT_HAS_FLOAT32_NATIVE_TYPE == 1)
|
||||
#define BOOST_FLOAT_FAST32_MIN BOOST_CSTDFLOAT_FLOAT_32_MIN
|
||||
#define BOOST_FLOAT_LEAST32_MIN BOOST_CSTDFLOAT_FLOAT_32_MIN
|
||||
#define BOOST_FLOAT_FAST32_MAX BOOST_CSTDFLOAT_FLOAT_32_MAX
|
||||
#define BOOST_FLOAT_LEAST32_MAX BOOST_CSTDFLOAT_FLOAT_32_MAX
|
||||
#endif
|
||||
|
||||
#if(BOOST_CSTDFLOAT_HAS_FLOAT64_NATIVE_TYPE == 1)
|
||||
#define BOOST_FLOAT_FAST64_MIN BOOST_CSTDFLOAT_FLOAT_64_MIN
|
||||
#define BOOST_FLOAT_LEAST64_MIN BOOST_CSTDFLOAT_FLOAT_64_MIN
|
||||
#define BOOST_FLOAT_FAST64_MAX BOOST_CSTDFLOAT_FLOAT_64_MAX
|
||||
#define BOOST_FLOAT_LEAST64_MAX BOOST_CSTDFLOAT_FLOAT_64_MAX
|
||||
#endif
|
||||
|
||||
#if(BOOST_CSTDFLOAT_HAS_FLOAT80_NATIVE_TYPE == 1)
|
||||
#define BOOST_FLOAT_FAST80_MIN BOOST_CSTDFLOAT_FLOAT_80_MIN
|
||||
#define BOOST_FLOAT_LEAST80_MIN BOOST_CSTDFLOAT_FLOAT_80_MIN
|
||||
#define BOOST_FLOAT_FAST80_MAX BOOST_CSTDFLOAT_FLOAT_80_MAX
|
||||
#define BOOST_FLOAT_LEAST80_MAX BOOST_CSTDFLOAT_FLOAT_80_MAX
|
||||
#endif
|
||||
|
||||
#if(BOOST_CSTDFLOAT_HAS_FLOAT128_NATIVE_TYPE == 1)
|
||||
#define BOOST_CSTDFLOAT_HAS_INTERNAL_FLOAT128_T
|
||||
|
||||
#define BOOST_FLOAT_FAST128_MIN BOOST_CSTDFLOAT_FLOAT_128_MIN
|
||||
#define BOOST_FLOAT_LEAST128_MIN BOOST_CSTDFLOAT_FLOAT_128_MIN
|
||||
#define BOOST_FLOAT_FAST128_MAX BOOST_CSTDFLOAT_FLOAT_128_MAX
|
||||
#define BOOST_FLOAT_LEAST128_MAX BOOST_CSTDFLOAT_FLOAT_128_MAX
|
||||
#endif
|
||||
|
||||
// The following section contains the various min/max macros
|
||||
// for the *floatmax types.
|
||||
|
||||
#if (BOOST_CSTDFLOAT_MAXIMUM_AVAILABLE_WIDTH == 16)
|
||||
#define BOOST_FLOATMAX_C(x) BOOST_FLOAT16_C(x)
|
||||
#define BOOST_FLOATMAX_MIN BOOST_CSTDFLOAT_FLOAT_16_MIN
|
||||
#define BOOST_FLOATMAX_MAX BOOST_CSTDFLOAT_FLOAT_16_MAX
|
||||
#elif(BOOST_CSTDFLOAT_MAXIMUM_AVAILABLE_WIDTH == 32)
|
||||
#define BOOST_FLOATMAX_C(x) BOOST_FLOAT32_C(x)
|
||||
#define BOOST_FLOATMAX_MIN BOOST_CSTDFLOAT_FLOAT_32_MIN
|
||||
#define BOOST_FLOATMAX_MAX BOOST_CSTDFLOAT_FLOAT_32_MAX
|
||||
#elif(BOOST_CSTDFLOAT_MAXIMUM_AVAILABLE_WIDTH == 64)
|
||||
#define BOOST_FLOATMAX_C(x) BOOST_FLOAT64_C(x)
|
||||
#define BOOST_FLOATMAX_MIN BOOST_CSTDFLOAT_FLOAT_64_MIN
|
||||
#define BOOST_FLOATMAX_MAX BOOST_CSTDFLOAT_FLOAT_64_MAX
|
||||
#elif(BOOST_CSTDFLOAT_MAXIMUM_AVAILABLE_WIDTH == 80)
|
||||
#define BOOST_FLOATMAX_C(x) BOOST_FLOAT80_C(x)
|
||||
#define BOOST_FLOATMAX_MIN BOOST_CSTDFLOAT_FLOAT_80_MIN
|
||||
#define BOOST_FLOATMAX_MAX BOOST_CSTDFLOAT_FLOAT_80_MAX
|
||||
#elif(BOOST_CSTDFLOAT_MAXIMUM_AVAILABLE_WIDTH == 128)
|
||||
#define BOOST_FLOATMAX_C(x) BOOST_FLOAT128_C(x)
|
||||
#define BOOST_FLOATMAX_MIN BOOST_CSTDFLOAT_FLOAT_128_MIN
|
||||
#define BOOST_FLOATMAX_MAX BOOST_CSTDFLOAT_FLOAT_128_MAX
|
||||
#else
|
||||
#error The maximum available floating-point width for <boost/cstdfloat.hpp> is undefined.
|
||||
#endif
|
||||
|
||||
// And finally..., we define the floating-point typedefs having
|
||||
// specified widths. The types are defined in the namespace boost.
|
||||
|
||||
// For simplicity, the least and fast types are type defined identically
|
||||
// as the corresponding fixed-width type. This behavior may, however,
|
||||
// be modified when being optimized for a given compiler implementation.
|
||||
|
||||
// In addition, a clear assessment of IEEE-754 comformance is carried out
|
||||
// using compile-time assertion.
|
||||
|
||||
namespace boost
|
||||
{
|
||||
#if(BOOST_CSTDFLOAT_HAS_FLOAT16_NATIVE_TYPE == 1)
|
||||
typedef BOOST_CSTDFLOAT_FLOAT16_NATIVE_TYPE float16_t;
|
||||
typedef boost::float16_t float_fast16_t;
|
||||
typedef boost::float16_t float_least16_t;
|
||||
|
||||
BOOST_STATIC_ASSERT_MSG(std::numeric_limits<boost::float16_t>::is_iec559 == true, "boost::float16_t has been detected in <boost/cstdfloat>, but verification with std::numeric_limits fails");
|
||||
BOOST_STATIC_ASSERT_MSG(std::numeric_limits<boost::float16_t>::radix == 2, "boost::float16_t has been detected in <boost/cstdfloat>, but verification with std::numeric_limits fails");
|
||||
BOOST_STATIC_ASSERT_MSG(std::numeric_limits<boost::float16_t>::digits == 11, "boost::float16_t has been detected in <boost/cstdfloat>, but verification with std::numeric_limits fails");
|
||||
BOOST_STATIC_ASSERT_MSG(std::numeric_limits<boost::float16_t>::max_exponent == 16, "boost::float16_t has been detected in <boost/cstdfloat>, but verification with std::numeric_limits fails");
|
||||
|
||||
#undef BOOST_CSTDFLOAT_FLOAT_16_MIN
|
||||
#undef BOOST_CSTDFLOAT_FLOAT_16_MAX
|
||||
#endif
|
||||
|
||||
#if(BOOST_CSTDFLOAT_HAS_FLOAT32_NATIVE_TYPE == 1)
|
||||
typedef BOOST_CSTDFLOAT_FLOAT32_NATIVE_TYPE float32_t;
|
||||
typedef boost::float32_t float_fast32_t;
|
||||
typedef boost::float32_t float_least32_t;
|
||||
|
||||
BOOST_STATIC_ASSERT_MSG(std::numeric_limits<boost::float32_t>::is_iec559 == true, "boost::float32_t has been detected in <boost/cstdfloat>, but verification with std::numeric_limits fails");
|
||||
BOOST_STATIC_ASSERT_MSG(std::numeric_limits<boost::float32_t>::radix == 2, "boost::float32_t has been detected in <boost/cstdfloat>, but verification with std::numeric_limits fails");
|
||||
BOOST_STATIC_ASSERT_MSG(std::numeric_limits<boost::float32_t>::digits == 24, "boost::float32_t has been detected in <boost/cstdfloat>, but verification with std::numeric_limits fails");
|
||||
BOOST_STATIC_ASSERT_MSG(std::numeric_limits<boost::float32_t>::max_exponent == 128, "boost::float32_t has been detected in <boost/cstdfloat>, but verification with std::numeric_limits fails");
|
||||
|
||||
#undef BOOST_CSTDFLOAT_FLOAT_32_MIN
|
||||
#undef BOOST_CSTDFLOAT_FLOAT_32_MAX
|
||||
#endif
|
||||
|
||||
#if (defined(__SGI_STL_PORT) || defined(_STLPORT_VERSION)) && defined(__SUNPRO_CC)
|
||||
#undef BOOST_CSTDFLOAT_HAS_FLOAT80_NATIVE_TYPE
|
||||
#define BOOST_CSTDFLOAT_HAS_FLOAT80_NATIVE_TYPE 0
|
||||
#undef BOOST_CSTDFLOAT_HAS_FLOAT128_NATIVE_TYPE
|
||||
#define BOOST_CSTDFLOAT_HAS_FLOAT128_NATIVE_TYPE 0
|
||||
#undef BOOST_CSTDFLOAT_MAXIMUM_AVAILABLE_WIDTH
|
||||
#define BOOST_CSTDFLOAT_MAXIMUM_AVAILABLE_WIDTH 64
|
||||
#endif
|
||||
|
||||
#if(BOOST_CSTDFLOAT_HAS_FLOAT64_NATIVE_TYPE == 1)
|
||||
typedef BOOST_CSTDFLOAT_FLOAT64_NATIVE_TYPE float64_t;
|
||||
typedef boost::float64_t float_fast64_t;
|
||||
typedef boost::float64_t float_least64_t;
|
||||
|
||||
BOOST_STATIC_ASSERT_MSG(std::numeric_limits<boost::float64_t>::is_iec559 == true, "boost::float64_t has been detected in <boost/cstdfloat>, but verification with std::numeric_limits fails");
|
||||
BOOST_STATIC_ASSERT_MSG(std::numeric_limits<boost::float64_t>::radix == 2, "boost::float64_t has been detected in <boost/cstdfloat>, but verification with std::numeric_limits fails");
|
||||
BOOST_STATIC_ASSERT_MSG(std::numeric_limits<boost::float64_t>::digits == 53, "boost::float64_t has been detected in <boost/cstdfloat>, but verification with std::numeric_limits fails");
|
||||
BOOST_STATIC_ASSERT_MSG(std::numeric_limits<boost::float64_t>::max_exponent == 1024, "boost::float64_t has been detected in <boost/cstdfloat>, but verification with std::numeric_limits fails");
|
||||
|
||||
#undef BOOST_CSTDFLOAT_FLOAT_64_MIN
|
||||
#undef BOOST_CSTDFLOAT_FLOAT_64_MAX
|
||||
#endif
|
||||
|
||||
#if(BOOST_CSTDFLOAT_HAS_FLOAT80_NATIVE_TYPE == 1)
|
||||
typedef BOOST_CSTDFLOAT_FLOAT80_NATIVE_TYPE float80_t;
|
||||
typedef boost::float80_t float_fast80_t;
|
||||
typedef boost::float80_t float_least80_t;
|
||||
|
||||
BOOST_STATIC_ASSERT_MSG(std::numeric_limits<boost::float80_t>::is_iec559 == true, "boost::float80_t has been detected in <boost/cstdfloat>, but verification with std::numeric_limits fails");
|
||||
BOOST_STATIC_ASSERT_MSG(std::numeric_limits<boost::float80_t>::radix == 2, "boost::float80_t has been detected in <boost/cstdfloat>, but verification with std::numeric_limits fails");
|
||||
BOOST_STATIC_ASSERT_MSG(std::numeric_limits<boost::float80_t>::digits == 64, "boost::float80_t has been detected in <boost/cstdfloat>, but verification with std::numeric_limits fails");
|
||||
BOOST_STATIC_ASSERT_MSG(std::numeric_limits<boost::float80_t>::max_exponent == 16384, "boost::float80_t has been detected in <boost/cstdfloat>, but verification with std::numeric_limits fails");
|
||||
|
||||
#undef BOOST_CSTDFLOAT_FLOAT_80_MIN
|
||||
#undef BOOST_CSTDFLOAT_FLOAT_80_MAX
|
||||
#endif
|
||||
|
||||
#if(BOOST_CSTDFLOAT_HAS_FLOAT128_NATIVE_TYPE == 1)
|
||||
typedef BOOST_CSTDFLOAT_FLOAT128_NATIVE_TYPE float128_t;
|
||||
typedef boost::float128_t float_fast128_t;
|
||||
typedef boost::float128_t float_least128_t;
|
||||
|
||||
#if defined(BOOST_CSTDFLOAT_HAS_INTERNAL_FLOAT128_T) && defined(BOOST_MATH_USE_FLOAT128) && !defined(BOOST_CSTDFLOAT_NO_LIBQUADMATH_SUPPORT)
|
||||
// This configuration does not *yet* support std::numeric_limits<boost::float128_t>.
|
||||
// Support for std::numeric_limits<boost::float128_t> is added in the detail
|
||||
// file <boost/math/cstdfloat/cstdfloat_limits.hpp>.
|
||||
#else
|
||||
BOOST_STATIC_ASSERT_MSG(std::numeric_limits<boost::float128_t>::is_iec559 == true, "boost::float128_t has been detected in <boost/cstdfloat>, but verification with std::numeric_limits fails");
|
||||
BOOST_STATIC_ASSERT_MSG(std::numeric_limits<boost::float128_t>::radix == 2, "boost::float128_t has been detected in <boost/cstdfloat>, but verification with std::numeric_limits fails");
|
||||
BOOST_STATIC_ASSERT_MSG(std::numeric_limits<boost::float128_t>::digits == 113, "boost::float128_t has been detected in <boost/cstdfloat>, but verification with std::numeric_limits fails");
|
||||
BOOST_STATIC_ASSERT_MSG(std::numeric_limits<boost::float128_t>::max_exponent == 16384, "boost::float128_t has been detected in <boost/cstdfloat>, but verification with std::numeric_limits fails");
|
||||
#endif
|
||||
|
||||
#undef BOOST_CSTDFLOAT_FLOAT_128_MIN
|
||||
#undef BOOST_CSTDFLOAT_FLOAT_128_MAX
|
||||
#endif
|
||||
|
||||
#if (BOOST_CSTDFLOAT_MAXIMUM_AVAILABLE_WIDTH == 16)
|
||||
typedef boost::float16_t floatmax_t;
|
||||
#elif(BOOST_CSTDFLOAT_MAXIMUM_AVAILABLE_WIDTH == 32)
|
||||
typedef boost::float32_t floatmax_t;
|
||||
#elif(BOOST_CSTDFLOAT_MAXIMUM_AVAILABLE_WIDTH == 64)
|
||||
typedef boost::float64_t floatmax_t;
|
||||
#elif(BOOST_CSTDFLOAT_MAXIMUM_AVAILABLE_WIDTH == 80)
|
||||
typedef boost::float80_t floatmax_t;
|
||||
#elif(BOOST_CSTDFLOAT_MAXIMUM_AVAILABLE_WIDTH == 128)
|
||||
typedef boost::float128_t floatmax_t;
|
||||
#else
|
||||
#error The maximum available floating-point width for <boost/cstdfloat.hpp> is undefined.
|
||||
#endif
|
||||
|
||||
#undef BOOST_CSTDFLOAT_HAS_FLOAT16_NATIVE_TYPE
|
||||
#undef BOOST_CSTDFLOAT_HAS_FLOAT32_NATIVE_TYPE
|
||||
#undef BOOST_CSTDFLOAT_HAS_FLOAT64_NATIVE_TYPE
|
||||
#undef BOOST_CSTDFLOAT_HAS_FLOAT80_NATIVE_TYPE
|
||||
#undef BOOST_CSTDFLOAT_HAS_FLOAT128_NATIVE_TYPE
|
||||
|
||||
#undef BOOST_CSTDFLOAT_MAXIMUM_AVAILABLE_WIDTH
|
||||
}
|
||||
// namespace boost
|
||||
|
||||
#endif // _BOOST_CSTDFLOAT_BASE_TYPES_2014_01_09_HPP_
|
||||
@@ -0,0 +1,166 @@
|
||||
/*
|
||||
[auto_generated]
|
||||
boost/numeric/odeint/util/unwrap_reference.hpp
|
||||
|
||||
[begin_description]
|
||||
unwrap_reference
|
||||
[end_description]
|
||||
|
||||
Copyright 2012-2013 Karsten Ahnert
|
||||
Copyright 2012-2013 Mario Mulansky
|
||||
|
||||
Distributed under the Boost Software License, Version 1.0.
|
||||
(See accompanying file LICENSE_1_0.txt or
|
||||
copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
*/
|
||||
|
||||
|
||||
#ifndef BOOST_NUMERIC_ODEINT_UTIL_UNWRAP_REFERENCE_HPP_INCLUDED
|
||||
#define BOOST_NUMERIC_ODEINT_UTIL_UNWRAP_REFERENCE_HPP_INCLUDED
|
||||
|
||||
|
||||
#include <boost/numeric/odeint/config.hpp>
|
||||
|
||||
|
||||
#if BOOST_NUMERIC_ODEINT_CXX11
|
||||
#include <functional>
|
||||
#else
|
||||
#include <boost/ref.hpp>
|
||||
#endif
|
||||
|
||||
namespace boost {
|
||||
|
||||
#if BOOST_NUMERIC_ODEINT_CXX11
|
||||
template<typename T> class reference_wrapper;
|
||||
|
||||
template<typename T> struct unwrap_reference;
|
||||
#endif
|
||||
|
||||
namespace numeric {
|
||||
namespace odeint {
|
||||
|
||||
|
||||
#if BOOST_NUMERIC_ODEINT_CXX11
|
||||
|
||||
template<typename T>
|
||||
struct unwrap_reference
|
||||
{
|
||||
typedef typename std::remove_reference<T>::type type;
|
||||
};
|
||||
|
||||
template<typename T>
|
||||
struct unwrap_reference< std::reference_wrapper<T> >
|
||||
{
|
||||
typedef typename std::remove_reference<T>::type type;
|
||||
};
|
||||
|
||||
template<typename T>
|
||||
struct unwrap_reference< boost::reference_wrapper<T> >
|
||||
{
|
||||
typedef typename boost::unwrap_reference<T>::type type;
|
||||
};
|
||||
|
||||
#else
|
||||
|
||||
using ::boost::unwrap_reference;
|
||||
|
||||
#endif
|
||||
|
||||
namespace detail
|
||||
{
|
||||
|
||||
#if BOOST_NUMERIC_ODEINT_CXX11
|
||||
|
||||
using ::std::ref;
|
||||
|
||||
#else
|
||||
|
||||
using ::boost::ref;
|
||||
|
||||
#endif
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*
|
||||
*
|
||||
* the following is the suggested way, but unfortunately it does not work with all compilers.
|
||||
*/
|
||||
|
||||
/*
|
||||
|
||||
#include <boost/config.hpp>
|
||||
|
||||
|
||||
#ifdef BOOST_NO_CXX11_HDR_FUNCTIONAL
|
||||
#include <boost/ref.hpp>
|
||||
#else
|
||||
#include <functional>
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
namespace boost {
|
||||
namespace numeric {
|
||||
namespace odeint {
|
||||
|
||||
|
||||
#ifndef BOOST_NO_CXX11_HDR_FUNCTIONAL
|
||||
|
||||
template<typename T>
|
||||
struct unwrap_reference
|
||||
{
|
||||
typedef typename std::remove_reference<T>::type type;
|
||||
};
|
||||
|
||||
template<typename T>
|
||||
struct unwrap_reference< std::reference_wrapper<T> >
|
||||
{
|
||||
typedef typename std::remove_reference<T>::type type;
|
||||
};
|
||||
|
||||
template<typename T>
|
||||
struct unwrap_reference< boost::reference_wrapper<T> >
|
||||
{
|
||||
typedef typename boost::unwrap_reference<T>::type type;
|
||||
};
|
||||
|
||||
#else
|
||||
|
||||
using ::boost::unwrap_reference;
|
||||
|
||||
#endif
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
namespace boost {
|
||||
namespace numeric {
|
||||
namespace odeint {
|
||||
namespace detail {
|
||||
|
||||
|
||||
#ifndef BOOST_NO_CXX11_HDR_FUNCTIONAL
|
||||
|
||||
using ::std::ref;
|
||||
|
||||
#else
|
||||
|
||||
using ::boost::ref;
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
*/
|
||||
|
||||
#endif // BOOST_NUMERIC_ODEINT_UTIL_UNWRAP_REFERENCE_HPP_INCLUDED
|
||||
@@ -0,0 +1,147 @@
|
||||
// (C) Copyright Gennadiy Rozental 2001.
|
||||
// Distributed under the Boost Software License, Version 1.0.
|
||||
// (See accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
// See http://www.boost.org/libs/test for the library home page.
|
||||
//
|
||||
// File : $RCSfile$
|
||||
//
|
||||
// Version : $Revision$
|
||||
//
|
||||
// Description : class basic_cstring comparisons implementation
|
||||
// ***************************************************************************
|
||||
|
||||
#ifndef BOOST_TEST_UTILS_BASIC_CSTRING_COMPARE_HPP
|
||||
#define BOOST_TEST_UTILS_BASIC_CSTRING_COMPARE_HPP
|
||||
|
||||
// Boost.Test
|
||||
#include <boost/test/utils/basic_cstring/basic_cstring.hpp>
|
||||
|
||||
// STL
|
||||
#include <functional>
|
||||
#include <cctype>
|
||||
|
||||
#include <boost/test/detail/suppress_warnings.hpp>
|
||||
|
||||
//____________________________________________________________________________//
|
||||
|
||||
# if defined(BOOST_NO_STDC_NAMESPACE) && !BOOST_WORKAROUND(__BORLANDC__, <= 0x570)
|
||||
namespace std { using ::toupper; }
|
||||
# endif
|
||||
|
||||
namespace boost {
|
||||
|
||||
namespace unit_test {
|
||||
|
||||
// ************************************************************************** //
|
||||
// ************** case_ins_compare ************** //
|
||||
// ************************************************************************** //
|
||||
|
||||
namespace ut_detail {
|
||||
|
||||
template<class CharT>
|
||||
struct case_ins
|
||||
{
|
||||
static bool eq( CharT c1, CharT c2 ) { return (std::toupper)( c1 ) == (std::toupper)( c2 ); }
|
||||
static bool lt( CharT c1, CharT c2 ) { return (std::toupper)( c1 ) < (std::toupper)( c2 ); }
|
||||
|
||||
static int compare( CharT const* s1, CharT const* s2, std::size_t n )
|
||||
{
|
||||
for( std::size_t i = 0; i < n; ++i ) {
|
||||
if( !eq( s1[i], s2[i] ) )
|
||||
return lt( s1[i], s2[i] ) ? -1 : 1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace ut_detail
|
||||
|
||||
// ************************************************************************** //
|
||||
// ************** case_ins_eq ************** //
|
||||
// ************************************************************************** //
|
||||
|
||||
template<class CharT>
|
||||
inline bool
|
||||
case_ins_eq( basic_cstring<CharT> x, basic_cstring<CharT> y )
|
||||
{
|
||||
return x.size() == y.size() && ut_detail::case_ins<CharT>::compare( x.begin(), y.begin(), x.size() ) == 0;
|
||||
}
|
||||
|
||||
//____________________________________________________________________________//
|
||||
|
||||
// ************************************************************************** //
|
||||
// ************** case_ins_less ************** //
|
||||
// ************************************************************************** //
|
||||
|
||||
template<class CharT>
|
||||
class case_ins_less : public std::binary_function<basic_cstring<CharT>,basic_cstring<CharT>,bool>
|
||||
{
|
||||
public:
|
||||
bool operator()( basic_cstring<CharT> x, basic_cstring<CharT> y ) const
|
||||
{
|
||||
return x.size() != y.size()
|
||||
? x.size() < y.size()
|
||||
: ut_detail::case_ins<CharT>::compare( x.begin(), y.begin(), x.size() ) < 0;
|
||||
}
|
||||
};
|
||||
|
||||
//____________________________________________________________________________//
|
||||
|
||||
// ************************************************************************** //
|
||||
// ************** operators <,> ************** //
|
||||
// ************************************************************************** //
|
||||
|
||||
template<class CharT>
|
||||
inline bool
|
||||
operator <( boost::unit_test::basic_cstring<CharT> const& x,
|
||||
boost::unit_test::basic_cstring<CharT> const& y )
|
||||
{
|
||||
typedef typename boost::unit_test::basic_cstring<CharT>::traits_type traits_type;
|
||||
return x.size() != y.size()
|
||||
? x.size() < y.size()
|
||||
: traits_type::compare( x.begin(), y.begin(), x.size() ) < 0;
|
||||
}
|
||||
|
||||
//____________________________________________________________________________//
|
||||
|
||||
template<class CharT>
|
||||
inline bool
|
||||
operator <=( boost::unit_test::basic_cstring<CharT> const& x,
|
||||
boost::unit_test::basic_cstring<CharT> const& y )
|
||||
{
|
||||
return !(y < x);
|
||||
}
|
||||
|
||||
//____________________________________________________________________________//
|
||||
|
||||
template<class CharT>
|
||||
inline bool
|
||||
operator >( boost::unit_test::basic_cstring<CharT> const& x,
|
||||
boost::unit_test::basic_cstring<CharT> const& y )
|
||||
{
|
||||
return y < x;
|
||||
}
|
||||
|
||||
//____________________________________________________________________________//
|
||||
|
||||
template<class CharT>
|
||||
inline bool
|
||||
operator >=( boost::unit_test::basic_cstring<CharT> const& x,
|
||||
boost::unit_test::basic_cstring<CharT> const& y )
|
||||
{
|
||||
return !(x < y);
|
||||
}
|
||||
|
||||
//____________________________________________________________________________//
|
||||
|
||||
} // namespace unit_test
|
||||
|
||||
} // namespace boost
|
||||
|
||||
//____________________________________________________________________________//
|
||||
|
||||
#include <boost/test/detail/enable_warnings.hpp>
|
||||
|
||||
#endif // BOOST_TEST_BASIC_CSTRING_COMPARE_HPP_071894GER
|
||||
@@ -0,0 +1,211 @@
|
||||
#ifndef BOOST_ARCHIVE_BASIC_TEXT_OPRIMITIVE_HPP
|
||||
#define BOOST_ARCHIVE_BASIC_TEXT_OPRIMITIVE_HPP
|
||||
|
||||
// MS compatible compilers support #pragma once
|
||||
#if defined(_MSC_VER)
|
||||
# pragma once
|
||||
#endif
|
||||
|
||||
/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8
|
||||
// basic_text_oprimitive.hpp
|
||||
|
||||
// (C) Copyright 2002 Robert Ramey - http://www.rrsd.com .
|
||||
// Use, modification and distribution is subject to the Boost Software
|
||||
// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
// See http://www.boost.org for updates, documentation, and revision history.
|
||||
|
||||
// archives stored as text - note these ar templated on the basic
|
||||
// stream templates to accommodate wide (and other?) kind of characters
|
||||
//
|
||||
// note the fact that on libraries without wide characters, ostream is
|
||||
// is not a specialization of basic_ostream which in fact is not defined
|
||||
// in such cases. So we can't use basic_ostream<OStream::char_type> but rather
|
||||
// use two template parameters
|
||||
|
||||
#include <iomanip>
|
||||
#include <locale>
|
||||
#include <cstddef> // size_t
|
||||
|
||||
#include <boost/config.hpp>
|
||||
#include <boost/static_assert.hpp>
|
||||
#include <boost/io/ios_state.hpp>
|
||||
|
||||
#include <boost/detail/workaround.hpp>
|
||||
#if BOOST_WORKAROUND(BOOST_DINKUMWARE_STDLIB, == 1)
|
||||
#include <boost/archive/dinkumware.hpp>
|
||||
#endif
|
||||
|
||||
#if defined(BOOST_NO_STDC_NAMESPACE)
|
||||
namespace std{
|
||||
using ::size_t;
|
||||
#if ! defined(BOOST_DINKUMWARE_STDLIB) && ! defined(__SGI_STL_PORT)
|
||||
using ::locale;
|
||||
#endif
|
||||
} // namespace std
|
||||
#endif
|
||||
|
||||
#include <boost/type_traits/is_floating_point.hpp>
|
||||
#include <boost/mpl/bool.hpp>
|
||||
#include <boost/limits.hpp>
|
||||
#include <boost/integer.hpp>
|
||||
#include <boost/io/ios_state.hpp>
|
||||
#include <boost/serialization/throw_exception.hpp>
|
||||
#include <boost/archive/basic_streambuf_locale_saver.hpp>
|
||||
#include <boost/archive/codecvt_null.hpp>
|
||||
#include <boost/archive/archive_exception.hpp>
|
||||
#include <boost/archive/detail/abi_prefix.hpp> // must be the last header
|
||||
|
||||
namespace boost {
|
||||
namespace archive {
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
// class basic_text_oprimitive - output of prmitives to stream
|
||||
template<class OStream>
|
||||
class BOOST_SYMBOL_VISIBLE basic_text_oprimitive
|
||||
{
|
||||
protected:
|
||||
OStream &os;
|
||||
io::ios_flags_saver flags_saver;
|
||||
io::ios_precision_saver precision_saver;
|
||||
|
||||
#ifndef BOOST_NO_STD_LOCALE
|
||||
// note order! - if you change this, libstd++ will fail!
|
||||
// a) create new locale with new codecvt facet
|
||||
// b) save current locale
|
||||
// c) change locale to new one
|
||||
// d) use stream buffer
|
||||
// e) change locale back to original
|
||||
// f) destroy new codecvt facet
|
||||
boost::archive::codecvt_null<typename OStream::char_type> codecvt_null_facet;
|
||||
std::locale archive_locale;
|
||||
basic_ostream_locale_saver<
|
||||
typename OStream::char_type,
|
||||
typename OStream::traits_type
|
||||
> locale_saver;
|
||||
#endif
|
||||
|
||||
/////////////////////////////////////////////////////////
|
||||
// fundamental types that need special treatment
|
||||
void save(const bool t){
|
||||
// trap usage of invalid uninitialized boolean which would
|
||||
// otherwise crash on load.
|
||||
BOOST_ASSERT(0 == static_cast<int>(t) || 1 == static_cast<int>(t));
|
||||
if(os.fail())
|
||||
boost::serialization::throw_exception(
|
||||
archive_exception(archive_exception::output_stream_error)
|
||||
);
|
||||
os << t;
|
||||
}
|
||||
void save(const signed char t)
|
||||
{
|
||||
save(static_cast<short int>(t));
|
||||
}
|
||||
void save(const unsigned char t)
|
||||
{
|
||||
save(static_cast<short unsigned int>(t));
|
||||
}
|
||||
void save(const char t)
|
||||
{
|
||||
save(static_cast<short int>(t));
|
||||
}
|
||||
#ifndef BOOST_NO_INTRINSIC_WCHAR_T
|
||||
void save(const wchar_t t)
|
||||
{
|
||||
BOOST_STATIC_ASSERT(sizeof(wchar_t) <= sizeof(int));
|
||||
save(static_cast<int>(t));
|
||||
}
|
||||
#endif
|
||||
|
||||
/////////////////////////////////////////////////////////
|
||||
// saving of any types not listed above
|
||||
|
||||
template<class T>
|
||||
void save_impl(const T &t, boost::mpl::bool_<false> &){
|
||||
if(os.fail())
|
||||
boost::serialization::throw_exception(
|
||||
archive_exception(archive_exception::output_stream_error)
|
||||
);
|
||||
os << t;
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////
|
||||
// floating point types need even more special treatment
|
||||
// the following determines whether the type T is some sort
|
||||
// of floating point type. Note that we then assume that
|
||||
// the stream << operator is defined on that type - if not
|
||||
// we'll get a compile time error. This is meant to automatically
|
||||
// support synthesized types which support floating point
|
||||
// operations. Also it should handle compiler dependent types
|
||||
// such long double. Due to John Maddock.
|
||||
|
||||
template<class T>
|
||||
struct is_float {
|
||||
typedef typename mpl::bool_<
|
||||
boost::is_floating_point<T>::value
|
||||
|| (std::numeric_limits<T>::is_specialized
|
||||
&& !std::numeric_limits<T>::is_integer
|
||||
&& !std::numeric_limits<T>::is_exact
|
||||
&& std::numeric_limits<T>::max_exponent)
|
||||
>::type type;
|
||||
};
|
||||
|
||||
template<class T>
|
||||
void save_impl(const T &t, boost::mpl::bool_<true> &){
|
||||
// must be a user mistake - can't serialize un-initialized data
|
||||
if(os.fail())
|
||||
boost::serialization::throw_exception(
|
||||
archive_exception(archive_exception::output_stream_error)
|
||||
);
|
||||
// The formulae for the number of decimla digits required is given in
|
||||
// http://www2.open-std.org/JTC1/SC22/WG21/docs/papers/2005/n1822.pdf
|
||||
// which is derived from Kahan's paper:
|
||||
// www.eecs.berkeley.edu/~wkahan/ieee754status/ieee754.ps
|
||||
// const unsigned int digits = (std::numeric_limits<T>::digits * 3010) / 10000;
|
||||
// note: I've commented out the above because I didn't get good results. e.g.
|
||||
// in one case I got a difference of 19 units.
|
||||
#ifndef BOOST_NO_CXX11_NUMERIC_LIMITS
|
||||
const unsigned int digits = std::numeric_limits<T>::max_digits10;
|
||||
#else
|
||||
const unsigned int digits = std::numeric_limits<T>::digits10 + 2;
|
||||
#endif
|
||||
os << std::setprecision(digits) << std::scientific << t;
|
||||
}
|
||||
|
||||
template<class T>
|
||||
void save(const T & t){
|
||||
boost::io::ios_flags_saver fs(os);
|
||||
boost::io::ios_precision_saver ps(os);
|
||||
typename is_float<T>::type tf;
|
||||
save_impl(t, tf);
|
||||
}
|
||||
|
||||
BOOST_ARCHIVE_OR_WARCHIVE_DECL
|
||||
basic_text_oprimitive(OStream & os, bool no_codecvt);
|
||||
BOOST_ARCHIVE_OR_WARCHIVE_DECL
|
||||
~basic_text_oprimitive();
|
||||
public:
|
||||
// unformatted append of one character
|
||||
void put(typename OStream::char_type c){
|
||||
if(os.fail())
|
||||
boost::serialization::throw_exception(
|
||||
archive_exception(archive_exception::output_stream_error)
|
||||
);
|
||||
os.put(c);
|
||||
}
|
||||
// unformatted append of null terminated string
|
||||
void put(const char * s){
|
||||
while('\0' != *s)
|
||||
os.put(*s++);
|
||||
}
|
||||
BOOST_ARCHIVE_OR_WARCHIVE_DECL void
|
||||
save_binary(const void *address, std::size_t count);
|
||||
};
|
||||
|
||||
} //namespace boost
|
||||
} //namespace archive
|
||||
|
||||
#include <boost/archive/detail/abi_suffix.hpp> // pops abi_suffix.hpp pragmas
|
||||
|
||||
#endif // BOOST_ARCHIVE_BASIC_TEXT_OPRIMITIVE_HPP
|
||||
@@ -0,0 +1,134 @@
|
||||
/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8
|
||||
// basic_binary_iarchive.ipp:
|
||||
|
||||
// (C) Copyright 2002 Robert Ramey - http://www.rrsd.com .
|
||||
// Use, modification and distribution is subject to the Boost Software
|
||||
// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
// See http://www.boost.org for updates, documentation, and revision history.
|
||||
#include <string>
|
||||
#include <boost/assert.hpp>
|
||||
#include <algorithm>
|
||||
#include <cstring>
|
||||
|
||||
#include <boost/config.hpp>
|
||||
#if defined(BOOST_NO_STDC_NAMESPACE)
|
||||
namespace std{
|
||||
using ::memcpy;
|
||||
using ::strlen;
|
||||
using ::size_t;
|
||||
}
|
||||
#endif
|
||||
|
||||
#include <boost/detail/workaround.hpp>
|
||||
#include <boost/detail/endian.hpp>
|
||||
|
||||
#include <boost/archive/basic_binary_iarchive.hpp>
|
||||
|
||||
namespace boost {
|
||||
namespace archive {
|
||||
|
||||
/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8
|
||||
// implementation of binary_binary_archive
|
||||
template<class Archive>
|
||||
BOOST_ARCHIVE_OR_WARCHIVE_DECL void
|
||||
basic_binary_iarchive<Archive>::load_override(class_name_type & t){
|
||||
std::string cn;
|
||||
cn.reserve(BOOST_SERIALIZATION_MAX_KEY_SIZE);
|
||||
load_override(cn);
|
||||
if(cn.size() > (BOOST_SERIALIZATION_MAX_KEY_SIZE - 1))
|
||||
boost::serialization::throw_exception(
|
||||
archive_exception(archive_exception::invalid_class_name)
|
||||
);
|
||||
std::memcpy(t, cn.data(), cn.size());
|
||||
// borland tweak
|
||||
t.t[cn.size()] = '\0';
|
||||
}
|
||||
|
||||
template<class Archive>
|
||||
BOOST_ARCHIVE_OR_WARCHIVE_DECL void
|
||||
basic_binary_iarchive<Archive>::init(void){
|
||||
// read signature in an archive version independent manner
|
||||
std::string file_signature;
|
||||
|
||||
#if 0 // commented out since it interfers with derivation
|
||||
BOOST_TRY {
|
||||
std::size_t l;
|
||||
this->This()->load(l);
|
||||
if(l == std::strlen(BOOST_ARCHIVE_SIGNATURE())) {
|
||||
// borland de-allocator fixup
|
||||
#if BOOST_WORKAROUND(_RWSTD_VER, BOOST_TESTED_AT(20101))
|
||||
if(NULL != file_signature.data())
|
||||
#endif
|
||||
file_signature.resize(l);
|
||||
// note breaking a rule here - could be a problem on some platform
|
||||
if(0 < l)
|
||||
this->This()->load_binary(&(*file_signature.begin()), l);
|
||||
}
|
||||
}
|
||||
BOOST_CATCH(archive_exception const &) { // catch stream_error archive exceptions
|
||||
// will cause invalid_signature archive exception to be thrown below
|
||||
file_signature = "";
|
||||
}
|
||||
BOOST_CATCH_END
|
||||
#else
|
||||
// https://svn.boost.org/trac/boost/ticket/7301
|
||||
* this->This() >> file_signature;
|
||||
#endif
|
||||
|
||||
if(file_signature != BOOST_ARCHIVE_SIGNATURE())
|
||||
boost::serialization::throw_exception(
|
||||
archive_exception(archive_exception::invalid_signature)
|
||||
);
|
||||
|
||||
// make sure the version of the reading archive library can
|
||||
// support the format of the archive being read
|
||||
library_version_type input_library_version;
|
||||
//* this->This() >> input_library_version;
|
||||
{
|
||||
int v = 0;
|
||||
v = this->This()->m_sb.sbumpc();
|
||||
#if defined(BOOST_LITTLE_ENDIAN)
|
||||
if(v < 6){
|
||||
;
|
||||
}
|
||||
else
|
||||
if(v < 7){
|
||||
// version 6 - next byte should be zero
|
||||
this->This()->m_sb.sbumpc();
|
||||
}
|
||||
else
|
||||
if(v < 8){
|
||||
int x1;
|
||||
// version 7 = might be followed by zero or some other byte
|
||||
x1 = this->This()->m_sb.sgetc();
|
||||
// it's =a zero, push it back
|
||||
if(0 == x1)
|
||||
this->This()->m_sb.sbumpc();
|
||||
}
|
||||
else{
|
||||
// version 8+ followed by a zero
|
||||
this->This()->m_sb.sbumpc();
|
||||
}
|
||||
#elif defined(BOOST_BIG_ENDIAN)
|
||||
if(v == 0)
|
||||
v = this->This()->m_sb.sbumpc();
|
||||
#endif
|
||||
input_library_version = static_cast<library_version_type>(v);
|
||||
}
|
||||
|
||||
#if BOOST_WORKAROUND(__MWERKS__, BOOST_TESTED_AT(0x3205))
|
||||
this->set_library_version(input_library_version);
|
||||
#else
|
||||
detail::basic_iarchive::set_library_version(input_library_version);
|
||||
#endif
|
||||
|
||||
if(BOOST_ARCHIVE_VERSION() < input_library_version)
|
||||
boost::serialization::throw_exception(
|
||||
archive_exception(archive_exception::unsupported_version)
|
||||
);
|
||||
}
|
||||
|
||||
} // namespace archive
|
||||
} // namespace boost
|
||||
@@ -0,0 +1,55 @@
|
||||
|
||||
// NO INCLUDE GUARDS, THE HEADER IS INTENDED FOR MULTIPLE INCLUSION
|
||||
|
||||
// Copyright Aleksey Gurtovoy 2000-2006
|
||||
//
|
||||
// Distributed under the Boost Software License, Version 1.0.
|
||||
// (See accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
//
|
||||
// See http://www.boost.org/libs/mpl for documentation.
|
||||
|
||||
// $Id$
|
||||
// $Date$
|
||||
// $Revision$
|
||||
|
||||
#include <boost/mpl/aux_/config/typeof.hpp>
|
||||
#include <boost/mpl/aux_/config/ctps.hpp>
|
||||
#include <boost/mpl/aux_/config/preprocessor.hpp>
|
||||
#include <boost/mpl/aux_/config/workaround.hpp>
|
||||
|
||||
#include <boost/preprocessor/cat.hpp>
|
||||
#include <boost/preprocessor/stringize.hpp>
|
||||
|
||||
#if defined(BOOST_MPL_CFG_TYPEOF_BASED_SEQUENCES)
|
||||
# define AUX778076_INCLUDE_DIR typeof_based
|
||||
#elif defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) \
|
||||
|| defined(BOOST_MPL_CFG_NO_NONTYPE_TEMPLATE_PARTIAL_SPEC)
|
||||
# define AUX778076_INCLUDE_DIR no_ctps
|
||||
#else
|
||||
# define AUX778076_INCLUDE_DIR plain
|
||||
#endif
|
||||
|
||||
#if !defined(BOOST_NEEDS_TOKEN_PASTING_OP_FOR_TOKENS_JUXTAPOSING)
|
||||
# define AUX778076_HEADER \
|
||||
AUX778076_INCLUDE_DIR/BOOST_MPL_PREPROCESSED_HEADER \
|
||||
/**/
|
||||
#else
|
||||
# define AUX778076_HEADER \
|
||||
BOOST_PP_CAT(AUX778076_INCLUDE_DIR,/)##BOOST_MPL_PREPROCESSED_HEADER \
|
||||
/**/
|
||||
#endif
|
||||
|
||||
|
||||
#if BOOST_WORKAROUND(__IBMCPP__, BOOST_TESTED_AT(700))
|
||||
# define AUX778076_INCLUDE_STRING BOOST_PP_STRINGIZE(boost/mpl/vector/aux_/preprocessed/AUX778076_HEADER)
|
||||
# include AUX778076_INCLUDE_STRING
|
||||
# undef AUX778076_INCLUDE_STRING
|
||||
#else
|
||||
# include BOOST_PP_STRINGIZE(boost/mpl/vector/aux_/preprocessed/AUX778076_HEADER)
|
||||
#endif
|
||||
|
||||
# undef AUX778076_HEADER
|
||||
# undef AUX778076_INCLUDE_DIR
|
||||
|
||||
#undef BOOST_MPL_PREPROCESSED_HEADER
|
||||
@@ -0,0 +1,30 @@
|
||||
// Boost.Units - A C++ library for zero-overhead dimensional analysis and
|
||||
// unit/quantity manipulation and conversion
|
||||
//
|
||||
// Copyright (C) 2003-2008 Matthias Christian Schabel
|
||||
// Copyright (C) 2008 Steven Watanabe
|
||||
//
|
||||
// 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_UNITS_MAGNETIC_FIELD_INTENSITY_DERIVED_DIMENSION_HPP
|
||||
#define BOOST_UNITS_MAGNETIC_FIELD_INTENSITY_DERIVED_DIMENSION_HPP
|
||||
|
||||
#include <boost/units/derived_dimension.hpp>
|
||||
#include <boost/units/physical_dimensions/length.hpp>
|
||||
#include <boost/units/physical_dimensions/current.hpp>
|
||||
|
||||
namespace boost {
|
||||
|
||||
namespace units {
|
||||
|
||||
/// derived dimension for magnetic field intensity : L^-1 I
|
||||
typedef derived_dimension<length_base_dimension,-1,
|
||||
current_base_dimension,1>::type magnetic_field_intensity_dimension;
|
||||
|
||||
} // namespace units
|
||||
|
||||
} // namespace boost
|
||||
|
||||
#endif // BOOST_UNITS_MAGNETIC_FIELD_INTENSITY_DERIVED_DIMENSION_HPP
|
||||
@@ -0,0 +1,456 @@
|
||||
// Three-state boolean logic library
|
||||
|
||||
// Copyright Douglas Gregor 2002-2004. 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
|
||||
#ifndef BOOST_LOGIC_TRIBOOL_HPP
|
||||
#define BOOST_LOGIC_TRIBOOL_HPP
|
||||
|
||||
#include <boost/logic/tribool_fwd.hpp>
|
||||
#include <boost/config.hpp>
|
||||
#include <boost/detail/workaround.hpp>
|
||||
|
||||
#ifdef BOOST_HAS_PRAGMA_ONCE
|
||||
# pragma once
|
||||
#endif
|
||||
|
||||
namespace boost { namespace logic {
|
||||
|
||||
/// INTERNAL ONLY
|
||||
namespace detail {
|
||||
/**
|
||||
* INTERNAL ONLY
|
||||
*
|
||||
* \brief A type used only to uniquely identify the 'indeterminate'
|
||||
* function/keyword.
|
||||
*/
|
||||
struct indeterminate_t
|
||||
{
|
||||
#if BOOST_WORKAROUND(__BORLANDC__, < 0x0600)
|
||||
char dummy_; // BCB would use 8 bytes by default
|
||||
#endif
|
||||
};
|
||||
|
||||
} // end namespace detail
|
||||
|
||||
/**
|
||||
* INTERNAL ONLY
|
||||
* The type of the 'indeterminate' keyword. This has the same type as the
|
||||
* function 'indeterminate' so that we can recognize when the keyword is
|
||||
* used.
|
||||
*/
|
||||
typedef bool (*indeterminate_keyword_t)(tribool, detail::indeterminate_t);
|
||||
|
||||
/**
|
||||
* \brief Keyword and test function for the indeterminate tribool value
|
||||
*
|
||||
* The \c indeterminate function has a dual role. It's first role is
|
||||
* as a unary function that tells whether the tribool value is in the
|
||||
* "indeterminate" state. It's second role is as a keyword
|
||||
* representing the indeterminate (just like "true" and "false"
|
||||
* represent the true and false states). If you do not like the name
|
||||
* "indeterminate", and would prefer to use a different name, see the
|
||||
* macro \c BOOST_TRIBOOL_THIRD_STATE.
|
||||
*
|
||||
* \returns <tt>x.value == tribool::indeterminate_value</tt>
|
||||
* \throws nothrow
|
||||
*/
|
||||
BOOST_CONSTEXPR inline bool
|
||||
indeterminate(tribool x,
|
||||
detail::indeterminate_t dummy = detail::indeterminate_t()) BOOST_NOEXCEPT;
|
||||
|
||||
/**
|
||||
* \brief A 3-state boolean type.
|
||||
*
|
||||
* 3-state boolean values are either true, false, or
|
||||
* indeterminate.
|
||||
*/
|
||||
class tribool
|
||||
{
|
||||
private:
|
||||
/// INTERNAL ONLY
|
||||
struct dummy {
|
||||
void nonnull() {};
|
||||
};
|
||||
|
||||
typedef void (dummy::*safe_bool)();
|
||||
|
||||
public:
|
||||
/**
|
||||
* Construct a new 3-state boolean value with the value 'false'.
|
||||
*
|
||||
* \throws nothrow
|
||||
*/
|
||||
BOOST_CONSTEXPR tribool() BOOST_NOEXCEPT : value(false_value) {}
|
||||
|
||||
/**
|
||||
* Construct a new 3-state boolean value with the given boolean
|
||||
* value, which may be \c true or \c false.
|
||||
*
|
||||
* \throws nothrow
|
||||
*/
|
||||
BOOST_CONSTEXPR tribool(bool initial_value) BOOST_NOEXCEPT : value(initial_value? true_value : false_value) {}
|
||||
|
||||
/**
|
||||
* Construct a new 3-state boolean value with an indeterminate value.
|
||||
*
|
||||
* \throws nothrow
|
||||
*/
|
||||
BOOST_CONSTEXPR tribool(indeterminate_keyword_t) BOOST_NOEXCEPT : value(indeterminate_value) {}
|
||||
|
||||
/**
|
||||
* Use a 3-state boolean in a boolean context. Will evaluate true in a
|
||||
* boolean context only when the 3-state boolean is definitely true.
|
||||
*
|
||||
* \returns true if the 3-state boolean is true, false otherwise
|
||||
* \throws nothrow
|
||||
*/
|
||||
BOOST_CONSTEXPR operator safe_bool() const BOOST_NOEXCEPT
|
||||
{
|
||||
return value == true_value? &dummy::nonnull : 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* The actual stored value in this 3-state boolean, which may be false, true,
|
||||
* or indeterminate.
|
||||
*/
|
||||
enum value_t { false_value, true_value, indeterminate_value } value;
|
||||
};
|
||||
|
||||
// Check if the given tribool has an indeterminate value. Also doubles as a
|
||||
// keyword for the 'indeterminate' value
|
||||
BOOST_CONSTEXPR inline bool indeterminate(tribool x, detail::indeterminate_t) BOOST_NOEXCEPT
|
||||
{
|
||||
return x.value == tribool::indeterminate_value;
|
||||
}
|
||||
|
||||
/** @defgroup logical Logical operations
|
||||
*/
|
||||
//@{
|
||||
/**
|
||||
* \brief Computes the logical negation of a tribool
|
||||
*
|
||||
* \returns the logical negation of the tribool, according to the
|
||||
* table:
|
||||
* <table border=1>
|
||||
* <tr>
|
||||
* <th><center><code>!</code></center></th>
|
||||
* <th/>
|
||||
* </tr>
|
||||
* <tr>
|
||||
* <th><center>false</center></th>
|
||||
* <td><center>true</center></td>
|
||||
* </tr>
|
||||
* <tr>
|
||||
* <th><center>true</center></th>
|
||||
* <td><center>false</center></td>
|
||||
* </tr>
|
||||
* <tr>
|
||||
* <th><center>indeterminate</center></th>
|
||||
* <td><center>indeterminate</center></td>
|
||||
* </tr>
|
||||
* </table>
|
||||
* \throws nothrow
|
||||
*/
|
||||
BOOST_CONSTEXPR inline tribool operator!(tribool x) BOOST_NOEXCEPT
|
||||
{
|
||||
return x.value == tribool::false_value? tribool(true)
|
||||
:x.value == tribool::true_value? tribool(false)
|
||||
:tribool(indeterminate);
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief Computes the logical conjuction of two tribools
|
||||
*
|
||||
* \returns the result of logically ANDing the two tribool values,
|
||||
* according to the following table:
|
||||
* <table border=1>
|
||||
* <tr>
|
||||
* <th><center><code>&&</code></center></th>
|
||||
* <th><center>false</center></th>
|
||||
* <th><center>true</center></th>
|
||||
* <th><center>indeterminate</center></th>
|
||||
* </tr>
|
||||
* <tr>
|
||||
* <th><center>false</center></th>
|
||||
* <td><center>false</center></td>
|
||||
* <td><center>false</center></td>
|
||||
* <td><center>false</center></td>
|
||||
* </tr>
|
||||
* <tr>
|
||||
* <th><center>true</center></th>
|
||||
* <td><center>false</center></td>
|
||||
* <td><center>true</center></td>
|
||||
* <td><center>indeterminate</center></td>
|
||||
* </tr>
|
||||
* <tr>
|
||||
* <th><center>indeterminate</center></th>
|
||||
* <td><center>false</center></td>
|
||||
* <td><center>indeterminate</center></td>
|
||||
* <td><center>indeterminate</center></td>
|
||||
* </tr>
|
||||
* </table>
|
||||
* \throws nothrow
|
||||
*/
|
||||
BOOST_CONSTEXPR inline tribool operator&&(tribool x, tribool y) BOOST_NOEXCEPT
|
||||
{
|
||||
return (static_cast<bool>(!x) || static_cast<bool>(!y))
|
||||
? tribool(false)
|
||||
: ((static_cast<bool>(x) && static_cast<bool>(y)) ? tribool(true) : indeterminate)
|
||||
;
|
||||
}
|
||||
|
||||
/**
|
||||
* \overload
|
||||
*/
|
||||
BOOST_CONSTEXPR inline tribool operator&&(tribool x, bool y) BOOST_NOEXCEPT
|
||||
{ return y? x : tribool(false); }
|
||||
|
||||
/**
|
||||
* \overload
|
||||
*/
|
||||
BOOST_CONSTEXPR inline tribool operator&&(bool x, tribool y) BOOST_NOEXCEPT
|
||||
{ return x? y : tribool(false); }
|
||||
|
||||
/**
|
||||
* \overload
|
||||
*/
|
||||
BOOST_CONSTEXPR inline tribool operator&&(indeterminate_keyword_t, tribool x) BOOST_NOEXCEPT
|
||||
{ return !x? tribool(false) : tribool(indeterminate); }
|
||||
|
||||
/**
|
||||
* \overload
|
||||
*/
|
||||
BOOST_CONSTEXPR inline tribool operator&&(tribool x, indeterminate_keyword_t) BOOST_NOEXCEPT
|
||||
{ return !x? tribool(false) : tribool(indeterminate); }
|
||||
|
||||
/**
|
||||
* \brief Computes the logical disjunction of two tribools
|
||||
*
|
||||
* \returns the result of logically ORing the two tribool values,
|
||||
* according to the following table:
|
||||
* <table border=1>
|
||||
* <tr>
|
||||
* <th><center><code>||</code></center></th>
|
||||
* <th><center>false</center></th>
|
||||
* <th><center>true</center></th>
|
||||
* <th><center>indeterminate</center></th>
|
||||
* </tr>
|
||||
* <tr>
|
||||
* <th><center>false</center></th>
|
||||
* <td><center>false</center></td>
|
||||
* <td><center>true</center></td>
|
||||
* <td><center>indeterminate</center></td>
|
||||
* </tr>
|
||||
* <tr>
|
||||
* <th><center>true</center></th>
|
||||
* <td><center>true</center></td>
|
||||
* <td><center>true</center></td>
|
||||
* <td><center>true</center></td>
|
||||
* </tr>
|
||||
* <tr>
|
||||
* <th><center>indeterminate</center></th>
|
||||
* <td><center>indeterminate</center></td>
|
||||
* <td><center>true</center></td>
|
||||
* <td><center>indeterminate</center></td>
|
||||
* </tr>
|
||||
* </table>
|
||||
* \throws nothrow
|
||||
*/
|
||||
BOOST_CONSTEXPR inline tribool operator||(tribool x, tribool y) BOOST_NOEXCEPT
|
||||
{
|
||||
return (static_cast<bool>(!x) && static_cast<bool>(!y))
|
||||
? tribool(false)
|
||||
: ((static_cast<bool>(x) || static_cast<bool>(y)) ? tribool(true) : tribool(indeterminate))
|
||||
;
|
||||
}
|
||||
|
||||
/**
|
||||
* \overload
|
||||
*/
|
||||
BOOST_CONSTEXPR inline tribool operator||(tribool x, bool y) BOOST_NOEXCEPT
|
||||
{ return y? tribool(true) : x; }
|
||||
|
||||
/**
|
||||
* \overload
|
||||
*/
|
||||
BOOST_CONSTEXPR inline tribool operator||(bool x, tribool y) BOOST_NOEXCEPT
|
||||
{ return x? tribool(true) : y; }
|
||||
|
||||
/**
|
||||
* \overload
|
||||
*/
|
||||
BOOST_CONSTEXPR inline tribool operator||(indeterminate_keyword_t, tribool x) BOOST_NOEXCEPT
|
||||
{ return x? tribool(true) : tribool(indeterminate); }
|
||||
|
||||
/**
|
||||
* \overload
|
||||
*/
|
||||
BOOST_CONSTEXPR inline tribool operator||(tribool x, indeterminate_keyword_t) BOOST_NOEXCEPT
|
||||
{ return x? tribool(true) : tribool(indeterminate); }
|
||||
//@}
|
||||
|
||||
/**
|
||||
* \brief Compare tribools for equality
|
||||
*
|
||||
* \returns the result of comparing two tribool values, according to
|
||||
* the following table:
|
||||
* <table border=1>
|
||||
* <tr>
|
||||
* <th><center><code>==</code></center></th>
|
||||
* <th><center>false</center></th>
|
||||
* <th><center>true</center></th>
|
||||
* <th><center>indeterminate</center></th>
|
||||
* </tr>
|
||||
* <tr>
|
||||
* <th><center>false</center></th>
|
||||
* <td><center>true</center></td>
|
||||
* <td><center>false</center></td>
|
||||
* <td><center>indeterminate</center></td>
|
||||
* </tr>
|
||||
* <tr>
|
||||
* <th><center>true</center></th>
|
||||
* <td><center>false</center></td>
|
||||
* <td><center>true</center></td>
|
||||
* <td><center>indeterminate</center></td>
|
||||
* </tr>
|
||||
* <tr>
|
||||
* <th><center>indeterminate</center></th>
|
||||
* <td><center>indeterminate</center></td>
|
||||
* <td><center>indeterminate</center></td>
|
||||
* <td><center>indeterminate</center></td>
|
||||
* </tr>
|
||||
* </table>
|
||||
* \throws nothrow
|
||||
*/
|
||||
BOOST_CONSTEXPR inline tribool operator==(tribool x, tribool y) BOOST_NOEXCEPT
|
||||
{
|
||||
return (indeterminate(x) || indeterminate(y))
|
||||
? indeterminate
|
||||
: ((x && y) || (!x && !y))
|
||||
;
|
||||
}
|
||||
|
||||
/**
|
||||
* \overload
|
||||
*/
|
||||
BOOST_CONSTEXPR inline tribool operator==(tribool x, bool y) BOOST_NOEXCEPT { return x == tribool(y); }
|
||||
|
||||
/**
|
||||
* \overload
|
||||
*/
|
||||
BOOST_CONSTEXPR inline tribool operator==(bool x, tribool y) BOOST_NOEXCEPT { return tribool(x) == y; }
|
||||
|
||||
/**
|
||||
* \overload
|
||||
*/
|
||||
BOOST_CONSTEXPR inline tribool operator==(indeterminate_keyword_t, tribool x) BOOST_NOEXCEPT
|
||||
{ return tribool(indeterminate) == x; }
|
||||
|
||||
/**
|
||||
* \overload
|
||||
*/
|
||||
BOOST_CONSTEXPR inline tribool operator==(tribool x, indeterminate_keyword_t) BOOST_NOEXCEPT
|
||||
{ return tribool(indeterminate) == x; }
|
||||
|
||||
/**
|
||||
* \brief Compare tribools for inequality
|
||||
*
|
||||
* \returns the result of comparing two tribool values for inequality,
|
||||
* according to the following table:
|
||||
* <table border=1>
|
||||
* <tr>
|
||||
* <th><center><code>!=</code></center></th>
|
||||
* <th><center>false</center></th>
|
||||
* <th><center>true</center></th>
|
||||
* <th><center>indeterminate</center></th>
|
||||
* </tr>
|
||||
* <tr>
|
||||
* <th><center>false</center></th>
|
||||
* <td><center>false</center></td>
|
||||
* <td><center>true</center></td>
|
||||
* <td><center>indeterminate</center></td>
|
||||
* </tr>
|
||||
* <tr>
|
||||
* <th><center>true</center></th>
|
||||
* <td><center>true</center></td>
|
||||
* <td><center>false</center></td>
|
||||
* <td><center>indeterminate</center></td>
|
||||
* </tr>
|
||||
* <tr>
|
||||
* <th><center>indeterminate</center></th>
|
||||
* <td><center>indeterminate</center></td>
|
||||
* <td><center>indeterminate</center></td>
|
||||
* <td><center>indeterminate</center></td>
|
||||
* </tr>
|
||||
* </table>
|
||||
* \throws nothrow
|
||||
*/
|
||||
BOOST_CONSTEXPR inline tribool operator!=(tribool x, tribool y) BOOST_NOEXCEPT
|
||||
{
|
||||
return (indeterminate(x) || indeterminate(y))
|
||||
? indeterminate
|
||||
: !((x && y) || (!x && !y))
|
||||
;
|
||||
}
|
||||
|
||||
/**
|
||||
* \overload
|
||||
*/
|
||||
BOOST_CONSTEXPR inline tribool operator!=(tribool x, bool y) BOOST_NOEXCEPT { return x != tribool(y); }
|
||||
|
||||
/**
|
||||
* \overload
|
||||
*/
|
||||
BOOST_CONSTEXPR inline tribool operator!=(bool x, tribool y) BOOST_NOEXCEPT { return tribool(x) != y; }
|
||||
|
||||
/**
|
||||
* \overload
|
||||
*/
|
||||
BOOST_CONSTEXPR inline tribool operator!=(indeterminate_keyword_t, tribool x) BOOST_NOEXCEPT
|
||||
{ return tribool(indeterminate) != x; }
|
||||
|
||||
/**
|
||||
* \overload
|
||||
*/
|
||||
BOOST_CONSTEXPR inline tribool operator!=(tribool x, indeterminate_keyword_t) BOOST_NOEXCEPT
|
||||
{ return x != tribool(indeterminate); }
|
||||
|
||||
} } // end namespace boost::logic
|
||||
|
||||
// Pull tribool and indeterminate into namespace "boost"
|
||||
namespace boost {
|
||||
using logic::tribool;
|
||||
using logic::indeterminate;
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief Declare a new name for the third state of a tribool
|
||||
*
|
||||
* Use this macro to declare a new name for the third state of a
|
||||
* tribool. This state can have any number of new names (in addition
|
||||
* to \c indeterminate), all of which will be equivalent. The new name will be
|
||||
* placed in the namespace in which the macro is expanded.
|
||||
*
|
||||
* Example:
|
||||
* BOOST_TRIBOOL_THIRD_STATE(true_or_false)
|
||||
*
|
||||
* tribool x(true_or_false);
|
||||
* // potentially set x
|
||||
* if (true_or_false(x)) {
|
||||
* // don't know what x is
|
||||
* }
|
||||
*/
|
||||
#define BOOST_TRIBOOL_THIRD_STATE(Name) \
|
||||
inline bool \
|
||||
Name(boost::logic::tribool x, \
|
||||
boost::logic::detail::indeterminate_t = \
|
||||
boost::logic::detail::indeterminate_t()) \
|
||||
{ return x.value == boost::logic::tribool::indeterminate_value; }
|
||||
|
||||
#endif // BOOST_LOGIC_TRIBOOL_HPP
|
||||
|
||||
@@ -0,0 +1,398 @@
|
||||
/* boost random/detail/seed.hpp header file
|
||||
*
|
||||
* Copyright Steven Watanabe 2009
|
||||
* Distributed under the Boost Software License, Version 1.0. (See
|
||||
* accompanying file LICENSE_1_0.txt or copy at
|
||||
* http://www.boost.org/LICENSE_1_0.txt)
|
||||
*
|
||||
* See http://www.boost.org for most recent version including documentation.
|
||||
*
|
||||
* $Id$
|
||||
*/
|
||||
|
||||
#ifndef BOOST_RANDOM_DETAIL_SEED_IMPL_HPP
|
||||
#define BOOST_RANDOM_DETAIL_SEED_IMPL_HPP
|
||||
|
||||
#include <stdexcept>
|
||||
#include <boost/cstdint.hpp>
|
||||
#include <boost/throw_exception.hpp>
|
||||
#include <boost/config/no_tr1/cmath.hpp>
|
||||
#include <boost/integer/integer_mask.hpp>
|
||||
#include <boost/integer/static_log2.hpp>
|
||||
#include <boost/random/traits.hpp>
|
||||
#include <boost/mpl/bool.hpp>
|
||||
#include <boost/mpl/if.hpp>
|
||||
#include <boost/mpl/int.hpp>
|
||||
#include <boost/random/detail/const_mod.hpp>
|
||||
#include <boost/random/detail/integer_log2.hpp>
|
||||
#include <boost/random/detail/signed_unsigned_tools.hpp>
|
||||
#include <boost/random/detail/generator_bits.hpp>
|
||||
|
||||
#include <boost/random/detail/disable_warnings.hpp>
|
||||
|
||||
namespace boost {
|
||||
namespace random {
|
||||
namespace detail {
|
||||
|
||||
// finds the seed type of an engine, given its
|
||||
// result_type. If the result_type is integral
|
||||
// the seed type is the same. If the result_type
|
||||
// is floating point, the seed type is uint32_t
|
||||
template<class T>
|
||||
struct seed_type
|
||||
{
|
||||
typedef typename boost::mpl::if_<boost::is_integral<T>,
|
||||
T,
|
||||
boost::uint32_t
|
||||
>::type type;
|
||||
};
|
||||
|
||||
template<int N>
|
||||
struct const_pow_impl
|
||||
{
|
||||
template<class T>
|
||||
static T call(T arg, int n, T result)
|
||||
{
|
||||
return const_pow_impl<N / 2>::call(T(arg * arg), n / 2,
|
||||
n%2 == 0? result : T(result * arg));
|
||||
}
|
||||
};
|
||||
|
||||
template<>
|
||||
struct const_pow_impl<0>
|
||||
{
|
||||
template<class T>
|
||||
static T call(T, int, T result)
|
||||
{
|
||||
return result;
|
||||
}
|
||||
};
|
||||
|
||||
// requires N is an upper bound on n
|
||||
template<int N, class T>
|
||||
inline T const_pow(T arg, int n) { return const_pow_impl<N>::call(arg, n, T(1)); }
|
||||
|
||||
template<class T>
|
||||
inline T pow2(int n)
|
||||
{
|
||||
typedef unsigned int_type;
|
||||
const int max_bits = std::numeric_limits<int_type>::digits;
|
||||
T multiplier = T(int_type(1) << (max_bits - 1)) * 2;
|
||||
return (int_type(1) << (n % max_bits)) *
|
||||
const_pow<std::numeric_limits<T>::digits / max_bits>(multiplier, n / max_bits);
|
||||
}
|
||||
|
||||
template<class Engine, class Iter>
|
||||
void generate_from_real(Engine& eng, Iter begin, Iter end)
|
||||
{
|
||||
using std::fmod;
|
||||
typedef typename Engine::result_type RealType;
|
||||
const int Bits = detail::generator_bits<Engine>::value();
|
||||
int remaining_bits = 0;
|
||||
boost::uint_least32_t saved_bits = 0;
|
||||
RealType multiplier = pow2<RealType>( Bits);
|
||||
RealType mult32 = RealType(4294967296.0); // 2^32
|
||||
while(true) {
|
||||
RealType val = eng() * multiplier;
|
||||
int available_bits = Bits;
|
||||
// Make sure the compiler can optimize this out
|
||||
// if it isn't possible.
|
||||
if(Bits < 32 && available_bits < 32 - remaining_bits) {
|
||||
saved_bits |= boost::uint_least32_t(val) << remaining_bits;
|
||||
remaining_bits += Bits;
|
||||
} else {
|
||||
// If Bits < 32, then remaining_bits != 0, since
|
||||
// if remaining_bits == 0, available_bits < 32 - 0,
|
||||
// and we won't get here to begin with.
|
||||
if(Bits < 32 || remaining_bits != 0) {
|
||||
boost::uint_least32_t divisor =
|
||||
(boost::uint_least32_t(1) << (32 - remaining_bits));
|
||||
boost::uint_least32_t extra_bits = boost::uint_least32_t(fmod(val, mult32)) & (divisor - 1);
|
||||
val = val / divisor;
|
||||
*begin++ = saved_bits | (extra_bits << remaining_bits);
|
||||
if(begin == end) return;
|
||||
available_bits -= 32 - remaining_bits;
|
||||
remaining_bits = 0;
|
||||
}
|
||||
// If Bits < 32 we should never enter this loop
|
||||
if(Bits >= 32) {
|
||||
for(; available_bits >= 32; available_bits -= 32) {
|
||||
boost::uint_least32_t word = boost::uint_least32_t(fmod(val, mult32));
|
||||
val /= mult32;
|
||||
*begin++ = word;
|
||||
if(begin == end) return;
|
||||
}
|
||||
}
|
||||
remaining_bits = available_bits;
|
||||
saved_bits = static_cast<boost::uint_least32_t>(val);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
template<class Engine, class Iter>
|
||||
void generate_from_int(Engine& eng, Iter begin, Iter end)
|
||||
{
|
||||
typedef typename Engine::result_type IntType;
|
||||
typedef typename boost::random::traits::make_unsigned<IntType>::type unsigned_type;
|
||||
int remaining_bits = 0;
|
||||
boost::uint_least32_t saved_bits = 0;
|
||||
unsigned_type range = boost::random::detail::subtract<IntType>()((eng.max)(), (eng.min)());
|
||||
|
||||
int bits =
|
||||
(range == (std::numeric_limits<unsigned_type>::max)()) ?
|
||||
std::numeric_limits<unsigned_type>::digits :
|
||||
detail::integer_log2(range + 1);
|
||||
|
||||
{
|
||||
int discarded_bits = detail::integer_log2(bits);
|
||||
unsigned_type excess = (range + 1) >> (bits - discarded_bits);
|
||||
if(excess != 0) {
|
||||
int extra_bits = detail::integer_log2((excess - 1) ^ excess);
|
||||
bits = bits - discarded_bits + extra_bits;
|
||||
}
|
||||
}
|
||||
|
||||
unsigned_type mask = (static_cast<unsigned_type>(2) << (bits - 1)) - 1;
|
||||
unsigned_type limit = ((range + 1) & ~mask) - 1;
|
||||
|
||||
while(true) {
|
||||
unsigned_type val;
|
||||
do {
|
||||
val = boost::random::detail::subtract<IntType>()(eng(), (eng.min)());
|
||||
} while(limit != range && val > limit);
|
||||
val &= mask;
|
||||
int available_bits = bits;
|
||||
if(available_bits == 32) {
|
||||
*begin++ = static_cast<boost::uint_least32_t>(val) & 0xFFFFFFFFu;
|
||||
if(begin == end) return;
|
||||
} else if(available_bits % 32 == 0) {
|
||||
for(int i = 0; i < available_bits / 32; ++i) {
|
||||
boost::uint_least32_t word = boost::uint_least32_t(val) & 0xFFFFFFFFu;
|
||||
int suppress_warning = (bits >= 32);
|
||||
BOOST_ASSERT(suppress_warning == 1);
|
||||
val >>= (32 * suppress_warning);
|
||||
*begin++ = word;
|
||||
if(begin == end) return;
|
||||
}
|
||||
} else if(bits < 32 && available_bits < 32 - remaining_bits) {
|
||||
saved_bits |= boost::uint_least32_t(val) << remaining_bits;
|
||||
remaining_bits += bits;
|
||||
} else {
|
||||
if(bits < 32 || remaining_bits != 0) {
|
||||
boost::uint_least32_t extra_bits = boost::uint_least32_t(val) & ((boost::uint_least32_t(1) << (32 - remaining_bits)) - 1);
|
||||
val >>= 32 - remaining_bits;
|
||||
*begin++ = saved_bits | (extra_bits << remaining_bits);
|
||||
if(begin == end) return;
|
||||
available_bits -= 32 - remaining_bits;
|
||||
remaining_bits = 0;
|
||||
}
|
||||
if(bits >= 32) {
|
||||
for(; available_bits >= 32; available_bits -= 32) {
|
||||
boost::uint_least32_t word = boost::uint_least32_t(val) & 0xFFFFFFFFu;
|
||||
int suppress_warning = (bits >= 32);
|
||||
BOOST_ASSERT(suppress_warning == 1);
|
||||
val >>= (32 * suppress_warning);
|
||||
*begin++ = word;
|
||||
if(begin == end) return;
|
||||
}
|
||||
}
|
||||
remaining_bits = available_bits;
|
||||
saved_bits = static_cast<boost::uint_least32_t>(val);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
template<class Engine, class Iter>
|
||||
void generate_impl(Engine& eng, Iter first, Iter last, boost::mpl::true_)
|
||||
{
|
||||
return detail::generate_from_int(eng, first, last);
|
||||
}
|
||||
|
||||
template<class Engine, class Iter>
|
||||
void generate_impl(Engine& eng, Iter first, Iter last, boost::mpl::false_)
|
||||
{
|
||||
return detail::generate_from_real(eng, first, last);
|
||||
}
|
||||
|
||||
template<class Engine, class Iter>
|
||||
void generate(Engine& eng, Iter first, Iter last)
|
||||
{
|
||||
return detail::generate_impl(eng, first, last, boost::random::traits::is_integral<typename Engine::result_type>());
|
||||
}
|
||||
|
||||
|
||||
|
||||
template<class IntType, IntType m, class SeedSeq>
|
||||
IntType seed_one_int(SeedSeq& seq)
|
||||
{
|
||||
static const int log = ::boost::mpl::if_c<(m == 0),
|
||||
::boost::mpl::int_<(::std::numeric_limits<IntType>::digits)>,
|
||||
::boost::static_log2<m> >::type::value;
|
||||
static const int k =
|
||||
(log + ((~(static_cast<IntType>(2) << (log - 1)) & m)? 32 : 31)) / 32;
|
||||
::boost::uint_least32_t array[log / 32 + 4];
|
||||
seq.generate(&array[0], &array[0] + k + 3);
|
||||
IntType s = 0;
|
||||
for(int j = 0; j < k; ++j) {
|
||||
IntType digit = const_mod<IntType, m>::apply(IntType(array[j+3]));
|
||||
IntType mult = IntType(1) << 32*j;
|
||||
s = const_mod<IntType, m>::mult_add(mult, digit, s);
|
||||
}
|
||||
return s;
|
||||
}
|
||||
|
||||
template<class IntType, IntType m, class Iter>
|
||||
IntType get_one_int(Iter& first, Iter last)
|
||||
{
|
||||
static const int log = ::boost::mpl::if_c<(m == 0),
|
||||
::boost::mpl::int_<(::std::numeric_limits<IntType>::digits)>,
|
||||
::boost::static_log2<m> >::type::value;
|
||||
static const int k =
|
||||
(log + ((~(static_cast<IntType>(2) << (log - 1)) & m)? 32 : 31)) / 32;
|
||||
IntType s = 0;
|
||||
for(int j = 0; j < k; ++j) {
|
||||
if(first == last) {
|
||||
boost::throw_exception(::std::invalid_argument("Not enough elements in call to seed."));
|
||||
}
|
||||
IntType digit = const_mod<IntType, m>::apply(IntType(*first++));
|
||||
IntType mult = IntType(1) << 32*j;
|
||||
s = const_mod<IntType, m>::mult_add(mult, digit, s);
|
||||
}
|
||||
return s;
|
||||
}
|
||||
|
||||
// TODO: work in-place whenever possible
|
||||
template<int w, std::size_t n, class SeedSeq, class UIntType>
|
||||
void seed_array_int_impl(SeedSeq& seq, UIntType (&x)[n])
|
||||
{
|
||||
boost::uint_least32_t storage[((w+31)/32) * n];
|
||||
seq.generate(&storage[0], &storage[0] + ((w+31)/32) * n);
|
||||
for(std::size_t j = 0; j < n; j++) {
|
||||
UIntType val = 0;
|
||||
for(std::size_t k = 0; k < (w+31)/32; ++k) {
|
||||
val += static_cast<UIntType>(storage[(w+31)/32*j + k]) << 32*k;
|
||||
}
|
||||
x[j] = val & ::boost::low_bits_mask_t<w>::sig_bits;
|
||||
}
|
||||
}
|
||||
|
||||
template<int w, std::size_t n, class SeedSeq, class IntType>
|
||||
inline void seed_array_int_impl(SeedSeq& seq, IntType (&x)[n], boost::mpl::true_)
|
||||
{
|
||||
BOOST_STATIC_ASSERT_MSG(boost::is_integral<IntType>::value, "Sorry but this routine has not been ported to non built-in integers as it relies on a reinterpret_cast.");
|
||||
typedef typename boost::make_unsigned<IntType>::type unsigned_array[n];
|
||||
seed_array_int_impl<w>(seq, reinterpret_cast<unsigned_array&>(x));
|
||||
}
|
||||
|
||||
template<int w, std::size_t n, class SeedSeq, class IntType>
|
||||
inline void seed_array_int_impl(SeedSeq& seq, IntType (&x)[n], boost::mpl::false_)
|
||||
{
|
||||
seed_array_int_impl<w>(seq, x);
|
||||
}
|
||||
|
||||
template<int w, std::size_t n, class SeedSeq, class IntType>
|
||||
inline void seed_array_int(SeedSeq& seq, IntType (&x)[n])
|
||||
{
|
||||
seed_array_int_impl<w>(seq, x, boost::random::traits::is_signed<IntType>());
|
||||
}
|
||||
|
||||
template<int w, std::size_t n, class Iter, class UIntType>
|
||||
void fill_array_int_impl(Iter& first, Iter last, UIntType (&x)[n])
|
||||
{
|
||||
for(std::size_t j = 0; j < n; j++) {
|
||||
UIntType val = 0;
|
||||
for(std::size_t k = 0; k < (w+31)/32; ++k) {
|
||||
if(first == last) {
|
||||
boost::throw_exception(std::invalid_argument("Not enough elements in call to seed."));
|
||||
}
|
||||
val += static_cast<UIntType>(*first++) << 32*k;
|
||||
}
|
||||
x[j] = val & ::boost::low_bits_mask_t<w>::sig_bits;
|
||||
}
|
||||
}
|
||||
|
||||
template<int w, std::size_t n, class Iter, class IntType>
|
||||
inline void fill_array_int_impl(Iter& first, Iter last, IntType (&x)[n], boost::mpl::true_)
|
||||
{
|
||||
BOOST_STATIC_ASSERT_MSG(boost::is_integral<IntType>::value, "Sorry but this routine has not been ported to non built-in integers as it relies on a reinterpret_cast.");
|
||||
typedef typename boost::make_unsigned<IntType>::type unsigned_array[n];
|
||||
fill_array_int_impl<w>(first, last, reinterpret_cast<unsigned_array&>(x));
|
||||
}
|
||||
|
||||
template<int w, std::size_t n, class Iter, class IntType>
|
||||
inline void fill_array_int_impl(Iter& first, Iter last, IntType (&x)[n], boost::mpl::false_)
|
||||
{
|
||||
fill_array_int_impl<w>(first, last, x);
|
||||
}
|
||||
|
||||
template<int w, std::size_t n, class Iter, class IntType>
|
||||
inline void fill_array_int(Iter& first, Iter last, IntType (&x)[n])
|
||||
{
|
||||
fill_array_int_impl<w>(first, last, x, boost::random::traits::is_signed<IntType>());
|
||||
}
|
||||
|
||||
template<int w, std::size_t n, class RealType>
|
||||
void seed_array_real_impl(const boost::uint_least32_t* storage, RealType (&x)[n])
|
||||
{
|
||||
boost::uint_least32_t mask = ~((~boost::uint_least32_t(0)) << (w%32));
|
||||
RealType two32 = 4294967296.0;
|
||||
const RealType divisor = RealType(1)/detail::pow2<RealType>(w);
|
||||
unsigned int j;
|
||||
for(j = 0; j < n; ++j) {
|
||||
RealType val = RealType(0);
|
||||
RealType mult = divisor;
|
||||
for(int k = 0; k < w/32; ++k) {
|
||||
val += *storage++ * mult;
|
||||
mult *= two32;
|
||||
}
|
||||
if(mask != 0) {
|
||||
val += (*storage++ & mask) * mult;
|
||||
}
|
||||
BOOST_ASSERT(val >= 0);
|
||||
BOOST_ASSERT(val < 1);
|
||||
x[j] = val;
|
||||
}
|
||||
}
|
||||
|
||||
template<int w, std::size_t n, class SeedSeq, class RealType>
|
||||
void seed_array_real(SeedSeq& seq, RealType (&x)[n])
|
||||
{
|
||||
using std::pow;
|
||||
boost::uint_least32_t storage[((w+31)/32) * n];
|
||||
seq.generate(&storage[0], &storage[0] + ((w+31)/32) * n);
|
||||
seed_array_real_impl<w>(storage, x);
|
||||
}
|
||||
|
||||
template<int w, std::size_t n, class Iter, class RealType>
|
||||
void fill_array_real(Iter& first, Iter last, RealType (&x)[n])
|
||||
{
|
||||
boost::uint_least32_t mask = ~((~boost::uint_least32_t(0)) << (w%32));
|
||||
RealType two32 = 4294967296.0;
|
||||
const RealType divisor = RealType(1)/detail::pow2<RealType>(w);
|
||||
unsigned int j;
|
||||
for(j = 0; j < n; ++j) {
|
||||
RealType val = RealType(0);
|
||||
RealType mult = divisor;
|
||||
for(int k = 0; k < w/32; ++k, ++first) {
|
||||
if(first == last) boost::throw_exception(std::invalid_argument("Not enough elements in call to seed."));
|
||||
val += *first * mult;
|
||||
mult *= two32;
|
||||
}
|
||||
if(mask != 0) {
|
||||
if(first == last) boost::throw_exception(std::invalid_argument("Not enough elements in call to seed."));
|
||||
val += (*first & mask) * mult;
|
||||
++first;
|
||||
}
|
||||
BOOST_ASSERT(val >= 0);
|
||||
BOOST_ASSERT(val < 1);
|
||||
x[j] = val;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#include <boost/random/detail/enable_warnings.hpp>
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,24 @@
|
||||
// (C) Copyright Dave Abrahams, Steve Cleary, Beman Dawes, Howard
|
||||
// Hinnant & John Maddock 2000.
|
||||
// Use, modification and distribution are subject to the Boost Software License,
|
||||
// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt).
|
||||
//
|
||||
// See http://www.boost.org/libs/type_traits for most recent version including documentation.
|
||||
//
|
||||
// defines traits classes for cv-qualified types:
|
||||
// is_const, is_volatile, remove_const, remove_volatile, remove_cv.
|
||||
|
||||
#ifndef BOOST_TT_CV_TRAITS_HPP_INCLUDED
|
||||
#define BOOST_TT_CV_TRAITS_HPP_INCLUDED
|
||||
|
||||
#include <boost/type_traits/add_const.hpp>
|
||||
#include <boost/type_traits/add_volatile.hpp>
|
||||
#include <boost/type_traits/add_cv.hpp>
|
||||
#include <boost/type_traits/is_const.hpp>
|
||||
#include <boost/type_traits/is_volatile.hpp>
|
||||
#include <boost/type_traits/remove_const.hpp>
|
||||
#include <boost/type_traits/remove_volatile.hpp>
|
||||
#include <boost/type_traits/remove_cv.hpp>
|
||||
|
||||
#endif // BOOST_TT_CV_TRAITS_HPP_INCLUDED
|
||||
@@ -0,0 +1,46 @@
|
||||
// -*- Mode: C++ -*-
|
||||
#ifndef DISPLAYTEXT_H
|
||||
#define DISPLAYTEXT_H
|
||||
|
||||
#include <QTextEdit>
|
||||
#include <QFont>
|
||||
|
||||
#include "logbook/logbook.h"
|
||||
#include "decodedtext.h"
|
||||
|
||||
class QAction;
|
||||
|
||||
class DisplayText
|
||||
: public QTextEdit
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit DisplayText(QWidget *parent = 0);
|
||||
|
||||
void setContentFont (QFont const&);
|
||||
void insertLineSpacer(QString const&);
|
||||
void displayDecodedText(DecodedText const& decodedText, QString const& myCall, bool displayDXCCEntity,
|
||||
LogBook const& logBook, QColor color_CQ, QColor color_MyCall,
|
||||
QColor color_DXCC, QColor color_NewCall);
|
||||
void displayTransmittedText(QString text, QString modeTx, qint32 txFreq,
|
||||
QColor color_TxMsg, bool bFastMode);
|
||||
void displayQSY(QString text);
|
||||
|
||||
Q_SIGNAL void selectCallsign (bool alt, bool ctrl);
|
||||
Q_SIGNAL void erased ();
|
||||
|
||||
Q_SLOT void appendText (QString const& text, QColor bg = Qt::white);
|
||||
Q_SLOT void erase ();
|
||||
|
||||
protected:
|
||||
void mouseDoubleClickEvent(QMouseEvent *e);
|
||||
|
||||
private:
|
||||
QString appendDXCCWorkedB4(QString message, QString const& callsign, QColor * bg, LogBook const& logBook,
|
||||
QColor color_CQ, QColor color_DXCC, QColor color_NewCall);
|
||||
|
||||
QFont char_font_;
|
||||
QAction * erase_action_;
|
||||
};
|
||||
|
||||
#endif // DISPLAYTEXT_H
|
||||
@@ -0,0 +1,32 @@
|
||||
// Boost.Units - A C++ library for zero-overhead dimensional analysis and
|
||||
// unit/quantity manipulation and conversion
|
||||
//
|
||||
// Copyright (C) 2003-2008 Matthias Christian Schabel
|
||||
// Copyright (C) 2008 Steven Watanabe
|
||||
//
|
||||
// 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_UNITS_DYNAMIC_VISCOSITY_DERIVED_DIMENSION_HPP
|
||||
#define BOOST_UNITS_DYNAMIC_VISCOSITY_DERIVED_DIMENSION_HPP
|
||||
|
||||
#include <boost/units/derived_dimension.hpp>
|
||||
#include <boost/units/physical_dimensions/length.hpp>
|
||||
#include <boost/units/physical_dimensions/mass.hpp>
|
||||
#include <boost/units/physical_dimensions/time.hpp>
|
||||
|
||||
namespace boost {
|
||||
|
||||
namespace units {
|
||||
|
||||
/// derived dimension for dynamic viscosity : M L^-1 T^-1
|
||||
typedef derived_dimension<mass_base_dimension,1,
|
||||
length_base_dimension,-1,
|
||||
time_base_dimension,-1>::type dynamic_viscosity_dimension;
|
||||
|
||||
} // namespace units
|
||||
|
||||
} // namespace boost
|
||||
|
||||
#endif // BOOST_UNITS_DYNAMIC_VISCOSITY_DERIVED_DIMENSION_HPP
|
||||
@@ -0,0 +1,71 @@
|
||||
//---------------------------------------------------------------------------//
|
||||
// Copyright (c) 2013-2014 Kyle Lutz <kyle.r.lutz@gmail.com>
|
||||
//
|
||||
// Distributed under the Boost Software License, Version 1.0
|
||||
// See accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt
|
||||
//
|
||||
// See http://boostorg.github.com/compute for more information.
|
||||
//---------------------------------------------------------------------------//
|
||||
|
||||
#ifndef BOOST_COMPUTE_EXCEPTION_UNSUPPORTED_EXTENSION_ERROR_HPP
|
||||
#define BOOST_COMPUTE_EXCEPTION_UNSUPPORTED_EXTENSION_ERROR_HPP
|
||||
|
||||
#include <exception>
|
||||
#include <sstream>
|
||||
#include <string>
|
||||
|
||||
namespace boost {
|
||||
namespace compute {
|
||||
|
||||
/// \class unsupported_extension_error
|
||||
/// \brief Exception thrown when attempting to use an unsupported
|
||||
/// OpenCL extension.
|
||||
///
|
||||
/// This exception is thrown when the user attempts to use an OpenCL
|
||||
/// extension which is not supported on the platform and/or device.
|
||||
///
|
||||
/// An example of this is attempting to use CL-GL sharing on a non-GPU
|
||||
/// device.
|
||||
///
|
||||
/// \see opencl_error
|
||||
class unsupported_extension_error : public std::exception
|
||||
{
|
||||
public:
|
||||
/// Creates a new unsupported extension error exception object indicating
|
||||
/// that \p extension is not supported by the OpenCL platform or device.
|
||||
explicit unsupported_extension_error(const char *extension) throw()
|
||||
: m_extension(extension)
|
||||
{
|
||||
std::stringstream msg;
|
||||
msg << "OpenCL extension " << extension << " not supported";
|
||||
m_error_string = msg.str();
|
||||
}
|
||||
|
||||
/// Destroys the unsupported extension error object.
|
||||
~unsupported_extension_error() throw()
|
||||
{
|
||||
}
|
||||
|
||||
/// Returns the name of the unsupported extension.
|
||||
std::string extension_name() const throw()
|
||||
{
|
||||
return m_extension;
|
||||
}
|
||||
|
||||
/// Returns a string containing a human-readable error message containing
|
||||
/// the name of the unsupported exception.
|
||||
const char* what() const throw()
|
||||
{
|
||||
return m_error_string.c_str();
|
||||
}
|
||||
|
||||
private:
|
||||
std::string m_extension;
|
||||
std::string m_error_string;
|
||||
};
|
||||
|
||||
} // end compute namespace
|
||||
} // end boost namespace
|
||||
|
||||
#endif // BOOST_COMPUTE_EXCEPTION_UNSUPPORTED_EXTENSION_ERROR_HPP
|
||||
@@ -0,0 +1,31 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2001-2011 Joel de Guzman
|
||||
|
||||
Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
==============================================================================*/
|
||||
#if !defined(BOOST_FUSION_IS_VIEW_IMPL_09272006_0725)
|
||||
#define BOOST_FUSION_IS_VIEW_IMPL_09272006_0725
|
||||
|
||||
#include <boost/fusion/support/config.hpp>
|
||||
#include <boost/mpl/bool.hpp>
|
||||
|
||||
namespace boost { namespace fusion
|
||||
{
|
||||
struct boost_tuple_tag;
|
||||
|
||||
namespace extension
|
||||
{
|
||||
template<typename Tag>
|
||||
struct is_view_impl;
|
||||
|
||||
template<>
|
||||
struct is_view_impl<boost_tuple_tag>
|
||||
{
|
||||
template<typename T>
|
||||
struct apply : mpl::false_ {};
|
||||
};
|
||||
}
|
||||
}}
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,71 @@
|
||||
|
||||
// Copyright Aleksey Gurtovoy 2000-2004
|
||||
//
|
||||
// Distributed under the Boost Software License, Version 1.0.
|
||||
// (See accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
//
|
||||
|
||||
// Preprocessed version of "boost/mpl/and.hpp" header
|
||||
// -- DO NOT modify by hand!
|
||||
|
||||
namespace boost { namespace mpl {
|
||||
|
||||
namespace aux {
|
||||
template< bool C_ > struct and_impl
|
||||
{
|
||||
template<
|
||||
typename T1, typename T2, typename T3, typename T4
|
||||
>
|
||||
struct result_
|
||||
: false_
|
||||
{
|
||||
};
|
||||
};
|
||||
|
||||
template<> struct and_impl<true>
|
||||
{
|
||||
template<
|
||||
typename T1, typename T2, typename T3, typename T4
|
||||
>
|
||||
struct result_
|
||||
: and_impl<
|
||||
BOOST_MPL_AUX_NESTED_TYPE_WKND(T1)::value
|
||||
>::template result_< T2,T3,T4,true_ >
|
||||
{
|
||||
};
|
||||
|
||||
template<> struct result_< true_,true_,true_,true_ >
|
||||
: true_
|
||||
{
|
||||
};
|
||||
};
|
||||
|
||||
} // namespace aux
|
||||
|
||||
template<
|
||||
typename BOOST_MPL_AUX_NA_PARAM(T1)
|
||||
, typename BOOST_MPL_AUX_NA_PARAM(T2)
|
||||
, typename T3 = true_, typename T4 = true_, typename T5 = true_
|
||||
>
|
||||
struct and_
|
||||
|
||||
: aux::and_impl<
|
||||
BOOST_MPL_AUX_NESTED_TYPE_WKND(T1)::value
|
||||
>::template result_< T2,T3,T4,T5 >
|
||||
|
||||
{
|
||||
BOOST_MPL_AUX_LAMBDA_SUPPORT(
|
||||
5
|
||||
, and_
|
||||
, ( T1, T2, T3, T4, T5)
|
||||
)
|
||||
};
|
||||
|
||||
BOOST_MPL_AUX_NA_SPEC2(
|
||||
2
|
||||
, 5
|
||||
, and_
|
||||
)
|
||||
|
||||
}}
|
||||
@@ -0,0 +1,64 @@
|
||||
|
||||
// Copyright Aleksey Gurtovoy 2000-2004
|
||||
//
|
||||
// Distributed under the Boost Software License, Version 1.0.
|
||||
// (See accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
//
|
||||
|
||||
// Preprocessed version of "boost/mpl/or.hpp" header
|
||||
// -- DO NOT modify by hand!
|
||||
|
||||
namespace boost { namespace mpl {
|
||||
|
||||
namespace aux {
|
||||
|
||||
template< bool C_, typename T1, typename T2, typename T3, typename T4 >
|
||||
struct or_impl
|
||||
: true_
|
||||
{
|
||||
};
|
||||
|
||||
template< typename T1, typename T2, typename T3, typename T4 >
|
||||
struct or_impl< false,T1,T2,T3,T4 >
|
||||
: or_impl<
|
||||
BOOST_MPL_AUX_NESTED_TYPE_WKND(T1)::value
|
||||
, T2, T3, T4
|
||||
, false_
|
||||
>
|
||||
{
|
||||
};
|
||||
|
||||
template<>
|
||||
struct or_impl<
|
||||
false
|
||||
, false_, false_, false_, false_
|
||||
>
|
||||
: false_
|
||||
{
|
||||
};
|
||||
|
||||
} // namespace aux
|
||||
|
||||
template<
|
||||
typename BOOST_MPL_AUX_NA_PARAM(T1)
|
||||
, typename BOOST_MPL_AUX_NA_PARAM(T2)
|
||||
, typename T3 = false_, typename T4 = false_, typename T5 = false_
|
||||
>
|
||||
struct or_
|
||||
|
||||
: aux::or_impl<
|
||||
BOOST_MPL_AUX_NESTED_TYPE_WKND(T1)::value
|
||||
, T2, T3, T4, T5
|
||||
>
|
||||
|
||||
{
|
||||
};
|
||||
|
||||
BOOST_MPL_AUX_NA_SPEC2(
|
||||
2
|
||||
, 5
|
||||
, or_
|
||||
)
|
||||
|
||||
}}
|
||||
@@ -0,0 +1,249 @@
|
||||
//-----------------------------------------------------------------------------
|
||||
// boost variant/detail/initializer.hpp header file
|
||||
// See http://www.boost.org for updates, documentation, and revision history.
|
||||
//-----------------------------------------------------------------------------
|
||||
//
|
||||
// Copyright (c) 2002-2003
|
||||
// Eric Friedman, Itay Maman
|
||||
//
|
||||
// Distributed under the Boost Software License, Version 1.0. (See
|
||||
// accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
#ifndef BOOST_VARIANT_DETAIL_INITIALIZER_HPP
|
||||
#define BOOST_VARIANT_DETAIL_INITIALIZER_HPP
|
||||
|
||||
#include <new> // for placement new
|
||||
|
||||
#include <boost/config.hpp>
|
||||
|
||||
#include <boost/call_traits.hpp>
|
||||
#include <boost/detail/reference_content.hpp>
|
||||
#include <boost/variant/recursive_wrapper_fwd.hpp>
|
||||
#include <boost/variant/detail/move.hpp>
|
||||
|
||||
#if !defined(BOOST_NO_USING_DECLARATION_OVERLOADS_FROM_TYPENAME_BASE)
|
||||
# include <boost/mpl/aux_/value_wknd.hpp>
|
||||
# include <boost/mpl/int.hpp>
|
||||
# include <boost/mpl/iter_fold.hpp>
|
||||
# include <boost/mpl/next.hpp>
|
||||
# include <boost/mpl/deref.hpp>
|
||||
# include <boost/mpl/pair.hpp>
|
||||
# include <boost/mpl/protect.hpp>
|
||||
#else
|
||||
# include <boost/variant/variant_fwd.hpp>
|
||||
# include <boost/preprocessor/cat.hpp>
|
||||
# include <boost/preprocessor/enum.hpp>
|
||||
# include <boost/preprocessor/repeat.hpp>
|
||||
#endif
|
||||
|
||||
namespace boost {
|
||||
namespace detail { namespace variant {
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// (detail) support to simulate standard overload resolution rules
|
||||
//
|
||||
// The below initializers allows variant to follow standard overload
|
||||
// resolution rules over the specified set of bounded types.
|
||||
//
|
||||
// On compilers where using declarations in class templates can correctly
|
||||
// avoid name hiding, use an optimal solution based on the variant's typelist.
|
||||
//
|
||||
// Otherwise, use a preprocessor workaround based on knowledge of the fixed
|
||||
// size of the variant's psuedo-variadic template parameter list.
|
||||
//
|
||||
|
||||
#if !defined(BOOST_NO_USING_DECLARATION_OVERLOADS_FROM_TYPENAME_BASE)
|
||||
|
||||
// (detail) quoted metafunction make_initializer_node
|
||||
//
|
||||
// Exposes a pair whose first type is a node in the initializer hierarchy.
|
||||
//
|
||||
struct make_initializer_node
|
||||
{
|
||||
template <typename BaseIndexPair, typename Iterator>
|
||||
struct apply
|
||||
{
|
||||
private: // helpers, for metafunction result (below)
|
||||
|
||||
typedef typename BaseIndexPair::first
|
||||
base;
|
||||
typedef typename BaseIndexPair::second
|
||||
index;
|
||||
|
||||
class initializer_node
|
||||
: public base
|
||||
{
|
||||
private: // helpers, for static functions (below)
|
||||
|
||||
typedef typename mpl::deref<Iterator>::type
|
||||
recursive_enabled_T;
|
||||
typedef typename unwrap_recursive<recursive_enabled_T>::type
|
||||
public_T;
|
||||
|
||||
#ifndef BOOST_NO_CXX11_RVALUE_REFERENCES
|
||||
typedef boost::is_reference<public_T>
|
||||
is_reference_content_t;
|
||||
|
||||
typedef typename boost::mpl::if_<is_reference_content_t, public_T, const public_T& >::type
|
||||
param_T;
|
||||
|
||||
template <class T> struct disable_overload{};
|
||||
|
||||
typedef typename boost::mpl::if_<is_reference_content_t, disable_overload<public_T>, public_T&& >::type
|
||||
param2_T;
|
||||
#else
|
||||
typedef typename call_traits<public_T>::param_type
|
||||
param_T;
|
||||
#endif
|
||||
|
||||
public: // static functions
|
||||
|
||||
using base::initialize;
|
||||
|
||||
static int initialize(void* dest, param_T operand)
|
||||
{
|
||||
typedef typename boost::detail::make_reference_content<
|
||||
recursive_enabled_T
|
||||
>::type internal_T;
|
||||
|
||||
new(dest) internal_T(operand);
|
||||
return BOOST_MPL_AUX_VALUE_WKND(index)::value; // which
|
||||
}
|
||||
|
||||
#ifndef BOOST_NO_CXX11_RVALUE_REFERENCES
|
||||
static int initialize(void* dest, param2_T operand)
|
||||
{
|
||||
// This assert must newer trigger, because all the reference contents are
|
||||
// handled by the initilize(void* dest, param_T operand) function above
|
||||
BOOST_ASSERT(!is_reference_content_t::value);
|
||||
|
||||
typedef typename boost::mpl::if_<is_reference_content_t, param2_T, recursive_enabled_T>::type value_T;
|
||||
new(dest) value_T( boost::detail::variant::move(operand) );
|
||||
return BOOST_MPL_AUX_VALUE_WKND(index)::value; // which
|
||||
}
|
||||
#endif
|
||||
};
|
||||
|
||||
friend class initializer_node;
|
||||
|
||||
public: // metafunction result
|
||||
|
||||
typedef mpl::pair<
|
||||
initializer_node
|
||||
, typename mpl::next< index >::type
|
||||
> type;
|
||||
|
||||
};
|
||||
};
|
||||
|
||||
// (detail) class initializer_root
|
||||
//
|
||||
// Every level of the initializer hierarchy must expose the name
|
||||
// "initialize," so initializer_root provides a dummy function:
|
||||
//
|
||||
class initializer_root
|
||||
{
|
||||
public: // static functions
|
||||
|
||||
static void initialize();
|
||||
|
||||
};
|
||||
|
||||
#else // defined(BOOST_NO_USING_DECLARATION_OVERLOADS_FROM_TYPENAME_BASE)
|
||||
|
||||
// Obsolete. Remove.
|
||||
#define BOOST_VARIANT_AUX_PP_INITIALIZER_TEMPLATE_PARAMS \
|
||||
BOOST_VARIANT_ENUM_PARAMS(typename recursive_enabled_T) \
|
||||
/**/
|
||||
|
||||
// Obsolete. Remove.
|
||||
#define BOOST_VARIANT_AUX_PP_INITIALIZER_DEFINE_PARAM_T(N) \
|
||||
typedef typename unwrap_recursive< \
|
||||
BOOST_PP_CAT(recursive_enabled_T,N) \
|
||||
>::type BOOST_PP_CAT(public_T,N); \
|
||||
typedef typename call_traits< \
|
||||
BOOST_PP_CAT(public_T,N) \
|
||||
>::param_type BOOST_PP_CAT(param_T,N); \
|
||||
/**/
|
||||
|
||||
template < BOOST_VARIANT_ENUM_PARAMS(typename recursive_enabled_T) >
|
||||
struct preprocessor_list_initializer
|
||||
{
|
||||
public: // static functions
|
||||
|
||||
#define BOOST_VARIANT_AUX_PP_INITIALIZE_FUNCTION(z,N,_) \
|
||||
typedef typename unwrap_recursive< \
|
||||
BOOST_PP_CAT(recursive_enabled_T,N) \
|
||||
>::type BOOST_PP_CAT(public_T,N); \
|
||||
typedef typename call_traits< \
|
||||
BOOST_PP_CAT(public_T,N) \
|
||||
>::param_type BOOST_PP_CAT(param_T,N); \
|
||||
static int initialize( \
|
||||
void* dest \
|
||||
, BOOST_PP_CAT(param_T,N) operand \
|
||||
) \
|
||||
{ \
|
||||
typedef typename boost::detail::make_reference_content< \
|
||||
BOOST_PP_CAT(recursive_enabled_T,N) \
|
||||
>::type internal_T; \
|
||||
\
|
||||
new(dest) internal_T(operand); \
|
||||
return (N); /*which*/ \
|
||||
} \
|
||||
/**/
|
||||
|
||||
BOOST_PP_REPEAT(
|
||||
BOOST_VARIANT_LIMIT_TYPES
|
||||
, BOOST_VARIANT_AUX_PP_INITIALIZE_FUNCTION
|
||||
, _
|
||||
)
|
||||
|
||||
#undef BOOST_VARIANT_AUX_PP_INITIALIZE_FUNCTION
|
||||
|
||||
};
|
||||
|
||||
#endif // BOOST_NO_USING_DECLARATION_OVERLOADS_FROM_TYPENAME_BASE workaround
|
||||
|
||||
}} // namespace detail::variant
|
||||
} // namespace boost
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// macro BOOST_VARIANT_AUX_INITIALIZER_T
|
||||
//
|
||||
// Given both the variant's typelist and a basename for forming the list of
|
||||
// bounded types (i.e., T becomes T1, T2, etc.), exposes the initializer
|
||||
// most appropriate to the current compiler.
|
||||
//
|
||||
|
||||
#if !defined(BOOST_NO_USING_DECLARATION_OVERLOADS_FROM_TYPENAME_BASE)
|
||||
|
||||
#define BOOST_VARIANT_AUX_INITIALIZER_T( mpl_seq, typename_base ) \
|
||||
::boost::mpl::iter_fold< \
|
||||
mpl_seq \
|
||||
, ::boost::mpl::pair< \
|
||||
::boost::detail::variant::initializer_root \
|
||||
, ::boost::mpl::int_<0> \
|
||||
> \
|
||||
, ::boost::mpl::protect< \
|
||||
::boost::detail::variant::make_initializer_node \
|
||||
> \
|
||||
>::type::first \
|
||||
/**/
|
||||
|
||||
#else // defined(BOOST_NO_USING_DECLARATION_OVERLOADS_FROM_TYPENAME_BASE)
|
||||
|
||||
// Obsolete. Remove.
|
||||
#define BOOST_VARIANT_AUX_PP_INITIALIZER_TEMPLATE_ARGS(typename_base) \
|
||||
BOOST_VARIANT_ENUM_PARAMS(typename_base) \
|
||||
/**/
|
||||
|
||||
#define BOOST_VARIANT_AUX_INITIALIZER_T( mpl_seq, typename_base ) \
|
||||
::boost::detail::variant::preprocessor_list_initializer< \
|
||||
BOOST_VARIANT_ENUM_PARAMS(typename_base) \
|
||||
> \
|
||||
/**/
|
||||
|
||||
#endif // BOOST_NO_USING_DECLARATION_OVERLOADS_FROM_TYPENAME_BASE workaround
|
||||
|
||||
#endif // BOOST_VARIANT_DETAIL_INITIALIZER_HPP
|
||||
@@ -0,0 +1,76 @@
|
||||
//---------------------------------------------------------------------------//
|
||||
// Copyright (c) 2013 Kyle Lutz <kyle.r.lutz@gmail.com>
|
||||
//
|
||||
// Distributed under the Boost Software License, Version 1.0
|
||||
// See accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt
|
||||
//
|
||||
// See http://boostorg.github.com/compute for more information.
|
||||
//---------------------------------------------------------------------------//
|
||||
|
||||
#ifndef BOOST_COMPUTE_FUNCTIONAL_GET_HPP
|
||||
#define BOOST_COMPUTE_FUNCTIONAL_GET_HPP
|
||||
|
||||
#include <cstddef>
|
||||
|
||||
#include <boost/compute/types/fundamental.hpp>
|
||||
#include <boost/compute/type_traits/scalar_type.hpp>
|
||||
|
||||
namespace boost {
|
||||
namespace compute {
|
||||
namespace detail {
|
||||
|
||||
// meta-function returning the result type for get<N>()
|
||||
template<size_t N, class Arg>
|
||||
struct get_result_type
|
||||
{
|
||||
typedef typename scalar_type<Arg>::type type;
|
||||
};
|
||||
|
||||
template<size_t N, class Arg, class T>
|
||||
struct invoked_get
|
||||
{
|
||||
typedef typename get_result_type<N, T>::type result_type;
|
||||
|
||||
invoked_get(const Arg &arg)
|
||||
: m_arg(arg)
|
||||
{
|
||||
}
|
||||
|
||||
Arg m_arg;
|
||||
};
|
||||
|
||||
} // end detail namespace
|
||||
|
||||
/// Returns the \c N'th element of an aggregate type (e.g. scalarN,
|
||||
/// pair, tuple, etc.).
|
||||
///
|
||||
/// \see \ref field "field<T>"
|
||||
template<size_t N>
|
||||
struct get
|
||||
{
|
||||
/// \internal_
|
||||
template<class> struct result;
|
||||
|
||||
/// \internal_
|
||||
template<class F, class Arg>
|
||||
struct result<F(Arg)>
|
||||
{
|
||||
typedef typename detail::get_result_type<N, Arg>::type type;
|
||||
};
|
||||
|
||||
template<class Arg>
|
||||
detail::invoked_get<
|
||||
N, Arg, typename boost::remove_cv<typename Arg::result_type>::type
|
||||
> operator()(const Arg &arg) const
|
||||
{
|
||||
typedef typename boost::remove_cv<typename Arg::result_type>::type T;
|
||||
|
||||
return detail::invoked_get<N, Arg, T>(arg);
|
||||
}
|
||||
};
|
||||
|
||||
} // end compute namespace
|
||||
} // end boost namespace
|
||||
|
||||
#endif // BOOST_COMPUTE_FUNCTIONAL_GET_HPP
|
||||
@@ -0,0 +1,496 @@
|
||||
// (C) Copyright John Maddock 2007.
|
||||
// Use, modification and distribution are subject to the
|
||||
// Boost Software License, Version 1.0. (See accompanying file
|
||||
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
//
|
||||
// This file is machine generated, do not edit by hand
|
||||
|
||||
// Unrolled polynomial evaluation using second order Horners rule
|
||||
#ifndef BOOST_MATH_TOOLS_POLY_EVAL_20_HPP
|
||||
#define BOOST_MATH_TOOLS_POLY_EVAL_20_HPP
|
||||
|
||||
namespace boost{ namespace math{ namespace tools{ namespace detail{
|
||||
|
||||
template <class T, class V>
|
||||
inline V evaluate_polynomial_c_imp(const T*, const V&, const mpl::int_<0>*) BOOST_MATH_NOEXCEPT(V)
|
||||
{
|
||||
return static_cast<V>(0);
|
||||
}
|
||||
|
||||
template <class T, class V>
|
||||
inline V evaluate_polynomial_c_imp(const T* a, const V&, const mpl::int_<1>*) BOOST_MATH_NOEXCEPT(V)
|
||||
{
|
||||
return static_cast<V>(a[0]);
|
||||
}
|
||||
|
||||
template <class T, class V>
|
||||
inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<2>*) BOOST_MATH_NOEXCEPT(V)
|
||||
{
|
||||
return static_cast<V>(a[1] * x + a[0]);
|
||||
}
|
||||
|
||||
template <class T, class V>
|
||||
inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<3>*) BOOST_MATH_NOEXCEPT(V)
|
||||
{
|
||||
return static_cast<V>((a[2] * x + a[1]) * x + a[0]);
|
||||
}
|
||||
|
||||
template <class T, class V>
|
||||
inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<4>*) BOOST_MATH_NOEXCEPT(V)
|
||||
{
|
||||
return static_cast<V>(((a[3] * x + a[2]) * x + a[1]) * x + a[0]);
|
||||
}
|
||||
|
||||
template <class T, class V>
|
||||
inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<5>*) BOOST_MATH_NOEXCEPT(V)
|
||||
{
|
||||
V x2 = x * x;
|
||||
V t[2];
|
||||
t[0] = static_cast<V>(a[4] * x2 + a[2]);
|
||||
t[1] = static_cast<V>(a[3] * x2 + a[1]);
|
||||
t[0] *= x2;
|
||||
t[0] += static_cast<V>(a[0]);
|
||||
t[1] *= x;
|
||||
return t[0] + t[1];
|
||||
}
|
||||
|
||||
template <class T, class V>
|
||||
inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<6>*) BOOST_MATH_NOEXCEPT(V)
|
||||
{
|
||||
V x2 = x * x;
|
||||
V t[2];
|
||||
t[0] = a[5] * x2 + a[3];
|
||||
t[1] = a[4] * x2 + a[2];
|
||||
t[0] *= x2;
|
||||
t[1] *= x2;
|
||||
t[0] += static_cast<V>(a[1]);
|
||||
t[1] += static_cast<V>(a[0]);
|
||||
t[0] *= x;
|
||||
return t[0] + t[1];
|
||||
}
|
||||
|
||||
template <class T, class V>
|
||||
inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<7>*) BOOST_MATH_NOEXCEPT(V)
|
||||
{
|
||||
V x2 = x * x;
|
||||
V t[2];
|
||||
t[0] = static_cast<V>(a[6] * x2 + a[4]);
|
||||
t[1] = static_cast<V>(a[5] * x2 + a[3]);
|
||||
t[0] *= x2;
|
||||
t[1] *= x2;
|
||||
t[0] += static_cast<V>(a[2]);
|
||||
t[1] += static_cast<V>(a[1]);
|
||||
t[0] *= x2;
|
||||
t[0] += static_cast<V>(a[0]);
|
||||
t[1] *= x;
|
||||
return t[0] + t[1];
|
||||
}
|
||||
|
||||
template <class T, class V>
|
||||
inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<8>*) BOOST_MATH_NOEXCEPT(V)
|
||||
{
|
||||
V x2 = x * x;
|
||||
V t[2];
|
||||
t[0] = a[7] * x2 + a[5];
|
||||
t[1] = a[6] * x2 + a[4];
|
||||
t[0] *= x2;
|
||||
t[1] *= x2;
|
||||
t[0] += static_cast<V>(a[3]);
|
||||
t[1] += static_cast<V>(a[2]);
|
||||
t[0] *= x2;
|
||||
t[1] *= x2;
|
||||
t[0] += static_cast<V>(a[1]);
|
||||
t[1] += static_cast<V>(a[0]);
|
||||
t[0] *= x;
|
||||
return t[0] + t[1];
|
||||
}
|
||||
|
||||
template <class T, class V>
|
||||
inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<9>*) BOOST_MATH_NOEXCEPT(V)
|
||||
{
|
||||
V x2 = x * x;
|
||||
V t[2];
|
||||
t[0] = static_cast<V>(a[8] * x2 + a[6]);
|
||||
t[1] = static_cast<V>(a[7] * x2 + a[5]);
|
||||
t[0] *= x2;
|
||||
t[1] *= x2;
|
||||
t[0] += static_cast<V>(a[4]);
|
||||
t[1] += static_cast<V>(a[3]);
|
||||
t[0] *= x2;
|
||||
t[1] *= x2;
|
||||
t[0] += static_cast<V>(a[2]);
|
||||
t[1] += static_cast<V>(a[1]);
|
||||
t[0] *= x2;
|
||||
t[0] += static_cast<V>(a[0]);
|
||||
t[1] *= x;
|
||||
return t[0] + t[1];
|
||||
}
|
||||
|
||||
template <class T, class V>
|
||||
inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<10>*) BOOST_MATH_NOEXCEPT(V)
|
||||
{
|
||||
V x2 = x * x;
|
||||
V t[2];
|
||||
t[0] = a[9] * x2 + a[7];
|
||||
t[1] = a[8] * x2 + a[6];
|
||||
t[0] *= x2;
|
||||
t[1] *= x2;
|
||||
t[0] += static_cast<V>(a[5]);
|
||||
t[1] += static_cast<V>(a[4]);
|
||||
t[0] *= x2;
|
||||
t[1] *= x2;
|
||||
t[0] += static_cast<V>(a[3]);
|
||||
t[1] += static_cast<V>(a[2]);
|
||||
t[0] *= x2;
|
||||
t[1] *= x2;
|
||||
t[0] += static_cast<V>(a[1]);
|
||||
t[1] += static_cast<V>(a[0]);
|
||||
t[0] *= x;
|
||||
return t[0] + t[1];
|
||||
}
|
||||
|
||||
template <class T, class V>
|
||||
inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<11>*) BOOST_MATH_NOEXCEPT(V)
|
||||
{
|
||||
V x2 = x * x;
|
||||
V t[2];
|
||||
t[0] = static_cast<V>(a[10] * x2 + a[8]);
|
||||
t[1] = static_cast<V>(a[9] * x2 + a[7]);
|
||||
t[0] *= x2;
|
||||
t[1] *= x2;
|
||||
t[0] += static_cast<V>(a[6]);
|
||||
t[1] += static_cast<V>(a[5]);
|
||||
t[0] *= x2;
|
||||
t[1] *= x2;
|
||||
t[0] += static_cast<V>(a[4]);
|
||||
t[1] += static_cast<V>(a[3]);
|
||||
t[0] *= x2;
|
||||
t[1] *= x2;
|
||||
t[0] += static_cast<V>(a[2]);
|
||||
t[1] += static_cast<V>(a[1]);
|
||||
t[0] *= x2;
|
||||
t[0] += static_cast<V>(a[0]);
|
||||
t[1] *= x;
|
||||
return t[0] + t[1];
|
||||
}
|
||||
|
||||
template <class T, class V>
|
||||
inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<12>*) BOOST_MATH_NOEXCEPT(V)
|
||||
{
|
||||
V x2 = x * x;
|
||||
V t[2];
|
||||
t[0] = a[11] * x2 + a[9];
|
||||
t[1] = a[10] * x2 + a[8];
|
||||
t[0] *= x2;
|
||||
t[1] *= x2;
|
||||
t[0] += static_cast<V>(a[7]);
|
||||
t[1] += static_cast<V>(a[6]);
|
||||
t[0] *= x2;
|
||||
t[1] *= x2;
|
||||
t[0] += static_cast<V>(a[5]);
|
||||
t[1] += static_cast<V>(a[4]);
|
||||
t[0] *= x2;
|
||||
t[1] *= x2;
|
||||
t[0] += static_cast<V>(a[3]);
|
||||
t[1] += static_cast<V>(a[2]);
|
||||
t[0] *= x2;
|
||||
t[1] *= x2;
|
||||
t[0] += static_cast<V>(a[1]);
|
||||
t[1] += static_cast<V>(a[0]);
|
||||
t[0] *= x;
|
||||
return t[0] + t[1];
|
||||
}
|
||||
|
||||
template <class T, class V>
|
||||
inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<13>*) BOOST_MATH_NOEXCEPT(V)
|
||||
{
|
||||
V x2 = x * x;
|
||||
V t[2];
|
||||
t[0] = static_cast<V>(a[12] * x2 + a[10]);
|
||||
t[1] = static_cast<V>(a[11] * x2 + a[9]);
|
||||
t[0] *= x2;
|
||||
t[1] *= x2;
|
||||
t[0] += static_cast<V>(a[8]);
|
||||
t[1] += static_cast<V>(a[7]);
|
||||
t[0] *= x2;
|
||||
t[1] *= x2;
|
||||
t[0] += static_cast<V>(a[6]);
|
||||
t[1] += static_cast<V>(a[5]);
|
||||
t[0] *= x2;
|
||||
t[1] *= x2;
|
||||
t[0] += static_cast<V>(a[4]);
|
||||
t[1] += static_cast<V>(a[3]);
|
||||
t[0] *= x2;
|
||||
t[1] *= x2;
|
||||
t[0] += static_cast<V>(a[2]);
|
||||
t[1] += static_cast<V>(a[1]);
|
||||
t[0] *= x2;
|
||||
t[0] += static_cast<V>(a[0]);
|
||||
t[1] *= x;
|
||||
return t[0] + t[1];
|
||||
}
|
||||
|
||||
template <class T, class V>
|
||||
inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<14>*) BOOST_MATH_NOEXCEPT(V)
|
||||
{
|
||||
V x2 = x * x;
|
||||
V t[2];
|
||||
t[0] = a[13] * x2 + a[11];
|
||||
t[1] = a[12] * x2 + a[10];
|
||||
t[0] *= x2;
|
||||
t[1] *= x2;
|
||||
t[0] += static_cast<V>(a[9]);
|
||||
t[1] += static_cast<V>(a[8]);
|
||||
t[0] *= x2;
|
||||
t[1] *= x2;
|
||||
t[0] += static_cast<V>(a[7]);
|
||||
t[1] += static_cast<V>(a[6]);
|
||||
t[0] *= x2;
|
||||
t[1] *= x2;
|
||||
t[0] += static_cast<V>(a[5]);
|
||||
t[1] += static_cast<V>(a[4]);
|
||||
t[0] *= x2;
|
||||
t[1] *= x2;
|
||||
t[0] += static_cast<V>(a[3]);
|
||||
t[1] += static_cast<V>(a[2]);
|
||||
t[0] *= x2;
|
||||
t[1] *= x2;
|
||||
t[0] += static_cast<V>(a[1]);
|
||||
t[1] += static_cast<V>(a[0]);
|
||||
t[0] *= x;
|
||||
return t[0] + t[1];
|
||||
}
|
||||
|
||||
template <class T, class V>
|
||||
inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<15>*) BOOST_MATH_NOEXCEPT(V)
|
||||
{
|
||||
V x2 = x * x;
|
||||
V t[2];
|
||||
t[0] = static_cast<V>(a[14] * x2 + a[12]);
|
||||
t[1] = static_cast<V>(a[13] * x2 + a[11]);
|
||||
t[0] *= x2;
|
||||
t[1] *= x2;
|
||||
t[0] += static_cast<V>(a[10]);
|
||||
t[1] += static_cast<V>(a[9]);
|
||||
t[0] *= x2;
|
||||
t[1] *= x2;
|
||||
t[0] += static_cast<V>(a[8]);
|
||||
t[1] += static_cast<V>(a[7]);
|
||||
t[0] *= x2;
|
||||
t[1] *= x2;
|
||||
t[0] += static_cast<V>(a[6]);
|
||||
t[1] += static_cast<V>(a[5]);
|
||||
t[0] *= x2;
|
||||
t[1] *= x2;
|
||||
t[0] += static_cast<V>(a[4]);
|
||||
t[1] += static_cast<V>(a[3]);
|
||||
t[0] *= x2;
|
||||
t[1] *= x2;
|
||||
t[0] += static_cast<V>(a[2]);
|
||||
t[1] += static_cast<V>(a[1]);
|
||||
t[0] *= x2;
|
||||
t[0] += static_cast<V>(a[0]);
|
||||
t[1] *= x;
|
||||
return t[0] + t[1];
|
||||
}
|
||||
|
||||
template <class T, class V>
|
||||
inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<16>*) BOOST_MATH_NOEXCEPT(V)
|
||||
{
|
||||
V x2 = x * x;
|
||||
V t[2];
|
||||
t[0] = a[15] * x2 + a[13];
|
||||
t[1] = a[14] * x2 + a[12];
|
||||
t[0] *= x2;
|
||||
t[1] *= x2;
|
||||
t[0] += static_cast<V>(a[11]);
|
||||
t[1] += static_cast<V>(a[10]);
|
||||
t[0] *= x2;
|
||||
t[1] *= x2;
|
||||
t[0] += static_cast<V>(a[9]);
|
||||
t[1] += static_cast<V>(a[8]);
|
||||
t[0] *= x2;
|
||||
t[1] *= x2;
|
||||
t[0] += static_cast<V>(a[7]);
|
||||
t[1] += static_cast<V>(a[6]);
|
||||
t[0] *= x2;
|
||||
t[1] *= x2;
|
||||
t[0] += static_cast<V>(a[5]);
|
||||
t[1] += static_cast<V>(a[4]);
|
||||
t[0] *= x2;
|
||||
t[1] *= x2;
|
||||
t[0] += static_cast<V>(a[3]);
|
||||
t[1] += static_cast<V>(a[2]);
|
||||
t[0] *= x2;
|
||||
t[1] *= x2;
|
||||
t[0] += static_cast<V>(a[1]);
|
||||
t[1] += static_cast<V>(a[0]);
|
||||
t[0] *= x;
|
||||
return t[0] + t[1];
|
||||
}
|
||||
|
||||
template <class T, class V>
|
||||
inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<17>*) BOOST_MATH_NOEXCEPT(V)
|
||||
{
|
||||
V x2 = x * x;
|
||||
V t[2];
|
||||
t[0] = static_cast<V>(a[16] * x2 + a[14]);
|
||||
t[1] = static_cast<V>(a[15] * x2 + a[13]);
|
||||
t[0] *= x2;
|
||||
t[1] *= x2;
|
||||
t[0] += static_cast<V>(a[12]);
|
||||
t[1] += static_cast<V>(a[11]);
|
||||
t[0] *= x2;
|
||||
t[1] *= x2;
|
||||
t[0] += static_cast<V>(a[10]);
|
||||
t[1] += static_cast<V>(a[9]);
|
||||
t[0] *= x2;
|
||||
t[1] *= x2;
|
||||
t[0] += static_cast<V>(a[8]);
|
||||
t[1] += static_cast<V>(a[7]);
|
||||
t[0] *= x2;
|
||||
t[1] *= x2;
|
||||
t[0] += static_cast<V>(a[6]);
|
||||
t[1] += static_cast<V>(a[5]);
|
||||
t[0] *= x2;
|
||||
t[1] *= x2;
|
||||
t[0] += static_cast<V>(a[4]);
|
||||
t[1] += static_cast<V>(a[3]);
|
||||
t[0] *= x2;
|
||||
t[1] *= x2;
|
||||
t[0] += static_cast<V>(a[2]);
|
||||
t[1] += static_cast<V>(a[1]);
|
||||
t[0] *= x2;
|
||||
t[0] += static_cast<V>(a[0]);
|
||||
t[1] *= x;
|
||||
return t[0] + t[1];
|
||||
}
|
||||
|
||||
template <class T, class V>
|
||||
inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<18>*) BOOST_MATH_NOEXCEPT(V)
|
||||
{
|
||||
V x2 = x * x;
|
||||
V t[2];
|
||||
t[0] = a[17] * x2 + a[15];
|
||||
t[1] = a[16] * x2 + a[14];
|
||||
t[0] *= x2;
|
||||
t[1] *= x2;
|
||||
t[0] += static_cast<V>(a[13]);
|
||||
t[1] += static_cast<V>(a[12]);
|
||||
t[0] *= x2;
|
||||
t[1] *= x2;
|
||||
t[0] += static_cast<V>(a[11]);
|
||||
t[1] += static_cast<V>(a[10]);
|
||||
t[0] *= x2;
|
||||
t[1] *= x2;
|
||||
t[0] += static_cast<V>(a[9]);
|
||||
t[1] += static_cast<V>(a[8]);
|
||||
t[0] *= x2;
|
||||
t[1] *= x2;
|
||||
t[0] += static_cast<V>(a[7]);
|
||||
t[1] += static_cast<V>(a[6]);
|
||||
t[0] *= x2;
|
||||
t[1] *= x2;
|
||||
t[0] += static_cast<V>(a[5]);
|
||||
t[1] += static_cast<V>(a[4]);
|
||||
t[0] *= x2;
|
||||
t[1] *= x2;
|
||||
t[0] += static_cast<V>(a[3]);
|
||||
t[1] += static_cast<V>(a[2]);
|
||||
t[0] *= x2;
|
||||
t[1] *= x2;
|
||||
t[0] += static_cast<V>(a[1]);
|
||||
t[1] += static_cast<V>(a[0]);
|
||||
t[0] *= x;
|
||||
return t[0] + t[1];
|
||||
}
|
||||
|
||||
template <class T, class V>
|
||||
inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<19>*) BOOST_MATH_NOEXCEPT(V)
|
||||
{
|
||||
V x2 = x * x;
|
||||
V t[2];
|
||||
t[0] = static_cast<V>(a[18] * x2 + a[16]);
|
||||
t[1] = static_cast<V>(a[17] * x2 + a[15]);
|
||||
t[0] *= x2;
|
||||
t[1] *= x2;
|
||||
t[0] += static_cast<V>(a[14]);
|
||||
t[1] += static_cast<V>(a[13]);
|
||||
t[0] *= x2;
|
||||
t[1] *= x2;
|
||||
t[0] += static_cast<V>(a[12]);
|
||||
t[1] += static_cast<V>(a[11]);
|
||||
t[0] *= x2;
|
||||
t[1] *= x2;
|
||||
t[0] += static_cast<V>(a[10]);
|
||||
t[1] += static_cast<V>(a[9]);
|
||||
t[0] *= x2;
|
||||
t[1] *= x2;
|
||||
t[0] += static_cast<V>(a[8]);
|
||||
t[1] += static_cast<V>(a[7]);
|
||||
t[0] *= x2;
|
||||
t[1] *= x2;
|
||||
t[0] += static_cast<V>(a[6]);
|
||||
t[1] += static_cast<V>(a[5]);
|
||||
t[0] *= x2;
|
||||
t[1] *= x2;
|
||||
t[0] += static_cast<V>(a[4]);
|
||||
t[1] += static_cast<V>(a[3]);
|
||||
t[0] *= x2;
|
||||
t[1] *= x2;
|
||||
t[0] += static_cast<V>(a[2]);
|
||||
t[1] += static_cast<V>(a[1]);
|
||||
t[0] *= x2;
|
||||
t[0] += static_cast<V>(a[0]);
|
||||
t[1] *= x;
|
||||
return t[0] + t[1];
|
||||
}
|
||||
|
||||
template <class T, class V>
|
||||
inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<20>*) BOOST_MATH_NOEXCEPT(V)
|
||||
{
|
||||
V x2 = x * x;
|
||||
V t[2];
|
||||
t[0] = a[19] * x2 + a[17];
|
||||
t[1] = a[18] * x2 + a[16];
|
||||
t[0] *= x2;
|
||||
t[1] *= x2;
|
||||
t[0] += static_cast<V>(a[15]);
|
||||
t[1] += static_cast<V>(a[14]);
|
||||
t[0] *= x2;
|
||||
t[1] *= x2;
|
||||
t[0] += static_cast<V>(a[13]);
|
||||
t[1] += static_cast<V>(a[12]);
|
||||
t[0] *= x2;
|
||||
t[1] *= x2;
|
||||
t[0] += static_cast<V>(a[11]);
|
||||
t[1] += static_cast<V>(a[10]);
|
||||
t[0] *= x2;
|
||||
t[1] *= x2;
|
||||
t[0] += static_cast<V>(a[9]);
|
||||
t[1] += static_cast<V>(a[8]);
|
||||
t[0] *= x2;
|
||||
t[1] *= x2;
|
||||
t[0] += static_cast<V>(a[7]);
|
||||
t[1] += static_cast<V>(a[6]);
|
||||
t[0] *= x2;
|
||||
t[1] *= x2;
|
||||
t[0] += static_cast<V>(a[5]);
|
||||
t[1] += static_cast<V>(a[4]);
|
||||
t[0] *= x2;
|
||||
t[1] *= x2;
|
||||
t[0] += static_cast<V>(a[3]);
|
||||
t[1] += static_cast<V>(a[2]);
|
||||
t[0] *= x2;
|
||||
t[1] *= x2;
|
||||
t[0] += static_cast<V>(a[1]);
|
||||
t[1] += static_cast<V>(a[0]);
|
||||
t[0] *= x;
|
||||
return t[0] + t[1];
|
||||
}
|
||||
|
||||
|
||||
}}}} // namespaces
|
||||
|
||||
#endif // include guard
|
||||
|
||||
@@ -0,0 +1,14 @@
|
||||
# gnuplot script for "ntrials_vs_nhard" figure
|
||||
# run: gnuplot fig_ntrials_vs_nhard.gnuplot
|
||||
# then: pdflatex fig_ntrials_vs_nhard.tex
|
||||
#
|
||||
set term epslatex standalone size 6in,2*6/3in
|
||||
set output "fig_ntrials_vs_nhard.tex"
|
||||
set xlabel "Errors in received word, $X$"
|
||||
set ylabel "Number of trials"
|
||||
set tics in
|
||||
set mxtics 5
|
||||
set mytics 10
|
||||
#set grid
|
||||
set logscale y
|
||||
plot "stats-100000-24db-3.dat" using 1:4 pt 12 notitle
|
||||
@@ -0,0 +1,88 @@
|
||||
subroutine symspec2(c5,nz3,nsps8,nspsd,fsample,freq,drift,snrdb,schk, &
|
||||
i1SoftSymbolsScrambled)
|
||||
|
||||
! Compute soft symbols from the final downsampled data
|
||||
|
||||
complex c5(0:4096-1)
|
||||
complex z
|
||||
integer*1 i1SoftSymbolsScrambled(207)
|
||||
real aa(3)
|
||||
real ss2(0:8,85)
|
||||
real ss3(0:7,69)
|
||||
include 'jt9sync.f90'
|
||||
data scale/10.0/
|
||||
|
||||
aa(1)=-1500.0/nsps8
|
||||
aa(2)=0.
|
||||
aa(3)=0.
|
||||
do i=0,8 !Loop over the 9 tones
|
||||
if(i.ge.1) call twkfreq(c5,c5,nz3,fsample,aa)
|
||||
m=0
|
||||
k=-1
|
||||
do j=1,85 !Loop over all symbols
|
||||
z=0.
|
||||
do n=1,nspsd !Sum over 16 samples
|
||||
k=k+1
|
||||
z=z+c5(k)
|
||||
enddo
|
||||
ss2(i,j)=real(z)**2 + aimag(z)**2 !Symbol speactra, data and sync
|
||||
if(i.ge.1 .and. isync(j).eq.0) then
|
||||
m=m+1
|
||||
ss3(i-1,m)=ss2(i,j) !Symbol speactra, data only
|
||||
endif
|
||||
enddo
|
||||
enddo
|
||||
|
||||
call chkss2(ss2,freq,drift,schk)
|
||||
|
||||
ss=0.
|
||||
sig=0.
|
||||
do j=1,69
|
||||
smax=0.
|
||||
do i=0,7
|
||||
smax=max(smax,ss3(i,j))
|
||||
ss=ss+ss3(i,j)
|
||||
enddo
|
||||
sig=sig+smax
|
||||
ss=ss-smax
|
||||
enddo
|
||||
ave=ss/(69*7) !Baseline
|
||||
call pctile(ss2,9*85,35,xmed)
|
||||
ss3=ss3/ave
|
||||
sig=sig/69. !Signal
|
||||
t=max(1.0,sig - 1.0)
|
||||
snrdb=db(t) - 61.3
|
||||
|
||||
m0=3
|
||||
k=0
|
||||
do j=1,69
|
||||
smax=0.
|
||||
do i=0,7
|
||||
if(ss3(i,j).gt.smax) smax=ss3(i,j)
|
||||
enddo
|
||||
|
||||
do m=m0-1,0,-1 !Get bit-wise soft symbols
|
||||
if(m.eq.2) then
|
||||
r1=max(ss3(4,j),ss3(5,j),ss3(6,j),ss3(7,j))
|
||||
r0=max(ss3(0,j),ss3(1,j),ss3(2,j),ss3(3,j))
|
||||
else if(m.eq.1) then
|
||||
r1=max(ss3(2,j),ss3(3,j),ss3(4,j),ss3(5,j))
|
||||
r0=max(ss3(0,j),ss3(1,j),ss3(6,j),ss3(7,j))
|
||||
else
|
||||
r1=max(ss3(1,j),ss3(2,j),ss3(4,j),ss3(7,j))
|
||||
r0=max(ss3(0,j),ss3(3,j),ss3(5,j),ss3(6,j))
|
||||
endif
|
||||
|
||||
k=k+1
|
||||
i4=nint(scale*(r1-r0))
|
||||
if(i4.lt.-127) i4=-127
|
||||
if(i4.gt.127) i4=127
|
||||
! i4=i4+128
|
||||
! if(i4.le.127) i1SoftSymbolsScrambled(k)=i4
|
||||
! if(i4.ge.128) i1SoftSymbolsScrambled(k)=i4-256
|
||||
i1SoftSymbolsScrambled(k)=i4
|
||||
enddo
|
||||
enddo
|
||||
|
||||
return
|
||||
end subroutine symspec2
|
||||
@@ -0,0 +1,47 @@
|
||||
/*=============================================================================
|
||||
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(BOOST_FUSION_BEGIN_IMPL_31122005_1209)
|
||||
#define BOOST_FUSION_BEGIN_IMPL_31122005_1209
|
||||
|
||||
#include <boost/fusion/support/config.hpp>
|
||||
#include <boost/fusion/adapted/mpl/mpl_iterator.hpp>
|
||||
#include <boost/mpl/begin.hpp>
|
||||
#include <boost/type_traits/remove_const.hpp>
|
||||
|
||||
namespace boost { namespace fusion {
|
||||
|
||||
struct mpl_sequence_tag;
|
||||
|
||||
namespace extension
|
||||
{
|
||||
template <typename Tag>
|
||||
struct begin_impl;
|
||||
|
||||
template <>
|
||||
struct begin_impl<mpl_sequence_tag>
|
||||
{
|
||||
template <typename Sequence>
|
||||
struct apply
|
||||
{
|
||||
typedef typename mpl::begin<
|
||||
typename remove_const<Sequence>::type
|
||||
>::type iterator;
|
||||
typedef mpl_iterator<iterator> type;
|
||||
|
||||
BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
|
||||
static type
|
||||
call(Sequence)
|
||||
{
|
||||
return type();
|
||||
}
|
||||
};
|
||||
};
|
||||
}
|
||||
}}
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,187 @@
|
||||
// Boost integer_fwd.hpp header file ---------------------------------------//
|
||||
|
||||
// (C) Copyright Dave Abrahams and Daryle Walker 2001. Distributed under the Boost
|
||||
// Software License, Version 1.0. (See accompanying file
|
||||
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
// See http://www.boost.org/libs/integer for documentation.
|
||||
|
||||
#ifndef BOOST_INTEGER_FWD_HPP
|
||||
#define BOOST_INTEGER_FWD_HPP
|
||||
|
||||
#include <climits> // for UCHAR_MAX, etc.
|
||||
#include <cstddef> // for std::size_t
|
||||
|
||||
#include <boost/config.hpp> // for BOOST_NO_INTRINSIC_WCHAR_T
|
||||
#include <boost/limits.hpp> // for std::numeric_limits
|
||||
#include <boost/cstdint.hpp> // For intmax_t
|
||||
|
||||
|
||||
namespace boost
|
||||
{
|
||||
|
||||
#ifdef BOOST_NO_INTEGRAL_INT64_T
|
||||
typedef unsigned long static_log2_argument_type;
|
||||
typedef int static_log2_result_type;
|
||||
typedef long static_min_max_signed_type;
|
||||
typedef unsigned long static_min_max_unsigned_type;
|
||||
#else
|
||||
typedef boost::uintmax_t static_min_max_unsigned_type;
|
||||
typedef boost::intmax_t static_min_max_signed_type;
|
||||
typedef boost::uintmax_t static_log2_argument_type;
|
||||
typedef int static_log2_result_type;
|
||||
#endif
|
||||
|
||||
// From <boost/cstdint.hpp> ------------------------------------------------//
|
||||
|
||||
// Only has typedefs or using statements, with #conditionals
|
||||
|
||||
|
||||
// From <boost/integer_traits.hpp> -----------------------------------------//
|
||||
|
||||
template < class T >
|
||||
class integer_traits;
|
||||
|
||||
template < >
|
||||
class integer_traits< bool >;
|
||||
|
||||
template < >
|
||||
class integer_traits< char >;
|
||||
|
||||
template < >
|
||||
class integer_traits< signed char >;
|
||||
|
||||
template < >
|
||||
class integer_traits< unsigned char >;
|
||||
|
||||
#ifndef BOOST_NO_INTRINSIC_WCHAR_T
|
||||
template < >
|
||||
class integer_traits< wchar_t >;
|
||||
#endif
|
||||
|
||||
template < >
|
||||
class integer_traits< short >;
|
||||
|
||||
template < >
|
||||
class integer_traits< unsigned short >;
|
||||
|
||||
template < >
|
||||
class integer_traits< int >;
|
||||
|
||||
template < >
|
||||
class integer_traits< unsigned int >;
|
||||
|
||||
template < >
|
||||
class integer_traits< long >;
|
||||
|
||||
template < >
|
||||
class integer_traits< unsigned long >;
|
||||
|
||||
#if !defined(BOOST_NO_INTEGRAL_INT64_T) && !defined(BOOST_NO_INT64_T) && defined(BOOST_HAS_LONG_LONG)
|
||||
template < >
|
||||
class integer_traits< ::boost::long_long_type>;
|
||||
|
||||
template < >
|
||||
class integer_traits< ::boost::ulong_long_type >;
|
||||
#elif !defined(BOOST_NO_INTEGRAL_INT64_T) && !defined(BOOST_NO_INT64_T) && defined(BOOST_HAS_MS_INT64)
|
||||
template < >
|
||||
class integer_traits<__int64>;
|
||||
|
||||
template < >
|
||||
class integer_traits<unsigned __int64>;
|
||||
#endif
|
||||
|
||||
|
||||
// From <boost/integer.hpp> ------------------------------------------------//
|
||||
|
||||
template < typename LeastInt >
|
||||
struct int_fast_t;
|
||||
|
||||
template< int Bits >
|
||||
struct int_t;
|
||||
|
||||
template< int Bits >
|
||||
struct uint_t;
|
||||
|
||||
#if !defined(BOOST_NO_INTEGRAL_INT64_T) && defined(BOOST_HAS_LONG_LONG)
|
||||
template< boost::long_long_type MaxValue > // maximum value to require support
|
||||
#else
|
||||
template< long MaxValue > // maximum value to require support
|
||||
#endif
|
||||
struct int_max_value_t;
|
||||
|
||||
#if !defined(BOOST_NO_INTEGRAL_INT64_T) && defined(BOOST_HAS_LONG_LONG)
|
||||
template< boost::long_long_type MinValue > // minimum value to require support
|
||||
#else
|
||||
template< long MinValue > // minimum value to require support
|
||||
#endif
|
||||
struct int_min_value_t;
|
||||
|
||||
#if !defined(BOOST_NO_INTEGRAL_INT64_T) && defined(BOOST_HAS_LONG_LONG)
|
||||
template< boost::ulong_long_type MaxValue > // maximum value to require support
|
||||
#else
|
||||
template< unsigned long MaxValue > // maximum value to require support
|
||||
#endif
|
||||
struct uint_value_t;
|
||||
|
||||
|
||||
// From <boost/integer/integer_mask.hpp> -----------------------------------//
|
||||
|
||||
template < std::size_t Bit >
|
||||
struct high_bit_mask_t;
|
||||
|
||||
template < std::size_t Bits >
|
||||
struct low_bits_mask_t;
|
||||
|
||||
template < >
|
||||
struct low_bits_mask_t< ::std::numeric_limits<unsigned char>::digits >;
|
||||
|
||||
// From <boost/integer/static_log2.hpp> ------------------------------------//
|
||||
|
||||
template <static_log2_argument_type Value >
|
||||
struct static_log2;
|
||||
|
||||
template <> struct static_log2<0u>;
|
||||
|
||||
|
||||
// From <boost/integer/static_min_max.hpp> ---------------------------------//
|
||||
|
||||
template <static_min_max_signed_type Value1, static_min_max_signed_type Value2>
|
||||
struct static_signed_min;
|
||||
|
||||
template <static_min_max_signed_type Value1, static_min_max_signed_type Value2>
|
||||
struct static_signed_max;
|
||||
|
||||
template <static_min_max_unsigned_type Value1, static_min_max_unsigned_type Value2>
|
||||
struct static_unsigned_min;
|
||||
|
||||
template <static_min_max_unsigned_type Value1, static_min_max_unsigned_type Value2>
|
||||
struct static_unsigned_max;
|
||||
|
||||
|
||||
// From <boost/integer/common_factor_ct.hpp>
|
||||
|
||||
#ifdef BOOST_NO_INTEGRAL_INT64_T
|
||||
typedef unsigned long static_gcd_type;
|
||||
#else
|
||||
typedef boost::uintmax_t static_gcd_type;
|
||||
#endif
|
||||
|
||||
template < static_gcd_type Value1, static_gcd_type Value2 >
|
||||
struct static_gcd;
|
||||
template < static_gcd_type Value1, static_gcd_type Value2 >
|
||||
struct static_lcm;
|
||||
|
||||
|
||||
// From <boost/integer/common_factor_rt.hpp>
|
||||
|
||||
template < typename IntegerType >
|
||||
class gcd_evaluator;
|
||||
template < typename IntegerType >
|
||||
class lcm_evaluator;
|
||||
|
||||
|
||||
} // namespace boost
|
||||
|
||||
|
||||
#endif // BOOST_INTEGER_FWD_HPP
|
||||
@@ -0,0 +1,34 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 1998-2003 Joel de Guzman
|
||||
Copyright (c) 2001 Daniel Nuffer
|
||||
Copyright (c) 2002 Hartmut Kaiser
|
||||
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_OPTIONAL_IPP)
|
||||
#define BOOST_SPIRIT_OPTIONAL_IPP
|
||||
|
||||
namespace boost { namespace spirit {
|
||||
|
||||
BOOST_SPIRIT_CLASSIC_NAMESPACE_BEGIN
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// optional class implementation
|
||||
//
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
template <typename S>
|
||||
optional<S>
|
||||
operator!(parser<S> const& a)
|
||||
{
|
||||
return optional<S>(a.derived());
|
||||
}
|
||||
|
||||
BOOST_SPIRIT_CLASSIC_NAMESPACE_END
|
||||
|
||||
}} // namespace boost::spirit
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,67 @@
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
/// \file construct_funop.hpp
|
||||
/// Overloads of construct_\<\>::operator().
|
||||
//
|
||||
// Copyright 2008 Eric Niebler. Distributed under the Boost
|
||||
// Software License, Version 1.0. (See accompanying file
|
||||
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
template<typename A0>
|
||||
BOOST_FORCEINLINE
|
||||
Type operator ()(A0 &a0) const
|
||||
{
|
||||
return Type(a0);
|
||||
}
|
||||
template<typename A0 , typename A1>
|
||||
BOOST_FORCEINLINE
|
||||
Type operator ()(A0 &a0 , A1 &a1) const
|
||||
{
|
||||
return Type(a0 , a1);
|
||||
}
|
||||
template<typename A0 , typename A1 , typename A2>
|
||||
BOOST_FORCEINLINE
|
||||
Type operator ()(A0 &a0 , A1 &a1 , A2 &a2) const
|
||||
{
|
||||
return Type(a0 , a1 , a2);
|
||||
}
|
||||
template<typename A0 , typename A1 , typename A2 , typename A3>
|
||||
BOOST_FORCEINLINE
|
||||
Type operator ()(A0 &a0 , A1 &a1 , A2 &a2 , A3 &a3) const
|
||||
{
|
||||
return Type(a0 , a1 , a2 , a3);
|
||||
}
|
||||
template<typename A0 , typename A1 , typename A2 , typename A3 , typename A4>
|
||||
BOOST_FORCEINLINE
|
||||
Type operator ()(A0 &a0 , A1 &a1 , A2 &a2 , A3 &a3 , A4 &a4) const
|
||||
{
|
||||
return Type(a0 , a1 , a2 , a3 , a4);
|
||||
}
|
||||
template<typename A0 , typename A1 , typename A2 , typename A3 , typename A4 , typename A5>
|
||||
BOOST_FORCEINLINE
|
||||
Type operator ()(A0 &a0 , A1 &a1 , A2 &a2 , A3 &a3 , A4 &a4 , A5 &a5) const
|
||||
{
|
||||
return Type(a0 , a1 , a2 , a3 , a4 , a5);
|
||||
}
|
||||
template<typename A0 , typename A1 , typename A2 , typename A3 , typename A4 , typename A5 , typename A6>
|
||||
BOOST_FORCEINLINE
|
||||
Type operator ()(A0 &a0 , A1 &a1 , A2 &a2 , A3 &a3 , A4 &a4 , A5 &a5 , A6 &a6) const
|
||||
{
|
||||
return Type(a0 , a1 , a2 , a3 , a4 , a5 , a6);
|
||||
}
|
||||
template<typename A0 , typename A1 , typename A2 , typename A3 , typename A4 , typename A5 , typename A6 , typename A7>
|
||||
BOOST_FORCEINLINE
|
||||
Type operator ()(A0 &a0 , A1 &a1 , A2 &a2 , A3 &a3 , A4 &a4 , A5 &a5 , A6 &a6 , A7 &a7) const
|
||||
{
|
||||
return Type(a0 , a1 , a2 , a3 , a4 , a5 , a6 , a7);
|
||||
}
|
||||
template<typename A0 , typename A1 , typename A2 , typename A3 , typename A4 , typename A5 , typename A6 , typename A7 , typename A8>
|
||||
BOOST_FORCEINLINE
|
||||
Type operator ()(A0 &a0 , A1 &a1 , A2 &a2 , A3 &a3 , A4 &a4 , A5 &a5 , A6 &a6 , A7 &a7 , A8 &a8) const
|
||||
{
|
||||
return Type(a0 , a1 , a2 , a3 , a4 , a5 , a6 , a7 , a8);
|
||||
}
|
||||
template<typename A0 , typename A1 , typename A2 , typename A3 , typename A4 , typename A5 , typename A6 , typename A7 , typename A8 , typename A9>
|
||||
BOOST_FORCEINLINE
|
||||
Type operator ()(A0 &a0 , A1 &a1 , A2 &a2 , A3 &a3 , A4 &a4 , A5 &a5 , A6 &a6 , A7 &a7 , A8 &a8 , A9 &a9) const
|
||||
{
|
||||
return Type(a0 , a1 , a2 , a3 , a4 , a5 , a6 , a7 , a8 , a9);
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,319 @@
|
||||
#include "Directory.hpp"
|
||||
|
||||
#include <QVariant>
|
||||
#include <QString>
|
||||
#include <QHeaderView>
|
||||
#include <QStringList>
|
||||
#include <QFileInfo>
|
||||
#include <QDir>
|
||||
#include <QNetworkAccessManager>
|
||||
#include <QAuthenticator>
|
||||
#include <QNetworkReply>
|
||||
#include <QTreeWidgetItem>
|
||||
#include <QTreeWidgetItemIterator>
|
||||
#include <QJsonDocument>
|
||||
#include <QJsonParseError>
|
||||
#include <QJsonArray>
|
||||
#include <QJsonObject>
|
||||
#include <QRegularExpression>
|
||||
|
||||
#include "Configuration.hpp"
|
||||
#include "DirectoryNode.hpp"
|
||||
#include "FileNode.hpp"
|
||||
#include "revision_utils.hpp"
|
||||
#include "MessageBox.hpp"
|
||||
|
||||
#include "moc_Directory.cpp"
|
||||
|
||||
namespace
|
||||
{
|
||||
char const * samples_dir_name = "samples";
|
||||
QString const contents_file_name = "contents_" + version (false) + ".json";
|
||||
}
|
||||
|
||||
Directory::Directory (Configuration const * configuration
|
||||
, QNetworkAccessManager * network_manager
|
||||
, QWidget * parent)
|
||||
: QTreeWidget {parent}
|
||||
, configuration_ {configuration}
|
||||
, network_manager_ {network_manager}
|
||||
, http_only_ {false}
|
||||
, root_dir_ {configuration_->save_directory ()}
|
||||
, contents_ {this
|
||||
, network_manager_
|
||||
, QDir {root_dir_.absoluteFilePath (samples_dir_name)}.absoluteFilePath (contents_file_name)}
|
||||
{
|
||||
dir_icon_.addPixmap (style ()->standardPixmap (QStyle::SP_DirClosedIcon), QIcon::Normal, QIcon::Off);
|
||||
dir_icon_.addPixmap (style ()->standardPixmap (QStyle::SP_DirOpenIcon), QIcon::Normal, QIcon::On);
|
||||
file_icon_.addPixmap (style ()->standardPixmap (QStyle::SP_FileIcon));
|
||||
|
||||
setColumnCount (2);
|
||||
setHeaderLabels ({"File", "Progress"});
|
||||
header ()->setSectionResizeMode (QHeaderView::ResizeToContents);
|
||||
setItemDelegate (&item_delegate_);
|
||||
|
||||
connect (network_manager_, &QNetworkAccessManager::authenticationRequired
|
||||
, this, &Directory::authentication);
|
||||
connect (this, &Directory::itemChanged, [this] (QTreeWidgetItem * item) {
|
||||
switch (item->type ())
|
||||
{
|
||||
case FileNode::Type:
|
||||
{
|
||||
FileNode * node = static_cast<FileNode *> (item);
|
||||
if (!node->sync (node->checkState (0) == Qt::Checked))
|
||||
{
|
||||
FileNode::sync_blocker b {node};
|
||||
node->setCheckState (0, node->checkState (0) == Qt::Checked ? Qt::Unchecked : Qt::Checked);
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
bool Directory::url_root (QUrl root)
|
||||
{
|
||||
if (!root.path ().endsWith ('/'))
|
||||
{
|
||||
root.setPath (root.path () + '/');
|
||||
}
|
||||
bool valid = root.isValid ();
|
||||
if (valid)
|
||||
{
|
||||
url_root_ = root;
|
||||
}
|
||||
return valid;
|
||||
}
|
||||
|
||||
void Directory::error (QString const& title, QString const& message)
|
||||
{
|
||||
MessageBox::warning_message (this, title, message);
|
||||
}
|
||||
|
||||
bool Directory::refresh (bool http_only)
|
||||
{
|
||||
abort ();
|
||||
clear ();
|
||||
// update locations
|
||||
root_dir_ = configuration_->save_directory ();
|
||||
QDir contents_dir {root_dir_.absoluteFilePath (samples_dir_name)};
|
||||
contents_.local_file_path (contents_dir.absoluteFilePath (contents_file_name));
|
||||
contents_.http_only (http_only_ = http_only);
|
||||
QUrl url {url_root_.resolved (QDir {root_dir_.relativeFilePath (samples_dir_name)}.filePath (contents_file_name))};
|
||||
if (url.isValid ())
|
||||
{
|
||||
return contents_.sync (url, true, true); // attempt to fetch contents
|
||||
}
|
||||
else
|
||||
{
|
||||
MessageBox::warning_message (this
|
||||
, tr ("URL Error")
|
||||
, tr ("Invalid URL:\n\"%1\"")
|
||||
.arg (url.toDisplayString ()));
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
void Directory::download_finished (bool success)
|
||||
{
|
||||
if (success)
|
||||
{
|
||||
QFile contents {contents_.local_file_path ()};
|
||||
if (contents.open (QFile::ReadOnly | QFile::Text))
|
||||
{
|
||||
QJsonParseError json_status;
|
||||
auto content = QJsonDocument::fromJson (contents.readAll (), &json_status);
|
||||
if (json_status.error)
|
||||
{
|
||||
MessageBox::warning_message (this
|
||||
, tr ("JSON Error")
|
||||
, tr ("Contents file syntax error %1 at character offset %2")
|
||||
.arg (json_status.errorString ()).arg (json_status.offset));
|
||||
return;
|
||||
}
|
||||
if (!content.isArray ())
|
||||
{
|
||||
MessageBox::warning_message (this, tr ("JSON Error")
|
||||
, tr ("Contents file top level must be a JSON array"));
|
||||
return;
|
||||
}
|
||||
QTreeWidgetItem * parent {invisibleRootItem ()};
|
||||
parent = new DirectoryNode {parent, samples_dir_name};
|
||||
parent->setIcon (0, dir_icon_);
|
||||
parent->setExpanded (true);
|
||||
parse_entries (content.array (), root_dir_.relativeFilePath (samples_dir_name), parent);
|
||||
}
|
||||
else
|
||||
{
|
||||
MessageBox::warning_message (this, tr ("File System Error")
|
||||
, tr ("Failed to open \"%1\"\nError: %2 - %3")
|
||||
.arg (contents.fileName ())
|
||||
.arg (contents.error ())
|
||||
.arg (contents.errorString ()));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void Directory::parse_entries (QJsonArray const& entries, QDir const& dir, QTreeWidgetItem * parent)
|
||||
{
|
||||
if (dir.isRelative () && !dir.path ().startsWith ('.'))
|
||||
{
|
||||
for (auto const& value: entries)
|
||||
{
|
||||
if (value.isObject ())
|
||||
{
|
||||
auto const& entry = value.toObject ();
|
||||
auto const& name = entry["name"].toString ();
|
||||
if (name.size () && !name.contains (QRegularExpression {R"([/:;])"}))
|
||||
{
|
||||
auto const& type = entry["type"].toString ();
|
||||
if ("file" == type)
|
||||
{
|
||||
QUrl url {url_root_.resolved (dir.filePath (name))};
|
||||
if (url.isValid ())
|
||||
{
|
||||
auto node = new FileNode {parent, network_manager_
|
||||
, QDir {root_dir_.filePath (dir.path ())}.absoluteFilePath (name)
|
||||
, url, http_only_};
|
||||
FileNode::sync_blocker b {node};
|
||||
node->setIcon (0, file_icon_);
|
||||
node->setCheckState (0, node->local () ? Qt::Checked : Qt::Unchecked);
|
||||
update (parent);
|
||||
}
|
||||
else
|
||||
{
|
||||
MessageBox::warning_message (this
|
||||
, tr ("URL Error")
|
||||
, tr ("Invalid URL:\n\"%1\"")
|
||||
.arg (url.toDisplayString ()));
|
||||
}
|
||||
}
|
||||
else if ("directory" == type)
|
||||
{
|
||||
auto node = new DirectoryNode {parent, name};
|
||||
node->setIcon (0, dir_icon_);
|
||||
auto const& entries = entry["entries"];
|
||||
if (entries.isArray ())
|
||||
{
|
||||
parse_entries (entries.toArray ()
|
||||
, QDir {root_dir_.relativeFilePath (dir.path ())}.filePath (name)
|
||||
, node);
|
||||
}
|
||||
else
|
||||
{
|
||||
MessageBox::warning_message (this, tr ("JSON Error")
|
||||
, tr ("Contents entries must be a JSON array"));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
MessageBox::warning_message (this, tr ("JSON Error")
|
||||
, tr ("Contents entries must have a valid type"));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
MessageBox::warning_message (this, tr ("JSON Error")
|
||||
, tr ("Contents entries must have a valid name"));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
MessageBox::warning_message (this, tr ("JSON Error")
|
||||
, tr ("Contents entries must be JSON objects"));
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
MessageBox::warning_message (this, tr ("JSON Error")
|
||||
, tr ("Contents directories must be relative and within \"%1\"")
|
||||
.arg (samples_dir_name));
|
||||
}
|
||||
}
|
||||
|
||||
void Directory::abort ()
|
||||
{
|
||||
QTreeWidgetItemIterator iter {this};
|
||||
while (*iter)
|
||||
{
|
||||
if ((*iter)->type () == FileNode::Type)
|
||||
{
|
||||
auto * node = static_cast<FileNode *> (*iter);
|
||||
node->abort ();
|
||||
}
|
||||
++iter;
|
||||
}
|
||||
}
|
||||
|
||||
namespace
|
||||
{
|
||||
//
|
||||
// traverse the passed subtree accumulating the number of items, the
|
||||
// number we have size data for, the bytes downloaded so far and the
|
||||
// maximum bytes to expect
|
||||
//
|
||||
int recurse_children (QTreeWidgetItem const * item, int * counted
|
||||
, qint64 * bytes, qint64 * max)
|
||||
{
|
||||
int items {0};
|
||||
for (int index {0}; index < item->childCount (); ++index)
|
||||
{
|
||||
auto const * child = item->child (index);
|
||||
if (child->type () == FileNode::Type) // only count files
|
||||
{
|
||||
++items;
|
||||
if (auto size = child->data (1, Qt::UserRole).toLongLong ())
|
||||
{
|
||||
*max += size;
|
||||
++*counted;
|
||||
}
|
||||
*bytes += child->data (1, Qt::DisplayRole).toLongLong ();
|
||||
}
|
||||
else
|
||||
{
|
||||
// recurse into sub-directory subtrees
|
||||
items += recurse_children (child, counted, bytes, max);
|
||||
}
|
||||
}
|
||||
return items;
|
||||
}
|
||||
}
|
||||
|
||||
void Directory::update (QTreeWidgetItem * item)
|
||||
{
|
||||
// iterate the tree under item and accumulate the progress
|
||||
if (item)
|
||||
{
|
||||
Q_ASSERT (item->type () == DirectoryNode::Type);
|
||||
qint64 max {0};
|
||||
qint64 bytes {0};
|
||||
int counted {0};
|
||||
|
||||
// get the count, progress and size of children
|
||||
int items {recurse_children (item, &counted, &bytes, &max)};
|
||||
|
||||
// estimate size of items not yet downloaded as average of
|
||||
// those actually present
|
||||
if (counted)
|
||||
{
|
||||
max += (items - counted) * max / counted;
|
||||
}
|
||||
|
||||
// save as our progress
|
||||
item->setData (1, Qt::UserRole, max);
|
||||
item->setData (1, Qt::DisplayRole, bytes);
|
||||
|
||||
// recurse up to top
|
||||
update (item->parent ());
|
||||
}
|
||||
}
|
||||
|
||||
void Directory::authentication (QNetworkReply * /* reply */
|
||||
, QAuthenticator * /* authenticator */)
|
||||
{
|
||||
MessageBox::warning_message (this, tr ("Network Error"), tr ("Authentication required"));
|
||||
}
|
||||
@@ -0,0 +1,123 @@
|
||||
subroutine sync8(iwave,nfa,nfb,nfqso,s,candidate,ncand)
|
||||
|
||||
include 'ft8_params.f90'
|
||||
parameter (JZ=35) !DT up to +/- 3 s
|
||||
complex cx(0:NH1)
|
||||
real s(NH1,NHSYM)
|
||||
real savg(NH1)
|
||||
real x(NFFT1)
|
||||
real sync2d(NH1,-JZ:JZ)
|
||||
real red(NH1)
|
||||
real candidate0(3,100)
|
||||
real candidate(3,100)
|
||||
integer*2 iwave(NMAX)
|
||||
integer jpeak(NH1)
|
||||
integer indx(NH1)
|
||||
integer ii(1)
|
||||
integer icos7(0:6)
|
||||
data icos7/2,5,6,0,4,1,3/ !Costas 7x7 tone pattern
|
||||
equivalence (x,cx)
|
||||
|
||||
! Compute symbol spectra at half-symbol steps.
|
||||
savg=0.
|
||||
istep=NSPS/2 !1024
|
||||
tstep=istep/12000.0 !0.085333 s
|
||||
df=12000.0/NFFT1 !2.93 Hz
|
||||
|
||||
! Compute symbol spectra at half-symbol steps
|
||||
fac=1.0/300.0
|
||||
do j=1,NHSYM
|
||||
ia=(j-1)*istep + 1
|
||||
ib=ia+NSPS-1
|
||||
x(1:NSPS)=fac*iwave(ia:ib)
|
||||
x(NSPS+1:)=0.
|
||||
call four2a(x,NFFT1,1,-1,0) !r2c FFT
|
||||
do i=1,NH1
|
||||
s(i,j)=real(cx(i))**2 + aimag(cx(i))**2
|
||||
enddo
|
||||
savg=savg + s(1:NH1,j) !Average spectrum
|
||||
enddo
|
||||
savg=savg/NHSYM
|
||||
|
||||
ia=max(1,nint(nfa/df))
|
||||
ib=nint(nfb/df)
|
||||
do i=ia,ib
|
||||
do j=-JZ,JZ
|
||||
t=0.
|
||||
t0=0.
|
||||
do n=0,6
|
||||
k=j+2*n
|
||||
if(k.ge.1) then
|
||||
t=t + s(i+2*icos7(n),k)
|
||||
t0=t0 + sum(s(i:i+12:2,k))
|
||||
endif
|
||||
t=t + s(i+2*icos7(n),k+72)
|
||||
t0=t0 + sum(s(i:i+12:2,k+72))
|
||||
if(k+144.le.NHSYM) then
|
||||
t=t + s(i+2*icos7(n),k+144)
|
||||
t0=t0 + sum(s(i:i+12:2,k+144))
|
||||
endif
|
||||
enddo
|
||||
t0=(t0-t)/6.0
|
||||
sync2d(i,j)=t/t0
|
||||
enddo
|
||||
enddo
|
||||
|
||||
red=0.
|
||||
do i=ia,ib
|
||||
ii=maxloc(sync2d(i,-JZ:JZ)) - 1 - JZ
|
||||
j0=ii(1)
|
||||
jpeak(i)=j0
|
||||
red(i)=sync2d(i,j0)
|
||||
! write(52,3052) i*df,red(i),db(red(i))
|
||||
!3052 format(3f12.3)
|
||||
enddo
|
||||
iz=ib-ia+1
|
||||
call indexx(red(ia:ib),iz,indx)
|
||||
ibase=indx(nint(0.40*iz)) - 1 + ia
|
||||
base=red(ibase)
|
||||
red=red/base
|
||||
|
||||
candidate0=0.
|
||||
k=0
|
||||
syncmin=1.5
|
||||
do i=1,100
|
||||
n=ia + indx(iz+1-i) - 1
|
||||
if(red(n).lt.syncmin) exit
|
||||
k=k+1
|
||||
candidate0(1,k)=n*df
|
||||
candidate0(2,k)=(jpeak(n)-1)*tstep
|
||||
candidate0(3,k)=red(n)
|
||||
enddo
|
||||
ncand=min(100,k)
|
||||
|
||||
! Put nfqso at top of list, and save only the best of near-dupe freqs.
|
||||
do i=1,ncand
|
||||
if(abs(candidate0(1,i)-nfqso).lt.10.0) candidate0(1,i)=-candidate0(1,i)
|
||||
if(i.ge.2) then
|
||||
do j=1,i-1
|
||||
fdiff=abs(candidate0(1,i))-abs(candidate0(1,j))
|
||||
if(abs(fdiff).lt.4.0) then
|
||||
if(candidate0(3,i).ge.candidate0(3,j)) candidate0(3,j)=0.
|
||||
if(candidate0(3,i).lt.candidate0(3,j)) candidate0(3,i)=0.
|
||||
endif
|
||||
enddo
|
||||
! write(*,3001) i,candidate0(1,i-1),candidate0(1,i),candidate0(3,i-1), &
|
||||
! candidate0(3,i)
|
||||
!3001 format(i2,4f8.1)
|
||||
endif
|
||||
enddo
|
||||
|
||||
fac=20.0/maxval(s)
|
||||
s=fac*s
|
||||
|
||||
call indexx(candidate0(1,1:ncand),ncand,indx)
|
||||
do i=1,ncand
|
||||
j=indx(i)
|
||||
candidate(1,i)=abs(candidate0(1,j))
|
||||
candidate(2,i)=candidate0(2,j)
|
||||
candidate(3,i)=candidate0(3,j)
|
||||
enddo
|
||||
|
||||
return
|
||||
end subroutine sync8
|
||||
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user