Initial Commit
This commit is contained in:
@@ -0,0 +1,278 @@
|
||||
// Copyright (C) 2004-2006 The Trustees of Indiana University.
|
||||
|
||||
// Use, modification and distribution is subject to the Boost Software
|
||||
// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
// Authors: Douglas Gregor
|
||||
// Andrew Lumsdaine
|
||||
#ifndef BOOST_GRAPH_DISTRIBUTED_QUEUE_HPP
|
||||
#define BOOST_GRAPH_DISTRIBUTED_QUEUE_HPP
|
||||
|
||||
#ifndef BOOST_GRAPH_USE_MPI
|
||||
#error "Parallel BGL files should not be included unless <boost/graph/use_mpi.hpp> has been included"
|
||||
#endif
|
||||
|
||||
#include <boost/graph/parallel/process_group.hpp>
|
||||
#include <boost/optional.hpp>
|
||||
#include <boost/shared_ptr.hpp>
|
||||
#include <vector>
|
||||
|
||||
namespace boost { namespace graph { namespace distributed {
|
||||
|
||||
/// A unary predicate that always returns "true".
|
||||
struct always_push
|
||||
{
|
||||
template<typename T> bool operator()(const T&) const { return true; }
|
||||
};
|
||||
|
||||
|
||||
|
||||
/** A distributed queue adaptor.
|
||||
*
|
||||
* Class template @c distributed_queue implements a distributed queue
|
||||
* across a process group. The distributed queue is an adaptor over an
|
||||
* existing (local) queue, which must model the @ref Buffer
|
||||
* concept. Each process stores a distinct copy of the local queue,
|
||||
* from which it draws or removes elements via the @ref pop and @ref
|
||||
* top members.
|
||||
*
|
||||
* The value type of the local queue must be a model of the @ref
|
||||
* GlobalDescriptor concept. The @ref push operation of the
|
||||
* distributed queue passes (via a message) the value to its owning
|
||||
* processor. Thus, the elements within a particular local queue are
|
||||
* guaranteed to have the process owning that local queue as an owner.
|
||||
*
|
||||
* Synchronization of distributed queues occurs in the @ref empty and
|
||||
* @ref size functions, which will only return "empty" values (true or
|
||||
* 0, respectively) when the entire distributed queue is empty. If the
|
||||
* local queue is empty but the distributed queue is not, the
|
||||
* operation will block until either condition changes. When the @ref
|
||||
* size function of a nonempty queue returns, it returns the size of
|
||||
* the local queue. These semantics were selected so that sequential
|
||||
* code that processes elements in the queue via the following idiom
|
||||
* can be parallelized via introduction of a distributed queue:
|
||||
*
|
||||
* distributed_queue<...> Q;
|
||||
* Q.push(x);
|
||||
* while (!Q.empty()) {
|
||||
* // do something, that may push a value onto Q
|
||||
* }
|
||||
*
|
||||
* In the parallel version, the initial @ref push operation will place
|
||||
* the value @c x onto its owner's queue. All processes will
|
||||
* synchronize at the call to empty, and only the process owning @c x
|
||||
* will be allowed to execute the loop (@ref Q.empty() returns
|
||||
* false). This iteration may in turn push values onto other remote
|
||||
* queues, so when that process finishes execution of the loop body
|
||||
* and all processes synchronize again in @ref empty, more processes
|
||||
* may have nonempty local queues to execute. Once all local queues
|
||||
* are empty, @ref Q.empty() returns @c false for all processes.
|
||||
*
|
||||
* The distributed queue can receive messages at two different times:
|
||||
* during synchronization and when polling @ref empty. Messages are
|
||||
* always received during synchronization, to ensure that accurate
|
||||
* local queue sizes can be determines. However, whether @ref empty
|
||||
* should poll for messages is specified as an option to the
|
||||
* constructor. Polling may be desired when the order in which
|
||||
* elements in the queue are processed is not important, because it
|
||||
* permits fewer synchronization steps and less communication
|
||||
* overhead. However, when more strict ordering guarantees are
|
||||
* required, polling may be semantically incorrect. By disabling
|
||||
* polling, one ensures that parallel execution using the idiom above
|
||||
* will not process an element at a later "level" before an earlier
|
||||
* "level".
|
||||
*
|
||||
* The distributed queue nearly models the @ref Buffer
|
||||
* concept. However, the @ref push routine does not necessarily
|
||||
* increase the result of @c size() by one (although the size of the
|
||||
* global queue does increase by one).
|
||||
*/
|
||||
template<typename ProcessGroup, typename OwnerMap, typename Buffer,
|
||||
typename UnaryPredicate = always_push>
|
||||
class distributed_queue
|
||||
{
|
||||
typedef distributed_queue self_type;
|
||||
|
||||
enum {
|
||||
/** Message indicating a remote push. The message contains a
|
||||
* single value x of type value_type that is to be pushed on the
|
||||
* receiver's queue.
|
||||
*/
|
||||
msg_push,
|
||||
/** Push many elements at once. */
|
||||
msg_multipush
|
||||
};
|
||||
|
||||
public:
|
||||
typedef ProcessGroup process_group_type;
|
||||
typedef Buffer buffer_type;
|
||||
typedef typename buffer_type::value_type value_type;
|
||||
typedef typename buffer_type::size_type size_type;
|
||||
|
||||
/** Construct a new distributed queue.
|
||||
*
|
||||
* Build a new distributed queue that communicates over the given @p
|
||||
* process_group, whose local queue is initialized via @p buffer and
|
||||
* which may or may not poll for messages.
|
||||
*/
|
||||
explicit
|
||||
distributed_queue(const ProcessGroup& process_group,
|
||||
const OwnerMap& owner,
|
||||
const Buffer& buffer,
|
||||
bool polling = false);
|
||||
|
||||
/** Construct a new distributed queue.
|
||||
*
|
||||
* Build a new distributed queue that communicates over the given @p
|
||||
* process_group, whose local queue is initialized via @p buffer and
|
||||
* which may or may not poll for messages.
|
||||
*/
|
||||
explicit
|
||||
distributed_queue(const ProcessGroup& process_group = ProcessGroup(),
|
||||
const OwnerMap& owner = OwnerMap(),
|
||||
const Buffer& buffer = Buffer(),
|
||||
const UnaryPredicate& pred = UnaryPredicate(),
|
||||
bool polling = false);
|
||||
|
||||
/** Construct a new distributed queue.
|
||||
*
|
||||
* Build a new distributed queue that communicates over the given @p
|
||||
* process_group, whose local queue is default-initalized and which
|
||||
* may or may not poll for messages.
|
||||
*/
|
||||
distributed_queue(const ProcessGroup& process_group, const OwnerMap& owner,
|
||||
const UnaryPredicate& pred, bool polling = false);
|
||||
|
||||
/** Virtual destructor required with virtual functions.
|
||||
*
|
||||
*/
|
||||
virtual ~distributed_queue() {}
|
||||
|
||||
/** Push an element onto the distributed queue.
|
||||
*
|
||||
* The element will be sent to its owner process to be added to that
|
||||
* process's local queue. If polling is enabled for this queue and
|
||||
* the owner process is the current process, the value will be
|
||||
* immediately pushed onto the local queue.
|
||||
*
|
||||
* Complexity: O(1) messages of size O(sizeof(value_type)) will be
|
||||
* transmitted.
|
||||
*/
|
||||
void push(const value_type& x);
|
||||
|
||||
/** Pop an element off the local queue.
|
||||
*
|
||||
* @p @c !empty()
|
||||
*/
|
||||
void pop() { buffer.pop(); }
|
||||
|
||||
/**
|
||||
* Return the element at the top of the local queue.
|
||||
*
|
||||
* @p @c !empty()
|
||||
*/
|
||||
value_type& top() { return buffer.top(); }
|
||||
|
||||
/**
|
||||
* \overload
|
||||
*/
|
||||
const value_type& top() const { return buffer.top(); }
|
||||
|
||||
/** Determine if the queue is empty.
|
||||
*
|
||||
* When the local queue is nonempty, returns @c true. If the local
|
||||
* queue is empty, synchronizes with all other processes in the
|
||||
* process group until either (1) the local queue is nonempty
|
||||
* (returns @c true) (2) the entire distributed queue is empty
|
||||
* (returns @c false).
|
||||
*/
|
||||
bool empty() const;
|
||||
|
||||
/** Determine the size of the local queue.
|
||||
*
|
||||
* The behavior of this routine is equivalent to the behavior of
|
||||
* @ref empty, except that when @ref empty returns true this
|
||||
* function returns the size of the local queue and when @ref empty
|
||||
* returns false this function returns zero.
|
||||
*/
|
||||
size_type size() const;
|
||||
|
||||
// private:
|
||||
/** Synchronize the distributed queue and determine if all queues
|
||||
* are empty.
|
||||
*
|
||||
* \returns \c true when all local queues are empty, or false if at least
|
||||
* one of the local queues is nonempty.
|
||||
* Defined as virtual for derived classes like depth_limited_distributed_queue.
|
||||
*/
|
||||
virtual bool do_synchronize() const;
|
||||
|
||||
private:
|
||||
// Setup triggers
|
||||
void setup_triggers();
|
||||
|
||||
// Message handlers
|
||||
void
|
||||
handle_push(int source, int tag, const value_type& value,
|
||||
trigger_receive_context);
|
||||
|
||||
void
|
||||
handle_multipush(int source, int tag, const std::vector<value_type>& values,
|
||||
trigger_receive_context);
|
||||
|
||||
mutable ProcessGroup process_group;
|
||||
OwnerMap owner;
|
||||
mutable Buffer buffer;
|
||||
UnaryPredicate pred;
|
||||
bool polling;
|
||||
|
||||
typedef std::vector<value_type> outgoing_buffer_t;
|
||||
typedef std::vector<outgoing_buffer_t> outgoing_buffers_t;
|
||||
shared_ptr<outgoing_buffers_t> outgoing_buffers;
|
||||
};
|
||||
|
||||
/// Helper macro containing the normal names for the template
|
||||
/// parameters to distributed_queue.
|
||||
#define BOOST_DISTRIBUTED_QUEUE_PARMS \
|
||||
typename ProcessGroup, typename OwnerMap, typename Buffer, \
|
||||
typename UnaryPredicate
|
||||
|
||||
/// Helper macro containing the normal template-id for
|
||||
/// distributed_queue.
|
||||
#define BOOST_DISTRIBUTED_QUEUE_TYPE \
|
||||
distributed_queue<ProcessGroup, OwnerMap, Buffer, UnaryPredicate>
|
||||
|
||||
/** Synchronize all processes involved with the given distributed queue.
|
||||
*
|
||||
* This function will synchronize all of the local queues for a given
|
||||
* distributed queue, by ensuring that no additional messages are in
|
||||
* transit. It is rarely required by the user, because most
|
||||
* synchronization of distributed queues occurs via the @c empty or @c
|
||||
* size methods.
|
||||
*/
|
||||
template<BOOST_DISTRIBUTED_QUEUE_PARMS>
|
||||
inline void
|
||||
synchronize(const BOOST_DISTRIBUTED_QUEUE_TYPE& Q)
|
||||
{ Q.do_synchronize(); }
|
||||
|
||||
/// Construct a new distributed queue.
|
||||
template<typename ProcessGroup, typename OwnerMap, typename Buffer>
|
||||
inline distributed_queue<ProcessGroup, OwnerMap, Buffer>
|
||||
make_distributed_queue(const ProcessGroup& process_group,
|
||||
const OwnerMap& owner,
|
||||
const Buffer& buffer,
|
||||
bool polling = false)
|
||||
{
|
||||
typedef distributed_queue<ProcessGroup, OwnerMap, Buffer> result_type;
|
||||
return result_type(process_group, owner, buffer, polling);
|
||||
}
|
||||
|
||||
} } } // end namespace boost::graph::distributed
|
||||
|
||||
#include <boost/graph/distributed/detail/queue.ipp>
|
||||
|
||||
#undef BOOST_DISTRIBUTED_QUEUE_TYPE
|
||||
#undef BOOST_DISTRIBUTED_QUEUE_PARMS
|
||||
|
||||
#endif // BOOST_GRAPH_DISTRIBUTED_QUEUE_HPP
|
||||
@@ -0,0 +1,46 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 1999-2003 Jaakko Jarvi
|
||||
Copyright (c) 2001-2011 Joel de Guzman
|
||||
|
||||
Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
==============================================================================*/
|
||||
#if !defined(FUSION_LESS_05052005_0432)
|
||||
#define FUSION_LESS_05052005_0432
|
||||
|
||||
#include <boost/fusion/support/config.hpp>
|
||||
#include <boost/fusion/sequence/intrinsic/begin.hpp>
|
||||
#include <boost/fusion/sequence/intrinsic/end.hpp>
|
||||
#include <boost/fusion/sequence/intrinsic/size.hpp>
|
||||
#include <boost/fusion/sequence/comparison/detail/less.hpp>
|
||||
#include <boost/fusion/sequence/comparison/enable_comparison.hpp>
|
||||
|
||||
namespace boost { namespace fusion
|
||||
{
|
||||
template <typename Seq1, typename Seq2>
|
||||
BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
|
||||
inline bool
|
||||
less(Seq1 const& a, Seq2 const& b)
|
||||
{
|
||||
return detail::sequence_less<Seq1 const, Seq2 const>::
|
||||
call(fusion::begin(a), fusion::begin(b));
|
||||
}
|
||||
|
||||
namespace operators
|
||||
{
|
||||
template <typename Seq1, typename Seq2>
|
||||
BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
|
||||
inline typename
|
||||
boost::enable_if<
|
||||
traits::enable_comparison<Seq1, Seq2>
|
||||
, bool
|
||||
>::type
|
||||
operator<(Seq1 const& a, Seq2 const& b)
|
||||
{
|
||||
return fusion::less(a, b);
|
||||
}
|
||||
}
|
||||
using operators::operator<;
|
||||
}}
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,131 @@
|
||||
|
||||
// (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).
|
||||
//
|
||||
// See http://www.boost.org/libs/type_traits for most recent version including documentation.
|
||||
|
||||
#ifndef BOOST_TT_MAKE_SIGNED_HPP_INCLUDED
|
||||
#define BOOST_TT_MAKE_SIGNED_HPP_INCLUDED
|
||||
|
||||
#include <boost/type_traits/conditional.hpp>
|
||||
#include <boost/type_traits/is_integral.hpp>
|
||||
#include <boost/type_traits/is_signed.hpp>
|
||||
#include <boost/type_traits/is_unsigned.hpp>
|
||||
#include <boost/type_traits/is_enum.hpp>
|
||||
#include <boost/type_traits/is_same.hpp>
|
||||
#include <boost/type_traits/remove_cv.hpp>
|
||||
#include <boost/type_traits/is_const.hpp>
|
||||
#include <boost/type_traits/is_volatile.hpp>
|
||||
#include <boost/type_traits/add_const.hpp>
|
||||
#include <boost/type_traits/add_volatile.hpp>
|
||||
#include <boost/static_assert.hpp>
|
||||
|
||||
namespace boost {
|
||||
|
||||
template <class T>
|
||||
struct make_signed
|
||||
{
|
||||
private:
|
||||
BOOST_STATIC_ASSERT_MSG(( ::boost::is_integral<T>::value || ::boost::is_enum<T>::value), "The template argument to make_signed must be an integer or enum type.");
|
||||
BOOST_STATIC_ASSERT_MSG(!(::boost::is_same<typename remove_cv<T>::type, bool>::value), "The template argument to make_signed must not be the type bool.");
|
||||
|
||||
typedef typename remove_cv<T>::type t_no_cv;
|
||||
typedef typename conditional<
|
||||
(::boost::is_signed<T>::value
|
||||
&& ::boost::is_integral<T>::value
|
||||
&& ! ::boost::is_same<t_no_cv, char>::value
|
||||
&& ! ::boost::is_same<t_no_cv, wchar_t>::value
|
||||
&& ! ::boost::is_same<t_no_cv, bool>::value),
|
||||
T,
|
||||
typename conditional<
|
||||
(::boost::is_integral<T>::value
|
||||
&& ! ::boost::is_same<t_no_cv, char>::value
|
||||
&& ! ::boost::is_same<t_no_cv, wchar_t>::value
|
||||
&& ! ::boost::is_same<t_no_cv, bool>::value),
|
||||
typename conditional<
|
||||
is_same<t_no_cv, unsigned char>::value,
|
||||
signed char,
|
||||
typename conditional<
|
||||
is_same<t_no_cv, unsigned short>::value,
|
||||
signed short,
|
||||
typename conditional<
|
||||
is_same<t_no_cv, unsigned int>::value,
|
||||
int,
|
||||
typename conditional<
|
||||
is_same<t_no_cv, unsigned long>::value,
|
||||
long,
|
||||
#if defined(BOOST_HAS_LONG_LONG)
|
||||
#ifdef BOOST_HAS_INT128
|
||||
typename conditional<
|
||||
sizeof(t_no_cv) == sizeof(boost::long_long_type),
|
||||
boost::long_long_type,
|
||||
boost::int128_type
|
||||
>::type
|
||||
#else
|
||||
boost::long_long_type
|
||||
#endif
|
||||
#elif defined(BOOST_HAS_MS_INT64)
|
||||
__int64
|
||||
#else
|
||||
long
|
||||
#endif
|
||||
>::type
|
||||
>::type
|
||||
>::type
|
||||
>::type,
|
||||
// Not a regular integer type:
|
||||
typename conditional<
|
||||
sizeof(t_no_cv) == sizeof(unsigned char),
|
||||
signed char,
|
||||
typename conditional<
|
||||
sizeof(t_no_cv) == sizeof(unsigned short),
|
||||
signed short,
|
||||
typename conditional<
|
||||
sizeof(t_no_cv) == sizeof(unsigned int),
|
||||
int,
|
||||
typename conditional<
|
||||
sizeof(t_no_cv) == sizeof(unsigned long),
|
||||
long,
|
||||
#if defined(BOOST_HAS_LONG_LONG)
|
||||
#ifdef BOOST_HAS_INT128
|
||||
typename conditional<
|
||||
sizeof(t_no_cv) == sizeof(boost::long_long_type),
|
||||
boost::long_long_type,
|
||||
boost::int128_type
|
||||
>::type
|
||||
#else
|
||||
boost::long_long_type
|
||||
#endif
|
||||
#elif defined(BOOST_HAS_MS_INT64)
|
||||
__int64
|
||||
#else
|
||||
long
|
||||
#endif
|
||||
>::type
|
||||
>::type
|
||||
>::type
|
||||
>::type
|
||||
>::type
|
||||
>::type base_integer_type;
|
||||
|
||||
// Add back any const qualifier:
|
||||
typedef typename conditional<
|
||||
is_const<T>::value,
|
||||
typename add_const<base_integer_type>::type,
|
||||
base_integer_type
|
||||
>::type const_base_integer_type;
|
||||
public:
|
||||
// Add back any volatile qualifier:
|
||||
typedef typename conditional<
|
||||
is_volatile<T>::value,
|
||||
typename add_volatile<const_base_integer_type>::type,
|
||||
const_base_integer_type
|
||||
>::type type;
|
||||
};
|
||||
|
||||
} // namespace boost
|
||||
|
||||
#endif // BOOST_TT_ADD_REFERENCE_HPP_INCLUDED
|
||||
|
||||
@@ -0,0 +1,216 @@
|
||||
// npfwht.c
|
||||
// Basic implementation of the Fast Walsh-Hadamard Transforms
|
||||
//
|
||||
// (c) 2016 - Nico Palermo, IV3NWV - Microtelecom Srl, Italy
|
||||
// ------------------------------------------------------------------------------
|
||||
// This file is part of the qracodes project, a Forward Error Control
|
||||
// encoding/decoding package based on Q-ary RA (repeat and accumulate) LDPC codes.
|
||||
//
|
||||
// qracodes is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
// qracodes is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with qracodes source distribution.
|
||||
// If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
#include "npfwht.h"
|
||||
|
||||
#define WHBFY(dst,src,base,offs,dist) { dst[base+offs]=src[base+offs]+src[base+offs+dist]; dst[base+offs+dist]=src[base+offs]-src[base+offs+dist]; }
|
||||
|
||||
typedef void (*pnp_fwht)(float*,float*);
|
||||
|
||||
static void np_fwht2(float *dst, float *src);
|
||||
|
||||
static void np_fwht1(float *dst, float *src);
|
||||
static void np_fwht2(float *dst, float *src);
|
||||
static void np_fwht4(float *dst, float *src);
|
||||
static void np_fwht8(float *dst, float *src);
|
||||
static void np_fwht16(float *dst, float *src);
|
||||
static void np_fwht32(float *dst, float *src);
|
||||
static void np_fwht64(float *dst, float *src);
|
||||
|
||||
static pnp_fwht np_fwht_tab[7] = {
|
||||
np_fwht1,
|
||||
np_fwht2,
|
||||
np_fwht4,
|
||||
np_fwht8,
|
||||
np_fwht16,
|
||||
np_fwht32,
|
||||
np_fwht64
|
||||
};
|
||||
|
||||
void np_fwht(int nlogdim, float *dst, float *src)
|
||||
{
|
||||
np_fwht_tab[nlogdim](dst,src);
|
||||
}
|
||||
|
||||
static void np_fwht1(float *dst, float *src)
|
||||
{
|
||||
dst[0] = src[0];
|
||||
}
|
||||
|
||||
|
||||
static void np_fwht2(float *dst, float *src)
|
||||
{
|
||||
float t[2];
|
||||
|
||||
WHBFY(t,src,0,0,1);
|
||||
dst[0]= t[0];
|
||||
dst[1]= t[1];
|
||||
}
|
||||
|
||||
static void np_fwht4(float *dst, float *src)
|
||||
{
|
||||
float t[4];
|
||||
|
||||
// group 1
|
||||
WHBFY(t,src,0,0,2); WHBFY(t,src,0,1,2);
|
||||
// group 2
|
||||
WHBFY(dst,t,0,0,1); WHBFY(dst,t,2,0,1);
|
||||
};
|
||||
|
||||
|
||||
static void np_fwht8(float *dst, float *src)
|
||||
{
|
||||
float t[16];
|
||||
float *t1=t, *t2=t+8;
|
||||
|
||||
// group 1
|
||||
WHBFY(t1,src,0,0,4); WHBFY(t1,src,0,1,4); WHBFY(t1,src,0,2,4); WHBFY(t1,src,0,3,4);
|
||||
// group 2
|
||||
WHBFY(t2,t1,0,0,2); WHBFY(t2,t1,0,1,2); WHBFY(t2,t1,4,0,2); WHBFY(t2,t1,4,1,2);
|
||||
// group 3
|
||||
WHBFY(dst,t2,0,0,1); WHBFY(dst,t2,2,0,1); WHBFY(dst,t2,4,0,1); WHBFY(dst,t2,6,0,1);
|
||||
};
|
||||
|
||||
|
||||
static void np_fwht16(float *dst, float *src)
|
||||
{
|
||||
float t[32];
|
||||
float *t1=t, *t2=t+16;
|
||||
|
||||
// group 1
|
||||
WHBFY(t1,src,0,0,8); WHBFY(t1,src,0,1,8); WHBFY(t1,src,0,2,8); WHBFY(t1,src,0,3,8);
|
||||
WHBFY(t1,src,0,4,8); WHBFY(t1,src,0,5,8); WHBFY(t1,src,0,6,8); WHBFY(t1,src,0,7,8);
|
||||
// group 2
|
||||
WHBFY(t2,t1,0,0,4); WHBFY(t2,t1,0,1,4); WHBFY(t2,t1,0,2,4); WHBFY(t2,t1,0,3,4);
|
||||
WHBFY(t2,t1,8,0,4); WHBFY(t2,t1,8,1,4); WHBFY(t2,t1,8,2,4); WHBFY(t2,t1,8,3,4);
|
||||
// group 3
|
||||
WHBFY(t1,t2,0,0,2); WHBFY(t1,t2,0,1,2); WHBFY(t1,t2,4,0,2); WHBFY(t1,t2,4,1,2);
|
||||
WHBFY(t1,t2,8,0,2); WHBFY(t1,t2,8,1,2); WHBFY(t1,t2,12,0,2); WHBFY(t1,t2,12,1,2);
|
||||
// group 4
|
||||
WHBFY(dst,t1,0,0,1); WHBFY(dst,t1,2,0,1); WHBFY(dst,t1,4,0,1); WHBFY(dst,t1,6,0,1);
|
||||
WHBFY(dst,t1,8,0,1); WHBFY(dst,t1,10,0,1); WHBFY(dst,t1,12,0,1); WHBFY(dst,t1,14,0,1);
|
||||
|
||||
}
|
||||
|
||||
static void np_fwht32(float *dst, float *src)
|
||||
{
|
||||
float t[64];
|
||||
float *t1=t, *t2=t+32;
|
||||
|
||||
// group 1
|
||||
WHBFY(t1,src,0,0,16); WHBFY(t1,src,0,1,16); WHBFY(t1,src,0,2,16); WHBFY(t1,src,0,3,16);
|
||||
WHBFY(t1,src,0,4,16); WHBFY(t1,src,0,5,16); WHBFY(t1,src,0,6,16); WHBFY(t1,src,0,7,16);
|
||||
WHBFY(t1,src,0,8,16); WHBFY(t1,src,0,9,16); WHBFY(t1,src,0,10,16); WHBFY(t1,src,0,11,16);
|
||||
WHBFY(t1,src,0,12,16); WHBFY(t1,src,0,13,16); WHBFY(t1,src,0,14,16); WHBFY(t1,src,0,15,16);
|
||||
|
||||
// group 2
|
||||
WHBFY(t2,t1,0,0,8); WHBFY(t2,t1,0,1,8); WHBFY(t2,t1,0,2,8); WHBFY(t2,t1,0,3,8);
|
||||
WHBFY(t2,t1,0,4,8); WHBFY(t2,t1,0,5,8); WHBFY(t2,t1,0,6,8); WHBFY(t2,t1,0,7,8);
|
||||
WHBFY(t2,t1,16,0,8); WHBFY(t2,t1,16,1,8); WHBFY(t2,t1,16,2,8); WHBFY(t2,t1,16,3,8);
|
||||
WHBFY(t2,t1,16,4,8); WHBFY(t2,t1,16,5,8); WHBFY(t2,t1,16,6,8); WHBFY(t2,t1,16,7,8);
|
||||
|
||||
// group 3
|
||||
WHBFY(t1,t2,0,0,4); WHBFY(t1,t2,0,1,4); WHBFY(t1,t2,0,2,4); WHBFY(t1,t2,0,3,4);
|
||||
WHBFY(t1,t2,8,0,4); WHBFY(t1,t2,8,1,4); WHBFY(t1,t2,8,2,4); WHBFY(t1,t2,8,3,4);
|
||||
WHBFY(t1,t2,16,0,4); WHBFY(t1,t2,16,1,4); WHBFY(t1,t2,16,2,4); WHBFY(t1,t2,16,3,4);
|
||||
WHBFY(t1,t2,24,0,4); WHBFY(t1,t2,24,1,4); WHBFY(t1,t2,24,2,4); WHBFY(t1,t2,24,3,4);
|
||||
|
||||
// group 4
|
||||
WHBFY(t2,t1,0,0,2); WHBFY(t2,t1,0,1,2); WHBFY(t2,t1,4,0,2); WHBFY(t2,t1,4,1,2);
|
||||
WHBFY(t2,t1,8,0,2); WHBFY(t2,t1,8,1,2); WHBFY(t2,t1,12,0,2); WHBFY(t2,t1,12,1,2);
|
||||
WHBFY(t2,t1,16,0,2); WHBFY(t2,t1,16,1,2); WHBFY(t2,t1,20,0,2); WHBFY(t2,t1,20,1,2);
|
||||
WHBFY(t2,t1,24,0,2); WHBFY(t2,t1,24,1,2); WHBFY(t2,t1,28,0,2); WHBFY(t2,t1,28,1,2);
|
||||
|
||||
// group 5
|
||||
WHBFY(dst,t2,0,0,1); WHBFY(dst,t2,2,0,1); WHBFY(dst,t2,4,0,1); WHBFY(dst,t2,6,0,1);
|
||||
WHBFY(dst,t2,8,0,1); WHBFY(dst,t2,10,0,1); WHBFY(dst,t2,12,0,1); WHBFY(dst,t2,14,0,1);
|
||||
WHBFY(dst,t2,16,0,1); WHBFY(dst,t2,18,0,1); WHBFY(dst,t2,20,0,1); WHBFY(dst,t2,22,0,1);
|
||||
WHBFY(dst,t2,24,0,1); WHBFY(dst,t2,26,0,1); WHBFY(dst,t2,28,0,1); WHBFY(dst,t2,30,0,1);
|
||||
|
||||
}
|
||||
|
||||
static void np_fwht64(float *dst, float *src)
|
||||
{
|
||||
float t[128];
|
||||
float *t1=t, *t2=t+64;
|
||||
|
||||
|
||||
// group 1
|
||||
WHBFY(t1,src,0,0,32); WHBFY(t1,src,0,1,32); WHBFY(t1,src,0,2,32); WHBFY(t1,src,0,3,32);
|
||||
WHBFY(t1,src,0,4,32); WHBFY(t1,src,0,5,32); WHBFY(t1,src,0,6,32); WHBFY(t1,src,0,7,32);
|
||||
WHBFY(t1,src,0,8,32); WHBFY(t1,src,0,9,32); WHBFY(t1,src,0,10,32); WHBFY(t1,src,0,11,32);
|
||||
WHBFY(t1,src,0,12,32); WHBFY(t1,src,0,13,32); WHBFY(t1,src,0,14,32); WHBFY(t1,src,0,15,32);
|
||||
WHBFY(t1,src,0,16,32); WHBFY(t1,src,0,17,32); WHBFY(t1,src,0,18,32); WHBFY(t1,src,0,19,32);
|
||||
WHBFY(t1,src,0,20,32); WHBFY(t1,src,0,21,32); WHBFY(t1,src,0,22,32); WHBFY(t1,src,0,23,32);
|
||||
WHBFY(t1,src,0,24,32); WHBFY(t1,src,0,25,32); WHBFY(t1,src,0,26,32); WHBFY(t1,src,0,27,32);
|
||||
WHBFY(t1,src,0,28,32); WHBFY(t1,src,0,29,32); WHBFY(t1,src,0,30,32); WHBFY(t1,src,0,31,32);
|
||||
|
||||
// group 2
|
||||
WHBFY(t2,t1,0,0,16); WHBFY(t2,t1,0,1,16); WHBFY(t2,t1,0,2,16); WHBFY(t2,t1,0,3,16);
|
||||
WHBFY(t2,t1,0,4,16); WHBFY(t2,t1,0,5,16); WHBFY(t2,t1,0,6,16); WHBFY(t2,t1,0,7,16);
|
||||
WHBFY(t2,t1,0,8,16); WHBFY(t2,t1,0,9,16); WHBFY(t2,t1,0,10,16); WHBFY(t2,t1,0,11,16);
|
||||
WHBFY(t2,t1,0,12,16); WHBFY(t2,t1,0,13,16); WHBFY(t2,t1,0,14,16); WHBFY(t2,t1,0,15,16);
|
||||
|
||||
WHBFY(t2,t1,32,0,16); WHBFY(t2,t1,32,1,16); WHBFY(t2,t1,32,2,16); WHBFY(t2,t1,32,3,16);
|
||||
WHBFY(t2,t1,32,4,16); WHBFY(t2,t1,32,5,16); WHBFY(t2,t1,32,6,16); WHBFY(t2,t1,32,7,16);
|
||||
WHBFY(t2,t1,32,8,16); WHBFY(t2,t1,32,9,16); WHBFY(t2,t1,32,10,16); WHBFY(t2,t1,32,11,16);
|
||||
WHBFY(t2,t1,32,12,16); WHBFY(t2,t1,32,13,16); WHBFY(t2,t1,32,14,16); WHBFY(t2,t1,32,15,16);
|
||||
|
||||
// group 3
|
||||
WHBFY(t1,t2,0,0,8); WHBFY(t1,t2,0,1,8); WHBFY(t1,t2,0,2,8); WHBFY(t1,t2,0,3,8);
|
||||
WHBFY(t1,t2,0,4,8); WHBFY(t1,t2,0,5,8); WHBFY(t1,t2,0,6,8); WHBFY(t1,t2,0,7,8);
|
||||
WHBFY(t1,t2,16,0,8); WHBFY(t1,t2,16,1,8); WHBFY(t1,t2,16,2,8); WHBFY(t1,t2,16,3,8);
|
||||
WHBFY(t1,t2,16,4,8); WHBFY(t1,t2,16,5,8); WHBFY(t1,t2,16,6,8); WHBFY(t1,t2,16,7,8);
|
||||
WHBFY(t1,t2,32,0,8); WHBFY(t1,t2,32,1,8); WHBFY(t1,t2,32,2,8); WHBFY(t1,t2,32,3,8);
|
||||
WHBFY(t1,t2,32,4,8); WHBFY(t1,t2,32,5,8); WHBFY(t1,t2,32,6,8); WHBFY(t1,t2,32,7,8);
|
||||
WHBFY(t1,t2,48,0,8); WHBFY(t1,t2,48,1,8); WHBFY(t1,t2,48,2,8); WHBFY(t1,t2,48,3,8);
|
||||
WHBFY(t1,t2,48,4,8); WHBFY(t1,t2,48,5,8); WHBFY(t1,t2,48,6,8); WHBFY(t1,t2,48,7,8);
|
||||
|
||||
// group 4
|
||||
WHBFY(t2,t1,0,0,4); WHBFY(t2,t1,0,1,4); WHBFY(t2,t1,0,2,4); WHBFY(t2,t1,0,3,4);
|
||||
WHBFY(t2,t1,8,0,4); WHBFY(t2,t1,8,1,4); WHBFY(t2,t1,8,2,4); WHBFY(t2,t1,8,3,4);
|
||||
WHBFY(t2,t1,16,0,4); WHBFY(t2,t1,16,1,4); WHBFY(t2,t1,16,2,4); WHBFY(t2,t1,16,3,4);
|
||||
WHBFY(t2,t1,24,0,4); WHBFY(t2,t1,24,1,4); WHBFY(t2,t1,24,2,4); WHBFY(t2,t1,24,3,4);
|
||||
WHBFY(t2,t1,32,0,4); WHBFY(t2,t1,32,1,4); WHBFY(t2,t1,32,2,4); WHBFY(t2,t1,32,3,4);
|
||||
WHBFY(t2,t1,40,0,4); WHBFY(t2,t1,40,1,4); WHBFY(t2,t1,40,2,4); WHBFY(t2,t1,40,3,4);
|
||||
WHBFY(t2,t1,48,0,4); WHBFY(t2,t1,48,1,4); WHBFY(t2,t1,48,2,4); WHBFY(t2,t1,48,3,4);
|
||||
WHBFY(t2,t1,56,0,4); WHBFY(t2,t1,56,1,4); WHBFY(t2,t1,56,2,4); WHBFY(t2,t1,56,3,4);
|
||||
|
||||
// group 5
|
||||
WHBFY(t1,t2,0,0,2); WHBFY(t1,t2,0,1,2); WHBFY(t1,t2,4,0,2); WHBFY(t1,t2,4,1,2);
|
||||
WHBFY(t1,t2,8,0,2); WHBFY(t1,t2,8,1,2); WHBFY(t1,t2,12,0,2); WHBFY(t1,t2,12,1,2);
|
||||
WHBFY(t1,t2,16,0,2); WHBFY(t1,t2,16,1,2); WHBFY(t1,t2,20,0,2); WHBFY(t1,t2,20,1,2);
|
||||
WHBFY(t1,t2,24,0,2); WHBFY(t1,t2,24,1,2); WHBFY(t1,t2,28,0,2); WHBFY(t1,t2,28,1,2);
|
||||
WHBFY(t1,t2,32,0,2); WHBFY(t1,t2,32,1,2); WHBFY(t1,t2,36,0,2); WHBFY(t1,t2,36,1,2);
|
||||
WHBFY(t1,t2,40,0,2); WHBFY(t1,t2,40,1,2); WHBFY(t1,t2,44,0,2); WHBFY(t1,t2,44,1,2);
|
||||
WHBFY(t1,t2,48,0,2); WHBFY(t1,t2,48,1,2); WHBFY(t1,t2,52,0,2); WHBFY(t1,t2,52,1,2);
|
||||
WHBFY(t1,t2,56,0,2); WHBFY(t1,t2,56,1,2); WHBFY(t1,t2,60,0,2); WHBFY(t1,t2,60,1,2);
|
||||
|
||||
// group 6
|
||||
WHBFY(dst,t1,0,0,1); WHBFY(dst,t1,2,0,1); WHBFY(dst,t1,4,0,1); WHBFY(dst,t1,6,0,1);
|
||||
WHBFY(dst,t1,8,0,1); WHBFY(dst,t1,10,0,1); WHBFY(dst,t1,12,0,1); WHBFY(dst,t1,14,0,1);
|
||||
WHBFY(dst,t1,16,0,1); WHBFY(dst,t1,18,0,1); WHBFY(dst,t1,20,0,1); WHBFY(dst,t1,22,0,1);
|
||||
WHBFY(dst,t1,24,0,1); WHBFY(dst,t1,26,0,1); WHBFY(dst,t1,28,0,1); WHBFY(dst,t1,30,0,1);
|
||||
WHBFY(dst,t1,32,0,1); WHBFY(dst,t1,34,0,1); WHBFY(dst,t1,36,0,1); WHBFY(dst,t1,38,0,1);
|
||||
WHBFY(dst,t1,40,0,1); WHBFY(dst,t1,42,0,1); WHBFY(dst,t1,44,0,1); WHBFY(dst,t1,46,0,1);
|
||||
WHBFY(dst,t1,48,0,1); WHBFY(dst,t1,50,0,1); WHBFY(dst,t1,52,0,1); WHBFY(dst,t1,54,0,1);
|
||||
WHBFY(dst,t1,56,0,1); WHBFY(dst,t1,58,0,1); WHBFY(dst,t1,60,0,1); WHBFY(dst,t1,62,0,1);
|
||||
}
|
||||
@@ -0,0 +1,89 @@
|
||||
#include "CandidateKeyFilter.hpp"
|
||||
|
||||
#include <QModelIndex>
|
||||
#include <QAbstractItemModel>
|
||||
|
||||
#include "pimpl_impl.hpp"
|
||||
|
||||
class CandidateKeyFilter::impl final
|
||||
{
|
||||
public:
|
||||
explicit impl (int referenced_key_column
|
||||
, int referenced_key_role
|
||||
, QAbstractItemModel const * referencing_model
|
||||
, int referencing_key_column
|
||||
, int referencing_key_role)
|
||||
: referencing_ {referencing_model}
|
||||
, referencing_key_column_ {referencing_key_column}
|
||||
, referencing_key_role_ {referencing_key_role}
|
||||
, referenced_key_column_ {referenced_key_column}
|
||||
, referenced_key_role_ {referenced_key_role}
|
||||
{
|
||||
}
|
||||
|
||||
QAbstractItemModel const * referencing_;
|
||||
int referencing_key_column_;
|
||||
int referencing_key_role_;
|
||||
int referenced_key_column_;
|
||||
int referenced_key_role_;
|
||||
QModelIndex active_key_;
|
||||
};
|
||||
|
||||
CandidateKeyFilter::CandidateKeyFilter (QAbstractItemModel * referenced_model
|
||||
, int referenced_key_column
|
||||
, QObject * parent
|
||||
, int referenced_key_role)
|
||||
: QSortFilterProxyModel {parent}
|
||||
, m_ {referenced_key_column, referenced_key_role, nullptr, 0, Qt::EditRole}
|
||||
{
|
||||
setSourceModel (referenced_model);
|
||||
}
|
||||
|
||||
CandidateKeyFilter::CandidateKeyFilter (QAbstractItemModel * referenced_model
|
||||
, QAbstractItemModel const * referencing_model
|
||||
, int referenced_key_column
|
||||
, int referencing_key_column
|
||||
, QObject * parent
|
||||
, int referenced_key_role
|
||||
, int referencing_key_role)
|
||||
: QSortFilterProxyModel {parent}
|
||||
, m_ {referenced_key_column, referenced_key_role, referencing_model, referencing_key_column, referencing_key_role}
|
||||
{
|
||||
setSourceModel (referenced_model);
|
||||
}
|
||||
|
||||
CandidateKeyFilter::~CandidateKeyFilter ()
|
||||
{
|
||||
}
|
||||
|
||||
void CandidateKeyFilter::set_active_key (QModelIndex const& index)
|
||||
{
|
||||
if (m_->referencing_)
|
||||
{
|
||||
if (index.isValid () )
|
||||
{
|
||||
Q_ASSERT (index.column () == m_->referencing_key_column_);
|
||||
m_->active_key_ = index;
|
||||
}
|
||||
invalidateFilter ();
|
||||
}
|
||||
}
|
||||
|
||||
bool CandidateKeyFilter::filterAcceptsRow (int candidate_row, QModelIndex const& candidate_parent) const
|
||||
{
|
||||
if (!m_->referencing_) // many to many passes all
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
auto candidate_key = sourceModel ()->index (candidate_row, m_->referenced_key_column_, candidate_parent).data (m_->referenced_key_role_);
|
||||
|
||||
// Include the current key.
|
||||
if (m_->active_key_.isValid () && candidate_key == m_->active_key_.data (m_->referencing_key_role_))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
// Filter out any candidates already in the referencing key rows.
|
||||
return m_->referencing_->match (m_->referencing_->index (0, m_->referencing_key_column_), m_->referencing_key_role_, candidate_key, 1, Qt::MatchExactly).isEmpty ();
|
||||
}
|
||||
@@ -0,0 +1,61 @@
|
||||
//---------------------------------------------------------------------------//
|
||||
// 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_CONTAINER_DETAIL_SCALAR_HPP
|
||||
#define BOOST_COMPUTE_CONTAINER_DETAIL_SCALAR_HPP
|
||||
|
||||
#include <boost/compute/buffer.hpp>
|
||||
#include <boost/compute/detail/read_write_single_value.hpp>
|
||||
|
||||
namespace boost {
|
||||
namespace compute {
|
||||
namespace detail {
|
||||
|
||||
// scalar<T> provides a trivial "container" that stores a
|
||||
// single value in a memory buffer on a compute device
|
||||
template<class T>
|
||||
class scalar
|
||||
{
|
||||
public:
|
||||
typedef T value_type;
|
||||
|
||||
scalar(const context &context)
|
||||
: m_buffer(context, sizeof(T))
|
||||
{
|
||||
}
|
||||
|
||||
~scalar()
|
||||
{
|
||||
}
|
||||
|
||||
T read(command_queue &queue) const
|
||||
{
|
||||
return read_single_value<T>(m_buffer, 0, queue);
|
||||
}
|
||||
|
||||
void write(const T &value, command_queue &queue)
|
||||
{
|
||||
write_single_value<T>(value, m_buffer, 0, queue);
|
||||
}
|
||||
|
||||
const buffer& get_buffer() const
|
||||
{
|
||||
return m_buffer;
|
||||
}
|
||||
|
||||
private:
|
||||
buffer m_buffer;
|
||||
};
|
||||
|
||||
} // end detail namespace
|
||||
} // end compute namespace
|
||||
} // end boost namespace
|
||||
|
||||
#endif // BOOST_COMPUTE_CONTAINER_DETAIL_SCALAR_HPP
|
||||
@@ -0,0 +1,45 @@
|
||||
// Boost.Assign library
|
||||
//
|
||||
// Copyright Thorsten Ottosen 2003-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/libs/assign/
|
||||
//
|
||||
|
||||
|
||||
#ifndef BOOST_ASSIGN_STD_QUEUE_HPP
|
||||
#define BOOST_ASSIGN_STD_QUEUE_HPP
|
||||
|
||||
#if defined(_MSC_VER)
|
||||
# pragma once
|
||||
#endif
|
||||
|
||||
#include <boost/assign/list_inserter.hpp>
|
||||
#include <boost/config.hpp>
|
||||
#include <queue>
|
||||
|
||||
namespace boost
|
||||
{
|
||||
namespace assign
|
||||
{
|
||||
|
||||
template< class V, class C, class V2 >
|
||||
inline list_inserter< assign_detail::call_push< std::queue<V,C> >, V >
|
||||
operator+=( std::queue<V,C>& c, V2 v )
|
||||
{
|
||||
return push( c )( v );
|
||||
}
|
||||
|
||||
template< class V, class C, class V2 >
|
||||
inline list_inserter< assign_detail::call_push< std::priority_queue<V,C> >, V >
|
||||
operator+=( std::priority_queue<V,C>& c, V2 v )
|
||||
{
|
||||
return push( c )( v );
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,22 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2001-2011 Joel de Guzman
|
||||
|
||||
Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
This is an auto-generated file. Do not edit!
|
||||
==============================================================================*/
|
||||
|
||||
#if FUSION_MAX_LIST_SIZE <= 10
|
||||
#include <boost/fusion/container/list/detail/cpp03/preprocessed/list10.hpp>
|
||||
#elif FUSION_MAX_LIST_SIZE <= 20
|
||||
#include <boost/fusion/container/list/detail/cpp03/preprocessed/list20.hpp>
|
||||
#elif FUSION_MAX_LIST_SIZE <= 30
|
||||
#include <boost/fusion/container/list/detail/cpp03/preprocessed/list30.hpp>
|
||||
#elif FUSION_MAX_LIST_SIZE <= 40
|
||||
#include <boost/fusion/container/list/detail/cpp03/preprocessed/list40.hpp>
|
||||
#elif FUSION_MAX_LIST_SIZE <= 50
|
||||
#include <boost/fusion/container/list/detail/cpp03/preprocessed/list50.hpp>
|
||||
#else
|
||||
#error "FUSION_MAX_LIST_SIZE out of bounds for preprocessed headers"
|
||||
#endif
|
||||
@@ -0,0 +1,40 @@
|
||||
//
|
||||
// Copyright (c) Antony Polukhin, 2013-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)
|
||||
//
|
||||
|
||||
#ifndef BOOST_TYPE_INDEX_STL_REGISTER_CLASS_HPP
|
||||
#define BOOST_TYPE_INDEX_STL_REGISTER_CLASS_HPP
|
||||
|
||||
/// \file stl_register_class.hpp
|
||||
/// \brief Contains BOOST_TYPE_INDEX_REGISTER_CLASS macro implementation that uses boost::typeindex::stl_type_index.
|
||||
/// Not intended for inclusion from user's code.
|
||||
|
||||
#include <boost/type_index/stl_type_index.hpp>
|
||||
|
||||
#ifdef BOOST_HAS_PRAGMA_ONCE
|
||||
# pragma once
|
||||
#endif
|
||||
|
||||
namespace boost { namespace typeindex { namespace detail {
|
||||
|
||||
template <class T>
|
||||
inline const stl_type_index::type_info_t& stl_construct_typeid_ref(const T*) BOOST_NOEXCEPT {
|
||||
return typeid(T);
|
||||
}
|
||||
|
||||
}}} // namespace boost::typeindex::detail
|
||||
|
||||
/// @cond
|
||||
#define BOOST_TYPE_INDEX_REGISTER_CLASS \
|
||||
virtual const boost::typeindex::stl_type_index::type_info_t& boost_type_index_type_id_runtime_() const BOOST_NOEXCEPT { \
|
||||
return boost::typeindex::detail::stl_construct_typeid_ref(this); \
|
||||
} \
|
||||
/**/
|
||||
/// @endcond
|
||||
|
||||
#endif // BOOST_TYPE_INDEX_STL_REGISTER_CLASS_HPP
|
||||
|
||||
@@ -0,0 +1,125 @@
|
||||
#include "fastgraph.h"
|
||||
|
||||
#include "commons.h"
|
||||
#include <QSettings>
|
||||
#include <QApplication>
|
||||
#include "fastplot.h"
|
||||
#include "SettingsGroup.hpp"
|
||||
|
||||
#include "ui_fastgraph.h"
|
||||
#include "moc_fastgraph.cpp"
|
||||
|
||||
#define NSMAX2 1366
|
||||
|
||||
FastGraph::FastGraph(QSettings * settings, QWidget *parent) :
|
||||
QDialog {parent, Qt::Window | Qt::WindowTitleHint |
|
||||
Qt::WindowCloseButtonHint |
|
||||
Qt::WindowMinimizeButtonHint},
|
||||
m_settings {settings},
|
||||
m_ave {40},
|
||||
ui {new Ui::FastGraph}
|
||||
{
|
||||
ui->setupUi(this);
|
||||
setWindowTitle (QApplication::applicationName () + " - " + tr ("Fast Graph"));
|
||||
installEventFilter(parent); //Installing the filter
|
||||
ui->fastPlot->setCursor(Qt::CrossCursor);
|
||||
|
||||
//Restore user's settings
|
||||
SettingsGroup g {m_settings, "FastGraph"};
|
||||
restoreGeometry (m_settings->value ("geometry", saveGeometry ()).toByteArray ());
|
||||
ui->fastPlot->setPlotZero(m_settings->value("PlotZero", 0).toInt());
|
||||
ui->fastPlot->setPlotGain(m_settings->value("PlotGain", 0).toInt());
|
||||
ui->zeroSlider->setValue(ui->fastPlot->m_plotZero);
|
||||
ui->gainSlider->setValue(ui->fastPlot->m_plotGain);
|
||||
ui->fastPlot->setGreenZero(m_settings->value("GreenZero", 0).toInt());
|
||||
ui->greenZeroSlider->setValue(ui->fastPlot->m_greenZero);
|
||||
// ui->controls_widget->setVisible (!m_settings->value("HideControls", false).toBool ());
|
||||
ui->controls_widget->setVisible(true);
|
||||
connect (ui->fastPlot, &FPlotter::fastPick, this, &FastGraph::fastPick);
|
||||
}
|
||||
|
||||
void FastGraph::closeEvent (QCloseEvent * e)
|
||||
{
|
||||
saveSettings ();
|
||||
QDialog::closeEvent (e);
|
||||
}
|
||||
|
||||
FastGraph::~FastGraph ()
|
||||
{
|
||||
}
|
||||
|
||||
void FastGraph::saveSettings()
|
||||
{
|
||||
//Save user's settings
|
||||
SettingsGroup g {m_settings, "FastGraph"};
|
||||
m_settings->setValue ("geometry", saveGeometry ());
|
||||
m_settings->setValue("PlotZero",ui->fastPlot->m_plotZero);
|
||||
m_settings->setValue("PlotGain",ui->fastPlot->m_plotGain);
|
||||
m_settings->setValue("GreenZero",ui->fastPlot->m_greenZero);
|
||||
m_settings->setValue("GreenGain",ui->fastPlot->m_greenGain);
|
||||
// m_settings->setValue ("HideControls", ui->controls_widget->isHidden ());
|
||||
}
|
||||
|
||||
void FastGraph::plotSpec(bool diskData, int UTCdisk)
|
||||
{
|
||||
ui->fastPlot->m_diskData=diskData;
|
||||
ui->fastPlot->m_UTCdisk=UTCdisk;
|
||||
ui->fastPlot->draw();
|
||||
}
|
||||
|
||||
void FastGraph::on_gainSlider_valueChanged(int value)
|
||||
{
|
||||
ui->fastPlot->setPlotGain(value);
|
||||
ui->fastPlot->draw();
|
||||
}
|
||||
|
||||
void FastGraph::on_zeroSlider_valueChanged(int value)
|
||||
{
|
||||
ui->fastPlot->setPlotZero(value);
|
||||
ui->fastPlot->draw();
|
||||
}
|
||||
|
||||
void FastGraph::on_greenZeroSlider_valueChanged(int value)
|
||||
{
|
||||
ui->fastPlot->setGreenZero(value);
|
||||
ui->fastPlot->draw();
|
||||
}
|
||||
|
||||
void FastGraph::setTRperiod(int n)
|
||||
{
|
||||
m_TRperiod=n;
|
||||
ui->fastPlot->setTRperiod(m_TRperiod);
|
||||
}
|
||||
|
||||
void FastGraph::on_pbAutoLevel_clicked()
|
||||
{
|
||||
float sum=0.0;
|
||||
for(int i=0; i<=fast_jh; i++) {
|
||||
sum += fast_green[i];
|
||||
}
|
||||
m_ave=sum/fast_jh;
|
||||
ui->gainSlider->setValue(127-int(2.2*m_ave));
|
||||
ui->zeroSlider->setValue(int(m_ave)+20);
|
||||
ui->greenZeroSlider->setValue(160-int(3.3*m_ave));
|
||||
}
|
||||
|
||||
void FastGraph::setMode(QString mode) //setMode
|
||||
{
|
||||
ui->fastPlot->setMode(mode);
|
||||
}
|
||||
|
||||
void FastGraph::keyPressEvent(QKeyEvent *e)
|
||||
{
|
||||
switch(e->key())
|
||||
{
|
||||
/*
|
||||
case Qt::Key_M:
|
||||
if(e->modifiers() & Qt::ControlModifier) {
|
||||
ui->controls_widget->setVisible (!ui->controls_widget->isVisible ());
|
||||
}
|
||||
break;
|
||||
*/
|
||||
default:
|
||||
QDialog::keyPressEvent (e);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
subroutine interleave8(idat,jdat)
|
||||
|
||||
integer idat(66),jdat(66)
|
||||
integer ii(66),jj(66)
|
||||
data ii/ &
|
||||
64,32,16,48, 8,40,24,56, 4,36,20,52,12,44,28,60, 2,66,34,18, &
|
||||
50,10,42,26,58, 6,38,22,54,14,46,30,62, 1,65,33,17,49, 9,41, &
|
||||
25,57, 5,37,21,53,13,45,29,61, 3,35,19,51,11,43,27,59, 7,39, &
|
||||
23,55,15,47,31,63/
|
||||
data jj/ &
|
||||
34,17,51, 9,43,26,59, 5,39,22,55,13,47,30,63, 3,37,20,53,11, &
|
||||
45,28,61, 7,41,24,57,15,49,32,65, 2,36,19,52,10,44,27,60, 6, &
|
||||
40,23,56,14,48,31,64, 4,38,21,54,12,46,29,62, 8,42,25,58,16, &
|
||||
50,33,66, 1,35,18/
|
||||
|
||||
return
|
||||
end subroutine interleave8
|
||||
@@ -0,0 +1,221 @@
|
||||
#include "TransceiverFactory.hpp"
|
||||
|
||||
#include <QMetaType>
|
||||
|
||||
#include "HamlibTransceiver.hpp"
|
||||
#include "DXLabSuiteCommanderTransceiver.hpp"
|
||||
#include "HRDTransceiver.hpp"
|
||||
#include "EmulateSplitTransceiver.hpp"
|
||||
|
||||
#if defined (WIN32)
|
||||
#include "OmniRigTransceiver.hpp"
|
||||
#endif
|
||||
|
||||
#include "moc_TransceiverFactory.cpp"
|
||||
|
||||
// we use the hamlib "Hamlib Dummy" transceiver for non-CAT radios,
|
||||
// this allows us to still use the hamlib PTT control features for a
|
||||
// unified PTT control solution
|
||||
|
||||
char const * const TransceiverFactory::basic_transceiver_name_ = "None";
|
||||
|
||||
namespace
|
||||
{
|
||||
enum // supported non-hamlib radio interfaces
|
||||
{
|
||||
NonHamlibBaseId = 9899
|
||||
, CommanderId
|
||||
, HRDId
|
||||
, OmniRigOneId
|
||||
, OmniRigTwoId
|
||||
};
|
||||
}
|
||||
|
||||
TransceiverFactory::TransceiverFactory ()
|
||||
{
|
||||
HamlibTransceiver::register_transceivers (&transceivers_);
|
||||
DXLabSuiteCommanderTransceiver::register_transceivers (&transceivers_, CommanderId);
|
||||
HRDTransceiver::register_transceivers (&transceivers_, HRDId);
|
||||
|
||||
#if defined (WIN32)
|
||||
// OmniRig is ActiveX/COM server so only on Windows
|
||||
OmniRigTransceiver::register_transceivers (&transceivers_, OmniRigOneId, OmniRigTwoId);
|
||||
#endif
|
||||
}
|
||||
|
||||
TransceiverFactory::~TransceiverFactory ()
|
||||
{
|
||||
HamlibTransceiver::unregister_transceivers ();
|
||||
}
|
||||
|
||||
auto TransceiverFactory::supported_transceivers () const -> Transceivers const&
|
||||
{
|
||||
return transceivers_;
|
||||
}
|
||||
|
||||
auto TransceiverFactory::CAT_port_type (QString const& name) const -> Capabilities::PortType
|
||||
{
|
||||
return supported_transceivers ()[name].port_type_;
|
||||
}
|
||||
|
||||
bool TransceiverFactory::has_CAT_PTT (QString const& name) const
|
||||
{
|
||||
return
|
||||
supported_transceivers ()[name].has_CAT_PTT_
|
||||
|| supported_transceivers ()[name].model_number_ > NonHamlibBaseId;
|
||||
}
|
||||
|
||||
bool TransceiverFactory::has_CAT_PTT_mic_data (QString const& name) const
|
||||
{
|
||||
return supported_transceivers ()[name].has_CAT_PTT_mic_data_;
|
||||
}
|
||||
|
||||
bool TransceiverFactory::has_CAT_indirect_serial_PTT (QString const& name) const
|
||||
{
|
||||
return supported_transceivers ()[name].has_CAT_indirect_serial_PTT_;
|
||||
}
|
||||
|
||||
bool TransceiverFactory::has_asynchronous_CAT (QString const& name) const
|
||||
{
|
||||
return supported_transceivers ()[name].asynchronous_;
|
||||
}
|
||||
|
||||
std::unique_ptr<Transceiver> TransceiverFactory::create (ParameterPack const& params, QThread * target_thread)
|
||||
{
|
||||
std::unique_ptr<Transceiver> result;
|
||||
switch (supported_transceivers ()[params.rig_name].model_number_)
|
||||
{
|
||||
case CommanderId:
|
||||
{
|
||||
std::unique_ptr<TransceiverBase> basic_transceiver;
|
||||
if (PTT_method_CAT != params.ptt_type)
|
||||
{
|
||||
// we start with a dummy HamlibTransceiver object instance that can support direct PTT
|
||||
basic_transceiver.reset (new HamlibTransceiver {params.ptt_type, params.ptt_port});
|
||||
if (target_thread)
|
||||
{
|
||||
basic_transceiver.get ()->moveToThread (target_thread);
|
||||
}
|
||||
}
|
||||
|
||||
// wrap the basic Transceiver object instance with a decorator object that talks to DX Lab Suite Commander
|
||||
result.reset (new DXLabSuiteCommanderTransceiver {std::move (basic_transceiver), params.network_port, PTT_method_CAT == params.ptt_type, params.poll_interval});
|
||||
if (target_thread)
|
||||
{
|
||||
result->moveToThread (target_thread);
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case HRDId:
|
||||
{
|
||||
std::unique_ptr<TransceiverBase> basic_transceiver;
|
||||
if (PTT_method_CAT != params.ptt_type)
|
||||
{
|
||||
// we start with a dummy HamlibTransceiver object instance that can support direct PTT
|
||||
basic_transceiver.reset (new HamlibTransceiver {params.ptt_type, params.ptt_port});
|
||||
if (target_thread)
|
||||
{
|
||||
basic_transceiver.get ()->moveToThread (target_thread);
|
||||
}
|
||||
}
|
||||
|
||||
// wrap the basic Transceiver object instance with a decorator object that talks to ham Radio Deluxe
|
||||
result.reset (new HRDTransceiver {std::move (basic_transceiver), params.network_port, PTT_method_CAT == params.ptt_type, params.audio_source, params.poll_interval});
|
||||
if (target_thread)
|
||||
{
|
||||
result->moveToThread (target_thread);
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
#if defined (WIN32)
|
||||
case OmniRigOneId:
|
||||
{
|
||||
std::unique_ptr<TransceiverBase> basic_transceiver;
|
||||
if (PTT_method_CAT != params.ptt_type && "CAT" != params.ptt_port)
|
||||
{
|
||||
// we start with a dummy HamlibTransceiver object instance that can support direct PTT
|
||||
basic_transceiver.reset (new HamlibTransceiver {params.ptt_type, params.ptt_port});
|
||||
if (target_thread)
|
||||
{
|
||||
basic_transceiver.get ()->moveToThread (target_thread);
|
||||
}
|
||||
}
|
||||
|
||||
// wrap the basic Transceiver object instance with a decorator object that talks to OmniRig rig one
|
||||
result.reset (new OmniRigTransceiver {std::move (basic_transceiver), OmniRigTransceiver::One, params.ptt_type, params.ptt_port});
|
||||
if (target_thread)
|
||||
{
|
||||
result->moveToThread (target_thread);
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case OmniRigTwoId:
|
||||
{
|
||||
std::unique_ptr<TransceiverBase> basic_transceiver;
|
||||
if (PTT_method_CAT != params.ptt_type && "CAT" != params.ptt_port)
|
||||
{
|
||||
// we start with a dummy HamlibTransceiver object instance that can support direct PTT
|
||||
basic_transceiver.reset (new HamlibTransceiver {params.ptt_type, params.ptt_port});
|
||||
if (target_thread)
|
||||
{
|
||||
basic_transceiver.get ()->moveToThread (target_thread);
|
||||
}
|
||||
}
|
||||
|
||||
// wrap the basic Transceiver object instance with a decorator object that talks to OmniRig rig two
|
||||
result.reset (new OmniRigTransceiver {std::move (basic_transceiver), OmniRigTransceiver::Two, params.ptt_type, params.ptt_port});
|
||||
if (target_thread)
|
||||
{
|
||||
result->moveToThread (target_thread);
|
||||
}
|
||||
}
|
||||
break;
|
||||
#endif
|
||||
|
||||
default:
|
||||
result.reset (new HamlibTransceiver {supported_transceivers ()[params.rig_name].model_number_, params});
|
||||
if (target_thread)
|
||||
{
|
||||
result->moveToThread (target_thread);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
if (split_mode_emulate == params.split_mode)
|
||||
{
|
||||
// wrap the Transceiver object instance with a decorator that emulates split mode
|
||||
result.reset (new EmulateSplitTransceiver {std::move (result)});
|
||||
if (target_thread)
|
||||
{
|
||||
result->moveToThread (target_thread);
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
#if !defined (QT_NO_DEBUG_STREAM)
|
||||
ENUM_QDEBUG_OPS_IMPL (TransceiverFactory, DataBits);
|
||||
ENUM_QDEBUG_OPS_IMPL (TransceiverFactory, StopBits);
|
||||
ENUM_QDEBUG_OPS_IMPL (TransceiverFactory, Handshake);
|
||||
ENUM_QDEBUG_OPS_IMPL (TransceiverFactory, PTTMethod);
|
||||
ENUM_QDEBUG_OPS_IMPL (TransceiverFactory, TXAudioSource);
|
||||
ENUM_QDEBUG_OPS_IMPL (TransceiverFactory, SplitMode);
|
||||
#endif
|
||||
|
||||
ENUM_QDATASTREAM_OPS_IMPL (TransceiverFactory, DataBits);
|
||||
ENUM_QDATASTREAM_OPS_IMPL (TransceiverFactory, StopBits);
|
||||
ENUM_QDATASTREAM_OPS_IMPL (TransceiverFactory, Handshake);
|
||||
ENUM_QDATASTREAM_OPS_IMPL (TransceiverFactory, PTTMethod);
|
||||
ENUM_QDATASTREAM_OPS_IMPL (TransceiverFactory, TXAudioSource);
|
||||
ENUM_QDATASTREAM_OPS_IMPL (TransceiverFactory, SplitMode);
|
||||
|
||||
ENUM_CONVERSION_OPS_IMPL (TransceiverFactory, DataBits);
|
||||
ENUM_CONVERSION_OPS_IMPL (TransceiverFactory, StopBits);
|
||||
ENUM_CONVERSION_OPS_IMPL (TransceiverFactory, Handshake);
|
||||
ENUM_CONVERSION_OPS_IMPL (TransceiverFactory, PTTMethod);
|
||||
ENUM_CONVERSION_OPS_IMPL (TransceiverFactory, TXAudioSource);
|
||||
ENUM_CONVERSION_OPS_IMPL (TransceiverFactory, SplitMode);
|
||||
@@ -0,0 +1,558 @@
|
||||
|
||||
// Copyright Aleksey Gurtovoy 2001-2004
|
||||
//
|
||||
// Distributed under the Boost Software License, Version 1.0.
|
||||
// (See accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
//
|
||||
|
||||
// *Preprocessed* version of the main "full_lambda.hpp" header
|
||||
// -- DO NOT modify by hand!
|
||||
|
||||
namespace boost { namespace mpl {
|
||||
|
||||
namespace aux {
|
||||
|
||||
template<
|
||||
bool C1 = false, bool C2 = false, bool C3 = false, bool C4 = false
|
||||
, bool C5 = false
|
||||
>
|
||||
struct lambda_or
|
||||
: true_
|
||||
{
|
||||
};
|
||||
|
||||
template<>
|
||||
struct lambda_or< false,false,false,false,false >
|
||||
: false_
|
||||
{
|
||||
};
|
||||
|
||||
} // namespace aux
|
||||
|
||||
template<
|
||||
typename T
|
||||
, typename Tag
|
||||
, typename Arity
|
||||
>
|
||||
struct lambda
|
||||
{
|
||||
typedef false_ is_le;
|
||||
typedef T result_;
|
||||
typedef T type;
|
||||
};
|
||||
|
||||
template<
|
||||
typename T
|
||||
>
|
||||
struct is_lambda_expression
|
||||
: lambda<T>::is_le
|
||||
{
|
||||
};
|
||||
|
||||
template< int N, typename Tag >
|
||||
struct lambda< arg<N>,Tag, int_< -1 > >
|
||||
{
|
||||
typedef true_ is_le;
|
||||
typedef mpl::arg<N> result_; // qualified for the sake of MIPSpro 7.41
|
||||
typedef mpl::protect<result_> type;
|
||||
};
|
||||
|
||||
template<
|
||||
typename F
|
||||
, typename Tag
|
||||
>
|
||||
struct lambda<
|
||||
bind0<F>
|
||||
, Tag
|
||||
, int_<1>
|
||||
>
|
||||
{
|
||||
typedef false_ is_le;
|
||||
typedef bind0<
|
||||
F
|
||||
> result_;
|
||||
|
||||
typedef result_ type;
|
||||
};
|
||||
|
||||
namespace aux {
|
||||
|
||||
template<
|
||||
typename IsLE, typename Tag
|
||||
, template< typename P1 > class F
|
||||
, typename L1
|
||||
>
|
||||
struct le_result1
|
||||
{
|
||||
typedef F<
|
||||
typename L1::type
|
||||
> result_;
|
||||
|
||||
typedef result_ type;
|
||||
};
|
||||
|
||||
template<
|
||||
typename Tag
|
||||
, template< typename P1 > class F
|
||||
, typename L1
|
||||
>
|
||||
struct le_result1< true_,Tag,F,L1 >
|
||||
{
|
||||
typedef bind1<
|
||||
quote1< F,Tag >
|
||||
, typename L1::result_
|
||||
> result_;
|
||||
|
||||
typedef mpl::protect<result_> type;
|
||||
};
|
||||
|
||||
} // namespace aux
|
||||
|
||||
template<
|
||||
template< typename P1 > class F
|
||||
, typename T1
|
||||
, typename Tag
|
||||
>
|
||||
struct lambda<
|
||||
F<T1>
|
||||
, Tag
|
||||
, int_<1>
|
||||
>
|
||||
{
|
||||
typedef lambda< T1,Tag > l1;
|
||||
typedef typename l1::is_le is_le1;
|
||||
typedef typename aux::lambda_or<
|
||||
is_le1::value
|
||||
>::type is_le;
|
||||
|
||||
typedef aux::le_result1<
|
||||
is_le, Tag, F, l1
|
||||
> le_result_;
|
||||
|
||||
typedef typename le_result_::result_ result_;
|
||||
typedef typename le_result_::type type;
|
||||
};
|
||||
|
||||
template<
|
||||
typename F, typename T1
|
||||
, typename Tag
|
||||
>
|
||||
struct lambda<
|
||||
bind1< F,T1 >
|
||||
, Tag
|
||||
, int_<2>
|
||||
>
|
||||
{
|
||||
typedef false_ is_le;
|
||||
typedef bind1<
|
||||
F
|
||||
, T1
|
||||
> result_;
|
||||
|
||||
typedef result_ type;
|
||||
};
|
||||
|
||||
namespace aux {
|
||||
|
||||
template<
|
||||
typename IsLE, typename Tag
|
||||
, template< typename P1, typename P2 > class F
|
||||
, typename L1, typename L2
|
||||
>
|
||||
struct le_result2
|
||||
{
|
||||
typedef F<
|
||||
typename L1::type, typename L2::type
|
||||
> result_;
|
||||
|
||||
typedef result_ type;
|
||||
};
|
||||
|
||||
template<
|
||||
typename Tag
|
||||
, template< typename P1, typename P2 > class F
|
||||
, typename L1, typename L2
|
||||
>
|
||||
struct le_result2< true_,Tag,F,L1,L2 >
|
||||
{
|
||||
typedef bind2<
|
||||
quote2< F,Tag >
|
||||
, typename L1::result_, typename L2::result_
|
||||
> result_;
|
||||
|
||||
typedef mpl::protect<result_> type;
|
||||
};
|
||||
|
||||
} // namespace aux
|
||||
|
||||
template<
|
||||
template< typename P1, typename P2 > class F
|
||||
, typename T1, typename T2
|
||||
, typename Tag
|
||||
>
|
||||
struct lambda<
|
||||
F< T1,T2 >
|
||||
, Tag
|
||||
, int_<2>
|
||||
>
|
||||
{
|
||||
typedef lambda< T1,Tag > l1;
|
||||
typedef lambda< T2,Tag > l2;
|
||||
|
||||
typedef typename l1::is_le is_le1;
|
||||
typedef typename l2::is_le is_le2;
|
||||
|
||||
|
||||
typedef typename aux::lambda_or<
|
||||
is_le1::value, is_le2::value
|
||||
>::type is_le;
|
||||
|
||||
typedef aux::le_result2<
|
||||
is_le, Tag, F, l1, l2
|
||||
> le_result_;
|
||||
|
||||
typedef typename le_result_::result_ result_;
|
||||
typedef typename le_result_::type type;
|
||||
};
|
||||
|
||||
template<
|
||||
typename F, typename T1, typename T2
|
||||
, typename Tag
|
||||
>
|
||||
struct lambda<
|
||||
bind2< F,T1,T2 >
|
||||
, Tag
|
||||
, int_<3>
|
||||
>
|
||||
{
|
||||
typedef false_ is_le;
|
||||
typedef bind2<
|
||||
F
|
||||
, T1, T2
|
||||
> result_;
|
||||
|
||||
typedef result_ type;
|
||||
};
|
||||
|
||||
namespace aux {
|
||||
|
||||
template<
|
||||
typename IsLE, typename Tag
|
||||
, template< typename P1, typename P2, typename P3 > class F
|
||||
, typename L1, typename L2, typename L3
|
||||
>
|
||||
struct le_result3
|
||||
{
|
||||
typedef F<
|
||||
typename L1::type, typename L2::type, typename L3::type
|
||||
> result_;
|
||||
|
||||
typedef result_ type;
|
||||
};
|
||||
|
||||
template<
|
||||
typename Tag
|
||||
, template< typename P1, typename P2, typename P3 > class F
|
||||
, typename L1, typename L2, typename L3
|
||||
>
|
||||
struct le_result3< true_,Tag,F,L1,L2,L3 >
|
||||
{
|
||||
typedef bind3<
|
||||
quote3< F,Tag >
|
||||
, typename L1::result_, typename L2::result_, typename L3::result_
|
||||
> result_;
|
||||
|
||||
typedef mpl::protect<result_> type;
|
||||
};
|
||||
|
||||
} // namespace aux
|
||||
|
||||
template<
|
||||
template< typename P1, typename P2, typename P3 > class F
|
||||
, typename T1, typename T2, typename T3
|
||||
, typename Tag
|
||||
>
|
||||
struct lambda<
|
||||
F< T1,T2,T3 >
|
||||
, Tag
|
||||
, int_<3>
|
||||
>
|
||||
{
|
||||
typedef lambda< T1,Tag > l1;
|
||||
typedef lambda< T2,Tag > l2;
|
||||
typedef lambda< T3,Tag > l3;
|
||||
|
||||
typedef typename l1::is_le is_le1;
|
||||
typedef typename l2::is_le is_le2;
|
||||
typedef typename l3::is_le is_le3;
|
||||
|
||||
|
||||
typedef typename aux::lambda_or<
|
||||
is_le1::value, is_le2::value, is_le3::value
|
||||
>::type is_le;
|
||||
|
||||
typedef aux::le_result3<
|
||||
is_le, Tag, F, l1, l2, l3
|
||||
> le_result_;
|
||||
|
||||
typedef typename le_result_::result_ result_;
|
||||
typedef typename le_result_::type type;
|
||||
};
|
||||
|
||||
template<
|
||||
typename F, typename T1, typename T2, typename T3
|
||||
, typename Tag
|
||||
>
|
||||
struct lambda<
|
||||
bind3< F,T1,T2,T3 >
|
||||
, Tag
|
||||
, int_<4>
|
||||
>
|
||||
{
|
||||
typedef false_ is_le;
|
||||
typedef bind3<
|
||||
F
|
||||
, T1, T2, T3
|
||||
> result_;
|
||||
|
||||
typedef result_ type;
|
||||
};
|
||||
|
||||
namespace aux {
|
||||
|
||||
template<
|
||||
typename IsLE, typename Tag
|
||||
, template< typename P1, typename P2, typename P3, typename P4 > class F
|
||||
, typename L1, typename L2, typename L3, typename L4
|
||||
>
|
||||
struct le_result4
|
||||
{
|
||||
typedef F<
|
||||
typename L1::type, typename L2::type, typename L3::type
|
||||
, typename L4::type
|
||||
> result_;
|
||||
|
||||
typedef result_ type;
|
||||
};
|
||||
|
||||
template<
|
||||
typename Tag
|
||||
, template< typename P1, typename P2, typename P3, typename P4 > class F
|
||||
, typename L1, typename L2, typename L3, typename L4
|
||||
>
|
||||
struct le_result4< true_,Tag,F,L1,L2,L3,L4 >
|
||||
{
|
||||
typedef bind4<
|
||||
quote4< F,Tag >
|
||||
, typename L1::result_, typename L2::result_, typename L3::result_
|
||||
, typename L4::result_
|
||||
> result_;
|
||||
|
||||
typedef mpl::protect<result_> type;
|
||||
};
|
||||
|
||||
} // namespace aux
|
||||
|
||||
template<
|
||||
template< typename P1, typename P2, typename P3, typename P4 > class F
|
||||
, typename T1, typename T2, typename T3, typename T4
|
||||
, typename Tag
|
||||
>
|
||||
struct lambda<
|
||||
F< T1,T2,T3,T4 >
|
||||
, Tag
|
||||
, int_<4>
|
||||
>
|
||||
{
|
||||
typedef lambda< T1,Tag > l1;
|
||||
typedef lambda< T2,Tag > l2;
|
||||
typedef lambda< T3,Tag > l3;
|
||||
typedef lambda< T4,Tag > l4;
|
||||
|
||||
typedef typename l1::is_le is_le1;
|
||||
typedef typename l2::is_le is_le2;
|
||||
typedef typename l3::is_le is_le3;
|
||||
typedef typename l4::is_le is_le4;
|
||||
|
||||
|
||||
typedef typename aux::lambda_or<
|
||||
is_le1::value, is_le2::value, is_le3::value, is_le4::value
|
||||
>::type is_le;
|
||||
|
||||
typedef aux::le_result4<
|
||||
is_le, Tag, F, l1, l2, l3, l4
|
||||
> le_result_;
|
||||
|
||||
typedef typename le_result_::result_ result_;
|
||||
typedef typename le_result_::type type;
|
||||
};
|
||||
|
||||
template<
|
||||
typename F, typename T1, typename T2, typename T3, typename T4
|
||||
, typename Tag
|
||||
>
|
||||
struct lambda<
|
||||
bind4< F,T1,T2,T3,T4 >
|
||||
, Tag
|
||||
, int_<5>
|
||||
>
|
||||
{
|
||||
typedef false_ is_le;
|
||||
typedef bind4<
|
||||
F
|
||||
, T1, T2, T3, T4
|
||||
> result_;
|
||||
|
||||
typedef result_ type;
|
||||
};
|
||||
|
||||
namespace aux {
|
||||
|
||||
template<
|
||||
typename IsLE, typename Tag
|
||||
, template< typename P1, typename P2, typename P3, typename P4, typename P5 > class F
|
||||
, typename L1, typename L2, typename L3, typename L4, typename L5
|
||||
>
|
||||
struct le_result5
|
||||
{
|
||||
typedef F<
|
||||
typename L1::type, typename L2::type, typename L3::type
|
||||
, typename L4::type, typename L5::type
|
||||
> result_;
|
||||
|
||||
typedef result_ type;
|
||||
};
|
||||
|
||||
template<
|
||||
typename Tag
|
||||
, template< typename P1, typename P2, typename P3, typename P4, typename P5 > class F
|
||||
, typename L1, typename L2, typename L3, typename L4, typename L5
|
||||
>
|
||||
struct le_result5< true_,Tag,F,L1,L2,L3,L4,L5 >
|
||||
{
|
||||
typedef bind5<
|
||||
quote5< F,Tag >
|
||||
, typename L1::result_, typename L2::result_, typename L3::result_
|
||||
, typename L4::result_, typename L5::result_
|
||||
> result_;
|
||||
|
||||
typedef mpl::protect<result_> type;
|
||||
};
|
||||
|
||||
} // namespace aux
|
||||
|
||||
template<
|
||||
template<
|
||||
typename P1, typename P2, typename P3, typename P4
|
||||
, typename P5
|
||||
>
|
||||
class F
|
||||
, typename T1, typename T2, typename T3, typename T4, typename T5
|
||||
, typename Tag
|
||||
>
|
||||
struct lambda<
|
||||
F< T1,T2,T3,T4,T5 >
|
||||
, Tag
|
||||
, int_<5>
|
||||
>
|
||||
{
|
||||
typedef lambda< T1,Tag > l1;
|
||||
typedef lambda< T2,Tag > l2;
|
||||
typedef lambda< T3,Tag > l3;
|
||||
typedef lambda< T4,Tag > l4;
|
||||
typedef lambda< T5,Tag > l5;
|
||||
|
||||
typedef typename l1::is_le is_le1;
|
||||
typedef typename l2::is_le is_le2;
|
||||
typedef typename l3::is_le is_le3;
|
||||
typedef typename l4::is_le is_le4;
|
||||
typedef typename l5::is_le is_le5;
|
||||
|
||||
|
||||
typedef typename aux::lambda_or<
|
||||
is_le1::value, is_le2::value, is_le3::value, is_le4::value
|
||||
, is_le5::value
|
||||
>::type is_le;
|
||||
|
||||
typedef aux::le_result5<
|
||||
is_le, Tag, F, l1, l2, l3, l4, l5
|
||||
> le_result_;
|
||||
|
||||
typedef typename le_result_::result_ result_;
|
||||
typedef typename le_result_::type type;
|
||||
};
|
||||
|
||||
template<
|
||||
typename F, typename T1, typename T2, typename T3, typename T4
|
||||
, typename T5
|
||||
, typename Tag
|
||||
>
|
||||
struct lambda<
|
||||
bind5< F,T1,T2,T3,T4,T5 >
|
||||
, Tag
|
||||
, int_<6>
|
||||
>
|
||||
{
|
||||
typedef false_ is_le;
|
||||
typedef bind5<
|
||||
F
|
||||
, T1, T2, T3, T4, T5
|
||||
> result_;
|
||||
|
||||
typedef result_ type;
|
||||
};
|
||||
|
||||
/// special case for 'protect'
|
||||
template< typename T, typename Tag >
|
||||
struct lambda< mpl::protect<T>,Tag, int_<1> >
|
||||
{
|
||||
typedef false_ is_le;
|
||||
typedef mpl::protect<T> result_;
|
||||
typedef result_ type;
|
||||
};
|
||||
|
||||
/// specializations for the main 'bind' form
|
||||
|
||||
template<
|
||||
typename F, typename T1, typename T2, typename T3, typename T4
|
||||
, typename T5
|
||||
, typename Tag
|
||||
>
|
||||
struct lambda<
|
||||
bind< F,T1,T2,T3,T4,T5 >
|
||||
, Tag
|
||||
, int_<6>
|
||||
>
|
||||
{
|
||||
typedef false_ is_le;
|
||||
typedef bind< F,T1,T2,T3,T4,T5 > result_;
|
||||
typedef result_ type;
|
||||
};
|
||||
|
||||
template<
|
||||
typename F
|
||||
, typename Tag1
|
||||
, typename Tag2
|
||||
, typename Arity
|
||||
>
|
||||
struct lambda<
|
||||
lambda< F,Tag1,Arity >
|
||||
, Tag2
|
||||
, int_<3>
|
||||
>
|
||||
{
|
||||
typedef lambda< F,Tag2 > l1;
|
||||
typedef lambda< Tag1,Tag2 > l2;
|
||||
typedef typename l1::is_le is_le;
|
||||
typedef bind1< quote1<aux::template_arity>, typename l1::result_ > arity_;
|
||||
typedef lambda< typename if_< is_le,arity_,Arity >::type, Tag2 > l3;
|
||||
typedef aux::le_result3<is_le, Tag2, mpl::lambda, l1, l2, l3> le_result_;
|
||||
typedef typename le_result_::result_ result_;
|
||||
typedef typename le_result_::type type;
|
||||
};
|
||||
|
||||
BOOST_MPL_AUX_NA_SPEC2(2, 3, lambda)
|
||||
|
||||
}}
|
||||
|
||||
@@ -0,0 +1,35 @@
|
||||
// Copyright (C) 2013 Vicente J. Botet Escriba
|
||||
//
|
||||
// Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
//
|
||||
// 2013/10 Vicente J. Botet Escriba
|
||||
// Creation.
|
||||
|
||||
#ifndef BOOST_CSBL_MEMORY_ALLOCATOR_TRAITS_HPP
|
||||
#define BOOST_CSBL_MEMORY_ALLOCATOR_TRAITS_HPP
|
||||
|
||||
#include <boost/thread/csbl/memory/config.hpp>
|
||||
|
||||
// 20.7.8, allocator traits
|
||||
#if defined BOOST_NO_CXX11_ALLOCATOR
|
||||
#include <boost/container/allocator_traits.hpp>
|
||||
|
||||
namespace boost
|
||||
{
|
||||
namespace csbl
|
||||
{
|
||||
using ::boost::container::allocator_traits;
|
||||
}
|
||||
}
|
||||
#else
|
||||
namespace boost
|
||||
{
|
||||
namespace csbl
|
||||
{
|
||||
using ::std::allocator_traits;
|
||||
}
|
||||
}
|
||||
#endif // BOOST_NO_CXX11_POINTER_TRAITS
|
||||
|
||||
#endif // header
|
||||
@@ -0,0 +1,84 @@
|
||||
#ifndef WSPR_BAND_HOPPING_HPP__
|
||||
#define WSPR_BAND_HOPPING_HPP__
|
||||
|
||||
#include <QObject>
|
||||
|
||||
#include "pimpl_h.hpp"
|
||||
|
||||
class QSettings;
|
||||
class Configuration;
|
||||
class QWidget;
|
||||
|
||||
//
|
||||
// WSPR Band Hopping Control
|
||||
//
|
||||
// WSPR specifies a globally coordinated band hopping schedule and
|
||||
// this class implements that.
|
||||
//
|
||||
// Responsibilities
|
||||
//
|
||||
// Provides a maintenance dialog allowing the user to define which
|
||||
// bands are allowed from the band hopping schedule as defined here:
|
||||
//
|
||||
// http://physics.princeton.edu/pulsar/K1JT/doc/wspr/wspr-main.html
|
||||
//
|
||||
// Along with selecting bands a flag indicating that a short tune up
|
||||
// signal is required for specified bands before they are used for
|
||||
// receive.
|
||||
//
|
||||
// Provides a Qt property that holds the Tx percentage which is used
|
||||
// to generate a semi-randomized schedule of period to transmit. This
|
||||
// schedule is random but adjusted to limit the number of consecutive
|
||||
// transmission periods, it also adjusts the schedule to ensure that
|
||||
// the overall number of transmission periods in any two hour hopping
|
||||
// schedule reflects the percentage provided.
|
||||
//
|
||||
// Collaborations
|
||||
//
|
||||
// Settings including the selected bands with periods, the tune up
|
||||
// flags and the gray line duration are maintained in persistent
|
||||
// storage using the provided QSettings object instance.
|
||||
//
|
||||
// A passed in Configuration object instance is used to query the
|
||||
// FrequencyList model to determine working frequencies for each
|
||||
// band. The row index of this model is returned by this classes
|
||||
// hopping scheduling method so it may be conveniently used to select
|
||||
// a new working frequency by a client.
|
||||
//
|
||||
class WSPRBandHopping
|
||||
: public QObject
|
||||
{
|
||||
Q_OBJECT;
|
||||
Q_PROPERTY (int tx_percent READ tx_percent WRITE set_tx_percent);
|
||||
|
||||
public:
|
||||
WSPRBandHopping (QSettings *, Configuration const *, QWidget * parent = nullptr);
|
||||
~WSPRBandHopping ();
|
||||
|
||||
// display the band hopping maintenance dialog
|
||||
Q_SLOT void show_dialog (bool);
|
||||
|
||||
// Property tx_percent implementation
|
||||
int tx_percent () const;
|
||||
Q_SLOT void set_tx_percent (int);
|
||||
|
||||
// structure that defines the results of the next_hop() method
|
||||
struct Hop
|
||||
{
|
||||
QString period_name_;
|
||||
int frequencies_index_; // may be -1 indicating no change
|
||||
bool tune_required_;
|
||||
bool tx_next_;
|
||||
};
|
||||
// return the next band parameters
|
||||
Hop next_hop (bool tx_enabled);
|
||||
// determine if the next period should be a transmit period
|
||||
bool next_is_tx (bool simple_schedule = false);
|
||||
|
||||
private:
|
||||
// implementation hidden from public interface
|
||||
class impl;
|
||||
pimpl<impl> m_;
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,30 @@
|
||||
# /* **************************************************************************
|
||||
# * *
|
||||
# * (C) Copyright Edward Diener 2011. *
|
||||
# * (C) Copyright Paul Mensonides 2011. *
|
||||
# * Distributed under the Boost Software License, Version 1.0. (See *
|
||||
# * accompanying file LICENSE_1_0.txt or copy at *
|
||||
# * http://www.boost.org/LICENSE_1_0.txt) *
|
||||
# * *
|
||||
# ************************************************************************** */
|
||||
#
|
||||
# /* See http://www.boost.org for most recent version. */
|
||||
#
|
||||
# ifndef BOOST_PREPROCESSOR_VARIADIC_SIZE_HPP
|
||||
# define BOOST_PREPROCESSOR_VARIADIC_SIZE_HPP
|
||||
#
|
||||
# include <boost/preprocessor/cat.hpp>
|
||||
# include <boost/preprocessor/config/config.hpp>
|
||||
#
|
||||
# /* BOOST_PP_VARIADIC_SIZE */
|
||||
#
|
||||
# if BOOST_PP_VARIADICS
|
||||
# if BOOST_PP_VARIADICS_MSVC
|
||||
# define BOOST_PP_VARIADIC_SIZE(...) BOOST_PP_CAT(BOOST_PP_VARIADIC_SIZE_I(__VA_ARGS__, 64, 63, 62, 61, 60, 59, 58, 57, 56, 55, 54, 53, 52, 51, 50, 49, 48, 47, 46, 45, 44, 43, 42, 41, 40, 39, 38, 37, 36, 35, 34, 33, 32, 31, 30, 29, 28, 27, 26, 25, 24, 23, 22, 21, 20, 19, 18, 17, 16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1,),)
|
||||
# else
|
||||
# define BOOST_PP_VARIADIC_SIZE(...) BOOST_PP_VARIADIC_SIZE_I(__VA_ARGS__, 64, 63, 62, 61, 60, 59, 58, 57, 56, 55, 54, 53, 52, 51, 50, 49, 48, 47, 46, 45, 44, 43, 42, 41, 40, 39, 38, 37, 36, 35, 34, 33, 32, 31, 30, 29, 28, 27, 26, 25, 24, 23, 22, 21, 20, 19, 18, 17, 16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1,)
|
||||
# endif
|
||||
# define BOOST_PP_VARIADIC_SIZE_I(e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13, e14, e15, e16, e17, e18, e19, e20, e21, e22, e23, e24, e25, e26, e27, e28, e29, e30, e31, e32, e33, e34, e35, e36, e37, e38, e39, e40, e41, e42, e43, e44, e45, e46, e47, e48, e49, e50, e51, e52, e53, e54, e55, e56, e57, e58, e59, e60, e61, e62, e63, size, ...) size
|
||||
# endif
|
||||
#
|
||||
# endif
|
||||
@@ -0,0 +1,51 @@
|
||||
// normrnd.h
|
||||
// Functions to generate gaussian distributed numbers
|
||||
//
|
||||
// (c) 2016 - Nico Palermo, IV3NWV - Microtelecom Srl, Italy
|
||||
// ------------------------------------------------------------------------------
|
||||
// This file is part of the qracodes project, a Forward Error Control
|
||||
// encoding/decoding package based on Q-ary RA (Repeat and Accumulate) LDPC codes.
|
||||
//
|
||||
// qracodes is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
// qracodes is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with qracodes source distribution.
|
||||
// If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
#ifndef _normrnd_h_
|
||||
#define _normrnd_h_
|
||||
|
||||
#define _CRT_RAND_S
|
||||
#include <stdlib.h>
|
||||
|
||||
#define _USE_MATH_DEFINES
|
||||
#include <math.h>
|
||||
#define M_2PI (2.0f*(float)M_PI)
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
void normrnd_s(float *dst, int nitems, float mean, float stdev);
|
||||
// generate a random array of numbers with a gaussian distribution of given mean and stdev
|
||||
// use MS rand_s(...) function
|
||||
|
||||
/* not used
|
||||
void normrnd(float *dst, int nitems, float mean, float stdev);
|
||||
// generate a random array of numbers with a gaussian distribution of given mean and stdev
|
||||
// use MS rand() function
|
||||
*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif // _normrnd_h_
|
||||
|
||||
@@ -0,0 +1,280 @@
|
||||
//-----------------------------------------------------------------------------
|
||||
// boost variant/detail/apply_visitor_binary.hpp header file
|
||||
// See http://www.boost.org for updates, documentation, and revision history.
|
||||
//-----------------------------------------------------------------------------
|
||||
//
|
||||
// Copyright (c) 2002-2003 Eric Friedman
|
||||
// Copyright (c) 2014 Antony Polukhin
|
||||
//
|
||||
// Distributed under the Boost Software License, Version 1.0. (See
|
||||
// accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
#ifndef BOOST_VARIANT_DETAIL_APPLY_VISITOR_BINARY_HPP
|
||||
#define BOOST_VARIANT_DETAIL_APPLY_VISITOR_BINARY_HPP
|
||||
|
||||
#include <boost/config.hpp>
|
||||
#include <boost/detail/workaround.hpp>
|
||||
#include <boost/variant/detail/generic_result_type.hpp>
|
||||
|
||||
#include <boost/variant/detail/apply_visitor_unary.hpp>
|
||||
|
||||
#if BOOST_WORKAROUND(__EDG__, BOOST_TESTED_AT(302))
|
||||
#include <boost/utility/enable_if.hpp>
|
||||
#include <boost/mpl/not.hpp>
|
||||
#include <boost/type_traits/is_const.hpp>
|
||||
#endif
|
||||
|
||||
|
||||
#if !defined(BOOST_NO_CXX14_DECLTYPE_AUTO) && !defined(BOOST_NO_CXX11_DECLTYPE_N3276)
|
||||
# include <boost/variant/detail/has_result_type.hpp>
|
||||
#endif
|
||||
|
||||
namespace boost {
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
// function template apply_visitor(visitor, visitable1, visitable2)
|
||||
//
|
||||
// Visits visitable1 and visitable2 such that their values (which we
|
||||
// shall call x and y, respectively) are used as arguments in the
|
||||
// expression visitor(x, y).
|
||||
//
|
||||
|
||||
namespace detail { namespace variant {
|
||||
|
||||
template <typename Visitor, typename Value1>
|
||||
class apply_visitor_binary_invoke
|
||||
{
|
||||
public: // visitor typedefs
|
||||
|
||||
typedef typename Visitor::result_type
|
||||
result_type;
|
||||
|
||||
private: // representation
|
||||
|
||||
Visitor& visitor_;
|
||||
Value1& value1_;
|
||||
|
||||
public: // structors
|
||||
|
||||
apply_visitor_binary_invoke(Visitor& visitor, Value1& value1) BOOST_NOEXCEPT
|
||||
: visitor_(visitor)
|
||||
, value1_(value1)
|
||||
{
|
||||
}
|
||||
|
||||
public: // visitor interfaces
|
||||
|
||||
template <typename Value2>
|
||||
BOOST_VARIANT_AUX_GENERIC_RESULT_TYPE(result_type)
|
||||
operator()(Value2& value2)
|
||||
{
|
||||
return visitor_(value1_, value2);
|
||||
}
|
||||
|
||||
private:
|
||||
apply_visitor_binary_invoke& operator=(const apply_visitor_binary_invoke&);
|
||||
};
|
||||
|
||||
template <typename Visitor, typename Visitable2>
|
||||
class apply_visitor_binary_unwrap
|
||||
{
|
||||
public: // visitor typedefs
|
||||
|
||||
typedef typename Visitor::result_type
|
||||
result_type;
|
||||
|
||||
private: // representation
|
||||
|
||||
Visitor& visitor_;
|
||||
Visitable2& visitable2_;
|
||||
|
||||
public: // structors
|
||||
|
||||
apply_visitor_binary_unwrap(Visitor& visitor, Visitable2& visitable2) BOOST_NOEXCEPT
|
||||
: visitor_(visitor)
|
||||
, visitable2_(visitable2)
|
||||
{
|
||||
}
|
||||
|
||||
public: // visitor interfaces
|
||||
|
||||
template <typename Value1>
|
||||
BOOST_VARIANT_AUX_GENERIC_RESULT_TYPE(result_type)
|
||||
operator()(Value1& value1)
|
||||
{
|
||||
apply_visitor_binary_invoke<
|
||||
Visitor
|
||||
, Value1
|
||||
> invoker(visitor_, value1);
|
||||
|
||||
return boost::apply_visitor(invoker, visitable2_);
|
||||
}
|
||||
|
||||
private:
|
||||
apply_visitor_binary_unwrap& operator=(const apply_visitor_binary_unwrap&);
|
||||
|
||||
};
|
||||
|
||||
}} // namespace detail::variant
|
||||
|
||||
//
|
||||
// nonconst-visitor version:
|
||||
//
|
||||
|
||||
#if !BOOST_WORKAROUND(__EDG__, BOOST_TESTED_AT(302))
|
||||
|
||||
# define BOOST_VARIANT_AUX_APPLY_VISITOR_NON_CONST_RESULT_TYPE(V) \
|
||||
BOOST_VARIANT_AUX_GENERIC_RESULT_TYPE(typename V::result_type) \
|
||||
/**/
|
||||
|
||||
#else // EDG-based compilers
|
||||
|
||||
# define BOOST_VARIANT_AUX_APPLY_VISITOR_NON_CONST_RESULT_TYPE(V) \
|
||||
typename enable_if< \
|
||||
mpl::not_< is_const< V > > \
|
||||
, BOOST_VARIANT_AUX_GENERIC_RESULT_TYPE(typename V::result_type) \
|
||||
>::type \
|
||||
/**/
|
||||
|
||||
#endif // EDG-based compilers workaround
|
||||
|
||||
template <typename Visitor, typename Visitable1, typename Visitable2>
|
||||
inline
|
||||
BOOST_VARIANT_AUX_APPLY_VISITOR_NON_CONST_RESULT_TYPE(Visitor)
|
||||
apply_visitor(
|
||||
Visitor& visitor
|
||||
, Visitable1& visitable1, Visitable2& visitable2
|
||||
)
|
||||
{
|
||||
::boost::detail::variant::apply_visitor_binary_unwrap<
|
||||
Visitor, Visitable2
|
||||
> unwrapper(visitor, visitable2);
|
||||
|
||||
return boost::apply_visitor(unwrapper, visitable1);
|
||||
}
|
||||
|
||||
#undef BOOST_VARIANT_AUX_APPLY_VISITOR_NON_CONST_RESULT_TYPE
|
||||
|
||||
//
|
||||
// const-visitor version:
|
||||
//
|
||||
|
||||
template <typename Visitor, typename Visitable1, typename Visitable2>
|
||||
inline
|
||||
BOOST_VARIANT_AUX_GENERIC_RESULT_TYPE(
|
||||
typename Visitor::result_type
|
||||
)
|
||||
apply_visitor(
|
||||
const Visitor& visitor
|
||||
, Visitable1& visitable1, Visitable2& visitable2
|
||||
)
|
||||
{
|
||||
::boost::detail::variant::apply_visitor_binary_unwrap<
|
||||
const Visitor, Visitable2
|
||||
> unwrapper(visitor, visitable2);
|
||||
|
||||
return boost::apply_visitor(unwrapper, visitable1);
|
||||
}
|
||||
|
||||
|
||||
#if !defined(BOOST_NO_CXX14_DECLTYPE_AUTO) && !defined(BOOST_NO_CXX11_DECLTYPE_N3276)
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
// function template apply_visitor(visitor, visitable1, visitable2)
|
||||
//
|
||||
// C++14 part.
|
||||
//
|
||||
|
||||
namespace detail { namespace variant {
|
||||
|
||||
template <typename Visitor, typename Value1>
|
||||
class apply_visitor_binary_invoke_cpp14
|
||||
{
|
||||
Visitor& visitor_;
|
||||
Value1& value1_;
|
||||
|
||||
public: // structors
|
||||
|
||||
apply_visitor_binary_invoke_cpp14(Visitor& visitor, Value1& value1) BOOST_NOEXCEPT
|
||||
: visitor_(visitor)
|
||||
, value1_(value1)
|
||||
{
|
||||
}
|
||||
|
||||
public: // visitor interfaces
|
||||
|
||||
template <typename Value2>
|
||||
decltype(auto) operator()(Value2& value2)
|
||||
{
|
||||
return visitor_(value1_, value2);
|
||||
}
|
||||
|
||||
private:
|
||||
apply_visitor_binary_invoke_cpp14& operator=(const apply_visitor_binary_invoke_cpp14&);
|
||||
};
|
||||
|
||||
template <typename Visitor, typename Visitable2>
|
||||
class apply_visitor_binary_unwrap_cpp14
|
||||
{
|
||||
Visitor& visitor_;
|
||||
Visitable2& visitable2_;
|
||||
|
||||
public: // structors
|
||||
|
||||
apply_visitor_binary_unwrap_cpp14(Visitor& visitor, Visitable2& visitable2) BOOST_NOEXCEPT
|
||||
: visitor_(visitor)
|
||||
, visitable2_(visitable2)
|
||||
{
|
||||
}
|
||||
|
||||
public: // visitor interfaces
|
||||
|
||||
template <typename Value1>
|
||||
decltype(auto) operator()(Value1& value1)
|
||||
{
|
||||
apply_visitor_binary_invoke_cpp14<
|
||||
Visitor
|
||||
, Value1
|
||||
> invoker(visitor_, value1);
|
||||
|
||||
return boost::apply_visitor(invoker, visitable2_);
|
||||
}
|
||||
|
||||
private:
|
||||
apply_visitor_binary_unwrap_cpp14& operator=(const apply_visitor_binary_unwrap_cpp14&);
|
||||
};
|
||||
|
||||
}} // namespace detail::variant
|
||||
|
||||
template <typename Visitor, typename Visitable1, typename Visitable2>
|
||||
inline decltype(auto) apply_visitor(Visitor& visitor, Visitable1& visitable1, Visitable2& visitable2,
|
||||
typename boost::disable_if<
|
||||
boost::detail::variant::has_result_type<Visitor>
|
||||
>::type* = 0)
|
||||
{
|
||||
::boost::detail::variant::apply_visitor_binary_unwrap_cpp14<
|
||||
Visitor, Visitable2
|
||||
> unwrapper(visitor, visitable2);
|
||||
|
||||
return boost::apply_visitor(unwrapper, visitable1);
|
||||
}
|
||||
|
||||
template <typename Visitor, typename Visitable1, typename Visitable2>
|
||||
inline decltype(auto) apply_visitor(const Visitor& visitor, Visitable1& visitable1, Visitable2& visitable2,
|
||||
typename boost::disable_if<
|
||||
boost::detail::variant::has_result_type<Visitor>
|
||||
>::type* = 0)
|
||||
{
|
||||
::boost::detail::variant::apply_visitor_binary_unwrap_cpp14<
|
||||
const Visitor, Visitable2
|
||||
> unwrapper(visitor, visitable2);
|
||||
|
||||
return boost::apply_visitor(unwrapper, visitable1);
|
||||
}
|
||||
|
||||
#endif // !defined(BOOST_NO_CXX14_DECLTYPE_AUTO) && !defined(BOOST_NO_CXX11_DECLTYPE_N3276)
|
||||
|
||||
} // namespace boost
|
||||
|
||||
#endif // BOOST_VARIANT_DETAIL_APPLY_VISITOR_BINARY_HPP
|
||||
@@ -0,0 +1,70 @@
|
||||
// Copyright 2002 The Trustees of Indiana University.
|
||||
|
||||
// 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)
|
||||
|
||||
// Boost.MultiArray Library
|
||||
// Authors: Ronald Garcia
|
||||
// Jeremy Siek
|
||||
// Andrew Lumsdaine
|
||||
// See http://www.boost.org/libs/multi_array for documentation.
|
||||
|
||||
#ifndef RANGE_LIST_RG072501_HPP
|
||||
#define RANGE_LIST_RG072501_HPP
|
||||
//
|
||||
// range_list.hpp - helper to build boost::arrays for *_set types
|
||||
//
|
||||
|
||||
#include "boost/array.hpp"
|
||||
|
||||
namespace boost {
|
||||
namespace detail {
|
||||
namespace multi_array {
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
// choose range list begins
|
||||
//
|
||||
|
||||
struct choose_range_list_n {
|
||||
template <typename T, std::size_t NumRanges>
|
||||
struct bind {
|
||||
typedef boost::array<T,NumRanges> type;
|
||||
};
|
||||
};
|
||||
|
||||
struct choose_range_list_zero {
|
||||
template <typename T, std::size_t NumRanges>
|
||||
struct bind {
|
||||
typedef boost::array<T,1> type;
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
template <std::size_t NumRanges>
|
||||
struct range_list_gen_helper {
|
||||
typedef choose_range_list_n choice;
|
||||
};
|
||||
|
||||
template <>
|
||||
struct range_list_gen_helper<0> {
|
||||
typedef choose_range_list_zero choice;
|
||||
};
|
||||
|
||||
template <typename T, std::size_t NumRanges>
|
||||
struct range_list_generator {
|
||||
private:
|
||||
typedef typename range_list_gen_helper<NumRanges>::choice Choice;
|
||||
public:
|
||||
typedef typename Choice::template bind<T,NumRanges>::type type;
|
||||
};
|
||||
|
||||
//
|
||||
// choose range list ends
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
|
||||
} // namespace multi_array
|
||||
} // namespace detail
|
||||
} // namespace boost
|
||||
|
||||
#endif // RANGE_LIST_RG072501_HPP
|
||||
@@ -0,0 +1,31 @@
|
||||
// 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_SI_RELUCTANCE_HPP
|
||||
#define BOOST_UNITS_SI_RELUCTANCE_HPP
|
||||
|
||||
#include <boost/units/systems/si/base.hpp>
|
||||
#include <boost/units/physical_dimensions/reluctance.hpp>
|
||||
|
||||
namespace boost {
|
||||
|
||||
namespace units {
|
||||
|
||||
namespace si {
|
||||
|
||||
typedef unit<reluctance_dimension,si::system> reluctance;
|
||||
|
||||
} // namespace si
|
||||
|
||||
} // namespace units
|
||||
|
||||
} // namespace boost
|
||||
|
||||
#endif // BOOST_UNITS_SI_RELUCTANCE_HPP
|
||||
@@ -0,0 +1,47 @@
|
||||
// Copyright Gottfried Ganßauge 2003.
|
||||
// Distributed under the Boost Software License, Version 1.0. (See
|
||||
// accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
/*
|
||||
* Generic Return value converter generator for opaque C++-pointers
|
||||
*/
|
||||
# ifndef RETURN_OPAQUE_POINTER_HPP_
|
||||
# define RETURN_OPAQUE_POINTER_HPP_
|
||||
|
||||
# include <boost/python/detail/prefix.hpp>
|
||||
# include <boost/python/opaque_pointer_converter.hpp>
|
||||
# include <boost/python/detail/force_instantiate.hpp>
|
||||
# include <boost/python/to_python_value.hpp>
|
||||
# include <boost/python/detail/value_arg.hpp>
|
||||
# include <boost/mpl/assert.hpp>
|
||||
|
||||
namespace boost { namespace python {
|
||||
|
||||
namespace detail
|
||||
{
|
||||
template <class Pointee>
|
||||
static void opaque_pointee(Pointee const volatile*)
|
||||
{
|
||||
force_instantiate(opaque<Pointee>::instance);
|
||||
}
|
||||
}
|
||||
|
||||
struct return_opaque_pointer
|
||||
{
|
||||
template <class R>
|
||||
struct apply
|
||||
{
|
||||
BOOST_MPL_ASSERT_MSG( is_pointer<R>::value, RETURN_OPAQUE_POINTER_EXPECTS_A_POINTER_TYPE, (R));
|
||||
|
||||
struct type :
|
||||
boost::python::to_python_value<
|
||||
typename detail::value_arg<R>::type
|
||||
>
|
||||
{
|
||||
type() { detail::opaque_pointee(R()); }
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
}} // namespace boost::python
|
||||
# endif // RETURN_OPAQUE_POINTER_HPP_
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,214 @@
|
||||
/* boost random/cauchy_distribution.hpp header file
|
||||
*
|
||||
* Copyright Jens Maurer 2000-2001
|
||||
* Distributed under the Boost Software License, Version 1.0. (See
|
||||
* accompanying file LICENSE_1_0.txt or copy at
|
||||
* http://www.boost.org/LICENSE_1_0.txt)
|
||||
*
|
||||
* See http://www.boost.org for most recent version including documentation.
|
||||
*
|
||||
* $Id$
|
||||
*
|
||||
* Revision history
|
||||
* 2001-02-18 moved to individual header files
|
||||
*/
|
||||
|
||||
#ifndef BOOST_RANDOM_CAUCHY_DISTRIBUTION_HPP
|
||||
#define BOOST_RANDOM_CAUCHY_DISTRIBUTION_HPP
|
||||
|
||||
#include <boost/config/no_tr1/cmath.hpp>
|
||||
#include <iosfwd>
|
||||
#include <istream>
|
||||
#include <boost/limits.hpp>
|
||||
#include <boost/random/detail/config.hpp>
|
||||
#include <boost/random/detail/operators.hpp>
|
||||
#include <boost/random/uniform_01.hpp>
|
||||
|
||||
namespace boost {
|
||||
namespace random {
|
||||
|
||||
// Cauchy distribution:
|
||||
|
||||
/**
|
||||
* The cauchy distribution is a continuous distribution with two
|
||||
* parameters, median and sigma.
|
||||
*
|
||||
* It has \f$\displaystyle p(x) = \frac{\sigma}{\pi(\sigma^2 + (x-m)^2)}\f$
|
||||
*/
|
||||
template<class RealType = double>
|
||||
class cauchy_distribution
|
||||
{
|
||||
public:
|
||||
typedef RealType input_type;
|
||||
typedef RealType result_type;
|
||||
|
||||
class param_type
|
||||
{
|
||||
public:
|
||||
|
||||
typedef cauchy_distribution distribution_type;
|
||||
|
||||
/** Constructs the parameters of the cauchy distribution. */
|
||||
explicit param_type(RealType median_arg = RealType(0.0),
|
||||
RealType sigma_arg = RealType(1.0))
|
||||
: _median(median_arg), _sigma(sigma_arg) {}
|
||||
|
||||
// backwards compatibility for Boost.Random
|
||||
|
||||
/** Returns the median of the distribution. */
|
||||
RealType median() const { return _median; }
|
||||
/** Returns the sigma parameter of the distribution. */
|
||||
RealType sigma() const { return _sigma; }
|
||||
|
||||
// The new names in C++0x.
|
||||
|
||||
/** Returns the median of the distribution. */
|
||||
RealType a() const { return _median; }
|
||||
/** Returns the sigma parameter of the distribution. */
|
||||
RealType b() const { return _sigma; }
|
||||
|
||||
/** Writes the parameters to a std::ostream. */
|
||||
BOOST_RANDOM_DETAIL_OSTREAM_OPERATOR(os, param_type, parm)
|
||||
{
|
||||
os << parm._median << " " << parm._sigma;
|
||||
return os;
|
||||
}
|
||||
|
||||
/** Reads the parameters from a std::istream. */
|
||||
BOOST_RANDOM_DETAIL_ISTREAM_OPERATOR(is, param_type, parm)
|
||||
{
|
||||
is >> parm._median >> std::ws >> parm._sigma;
|
||||
return is;
|
||||
}
|
||||
|
||||
/** Returns true if the two sets of parameters are equal. */
|
||||
BOOST_RANDOM_DETAIL_EQUALITY_OPERATOR(param_type, lhs, rhs)
|
||||
{ return lhs._median == rhs._median && lhs._sigma == rhs._sigma; }
|
||||
|
||||
/** Returns true if the two sets of parameters are different. */
|
||||
BOOST_RANDOM_DETAIL_INEQUALITY_OPERATOR(param_type)
|
||||
|
||||
private:
|
||||
RealType _median;
|
||||
RealType _sigma;
|
||||
};
|
||||
|
||||
/**
|
||||
* Constructs a \cauchy_distribution with the paramters @c median
|
||||
* and @c sigma.
|
||||
*/
|
||||
explicit cauchy_distribution(RealType median_arg = RealType(0.0),
|
||||
RealType sigma_arg = RealType(1.0))
|
||||
: _median(median_arg), _sigma(sigma_arg) { }
|
||||
|
||||
/**
|
||||
* Constructs a \cauchy_distribution from it's parameters.
|
||||
*/
|
||||
explicit cauchy_distribution(const param_type& parm)
|
||||
: _median(parm.median()), _sigma(parm.sigma()) { }
|
||||
|
||||
// compiler-generated copy ctor and assignment operator are fine
|
||||
|
||||
// backwards compatibility for Boost.Random
|
||||
|
||||
/** Returns: the "median" parameter of the distribution */
|
||||
RealType median() const { return _median; }
|
||||
/** Returns: the "sigma" parameter of the distribution */
|
||||
RealType sigma() const { return _sigma; }
|
||||
|
||||
// The new names in C++0x
|
||||
|
||||
/** Returns: the "median" parameter of the distribution */
|
||||
RealType a() const { return _median; }
|
||||
/** Returns: the "sigma" parameter of the distribution */
|
||||
RealType b() const { return _sigma; }
|
||||
|
||||
/** Returns the smallest value that the distribution can produce. */
|
||||
RealType min BOOST_PREVENT_MACRO_SUBSTITUTION () const
|
||||
{ return -(std::numeric_limits<RealType>::infinity)(); }
|
||||
|
||||
/** Returns the largest value that the distribution can produce. */
|
||||
RealType max BOOST_PREVENT_MACRO_SUBSTITUTION () const
|
||||
{ return (std::numeric_limits<RealType>::infinity)(); }
|
||||
|
||||
param_type param() const { return param_type(_median, _sigma); }
|
||||
|
||||
void param(const param_type& parm)
|
||||
{
|
||||
_median = parm.median();
|
||||
_sigma = parm.sigma();
|
||||
}
|
||||
|
||||
/**
|
||||
* Effects: Subsequent uses of the distribution do not depend
|
||||
* on values produced by any engine prior to invoking reset.
|
||||
*/
|
||||
void reset() { }
|
||||
|
||||
/**
|
||||
* Returns: A random variate distributed according to the
|
||||
* cauchy distribution.
|
||||
*/
|
||||
template<class Engine>
|
||||
result_type operator()(Engine& eng)
|
||||
{
|
||||
// Can we have a boost::mathconst please?
|
||||
const result_type pi = result_type(3.14159265358979323846);
|
||||
using std::tan;
|
||||
RealType val = uniform_01<RealType>()(eng)-result_type(0.5);
|
||||
return _median + _sigma * tan(pi*val);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns: A random variate distributed according to the
|
||||
* cauchy distribution with parameters specified by param.
|
||||
*/
|
||||
template<class Engine>
|
||||
result_type operator()(Engine& eng, const param_type& parm)
|
||||
{
|
||||
return cauchy_distribution(parm)(eng);
|
||||
}
|
||||
|
||||
/**
|
||||
* Writes the distribution to a @c std::ostream.
|
||||
*/
|
||||
BOOST_RANDOM_DETAIL_OSTREAM_OPERATOR(os, cauchy_distribution, cd)
|
||||
{
|
||||
os << cd._median << " " << cd._sigma;
|
||||
return os;
|
||||
}
|
||||
|
||||
/**
|
||||
* Reads the distribution from a @c std::istream.
|
||||
*/
|
||||
BOOST_RANDOM_DETAIL_ISTREAM_OPERATOR(is, cauchy_distribution, cd)
|
||||
{
|
||||
is >> cd._median >> std::ws >> cd._sigma;
|
||||
return is;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns true if the two distributions will produce
|
||||
* identical sequences of values, given equal generators.
|
||||
*/
|
||||
BOOST_RANDOM_DETAIL_EQUALITY_OPERATOR(cauchy_distribution, lhs, rhs)
|
||||
{ return lhs._median == rhs._median && lhs._sigma == rhs._sigma; }
|
||||
|
||||
/**
|
||||
* Returns true if the two distributions may produce
|
||||
* different sequences of values, given equal generators.
|
||||
*/
|
||||
BOOST_RANDOM_DETAIL_INEQUALITY_OPERATOR(cauchy_distribution)
|
||||
|
||||
private:
|
||||
RealType _median;
|
||||
RealType _sigma;
|
||||
};
|
||||
|
||||
} // namespace random
|
||||
|
||||
using random::cauchy_distribution;
|
||||
|
||||
} // namespace boost
|
||||
|
||||
#endif // BOOST_RANDOM_CAUCHY_DISTRIBUTION_HPP
|
||||
Reference in New Issue
Block a user