Initial Commit
This commit is contained in:
@@ -0,0 +1,13 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2001-2007 Joel de Guzman
|
||||
|
||||
Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
==============================================================================*/
|
||||
#if !defined(FUSION_INCLUDE_REVERSE)
|
||||
#define FUSION_INCLUDE_REVERSE
|
||||
|
||||
#include <boost/fusion/support/config.hpp>
|
||||
#include <boost/fusion/algorithm/transformation/reverse.hpp>
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,51 @@
|
||||
// Copyright 2005 Daniel Wallin.
|
||||
// Copyright 2005 Joel de Guzman.
|
||||
//
|
||||
// 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)
|
||||
//
|
||||
// Modeled after range_ex, Copyright 2004 Eric Niebler
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// has_lower_bound.hpp
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#if defined(_MSC_VER)
|
||||
#pragma once
|
||||
#endif
|
||||
|
||||
#ifndef BOOST_PHOENIX_HAS_LOWER_BOUND_EN_14_12_2004
|
||||
#define BOOST_PHOENIX_HAS_LOWER_BOUND_EN_14_12_2004
|
||||
|
||||
#include <boost/mpl/or.hpp>
|
||||
#include "./is_std_map.hpp"
|
||||
#include "./is_std_set.hpp"
|
||||
#include "./is_std_hash_map.hpp"
|
||||
#include "./is_std_hash_set.hpp"
|
||||
|
||||
namespace boost
|
||||
{
|
||||
// Specialize this for user-defined types
|
||||
template<typename T>
|
||||
struct has_lower_bound
|
||||
: boost::mpl::or_<
|
||||
boost::mpl::or_<
|
||||
is_std_map<T>
|
||||
, is_std_multimap<T>
|
||||
, is_std_set<T>
|
||||
, is_std_multiset<T>
|
||||
>
|
||||
, boost::mpl::or_<
|
||||
is_std_hash_map<T>
|
||||
, is_std_hash_multimap<T>
|
||||
, is_std_hash_set<T>
|
||||
, is_std_hash_multiset<T>
|
||||
>
|
||||
>
|
||||
{
|
||||
};
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,308 @@
|
||||
subroutine encode300(message,codeword)
|
||||
! Encode an 60-bit message and return a 300-bit codeword.
|
||||
! The generator matrix has dimensions (240,60).
|
||||
! The code is a (300,60) irregular ldpc code with column weights:
|
||||
! 52% column weight 2
|
||||
! 27% column weight 3
|
||||
! 21% column weight 7
|
||||
! The code was generated using the PEG algorithm.
|
||||
! After creating the codeword, the columns are re-ordered according to
|
||||
! "colorder" to make the codeword compatible with the parity-check matrix
|
||||
!
|
||||
character*15 g(240)
|
||||
integer*1 codeword(300)
|
||||
integer colorder(300)
|
||||
integer*1 gen(240,60)
|
||||
integer*1 itmp(300)
|
||||
integer*1 message(60)
|
||||
integer*1 pchecks(240)
|
||||
logical first
|
||||
data first/.true./
|
||||
data g/ &
|
||||
"316fd3bb18bcefd", &
|
||||
"a9c1c984f91244e", &
|
||||
"9e04bd3d5d78d89", &
|
||||
"f81617089621bd4", &
|
||||
"12997ce2f44dbf4", &
|
||||
"3ebddaf9b0fa1fc", &
|
||||
"d0c114b0b0ef162", &
|
||||
"f8c4f115f98bd92", &
|
||||
"d0a79c0c5b8ca19", &
|
||||
"477f6712f357b3b", &
|
||||
"fa28b2444a7e66b", &
|
||||
"bedcd4df8d95c64", &
|
||||
"da30de73e57022c", &
|
||||
"bc099bbb90fe09e", &
|
||||
"cffc1e47e5708e8", &
|
||||
"713d808563ca9a3", &
|
||||
"70fcf1741d5d5d7", &
|
||||
"32e80bc15112008", &
|
||||
"804cef4df9b18ec", &
|
||||
"3736881819d1033", &
|
||||
"f4e37db7f9c5efe", &
|
||||
"9e84b93d4d78d09", &
|
||||
"2250c3518ec830a", &
|
||||
"55a529a92e18021", &
|
||||
"1cb80b14c9f6eae", &
|
||||
"80c504b031ef926", &
|
||||
"ece6636d0ac9c6d", &
|
||||
"5d50a1690782cd0", &
|
||||
"3d54a1fb30937a2", &
|
||||
"ba8fe8006318041", &
|
||||
"02917ce2fc45bf4", &
|
||||
"abc1d984f95a44e", &
|
||||
"fc05b4c4ab2d850", &
|
||||
"467f7718f357b3b", &
|
||||
"472cc094546c6b2", &
|
||||
"fcdd94cf8c9cc64", &
|
||||
"4dbc1647e970cc8", &
|
||||
"6caa465c442aed1", &
|
||||
"aead5af8b0da1be", &
|
||||
"d8e1fa45a2e8431", &
|
||||
"9d4dc4cc63abb7f", &
|
||||
"9b2df6b48264637", &
|
||||
"7335808563ca3a3", &
|
||||
"36bf8d5cd93e6cc", &
|
||||
"004ccf4db9b08ec", &
|
||||
"90a71c8c598ca19", &
|
||||
"f8c5d115f90bc92", &
|
||||
"b95546c4e3f7934", &
|
||||
"7d50a1690786cd0", &
|
||||
"c90939921a0d7c6", &
|
||||
"d0c504b030ef126", &
|
||||
"ce3e6f9396fc542", &
|
||||
"a0072a59f3707f5", &
|
||||
"532d0a8fe3da1ea", &
|
||||
"68b9e5cd7d142db", &
|
||||
"fedc94df8c9dc64", &
|
||||
"6da2465c448aed0", &
|
||||
"3574aa19cb273c0", &
|
||||
"1e54768c6bc6843", &
|
||||
"691f65654498186", &
|
||||
"fe2c92444a6ef6b", &
|
||||
"9caad933e038cc4", &
|
||||
"ad4e6f4defb28ec", &
|
||||
"4f3d80947c6d2b2", &
|
||||
"1caad933e0b8cc4", &
|
||||
"b14fd3bf18bcafd", &
|
||||
"ad091bbbb0f809e", &
|
||||
"90b71c8c598da19", &
|
||||
"f8c4d115f90bd92", &
|
||||
"9d4dcccc63afb7f", &
|
||||
"fa2c92444a6e76b", &
|
||||
"1e14768c6bc6c43", &
|
||||
"d1baf5aacb86087", &
|
||||
"bdf762b92ee51c7", &
|
||||
"caacec06ad8a90c", &
|
||||
"804ccf4df9b08ec", &
|
||||
"69e969f9da5cbd8", &
|
||||
"814ccf4df9b086c", &
|
||||
"cebe4f9796f4542", &
|
||||
"491f65654499186", &
|
||||
"8fbf5b9796f6d2a", &
|
||||
"ce3e4f9396f4542", &
|
||||
"47558560e7debc3", &
|
||||
"94aadd33e038cc4", &
|
||||
"a94eef4debb286e", &
|
||||
"d8e5d115f91bcd2", &
|
||||
"532d488fe3da0ab", &
|
||||
"664e7bc4e23a80c", &
|
||||
"94a2dd33a038cd4", &
|
||||
"d8c5d115f91bc92", &
|
||||
"0fef071eee60bd5", &
|
||||
"9a89a09163c2b97", &
|
||||
"0eaf071e6c60bd5", &
|
||||
"bc0d1bbbb0fe0be", &
|
||||
"f9babd3d12d0f31", &
|
||||
"69a969f9da5c9d8", &
|
||||
"6e4e7bc4e23a82c", &
|
||||
"b0042659f3227f5", &
|
||||
"2d51418f0f28347", &
|
||||
"be0d5bbbb0da0be", &
|
||||
"225003508ec8302", &
|
||||
"8fbf4b9796f4d2a", &
|
||||
"bead5af9b0da1be", &
|
||||
"6ca2465c440aed1", &
|
||||
"4fbc1e47ed708c8", &
|
||||
"bd091bbbb0fc09e", &
|
||||
"b0062259f3307f5", &
|
||||
"a8072a59f3727f5", &
|
||||
"a0062259f3707f5", &
|
||||
"3c380b14c974eae", &
|
||||
"30042659f3226f5", &
|
||||
"48b9e4cd7d142db", &
|
||||
"728bcd4b38308fb", &
|
||||
"c0c504b031ef126", &
|
||||
"314fd3bb18bcafd", &
|
||||
"1c29148305faec1", &
|
||||
"44c92a9c28ada63", &
|
||||
"88e99b370aae32b", &
|
||||
"695081690386ad8", &
|
||||
"572d0a8de3da1ea", &
|
||||
"467f6610f357b2b", &
|
||||
"733d008563da1a3", &
|
||||
"d1baf4aacb84087", &
|
||||
"4315551d71c8ff0", &
|
||||
"48bde4cd7d140db", &
|
||||
"3ebd58f9b0da9fc", &
|
||||
"51baf4aacb84083", &
|
||||
"814e4f4de9b082c", &
|
||||
"814ecf4de9b086c", &
|
||||
"be0d1bbbb0fa0be", &
|
||||
"4f7580947c792b3", &
|
||||
"cdf2dce48c39c3b", &
|
||||
"d8c5c115f91bc12", &
|
||||
"a94e6f4debb28ee", &
|
||||
"be2d5afbb0da1be", &
|
||||
"cdd6dce48439c2b", &
|
||||
"bebd5af9b0da1fe", &
|
||||
"fa2892444a6e66b", &
|
||||
"51bbf4aacb8c083", &
|
||||
"baa73d81eebcd83", &
|
||||
"79a2ce47f138cc9", &
|
||||
"cc28cf198e6dbd4", &
|
||||
"fcde94dfcc9cc64", &
|
||||
"1016fcf59286717", &
|
||||
"12917ce2fc4dbf4", &
|
||||
"4fbc1647e9708c8", &
|
||||
"3e382b1cc974fae", &
|
||||
"d5bafdaad386087", &
|
||||
"0fef473eee60bd5", &
|
||||
"c0e504b031ee126", &
|
||||
"8bbf5b9797f6d2a", &
|
||||
"0eef071e6e60bd5", &
|
||||
"1806fcf59386517", &
|
||||
"fcdc94df8c9cc64", &
|
||||
"141eca2bfa25656", &
|
||||
"5fbc1767e9708e8", &
|
||||
"5aa4c7803a6bdf1", &
|
||||
"b14bd3b718bcafd", &
|
||||
"3ebd5af9b0da1fc", &
|
||||
"d0a7148c5b8ca09", &
|
||||
"a94ecf4debb086e", &
|
||||
"733d808563ca1a3", &
|
||||
"fd9abd1d92d0f31", &
|
||||
"bc091bbbb0fe09e", &
|
||||
"d0c514b0b0ef122", &
|
||||
"4f7d80947c7d2b3", &
|
||||
"8b3f5b97b7f6d2a", &
|
||||
"4fbc1767e9708c8", &
|
||||
"cebf4f9796f4502", &
|
||||
"9c76c880a864e67", &
|
||||
"abc1c984f95244e", &
|
||||
"795081690786ad8", &
|
||||
"467f6710f357b3b", &
|
||||
"1c380b14c9f4eae", &
|
||||
"d5baf5aac386087", &
|
||||
"bedc94df8c95c64", &
|
||||
"553d0a8de2da1fa", &
|
||||
"0315551d71d8ff0", &
|
||||
"1c1eca2ffa25656", &
|
||||
"d4bafdaad3c6087", &
|
||||
"be2d5bfbb0da0be", &
|
||||
"b0062659f3207f5", &
|
||||
"5ffc1765e9708e8", &
|
||||
"8d62e8bcd303e33", &
|
||||
"cc08cf198e69bd4", &
|
||||
"573d0a8de3da1fa", &
|
||||
"cd56dce48639c2b", &
|
||||
"472dc094546c2b2", &
|
||||
"7950a16907868d8", &
|
||||
"7283cf4b38308fb", &
|
||||
"894ecf4de9b086e", &
|
||||
"0f7580b47c792b3", &
|
||||
"cfbf4b9796f4d0a", &
|
||||
"3e380b14c974fae", &
|
||||
"732d0085e3da1a3", &
|
||||
"1816fcf59386717", &
|
||||
"532d088fe3da1ab", &
|
||||
"1c300b94c9fcaae", &
|
||||
"d0a71c8c5b8ca19", &
|
||||
"9e84bd3d5d78d09", &
|
||||
"225083508ec830a", &
|
||||
"f99abd1d12d0f31", &
|
||||
"35f4aa19cb673c0", &
|
||||
"cdd2dce48c39c2b", &
|
||||
"0f7780b47c792bf", &
|
||||
"0e33a5f114f5730", &
|
||||
"bc05b4c4ab0d850", &
|
||||
"1c300b14c9f4aae", &
|
||||
"cfbc1e47ed708e8", &
|
||||
"0f7180b47c392b3", &
|
||||
"d8c7c115f91be12", &
|
||||
"c09148adfa94e97", &
|
||||
"9c66c880a844e67", &
|
||||
"2226c13b73519f8", &
|
||||
"cebf4b9796f4d02", &
|
||||
"c0e706b031ee126", &
|
||||
"6a6629715e53ce3", &
|
||||
"73f9aa824e7d0b8", &
|
||||
"473d80947c6c2b2", &
|
||||
"1df140e0ddb5632", &
|
||||
"473dc0945c6c2b2", &
|
||||
"81b4d95f671971d", &
|
||||
"663945ca758e2b6", &
|
||||
"02ec3d98a2306fd", &
|
||||
"5dadb0fa1275690", &
|
||||
"4bb8aaa854948d0", &
|
||||
"8359ba40886971c", &
|
||||
"49cc3d2a2be2ee0", &
|
||||
"bfdf13af137f318", &
|
||||
"a1de773a2b1ff04", &
|
||||
"8ff3945a2f465c7", &
|
||||
"532d0087e3da1a3", &
|
||||
"f3eaf7fa454d385", &
|
||||
"a606aa5aeba07d9", &
|
||||
"67f0627b0af8a53", &
|
||||
"56698bed69d1c2c", &
|
||||
"d5f420011fbf924", &
|
||||
"2a8f86c810e2c62", &
|
||||
"43cc1cf1208c206", &
|
||||
"ee784c4900258de"/
|
||||
|
||||
data colorder/ &
|
||||
0,1,2,3,4,5,6,7,8,9,10,11,123,12,13,14,15,16,17,18, &
|
||||
19,20,21,22,23,24,25,138,26,145,27,28,29,30,31,32,33,34,35,36, &
|
||||
37,154,38,39,40,41,42,43,44,144,46,47,48,49,50,51,52,53,143,54, &
|
||||
125,56,57,58,124,59,120,140,157,160,55,60,61,62,156,162,141,64,65,153, &
|
||||
181,183,66,170,67,68,69,130,70,164,71,72,73,74,75,63,76,77,135,78, &
|
||||
79,80,176,169,82,83,84,167,180,85,136,158,129,166,175,142,134,146,121,165, &
|
||||
88,89,192,90,45,91,92,93,182,189,94,95,96,173,81,97,98,178,122,126, &
|
||||
132,99,100,152,186,193,101,102,151,103,104,172,159,168,150,190,147,148,201,107, &
|
||||
205,177,108,198,197,174,127,109,185,110,202,87,199,171,179,187,139,137,106,131, &
|
||||
206,194,112,149,155,113,128,184,196,86,114,203,212,195,208,105,188,161,163,191, &
|
||||
200,209,214,204,115,218,133,111,207,117,213,216,211,217,116,215,219,220,210,221, &
|
||||
118,222,223,225,224,228,226,229,231,227,233,119,234,235,232,230,237,239,236,238, &
|
||||
240,241,242,243,244,245,246,247,248,249,250,251,252,253,254,255,256,257,258,259, &
|
||||
260,261,262,263,264,265,266,267,268,269,270,271,272,273,274,275,276,277,278,279, &
|
||||
280,281,282,283,284,285,286,287,288,289,290,291,292,293,294,295,296,297,298,299/
|
||||
|
||||
save first,gen
|
||||
|
||||
if( first ) then ! fill the generator matrix
|
||||
gen=0
|
||||
do i=1,240
|
||||
do j=1,15
|
||||
read(g(i)(j:j),"(Z1)") istr
|
||||
do jj=1, 4
|
||||
icol=(j-1)*4+jj
|
||||
if( btest(istr,4-jj) ) gen(i,icol)=1
|
||||
enddo
|
||||
enddo
|
||||
enddo
|
||||
first=.false.
|
||||
endif
|
||||
|
||||
do i=1, 240
|
||||
nsum=0
|
||||
do j=1, 60
|
||||
nsum=nsum+message(j)*gen(i,j)
|
||||
enddo
|
||||
pchecks(i)=mod(nsum,2)
|
||||
enddo
|
||||
itmp(1:240)=pchecks
|
||||
itmp(241:300)=message(1:60)
|
||||
codeword(colorder+1)=itmp(1:300)
|
||||
|
||||
return
|
||||
end subroutine encode300
|
||||
@@ -0,0 +1,103 @@
|
||||
#ifndef BOOST_ALGORITHM_RG071801_HPP
|
||||
#define BOOST_ALGORITHM_RG071801_HPP
|
||||
|
||||
//
|
||||
//
|
||||
// Copyright (c) 1994
|
||||
// Hewlett-Packard Company
|
||||
//
|
||||
// Permission to use, copy, modify, distribute and sell this software
|
||||
// and its documentation for any purpose is hereby granted without fee,
|
||||
// provided that the above copyright notice appear in all copies and
|
||||
// that both that copyright notice and this permission notice appear
|
||||
// in supporting documentation. Hewlett-Packard Company makes no
|
||||
// representations about the suitability of this software for any
|
||||
// purpose. It is provided "as is" without express or implied warranty.
|
||||
//
|
||||
//
|
||||
// Copyright (c) 1996-1998
|
||||
// Silicon Graphics Computer Systems, Inc.
|
||||
//
|
||||
// Permission to use, copy, modify, distribute and sell this software
|
||||
// and its documentation for any purpose is hereby granted without fee,
|
||||
// provided that the above copyright notice appear in all copies and
|
||||
// that both that copyright notice and this permission notice appear
|
||||
// in supporting documentation. Silicon Graphics makes no
|
||||
// representations about the suitability of this software for any
|
||||
// purpose. It is provided "as is" without express or implied warranty.
|
||||
//
|
||||
|
||||
// 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.
|
||||
|
||||
|
||||
#include "boost/iterator.hpp"
|
||||
|
||||
namespace boost {
|
||||
namespace detail {
|
||||
namespace multi_array {
|
||||
//--------------------------------------------------
|
||||
// copy_n (not part of the C++ standard)
|
||||
#if 1
|
||||
|
||||
template <class InputIter, class Size, class OutputIter>
|
||||
OutputIter copy_n(InputIter first, Size count,
|
||||
OutputIter result) {
|
||||
for ( ; count > 0; --count) {
|
||||
*result = *first;
|
||||
++first;
|
||||
++result;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
#else // !1
|
||||
|
||||
template <class InputIter, class Size, class OutputIter>
|
||||
OutputIter copy_n__(InputIter first, Size count,
|
||||
OutputIter result,
|
||||
std::input_iterator_tag) {
|
||||
for ( ; count > 0; --count) {
|
||||
*result = *first;
|
||||
++first;
|
||||
++result;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
template <class RAIter, class Size, class OutputIter>
|
||||
inline OutputIter
|
||||
copy_n__(RAIter first, Size count,
|
||||
OutputIter result,
|
||||
std::random_access_iterator_tag) {
|
||||
RAIter last = first + count;
|
||||
return std::copy(first, last, result);
|
||||
}
|
||||
|
||||
template <class InputIter, class Size, class OutputIter>
|
||||
inline OutputIter
|
||||
copy_n__(InputIter first, Size count, OutputIter result) {
|
||||
typedef typename std::iterator_traits<InputIter>::iterator_category cat;
|
||||
return copy_n__(first, count, result, cat());
|
||||
}
|
||||
|
||||
template <class InputIter, class Size, class OutputIter>
|
||||
inline OutputIter
|
||||
copy_n(InputIter first, Size count, OutputIter result) {
|
||||
return copy_n__(first, count, result);
|
||||
}
|
||||
|
||||
#endif // 1
|
||||
} // namespace multi_array
|
||||
} // namespace detail
|
||||
} // namespace boost
|
||||
|
||||
#endif // BOOST_ALGORITHM_RG071801_HPP
|
||||
@@ -0,0 +1,55 @@
|
||||
/*=============================================================================
|
||||
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_1141)
|
||||
#define FUSION_LESS_05052005_1141
|
||||
|
||||
#include <boost/fusion/support/config.hpp>
|
||||
#include <boost/mpl/bool.hpp>
|
||||
#include <boost/fusion/iterator/deref.hpp>
|
||||
#include <boost/fusion/iterator/next.hpp>
|
||||
#include <boost/fusion/iterator/equal_to.hpp>
|
||||
#include <boost/fusion/support/as_const.hpp>
|
||||
|
||||
namespace boost { namespace fusion { namespace detail
|
||||
{
|
||||
template <typename Seq1, typename Seq2>
|
||||
struct sequence_less
|
||||
{
|
||||
typedef typename result_of::end<Seq1>::type end1_type;
|
||||
typedef typename result_of::end<Seq2>::type end2_type;
|
||||
|
||||
template <typename I1, typename I2>
|
||||
BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
|
||||
static bool
|
||||
call(I1 const&, I2 const&, mpl::true_)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
template <typename I1, typename I2>
|
||||
BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
|
||||
static bool
|
||||
call(I1 const& a, I2 const& b, mpl::false_)
|
||||
{
|
||||
return extension::as_const(*a) < extension::as_const(*b) ||
|
||||
(!(extension::as_const(*b) < extension::as_const(*a)) &&
|
||||
call(fusion::next(a), fusion::next(b)));
|
||||
}
|
||||
|
||||
template <typename I1, typename I2>
|
||||
BOOST_CXX14_CONSTEXPR BOOST_FUSION_GPU_ENABLED
|
||||
static bool
|
||||
call(I1 const& a, I2 const& b)
|
||||
{
|
||||
typename result_of::equal_to<I1, end1_type>::type eq;
|
||||
return call(a, b, eq);
|
||||
}
|
||||
};
|
||||
}}}
|
||||
|
||||
#endif
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,708 @@
|
||||
subroutine bpdecode300(llr,apmask,maxiterations,decoded,niterations,cw)
|
||||
|
||||
! A log-domain belief propagation decoder for the (300,60) code.
|
||||
|
||||
integer, parameter:: N=300, K=60, M=N-K
|
||||
integer*1 codeword(N),cw(N),apmask(N)
|
||||
integer colorder(N)
|
||||
integer*1 decoded(K)
|
||||
integer Nm(5,M) ! 4, or 5 bits per check
|
||||
integer Mn(7,N) ! 2, 3, or 7 checks per bit
|
||||
integer synd(M)
|
||||
real tov(7,N)
|
||||
real toc(5,M)
|
||||
real tanhtoc(5,M)
|
||||
real zn(N)
|
||||
real llr(N)
|
||||
real Tmn
|
||||
integer nrw(M)
|
||||
integer ncw(N)
|
||||
|
||||
data colorder/ &
|
||||
0,1,2,3,4,5,6,7,8,9,10,11,123,12,13,14,15,16,17,18, &
|
||||
19,20,21,22,23,24,25,138,26,145,27,28,29,30,31,32,33,34,35,36, &
|
||||
37,154,38,39,40,41,42,43,44,144,46,47,48,49,50,51,52,53,143,54, &
|
||||
125,56,57,58,124,59,120,140,157,160,55,60,61,62,156,162,141,64,65,153, &
|
||||
181,183,66,170,67,68,69,130,70,164,71,72,73,74,75,63,76,77,135,78, &
|
||||
79,80,176,169,82,83,84,167,180,85,136,158,129,166,175,142,134,146,121,165, &
|
||||
88,89,192,90,45,91,92,93,182,189,94,95,96,173,81,97,98,178,122,126, &
|
||||
132,99,100,152,186,193,101,102,151,103,104,172,159,168,150,190,147,148,201,107, &
|
||||
205,177,108,198,197,174,127,109,185,110,202,87,199,171,179,187,139,137,106,131, &
|
||||
206,194,112,149,155,113,128,184,196,86,114,203,212,195,208,105,188,161,163,191, &
|
||||
200,209,214,204,115,218,133,111,207,117,213,216,211,217,116,215,219,220,210,221, &
|
||||
118,222,223,225,224,228,226,229,231,227,233,119,234,235,232,230,237,239,236,238, &
|
||||
240,241,242,243,244,245,246,247,248,249,250,251,252,253,254,255,256,257,258,259, &
|
||||
260,261,262,263,264,265,266,267,268,269,270,271,272,273,274,275,276,277,278,279, &
|
||||
280,281,282,283,284,285,286,287,288,289,290,291,292,293,294,295,296,297,298,299/
|
||||
|
||||
data Mn/ &
|
||||
1, 67, 0, 0, 0, 0, 0, &
|
||||
2, 189, 0, 0, 0, 0, 0, &
|
||||
3, 201, 0, 0, 0, 0, 0, &
|
||||
4, 13, 0, 0, 0, 0, 0, &
|
||||
5, 84, 0, 0, 0, 0, 0, &
|
||||
6, 188, 0, 0, 0, 0, 0, &
|
||||
7, 140, 0, 0, 0, 0, 0, &
|
||||
8, 167, 0, 0, 0, 0, 0, &
|
||||
9, 187, 0, 0, 0, 0, 0, &
|
||||
10, 173, 0, 0, 0, 0, 0, &
|
||||
11, 88, 0, 0, 0, 0, 0, &
|
||||
12, 213, 0, 0, 0, 0, 0, &
|
||||
14, 141, 0, 0, 0, 0, 0, &
|
||||
15, 236, 0, 0, 0, 0, 0, &
|
||||
16, 117, 0, 0, 0, 0, 0, &
|
||||
17, 99, 0, 0, 0, 0, 0, &
|
||||
18, 111, 0, 0, 0, 0, 0, &
|
||||
19, 178, 0, 0, 0, 0, 0, &
|
||||
20, 28, 0, 0, 0, 0, 0, &
|
||||
21, 177, 0, 0, 0, 0, 0, &
|
||||
22, 199, 0, 0, 0, 0, 0, &
|
||||
23, 209, 0, 0, 0, 0, 0, &
|
||||
24, 220, 0, 0, 0, 0, 0, &
|
||||
25, 59, 0, 0, 0, 0, 0, &
|
||||
26, 224, 0, 0, 0, 0, 0, &
|
||||
27, 30, 0, 0, 0, 0, 0, &
|
||||
29, 157, 0, 0, 0, 0, 0, &
|
||||
31, 184, 0, 0, 0, 0, 0, &
|
||||
32, 179, 0, 0, 0, 0, 0, &
|
||||
33, 149, 0, 0, 0, 0, 0, &
|
||||
34, 144, 0, 0, 0, 0, 0, &
|
||||
35, 80, 0, 0, 0, 0, 0, &
|
||||
36, 228, 0, 0, 0, 0, 0, &
|
||||
37, 185, 0, 0, 0, 0, 0, &
|
||||
38, 197, 0, 0, 0, 0, 0, &
|
||||
39, 69, 0, 0, 0, 0, 0, &
|
||||
40, 42, 0, 0, 0, 0, 0, &
|
||||
41, 112, 0, 0, 0, 0, 0, &
|
||||
43, 70, 0, 0, 0, 0, 0, &
|
||||
44, 198, 0, 0, 0, 0, 0, &
|
||||
45, 76, 0, 0, 0, 0, 0, &
|
||||
46, 68, 0, 0, 0, 0, 0, &
|
||||
47, 90, 0, 0, 0, 0, 0, &
|
||||
48, 75, 0, 0, 0, 0, 0, &
|
||||
49, 118, 0, 0, 0, 0, 0, &
|
||||
50, 125, 0, 0, 0, 0, 0, &
|
||||
51, 114, 0, 0, 0, 0, 0, &
|
||||
52, 239, 0, 0, 0, 0, 0, &
|
||||
53, 108, 0, 0, 0, 0, 0, &
|
||||
54, 120, 0, 0, 0, 0, 0, &
|
||||
55, 162, 0, 0, 0, 0, 0, &
|
||||
56, 218, 0, 0, 0, 0, 0, &
|
||||
57, 138, 0, 0, 0, 0, 0, &
|
||||
58, 212, 0, 0, 0, 0, 0, &
|
||||
60, 207, 0, 0, 0, 0, 0, &
|
||||
61, 71, 0, 0, 0, 0, 0, &
|
||||
62, 65, 0, 0, 0, 0, 0, &
|
||||
63, 161, 0, 0, 0, 0, 0, &
|
||||
64, 166, 0, 0, 0, 0, 0, &
|
||||
66, 158, 0, 0, 0, 0, 0, &
|
||||
72, 235, 0, 0, 0, 0, 0, &
|
||||
73, 225, 0, 0, 0, 0, 0, &
|
||||
74, 116, 0, 0, 0, 0, 0, &
|
||||
77, 96, 0, 0, 0, 0, 0, &
|
||||
78, 81, 0, 0, 0, 0, 0, &
|
||||
79, 82, 0, 0, 0, 0, 0, &
|
||||
83, 229, 0, 0, 0, 0, 0, &
|
||||
85, 134, 0, 0, 0, 0, 0, &
|
||||
86, 176, 0, 0, 0, 0, 0, &
|
||||
87, 203, 0, 0, 0, 0, 0, &
|
||||
89, 145, 0, 0, 0, 0, 0, &
|
||||
91, 152, 0, 0, 0, 0, 0, &
|
||||
92, 237, 0, 0, 0, 0, 0, &
|
||||
93, 215, 0, 0, 0, 0, 0, &
|
||||
94, 130, 0, 0, 0, 0, 0, &
|
||||
95, 156, 0, 0, 0, 0, 0, &
|
||||
97, 104, 0, 0, 0, 0, 0, &
|
||||
98, 182, 0, 0, 0, 0, 0, &
|
||||
100, 222, 0, 0, 0, 0, 0, &
|
||||
101, 123, 0, 0, 0, 0, 0, &
|
||||
102, 181, 0, 0, 0, 0, 0, &
|
||||
103, 135, 0, 0, 0, 0, 0, &
|
||||
105, 146, 0, 0, 0, 0, 0, &
|
||||
106, 115, 0, 0, 0, 0, 0, &
|
||||
107, 109, 0, 0, 0, 0, 0, &
|
||||
110, 194, 0, 0, 0, 0, 0, &
|
||||
113, 164, 0, 0, 0, 0, 0, &
|
||||
119, 172, 0, 0, 0, 0, 0, &
|
||||
121, 190, 0, 0, 0, 0, 0, &
|
||||
122, 169, 0, 0, 0, 0, 0, &
|
||||
124, 211, 0, 0, 0, 0, 0, &
|
||||
126, 165, 0, 0, 0, 0, 0, &
|
||||
127, 139, 0, 0, 0, 0, 0, &
|
||||
128, 129, 0, 0, 0, 0, 0, &
|
||||
131, 205, 0, 0, 0, 0, 0, &
|
||||
132, 196, 0, 0, 0, 0, 0, &
|
||||
133, 193, 0, 0, 0, 0, 0, &
|
||||
136, 200, 0, 0, 0, 0, 0, &
|
||||
137, 159, 0, 0, 0, 0, 0, &
|
||||
142, 204, 0, 0, 0, 0, 0, &
|
||||
143, 154, 0, 0, 0, 0, 0, &
|
||||
147, 238, 0, 0, 0, 0, 0, &
|
||||
148, 175, 0, 0, 0, 0, 0, &
|
||||
150, 216, 0, 0, 0, 0, 0, &
|
||||
151, 171, 0, 0, 0, 0, 0, &
|
||||
153, 231, 0, 0, 0, 0, 0, &
|
||||
155, 208, 0, 0, 0, 0, 0, &
|
||||
160, 230, 0, 0, 0, 0, 0, &
|
||||
163, 223, 0, 0, 0, 0, 0, &
|
||||
168, 217, 0, 0, 0, 0, 0, &
|
||||
170, 180, 0, 0, 0, 0, 0, &
|
||||
174, 233, 0, 0, 0, 0, 0, &
|
||||
183, 202, 0, 0, 0, 0, 0, &
|
||||
186, 214, 0, 0, 0, 0, 0, &
|
||||
191, 206, 0, 0, 0, 0, 0, &
|
||||
192, 219, 0, 0, 0, 0, 0, &
|
||||
195, 227, 0, 0, 0, 0, 0, &
|
||||
210, 226, 0, 0, 0, 0, 0, &
|
||||
221, 234, 0, 0, 0, 0, 0, &
|
||||
232, 240, 0, 0, 0, 0, 0, &
|
||||
1, 106, 0, 0, 0, 0, 0, &
|
||||
2, 119, 0, 0, 0, 0, 0, &
|
||||
3, 139, 0, 0, 0, 0, 0, &
|
||||
4, 14, 0, 0, 0, 0, 0, &
|
||||
5, 65, 0, 0, 0, 0, 0, &
|
||||
6, 61, 0, 0, 0, 0, 0, &
|
||||
7, 223, 0, 0, 0, 0, 0, &
|
||||
8, 171, 0, 0, 0, 0, 0, &
|
||||
9, 136, 0, 0, 0, 0, 0, &
|
||||
10, 113, 0, 0, 0, 0, 0, &
|
||||
11, 104, 0, 0, 0, 0, 0, &
|
||||
12, 175, 0, 0, 0, 0, 0, &
|
||||
13, 203, 0, 0, 0, 0, 0, &
|
||||
15, 149, 0, 0, 0, 0, 0, &
|
||||
16, 226, 0, 0, 0, 0, 0, &
|
||||
17, 219, 0, 0, 0, 0, 0, &
|
||||
18, 98, 0, 0, 0, 0, 0, &
|
||||
19, 211, 0, 0, 0, 0, 0, &
|
||||
20, 49, 0, 0, 0, 0, 0, &
|
||||
21, 214, 0, 0, 0, 0, 0, &
|
||||
22, 68, 0, 0, 0, 0, 0, &
|
||||
23, 77, 0, 0, 0, 0, 0, &
|
||||
24, 116, 0, 0, 0, 0, 0, &
|
||||
25, 235, 0, 0, 0, 0, 0, &
|
||||
26, 50, 0, 0, 0, 0, 0, &
|
||||
27, 124, 0, 0, 0, 0, 0, &
|
||||
28, 229, 0, 0, 0, 0, 0, &
|
||||
29, 83, 0, 0, 0, 0, 0, &
|
||||
30, 158, 0, 0, 0, 0, 0, &
|
||||
31, 220, 0, 0, 0, 0, 0, &
|
||||
32, 155, 0, 0, 0, 0, 0, &
|
||||
33, 152, 0, 0, 0, 0, 0, &
|
||||
34, 231, 0, 0, 0, 0, 0, &
|
||||
35, 207, 0, 0, 0, 0, 0, &
|
||||
36, 40, 0, 0, 0, 0, 0, &
|
||||
37, 142, 0, 0, 0, 0, 0, &
|
||||
38, 75, 0, 0, 0, 0, 0, &
|
||||
39, 90, 167, 0, 0, 0, 0, &
|
||||
41, 55, 125, 0, 0, 0, 0, &
|
||||
42, 153, 196, 0, 0, 0, 0, &
|
||||
43, 72, 112, 0, 0, 0, 0, &
|
||||
44, 183, 233, 0, 0, 0, 0, &
|
||||
45, 81, 178, 0, 0, 0, 0, &
|
||||
46, 187, 230, 0, 0, 0, 0, &
|
||||
47, 133, 176, 0, 0, 0, 0, &
|
||||
48, 54, 186, 0, 0, 0, 0, &
|
||||
51, 150, 224, 0, 0, 0, 0, &
|
||||
52, 53, 190, 0, 0, 0, 0, &
|
||||
56, 143, 228, 0, 0, 0, 0, &
|
||||
57, 97, 197, 0, 0, 0, 0, &
|
||||
58, 62, 89, 0, 0, 0, 0, &
|
||||
59, 174, 194, 0, 0, 0, 0, &
|
||||
60, 91, 93, 0, 0, 0, 0, &
|
||||
63, 85, 96, 0, 0, 0, 0, &
|
||||
64, 92, 205, 0, 0, 0, 0, &
|
||||
66, 67, 164, 0, 0, 0, 0, &
|
||||
69, 103, 159, 0, 0, 0, 0, &
|
||||
70, 117, 122, 0, 0, 0, 0, &
|
||||
71, 88, 160, 0, 0, 0, 0, &
|
||||
73, 148, 180, 0, 0, 0, 0, &
|
||||
74, 108, 109, 0, 0, 0, 0, &
|
||||
76, 102, 151, 0, 0, 0, 0, &
|
||||
78, 128, 206, 0, 0, 0, 0, &
|
||||
79, 215, 239, 0, 0, 0, 0, &
|
||||
80, 138, 221, 0, 0, 0, 0, &
|
||||
82, 162, 195, 0, 0, 0, 0, &
|
||||
84, 161, 184, 0, 0, 0, 0, &
|
||||
86, 213, 218, 0, 0, 0, 0, &
|
||||
87, 120, 240, 0, 0, 0, 0, &
|
||||
94, 100, 157, 0, 0, 0, 0, &
|
||||
95, 202, 217, 0, 0, 0, 0, &
|
||||
99, 199, 201, 0, 0, 0, 0, &
|
||||
101, 127, 225, 0, 0, 0, 0, &
|
||||
105, 168, 185, 0, 0, 0, 0, &
|
||||
107, 182, 237, 0, 0, 0, 0, &
|
||||
110, 147, 208, 0, 0, 0, 0, &
|
||||
111, 118, 172, 0, 0, 0, 0, &
|
||||
114, 140, 165, 0, 0, 0, 0, &
|
||||
115, 130, 141, 0, 0, 0, 0, &
|
||||
121, 144, 173, 0, 0, 0, 0, &
|
||||
123, 204, 209, 0, 0, 0, 0, &
|
||||
126, 137, 188, 0, 0, 0, 0, &
|
||||
129, 179, 189, 0, 0, 0, 0, &
|
||||
131, 192, 210, 0, 0, 0, 0, &
|
||||
132, 200, 238, 0, 0, 0, 0, &
|
||||
134, 177, 191, 0, 0, 0, 0, &
|
||||
135, 145, 222, 0, 0, 0, 0, &
|
||||
146, 229, 236, 0, 0, 0, 0, &
|
||||
154, 169, 232, 0, 0, 0, 0, &
|
||||
124, 156, 163, 0, 0, 0, 0, &
|
||||
166, 223, 234, 0, 0, 0, 0, &
|
||||
1, 11, 170, 0, 0, 0, 0, &
|
||||
3, 181, 227, 0, 0, 0, 0, &
|
||||
193, 198, 220, 0, 0, 0, 0, &
|
||||
10, 16, 212, 0, 0, 0, 0, &
|
||||
42, 96, 216, 0, 0, 0, 0, &
|
||||
2, 6, 215, 0, 0, 0, 0, &
|
||||
4, 208, 219, 0, 0, 0, 0, &
|
||||
5, 22, 35, 0, 0, 0, 0, &
|
||||
7, 12, 20, 0, 0, 0, 0, &
|
||||
8, 15, 75, 0, 0, 0, 0, &
|
||||
9, 74, 83, 0, 0, 0, 0, &
|
||||
13, 37, 50, 0, 0, 0, 0, &
|
||||
14, 52, 86, 0, 0, 0, 0, &
|
||||
17, 30, 177, 0, 0, 0, 0, &
|
||||
18, 25, 97, 0, 0, 0, 0, &
|
||||
19, 72, 157, 0, 0, 0, 0, &
|
||||
21, 58, 116, 0, 0, 0, 0, &
|
||||
23, 111, 226, 0, 0, 0, 0, &
|
||||
24, 26, 180, 0, 0, 0, 0, &
|
||||
27, 34, 39, 0, 0, 0, 0, &
|
||||
28, 32, 161, 0, 0, 0, 0, &
|
||||
29, 36, 60, 0, 0, 0, 0, &
|
||||
31, 76, 154, 0, 0, 0, 0, &
|
||||
33, 101, 238, 0, 0, 0, 0, &
|
||||
38, 95, 162, 0, 0, 0, 0, &
|
||||
40, 164, 183, 0, 0, 0, 0, &
|
||||
41, 92, 196, 0, 0, 0, 0, &
|
||||
43, 48, 99, 165, 190, 198, 204, &
|
||||
44, 129, 138, 145, 160, 203, 237, &
|
||||
45, 65, 66, 98, 127, 137, 146, &
|
||||
46, 131, 149, 181, 211, 218, 224, &
|
||||
47, 49, 55, 191, 194, 207, 232, &
|
||||
51, 69, 106, 109, 119, 184, 217, &
|
||||
53, 62, 104, 155, 166, 206, 231, &
|
||||
54, 61, 63, 73, 118, 151, 163, &
|
||||
56, 94, 110, 117, 185, 189, 214, &
|
||||
57, 81, 91, 115, 173, 175, 227, &
|
||||
59, 79, 103, 136, 171, 201, 212, &
|
||||
24, 64, 77, 93, 202, 235, 236, &
|
||||
67, 132, 142, 150, 156, 176, 222, &
|
||||
68, 153, 159, 169, 170, 186, 221, &
|
||||
70, 84, 89, 113, 174, 197, 205, &
|
||||
71, 125, 130, 140, 158, 200, 210, &
|
||||
8, 78, 143, 182, 192, 193, 216, &
|
||||
23, 80, 82, 90, 108, 139, 228, &
|
||||
85, 122, 123, 128, 141, 187, 188, &
|
||||
25, 87, 100, 152, 209, 213, 234, &
|
||||
88, 134, 147, 167, 172, 178, 239, &
|
||||
18, 40, 102, 114, 133, 144, 179, &
|
||||
4, 105, 108, 112, 148, 230, 240, &
|
||||
29, 33, 50, 62, 107, 195, 199, &
|
||||
3, 83, 113, 120, 126, 177, 216, &
|
||||
11, 55, 116, 121, 135, 168, 225, &
|
||||
1, 27, 28, 76, 187, 226, 233, &
|
||||
2, 4, 7, 10, 22, 75, 222, &
|
||||
5, 30, 131, 152, 156, 168, 215, &
|
||||
6, 13, 19, 58, 196, 228, 229, &
|
||||
9, 26, 144, 147, 158, 223, 240, &
|
||||
12, 31, 66, 79, 92, 96, 155, &
|
||||
14, 54, 103, 173, 202, 232, 238, &
|
||||
15, 17, 37, 69, 129, 164, 209, &
|
||||
16, 72, 91, 114, 163, 169, 237, &
|
||||
20, 45, 89, 99, 143, 180, 208, &
|
||||
21, 39, 60, 141, 171, 198, 234, &
|
||||
21, 32, 52, 78, 95, 148, 199, &
|
||||
34, 73, 84, 157, 200, 221, 236, &
|
||||
35, 36, 63, 97, 105, 119, 220, &
|
||||
38, 46, 93, 111, 136, 191, 203, &
|
||||
41, 51, 151, 160, 213, 214, 231, &
|
||||
42, 57, 65, 161, 167, 194, 204, &
|
||||
43, 109, 162, 175, 189, 210, 212, &
|
||||
44, 74, 100, 149, 170, 188, 197, &
|
||||
47, 64, 88, 107, 122, 165, 211, &
|
||||
48, 139, 179, 184, 218, 233, 239, &
|
||||
49, 94, 106, 112, 138, 142, 205, &
|
||||
53, 59, 102, 115, 134, 182, 225, &
|
||||
56, 68, 101, 150, 166, 178, 207, &
|
||||
61, 117, 126, 154, 195, 219, 224, &
|
||||
67, 80, 118, 174, 185, 190, 235, &
|
||||
70, 77, 86, 125, 153, 172, 193, &
|
||||
32, 71, 87, 90, 98, 110, 135, &
|
||||
41, 75, 81, 85, 124, 133, 201, &
|
||||
82, 120, 128, 140, 159, 176, 183, &
|
||||
22, 72, 104, 130, 146, 181, 217, &
|
||||
25, 89, 96, 121, 132, 186, 230, &
|
||||
118, 123, 145, 192, 196, 227, 240, &
|
||||
1, 14, 35, 38, 114, 127, 192, &
|
||||
7, 23, 43, 63, 116, 137, 206, &
|
||||
2, 37, 52, 57, 64, 76, 120/
|
||||
|
||||
data Nm/ &
|
||||
1, 121, 212, 265, 298, &
|
||||
2, 122, 217, 266, 300, &
|
||||
3, 123, 213, 263, 0, &
|
||||
4, 124, 218, 261, 266, &
|
||||
5, 125, 219, 267, 0, &
|
||||
6, 126, 217, 268, 0, &
|
||||
7, 127, 220, 266, 299, &
|
||||
8, 128, 221, 255, 0, &
|
||||
9, 129, 222, 269, 0, &
|
||||
10, 130, 215, 266, 0, &
|
||||
11, 131, 212, 264, 0, &
|
||||
12, 132, 220, 270, 0, &
|
||||
4, 133, 223, 268, 0, &
|
||||
13, 124, 224, 271, 298, &
|
||||
14, 134, 221, 272, 0, &
|
||||
15, 135, 215, 273, 0, &
|
||||
16, 136, 225, 272, 0, &
|
||||
17, 137, 226, 260, 0, &
|
||||
18, 138, 227, 268, 0, &
|
||||
19, 139, 220, 274, 0, &
|
||||
20, 140, 228, 275, 276, &
|
||||
21, 141, 219, 266, 295, &
|
||||
22, 142, 229, 256, 299, &
|
||||
23, 143, 230, 250, 0, &
|
||||
24, 144, 226, 258, 296, &
|
||||
25, 145, 230, 269, 0, &
|
||||
26, 146, 231, 265, 0, &
|
||||
19, 147, 232, 265, 0, &
|
||||
27, 148, 233, 262, 0, &
|
||||
26, 149, 225, 267, 0, &
|
||||
28, 150, 234, 270, 0, &
|
||||
29, 151, 232, 276, 292, &
|
||||
30, 152, 235, 262, 0, &
|
||||
31, 153, 231, 277, 0, &
|
||||
32, 154, 219, 278, 298, &
|
||||
33, 155, 233, 278, 0, &
|
||||
34, 156, 223, 272, 300, &
|
||||
35, 157, 236, 279, 298, &
|
||||
36, 158, 231, 275, 0, &
|
||||
37, 155, 237, 260, 0, &
|
||||
38, 159, 238, 280, 293, &
|
||||
37, 160, 216, 281, 0, &
|
||||
39, 161, 239, 282, 299, &
|
||||
40, 162, 240, 283, 0, &
|
||||
41, 163, 241, 274, 0, &
|
||||
42, 164, 242, 279, 0, &
|
||||
43, 165, 243, 284, 0, &
|
||||
44, 166, 239, 285, 0, &
|
||||
45, 139, 243, 286, 0, &
|
||||
46, 145, 223, 262, 0, &
|
||||
47, 167, 244, 280, 0, &
|
||||
48, 168, 224, 276, 300, &
|
||||
49, 168, 245, 287, 0, &
|
||||
50, 166, 246, 271, 0, &
|
||||
51, 159, 243, 264, 0, &
|
||||
52, 169, 247, 288, 0, &
|
||||
53, 170, 248, 281, 300, &
|
||||
54, 171, 228, 268, 0, &
|
||||
24, 172, 249, 287, 0, &
|
||||
55, 173, 233, 275, 0, &
|
||||
56, 126, 246, 289, 0, &
|
||||
57, 171, 245, 262, 0, &
|
||||
58, 174, 246, 278, 299, &
|
||||
59, 175, 250, 284, 300, &
|
||||
57, 125, 241, 281, 0, &
|
||||
60, 176, 241, 270, 0, &
|
||||
1, 176, 251, 290, 0, &
|
||||
42, 141, 252, 288, 0, &
|
||||
36, 177, 244, 272, 0, &
|
||||
39, 178, 253, 291, 0, &
|
||||
56, 179, 254, 292, 0, &
|
||||
61, 161, 227, 273, 295, &
|
||||
62, 180, 246, 277, 0, &
|
||||
63, 181, 222, 283, 0, &
|
||||
44, 157, 221, 266, 293, &
|
||||
41, 182, 234, 265, 300, &
|
||||
64, 142, 250, 291, 0, &
|
||||
65, 183, 255, 276, 0, &
|
||||
66, 184, 249, 270, 0, &
|
||||
32, 185, 256, 290, 0, &
|
||||
65, 163, 248, 293, 0, &
|
||||
66, 186, 256, 294, 0, &
|
||||
67, 148, 222, 263, 0, &
|
||||
5, 187, 253, 277, 0, &
|
||||
68, 174, 257, 293, 0, &
|
||||
69, 188, 224, 291, 0, &
|
||||
70, 189, 258, 292, 0, &
|
||||
11, 179, 259, 284, 0, &
|
||||
71, 171, 253, 274, 296, &
|
||||
43, 158, 256, 292, 0, &
|
||||
72, 173, 248, 273, 0, &
|
||||
73, 175, 238, 270, 0, &
|
||||
74, 173, 250, 279, 0, &
|
||||
75, 190, 247, 286, 0, &
|
||||
76, 191, 236, 276, 0, &
|
||||
64, 174, 216, 270, 296, &
|
||||
77, 170, 226, 278, 0, &
|
||||
78, 137, 241, 292, 0, &
|
||||
16, 192, 239, 274, 0, &
|
||||
79, 190, 258, 283, 0, &
|
||||
80, 193, 235, 288, 0, &
|
||||
81, 182, 260, 287, 0, &
|
||||
82, 177, 249, 271, 0, &
|
||||
77, 131, 245, 295, 0, &
|
||||
83, 194, 261, 278, 0, &
|
||||
84, 121, 244, 286, 0, &
|
||||
85, 195, 262, 284, 0, &
|
||||
49, 181, 256, 261, 0, &
|
||||
85, 181, 244, 282, 0, &
|
||||
86, 196, 247, 292, 0, &
|
||||
17, 197, 229, 279, 0, &
|
||||
38, 161, 261, 286, 0, &
|
||||
87, 130, 253, 263, 0, &
|
||||
47, 198, 260, 273, 298, &
|
||||
84, 199, 248, 287, 0, &
|
||||
63, 143, 228, 264, 299, &
|
||||
15, 178, 247, 289, 0, &
|
||||
45, 197, 246, 290, 297, &
|
||||
88, 122, 244, 278, 0, &
|
||||
50, 189, 263, 294, 300, &
|
||||
89, 200, 264, 296, 0, &
|
||||
90, 178, 257, 284, 0, &
|
||||
80, 201, 257, 297, 0, &
|
||||
91, 146, 210, 293, 0, &
|
||||
46, 159, 254, 291, 0, &
|
||||
92, 202, 263, 289, 0, &
|
||||
93, 193, 241, 298, 0, &
|
||||
94, 183, 257, 294, 0, &
|
||||
94, 203, 240, 272, 0, &
|
||||
75, 199, 254, 295, 0, &
|
||||
95, 204, 242, 267, 0, &
|
||||
96, 205, 251, 296, 0, &
|
||||
97, 165, 260, 293, 0, &
|
||||
68, 206, 259, 287, 0, &
|
||||
82, 207, 264, 292, 0, &
|
||||
98, 129, 249, 279, 0, &
|
||||
99, 202, 241, 299, 0, &
|
||||
53, 185, 240, 286, 0, &
|
||||
93, 123, 256, 285, 0, &
|
||||
7, 198, 254, 294, 0, &
|
||||
13, 199, 257, 275, 0, &
|
||||
100, 156, 251, 286, 0, &
|
||||
101, 169, 255, 274, 0, &
|
||||
31, 200, 260, 269, 0, &
|
||||
71, 207, 240, 297, 0, &
|
||||
83, 208, 241, 295, 0, &
|
||||
102, 196, 259, 269, 0, &
|
||||
103, 180, 261, 276, 0, &
|
||||
30, 134, 242, 283, 0, &
|
||||
104, 167, 251, 288, 0, &
|
||||
105, 182, 246, 280, 0, &
|
||||
72, 152, 258, 267, 0, &
|
||||
106, 160, 252, 291, 0, &
|
||||
101, 209, 234, 289, 0, &
|
||||
107, 151, 245, 270, 0, &
|
||||
76, 210, 251, 267, 0, &
|
||||
27, 190, 227, 277, 0, &
|
||||
60, 149, 254, 269, 0, &
|
||||
99, 177, 252, 294, 0, &
|
||||
108, 179, 240, 280, 0, &
|
||||
58, 187, 232, 281, 0, &
|
||||
51, 186, 236, 282, 0, &
|
||||
109, 210, 246, 273, 0, &
|
||||
87, 176, 237, 272, 0, &
|
||||
92, 198, 239, 284, 0, &
|
||||
59, 211, 245, 288, 0, &
|
||||
8, 158, 259, 281, 0, &
|
||||
110, 194, 264, 267, 0, &
|
||||
90, 209, 252, 273, 0, &
|
||||
111, 212, 252, 283, 0, &
|
||||
105, 128, 249, 275, 0, &
|
||||
88, 197, 259, 291, 0, &
|
||||
10, 200, 248, 271, 0, &
|
||||
112, 172, 253, 290, 0, &
|
||||
103, 132, 248, 282, 0, &
|
||||
69, 165, 251, 294, 0, &
|
||||
20, 206, 225, 263, 0, &
|
||||
18, 163, 259, 288, 0, &
|
||||
29, 203, 260, 285, 0, &
|
||||
111, 180, 230, 274, 0, &
|
||||
81, 213, 242, 295, 0, &
|
||||
78, 195, 255, 287, 0, &
|
||||
113, 162, 237, 294, 0, &
|
||||
28, 187, 244, 285, 0, &
|
||||
34, 194, 247, 290, 0, &
|
||||
114, 166, 252, 296, 0, &
|
||||
9, 164, 257, 265, 0, &
|
||||
6, 202, 257, 283, 0, &
|
||||
2, 203, 247, 282, 0, &
|
||||
89, 168, 239, 290, 0, &
|
||||
115, 206, 243, 279, 0, &
|
||||
116, 204, 255, 297, 298, &
|
||||
97, 214, 255, 291, 0, &
|
||||
86, 172, 243, 281, 0, &
|
||||
117, 186, 262, 289, 0, &
|
||||
96, 160, 238, 268, 297, &
|
||||
35, 170, 253, 283, 0, &
|
||||
40, 214, 239, 275, 0, &
|
||||
21, 192, 262, 276, 0, &
|
||||
98, 205, 254, 277, 0, &
|
||||
3, 192, 249, 293, 0, &
|
||||
113, 191, 250, 271, 0, &
|
||||
70, 133, 240, 279, 0, &
|
||||
100, 201, 239, 281, 0, &
|
||||
95, 175, 253, 286, 0, &
|
||||
115, 183, 245, 299, 0, &
|
||||
55, 154, 243, 288, 0, &
|
||||
107, 196, 218, 274, 0, &
|
||||
22, 201, 258, 272, 0, &
|
||||
118, 204, 254, 282, 0, &
|
||||
91, 138, 242, 284, 0, &
|
||||
54, 215, 249, 282, 0, &
|
||||
12, 188, 258, 280, 0, &
|
||||
114, 140, 247, 280, 0, &
|
||||
74, 184, 217, 267, 0, &
|
||||
104, 216, 255, 263, 0, &
|
||||
110, 191, 244, 295, 0, &
|
||||
52, 188, 242, 285, 0, &
|
||||
116, 136, 218, 289, 0, &
|
||||
23, 150, 214, 278, 0, &
|
||||
119, 185, 252, 277, 0, &
|
||||
79, 207, 251, 266, 0, &
|
||||
109, 127, 211, 269, 0, &
|
||||
25, 167, 242, 289, 0, &
|
||||
62, 193, 264, 287, 0, &
|
||||
118, 135, 229, 265, 0, &
|
||||
117, 213, 248, 297, 0, &
|
||||
33, 169, 256, 268, 0, &
|
||||
67, 147, 208, 268, 0, &
|
||||
108, 164, 261, 296, 0, &
|
||||
106, 153, 245, 280, 0, &
|
||||
120, 209, 243, 271, 0, &
|
||||
112, 162, 265, 285, 0, &
|
||||
119, 211, 258, 275, 0, &
|
||||
61, 144, 250, 290, 0, &
|
||||
14, 208, 250, 277, 0, &
|
||||
73, 195, 240, 273, 0, &
|
||||
102, 205, 235, 271, 0, &
|
||||
48, 184, 259, 285, 0, &
|
||||
120, 189, 261, 269, 297/
|
||||
|
||||
data nrw/ &
|
||||
5,5,4,5,4,4,5,4,4,4,4,4,4,5,4,4,4,4,4,4, &
|
||||
5,5,5,4,5,4,4,4,4,4,4,5,4,4,5,4,5,5,4,4, &
|
||||
5,4,5,4,4,4,4,4,4,4,4,5,4,4,4,4,5,4,4,4, &
|
||||
4,4,5,5,4,4,4,4,4,4,4,5,4,4,5,5,4,4,4,4, &
|
||||
4,4,4,4,4,4,4,4,5,4,4,4,4,4,4,5,4,4,4,4, &
|
||||
4,4,4,4,4,4,4,4,4,4,4,4,4,5,4,5,4,5,4,5, &
|
||||
4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4, &
|
||||
4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4, &
|
||||
4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4, &
|
||||
4,4,4,4,4,4,4,4,4,4,4,5,4,4,4,5,4,4,4,4, &
|
||||
4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4, &
|
||||
4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,5/
|
||||
|
||||
data ncw/ &
|
||||
2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2, &
|
||||
2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2, &
|
||||
2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2, &
|
||||
2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2, &
|
||||
2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2, &
|
||||
2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2, &
|
||||
2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2, &
|
||||
2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,3,3,3, &
|
||||
3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3, &
|
||||
3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3, &
|
||||
3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3, &
|
||||
3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,7,7, &
|
||||
7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7, &
|
||||
7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7, &
|
||||
7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7/
|
||||
|
||||
!ncw=3
|
||||
|
||||
toc=0
|
||||
tov=0
|
||||
tanhtoc=0
|
||||
!write(*,*) llr
|
||||
! initialize messages to checks
|
||||
do j=1,M
|
||||
do i=1,nrw(j)
|
||||
toc(i,j)=llr((Nm(i,j)))
|
||||
enddo
|
||||
enddo
|
||||
|
||||
ncnt=0
|
||||
|
||||
do iter=0,maxiterations
|
||||
|
||||
! Update bit log likelihood ratios (tov=0 in iteration 0).
|
||||
do i=1,N
|
||||
if( apmask(i) .ne. 1 ) then
|
||||
zn(i)=llr(i)+sum(tov(1:ncw(i),i))
|
||||
else
|
||||
zn(i)=llr(i)
|
||||
endif
|
||||
enddo
|
||||
|
||||
! Check to see if we have a codeword (check before we do any iteration).
|
||||
cw=0
|
||||
where( zn .gt. 0. ) cw=1
|
||||
ncheck=0
|
||||
do i=1,M
|
||||
synd(i)=sum(cw(Nm(1:nrw(i),i)))
|
||||
if( mod(synd(i),2) .ne. 0 ) ncheck=ncheck+1
|
||||
! if( mod(synd(i),2) .ne. 0 ) write(*,*) 'check ',i,' unsatisfied'
|
||||
enddo
|
||||
!write(*,*) 'number of unsatisfied parity checks ',ncheck
|
||||
if( ncheck .eq. 0 ) then ! we have a codeword - reorder the columns and return it
|
||||
! niterations=iter
|
||||
codeword=cw(colorder+1)
|
||||
decoded=codeword(M+1:N)
|
||||
nerr=0
|
||||
do i=1,N
|
||||
if( (2*cw(i)-1)*llr(i) .lt. 0.0 ) nerr=nerr+1
|
||||
enddo
|
||||
niterations=nerr
|
||||
return
|
||||
endif
|
||||
|
||||
if( iter.gt.0 ) then ! this code block implements an early stopping criterion
|
||||
nd=ncheck-nclast
|
||||
if( nd .lt. 0 ) then ! # of unsatisfied parity checks decreased
|
||||
ncnt=0 ! reset counter
|
||||
else
|
||||
ncnt=ncnt+1
|
||||
endif
|
||||
! write(*,*) iter,ncheck,nd,ncnt
|
||||
if( ncnt .ge. 5 .and. iter .ge. 15 .and. ncheck .gt. 50) then
|
||||
niterations=-1
|
||||
return
|
||||
endif
|
||||
endif
|
||||
nclast=ncheck
|
||||
|
||||
! Send messages from bits to check nodes
|
||||
do j=1,M
|
||||
do i=1,nrw(j)
|
||||
ibj=Nm(i,j)
|
||||
toc(i,j)=zn(ibj)
|
||||
! do kk=1,ncw(ibj) ! subtract off what the bit had received from the check
|
||||
do kk=1,7 ! subtract off what the bit had received from the check
|
||||
if( Mn(kk,ibj) .eq. j ) then
|
||||
toc(i,j)=toc(i,j)-tov(kk,ibj)
|
||||
endif
|
||||
enddo
|
||||
enddo
|
||||
enddo
|
||||
|
||||
! send messages from check nodes to variable nodes
|
||||
do i=1,M
|
||||
tanhtoc(1:5,i)=tanh(-toc(1:5,i)/2)
|
||||
enddo
|
||||
|
||||
do j=1,N
|
||||
do i=1,ncw(j)
|
||||
ichk=Mn(i,j) ! Mn(:,j) are the checks that include bit j
|
||||
Tmn=product(tanhtoc(1:nrw(ichk),ichk),mask=Nm(1:nrw(ichk),ichk).ne.j)
|
||||
call platanh(-Tmn,y)
|
||||
! y=atanh(-Tmn)
|
||||
tov(i,j)=2*y
|
||||
enddo
|
||||
enddo
|
||||
|
||||
enddo
|
||||
niterations=-1
|
||||
return
|
||||
end subroutine bpdecode300
|
||||
@@ -0,0 +1,39 @@
|
||||
|
||||
#ifndef BOOST_MPL_POP_FRONT_HPP_INCLUDED
|
||||
#define BOOST_MPL_POP_FRONT_HPP_INCLUDED
|
||||
|
||||
// Copyright Aleksey Gurtovoy 2000-2004
|
||||
//
|
||||
// Distributed under the Boost Software License, Version 1.0.
|
||||
// (See accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
//
|
||||
// See http://www.boost.org/libs/mpl for documentation.
|
||||
|
||||
// $Id$
|
||||
// $Date$
|
||||
// $Revision$
|
||||
|
||||
#include <boost/mpl/pop_front_fwd.hpp>
|
||||
#include <boost/mpl/aux_/pop_front_impl.hpp>
|
||||
#include <boost/mpl/sequence_tag.hpp>
|
||||
#include <boost/mpl/aux_/na_spec.hpp>
|
||||
#include <boost/mpl/aux_/lambda_support.hpp>
|
||||
|
||||
namespace boost { namespace mpl {
|
||||
|
||||
template<
|
||||
typename BOOST_MPL_AUX_NA_PARAM(Sequence)
|
||||
>
|
||||
struct pop_front
|
||||
: pop_front_impl< typename sequence_tag<Sequence>::type >
|
||||
::template apply< Sequence >
|
||||
{
|
||||
BOOST_MPL_AUX_LAMBDA_SUPPORT(1,pop_front,(Sequence))
|
||||
};
|
||||
|
||||
BOOST_MPL_AUX_NA_SPEC(1, pop_front)
|
||||
|
||||
}}
|
||||
|
||||
#endif // BOOST_MPL_POP_FRONT_HPP_INCLUDED
|
||||
@@ -0,0 +1,785 @@
|
||||
// Copyright Kevlin Henney, 2000-2005.
|
||||
// Copyright Alexander Nasonov, 2006-2010.
|
||||
// Copyright Antony Polukhin, 2011-2016.
|
||||
//
|
||||
// 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)
|
||||
//
|
||||
// what: lexical_cast custom keyword cast
|
||||
// who: contributed by Kevlin Henney,
|
||||
// enhanced with contributions from Terje Slettebo,
|
||||
// with additional fixes and suggestions from Gennaro Prota,
|
||||
// Beman Dawes, Dave Abrahams, Daryle Walker, Peter Dimov,
|
||||
// Alexander Nasonov, Antony Polukhin, Justin Viiret, Michael Hofmann,
|
||||
// Cheng Yang, Matthew Bradbury, David W. Birdsall, Pavel Korzh and other Boosters
|
||||
// when: November 2000, March 2003, June 2005, June 2006, March 2011 - 2014, Nowember 2016
|
||||
|
||||
#ifndef BOOST_LEXICAL_CAST_DETAIL_CONVERTER_LEXICAL_STREAMS_HPP
|
||||
#define BOOST_LEXICAL_CAST_DETAIL_CONVERTER_LEXICAL_STREAMS_HPP
|
||||
|
||||
#include <boost/config.hpp>
|
||||
#ifdef BOOST_HAS_PRAGMA_ONCE
|
||||
# pragma once
|
||||
#endif
|
||||
|
||||
|
||||
#if defined(BOOST_NO_STRINGSTREAM) || defined(BOOST_NO_STD_WSTRING)
|
||||
#define BOOST_LCAST_NO_WCHAR_T
|
||||
#endif
|
||||
|
||||
#include <cstddef>
|
||||
#include <string>
|
||||
#include <cstring>
|
||||
#include <cstdio>
|
||||
#include <boost/limits.hpp>
|
||||
#include <boost/mpl/if.hpp>
|
||||
#include <boost/type_traits/is_pointer.hpp>
|
||||
#include <boost/static_assert.hpp>
|
||||
#include <boost/detail/workaround.hpp>
|
||||
|
||||
|
||||
#ifndef BOOST_NO_STD_LOCALE
|
||||
# include <locale>
|
||||
#else
|
||||
# ifndef BOOST_LEXICAL_CAST_ASSUME_C_LOCALE
|
||||
// Getting error at this point means, that your STL library is old/lame/misconfigured.
|
||||
// If nothing can be done with STL library, define BOOST_LEXICAL_CAST_ASSUME_C_LOCALE,
|
||||
// but beware: lexical_cast will understand only 'C' locale delimeters and thousands
|
||||
// separators.
|
||||
# error "Unable to use <locale> header. Define BOOST_LEXICAL_CAST_ASSUME_C_LOCALE to force "
|
||||
# error "boost::lexical_cast to use only 'C' locale during conversions."
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#ifdef BOOST_NO_STRINGSTREAM
|
||||
#include <strstream>
|
||||
#else
|
||||
#include <sstream>
|
||||
#endif
|
||||
|
||||
#include <boost/lexical_cast/detail/lcast_char_constants.hpp>
|
||||
#include <boost/lexical_cast/detail/lcast_unsigned_converters.hpp>
|
||||
#include <boost/lexical_cast/detail/inf_nan.hpp>
|
||||
|
||||
#include <istream>
|
||||
|
||||
#ifndef BOOST_NO_CXX11_HDR_ARRAY
|
||||
#include <array>
|
||||
#endif
|
||||
|
||||
#include <boost/array.hpp>
|
||||
#include <boost/type_traits/make_unsigned.hpp>
|
||||
#include <boost/type_traits/is_integral.hpp>
|
||||
#include <boost/type_traits/is_float.hpp>
|
||||
#include <boost/range/iterator_range_core.hpp>
|
||||
#include <boost/container/container_fwd.hpp>
|
||||
#include <boost/integer.hpp>
|
||||
#include <boost/detail/basic_pointerbuf.hpp>
|
||||
#include <boost/noncopyable.hpp>
|
||||
#ifndef BOOST_NO_CWCHAR
|
||||
# include <cwchar>
|
||||
#endif
|
||||
|
||||
namespace boost {
|
||||
|
||||
namespace detail // basic_unlockedbuf
|
||||
{
|
||||
// acts as a stream buffer which wraps around a pair of pointers
|
||||
// and gives acces to internals
|
||||
template <class BufferType, class CharT>
|
||||
class basic_unlockedbuf : public basic_pointerbuf<CharT, BufferType> {
|
||||
public:
|
||||
typedef basic_pointerbuf<CharT, BufferType> base_type;
|
||||
typedef BOOST_DEDUCED_TYPENAME base_type::streamsize streamsize;
|
||||
|
||||
#ifndef BOOST_NO_USING_TEMPLATE
|
||||
using base_type::pptr;
|
||||
using base_type::pbase;
|
||||
using base_type::setbuf;
|
||||
#else
|
||||
charT* pptr() const { return base_type::pptr(); }
|
||||
charT* pbase() const { return base_type::pbase(); }
|
||||
BufferType* setbuf(char_type* s, streamsize n) { return base_type::setbuf(s, n); }
|
||||
#endif
|
||||
};
|
||||
}
|
||||
|
||||
namespace detail
|
||||
{
|
||||
struct do_not_construct_out_buffer_t{};
|
||||
struct do_not_construct_out_stream_t{
|
||||
do_not_construct_out_stream_t(do_not_construct_out_buffer_t*){}
|
||||
};
|
||||
|
||||
template <class CharT, class Traits>
|
||||
struct out_stream_helper_trait {
|
||||
#if defined(BOOST_NO_STRINGSTREAM)
|
||||
typedef std::ostream out_stream_t;
|
||||
typedef basic_unlockedbuf<std::strstreambuf, char> stringbuffer_t;
|
||||
#elif defined(BOOST_NO_STD_LOCALE)
|
||||
typedef std::ostream out_stream_t;
|
||||
typedef basic_unlockedbuf<std::stringbuf, char> stringbuffer_t;
|
||||
typedef basic_unlockedbuf<std::streambuf, char> buffer_t;
|
||||
#else
|
||||
typedef std::basic_ostream<CharT, Traits> out_stream_t;
|
||||
typedef basic_unlockedbuf<std::basic_stringbuf<CharT, Traits>, CharT> stringbuffer_t;
|
||||
typedef basic_unlockedbuf<std::basic_streambuf<CharT, Traits>, CharT> buffer_t;
|
||||
#endif
|
||||
};
|
||||
}
|
||||
|
||||
namespace detail // optimized stream wrappers
|
||||
{
|
||||
template< class CharT // a result of widest_char transformation
|
||||
, class Traits
|
||||
, bool RequiresStringbuffer
|
||||
, std::size_t CharacterBufferSize
|
||||
>
|
||||
class lexical_istream_limited_src: boost::noncopyable {
|
||||
typedef BOOST_DEDUCED_TYPENAME boost::mpl::if_c<
|
||||
RequiresStringbuffer,
|
||||
BOOST_DEDUCED_TYPENAME out_stream_helper_trait<CharT, Traits>::out_stream_t,
|
||||
do_not_construct_out_stream_t
|
||||
>::type deduced_out_stream_t;
|
||||
|
||||
typedef BOOST_DEDUCED_TYPENAME boost::mpl::if_c<
|
||||
RequiresStringbuffer,
|
||||
BOOST_DEDUCED_TYPENAME out_stream_helper_trait<CharT, Traits>::stringbuffer_t,
|
||||
do_not_construct_out_buffer_t
|
||||
>::type deduced_out_buffer_t;
|
||||
|
||||
deduced_out_buffer_t out_buffer;
|
||||
deduced_out_stream_t out_stream;
|
||||
CharT buffer[CharacterBufferSize];
|
||||
|
||||
// After the `operator <<` finishes, `[start, finish)` is
|
||||
// the range to output by `operator >>`
|
||||
const CharT* start;
|
||||
const CharT* finish;
|
||||
|
||||
public:
|
||||
lexical_istream_limited_src() BOOST_NOEXCEPT
|
||||
: out_buffer()
|
||||
, out_stream(&out_buffer)
|
||||
, start(buffer)
|
||||
, finish(buffer + CharacterBufferSize)
|
||||
{}
|
||||
|
||||
const CharT* cbegin() const BOOST_NOEXCEPT {
|
||||
return start;
|
||||
}
|
||||
|
||||
const CharT* cend() const BOOST_NOEXCEPT {
|
||||
return finish;
|
||||
}
|
||||
|
||||
private:
|
||||
/************************************ HELPER FUNCTIONS FOR OPERATORS << ( ... ) ********************************/
|
||||
bool shl_char(CharT ch) BOOST_NOEXCEPT {
|
||||
Traits::assign(buffer[0], ch);
|
||||
finish = start + 1;
|
||||
return true;
|
||||
}
|
||||
|
||||
#ifndef BOOST_LCAST_NO_WCHAR_T
|
||||
template <class T>
|
||||
bool shl_char(T ch) {
|
||||
BOOST_STATIC_ASSERT_MSG(( sizeof(T) <= sizeof(CharT)) ,
|
||||
"boost::lexical_cast does not support narrowing of char types."
|
||||
"Use boost::locale instead" );
|
||||
#ifndef BOOST_LEXICAL_CAST_ASSUME_C_LOCALE
|
||||
std::locale loc;
|
||||
CharT const w = BOOST_USE_FACET(std::ctype<CharT>, loc).widen(ch);
|
||||
#else
|
||||
CharT const w = static_cast<CharT>(ch);
|
||||
#endif
|
||||
Traits::assign(buffer[0], w);
|
||||
finish = start + 1;
|
||||
return true;
|
||||
}
|
||||
#endif
|
||||
|
||||
bool shl_char_array(CharT const* str) BOOST_NOEXCEPT {
|
||||
start = str;
|
||||
finish = start + Traits::length(str);
|
||||
return true;
|
||||
}
|
||||
|
||||
template <class T>
|
||||
bool shl_char_array(T const* str) {
|
||||
BOOST_STATIC_ASSERT_MSG(( sizeof(T) <= sizeof(CharT)),
|
||||
"boost::lexical_cast does not support narrowing of char types."
|
||||
"Use boost::locale instead" );
|
||||
return shl_input_streamable(str);
|
||||
}
|
||||
|
||||
bool shl_char_array_limited(CharT const* str, std::size_t max_size) BOOST_NOEXCEPT {
|
||||
start = str;
|
||||
finish = std::find(start, start + max_size, Traits::to_char_type(0));
|
||||
return true;
|
||||
}
|
||||
|
||||
template<typename InputStreamable>
|
||||
bool shl_input_streamable(InputStreamable& input) {
|
||||
#if defined(BOOST_NO_STRINGSTREAM) || defined(BOOST_NO_STD_LOCALE)
|
||||
// If you have compilation error at this point, than your STL library
|
||||
// does not support such conversions. Try updating it.
|
||||
BOOST_STATIC_ASSERT((boost::is_same<char, CharT>::value));
|
||||
#endif
|
||||
|
||||
#ifndef BOOST_NO_EXCEPTIONS
|
||||
out_stream.exceptions(std::ios::badbit);
|
||||
try {
|
||||
#endif
|
||||
bool const result = !(out_stream << input).fail();
|
||||
const deduced_out_buffer_t* const p = static_cast<deduced_out_buffer_t*>(
|
||||
out_stream.rdbuf()
|
||||
);
|
||||
start = p->pbase();
|
||||
finish = p->pptr();
|
||||
return result;
|
||||
#ifndef BOOST_NO_EXCEPTIONS
|
||||
} catch (const ::std::ios_base::failure& /*f*/) {
|
||||
return false;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
template <class T>
|
||||
inline bool shl_unsigned(const T n) {
|
||||
CharT* tmp_finish = buffer + CharacterBufferSize;
|
||||
start = lcast_put_unsigned<Traits, T, CharT>(n, tmp_finish).convert();
|
||||
finish = tmp_finish;
|
||||
return true;
|
||||
}
|
||||
|
||||
template <class T>
|
||||
inline bool shl_signed(const T n) {
|
||||
CharT* tmp_finish = buffer + CharacterBufferSize;
|
||||
typedef BOOST_DEDUCED_TYPENAME boost::make_unsigned<T>::type utype;
|
||||
CharT* tmp_start = lcast_put_unsigned<Traits, utype, CharT>(lcast_to_unsigned(n), tmp_finish).convert();
|
||||
if (n < 0) {
|
||||
--tmp_start;
|
||||
CharT const minus = lcast_char_constants<CharT>::minus;
|
||||
Traits::assign(*tmp_start, minus);
|
||||
}
|
||||
start = tmp_start;
|
||||
finish = tmp_finish;
|
||||
return true;
|
||||
}
|
||||
|
||||
template <class T, class SomeCharT>
|
||||
bool shl_real_type(const T& val, SomeCharT* /*begin*/) {
|
||||
lcast_set_precision(out_stream, &val);
|
||||
return shl_input_streamable(val);
|
||||
}
|
||||
|
||||
bool shl_real_type(float val, char* begin) {
|
||||
using namespace std;
|
||||
const double val_as_double = val;
|
||||
finish = start +
|
||||
#if defined(_MSC_VER) && (_MSC_VER >= 1400) && !defined(__SGI_STL_PORT) && !defined(_STLPORT_VERSION)
|
||||
sprintf_s(begin, CharacterBufferSize,
|
||||
#else
|
||||
sprintf(begin,
|
||||
#endif
|
||||
"%.*g", static_cast<int>(boost::detail::lcast_get_precision<float>()), val_as_double);
|
||||
return finish > start;
|
||||
}
|
||||
|
||||
bool shl_real_type(double val, char* begin) {
|
||||
using namespace std;
|
||||
finish = start +
|
||||
#if defined(_MSC_VER) && (_MSC_VER >= 1400) && !defined(__SGI_STL_PORT) && !defined(_STLPORT_VERSION)
|
||||
sprintf_s(begin, CharacterBufferSize,
|
||||
#else
|
||||
sprintf(begin,
|
||||
#endif
|
||||
"%.*g", static_cast<int>(boost::detail::lcast_get_precision<double>()), val);
|
||||
return finish > start;
|
||||
}
|
||||
|
||||
#ifndef __MINGW32__
|
||||
bool shl_real_type(long double val, char* begin) {
|
||||
using namespace std;
|
||||
finish = start +
|
||||
#if defined(_MSC_VER) && (_MSC_VER >= 1400) && !defined(__SGI_STL_PORT) && !defined(_STLPORT_VERSION)
|
||||
sprintf_s(begin, CharacterBufferSize,
|
||||
#else
|
||||
sprintf(begin,
|
||||
#endif
|
||||
"%.*Lg", static_cast<int>(boost::detail::lcast_get_precision<long double>()), val );
|
||||
return finish > start;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
#if !defined(BOOST_LCAST_NO_WCHAR_T) && !defined(BOOST_NO_SWPRINTF) && !defined(__MINGW32__)
|
||||
bool shl_real_type(float val, wchar_t* begin) {
|
||||
using namespace std;
|
||||
const double val_as_double = val;
|
||||
finish = start + swprintf(begin, CharacterBufferSize,
|
||||
L"%.*g",
|
||||
static_cast<int>(boost::detail::lcast_get_precision<float >()),
|
||||
val_as_double );
|
||||
return finish > start;
|
||||
}
|
||||
|
||||
bool shl_real_type(double val, wchar_t* begin) {
|
||||
using namespace std;
|
||||
finish = start + swprintf(begin, CharacterBufferSize,
|
||||
L"%.*g", static_cast<int>(boost::detail::lcast_get_precision<double >()), val );
|
||||
return finish > start;
|
||||
}
|
||||
|
||||
bool shl_real_type(long double val, wchar_t* begin) {
|
||||
using namespace std;
|
||||
finish = start + swprintf(begin, CharacterBufferSize,
|
||||
L"%.*Lg", static_cast<int>(boost::detail::lcast_get_precision<long double >()), val );
|
||||
return finish > start;
|
||||
}
|
||||
#endif
|
||||
template <class T>
|
||||
bool shl_real(T val) {
|
||||
CharT* tmp_finish = buffer + CharacterBufferSize;
|
||||
if (put_inf_nan(buffer, tmp_finish, val)) {
|
||||
finish = tmp_finish;
|
||||
return true;
|
||||
}
|
||||
|
||||
return shl_real_type(val, static_cast<CharT*>(buffer));
|
||||
}
|
||||
|
||||
/************************************ OPERATORS << ( ... ) ********************************/
|
||||
public:
|
||||
template<class Alloc>
|
||||
bool operator<<(std::basic_string<CharT,Traits,Alloc> const& str) BOOST_NOEXCEPT {
|
||||
start = str.data();
|
||||
finish = start + str.length();
|
||||
return true;
|
||||
}
|
||||
|
||||
template<class Alloc>
|
||||
bool operator<<(boost::container::basic_string<CharT,Traits,Alloc> const& str) BOOST_NOEXCEPT {
|
||||
start = str.data();
|
||||
finish = start + str.length();
|
||||
return true;
|
||||
}
|
||||
|
||||
bool operator<<(bool value) BOOST_NOEXCEPT {
|
||||
CharT const czero = lcast_char_constants<CharT>::zero;
|
||||
Traits::assign(buffer[0], Traits::to_char_type(czero + value));
|
||||
finish = start + 1;
|
||||
return true;
|
||||
}
|
||||
|
||||
template <class C>
|
||||
BOOST_DEDUCED_TYPENAME boost::disable_if<boost::is_const<C>, bool>::type
|
||||
operator<<(const iterator_range<C*>& rng) BOOST_NOEXCEPT {
|
||||
return (*this) << iterator_range<const C*>(rng.begin(), rng.end());
|
||||
}
|
||||
|
||||
bool operator<<(const iterator_range<const CharT*>& rng) BOOST_NOEXCEPT {
|
||||
start = rng.begin();
|
||||
finish = rng.end();
|
||||
return true;
|
||||
}
|
||||
|
||||
bool operator<<(const iterator_range<const signed char*>& rng) BOOST_NOEXCEPT {
|
||||
return (*this) << iterator_range<const char*>(
|
||||
reinterpret_cast<const char*>(rng.begin()),
|
||||
reinterpret_cast<const char*>(rng.end())
|
||||
);
|
||||
}
|
||||
|
||||
bool operator<<(const iterator_range<const unsigned char*>& rng) BOOST_NOEXCEPT {
|
||||
return (*this) << iterator_range<const char*>(
|
||||
reinterpret_cast<const char*>(rng.begin()),
|
||||
reinterpret_cast<const char*>(rng.end())
|
||||
);
|
||||
}
|
||||
|
||||
bool operator<<(char ch) { return shl_char(ch); }
|
||||
bool operator<<(unsigned char ch) { return ((*this) << static_cast<char>(ch)); }
|
||||
bool operator<<(signed char ch) { return ((*this) << static_cast<char>(ch)); }
|
||||
#if !defined(BOOST_LCAST_NO_WCHAR_T)
|
||||
bool operator<<(wchar_t const* str) { return shl_char_array(str); }
|
||||
bool operator<<(wchar_t * str) { return shl_char_array(str); }
|
||||
#ifndef BOOST_NO_INTRINSIC_WCHAR_T
|
||||
bool operator<<(wchar_t ch) { return shl_char(ch); }
|
||||
#endif
|
||||
#endif
|
||||
#if !defined(BOOST_NO_CXX11_CHAR16_T) && !defined(BOOST_NO_CXX11_UNICODE_LITERALS)
|
||||
bool operator<<(char16_t ch) { return shl_char(ch); }
|
||||
bool operator<<(char16_t * str) { return shl_char_array(str); }
|
||||
bool operator<<(char16_t const * str) { return shl_char_array(str); }
|
||||
#endif
|
||||
#if !defined(BOOST_NO_CXX11_CHAR32_T) && !defined(BOOST_NO_CXX11_UNICODE_LITERALS)
|
||||
bool operator<<(char32_t ch) { return shl_char(ch); }
|
||||
bool operator<<(char32_t * str) { return shl_char_array(str); }
|
||||
bool operator<<(char32_t const * str) { return shl_char_array(str); }
|
||||
#endif
|
||||
bool operator<<(unsigned char const* ch) { return ((*this) << reinterpret_cast<char const*>(ch)); }
|
||||
bool operator<<(unsigned char * ch) { return ((*this) << reinterpret_cast<char *>(ch)); }
|
||||
bool operator<<(signed char const* ch) { return ((*this) << reinterpret_cast<char const*>(ch)); }
|
||||
bool operator<<(signed char * ch) { return ((*this) << reinterpret_cast<char *>(ch)); }
|
||||
bool operator<<(char const* str) { return shl_char_array(str); }
|
||||
bool operator<<(char* str) { return shl_char_array(str); }
|
||||
bool operator<<(short n) { return shl_signed(n); }
|
||||
bool operator<<(int n) { return shl_signed(n); }
|
||||
bool operator<<(long n) { return shl_signed(n); }
|
||||
bool operator<<(unsigned short n) { return shl_unsigned(n); }
|
||||
bool operator<<(unsigned int n) { return shl_unsigned(n); }
|
||||
bool operator<<(unsigned long n) { return shl_unsigned(n); }
|
||||
|
||||
#if defined(BOOST_HAS_LONG_LONG)
|
||||
bool operator<<(boost::ulong_long_type n) { return shl_unsigned(n); }
|
||||
bool operator<<(boost::long_long_type n) { return shl_signed(n); }
|
||||
#elif defined(BOOST_HAS_MS_INT64)
|
||||
bool operator<<(unsigned __int64 n) { return shl_unsigned(n); }
|
||||
bool operator<<( __int64 n) { return shl_signed(n); }
|
||||
#endif
|
||||
|
||||
#ifdef BOOST_HAS_INT128
|
||||
bool operator<<(const boost::uint128_type& n) { return shl_unsigned(n); }
|
||||
bool operator<<(const boost::int128_type& n) { return shl_signed(n); }
|
||||
#endif
|
||||
bool operator<<(float val) { return shl_real(val); }
|
||||
bool operator<<(double val) { return shl_real(val); }
|
||||
bool operator<<(long double val) {
|
||||
#ifndef __MINGW32__
|
||||
return shl_real(val);
|
||||
#else
|
||||
return shl_real(static_cast<double>(val));
|
||||
#endif
|
||||
}
|
||||
|
||||
// Adding constness to characters. Constness does not change layout
|
||||
template <class C, std::size_t N>
|
||||
BOOST_DEDUCED_TYPENAME boost::disable_if<boost::is_const<C>, bool>::type
|
||||
operator<<(boost::array<C, N> const& input) BOOST_NOEXCEPT {
|
||||
BOOST_STATIC_ASSERT_MSG(
|
||||
(sizeof(boost::array<const C, N>) == sizeof(boost::array<C, N>)),
|
||||
"boost::array<C, N> and boost::array<const C, N> must have exactly the same layout."
|
||||
);
|
||||
return ((*this) << reinterpret_cast<boost::array<const C, N> const& >(input));
|
||||
}
|
||||
|
||||
template <std::size_t N>
|
||||
bool operator<<(boost::array<const CharT, N> const& input) BOOST_NOEXCEPT {
|
||||
return shl_char_array_limited(input.data(), N);
|
||||
}
|
||||
|
||||
template <std::size_t N>
|
||||
bool operator<<(boost::array<const unsigned char, N> const& input) BOOST_NOEXCEPT {
|
||||
return ((*this) << reinterpret_cast<boost::array<const char, N> const& >(input));
|
||||
}
|
||||
|
||||
template <std::size_t N>
|
||||
bool operator<<(boost::array<const signed char, N> const& input) BOOST_NOEXCEPT {
|
||||
return ((*this) << reinterpret_cast<boost::array<const char, N> const& >(input));
|
||||
}
|
||||
|
||||
#ifndef BOOST_NO_CXX11_HDR_ARRAY
|
||||
// Making a Boost.Array from std::array
|
||||
template <class C, std::size_t N>
|
||||
bool operator<<(std::array<C, N> const& input) BOOST_NOEXCEPT {
|
||||
BOOST_STATIC_ASSERT_MSG(
|
||||
(sizeof(std::array<C, N>) == sizeof(boost::array<C, N>)),
|
||||
"std::array and boost::array must have exactly the same layout. "
|
||||
"Bug in implementation of std::array or boost::array."
|
||||
);
|
||||
return ((*this) << reinterpret_cast<boost::array<C, N> const& >(input));
|
||||
}
|
||||
#endif
|
||||
template <class InStreamable>
|
||||
bool operator<<(const InStreamable& input) { return shl_input_streamable(input); }
|
||||
};
|
||||
|
||||
|
||||
template <class CharT, class Traits>
|
||||
class lexical_ostream_limited_src: boost::noncopyable {
|
||||
//`[start, finish)` is the range to output by `operator >>`
|
||||
const CharT* start;
|
||||
const CharT* const finish;
|
||||
|
||||
public:
|
||||
lexical_ostream_limited_src(const CharT* begin, const CharT* end) BOOST_NOEXCEPT
|
||||
: start(begin)
|
||||
, finish(end)
|
||||
{}
|
||||
|
||||
/************************************ HELPER FUNCTIONS FOR OPERATORS >> ( ... ) ********************************/
|
||||
private:
|
||||
template <typename Type>
|
||||
bool shr_unsigned(Type& output) {
|
||||
if (start == finish) return false;
|
||||
CharT const minus = lcast_char_constants<CharT>::minus;
|
||||
CharT const plus = lcast_char_constants<CharT>::plus;
|
||||
bool const has_minus = Traits::eq(minus, *start);
|
||||
|
||||
/* We won`t use `start' any more, so no need in decrementing it after */
|
||||
if (has_minus || Traits::eq(plus, *start)) {
|
||||
++start;
|
||||
}
|
||||
|
||||
bool const succeed = lcast_ret_unsigned<Traits, Type, CharT>(output, start, finish).convert();
|
||||
|
||||
if (has_minus) {
|
||||
output = static_cast<Type>(0u - output);
|
||||
}
|
||||
|
||||
return succeed;
|
||||
}
|
||||
|
||||
template <typename Type>
|
||||
bool shr_signed(Type& output) {
|
||||
if (start == finish) return false;
|
||||
CharT const minus = lcast_char_constants<CharT>::minus;
|
||||
CharT const plus = lcast_char_constants<CharT>::plus;
|
||||
typedef BOOST_DEDUCED_TYPENAME make_unsigned<Type>::type utype;
|
||||
utype out_tmp = 0;
|
||||
bool const has_minus = Traits::eq(minus, *start);
|
||||
|
||||
/* We won`t use `start' any more, so no need in decrementing it after */
|
||||
if (has_minus || Traits::eq(plus, *start)) {
|
||||
++start;
|
||||
}
|
||||
|
||||
bool succeed = lcast_ret_unsigned<Traits, utype, CharT>(out_tmp, start, finish).convert();
|
||||
if (has_minus) {
|
||||
utype const comp_val = (static_cast<utype>(1) << std::numeric_limits<Type>::digits);
|
||||
succeed = succeed && out_tmp<=comp_val;
|
||||
output = static_cast<Type>(0u - out_tmp);
|
||||
} else {
|
||||
utype const comp_val = static_cast<utype>((std::numeric_limits<Type>::max)());
|
||||
succeed = succeed && out_tmp<=comp_val;
|
||||
output = static_cast<Type>(out_tmp);
|
||||
}
|
||||
return succeed;
|
||||
}
|
||||
|
||||
template<typename InputStreamable>
|
||||
bool shr_using_base_class(InputStreamable& output)
|
||||
{
|
||||
BOOST_STATIC_ASSERT_MSG(
|
||||
(!boost::is_pointer<InputStreamable>::value),
|
||||
"boost::lexical_cast can not convert to pointers"
|
||||
);
|
||||
|
||||
#if defined(BOOST_NO_STRINGSTREAM) || defined(BOOST_NO_STD_LOCALE)
|
||||
BOOST_STATIC_ASSERT_MSG((boost::is_same<char, CharT>::value),
|
||||
"boost::lexical_cast can not convert, because your STL library does not "
|
||||
"support such conversions. Try updating it."
|
||||
);
|
||||
#endif
|
||||
|
||||
#if defined(BOOST_NO_STRINGSTREAM)
|
||||
std::istrstream stream(start, finish - start);
|
||||
#else
|
||||
BOOST_DEDUCED_TYPENAME out_stream_helper_trait<CharT, Traits>::buffer_t buf;
|
||||
// Usually `istream` and `basic_istream` do not modify
|
||||
// content of buffer; `buffer_t` assures that this is true
|
||||
buf.setbuf(const_cast<CharT*>(start), finish - start);
|
||||
#if defined(BOOST_NO_STD_LOCALE)
|
||||
std::istream stream(&buf);
|
||||
#else
|
||||
std::basic_istream<CharT, Traits> stream(&buf);
|
||||
#endif // BOOST_NO_STD_LOCALE
|
||||
#endif // BOOST_NO_STRINGSTREAM
|
||||
|
||||
#ifndef BOOST_NO_EXCEPTIONS
|
||||
stream.exceptions(std::ios::badbit);
|
||||
try {
|
||||
#endif
|
||||
stream.unsetf(std::ios::skipws);
|
||||
lcast_set_precision(stream, static_cast<InputStreamable*>(0));
|
||||
|
||||
return (stream >> output)
|
||||
&& (stream.get() == Traits::eof());
|
||||
|
||||
#ifndef BOOST_NO_EXCEPTIONS
|
||||
} catch (const ::std::ios_base::failure& /*f*/) {
|
||||
return false;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
template<class T>
|
||||
inline bool shr_xchar(T& output) BOOST_NOEXCEPT {
|
||||
BOOST_STATIC_ASSERT_MSG(( sizeof(CharT) == sizeof(T) ),
|
||||
"boost::lexical_cast does not support narrowing of character types."
|
||||
"Use boost::locale instead" );
|
||||
bool const ok = (finish - start == 1);
|
||||
if (ok) {
|
||||
CharT out;
|
||||
Traits::assign(out, *start);
|
||||
output = static_cast<T>(out);
|
||||
}
|
||||
return ok;
|
||||
}
|
||||
|
||||
template <std::size_t N, class ArrayT>
|
||||
bool shr_std_array(ArrayT& output) BOOST_NOEXCEPT {
|
||||
using namespace std;
|
||||
const std::size_t size = static_cast<std::size_t>(finish - start);
|
||||
if (size > N - 1) { // `-1` because we need to store \0 at the end
|
||||
return false;
|
||||
}
|
||||
|
||||
memcpy(&output[0], start, size * sizeof(CharT));
|
||||
output[size] = Traits::to_char_type(0);
|
||||
return true;
|
||||
}
|
||||
|
||||
/************************************ OPERATORS >> ( ... ) ********************************/
|
||||
public:
|
||||
bool operator>>(unsigned short& output) { return shr_unsigned(output); }
|
||||
bool operator>>(unsigned int& output) { return shr_unsigned(output); }
|
||||
bool operator>>(unsigned long int& output) { return shr_unsigned(output); }
|
||||
bool operator>>(short& output) { return shr_signed(output); }
|
||||
bool operator>>(int& output) { return shr_signed(output); }
|
||||
bool operator>>(long int& output) { return shr_signed(output); }
|
||||
#if defined(BOOST_HAS_LONG_LONG)
|
||||
bool operator>>(boost::ulong_long_type& output) { return shr_unsigned(output); }
|
||||
bool operator>>(boost::long_long_type& output) { return shr_signed(output); }
|
||||
#elif defined(BOOST_HAS_MS_INT64)
|
||||
bool operator>>(unsigned __int64& output) { return shr_unsigned(output); }
|
||||
bool operator>>(__int64& output) { return shr_signed(output); }
|
||||
#endif
|
||||
|
||||
#ifdef BOOST_HAS_INT128
|
||||
bool operator>>(boost::uint128_type& output) { return shr_unsigned(output); }
|
||||
bool operator>>(boost::int128_type& output) { return shr_signed(output); }
|
||||
#endif
|
||||
|
||||
bool operator>>(char& output) { return shr_xchar(output); }
|
||||
bool operator>>(unsigned char& output) { return shr_xchar(output); }
|
||||
bool operator>>(signed char& output) { return shr_xchar(output); }
|
||||
#if !defined(BOOST_LCAST_NO_WCHAR_T) && !defined(BOOST_NO_INTRINSIC_WCHAR_T)
|
||||
bool operator>>(wchar_t& output) { return shr_xchar(output); }
|
||||
#endif
|
||||
#if !defined(BOOST_NO_CXX11_CHAR16_T) && !defined(BOOST_NO_CXX11_UNICODE_LITERALS)
|
||||
bool operator>>(char16_t& output) { return shr_xchar(output); }
|
||||
#endif
|
||||
#if !defined(BOOST_NO_CXX11_CHAR32_T) && !defined(BOOST_NO_CXX11_UNICODE_LITERALS)
|
||||
bool operator>>(char32_t& output) { return shr_xchar(output); }
|
||||
#endif
|
||||
template<class Alloc>
|
||||
bool operator>>(std::basic_string<CharT,Traits,Alloc>& str) {
|
||||
str.assign(start, finish); return true;
|
||||
}
|
||||
|
||||
template<class Alloc>
|
||||
bool operator>>(boost::container::basic_string<CharT,Traits,Alloc>& str) {
|
||||
str.assign(start, finish); return true;
|
||||
}
|
||||
|
||||
template <std::size_t N>
|
||||
bool operator>>(boost::array<CharT, N>& output) BOOST_NOEXCEPT {
|
||||
return shr_std_array<N>(output);
|
||||
}
|
||||
|
||||
template <std::size_t N>
|
||||
bool operator>>(boost::array<unsigned char, N>& output) BOOST_NOEXCEPT {
|
||||
return ((*this) >> reinterpret_cast<boost::array<char, N>& >(output));
|
||||
}
|
||||
|
||||
template <std::size_t N>
|
||||
bool operator>>(boost::array<signed char, N>& output) BOOST_NOEXCEPT {
|
||||
return ((*this) >> reinterpret_cast<boost::array<char, N>& >(output));
|
||||
}
|
||||
|
||||
#ifndef BOOST_NO_CXX11_HDR_ARRAY
|
||||
template <class C, std::size_t N>
|
||||
bool operator>>(std::array<C, N>& output) BOOST_NOEXCEPT {
|
||||
BOOST_STATIC_ASSERT_MSG(
|
||||
(sizeof(std::array<C, N>) == sizeof(boost::array<C, N>)),
|
||||
"std::array<C, N> and boost::array<C, N> must have exactly the same layout."
|
||||
);
|
||||
return ((*this) >> reinterpret_cast<boost::array<C, N>& >(output));
|
||||
}
|
||||
#endif
|
||||
|
||||
bool operator>>(bool& output) BOOST_NOEXCEPT {
|
||||
output = false; // Suppress warning about uninitalized variable
|
||||
|
||||
if (start == finish) return false;
|
||||
CharT const zero = lcast_char_constants<CharT>::zero;
|
||||
CharT const plus = lcast_char_constants<CharT>::plus;
|
||||
CharT const minus = lcast_char_constants<CharT>::minus;
|
||||
|
||||
const CharT* const dec_finish = finish - 1;
|
||||
output = Traits::eq(*dec_finish, zero + 1);
|
||||
if (!output && !Traits::eq(*dec_finish, zero)) {
|
||||
return false; // Does not ends on '0' or '1'
|
||||
}
|
||||
|
||||
if (start == dec_finish) return true;
|
||||
|
||||
// We may have sign at the beginning
|
||||
if (Traits::eq(plus, *start) || (Traits::eq(minus, *start) && !output)) {
|
||||
++ start;
|
||||
}
|
||||
|
||||
// Skipping zeros
|
||||
while (start != dec_finish) {
|
||||
if (!Traits::eq(zero, *start)) {
|
||||
return false; // Not a zero => error
|
||||
}
|
||||
|
||||
++ start;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
private:
|
||||
// Not optimised converter
|
||||
template <class T>
|
||||
bool float_types_converter_internal(T& output) {
|
||||
if (parse_inf_nan(start, finish, output)) return true;
|
||||
bool const return_value = shr_using_base_class(output);
|
||||
|
||||
/* Some compilers and libraries successfully
|
||||
* parse 'inf', 'INFINITY', '1.0E', '1.0E-'...
|
||||
* We are trying to provide a unified behaviour,
|
||||
* so we just forbid such conversions (as some
|
||||
* of the most popular compilers/libraries do)
|
||||
* */
|
||||
CharT const minus = lcast_char_constants<CharT>::minus;
|
||||
CharT const plus = lcast_char_constants<CharT>::plus;
|
||||
CharT const capital_e = lcast_char_constants<CharT>::capital_e;
|
||||
CharT const lowercase_e = lcast_char_constants<CharT>::lowercase_e;
|
||||
if ( return_value &&
|
||||
(
|
||||
Traits::eq(*(finish-1), lowercase_e) // 1.0e
|
||||
|| Traits::eq(*(finish-1), capital_e) // 1.0E
|
||||
|| Traits::eq(*(finish-1), minus) // 1.0e- or 1.0E-
|
||||
|| Traits::eq(*(finish-1), plus) // 1.0e+ or 1.0E+
|
||||
)
|
||||
) return false;
|
||||
|
||||
return return_value;
|
||||
}
|
||||
|
||||
public:
|
||||
bool operator>>(float& output) { return float_types_converter_internal(output); }
|
||||
bool operator>>(double& output) { return float_types_converter_internal(output); }
|
||||
bool operator>>(long double& output) { return float_types_converter_internal(output); }
|
||||
|
||||
// Generic istream-based algorithm.
|
||||
// lcast_streambuf_for_target<InputStreamable>::value is true.
|
||||
template <typename InputStreamable>
|
||||
bool operator>>(InputStreamable& output) {
|
||||
return shr_using_base_class(output);
|
||||
}
|
||||
};
|
||||
}
|
||||
} // namespace boost
|
||||
|
||||
#undef BOOST_LCAST_NO_WCHAR_T
|
||||
|
||||
#endif // BOOST_LEXICAL_CAST_DETAIL_CONVERTER_LEXICAL_HPP
|
||||
|
||||
@@ -0,0 +1,41 @@
|
||||
/*
|
||||
[auto_generated]
|
||||
boost/numeric/odeint/external/compute/compute_algebra_dispatcher.hpp
|
||||
|
||||
[begin_description]
|
||||
algebra_dispatcher specialization for Boost.Compute
|
||||
[end_description]
|
||||
|
||||
Copyright 2009-2013 Karsten Ahnert
|
||||
Copyright 2009-2013 Mario Mulansky
|
||||
|
||||
Distributed under the Boost Software License, Version 1.0.
|
||||
(See accompanying file LICENSE_1_0.txt or
|
||||
copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
*/
|
||||
|
||||
|
||||
#ifndef BOOST_NUMERIC_ODEINT_EXTERNAL_COMPUTE_COMPUTE_ALGEBRA_DISPATCHER_HPP_DEFINED
|
||||
#define BOOST_NUMERIC_ODEINT_EXTERNAL_COMPUTE_COMPUTE_ALGEBRA_DISPATCHER_HPP_DEFINED
|
||||
|
||||
#include <boost/compute/container/vector.hpp>
|
||||
|
||||
#include <boost/numeric/odeint/external/compute/compute_algebra.hpp>
|
||||
#include <boost/numeric/odeint/algebra/algebra_dispatcher.hpp>
|
||||
|
||||
namespace boost {
|
||||
namespace numeric {
|
||||
namespace odeint {
|
||||
|
||||
// specialization for Boost.Compute vector
|
||||
template< class T , class A >
|
||||
struct algebra_dispatcher< boost::compute::vector< T , A > >
|
||||
{
|
||||
typedef compute_algebra algebra_type;
|
||||
};
|
||||
|
||||
} // namespace odeint
|
||||
} // namespace numeric
|
||||
} // namespace boost
|
||||
|
||||
#endif // BOOST_NUMERIC_ODEINT_EXTERNAL_COMPUTE_COMPUTE_ALGEBRA_DISPATCHER_HPP_DEFINED
|
||||
@@ -0,0 +1,119 @@
|
||||
|
||||
// (C) Copyright John Maddock 2000.
|
||||
// Use, modification and distribution are subject to the Boost Software License,
|
||||
// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt).
|
||||
//
|
||||
// See http://www.boost.org/libs/type_traits for most recent version including documentation.
|
||||
|
||||
#ifndef BOOST_TT_ALIGNMENT_OF_HPP_INCLUDED
|
||||
#define BOOST_TT_ALIGNMENT_OF_HPP_INCLUDED
|
||||
|
||||
#include <boost/config.hpp>
|
||||
#include <cstddef>
|
||||
|
||||
#include <boost/type_traits/intrinsics.hpp>
|
||||
#include <boost/type_traits/integral_constant.hpp>
|
||||
|
||||
#ifdef BOOST_MSVC
|
||||
# pragma warning(push)
|
||||
# pragma warning(disable: 4121 4512) // alignment is sensitive to packing
|
||||
#endif
|
||||
#if defined(__BORLANDC__) && (__BORLANDC__ < 0x600)
|
||||
#pragma option push -Vx- -Ve-
|
||||
#endif
|
||||
|
||||
namespace boost {
|
||||
|
||||
template <typename T> struct alignment_of;
|
||||
|
||||
// get the alignment of some arbitrary type:
|
||||
namespace detail {
|
||||
|
||||
#ifdef BOOST_MSVC
|
||||
#pragma warning(push)
|
||||
#pragma warning(disable:4324) // structure was padded due to __declspec(align())
|
||||
#endif
|
||||
template <typename T>
|
||||
struct alignment_of_hack
|
||||
{
|
||||
char c;
|
||||
T t;
|
||||
alignment_of_hack();
|
||||
};
|
||||
#ifdef BOOST_MSVC
|
||||
#pragma warning(pop)
|
||||
#endif
|
||||
|
||||
template <unsigned A, unsigned S>
|
||||
struct alignment_logic
|
||||
{
|
||||
BOOST_STATIC_CONSTANT(std::size_t, value = A < S ? A : S);
|
||||
};
|
||||
|
||||
|
||||
template< typename T >
|
||||
struct alignment_of_impl
|
||||
{
|
||||
#if defined(BOOST_MSVC) && (BOOST_MSVC >= 1400)
|
||||
//
|
||||
// With MSVC both the native __alignof operator
|
||||
// and our own logic gets things wrong from time to time :-(
|
||||
// Using a combination of the two seems to make the most of a bad job:
|
||||
//
|
||||
BOOST_STATIC_CONSTANT(std::size_t, value =
|
||||
(::boost::detail::alignment_logic<
|
||||
sizeof(::boost::detail::alignment_of_hack<T>) - sizeof(T),
|
||||
__alignof(T)
|
||||
>::value));
|
||||
#elif !defined(BOOST_ALIGNMENT_OF)
|
||||
BOOST_STATIC_CONSTANT(std::size_t, value =
|
||||
(::boost::detail::alignment_logic<
|
||||
sizeof(::boost::detail::alignment_of_hack<T>) - sizeof(T),
|
||||
sizeof(T)
|
||||
>::value));
|
||||
#else
|
||||
//
|
||||
// We put this here, rather than in the definition of
|
||||
// alignment_of below, because MSVC's __alignof doesn't
|
||||
// always work in that context for some unexplained reason.
|
||||
// (See type_with_alignment tests for test cases).
|
||||
//
|
||||
BOOST_STATIC_CONSTANT(std::size_t, value = BOOST_ALIGNMENT_OF(T));
|
||||
#endif
|
||||
};
|
||||
|
||||
} // namespace detail
|
||||
|
||||
template <class T> struct alignment_of : public integral_constant<std::size_t, ::boost::detail::alignment_of_impl<T>::value>{};
|
||||
|
||||
// references have to be treated specially, assume
|
||||
// that a reference is just a special pointer:
|
||||
template <typename T> struct alignment_of<T&> : public alignment_of<T*>{};
|
||||
|
||||
#ifdef __BORLANDC__
|
||||
// long double gives an incorrect value of 10 (!)
|
||||
// unless we do this...
|
||||
struct long_double_wrapper{ long double ld; };
|
||||
template<> struct alignment_of<long double> : public alignment_of<long_double_wrapper>{};
|
||||
#endif
|
||||
|
||||
// void has to be treated specially:
|
||||
template<> struct alignment_of<void> : integral_constant<std::size_t, 0>{};
|
||||
#ifndef BOOST_NO_CV_VOID_SPECIALIZATIONS
|
||||
template<> struct alignment_of<void const> : integral_constant<std::size_t, 0>{};
|
||||
template<> struct alignment_of<void const volatile> : integral_constant<std::size_t, 0>{};
|
||||
template<> struct alignment_of<void volatile> : integral_constant<std::size_t, 0>{};
|
||||
#endif
|
||||
|
||||
} // namespace boost
|
||||
|
||||
#if defined(__BORLANDC__) && (__BORLANDC__ < 0x600)
|
||||
#pragma option pop
|
||||
#endif
|
||||
#ifdef BOOST_MSVC
|
||||
# pragma warning(pop)
|
||||
#endif
|
||||
|
||||
#endif // BOOST_TT_ALIGNMENT_OF_HPP_INCLUDED
|
||||
|
||||
@@ -0,0 +1,97 @@
|
||||
// Boost math_fwd.hpp header file ------------------------------------------//
|
||||
|
||||
// (C) Copyright Hubert Holin and Daryle Walker 2001-2002. Distributed under the Boost
|
||||
// Software License, Version 1.0. (See accompanying file
|
||||
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
// See http://www.boost.org/libs/math for documentation.
|
||||
|
||||
#ifndef BOOST_MATH_FWD_HPP
|
||||
#define BOOST_MATH_FWD_HPP
|
||||
|
||||
#include <boost/cstdint.hpp>
|
||||
|
||||
namespace boost
|
||||
{
|
||||
namespace math
|
||||
{
|
||||
|
||||
|
||||
// From <boost/math/quaternion.hpp> ----------------------------------------//
|
||||
|
||||
template < typename T >
|
||||
class quaternion;
|
||||
|
||||
template < >
|
||||
class quaternion< float >;
|
||||
template < >
|
||||
class quaternion< double >;
|
||||
template < >
|
||||
class quaternion< long double >;
|
||||
|
||||
// Also has many function templates (including operators)
|
||||
|
||||
|
||||
// From <boost/math/octonion.hpp> ------------------------------------------//
|
||||
|
||||
template < typename T >
|
||||
class octonion;
|
||||
|
||||
template < >
|
||||
class octonion< float >;
|
||||
template < >
|
||||
class octonion< double >;
|
||||
template < >
|
||||
class octonion< long double >;
|
||||
|
||||
// Also has many function templates (including operators)
|
||||
|
||||
|
||||
// From <boost/math/special_functions/acosh.hpp> ---------------------------//
|
||||
|
||||
// Only has function template
|
||||
|
||||
|
||||
// From <boost/math/special_functions/asinh.hpp> ---------------------------//
|
||||
|
||||
// Only has function template
|
||||
|
||||
|
||||
// From <boost/math/special_functions/atanh.hpp> ---------------------------//
|
||||
|
||||
// Only has function template
|
||||
|
||||
|
||||
// From <boost/math/special_functions/sinc.hpp> ----------------------------//
|
||||
|
||||
// Only has function templates
|
||||
|
||||
|
||||
// From <boost/math/special_functions/sinhc.hpp> ---------------------------//
|
||||
|
||||
// Only has function templates
|
||||
|
||||
|
||||
// From <boost/math/common_factor.hpp> -------------------------------------//
|
||||
|
||||
// Only #includes other headers
|
||||
|
||||
|
||||
// From <boost/math/common_factor_ct.hpp> ----------------------------------//
|
||||
|
||||
#ifdef BOOST_NO_INTEGRAL_INT64_T
|
||||
typedef unsigned long static_gcd_type;
|
||||
#else
|
||||
typedef boost::uintmax_t static_gcd_type;
|
||||
#endif
|
||||
|
||||
template < static_gcd_type Value1, static_gcd_type Value2 >
|
||||
struct static_gcd;
|
||||
template < static_gcd_type Value1, static_gcd_type Value2 >
|
||||
struct static_lcm;
|
||||
|
||||
} // namespace math
|
||||
} // namespace boost
|
||||
|
||||
|
||||
#endif // BOOST_MATH_FWD_HPP
|
||||
@@ -0,0 +1,55 @@
|
||||
/*
|
||||
* Distributed under the Boost Software License, Version 1.0.
|
||||
* (See accompanying file LICENSE_1_0.txt or copy at
|
||||
* http://www.boost.org/LICENSE_1_0.txt)
|
||||
*
|
||||
* Copyright (c) 2009 Helge Bahmann
|
||||
* Copyright (c) 2013 Tim Blechmann
|
||||
* Copyright (c) 2012 - 2014 Andrey Semashev
|
||||
*/
|
||||
/*!
|
||||
* \file atomic/detail/caps_msvc_x86.hpp
|
||||
*
|
||||
* This header defines feature capabilities macros
|
||||
*/
|
||||
|
||||
#ifndef BOOST_ATOMIC_DETAIL_CAPS_MSVC_X86_HPP_INCLUDED_
|
||||
#define BOOST_ATOMIC_DETAIL_CAPS_MSVC_X86_HPP_INCLUDED_
|
||||
|
||||
#include <boost/atomic/detail/config.hpp>
|
||||
|
||||
#ifdef BOOST_HAS_PRAGMA_ONCE
|
||||
#pragma once
|
||||
#endif
|
||||
|
||||
#if defined(_M_IX86) && _M_IX86 >= 500
|
||||
#define BOOST_ATOMIC_DETAIL_X86_HAS_CMPXCHG8B 1
|
||||
#endif
|
||||
|
||||
#if _MSC_VER >= 1500 && defined(_M_AMD64) && !defined(BOOST_ATOMIC_NO_CMPXCHG16B)
|
||||
#define BOOST_ATOMIC_DETAIL_X86_HAS_CMPXCHG16B 1
|
||||
#endif
|
||||
|
||||
#if defined(_MSC_VER) && (defined(_M_AMD64) || (defined(_M_IX86) && defined(_M_IX86_FP) && _M_IX86_FP >= 2))
|
||||
// Use mfence only if SSE2 is available
|
||||
#define BOOST_ATOMIC_DETAIL_X86_HAS_MFENCE 1
|
||||
#endif
|
||||
|
||||
#define BOOST_ATOMIC_INT8_LOCK_FREE 2
|
||||
#define BOOST_ATOMIC_INT16_LOCK_FREE 2
|
||||
#define BOOST_ATOMIC_INT32_LOCK_FREE 2
|
||||
|
||||
#if defined(_M_AMD64) || defined(BOOST_ATOMIC_DETAIL_X86_HAS_CMPXCHG8B)
|
||||
#define BOOST_ATOMIC_INT64_LOCK_FREE 2
|
||||
#endif
|
||||
|
||||
#if defined(BOOST_ATOMIC_DETAIL_X86_HAS_CMPXCHG16B) && (defined(BOOST_HAS_INT128) || !defined(BOOST_NO_ALIGNMENT))
|
||||
#define BOOST_ATOMIC_INT128_LOCK_FREE 2
|
||||
#endif
|
||||
|
||||
#define BOOST_ATOMIC_POINTER_LOCK_FREE 2
|
||||
|
||||
#define BOOST_ATOMIC_THREAD_FENCE 2
|
||||
#define BOOST_ATOMIC_SIGNAL_FENCE 2
|
||||
|
||||
#endif // BOOST_ATOMIC_DETAIL_CAPS_MSVC_X86_HPP_INCLUDED_
|
||||
@@ -0,0 +1,177 @@
|
||||
/*==============================================================================
|
||||
Copyright (c) 2005-2010 Joel de Guzman
|
||||
Copyright (c) 2010 Thomas Heller
|
||||
|
||||
Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
==============================================================================*/
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
template <typename This, typename A0>
|
||||
struct result<This(A0 const&)>
|
||||
: detail::expression::function_eval<F, A0>
|
||||
{};
|
||||
template <typename A0>
|
||||
typename detail::expression::function_eval<F, A0>::type const
|
||||
operator()(A0 const& a0) const
|
||||
{
|
||||
return detail::expression::function_eval<F, A0>::make(f, a0);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
template <typename This, typename A0 , typename A1>
|
||||
struct result<This(A0 const& , A1 const&)>
|
||||
: detail::expression::function_eval<F, A0 , A1>
|
||||
{};
|
||||
template <typename A0 , typename A1>
|
||||
typename detail::expression::function_eval<F, A0 , A1>::type const
|
||||
operator()(A0 const& a0 , A1 const& a1) const
|
||||
{
|
||||
return detail::expression::function_eval<F, A0 , A1>::make(f, a0 , a1);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
template <typename This, typename A0 , typename A1 , typename A2>
|
||||
struct result<This(A0 const& , A1 const& , A2 const&)>
|
||||
: detail::expression::function_eval<F, A0 , A1 , A2>
|
||||
{};
|
||||
template <typename A0 , typename A1 , typename A2>
|
||||
typename detail::expression::function_eval<F, A0 , A1 , A2>::type const
|
||||
operator()(A0 const& a0 , A1 const& a1 , A2 const& a2) const
|
||||
{
|
||||
return detail::expression::function_eval<F, A0 , A1 , A2>::make(f, a0 , a1 , a2);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
template <typename This, typename A0 , typename A1 , typename A2 , typename A3>
|
||||
struct result<This(A0 const& , A1 const& , A2 const& , A3 const&)>
|
||||
: detail::expression::function_eval<F, A0 , A1 , A2 , A3>
|
||||
{};
|
||||
template <typename A0 , typename A1 , typename A2 , typename A3>
|
||||
typename detail::expression::function_eval<F, A0 , A1 , A2 , A3>::type const
|
||||
operator()(A0 const& a0 , A1 const& a1 , A2 const& a2 , A3 const& a3) const
|
||||
{
|
||||
return detail::expression::function_eval<F, A0 , A1 , A2 , A3>::make(f, a0 , a1 , a2 , a3);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
template <typename This, typename A0 , typename A1 , typename A2 , typename A3 , typename A4>
|
||||
struct result<This(A0 const& , A1 const& , A2 const& , A3 const& , A4 const&)>
|
||||
: detail::expression::function_eval<F, A0 , A1 , A2 , A3 , A4>
|
||||
{};
|
||||
template <typename A0 , typename A1 , typename A2 , typename A3 , typename A4>
|
||||
typename detail::expression::function_eval<F, A0 , A1 , A2 , A3 , A4>::type const
|
||||
operator()(A0 const& a0 , A1 const& a1 , A2 const& a2 , A3 const& a3 , A4 const& a4) const
|
||||
{
|
||||
return detail::expression::function_eval<F, A0 , A1 , A2 , A3 , A4>::make(f, a0 , a1 , a2 , a3 , a4);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
template <typename This, typename A0 , typename A1 , typename A2 , typename A3 , typename A4 , typename A5>
|
||||
struct result<This(A0 const& , A1 const& , A2 const& , A3 const& , A4 const& , A5 const&)>
|
||||
: detail::expression::function_eval<F, A0 , A1 , A2 , A3 , A4 , A5>
|
||||
{};
|
||||
template <typename A0 , typename A1 , typename A2 , typename A3 , typename A4 , typename A5>
|
||||
typename detail::expression::function_eval<F, A0 , A1 , A2 , A3 , A4 , A5>::type const
|
||||
operator()(A0 const& a0 , A1 const& a1 , A2 const& a2 , A3 const& a3 , A4 const& a4 , A5 const& a5) const
|
||||
{
|
||||
return detail::expression::function_eval<F, A0 , A1 , A2 , A3 , A4 , A5>::make(f, a0 , a1 , a2 , a3 , a4 , a5);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
template <typename This, typename A0 , typename A1 , typename A2 , typename A3 , typename A4 , typename A5 , typename A6>
|
||||
struct result<This(A0 const& , A1 const& , A2 const& , A3 const& , A4 const& , A5 const& , A6 const&)>
|
||||
: detail::expression::function_eval<F, A0 , A1 , A2 , A3 , A4 , A5 , A6>
|
||||
{};
|
||||
template <typename A0 , typename A1 , typename A2 , typename A3 , typename A4 , typename A5 , typename A6>
|
||||
typename detail::expression::function_eval<F, A0 , A1 , A2 , A3 , A4 , A5 , A6>::type const
|
||||
operator()(A0 const& a0 , A1 const& a1 , A2 const& a2 , A3 const& a3 , A4 const& a4 , A5 const& a5 , A6 const& a6) const
|
||||
{
|
||||
return detail::expression::function_eval<F, A0 , A1 , A2 , A3 , A4 , A5 , A6>::make(f, a0 , a1 , a2 , a3 , a4 , a5 , a6);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
template <typename This, typename A0 , typename A1 , typename A2 , typename A3 , typename A4 , typename A5 , typename A6 , typename A7>
|
||||
struct result<This(A0 const& , A1 const& , A2 const& , A3 const& , A4 const& , A5 const& , A6 const& , A7 const&)>
|
||||
: detail::expression::function_eval<F, A0 , A1 , A2 , A3 , A4 , A5 , A6 , A7>
|
||||
{};
|
||||
template <typename A0 , typename A1 , typename A2 , typename A3 , typename A4 , typename A5 , typename A6 , typename A7>
|
||||
typename detail::expression::function_eval<F, A0 , A1 , A2 , A3 , A4 , A5 , A6 , A7>::type const
|
||||
operator()(A0 const& a0 , A1 const& a1 , A2 const& a2 , A3 const& a3 , A4 const& a4 , A5 const& a5 , A6 const& a6 , A7 const& a7) const
|
||||
{
|
||||
return detail::expression::function_eval<F, A0 , A1 , A2 , A3 , A4 , A5 , A6 , A7>::make(f, a0 , a1 , a2 , a3 , a4 , a5 , a6 , a7);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
template <typename This, typename A0 , typename A1 , typename A2 , typename A3 , typename A4 , typename A5 , typename A6 , typename A7 , typename A8>
|
||||
struct result<This(A0 const& , A1 const& , A2 const& , A3 const& , A4 const& , A5 const& , A6 const& , A7 const& , A8 const&)>
|
||||
: detail::expression::function_eval<F, A0 , A1 , A2 , A3 , A4 , A5 , A6 , A7 , A8>
|
||||
{};
|
||||
template <typename A0 , typename A1 , typename A2 , typename A3 , typename A4 , typename A5 , typename A6 , typename A7 , typename A8>
|
||||
typename detail::expression::function_eval<F, A0 , A1 , A2 , A3 , A4 , A5 , A6 , A7 , A8>::type const
|
||||
operator()(A0 const& a0 , A1 const& a1 , A2 const& a2 , A3 const& a3 , A4 const& a4 , A5 const& a5 , A6 const& a6 , A7 const& a7 , A8 const& a8) const
|
||||
{
|
||||
return detail::expression::function_eval<F, A0 , A1 , A2 , A3 , A4 , A5 , A6 , A7 , A8>::make(f, a0 , a1 , a2 , a3 , a4 , a5 , a6 , a7 , a8);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
template <typename This, typename A0 , typename A1 , typename A2 , typename A3 , typename A4 , typename A5 , typename A6 , typename A7 , typename A8 , typename A9>
|
||||
struct result<This(A0 const& , A1 const& , A2 const& , A3 const& , A4 const& , A5 const& , A6 const& , A7 const& , A8 const& , A9 const&)>
|
||||
: detail::expression::function_eval<F, A0 , A1 , A2 , A3 , A4 , A5 , A6 , A7 , A8 , A9>
|
||||
{};
|
||||
template <typename A0 , typename A1 , typename A2 , typename A3 , typename A4 , typename A5 , typename A6 , typename A7 , typename A8 , typename A9>
|
||||
typename detail::expression::function_eval<F, A0 , A1 , A2 , A3 , A4 , A5 , A6 , A7 , A8 , A9>::type const
|
||||
operator()(A0 const& a0 , A1 const& a1 , A2 const& a2 , A3 const& a3 , A4 const& a4 , A5 const& a5 , A6 const& a6 , A7 const& a7 , A8 const& a8 , A9 const& a9) const
|
||||
{
|
||||
return detail::expression::function_eval<F, A0 , A1 , A2 , A3 , A4 , A5 , A6 , A7 , A8 , A9>::make(f, a0 , a1 , a2 , a3 , a4 , a5 , a6 , a7 , a8 , a9);
|
||||
}
|
||||
@@ -0,0 +1,76 @@
|
||||
#ifndef NETWORK_ACCESS_MANAGER_HPP__
|
||||
#define NETWORK_ACCESS_MANAGER_HPP__
|
||||
|
||||
#include <QNetworkAccessManager>
|
||||
#include <QList>
|
||||
#include <QSslError>
|
||||
#include <QNetworkReply>
|
||||
#include <QString>
|
||||
|
||||
#include "MessageBox.hpp"
|
||||
|
||||
class QNetworkRequest;
|
||||
class QIODevice;
|
||||
class QWidget;
|
||||
|
||||
// sub-class QNAM to keep a list of accepted SSL errors and allow
|
||||
// them in future replies
|
||||
class NetworkAccessManager
|
||||
: public QNetworkAccessManager
|
||||
{
|
||||
public:
|
||||
NetworkAccessManager (QWidget * parent)
|
||||
: QNetworkAccessManager (parent)
|
||||
{
|
||||
// handle SSL errors that have not been cached as allowed
|
||||
// exceptions and offer them to the user to add to the ignored
|
||||
// exception cache
|
||||
connect (this, &QNetworkAccessManager::sslErrors, [this, &parent] (QNetworkReply * reply, QList<QSslError> const& errors) {
|
||||
QString message;
|
||||
QList<QSslError> new_errors;
|
||||
for (auto const& error: errors)
|
||||
{
|
||||
if (!allowed_ssl_errors_.contains (error))
|
||||
{
|
||||
new_errors << error;
|
||||
message += '\n' + reply->request ().url ().toDisplayString () + ": "
|
||||
+ error.errorString ();
|
||||
}
|
||||
}
|
||||
if (new_errors.size ())
|
||||
{
|
||||
QString certs;
|
||||
for (auto const& cert : reply->sslConfiguration ().peerCertificateChain ())
|
||||
{
|
||||
certs += cert.toText () + '\n';
|
||||
}
|
||||
if (MessageBox::Ignore == MessageBox::query_message (parent, tr ("Network SSL Errors"), message, certs, MessageBox::Abort | MessageBox::Ignore))
|
||||
{
|
||||
// accumulate new SSL error exceptions that have been allowed
|
||||
allowed_ssl_errors_.append (new_errors);
|
||||
reply->ignoreSslErrors (allowed_ssl_errors_);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// no new exceptions so silently ignore the ones already allowed
|
||||
reply->ignoreSslErrors (allowed_ssl_errors_);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
protected:
|
||||
QNetworkReply * createRequest (Operation operation, QNetworkRequest const& request, QIODevice * outgoing_data = nullptr) override
|
||||
{
|
||||
auto reply = QNetworkAccessManager::createRequest (operation, request, outgoing_data);
|
||||
// errors are usually certificate specific so passing all cached
|
||||
// exceptions here is ok
|
||||
reply->ignoreSslErrors (allowed_ssl_errors_);
|
||||
return reply;
|
||||
}
|
||||
|
||||
private:
|
||||
QList<QSslError> allowed_ssl_errors_;
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,7 @@
|
||||
subroutine move(x,y,n)
|
||||
real x(n),y(n)
|
||||
do i=1,n
|
||||
y(i)=x(i)
|
||||
enddo
|
||||
return
|
||||
end subroutine move
|
||||
@@ -0,0 +1,49 @@
|
||||
// (C) Copyright 2009-2011 Frederic Bron.
|
||||
//
|
||||
// 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_HAS_RIGHT_SHIFT_HPP_INCLUDED
|
||||
#define BOOST_TT_HAS_RIGHT_SHIFT_HPP_INCLUDED
|
||||
|
||||
#define BOOST_TT_TRAIT_NAME has_right_shift
|
||||
#define BOOST_TT_TRAIT_OP >>
|
||||
#define BOOST_TT_FORBIDDEN_IF\
|
||||
(\
|
||||
/* Lhs==fundamental and Rhs==fundamental and (Lhs!=integral or Rhs!=integral) */\
|
||||
(\
|
||||
::boost::is_fundamental< Lhs_nocv >::value && \
|
||||
::boost::is_fundamental< Rhs_nocv >::value && \
|
||||
( \
|
||||
(! ::boost::is_integral< Lhs_noref >::value ) || \
|
||||
(! ::boost::is_integral< Rhs_noref >::value )\
|
||||
)\
|
||||
)||\
|
||||
/* Lhs==fundamental and Rhs==pointer */\
|
||||
(\
|
||||
::boost::is_fundamental< Lhs_nocv >::value && \
|
||||
::boost::is_pointer< Rhs_noref >::value\
|
||||
)||\
|
||||
/* Rhs==fundamental and Lhs==pointer */\
|
||||
(\
|
||||
::boost::is_fundamental< Rhs_nocv >::value && \
|
||||
::boost::is_pointer< Lhs_noref >::value\
|
||||
)||\
|
||||
/* Lhs==pointer and Rhs==pointer */\
|
||||
(\
|
||||
::boost::is_pointer< Lhs_noref >::value && \
|
||||
::boost::is_pointer< Rhs_noref >::value\
|
||||
)\
|
||||
)
|
||||
|
||||
|
||||
#include <boost/type_traits/detail/has_binary_operator.hpp>
|
||||
|
||||
#undef BOOST_TT_TRAIT_NAME
|
||||
#undef BOOST_TT_TRAIT_OP
|
||||
#undef BOOST_TT_FORBIDDEN_IF
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,23 @@
|
||||
// Copyright (C) 2005-2006 Douglas Gregor <doug.gregor -at- gmail.com>.
|
||||
|
||||
// Use, modification and distribution is subject to the Boost Software
|
||||
// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
// Message Passing Interface 1.1 -- Section 4. MPI Collectives
|
||||
|
||||
/** @file collectives_fwd.hpp
|
||||
*
|
||||
* This header provides forward declarations for all of the
|
||||
* collective operations contained in the header @c collectives.hpp.
|
||||
*/
|
||||
#ifndef BOOST_MPI_COLLECTIVES_FWD_HPP
|
||||
#define BOOST_MPI_COLLECTIVES_FWD_HPP
|
||||
|
||||
/// INTERNAL ONLY
|
||||
#define BOOST_MPI_COLLECTIVES_FORWARD_ONLY
|
||||
#include <boost/mpi/collectives.hpp>
|
||||
#undef BOOST_MPI_COLLECTIVES_FORWARD_ONLY
|
||||
|
||||
#endif // BOOST_MPI_COLLECTIVES_FWD_HPP
|
||||
|
||||
@@ -0,0 +1,115 @@
|
||||
/*
|
||||
[auto_generated]
|
||||
boost/numeric/odeint/util/state_wrapper.hpp
|
||||
|
||||
[begin_description]
|
||||
State wrapper for the state type in all stepper. The state wrappers are responsible for construction,
|
||||
destruction, copying construction, assignment and resizing.
|
||||
[end_description]
|
||||
|
||||
Copyright 2011-2013 Karsten Ahnert
|
||||
Copyright 2011 Mario Mulansky
|
||||
|
||||
Distributed under the Boost Software License, Version 1.0.
|
||||
(See accompanying file LICENSE_1_0.txt or
|
||||
copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
*/
|
||||
|
||||
|
||||
#ifndef BOOST_NUMERIC_ODEINT_UTIL_SAME_SIZE_HPP_INCLUDED
|
||||
#define BOOST_NUMERIC_ODEINT_UTIL_SAME_SIZE_HPP_INCLUDED
|
||||
|
||||
#include <boost/numeric/odeint/util/is_resizeable.hpp>
|
||||
|
||||
#include <boost/utility/enable_if.hpp>
|
||||
#include <boost/fusion/include/is_sequence.hpp>
|
||||
#include <boost/fusion/include/zip_view.hpp>
|
||||
#include <boost/fusion/include/vector.hpp>
|
||||
#include <boost/fusion/include/make_fused.hpp>
|
||||
#include <boost/fusion/include/all.hpp>
|
||||
|
||||
#include <boost/range.hpp>
|
||||
|
||||
|
||||
namespace boost {
|
||||
namespace numeric {
|
||||
namespace odeint {
|
||||
|
||||
template< typename State1 , typename State2 , class Enabler = void >
|
||||
struct same_size_impl_sfinae
|
||||
{
|
||||
static bool same_size( const State1 &x1 , const State2 &x2 )
|
||||
{
|
||||
return ( boost::size( x1 ) == boost::size( x2 ) );
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
// same_size function
|
||||
// standard implementation relies on boost.range
|
||||
template< class State1 , class State2 >
|
||||
struct same_size_impl
|
||||
{
|
||||
static bool same_size( const State1 &x1 , const State2 &x2 )
|
||||
{
|
||||
return same_size_impl_sfinae< State1 , State2 >::same_size( x1 , x2 );
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
// do not overload or specialize this function, specialize resize_impl<> instead
|
||||
template< class State1 , class State2 >
|
||||
bool same_size( const State1 &x1 , const State2 &x2 )
|
||||
{
|
||||
return same_size_impl< State1 , State2 >::same_size( x1 , x2 );
|
||||
}
|
||||
|
||||
namespace detail {
|
||||
|
||||
struct same_size_fusion
|
||||
{
|
||||
typedef bool result_type;
|
||||
|
||||
template< class S1 , class S2 >
|
||||
bool operator()( const S1 &x1 , const S2 &x2 ) const
|
||||
{
|
||||
return same_size_op( x1 , x2 , typename is_resizeable< S1 >::type() );
|
||||
}
|
||||
|
||||
template< class S1 , class S2 >
|
||||
bool same_size_op( const S1 &x1 , const S2 &x2 , boost::true_type ) const
|
||||
{
|
||||
return same_size( x1 , x2 );
|
||||
}
|
||||
|
||||
template< class S1 , class S2 >
|
||||
bool same_size_op( const S1 &/*x1*/ , const S2 &/*x2*/ , boost::false_type ) const
|
||||
{
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace detail
|
||||
|
||||
|
||||
|
||||
template< class FusionSeq >
|
||||
struct same_size_impl_sfinae< FusionSeq , FusionSeq , typename boost::enable_if< typename boost::fusion::traits::is_sequence< FusionSeq >::type >::type >
|
||||
{
|
||||
static bool same_size( const FusionSeq &x1 , const FusionSeq &x2 )
|
||||
{
|
||||
typedef boost::fusion::vector< const FusionSeq& , const FusionSeq& > Sequences;
|
||||
Sequences sequences( x1 , x2 );
|
||||
return boost::fusion::all( boost::fusion::zip_view< Sequences >( sequences ) ,
|
||||
boost::fusion::make_fused( detail::same_size_fusion() ) );
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
#endif // BOOST_NUMERIC_ODEINT_UTIL_SAME_SIZE_HPP_INCLUDED
|
||||
@@ -0,0 +1,25 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2016 Kohei Takahashi
|
||||
|
||||
Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
==============================================================================*/
|
||||
|
||||
#ifndef BOOST_PHOENIX_PREPROCESSED_CORE_DETAIL_FUNCTION_EVAL_EXPR_HPP
|
||||
#define BOOST_PHOENIX_PREPROCESSED_CORE_DETAIL_FUNCTION_EVAL_EXPR_HPP
|
||||
|
||||
#if BOOST_PHOENIX_LIMIT <= 10
|
||||
#include <boost/phoenix/core/detail/cpp03/preprocessed/function_eval_expr_10.hpp>
|
||||
#elif BOOST_PHOENIX_LIMIT <= 20
|
||||
#include <boost/phoenix/core/detail/cpp03/preprocessed/function_eval_expr_20.hpp>
|
||||
#elif BOOST_PHOENIX_LIMIT <= 30
|
||||
#include <boost/phoenix/core/detail/cpp03/preprocessed/function_eval_expr_30.hpp>
|
||||
#elif BOOST_PHOENIX_LIMIT <= 40
|
||||
#include <boost/phoenix/core/detail/cpp03/preprocessed/function_eval_expr_40.hpp>
|
||||
#elif BOOST_PHOENIX_LIMIT <= 50
|
||||
#include <boost/phoenix/core/detail/cpp03/preprocessed/function_eval_expr_50.hpp>
|
||||
#else
|
||||
#error "BOOST_PHOENIX_LIMIT out of bounds for preprocessed headers"
|
||||
#endif
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,17 @@
|
||||
// -----------------------------------------------------------
|
||||
//
|
||||
// Copyright (c) 2001-2002 Chuck Allison and Jeremy Siek
|
||||
// Copyright (c) 2003-2004, 2008 Gennaro Prota
|
||||
//
|
||||
// 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_DYNAMIC_BITSET_HPP
|
||||
#define BOOST_DYNAMIC_BITSET_HPP
|
||||
|
||||
#include "boost/dynamic_bitset/dynamic_bitset.hpp"
|
||||
|
||||
#endif // include guard
|
||||
@@ -0,0 +1,392 @@
|
||||
// (C) Copyright 2005 Matthias Troyer
|
||||
// (C) Copyright 2006 Douglas Gregor <doug.gregor -at gmail.com>
|
||||
|
||||
// Use, modification and distribution is subject to the Boost Software
|
||||
// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
// Authors: Matthias Troyer
|
||||
// Douglas Gregor
|
||||
|
||||
/** @file skeleton_and_content.hpp
|
||||
*
|
||||
* This header provides facilities that allow the structure of data
|
||||
* types (called the "skeleton") to be transmitted and received
|
||||
* separately from the content stored in those data types. These
|
||||
* facilities are useful when the data in a stable data structure
|
||||
* (e.g., a mesh or a graph) will need to be transmitted
|
||||
* repeatedly. In this case, transmitting the skeleton only once
|
||||
* saves both communication effort (it need not be sent again) and
|
||||
* local computation (serialization need only be performed once for
|
||||
* the content).
|
||||
*/
|
||||
#ifndef BOOST_MPI_SKELETON_AND_CONTENT_HPP
|
||||
#define BOOST_MPI_SKELETON_AND_CONTENT_HPP
|
||||
|
||||
#include <boost/mpi/config.hpp>
|
||||
#include <boost/archive/detail/auto_link_archive.hpp>
|
||||
#include <boost/mpi/packed_iarchive.hpp>
|
||||
#include <boost/mpi/packed_oarchive.hpp>
|
||||
#include <boost/mpi/detail/forward_skeleton_iarchive.hpp>
|
||||
#include <boost/mpi/detail/forward_skeleton_oarchive.hpp>
|
||||
#include <boost/mpi/detail/ignore_iprimitive.hpp>
|
||||
#include <boost/mpi/detail/ignore_oprimitive.hpp>
|
||||
#include <boost/shared_ptr.hpp>
|
||||
#include <boost/archive/detail/register_archive.hpp>
|
||||
|
||||
namespace boost { namespace mpi {
|
||||
|
||||
/**
|
||||
* @brief A proxy that requests that the skeleton of an object be
|
||||
* transmitted.
|
||||
*
|
||||
* The @c skeleton_proxy is a lightweight proxy object used to
|
||||
* indicate that the skeleton of an object, not the object itself,
|
||||
* should be transmitted. It can be used with the @c send and @c recv
|
||||
* operations of communicators or the @c broadcast collective. When a
|
||||
* @c skeleton_proxy is sent, Boost.MPI generates a description
|
||||
* containing the structure of the stored object. When that skeleton
|
||||
* is received, the receiving object is reshaped to match the
|
||||
* structure. Once the skeleton of an object as been transmitted, its
|
||||
* @c content can be transmitted separately (often several times)
|
||||
* without changing the structure of the object.
|
||||
*/
|
||||
template <class T>
|
||||
struct BOOST_MPI_DECL skeleton_proxy
|
||||
{
|
||||
/**
|
||||
* Constructs a @c skeleton_proxy that references object @p x.
|
||||
*
|
||||
* @param x the object whose structure will be transmitted or
|
||||
* altered.
|
||||
*/
|
||||
skeleton_proxy(T& x)
|
||||
: object(x)
|
||||
{}
|
||||
|
||||
T& object;
|
||||
};
|
||||
|
||||
/**
|
||||
* @brief Create a skeleton proxy object.
|
||||
*
|
||||
* This routine creates an instance of the skeleton_proxy class. It
|
||||
* will typically be used when calling @c send, @c recv, or @c
|
||||
* broadcast, to indicate that only the skeleton (structure) of an
|
||||
* object should be transmitted and not its contents.
|
||||
*
|
||||
* @param x the object whose structure will be transmitted.
|
||||
*
|
||||
* @returns a skeleton_proxy object referencing @p x
|
||||
*/
|
||||
template <class T>
|
||||
inline const skeleton_proxy<T> skeleton(T& x)
|
||||
{
|
||||
return skeleton_proxy<T>(x);
|
||||
}
|
||||
|
||||
namespace detail {
|
||||
/// @brief a class holding an MPI datatype
|
||||
/// INTERNAL ONLY
|
||||
/// the type is freed upon destruction
|
||||
class BOOST_MPI_DECL mpi_datatype_holder : public boost::noncopyable
|
||||
{
|
||||
public:
|
||||
mpi_datatype_holder()
|
||||
: is_committed(false)
|
||||
{}
|
||||
|
||||
mpi_datatype_holder(MPI_Datatype t, bool committed = true)
|
||||
: d(t)
|
||||
, is_committed(committed)
|
||||
{}
|
||||
|
||||
void commit()
|
||||
{
|
||||
BOOST_MPI_CHECK_RESULT(MPI_Type_commit,(&d));
|
||||
is_committed=true;
|
||||
}
|
||||
|
||||
MPI_Datatype get_mpi_datatype() const
|
||||
{
|
||||
return d;
|
||||
}
|
||||
|
||||
~mpi_datatype_holder()
|
||||
{
|
||||
int finalized=0;
|
||||
BOOST_MPI_CHECK_RESULT(MPI_Finalized,(&finalized));
|
||||
if (!finalized && is_committed)
|
||||
BOOST_MPI_CHECK_RESULT(MPI_Type_free,(&d));
|
||||
}
|
||||
|
||||
private:
|
||||
MPI_Datatype d;
|
||||
bool is_committed;
|
||||
};
|
||||
} // end namespace detail
|
||||
|
||||
/** @brief A proxy object that transfers the content of an object
|
||||
* without its structure.
|
||||
*
|
||||
* The @c content class indicates that Boost.MPI should transmit or
|
||||
* receive the content of an object, but without any information
|
||||
* about the structure of the object. It is only meaningful to
|
||||
* transmit the content of an object after the receiver has already
|
||||
* received the skeleton for the same object.
|
||||
*
|
||||
* Most users will not use @c content objects directly. Rather, they
|
||||
* will invoke @c send, @c recv, or @c broadcast operations using @c
|
||||
* get_content().
|
||||
*/
|
||||
class BOOST_MPI_DECL content
|
||||
{
|
||||
public:
|
||||
/**
|
||||
* Constructs an empty @c content object. This object will not be
|
||||
* useful for any Boost.MPI operations until it is reassigned.
|
||||
*/
|
||||
content() {}
|
||||
|
||||
/**
|
||||
* This routine initializes the @c content object with an MPI data
|
||||
* type that refers to the content of an object without its structure.
|
||||
*
|
||||
* @param d the MPI data type referring to the content of the object.
|
||||
*
|
||||
* @param committed @c true indicates that @c MPI_Type_commit has
|
||||
* already been excuted for the data type @p d.
|
||||
*/
|
||||
content(MPI_Datatype d, bool committed=true)
|
||||
: holder(new detail::mpi_datatype_holder(d,committed))
|
||||
{}
|
||||
|
||||
/**
|
||||
* Replace the MPI data type referencing the content of an object.
|
||||
*
|
||||
* @param d the new MPI data type referring to the content of the
|
||||
* object.
|
||||
*
|
||||
* @returns *this
|
||||
*/
|
||||
const content& operator=(MPI_Datatype d)
|
||||
{
|
||||
holder.reset(new detail::mpi_datatype_holder(d));
|
||||
return *this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieve the MPI data type that refers to the content of the
|
||||
* object.
|
||||
*
|
||||
* @returns the MPI data type, which should only be transmitted or
|
||||
* received using @c MPI_BOTTOM as the address.
|
||||
*/
|
||||
MPI_Datatype get_mpi_datatype() const
|
||||
{
|
||||
return holder->get_mpi_datatype();
|
||||
}
|
||||
|
||||
/**
|
||||
* Commit the MPI data type referring to the content of the
|
||||
* object.
|
||||
*/
|
||||
void commit()
|
||||
{
|
||||
holder->commit();
|
||||
}
|
||||
|
||||
private:
|
||||
boost::shared_ptr<detail::mpi_datatype_holder> holder;
|
||||
};
|
||||
|
||||
/** @brief Returns the content of an object, suitable for transmission
|
||||
* via Boost.MPI.
|
||||
*
|
||||
* The function creates an absolute MPI datatype for the object,
|
||||
* where all offsets are counted from the address 0 (a.k.a. @c
|
||||
* MPI_BOTTOM) instead of the address @c &x of the object. This
|
||||
* allows the creation of MPI data types for complex data structures
|
||||
* containing pointers, such as linked lists or trees.
|
||||
*
|
||||
* The disadvantage, compared to relative MPI data types is that for
|
||||
* each object a new MPI data type has to be created.
|
||||
*
|
||||
* The contents of an object can only be transmitted when the
|
||||
* receiver already has an object with the same structure or shape as
|
||||
* the sender. To accomplish this, first transmit the skeleton of the
|
||||
* object using, e.g., @c skeleton() or @c skeleton_proxy.
|
||||
*
|
||||
* The type @c T has to allow creation of an absolute MPI data type
|
||||
* (content).
|
||||
*
|
||||
* @param x the object for which the content will be transmitted.
|
||||
*
|
||||
* @returns the content of the object @p x, which can be used for
|
||||
* transmission via @c send, @c recv, or @c broadcast.
|
||||
*/
|
||||
template <class T> const content get_content(const T& x);
|
||||
|
||||
/** @brief An archiver that reconstructs a data structure based on the
|
||||
* binary skeleton stored in a buffer.
|
||||
*
|
||||
* The @c packed_skeleton_iarchive class is an Archiver (as in the
|
||||
* Boost.Serialization library) that can construct the the shape of a
|
||||
* data structure based on a binary skeleton stored in a buffer. The
|
||||
* @c packed_skeleton_iarchive is typically used by the receiver of a
|
||||
* skeleton, to prepare a data structure that will eventually receive
|
||||
* content separately.
|
||||
*
|
||||
* Users will not generally need to use @c packed_skeleton_iarchive
|
||||
* directly. Instead, use @c skeleton or @c get_skeleton.
|
||||
*/
|
||||
class BOOST_MPI_DECL packed_skeleton_iarchive
|
||||
: public detail::ignore_iprimitive,
|
||||
public detail::forward_skeleton_iarchive<packed_skeleton_iarchive,packed_iarchive>
|
||||
{
|
||||
public:
|
||||
/**
|
||||
* Construct a @c packed_skeleton_iarchive for the given
|
||||
* communicator.
|
||||
*
|
||||
* @param comm The communicator over which this archive will be
|
||||
* transmitted.
|
||||
*
|
||||
* @param flags Control the serialization of the skeleton. Refer to
|
||||
* the Boost.Serialization documentation before changing the
|
||||
* default flags.
|
||||
*/
|
||||
packed_skeleton_iarchive(MPI_Comm const & comm,
|
||||
unsigned int flags = boost::archive::no_header)
|
||||
: detail::forward_skeleton_iarchive<packed_skeleton_iarchive,packed_iarchive>(skeleton_archive_)
|
||||
, skeleton_archive_(comm,flags)
|
||||
{}
|
||||
|
||||
/**
|
||||
* Construct a @c packed_skeleton_iarchive that unpacks a skeleton
|
||||
* from the given @p archive.
|
||||
*
|
||||
* @param archive the archive from which the skeleton will be
|
||||
* unpacked.
|
||||
*
|
||||
*/
|
||||
explicit packed_skeleton_iarchive(packed_iarchive & archive)
|
||||
: detail::forward_skeleton_iarchive<packed_skeleton_iarchive,packed_iarchive>(archive)
|
||||
, skeleton_archive_(MPI_COMM_WORLD, boost::archive::no_header)
|
||||
{}
|
||||
|
||||
/**
|
||||
* Retrieve the archive corresponding to this skeleton.
|
||||
*/
|
||||
const packed_iarchive& get_skeleton() const
|
||||
{
|
||||
return this->implementation_archive;
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieve the archive corresponding to this skeleton.
|
||||
*/
|
||||
packed_iarchive& get_skeleton()
|
||||
{
|
||||
return this->implementation_archive;
|
||||
}
|
||||
|
||||
private:
|
||||
/// Store the actual archive that holds the structure, unless the
|
||||
/// user overrides this with their own archive.
|
||||
packed_iarchive skeleton_archive_;
|
||||
};
|
||||
|
||||
/** @brief An archiver that records the binary skeleton of a data
|
||||
* structure into a buffer.
|
||||
*
|
||||
* The @c packed_skeleton_oarchive class is an Archiver (as in the
|
||||
* Boost.Serialization library) that can record the shape of a data
|
||||
* structure (called the "skeleton") into a binary representation
|
||||
* stored in a buffer. The @c packed_skeleton_oarchive is typically
|
||||
* used by the send of a skeleton, to pack the skeleton of a data
|
||||
* structure for transmission separately from the content.
|
||||
*
|
||||
* Users will not generally need to use @c packed_skeleton_oarchive
|
||||
* directly. Instead, use @c skeleton or @c get_skeleton.
|
||||
*/
|
||||
class BOOST_MPI_DECL packed_skeleton_oarchive
|
||||
: public detail::ignore_oprimitive,
|
||||
public detail::forward_skeleton_oarchive<packed_skeleton_oarchive,packed_oarchive>
|
||||
{
|
||||
public:
|
||||
/**
|
||||
* Construct a @c packed_skeleton_oarchive for the given
|
||||
* communicator.
|
||||
*
|
||||
* @param comm The communicator over which this archive will be
|
||||
* transmitted.
|
||||
*
|
||||
* @param flags Control the serialization of the skeleton. Refer to
|
||||
* the Boost.Serialization documentation before changing the
|
||||
* default flags.
|
||||
*/
|
||||
packed_skeleton_oarchive(MPI_Comm const & comm,
|
||||
unsigned int flags = boost::archive::no_header)
|
||||
: detail::forward_skeleton_oarchive<packed_skeleton_oarchive,packed_oarchive>(skeleton_archive_)
|
||||
, skeleton_archive_(comm,flags)
|
||||
{}
|
||||
|
||||
/**
|
||||
* Construct a @c packed_skeleton_oarchive that packs a skeleton
|
||||
* into the given @p archive.
|
||||
*
|
||||
* @param archive the archive to which the skeleton will be packed.
|
||||
*
|
||||
*/
|
||||
explicit packed_skeleton_oarchive(packed_oarchive & archive)
|
||||
: detail::forward_skeleton_oarchive<packed_skeleton_oarchive,packed_oarchive>(archive)
|
||||
, skeleton_archive_(MPI_COMM_WORLD, boost::archive::no_header)
|
||||
{}
|
||||
|
||||
/**
|
||||
* Retrieve the archive corresponding to this skeleton.
|
||||
*/
|
||||
const packed_oarchive& get_skeleton() const
|
||||
{
|
||||
return this->implementation_archive;
|
||||
}
|
||||
|
||||
private:
|
||||
/// Store the actual archive that holds the structure.
|
||||
packed_oarchive skeleton_archive_;
|
||||
};
|
||||
|
||||
namespace detail {
|
||||
typedef boost::mpi::detail::forward_skeleton_oarchive<boost::mpi::packed_skeleton_oarchive,boost::mpi::packed_oarchive> type1;
|
||||
typedef boost::mpi::detail::forward_skeleton_iarchive<boost::mpi::packed_skeleton_iarchive,boost::mpi::packed_iarchive> type2;
|
||||
}
|
||||
|
||||
|
||||
} } // end namespace boost::mpi
|
||||
|
||||
#include <boost/mpi/detail/content_oarchive.hpp>
|
||||
|
||||
// For any headers that have provided declarations based on forward
|
||||
// declarations of the contents of this header, include definitions
|
||||
// for those declarations. This means that the inclusion of
|
||||
// skeleton_and_content.hpp enables the use of skeleton/content
|
||||
// transmission throughout the library.
|
||||
#ifdef BOOST_MPI_BROADCAST_HPP
|
||||
# include <boost/mpi/detail/broadcast_sc.hpp>
|
||||
#endif
|
||||
|
||||
#ifdef BOOST_MPI_COMMUNICATOR_HPP
|
||||
# include <boost/mpi/detail/communicator_sc.hpp>
|
||||
#endif
|
||||
|
||||
// required by export
|
||||
BOOST_SERIALIZATION_REGISTER_ARCHIVE(boost::mpi::packed_skeleton_oarchive)
|
||||
BOOST_SERIALIZATION_REGISTER_ARCHIVE(boost::mpi::packed_skeleton_iarchive)
|
||||
BOOST_SERIALIZATION_REGISTER_ARCHIVE(boost::mpi::detail::type1)
|
||||
BOOST_SERIALIZATION_REGISTER_ARCHIVE(boost::mpi::detail::type2)
|
||||
|
||||
BOOST_SERIALIZATION_USE_ARRAY_OPTIMIZATION(boost::mpi::packed_skeleton_oarchive)
|
||||
BOOST_SERIALIZATION_USE_ARRAY_OPTIMIZATION(boost::mpi::packed_skeleton_iarchive)
|
||||
|
||||
#endif // BOOST_MPI_SKELETON_AND_CONTENT_HPP
|
||||
@@ -0,0 +1,132 @@
|
||||
#ifndef BOOST_SMART_PTR_SCOPED_ARRAY_HPP_INCLUDED
|
||||
#define BOOST_SMART_PTR_SCOPED_ARRAY_HPP_INCLUDED
|
||||
|
||||
// (C) Copyright Greg Colvin and Beman Dawes 1998, 1999.
|
||||
// Copyright (c) 2001, 2002 Peter Dimov
|
||||
//
|
||||
// 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)
|
||||
//
|
||||
// http://www.boost.org/libs/smart_ptr/scoped_array.htm
|
||||
//
|
||||
|
||||
#include <boost/config.hpp>
|
||||
#include <boost/assert.hpp>
|
||||
#include <boost/checked_delete.hpp>
|
||||
#include <boost/smart_ptr/detail/sp_nullptr_t.hpp>
|
||||
|
||||
#include <boost/detail/workaround.hpp>
|
||||
|
||||
#include <cstddef> // for std::ptrdiff_t
|
||||
|
||||
namespace boost
|
||||
{
|
||||
|
||||
// Debug hooks
|
||||
|
||||
#if defined(BOOST_SP_ENABLE_DEBUG_HOOKS)
|
||||
|
||||
void sp_array_constructor_hook(void * p);
|
||||
void sp_array_destructor_hook(void * p);
|
||||
|
||||
#endif
|
||||
|
||||
// scoped_array extends scoped_ptr to arrays. Deletion of the array pointed to
|
||||
// is guaranteed, either on destruction of the scoped_array or via an explicit
|
||||
// reset(). Use shared_array or std::vector if your needs are more complex.
|
||||
|
||||
template<class T> class scoped_array // noncopyable
|
||||
{
|
||||
private:
|
||||
|
||||
T * px;
|
||||
|
||||
scoped_array(scoped_array const &);
|
||||
scoped_array & operator=(scoped_array const &);
|
||||
|
||||
typedef scoped_array<T> this_type;
|
||||
|
||||
void operator==( scoped_array const& ) const;
|
||||
void operator!=( scoped_array const& ) const;
|
||||
|
||||
public:
|
||||
|
||||
typedef T element_type;
|
||||
|
||||
explicit scoped_array( T * p = 0 ) BOOST_NOEXCEPT : px( p )
|
||||
{
|
||||
#if defined(BOOST_SP_ENABLE_DEBUG_HOOKS)
|
||||
boost::sp_array_constructor_hook( px );
|
||||
#endif
|
||||
}
|
||||
|
||||
~scoped_array() // never throws
|
||||
{
|
||||
#if defined(BOOST_SP_ENABLE_DEBUG_HOOKS)
|
||||
boost::sp_array_destructor_hook( px );
|
||||
#endif
|
||||
boost::checked_array_delete( px );
|
||||
}
|
||||
|
||||
void reset(T * p = 0) // never throws (but has a BOOST_ASSERT in it, so not marked with BOOST_NOEXCEPT)
|
||||
{
|
||||
BOOST_ASSERT( p == 0 || p != px ); // catch self-reset errors
|
||||
this_type(p).swap(*this);
|
||||
}
|
||||
|
||||
T & operator[](std::ptrdiff_t i) const // never throws (but has a BOOST_ASSERT in it, so not marked with BOOST_NOEXCEPT)
|
||||
{
|
||||
BOOST_ASSERT( px != 0 );
|
||||
BOOST_ASSERT( i >= 0 );
|
||||
return px[i];
|
||||
}
|
||||
|
||||
T * get() const BOOST_NOEXCEPT
|
||||
{
|
||||
return px;
|
||||
}
|
||||
|
||||
// implicit conversion to "bool"
|
||||
#include <boost/smart_ptr/detail/operator_bool.hpp>
|
||||
|
||||
void swap(scoped_array & b) BOOST_NOEXCEPT
|
||||
{
|
||||
T * tmp = b.px;
|
||||
b.px = px;
|
||||
px = tmp;
|
||||
}
|
||||
};
|
||||
|
||||
#if !defined( BOOST_NO_CXX11_NULLPTR )
|
||||
|
||||
template<class T> inline bool operator==( scoped_array<T> const & p, boost::detail::sp_nullptr_t ) BOOST_NOEXCEPT
|
||||
{
|
||||
return p.get() == 0;
|
||||
}
|
||||
|
||||
template<class T> inline bool operator==( boost::detail::sp_nullptr_t, scoped_array<T> const & p ) BOOST_NOEXCEPT
|
||||
{
|
||||
return p.get() == 0;
|
||||
}
|
||||
|
||||
template<class T> inline bool operator!=( scoped_array<T> const & p, boost::detail::sp_nullptr_t ) BOOST_NOEXCEPT
|
||||
{
|
||||
return p.get() != 0;
|
||||
}
|
||||
|
||||
template<class T> inline bool operator!=( boost::detail::sp_nullptr_t, scoped_array<T> const & p ) BOOST_NOEXCEPT
|
||||
{
|
||||
return p.get() != 0;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
template<class T> inline void swap(scoped_array<T> & a, scoped_array<T> & b) BOOST_NOEXCEPT
|
||||
{
|
||||
a.swap(b);
|
||||
}
|
||||
|
||||
} // namespace boost
|
||||
|
||||
#endif // #ifndef BOOST_SMART_PTR_SCOPED_ARRAY_HPP_INCLUDED
|
||||
@@ -0,0 +1,83 @@
|
||||
/*
|
||||
Copyright (c) Marshall Clow 2008-2012.
|
||||
|
||||
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)
|
||||
*/
|
||||
|
||||
/// \file all_of.hpp
|
||||
/// \brief Test ranges to see if all elements match a value or predicate.
|
||||
/// \author Marshall Clow
|
||||
|
||||
#ifndef BOOST_ALGORITHM_ALL_OF_HPP
|
||||
#define BOOST_ALGORITHM_ALL_OF_HPP
|
||||
|
||||
#include <boost/range/begin.hpp>
|
||||
#include <boost/range/end.hpp>
|
||||
|
||||
namespace boost { namespace algorithm {
|
||||
|
||||
/// \fn all_of ( InputIterator first, InputIterator last, Predicate p )
|
||||
/// \return true if all elements in [first, last) satisfy the predicate 'p'
|
||||
/// \note returns true on an empty range
|
||||
///
|
||||
/// \param first The start of the input sequence
|
||||
/// \param last One past the end of the input sequence
|
||||
/// \param p A predicate for testing the elements of the sequence
|
||||
///
|
||||
/// \note This function is part of the C++2011 standard library.
|
||||
template<typename InputIterator, typename Predicate>
|
||||
bool all_of ( InputIterator first, InputIterator last, Predicate p )
|
||||
{
|
||||
for ( ; first != last; ++first )
|
||||
if ( !p(*first))
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
/// \fn all_of ( const Range &r, Predicate p )
|
||||
/// \return true if all elements in the range satisfy the predicate 'p'
|
||||
/// \note returns true on an empty range
|
||||
///
|
||||
/// \param r The input range
|
||||
/// \param p A predicate for testing the elements of the range
|
||||
///
|
||||
template<typename Range, typename Predicate>
|
||||
bool all_of ( const Range &r, Predicate p )
|
||||
{
|
||||
return boost::algorithm::all_of ( boost::begin (r), boost::end (r), p );
|
||||
}
|
||||
|
||||
/// \fn all_of_equal ( InputIterator first, InputIterator last, const T &val )
|
||||
/// \return true if all elements in [first, last) are equal to 'val'
|
||||
/// \note returns true on an empty range
|
||||
///
|
||||
/// \param first The start of the input sequence
|
||||
/// \param last One past the end of the input sequence
|
||||
/// \param val A value to compare against
|
||||
///
|
||||
template<typename InputIterator, typename T>
|
||||
bool all_of_equal ( InputIterator first, InputIterator last, const T &val )
|
||||
{
|
||||
for ( ; first != last; ++first )
|
||||
if ( val != *first )
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
/// \fn all_of_equal ( const Range &r, const T &val )
|
||||
/// \return true if all elements in the range are equal to 'val'
|
||||
/// \note returns true on an empty range
|
||||
///
|
||||
/// \param r The input range
|
||||
/// \param val A value to compare against
|
||||
///
|
||||
template<typename Range, typename T>
|
||||
bool all_of_equal ( const Range &r, const T &val )
|
||||
{
|
||||
return boost::algorithm::all_of_equal ( boost::begin (r), boost::end (r), val );
|
||||
}
|
||||
|
||||
}} // namespace boost and algorithm
|
||||
|
||||
#endif // BOOST_ALGORITHM_ALL_OF_HPP
|
||||
@@ -0,0 +1,65 @@
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
/// \file pop_front.hpp
|
||||
/// Proto callables Fusion pop_front
|
||||
//
|
||||
// Copyright 2010 Eric Niebler. Distributed under the Boost
|
||||
// Software License, Version 1.0. (See accompanying file
|
||||
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
#ifndef BOOST_PROTO_FUNCTIONAL_FUSION_POP_FRONT_HPP_EAN_11_27_2010
|
||||
#define BOOST_PROTO_FUNCTIONAL_FUSION_POP_FRONT_HPP_EAN_11_27_2010
|
||||
|
||||
#include <boost/fusion/include/begin.hpp>
|
||||
#include <boost/fusion/include/end.hpp>
|
||||
#include <boost/fusion/include/next.hpp>
|
||||
#include <boost/fusion/include/pop_front.hpp>
|
||||
#include <boost/proto/proto_fwd.hpp>
|
||||
|
||||
namespace boost { namespace proto { namespace functional
|
||||
{
|
||||
/// \brief A PolymorphicFunctionObject type that invokes the
|
||||
/// \c fusion::pop_front() algorithm on its argument.
|
||||
///
|
||||
/// A PolymorphicFunctionObject type that invokes the
|
||||
/// \c fusion::pop_front() algorithm on its argument. This is
|
||||
/// useful for defining a CallableTransform like \c pop_front(_)
|
||||
/// which removes the first child from a Proto expression node.
|
||||
/// Such a transform might be used as the first argument to the
|
||||
/// \c proto::fold\<\> transform; that is, fold all but
|
||||
/// the first child.
|
||||
struct pop_front
|
||||
{
|
||||
BOOST_PROTO_CALLABLE()
|
||||
|
||||
template<typename Sig>
|
||||
struct result;
|
||||
|
||||
template<typename This, typename Seq>
|
||||
struct result<This(Seq)>
|
||||
: result<This(Seq const &)>
|
||||
{};
|
||||
|
||||
template<typename This, typename Seq>
|
||||
struct result<This(Seq &)>
|
||||
: fusion::result_of::pop_front<Seq>
|
||||
{};
|
||||
|
||||
template<typename Seq>
|
||||
typename fusion::result_of::pop_front<Seq>::type
|
||||
operator ()(Seq &seq) const
|
||||
{
|
||||
// Work around a const-correctness issue in Fusion
|
||||
typedef typename fusion::result_of::pop_front<Seq>::type result_type;
|
||||
return result_type(fusion::next(fusion::begin(seq)), fusion::end(seq));
|
||||
}
|
||||
|
||||
template<typename Seq>
|
||||
typename fusion::result_of::pop_front<Seq const>::type
|
||||
operator ()(Seq const &seq) const
|
||||
{
|
||||
return fusion::pop_front(seq);
|
||||
}
|
||||
};
|
||||
}}}
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,76 @@
|
||||
// (C) Copyright Toon Knapen 2001.
|
||||
// (C) Copyright David Abrahams 2003.
|
||||
// (C) Copyright Roland Richter 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)
|
||||
|
||||
#ifndef BOOST_PERMUTATION_ITERATOR_HPP
|
||||
#define BOOST_PERMUTATION_ITERATOR_HPP
|
||||
|
||||
#include <iterator>
|
||||
|
||||
#include <boost/iterator/iterator_adaptor.hpp>
|
||||
|
||||
|
||||
namespace boost {
|
||||
namespace iterators {
|
||||
|
||||
template< class ElementIterator
|
||||
, class IndexIterator>
|
||||
class permutation_iterator
|
||||
: public iterator_adaptor<
|
||||
permutation_iterator<ElementIterator, IndexIterator>
|
||||
, IndexIterator, typename boost::detail::iterator_traits<ElementIterator>::value_type
|
||||
, use_default, typename boost::detail::iterator_traits<ElementIterator>::reference>
|
||||
{
|
||||
typedef iterator_adaptor<
|
||||
permutation_iterator<ElementIterator, IndexIterator>
|
||||
, IndexIterator, typename boost::detail::iterator_traits<ElementIterator>::value_type
|
||||
, use_default, typename boost::detail::iterator_traits<ElementIterator>::reference> super_t;
|
||||
|
||||
friend class iterator_core_access;
|
||||
|
||||
public:
|
||||
permutation_iterator() : m_elt_iter() {}
|
||||
|
||||
explicit permutation_iterator(ElementIterator x, IndexIterator y)
|
||||
: super_t(y), m_elt_iter(x) {}
|
||||
|
||||
template<class OtherElementIterator, class OtherIndexIterator>
|
||||
permutation_iterator(
|
||||
permutation_iterator<OtherElementIterator, OtherIndexIterator> const& r
|
||||
, typename enable_if_convertible<OtherElementIterator, ElementIterator>::type* = 0
|
||||
, typename enable_if_convertible<OtherIndexIterator, IndexIterator>::type* = 0
|
||||
)
|
||||
: super_t(r.base()), m_elt_iter(r.m_elt_iter)
|
||||
{}
|
||||
|
||||
private:
|
||||
typename super_t::reference dereference() const
|
||||
{ return *(m_elt_iter + *this->base()); }
|
||||
|
||||
#ifndef BOOST_NO_MEMBER_TEMPLATE_FRIENDS
|
||||
template <class,class> friend class permutation_iterator;
|
||||
#else
|
||||
public:
|
||||
#endif
|
||||
ElementIterator m_elt_iter;
|
||||
};
|
||||
|
||||
|
||||
template <class ElementIterator, class IndexIterator>
|
||||
inline permutation_iterator<ElementIterator, IndexIterator>
|
||||
make_permutation_iterator( ElementIterator e, IndexIterator i )
|
||||
{
|
||||
return permutation_iterator<ElementIterator, IndexIterator>( e, i );
|
||||
}
|
||||
|
||||
} // namespace iterators
|
||||
|
||||
using iterators::permutation_iterator;
|
||||
using iterators::make_permutation_iterator;
|
||||
|
||||
} // namespace boost
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,118 @@
|
||||
#include "TraceFile.hpp"
|
||||
|
||||
#include <stdexcept>
|
||||
|
||||
#include <QDebug>
|
||||
#include <QString>
|
||||
#include <QFile>
|
||||
#include <QTextStream>
|
||||
#include <QMessageLogContext>
|
||||
#include <QDateTime>
|
||||
#include <QMutex>
|
||||
#include <QMutexLocker>
|
||||
|
||||
#include "pimpl_impl.hpp"
|
||||
|
||||
namespace
|
||||
{
|
||||
QMutex lock;
|
||||
}
|
||||
|
||||
class TraceFile::impl
|
||||
{
|
||||
public:
|
||||
impl (QString const& trace_file_path);
|
||||
~impl ();
|
||||
|
||||
// no copying
|
||||
impl (impl const&) = delete;
|
||||
impl& operator = (impl const&) = delete;
|
||||
|
||||
private:
|
||||
// write Qt messages to the diagnostic log file
|
||||
static void message_handler (QtMsgType type, QMessageLogContext const& context, QString const& msg);
|
||||
|
||||
QFile file_;
|
||||
QTextStream stream_;
|
||||
QTextStream * original_stream_;
|
||||
QtMessageHandler original_handler_;
|
||||
static QTextStream * current_stream_;
|
||||
};
|
||||
|
||||
QTextStream * TraceFile::impl::current_stream_;
|
||||
|
||||
|
||||
// delegate to implementation class
|
||||
TraceFile::TraceFile (QString const& trace_file_path)
|
||||
: m_ {trace_file_path}
|
||||
{
|
||||
}
|
||||
|
||||
TraceFile::~TraceFile ()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
TraceFile::impl::impl (QString const& trace_file_path)
|
||||
: file_ {trace_file_path}
|
||||
, original_stream_ {current_stream_}
|
||||
, original_handler_ {nullptr}
|
||||
{
|
||||
// if the log file is writeable; initialise diagnostic logging to it
|
||||
// for append and hook up the Qt global message handler
|
||||
if (file_.open (QFile::WriteOnly | QFile::Append | QFile::Text))
|
||||
{
|
||||
stream_.setDevice (&file_);
|
||||
current_stream_ = &stream_;
|
||||
original_handler_ = qInstallMessageHandler (message_handler);
|
||||
}
|
||||
}
|
||||
|
||||
TraceFile::impl::~impl ()
|
||||
{
|
||||
// unhook our message handler before the stream and file are destroyed
|
||||
if (original_handler_)
|
||||
{
|
||||
qInstallMessageHandler (original_handler_);
|
||||
}
|
||||
current_stream_ = original_stream_; // revert to prior stream
|
||||
}
|
||||
|
||||
// write Qt messages to the diagnostic log file
|
||||
void TraceFile::impl::message_handler (QtMsgType type, QMessageLogContext const& context, QString const& msg)
|
||||
{
|
||||
char const * severity;
|
||||
switch (type)
|
||||
{
|
||||
case QtDebugMsg:
|
||||
severity = "Debug";
|
||||
break;
|
||||
|
||||
case QtWarningMsg:
|
||||
severity = "Warning";
|
||||
break;
|
||||
|
||||
case QtFatalMsg:
|
||||
severity = "Fatal";
|
||||
break;
|
||||
|
||||
default:
|
||||
severity = "Critical";
|
||||
break;
|
||||
}
|
||||
|
||||
{
|
||||
// guard against multiple threads with overlapping messages
|
||||
QMutexLocker guard (&lock);
|
||||
Q_ASSERT_X (current_stream_, "TraceFile:message_handler", "no stream to write to");
|
||||
*current_stream_
|
||||
<< QDateTime::currentDateTimeUtc ().toString ("yyyy-MM-ddTHH:mm:ss.zzzZ")
|
||||
<< '(' << context.file << ':' << context.line /* << ", " << context.function */ << ')'
|
||||
<< severity << ": " << msg.trimmed () << endl;
|
||||
}
|
||||
|
||||
if (QtFatalMsg == type)
|
||||
{
|
||||
throw std::runtime_error {"Fatal Qt Error"};
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,75 @@
|
||||
subroutine jt9a()
|
||||
use, intrinsic :: iso_c_binding, only: c_f_pointer
|
||||
use prog_args
|
||||
use timer_module, only: timer
|
||||
use timer_impl, only: init_timer !, limtrace
|
||||
|
||||
include 'jt9com.f90'
|
||||
|
||||
! These routines connect the shared memory region to the decoder.
|
||||
interface
|
||||
function address_jt9()
|
||||
use, intrinsic :: iso_c_binding, only: c_ptr
|
||||
type(c_ptr) :: address_jt9
|
||||
end function address_jt9
|
||||
end interface
|
||||
|
||||
integer*1 attach_jt9
|
||||
! integer*1 lock_jt9,unlock_jt9
|
||||
integer size_jt9
|
||||
! Multiple instances:
|
||||
character*80 mykey
|
||||
type(dec_data), pointer :: shared_data
|
||||
type(params_block) :: local_params
|
||||
logical fileExists
|
||||
|
||||
! Multiple instances:
|
||||
i0 = len(trim(shm_key))
|
||||
|
||||
call init_timer (trim(data_dir)//'/timer.out')
|
||||
! open(23,file=trim(data_dir)//'/CALL3.TXT',status='unknown')
|
||||
|
||||
! limtrace=-1 !Disable all calls to timer()
|
||||
|
||||
! Multiple instances: set the shared memory key before attaching
|
||||
mykey=trim(repeat(shm_key,1))
|
||||
i0 = len(mykey)
|
||||
i0=setkey_jt9(trim(mykey))
|
||||
i1=attach_jt9()
|
||||
msdelay=10
|
||||
|
||||
10 inquire(file=trim(temp_dir)//'/.lock',exist=fileExists)
|
||||
if(fileExists) then
|
||||
call sleep_msec(msdelay)
|
||||
go to 10
|
||||
endif
|
||||
|
||||
inquire(file=trim(temp_dir)//'/.quit',exist=fileExists)
|
||||
if(fileExists) then
|
||||
i1=detach_jt9()
|
||||
go to 999
|
||||
endif
|
||||
if(i1.eq.999999) stop !Silence compiler warning
|
||||
|
||||
nbytes=size_jt9()
|
||||
if(nbytes.le.0) then
|
||||
print*,'jt9a: Shared memory mem_jt9 does not exist.'
|
||||
print*,"Must start 'jt9 -s <thekey>' from within WSJT-X."
|
||||
go to 999
|
||||
endif
|
||||
call c_f_pointer(address_jt9(),shared_data)
|
||||
local_params=shared_data%params !save a copy because wsjtx carries on accessing
|
||||
call flush(6)
|
||||
call timer('decoder ',0)
|
||||
call multimode_decoder(shared_data%ss,shared_data%id2,local_params,12000)
|
||||
call timer('decoder ',1)
|
||||
|
||||
100 inquire(file=trim(temp_dir)//'/.lock',exist=fileExists)
|
||||
if(fileExists) go to 10
|
||||
call sleep_msec(msdelay)
|
||||
go to 100
|
||||
|
||||
999 call timer('decoder ',101)
|
||||
|
||||
return
|
||||
end subroutine jt9a
|
||||
@@ -0,0 +1,88 @@
|
||||
//---------------------------------------------------------------------------//
|
||||
// Copyright (c) 2013-2014 Kyle Lutz <kyle.r.lutz@gmail.com>
|
||||
//
|
||||
// Distributed under the Boost Software License, Version 1.0
|
||||
// See accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt
|
||||
//
|
||||
// See http://boostorg.github.com/compute for more information.
|
||||
//---------------------------------------------------------------------------//
|
||||
|
||||
#ifndef BOOST_COMPUTE_USER_EVENT_HPP
|
||||
#define BOOST_COMPUTE_USER_EVENT_HPP
|
||||
|
||||
#include <boost/compute/event.hpp>
|
||||
#include <boost/compute/context.hpp>
|
||||
|
||||
namespace boost {
|
||||
namespace compute {
|
||||
|
||||
#if defined(CL_VERSION_1_1) || defined(BOOST_COMPUTE_DOXYGEN_INVOKED)
|
||||
/// \class user_event
|
||||
/// \brief An user-created event.
|
||||
///
|
||||
/// \opencl_version_warning{1,1}
|
||||
///
|
||||
/// \see event
|
||||
class user_event : public event
|
||||
{
|
||||
public:
|
||||
/// Creates a new user-event object.
|
||||
///
|
||||
/// \see_opencl_ref{clCreateUserEvent}
|
||||
explicit user_event(const context &context)
|
||||
{
|
||||
cl_int error;
|
||||
m_event = clCreateUserEvent(context.get(), &error);
|
||||
if(!m_event){
|
||||
BOOST_THROW_EXCEPTION(opencl_error(error));
|
||||
}
|
||||
}
|
||||
|
||||
/// Creates a new user-event from \p other.
|
||||
user_event(const user_event &other)
|
||||
: event(other)
|
||||
{
|
||||
}
|
||||
|
||||
/// Copies the user-event from \p other to \c *this.
|
||||
user_event& operator=(const user_event &other)
|
||||
{
|
||||
event::operator=(other);
|
||||
|
||||
return *this;
|
||||
}
|
||||
|
||||
#ifndef BOOST_COMPUTE_NO_RVALUE_REFERENCES
|
||||
/// Move-constructs a new user event object from \p other.
|
||||
user_event(user_event&& other) BOOST_NOEXCEPT
|
||||
: event(std::move(other))
|
||||
{
|
||||
}
|
||||
|
||||
/// Move-assigns the user event from \p other to \c *this.
|
||||
user_event& operator=(user_event&& other) BOOST_NOEXCEPT
|
||||
{
|
||||
event::operator=(std::move(other));
|
||||
|
||||
return *this;
|
||||
}
|
||||
#endif // BOOST_COMPUTE_NO_RVALUE_REFERENCES
|
||||
|
||||
/// Sets the execution status for the user-event.
|
||||
///
|
||||
/// \see_opencl_ref{clSetUserEventStatus}
|
||||
void set_status(cl_int execution_status)
|
||||
{
|
||||
cl_int ret = clSetUserEventStatus(m_event, execution_status);
|
||||
if(ret != CL_SUCCESS){
|
||||
BOOST_THROW_EXCEPTION(opencl_error(ret));
|
||||
}
|
||||
}
|
||||
};
|
||||
#endif // CL_VERSION_1_1
|
||||
|
||||
} // end compute namespace
|
||||
} // end boost namespace
|
||||
|
||||
#endif // BOOST_COMPUTE_EVENT_HPP
|
||||
@@ -0,0 +1,121 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2014-2015 Kohei Takahashi
|
||||
|
||||
Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
==============================================================================*/
|
||||
#ifndef FUSION_TUPLE_14122014_0102
|
||||
#define FUSION_TUPLE_14122014_0102
|
||||
|
||||
#include <boost/fusion/support/config.hpp>
|
||||
#include <boost/fusion/tuple/tuple_fwd.hpp>
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// With no variadics, we will use the C++03 version
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
#if !defined(BOOST_FUSION_HAS_VARIADIC_TUPLE)
|
||||
# include <boost/fusion/tuple/detail/tuple.hpp>
|
||||
#else
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// C++11 interface
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
#include <boost/core/enable_if.hpp>
|
||||
#include <boost/fusion/container/vector/vector.hpp>
|
||||
#include <boost/fusion/sequence/intrinsic/size.hpp>
|
||||
#include <boost/fusion/sequence/intrinsic/value_at.hpp>
|
||||
#include <boost/fusion/sequence/intrinsic/at.hpp>
|
||||
#include <boost/fusion/sequence/comparison.hpp>
|
||||
#include <boost/fusion/sequence/io.hpp>
|
||||
#include <boost/fusion/support/detail/and.hpp>
|
||||
#include <boost/type_traits/is_convertible.hpp>
|
||||
#include <utility>
|
||||
|
||||
namespace boost { namespace fusion
|
||||
{
|
||||
template <typename ...T>
|
||||
struct tuple : vector<T...>
|
||||
{
|
||||
typedef vector<T...> base_type;
|
||||
|
||||
BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
|
||||
tuple()
|
||||
: base_type() {}
|
||||
|
||||
template <
|
||||
typename ...U
|
||||
, typename = typename boost::enable_if_c<
|
||||
sizeof...(U) >= sizeof...(T)
|
||||
>::type
|
||||
>
|
||||
BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
|
||||
tuple(tuple<U...> const& other)
|
||||
: base_type(other) {}
|
||||
|
||||
template <
|
||||
typename ...U
|
||||
, typename = typename boost::enable_if_c<
|
||||
sizeof...(U) >= sizeof...(T)
|
||||
>::type
|
||||
>
|
||||
BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
|
||||
tuple(tuple<U...>&& other)
|
||||
: base_type(std::move(other)) {}
|
||||
|
||||
template <
|
||||
typename ...U
|
||||
, typename = typename boost::enable_if_c<(
|
||||
fusion::detail::and_<is_convertible<U, T>...>::value &&
|
||||
sizeof...(U) >= 1
|
||||
)>::type
|
||||
>
|
||||
/*BOOST_CONSTEXPR*/ BOOST_FUSION_GPU_ENABLED
|
||||
explicit
|
||||
tuple(U&&... args)
|
||||
: base_type(std::forward<U>(args)...) {}
|
||||
|
||||
template<typename U1, typename U2>
|
||||
BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
|
||||
tuple(std::pair<U1, U2> const& other)
|
||||
: base_type(other.first, other.second) {}
|
||||
|
||||
template<typename U1, typename U2>
|
||||
BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
|
||||
tuple(std::pair<U1, U2>&& other)
|
||||
: base_type(std::move(other.first), std::move(other.second)) {}
|
||||
|
||||
template<typename U>
|
||||
BOOST_CXX14_CONSTEXPR BOOST_FUSION_GPU_ENABLED
|
||||
tuple& operator=(U&& rhs)
|
||||
{
|
||||
base_type::operator=(std::forward<U>(rhs));
|
||||
return *this;
|
||||
}
|
||||
};
|
||||
|
||||
template <typename Tuple>
|
||||
struct tuple_size : result_of::size<Tuple> {};
|
||||
|
||||
template <int N, typename Tuple>
|
||||
struct tuple_element : result_of::value_at_c<Tuple, N> {};
|
||||
|
||||
template <int N, typename Tuple>
|
||||
BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
|
||||
inline typename result_of::at_c<Tuple, N>::type
|
||||
get(Tuple& tup)
|
||||
{
|
||||
return at_c<N>(tup);
|
||||
}
|
||||
|
||||
template <int N, typename Tuple>
|
||||
BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
|
||||
inline typename result_of::at_c<Tuple const, N>::type
|
||||
get(Tuple const& tup)
|
||||
{
|
||||
return at_c<N>(tup);
|
||||
}
|
||||
}}
|
||||
|
||||
#endif
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user