Initial Commit

This commit is contained in:
Jordan Sherer
2018-02-08 21:28:33 -05:00
commit 678c1d3966
14352 changed files with 3176737 additions and 0 deletions
@@ -0,0 +1,207 @@
#include "displaytext.h"
#include <QMouseEvent>
#include <QDateTime>
#include <QTextCharFormat>
#include <QFont>
#include <QTextCursor>
#include "qt_helpers.hpp"
#include "moc_displaytext.cpp"
DisplayText::DisplayText(QWidget *parent) :
QTextEdit(parent)
{
setReadOnly (true);
viewport ()->setCursor (Qt::ArrowCursor);
setWordWrapMode (QTextOption::NoWrap);
setStyleSheet ("");
}
void DisplayText::setContentFont(QFont const& font)
{
setFont (font);
m_charFormat.setFont (font);
selectAll ();
auto cursor = textCursor ();
cursor.mergeCharFormat (m_charFormat);
cursor.clearSelection ();
cursor.movePosition (QTextCursor::End);
// position so viewport scrolled to left
cursor.movePosition (QTextCursor::Up);
cursor.movePosition (QTextCursor::StartOfLine);
setTextCursor (cursor);
ensureCursorVisible ();
}
void DisplayText::mouseDoubleClickEvent(QMouseEvent *e)
{
bool ctrl = (e->modifiers() & Qt::ControlModifier);
bool shift = (e->modifiers() & Qt::ShiftModifier);
emit(selectCallsign(shift,ctrl));
QTextEdit::mouseDoubleClickEvent(e);
}
void DisplayText::insertLineSpacer(QString const& line)
{
appendText (line, "#d3d3d3");
}
void DisplayText::appendText(QString const& text, QString const& bg)
{
QString escaped {text.trimmed().replace('<',"&lt;").replace('>',"&gt;").replace(' ', "&nbsp;")};
QString s = "<table border=0 cellspacing=0 width=100%><tr><td bgcolor=\"" +
bg + "\">" + escaped + "</td></tr></table>";
auto cursor = textCursor ();
cursor.movePosition (QTextCursor::End);
auto pos = cursor.position ();
cursor.insertHtml (s);
cursor.setPosition (pos, QTextCursor::MoveAnchor);
cursor.movePosition (QTextCursor::End, QTextCursor::KeepAnchor);
cursor.mergeCharFormat (m_charFormat);
cursor.clearSelection ();
// position so viewport scrolled to left
cursor.movePosition (QTextCursor::Up);
cursor.movePosition (QTextCursor::StartOfLine);
setTextCursor (cursor);
ensureCursorVisible ();
}
void DisplayText::_appendDXCCWorkedB4(DecodedText& t1, QString& bg,
LogBook logBook, QColor color_CQ,
QColor color_DXCC,
QColor color_NewCall)
{
QString call = t1.CQersCall ();
QString countryName;
bool callWorkedBefore;
bool countryWorkedBefore;
if(call.length()==2) {
int i0=t1.indexOf("CQ "+call);
call=t1.mid(i0+6,-1);
i0=call.indexOf(" ");
call=call.mid(0,i0);
}
if(call.length()<3) return;
if(!call.contains(QRegExp("[0-9]")) or !call.contains(QRegExp("[A-Z]"))) return;
logBook.match(/*in*/call,/*out*/countryName,callWorkedBefore,countryWorkedBefore);
int charsAvail = 48;
// the decoder (seems) to always generate 41 chars. For a normal CQ call, the last five are spaces
// TODO this magic 37 characters is also referenced in MainWindow::doubleClickOnCall()
int nmin=37;
int i=t1.indexOf(" CQ ");
int k=t1.string().mid(i+4,3).toInt();
if(k>0 and k<999) nmin += 4;
int s3 = t1.indexOf(" ",nmin);
if (s3 < nmin) s3 = nmin; // always want at least the characters to position 35
s3 += 1; // convert the index into a character count
t1 = t1.left(s3); // reduce trailing white space
charsAvail -= s3;
if (charsAvail > 4)
{
if (!countryWorkedBefore) // therefore not worked call either
{
t1 += "!";
bg=color_DXCC.name();
}
else
if (!callWorkedBefore) // but have worked the country
{
t1 += "~";
bg=color_NewCall.name();
}
else
{
t1 += " "; // have worked this call before
bg=color_CQ.name();
}
charsAvail -= 1;
// do some obvious abbreviations
countryName.replace ("Islands", "Is.");
countryName.replace ("Island", "Is.");
countryName.replace ("North ", "N. ");
countryName.replace ("Northern ", "N. ");
countryName.replace ("South ", "S. ");
countryName.replace ("East ", "E. ");
countryName.replace ("Eastern ", "E. ");
countryName.replace ("West ", "W. ");
countryName.replace ("Western ", "W. ");
countryName.replace ("Central ", "C. ");
countryName.replace (" and ", " & ");
countryName.replace ("Republic", "Rep.");
countryName.replace ("United States", "U.S.A.");
countryName.replace ("Fed. Rep. of ", "");
countryName.replace ("French ", "Fr.");
countryName.replace ("Asiatic", "AS");
countryName.replace ("European", "EU");
countryName.replace ("African", "AF");
t1 += countryName;
}
}
void DisplayText::displayDecodedText(DecodedText decodedText, QString myCall,
bool displayDXCCEntity, LogBook logBook,
QColor color_CQ, QColor color_MyCall,
QColor color_DXCC, QColor color_NewCall)
{
QString bg="white";
bool CQcall = false;
if (decodedText.string ().contains (" CQ ")
|| decodedText.string ().contains (" CQDX ")
|| decodedText.string ().contains (" QRZ "))
{
CQcall = true;
bg=color_CQ.name();
}
if (myCall != "" and (
decodedText.indexOf (" " + myCall + " ") >= 0
or decodedText.indexOf (" " + myCall + "/") >= 0
or decodedText.indexOf ("/" + myCall + " ") >= 0
or decodedText.indexOf ("<" + myCall + " ") >= 0
or decodedText.indexOf (" " + myCall + ">") >= 0)) {
bg=color_MyCall.name();
}
// if enabled add the DXCC entity and B4 status to the end of the preformated text line t1
if (displayDXCCEntity && CQcall)
_appendDXCCWorkedB4(/*mod*/decodedText,bg,logBook,color_CQ,
color_DXCC,color_NewCall);
appendText(decodedText.string(),bg);
}
void DisplayText::displayTransmittedText(QString text, QString modeTx, qint32 txFreq,
QColor color_TxMsg, bool bFastMode)
{
QString bg=color_TxMsg.name();
QString t1=" @ ";
if(modeTx=="JT4") t1=" $ ";
if(modeTx=="JT65") t1=" # ";
if(modeTx=="MSK144") t1=" & ";
QString t2;
t2.sprintf("%4d",txFreq);
QString t;
if(bFastMode) {
t = QDateTime::currentDateTimeUtc().toString("hhmmss") + \
" Tx " + t2 + t1 + text;
} else {
t = QDateTime::currentDateTimeUtc().toString("hhmm") + \
" Tx " + t2 + t1 + text;
}
appendText(t,bg);
}
void DisplayText::displayQSY(QString text)
{
QString t = QDateTime::currentDateTimeUtc().toString("hhmmss") + " " + text;
QString bg="hot pink";
appendText(t,bg);
}
@@ -0,0 +1,94 @@
// Copyright (C) 2005, Fernando Luis Cacciola Carballal.
//
// Use, modification, and distribution is subject to the Boost Software
// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
//
// See http://www.boost.org/libs/optional for documentation.
//
// You are welcome to contact the author at:
// fernando_cacciola@hotmail.com
//
#ifndef BOOST_OPTIONAL_OPTIONAL_IO_FLC_19NOV2002_HPP
#define BOOST_OPTIONAL_OPTIONAL_IO_FLC_19NOV2002_HPP
#include <istream>
#include <ostream>
#include "boost/none.hpp"
#include "boost/optional/optional.hpp"
namespace boost
{
template<class CharType, class CharTrait>
inline
std::basic_ostream<CharType, CharTrait>&
operator<<(std::basic_ostream<CharType, CharTrait>& out, none_t)
{
if (out.good())
{
out << "--";
}
return out;
}
template<class CharType, class CharTrait, class T>
inline
std::basic_ostream<CharType, CharTrait>&
operator<<(std::basic_ostream<CharType, CharTrait>& out, optional<T> const& v)
{
if (out.good())
{
if (!v)
out << "--" ;
else out << ' ' << *v ;
}
return out;
}
template<class CharType, class CharTrait, class T>
inline
std::basic_istream<CharType, CharTrait>&
operator>>(std::basic_istream<CharType, CharTrait>& in, optional<T>& v)
{
if (in.good())
{
int d = in.get();
if (d == ' ')
{
T x;
in >> x;
#ifndef BOOST_OPTIONAL_DETAIL_NO_RVALUE_REFERENCES
v = boost::move(x);
#else
v = x;
#endif
}
else
{
if (d == '-')
{
d = in.get();
if (d == '-')
{
v = none;
return in;
}
}
in.setstate( std::ios::failbit );
}
}
return in;
}
} // namespace boost
#endif
@@ -0,0 +1,66 @@
/*=============================================================================
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_VECTOR_FORWARD_07072005_0125)
#define FUSION_VECTOR_FORWARD_07072005_0125
#include <boost/fusion/support/config.hpp>
#include <boost/fusion/container/vector/detail/cpp03/limits.hpp>
#include <boost/preprocessor/repetition/enum_params_with_a_default.hpp>
#include <boost/fusion/container/vector/detail/cpp03/vector10.hpp>
#if (FUSION_MAX_VECTOR_SIZE > 10)
#include <boost/fusion/container/vector/detail/cpp03/vector20.hpp>
#endif
#if (FUSION_MAX_VECTOR_SIZE > 20)
#include <boost/fusion/container/vector/detail/cpp03/vector30.hpp>
#endif
#if (FUSION_MAX_VECTOR_SIZE > 30)
#include <boost/fusion/container/vector/detail/cpp03/vector40.hpp>
#endif
#if (FUSION_MAX_VECTOR_SIZE > 40)
#include <boost/fusion/container/vector/detail/cpp03/vector50.hpp>
#endif
#if !defined(BOOST_FUSION_DONT_USE_PREPROCESSED_FILES)
#include <boost/fusion/container/vector/detail/cpp03/preprocessed/vector_fwd.hpp>
#else
#if defined(__WAVE__) && defined(BOOST_FUSION_CREATE_PREPROCESSED_FILES)
#pragma wave option(preserve: 2, line: 0, output: "preprocessed/vvector" FUSION_MAX_VECTOR_SIZE_STR "_fwd.hpp")
#endif
/*=============================================================================
Copyright (c) 2001-2011 Joel de Guzman
Distributed under the Boost Software License, Version 1.0. (See accompanying
file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
This is an auto-generated file. Do not edit!
==============================================================================*/
#if defined(__WAVE__) && defined(BOOST_FUSION_CREATE_PREPROCESSED_FILES)
#pragma wave option(preserve: 1)
#endif
namespace boost { namespace fusion
{
struct void_;
template <
BOOST_PP_ENUM_PARAMS_WITH_A_DEFAULT(
FUSION_MAX_VECTOR_SIZE, typename T, void_)
>
struct vector;
}}
#if defined(__WAVE__) && defined(BOOST_FUSION_CREATE_PREPROCESSED_FILES)
#pragma wave option(output: null)
#endif
#endif // BOOST_FUSION_DONT_USE_PREPROCESSED_FILES
#endif
@@ -0,0 +1,204 @@
/*
Copyright Rene Rivera 2013-2015
Distributed under the Boost Software License, Version 1.0.
(See accompanying file LICENSE_1_0.txt or copy at
http://www.boost.org/LICENSE_1_0.txt)
*/
#ifndef BOOST_PREDEF_ENDIAN_H
#define BOOST_PREDEF_ENDIAN_H
#include <boost/predef/version_number.h>
#include <boost/predef/make.h>
#include <boost/predef/library/c/gnu.h>
#include <boost/predef/os/macos.h>
#include <boost/predef/os/bsd.h>
#include <boost/predef/os/android.h>
/*`
[heading `BOOST_ENDIAN_*`]
Detection of endian memory ordering. There are four defined macros
in this header that define the various generally possible endian
memory orderings:
* `BOOST_ENDIAN_BIG_BYTE`, byte-swapped big-endian.
* `BOOST_ENDIAN_BIG_WORD`, word-swapped big-endian.
* `BOOST_ENDIAN_LITTLE_BYTE`, byte-swapped little-endian.
* `BOOST_ENDIAN_LITTLE_WORD`, word-swapped little-endian.
The detection is conservative in that it only identifies endianness
that it knows for certain. In particular bi-endianness is not
indicated as is it not practically possible to determine the
endianness from anything but an operating system provided
header. And the currently known headers do not define that
programatic bi-endianness is available.
This implementation is a compilation of various publicly available
information and acquired knowledge:
# The indispensable documentation of "Pre-defined Compiler Macros"
[@http://sourceforge.net/p/predef/wiki/Endianness Endianness].
# The various endian specifications available in the
[@http://wikipedia.org/ Wikipedia] computer architecture pages.
# Generally available searches for headers that define endianness.
*/
#define BOOST_ENDIAN_BIG_BYTE BOOST_VERSION_NUMBER_NOT_AVAILABLE
#define BOOST_ENDIAN_BIG_WORD BOOST_VERSION_NUMBER_NOT_AVAILABLE
#define BOOST_ENDIAN_LITTLE_BYTE BOOST_VERSION_NUMBER_NOT_AVAILABLE
#define BOOST_ENDIAN_LITTLE_WORD BOOST_VERSION_NUMBER_NOT_AVAILABLE
/* GNU libc provides a header defining __BYTE_ORDER, or _BYTE_ORDER.
* And some OSs provide some for of endian header also.
*/
#if !BOOST_ENDIAN_BIG_BYTE && !BOOST_ENDIAN_BIG_WORD && \
!BOOST_ENDIAN_LITTLE_BYTE && !BOOST_ENDIAN_LITTLE_WORD
# if BOOST_LIB_C_GNU || BOOST_OS_ANDROID
# include <endian.h>
# else
# if BOOST_OS_MACOS
# include <machine/endian.h>
# else
# if BOOST_OS_BSD
# if BOOST_OS_BSD_OPEN
# include <machine/endian.h>
# else
# include <sys/endian.h>
# endif
# endif
# endif
# endif
# if defined(__BYTE_ORDER)
# if defined(__BIG_ENDIAN) && (__BYTE_ORDER == __BIG_ENDIAN)
# undef BOOST_ENDIAN_BIG_BYTE
# define BOOST_ENDIAN_BIG_BYTE BOOST_VERSION_NUMBER_AVAILABLE
# endif
# if defined(__LITTLE_ENDIAN) && (__BYTE_ORDER == __LITTLE_ENDIAN)
# undef BOOST_ENDIAN_LITTLE_BYTE
# define BOOST_ENDIAN_LITTLE_BYTE BOOST_VERSION_NUMBER_AVAILABLE
# endif
# if defined(__PDP_ENDIAN) && (__BYTE_ORDER == __PDP_ENDIAN)
# undef BOOST_ENDIAN_LITTLE_WORD
# define BOOST_ENDIAN_LITTLE_WORD BOOST_VERSION_NUMBER_AVAILABLE
# endif
# endif
# if !defined(__BYTE_ORDER) && defined(_BYTE_ORDER)
# if defined(_BIG_ENDIAN) && (_BYTE_ORDER == _BIG_ENDIAN)
# undef BOOST_ENDIAN_BIG_BYTE
# define BOOST_ENDIAN_BIG_BYTE BOOST_VERSION_NUMBER_AVAILABLE
# endif
# if defined(_LITTLE_ENDIAN) && (_BYTE_ORDER == _LITTLE_ENDIAN)
# undef BOOST_ENDIAN_LITTLE_BYTE
# define BOOST_ENDIAN_LITTLE_BYTE BOOST_VERSION_NUMBER_AVAILABLE
# endif
# if defined(_PDP_ENDIAN) && (_BYTE_ORDER == _PDP_ENDIAN)
# undef BOOST_ENDIAN_LITTLE_WORD
# define BOOST_ENDIAN_LITTLE_WORD BOOST_VERSION_NUMBER_AVAILABLE
# endif
# endif
#endif
/* Built-in byte-swpped big-endian macros.
*/
#if !BOOST_ENDIAN_BIG_BYTE && !BOOST_ENDIAN_BIG_WORD && \
!BOOST_ENDIAN_LITTLE_BYTE && !BOOST_ENDIAN_LITTLE_WORD
# if (defined(__BIG_ENDIAN__) && !defined(__LITTLE_ENDIAN__)) || \
(defined(_BIG_ENDIAN) && !defined(_LITTLE_ENDIAN)) || \
defined(__ARMEB__) || \
defined(__THUMBEB__) || \
defined(__AARCH64EB__) || \
defined(_MIPSEB) || \
defined(__MIPSEB) || \
defined(__MIPSEB__)
# undef BOOST_ENDIAN_BIG_BYTE
# define BOOST_ENDIAN_BIG_BYTE BOOST_VERSION_NUMBER_AVAILABLE
# endif
#endif
/* Built-in byte-swpped little-endian macros.
*/
#if !BOOST_ENDIAN_BIG_BYTE && !BOOST_ENDIAN_BIG_WORD && \
!BOOST_ENDIAN_LITTLE_BYTE && !BOOST_ENDIAN_LITTLE_WORD
# if (defined(__LITTLE_ENDIAN__) && !defined(__BIG_ENDIAN__)) || \
(defined(_LITTLE_ENDIAN) && !defined(_BIG_ENDIAN)) || \
defined(__ARMEL__) || \
defined(__THUMBEL__) || \
defined(__AARCH64EL__) || \
defined(_MIPSEL) || \
defined(__MIPSEL) || \
defined(__MIPSEL__)
# undef BOOST_ENDIAN_LITTLE_BYTE
# define BOOST_ENDIAN_LITTLE_BYTE BOOST_VERSION_NUMBER_AVAILABLE
# endif
#endif
/* Some architectures are strictly one endianess (as opposed
* the current common bi-endianess).
*/
#if !BOOST_ENDIAN_BIG_BYTE && !BOOST_ENDIAN_BIG_WORD && \
!BOOST_ENDIAN_LITTLE_BYTE && !BOOST_ENDIAN_LITTLE_WORD
# include <boost/predef/architecture.h>
# if BOOST_ARCH_M68K || \
BOOST_ARCH_PARISC || \
BOOST_ARCH_SPARC || \
BOOST_ARCH_SYS370 || \
BOOST_ARCH_SYS390 || \
BOOST_ARCH_Z
# undef BOOST_ENDIAN_BIG_BYTE
# define BOOST_ENDIAN_BIG_BYTE BOOST_VERSION_NUMBER_AVAILABLE
# endif
# if BOOST_ARCH_AMD64 || \
BOOST_ARCH_IA64 || \
BOOST_ARCH_X86 || \
BOOST_ARCH_BLACKFIN
# undef BOOST_ENDIAN_LITTLE_BYTE
# define BOOST_ENDIAN_LITTLE_BYTE BOOST_VERSION_NUMBER_AVAILABLE
# endif
#endif
/* Windows on ARM, if not otherwise detected/specified, is always
* byte-swaped little-endian.
*/
#if !BOOST_ENDIAN_BIG_BYTE && !BOOST_ENDIAN_BIG_WORD && \
!BOOST_ENDIAN_LITTLE_BYTE && !BOOST_ENDIAN_LITTLE_WORD
# if BOOST_ARCH_ARM
# include <boost/predef/os/windows.h>
# if BOOST_OS_WINDOWS
# undef BOOST_ENDIAN_LITTLE_BYTE
# define BOOST_ENDIAN_LITTLE_BYTE BOOST_VERSION_NUMBER_AVAILABLE
# endif
# endif
#endif
#if BOOST_ENDIAN_BIG_BYTE
# define BOOST_ENDIAN_BIG_BYTE_AVAILABLE
#endif
#if BOOST_ENDIAN_BIG_WORD
# define BOOST_ENDIAN_BIG_WORD_BYTE_AVAILABLE
#endif
#if BOOST_ENDIAN_LITTLE_BYTE
# define BOOST_ENDIAN_LITTLE_BYTE_AVAILABLE
#endif
#if BOOST_ENDIAN_LITTLE_WORD
# define BOOST_ENDIAN_LITTLE_WORD_BYTE_AVAILABLE
#endif
#define BOOST_ENDIAN_BIG_BYTE_NAME "Byte-Swapped Big-Endian"
#define BOOST_ENDIAN_BIG_WORD_NAME "Word-Swapped Big-Endian"
#define BOOST_ENDIAN_LITTLE_BYTE_NAME "Byte-Swapped Little-Endian"
#define BOOST_ENDIAN_LITTLE_WORD_NAME "Word-Swapped Little-Endian"
#endif
#include <boost/predef/detail/test.h>
BOOST_PREDEF_DECLARE_TEST(BOOST_ENDIAN_BIG_BYTE,BOOST_ENDIAN_BIG_BYTE_NAME)
#include <boost/predef/detail/test.h>
BOOST_PREDEF_DECLARE_TEST(BOOST_ENDIAN_BIG_WORD,BOOST_ENDIAN_BIG_WORD_NAME)
#include <boost/predef/detail/test.h>
BOOST_PREDEF_DECLARE_TEST(BOOST_ENDIAN_LITTLE_BYTE,BOOST_ENDIAN_LITTLE_BYTE_NAME)
#include <boost/predef/detail/test.h>
BOOST_PREDEF_DECLARE_TEST(BOOST_ENDIAN_LITTLE_WORD,BOOST_ENDIAN_LITTLE_WORD_NAME)
@@ -0,0 +1,29 @@
// Boost.Range library
//
// Copyright Thorsten Ottosen 2003-2004. Use, modification and
// distribution is subject to the Boost Software License, Version
// 1.0. (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
//
// For more information, see http://www.boost.org/libs/range/
//
#ifndef BOOST_RANGE_REFERENCE_TYPE_HPP
#define BOOST_RANGE_REFERENCE_TYPE_HPP
#if defined(_MSC_VER)
# pragma once
#endif
#include <boost/range/config.hpp>
#include <boost/range/iterator.hpp>
#include <boost/iterator/iterator_traits.hpp>
namespace boost
{
template< class T >
struct range_reference : iterator_reference< typename range_iterator<T>::type >
{ };
}
#endif
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,531 @@
// Copyright John Maddock 2006, 2007.
// Copyright Paul A. Bristow 2006, 2007.
// Use, modification and distribution are subject to the
// Boost Software License, Version 1.0. (See accompanying file
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
#ifndef BOOST_STATS_TRIANGULAR_HPP
#define BOOST_STATS_TRIANGULAR_HPP
// http://mathworld.wolfram.com/TriangularDistribution.html
// Note that the 'constructors' defined by Wolfram are difference from those here,
// for example
// N[variance[triangulardistribution{1, +2}, 1.5], 50] computes
// 0.041666666666666666666666666666666666666666666666667
// TriangularDistribution{1, +2}, 1.5 is the analog of triangular_distribution(1, 1.5, 2)
// http://en.wikipedia.org/wiki/Triangular_distribution
#include <boost/math/distributions/fwd.hpp>
#include <boost/math/special_functions/expm1.hpp>
#include <boost/math/distributions/detail/common_error_handling.hpp>
#include <boost/math/distributions/complement.hpp>
#include <boost/math/constants/constants.hpp>
#include <utility>
namespace boost{ namespace math
{
namespace detail
{
template <class RealType, class Policy>
inline bool check_triangular_lower(
const char* function,
RealType lower,
RealType* result, const Policy& pol)
{
if((boost::math::isfinite)(lower))
{ // Any finite value is OK.
return true;
}
else
{ // Not finite: infinity or NaN.
*result = policies::raise_domain_error<RealType>(
function,
"Lower parameter is %1%, but must be finite!", lower, pol);
return false;
}
} // bool check_triangular_lower(
template <class RealType, class Policy>
inline bool check_triangular_mode(
const char* function,
RealType mode,
RealType* result, const Policy& pol)
{
if((boost::math::isfinite)(mode))
{ // any finite value is OK.
return true;
}
else
{ // Not finite: infinity or NaN.
*result = policies::raise_domain_error<RealType>(
function,
"Mode parameter is %1%, but must be finite!", mode, pol);
return false;
}
} // bool check_triangular_mode(
template <class RealType, class Policy>
inline bool check_triangular_upper(
const char* function,
RealType upper,
RealType* result, const Policy& pol)
{
if((boost::math::isfinite)(upper))
{ // any finite value is OK.
return true;
}
else
{ // Not finite: infinity or NaN.
*result = policies::raise_domain_error<RealType>(
function,
"Upper parameter is %1%, but must be finite!", upper, pol);
return false;
}
} // bool check_triangular_upper(
template <class RealType, class Policy>
inline bool check_triangular_x(
const char* function,
RealType const& x,
RealType* result, const Policy& pol)
{
if((boost::math::isfinite)(x))
{ // Any finite value is OK
return true;
}
else
{ // Not finite: infinity or NaN.
*result = policies::raise_domain_error<RealType>(
function,
"x parameter is %1%, but must be finite!", x, pol);
return false;
}
} // bool check_triangular_x
template <class RealType, class Policy>
inline bool check_triangular(
const char* function,
RealType lower,
RealType mode,
RealType upper,
RealType* result, const Policy& pol)
{
if ((check_triangular_lower(function, lower, result, pol) == false)
|| (check_triangular_mode(function, mode, result, pol) == false)
|| (check_triangular_upper(function, upper, result, pol) == false))
{ // Some parameter not finite.
return false;
}
else if (lower >= upper) // lower == upper NOT useful.
{ // lower >= upper.
*result = policies::raise_domain_error<RealType>(
function,
"lower parameter is %1%, but must be less than upper!", lower, pol);
return false;
}
else
{ // Check lower <= mode <= upper.
if (mode < lower)
{
*result = policies::raise_domain_error<RealType>(
function,
"mode parameter is %1%, but must be >= than lower!", lower, pol);
return false;
}
if (mode > upper)
{
*result = policies::raise_domain_error<RealType>(
function,
"mode parameter is %1%, but must be <= than upper!", upper, pol);
return false;
}
return true; // All OK.
}
} // bool check_triangular
} // namespace detail
template <class RealType = double, class Policy = policies::policy<> >
class triangular_distribution
{
public:
typedef RealType value_type;
typedef Policy policy_type;
triangular_distribution(RealType l_lower = -1, RealType l_mode = 0, RealType l_upper = 1)
: m_lower(l_lower), m_mode(l_mode), m_upper(l_upper) // Constructor.
{ // Evans says 'standard triangular' is lower 0, mode 1/2, upper 1,
// has median sqrt(c/2) for c <=1/2 and 1 - sqrt(1-c)/2 for c >= 1/2
// But this -1, 0, 1 is more useful in most applications to approximate normal distribution,
// where the central value is the most likely and deviations either side equally likely.
RealType result;
detail::check_triangular("boost::math::triangular_distribution<%1%>::triangular_distribution",l_lower, l_mode, l_upper, &result, Policy());
}
// Accessor functions.
RealType lower()const
{
return m_lower;
}
RealType mode()const
{
return m_mode;
}
RealType upper()const
{
return m_upper;
}
private:
// Data members:
RealType m_lower; // distribution lower aka a
RealType m_mode; // distribution mode aka c
RealType m_upper; // distribution upper aka b
}; // class triangular_distribution
typedef triangular_distribution<double> triangular;
template <class RealType, class Policy>
inline const std::pair<RealType, RealType> range(const triangular_distribution<RealType, Policy>& /* dist */)
{ // Range of permissible values for random variable x.
using boost::math::tools::max_value;
return std::pair<RealType, RealType>(-max_value<RealType>(), max_value<RealType>());
}
template <class RealType, class Policy>
inline const std::pair<RealType, RealType> support(const triangular_distribution<RealType, Policy>& dist)
{ // Range of supported values for random variable x.
// This is range where cdf rises from 0 to 1, and outside it, the pdf is zero.
return std::pair<RealType, RealType>(dist.lower(), dist.upper());
}
template <class RealType, class Policy>
RealType pdf(const triangular_distribution<RealType, Policy>& dist, const RealType& x)
{
static const char* function = "boost::math::pdf(const triangular_distribution<%1%>&, %1%)";
RealType lower = dist.lower();
RealType mode = dist.mode();
RealType upper = dist.upper();
RealType result = 0; // of checks.
if(false == detail::check_triangular(function, lower, mode, upper, &result, Policy()))
{
return result;
}
if(false == detail::check_triangular_x(function, x, &result, Policy()))
{
return result;
}
if((x < lower) || (x > upper))
{
return 0;
}
if (x == lower)
{ // (mode - lower) == 0 which would lead to divide by zero!
return (mode == lower) ? 2 / (upper - lower) : RealType(0);
}
else if (x == upper)
{
return (mode == upper) ? 2 / (upper - lower) : RealType(0);
}
else if (x <= mode)
{
return 2 * (x - lower) / ((upper - lower) * (mode - lower));
}
else
{ // (x > mode)
return 2 * (upper - x) / ((upper - lower) * (upper - mode));
}
} // RealType pdf(const triangular_distribution<RealType, Policy>& dist, const RealType& x)
template <class RealType, class Policy>
inline RealType cdf(const triangular_distribution<RealType, Policy>& dist, const RealType& x)
{
static const char* function = "boost::math::cdf(const triangular_distribution<%1%>&, %1%)";
RealType lower = dist.lower();
RealType mode = dist.mode();
RealType upper = dist.upper();
RealType result = 0; // of checks.
if(false == detail::check_triangular(function, lower, mode, upper, &result, Policy()))
{
return result;
}
if(false == detail::check_triangular_x(function, x, &result, Policy()))
{
return result;
}
if((x <= lower))
{
return 0;
}
if (x >= upper)
{
return 1;
}
// else lower < x < upper
if (x <= mode)
{
return ((x - lower) * (x - lower)) / ((upper - lower) * (mode - lower));
}
else
{
return 1 - (upper - x) * (upper - x) / ((upper - lower) * (upper - mode));
}
} // RealType cdf(const triangular_distribution<RealType, Policy>& dist, const RealType& x)
template <class RealType, class Policy>
RealType quantile(const triangular_distribution<RealType, Policy>& dist, const RealType& p)
{
BOOST_MATH_STD_USING // for ADL of std functions (sqrt).
static const char* function = "boost::math::quantile(const triangular_distribution<%1%>&, %1%)";
RealType lower = dist.lower();
RealType mode = dist.mode();
RealType upper = dist.upper();
RealType result = 0; // of checks
if(false == detail::check_triangular(function,lower, mode, upper, &result, Policy()))
{
return result;
}
if(false == detail::check_probability(function, p, &result, Policy()))
{
return result;
}
if(p == 0)
{
return lower;
}
if(p == 1)
{
return upper;
}
RealType p0 = (mode - lower) / (upper - lower);
RealType q = 1 - p;
if (p < p0)
{
result = sqrt((upper - lower) * (mode - lower) * p) + lower;
}
else if (p == p0)
{
result = mode;
}
else // p > p0
{
result = upper - sqrt((upper - lower) * (upper - mode) * q);
}
return result;
} // RealType quantile(const triangular_distribution<RealType, Policy>& dist, const RealType& q)
template <class RealType, class Policy>
RealType cdf(const complemented2_type<triangular_distribution<RealType, Policy>, RealType>& c)
{
static const char* function = "boost::math::cdf(const triangular_distribution<%1%>&, %1%)";
RealType lower = c.dist.lower();
RealType mode = c.dist.mode();
RealType upper = c.dist.upper();
RealType x = c.param;
RealType result = 0; // of checks.
if(false == detail::check_triangular(function, lower, mode, upper, &result, Policy()))
{
return result;
}
if(false == detail::check_triangular_x(function, x, &result, Policy()))
{
return result;
}
if (x <= lower)
{
return 1;
}
if (x >= upper)
{
return 0;
}
if (x <= mode)
{
return 1 - ((x - lower) * (x - lower)) / ((upper - lower) * (mode - lower));
}
else
{
return (upper - x) * (upper - x) / ((upper - lower) * (upper - mode));
}
} // RealType cdf(const complemented2_type<triangular_distribution<RealType, Policy>, RealType>& c)
template <class RealType, class Policy>
RealType quantile(const complemented2_type<triangular_distribution<RealType, Policy>, RealType>& c)
{
BOOST_MATH_STD_USING // Aid ADL for sqrt.
static const char* function = "boost::math::quantile(const triangular_distribution<%1%>&, %1%)";
RealType l = c.dist.lower();
RealType m = c.dist.mode();
RealType u = c.dist.upper();
RealType q = c.param; // probability 0 to 1.
RealType result = 0; // of checks.
if(false == detail::check_triangular(function, l, m, u, &result, Policy()))
{
return result;
}
if(false == detail::check_probability(function, q, &result, Policy()))
{
return result;
}
if(q == 0)
{
return u;
}
if(q == 1)
{
return l;
}
RealType lower = c.dist.lower();
RealType mode = c.dist.mode();
RealType upper = c.dist.upper();
RealType p = 1 - q;
RealType p0 = (mode - lower) / (upper - lower);
if(p < p0)
{
RealType s = (upper - lower) * (mode - lower);
s *= p;
result = sqrt((upper - lower) * (mode - lower) * p) + lower;
}
else if (p == p0)
{
result = mode;
}
else // p > p0
{
result = upper - sqrt((upper - lower) * (upper - mode) * q);
}
return result;
} // RealType quantile(const complemented2_type<triangular_distribution<RealType, Policy>, RealType>& c)
template <class RealType, class Policy>
inline RealType mean(const triangular_distribution<RealType, Policy>& dist)
{
static const char* function = "boost::math::mean(const triangular_distribution<%1%>&)";
RealType lower = dist.lower();
RealType mode = dist.mode();
RealType upper = dist.upper();
RealType result = 0; // of checks.
if(false == detail::check_triangular(function, lower, mode, upper, &result, Policy()))
{
return result;
}
return (lower + upper + mode) / 3;
} // RealType mean(const triangular_distribution<RealType, Policy>& dist)
template <class RealType, class Policy>
inline RealType variance(const triangular_distribution<RealType, Policy>& dist)
{
static const char* function = "boost::math::mean(const triangular_distribution<%1%>&)";
RealType lower = dist.lower();
RealType mode = dist.mode();
RealType upper = dist.upper();
RealType result = 0; // of checks.
if(false == detail::check_triangular(function, lower, mode, upper, &result, Policy()))
{
return result;
}
return (lower * lower + upper * upper + mode * mode - lower * upper - lower * mode - upper * mode) / 18;
} // RealType variance(const triangular_distribution<RealType, Policy>& dist)
template <class RealType, class Policy>
inline RealType mode(const triangular_distribution<RealType, Policy>& dist)
{
static const char* function = "boost::math::mode(const triangular_distribution<%1%>&)";
RealType mode = dist.mode();
RealType result = 0; // of checks.
if(false == detail::check_triangular_mode(function, mode, &result, Policy()))
{ // This should never happen!
return result;
}
return mode;
} // RealType mode
template <class RealType, class Policy>
inline RealType median(const triangular_distribution<RealType, Policy>& dist)
{
BOOST_MATH_STD_USING // ADL of std functions.
static const char* function = "boost::math::median(const triangular_distribution<%1%>&)";
RealType mode = dist.mode();
RealType result = 0; // of checks.
if(false == detail::check_triangular_mode(function, mode, &result, Policy()))
{ // This should never happen!
return result;
}
RealType lower = dist.lower();
RealType upper = dist.upper();
if (mode >= (upper + lower) / 2)
{
return lower + sqrt((upper - lower) * (mode - lower)) / constants::root_two<RealType>();
}
else
{
return upper - sqrt((upper - lower) * (upper - mode)) / constants::root_two<RealType>();
}
} // RealType mode
template <class RealType, class Policy>
inline RealType skewness(const triangular_distribution<RealType, Policy>& dist)
{
BOOST_MATH_STD_USING // for ADL of std functions
using namespace boost::math::constants; // for root_two
static const char* function = "boost::math::skewness(const triangular_distribution<%1%>&)";
RealType lower = dist.lower();
RealType mode = dist.mode();
RealType upper = dist.upper();
RealType result = 0; // of checks.
if(false == boost::math::detail::check_triangular(function,lower, mode, upper, &result, Policy()))
{
return result;
}
return root_two<RealType>() * (lower + upper - 2 * mode) * (2 * lower - upper - mode) * (lower - 2 * upper + mode) /
(5 * pow((lower * lower + upper * upper + mode * mode
- lower * upper - lower * mode - upper * mode), RealType(3)/RealType(2)));
// #11768: Skewness formula for triangular distribution is incorrect - corrected 29 Oct 2015 for release 1.61.
} // RealType skewness(const triangular_distribution<RealType, Policy>& dist)
template <class RealType, class Policy>
inline RealType kurtosis(const triangular_distribution<RealType, Policy>& dist)
{ // These checks may be belt and braces as should have been checked on construction?
static const char* function = "boost::math::kurtosis(const triangular_distribution<%1%>&)";
RealType lower = dist.lower();
RealType upper = dist.upper();
RealType mode = dist.mode();
RealType result = 0; // of checks.
if(false == detail::check_triangular(function,lower, mode, upper, &result, Policy()))
{
return result;
}
return static_cast<RealType>(12)/5; // 12/5 = 2.4;
} // RealType kurtosis_excess(const triangular_distribution<RealType, Policy>& dist)
template <class RealType, class Policy>
inline RealType kurtosis_excess(const triangular_distribution<RealType, Policy>& dist)
{ // These checks may be belt and braces as should have been checked on construction?
static const char* function = "boost::math::kurtosis_excess(const triangular_distribution<%1%>&)";
RealType lower = dist.lower();
RealType upper = dist.upper();
RealType mode = dist.mode();
RealType result = 0; // of checks.
if(false == detail::check_triangular(function,lower, mode, upper, &result, Policy()))
{
return result;
}
return static_cast<RealType>(-3)/5; // - 3/5 = -0.6
// Assuming mathworld really means kurtosis excess? Wikipedia now corrected to match this.
}
} // namespace math
} // namespace boost
// This include must be at the end, *after* the accessors
// for this distribution have been defined, in order to
// keep compilers that support two-phase lookup happy.
#include <boost/math/distributions/detail/derived_accessors.hpp>
#endif // BOOST_STATS_TRIANGULAR_HPP
@@ -0,0 +1,180 @@
// Copyright Aleksey Gurtovoy 2000-2004
//
// Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
//
// Preprocessed version of "boost/mpl/aux_/fold_impl.hpp" header
// -- DO NOT modify by hand!
namespace boost { namespace mpl { namespace aux {
/// forward declaration
template<
int N
, typename First
, typename Last
, typename State
, typename ForwardOp
>
struct fold_impl;
template<
typename First
, typename Last
, typename State
, typename ForwardOp
>
struct fold_impl< 0,First,Last,State,ForwardOp >
{
typedef First iter0;
typedef State state0;
typedef state0 state;
typedef iter0 iterator;
};
template<
typename First
, typename Last
, typename State
, typename ForwardOp
>
struct fold_impl< 1,First,Last,State,ForwardOp >
{
typedef First iter0;
typedef State state0;
typedef typename apply2< ForwardOp, state0, typename deref<iter0>::type >::type state1;
typedef typename mpl::next<iter0>::type iter1;
typedef state1 state;
typedef iter1 iterator;
};
template<
typename First
, typename Last
, typename State
, typename ForwardOp
>
struct fold_impl< 2,First,Last,State,ForwardOp >
{
typedef First iter0;
typedef State state0;
typedef typename apply2< ForwardOp, state0, typename deref<iter0>::type >::type state1;
typedef typename mpl::next<iter0>::type iter1;
typedef typename apply2< ForwardOp, state1, typename deref<iter1>::type >::type state2;
typedef typename mpl::next<iter1>::type iter2;
typedef state2 state;
typedef iter2 iterator;
};
template<
typename First
, typename Last
, typename State
, typename ForwardOp
>
struct fold_impl< 3,First,Last,State,ForwardOp >
{
typedef First iter0;
typedef State state0;
typedef typename apply2< ForwardOp, state0, typename deref<iter0>::type >::type state1;
typedef typename mpl::next<iter0>::type iter1;
typedef typename apply2< ForwardOp, state1, typename deref<iter1>::type >::type state2;
typedef typename mpl::next<iter1>::type iter2;
typedef typename apply2< ForwardOp, state2, typename deref<iter2>::type >::type state3;
typedef typename mpl::next<iter2>::type iter3;
typedef state3 state;
typedef iter3 iterator;
};
template<
typename First
, typename Last
, typename State
, typename ForwardOp
>
struct fold_impl< 4,First,Last,State,ForwardOp >
{
typedef First iter0;
typedef State state0;
typedef typename apply2< ForwardOp, state0, typename deref<iter0>::type >::type state1;
typedef typename mpl::next<iter0>::type iter1;
typedef typename apply2< ForwardOp, state1, typename deref<iter1>::type >::type state2;
typedef typename mpl::next<iter1>::type iter2;
typedef typename apply2< ForwardOp, state2, typename deref<iter2>::type >::type state3;
typedef typename mpl::next<iter2>::type iter3;
typedef typename apply2< ForwardOp, state3, typename deref<iter3>::type >::type state4;
typedef typename mpl::next<iter3>::type iter4;
typedef state4 state;
typedef iter4 iterator;
};
template<
int N
, typename First
, typename Last
, typename State
, typename ForwardOp
>
struct fold_impl
{
typedef fold_impl<
4
, First
, Last
, State
, ForwardOp
> chunk_;
typedef fold_impl<
( (N - 4) < 0 ? 0 : N - 4 )
, typename chunk_::iterator
, Last
, typename chunk_::state
, ForwardOp
> res_;
typedef typename res_::state state;
typedef typename res_::iterator iterator;
};
template<
typename First
, typename Last
, typename State
, typename ForwardOp
>
struct fold_impl< -1,First,Last,State,ForwardOp >
: fold_impl<
-1
, typename mpl::next<First>::type
, Last
, typename apply2<ForwardOp,State, typename deref<First>::type>::type
, ForwardOp
>
{
};
template<
typename Last
, typename State
, typename ForwardOp
>
struct fold_impl< -1,Last,Last,State,ForwardOp >
{
typedef State state;
typedef Last iterator;
};
}}}
@@ -0,0 +1,556 @@
// Copyright Aleksey Gurtovoy 2000-2004
//
// Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
//
// Preprocessed version of "boost/mpl/map.hpp" header
// -- DO NOT modify by hand!
namespace boost { namespace mpl {
namespace aux {
template< int N >
struct map_chooser;
}
namespace aux {
template<>
struct map_chooser<0>
{
template<
typename T0, typename T1, typename T2, typename T3, typename T4
, typename T5, typename T6, typename T7, typename T8, typename T9
, typename T10, typename T11, typename T12, typename T13, typename T14
, typename T15, typename T16, typename T17, typename T18, typename T19
>
struct result_
{
typedef map0<
>::type type;
};
};
} // namespace aux
namespace aux {
template<>
struct map_chooser<1>
{
template<
typename T0, typename T1, typename T2, typename T3, typename T4
, typename T5, typename T6, typename T7, typename T8, typename T9
, typename T10, typename T11, typename T12, typename T13, typename T14
, typename T15, typename T16, typename T17, typename T18, typename T19
>
struct result_
{
typedef typename map1<
T0
>::type type;
};
};
} // namespace aux
namespace aux {
template<>
struct map_chooser<2>
{
template<
typename T0, typename T1, typename T2, typename T3, typename T4
, typename T5, typename T6, typename T7, typename T8, typename T9
, typename T10, typename T11, typename T12, typename T13, typename T14
, typename T15, typename T16, typename T17, typename T18, typename T19
>
struct result_
{
typedef typename map2<
T0, T1
>::type type;
};
};
} // namespace aux
namespace aux {
template<>
struct map_chooser<3>
{
template<
typename T0, typename T1, typename T2, typename T3, typename T4
, typename T5, typename T6, typename T7, typename T8, typename T9
, typename T10, typename T11, typename T12, typename T13, typename T14
, typename T15, typename T16, typename T17, typename T18, typename T19
>
struct result_
{
typedef typename map3<
T0, T1, T2
>::type type;
};
};
} // namespace aux
namespace aux {
template<>
struct map_chooser<4>
{
template<
typename T0, typename T1, typename T2, typename T3, typename T4
, typename T5, typename T6, typename T7, typename T8, typename T9
, typename T10, typename T11, typename T12, typename T13, typename T14
, typename T15, typename T16, typename T17, typename T18, typename T19
>
struct result_
{
typedef typename map4<
T0, T1, T2, T3
>::type type;
};
};
} // namespace aux
namespace aux {
template<>
struct map_chooser<5>
{
template<
typename T0, typename T1, typename T2, typename T3, typename T4
, typename T5, typename T6, typename T7, typename T8, typename T9
, typename T10, typename T11, typename T12, typename T13, typename T14
, typename T15, typename T16, typename T17, typename T18, typename T19
>
struct result_
{
typedef typename map5<
T0, T1, T2, T3, T4
>::type type;
};
};
} // namespace aux
namespace aux {
template<>
struct map_chooser<6>
{
template<
typename T0, typename T1, typename T2, typename T3, typename T4
, typename T5, typename T6, typename T7, typename T8, typename T9
, typename T10, typename T11, typename T12, typename T13, typename T14
, typename T15, typename T16, typename T17, typename T18, typename T19
>
struct result_
{
typedef typename map6<
T0, T1, T2, T3, T4, T5
>::type type;
};
};
} // namespace aux
namespace aux {
template<>
struct map_chooser<7>
{
template<
typename T0, typename T1, typename T2, typename T3, typename T4
, typename T5, typename T6, typename T7, typename T8, typename T9
, typename T10, typename T11, typename T12, typename T13, typename T14
, typename T15, typename T16, typename T17, typename T18, typename T19
>
struct result_
{
typedef typename map7<
T0, T1, T2, T3, T4, T5, T6
>::type type;
};
};
} // namespace aux
namespace aux {
template<>
struct map_chooser<8>
{
template<
typename T0, typename T1, typename T2, typename T3, typename T4
, typename T5, typename T6, typename T7, typename T8, typename T9
, typename T10, typename T11, typename T12, typename T13, typename T14
, typename T15, typename T16, typename T17, typename T18, typename T19
>
struct result_
{
typedef typename map8<
T0, T1, T2, T3, T4, T5, T6, T7
>::type type;
};
};
} // namespace aux
namespace aux {
template<>
struct map_chooser<9>
{
template<
typename T0, typename T1, typename T2, typename T3, typename T4
, typename T5, typename T6, typename T7, typename T8, typename T9
, typename T10, typename T11, typename T12, typename T13, typename T14
, typename T15, typename T16, typename T17, typename T18, typename T19
>
struct result_
{
typedef typename map9<
T0, T1, T2, T3, T4, T5, T6, T7, T8
>::type type;
};
};
} // namespace aux
namespace aux {
template<>
struct map_chooser<10>
{
template<
typename T0, typename T1, typename T2, typename T3, typename T4
, typename T5, typename T6, typename T7, typename T8, typename T9
, typename T10, typename T11, typename T12, typename T13, typename T14
, typename T15, typename T16, typename T17, typename T18, typename T19
>
struct result_
{
typedef typename map10<
T0, T1, T2, T3, T4, T5, T6, T7, T8, T9
>::type type;
};
};
} // namespace aux
namespace aux {
template<>
struct map_chooser<11>
{
template<
typename T0, typename T1, typename T2, typename T3, typename T4
, typename T5, typename T6, typename T7, typename T8, typename T9
, typename T10, typename T11, typename T12, typename T13, typename T14
, typename T15, typename T16, typename T17, typename T18, typename T19
>
struct result_
{
typedef typename map11<
T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10
>::type type;
};
};
} // namespace aux
namespace aux {
template<>
struct map_chooser<12>
{
template<
typename T0, typename T1, typename T2, typename T3, typename T4
, typename T5, typename T6, typename T7, typename T8, typename T9
, typename T10, typename T11, typename T12, typename T13, typename T14
, typename T15, typename T16, typename T17, typename T18, typename T19
>
struct result_
{
typedef typename map12<
T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11
>::type type;
};
};
} // namespace aux
namespace aux {
template<>
struct map_chooser<13>
{
template<
typename T0, typename T1, typename T2, typename T3, typename T4
, typename T5, typename T6, typename T7, typename T8, typename T9
, typename T10, typename T11, typename T12, typename T13, typename T14
, typename T15, typename T16, typename T17, typename T18, typename T19
>
struct result_
{
typedef typename map13<
T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12
>::type type;
};
};
} // namespace aux
namespace aux {
template<>
struct map_chooser<14>
{
template<
typename T0, typename T1, typename T2, typename T3, typename T4
, typename T5, typename T6, typename T7, typename T8, typename T9
, typename T10, typename T11, typename T12, typename T13, typename T14
, typename T15, typename T16, typename T17, typename T18, typename T19
>
struct result_
{
typedef typename map14<
T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13
>::type type;
};
};
} // namespace aux
namespace aux {
template<>
struct map_chooser<15>
{
template<
typename T0, typename T1, typename T2, typename T3, typename T4
, typename T5, typename T6, typename T7, typename T8, typename T9
, typename T10, typename T11, typename T12, typename T13, typename T14
, typename T15, typename T16, typename T17, typename T18, typename T19
>
struct result_
{
typedef typename map15<
T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14
>::type type;
};
};
} // namespace aux
namespace aux {
template<>
struct map_chooser<16>
{
template<
typename T0, typename T1, typename T2, typename T3, typename T4
, typename T5, typename T6, typename T7, typename T8, typename T9
, typename T10, typename T11, typename T12, typename T13, typename T14
, typename T15, typename T16, typename T17, typename T18, typename T19
>
struct result_
{
typedef typename map16<
T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15
>::type type;
};
};
} // namespace aux
namespace aux {
template<>
struct map_chooser<17>
{
template<
typename T0, typename T1, typename T2, typename T3, typename T4
, typename T5, typename T6, typename T7, typename T8, typename T9
, typename T10, typename T11, typename T12, typename T13, typename T14
, typename T15, typename T16, typename T17, typename T18, typename T19
>
struct result_
{
typedef typename map17<
T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16
>::type type;
};
};
} // namespace aux
namespace aux {
template<>
struct map_chooser<18>
{
template<
typename T0, typename T1, typename T2, typename T3, typename T4
, typename T5, typename T6, typename T7, typename T8, typename T9
, typename T10, typename T11, typename T12, typename T13, typename T14
, typename T15, typename T16, typename T17, typename T18, typename T19
>
struct result_
{
typedef typename map18<
T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17
>::type type;
};
};
} // namespace aux
namespace aux {
template<>
struct map_chooser<19>
{
template<
typename T0, typename T1, typename T2, typename T3, typename T4
, typename T5, typename T6, typename T7, typename T8, typename T9
, typename T10, typename T11, typename T12, typename T13, typename T14
, typename T15, typename T16, typename T17, typename T18, typename T19
>
struct result_
{
typedef typename map19<
T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18
>::type type;
};
};
} // namespace aux
namespace aux {
template<>
struct map_chooser<20>
{
template<
typename T0, typename T1, typename T2, typename T3, typename T4
, typename T5, typename T6, typename T7, typename T8, typename T9
, typename T10, typename T11, typename T12, typename T13, typename T14
, typename T15, typename T16, typename T17, typename T18, typename T19
>
struct result_
{
typedef typename map20<
T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19
>::type type;
};
};
} // namespace aux
namespace aux {
template< typename T >
struct is_map_arg
{
BOOST_STATIC_CONSTANT(bool, value = true);
};
template<>
struct is_map_arg<na>
{
BOOST_STATIC_CONSTANT(bool, value = false);
};
template<
typename T1, typename T2, typename T3, typename T4, typename T5
, typename T6, typename T7, typename T8, typename T9, typename T10
, typename T11, typename T12, typename T13, typename T14, typename T15
, typename T16, typename T17, typename T18, typename T19, typename T20
>
struct map_count_args
{
BOOST_STATIC_CONSTANT(int, value =
is_map_arg<T1>::value + is_map_arg<T2>::value
+ is_map_arg<T3>::value + is_map_arg<T4>::value
+ is_map_arg<T5>::value + is_map_arg<T6>::value
+ is_map_arg<T7>::value + is_map_arg<T8>::value
+ is_map_arg<T9>::value + is_map_arg<T10>::value
+ is_map_arg<T11>::value + is_map_arg<T12>::value
+ is_map_arg<T13>::value + is_map_arg<T14>::value
+ is_map_arg<T15>::value + is_map_arg<T16>::value
+ is_map_arg<T17>::value + is_map_arg<T18>::value
+ is_map_arg<T19>::value + is_map_arg<T20>::value
);
};
template<
typename T0, typename T1, typename T2, typename T3, typename T4
, typename T5, typename T6, typename T7, typename T8, typename T9
, typename T10, typename T11, typename T12, typename T13, typename T14
, typename T15, typename T16, typename T17, typename T18, typename T19
>
struct map_impl
{
typedef aux::map_count_args<
T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19
> arg_num_;
typedef typename aux::map_chooser< arg_num_::value >
::template result_< T0,T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14,T15,T16,T17,T18,T19 >::type type;
};
} // namespace aux
template<
typename T0 = na, typename T1 = na, typename T2 = na, typename T3 = na
, typename T4 = na, typename T5 = na, typename T6 = na, typename T7 = na
, typename T8 = na, typename T9 = na, typename T10 = na, typename T11 = na
, typename T12 = na, typename T13 = na, typename T14 = na
, typename T15 = na, typename T16 = na, typename T17 = na
, typename T18 = na, typename T19 = na
>
struct map
: aux::map_impl<
T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19
>::type
{
typedef typename aux::map_impl<
T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19
>::type type;
};
}}
@@ -0,0 +1,45 @@
#ifndef BOOST_MPL_VECTOR_VECTOR20_HPP_INCLUDED
#define BOOST_MPL_VECTOR_VECTOR20_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$
#if !defined(BOOST_MPL_PREPROCESSING_MODE)
# include <boost/mpl/vector/vector10.hpp>
#endif
#include <boost/mpl/aux_/config/use_preprocessed.hpp>
#if !defined(BOOST_MPL_CFG_NO_PREPROCESSED_HEADERS) \
&& !defined(BOOST_MPL_PREPROCESSING_MODE)
# define BOOST_MPL_PREPROCESSED_HEADER vector20.hpp
# include <boost/mpl/vector/aux_/include_preprocessed.hpp>
#else
# include <boost/mpl/aux_/config/typeof.hpp>
# include <boost/mpl/aux_/config/ctps.hpp>
# include <boost/preprocessor/iterate.hpp>
namespace boost { namespace mpl {
# define BOOST_PP_ITERATION_PARAMS_1 \
(3,(11, 20, <boost/mpl/vector/aux_/numbered.hpp>))
# include BOOST_PP_ITERATE()
}}
#endif // BOOST_MPL_CFG_NO_PREPROCESSED_HEADERS
#endif // BOOST_MPL_VECTOR_VECTOR20_HPP_INCLUDED
@@ -0,0 +1,31 @@
#ifndef BOOST_IS_PLACEHOLDER_HPP_INCLUDED
#define BOOST_IS_PLACEHOLDER_HPP_INCLUDED
// MS compatible compilers support #pragma once
#if defined( _MSC_VER ) && ( _MSC_VER >= 1020 )
# pragma once
#endif
// is_placeholder.hpp - TR1 is_placeholder metafunction
//
// Copyright (c) 2006 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
namespace boost
{
template< class T > struct is_placeholder
{
enum _vt { value = 0 };
};
} // namespace boost
#endif // #ifndef BOOST_IS_PLACEHOLDER_HPP_INCLUDED
@@ -0,0 +1,56 @@
/*
[auto_generated]
boost/numeric/odeint/integrate/observer_collection.hpp
[begin_description]
Collection of observers, which are all called during the evolution of the ODE.
[end_description]
Copyright 2009-2011 Karsten Ahnert
Copyright 2009-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_INTEGRATE_OBSERVER_COLLECTION_HPP_INCLUDED
#define BOOST_NUMERIC_ODEINT_INTEGRATE_OBSERVER_COLLECTION_HPP_INCLUDED
#include <vector>
#include <boost/function.hpp>
namespace boost {
namespace numeric {
namespace odeint {
template< class State , class Time >
class observer_collection
{
public:
typedef boost::function< void( const State& , const Time& ) > observer_type;
typedef std::vector< observer_type > collection_type;
void operator()( const State& x , Time t )
{
for( size_t i=0 ; i<m_observers.size() ; ++i )
m_observers[i]( x , t );
}
collection_type& observers( void ) { return m_observers; }
const collection_type& observers( void ) const { return m_observers; }
private:
collection_type m_observers;
};
} // namespace odeint
} // namespace numeric
} // namespace boost
#endif // BOOST_NUMERIC_ODEINT_INTEGRATE_OBSERVER_COLLECTION_HPP_INCLUDED
@@ -0,0 +1,55 @@
!
! Generate a seed for the RANDOM_NUMBER PRNG that is guaranteed to be
! unique even if many processes are started simultaneously
!
subroutine init_random_seed()
use iso_fortran_env, only: int64
implicit none
integer, allocatable :: seed(:)
integer :: i, n, un, istat, dt(8), pid
integer(int64) :: t
call random_seed(size = n)
allocate(seed(n))
! First try if the OS provides a random number generator
open(newunit=un, file="/dev/urandom", access="stream", &
form="unformatted", action="read", status="old", iostat=istat)
if (istat == 0) then
read(un) seed
close(un)
else
! Fallback to XOR:ing the current time and pid. The PID is
! useful in case one launches multiple instances of the same
! program in parallel.
call system_clock(t)
if (t == 0) then
call date_and_time(values=dt)
t = (dt(1) - 1970) * 365_int64 * 24 * 60 * 60 * 1000 &
+ dt(2) * 31_int64 * 24 * 60 * 60 * 1000 &
+ dt(3) * 24_int64 * 60 * 60 * 1000 &
+ dt(5) * 60 * 60 * 1000 &
+ dt(6) * 60 * 1000 + dt(7) * 1000 &
+ dt(8)
end if
pid = getpid()
t = ieor(t, int(pid, kind(t)))
do i = 1, n
seed(i) = lcg(t)
end do
end if
call random_seed(put=seed)
contains
! This simple PRNG might not be good enough for real work, but is
! sufficient for seeding a better PRNG.
function lcg(s)
integer :: lcg
integer(int64) :: s
if (s == 0) then
s = 104729
else
s = mod(s, 4294967296_int64)
end if
s = mod(s * 279470273_int64, 4294967291_int64)
lcg = int(mod(s, int(huge(0), int64)), kind(0))
end function lcg
end subroutine init_random_seed
@@ -0,0 +1,56 @@
/*
Copyright Rene Rivera 2008-2015
Distributed under the Boost Software License, Version 1.0.
(See accompanying file LICENSE_1_0.txt or copy at
http://www.boost.org/LICENSE_1_0.txt)
*/
#ifndef BOOST_PREDEF_COMPILER_DIAB_H
#define BOOST_PREDEF_COMPILER_DIAB_H
#include <boost/predef/version_number.h>
#include <boost/predef/make.h>
/*`
[heading `BOOST_COMP_DIAB`]
[@http://www.windriver.com/products/development_suite/wind_river_compiler/ Diab C/C++] compiler.
Version number available as major, minor, and patch.
[table
[[__predef_symbol__] [__predef_version__]]
[[`__DCC__`] [__predef_detection__]]
[[`__VERSION_NUMBER__`] [V.R.P]]
]
*/
#define BOOST_COMP_DIAB BOOST_VERSION_NUMBER_NOT_AVAILABLE
#if defined(__DCC__)
# define BOOST_COMP_DIAB_DETECTION BOOST_PREDEF_MAKE_10_VRPP(__VERSION_NUMBER__)
#endif
#ifdef BOOST_COMP_DIAB_DETECTION
# if defined(BOOST_PREDEF_DETAIL_COMP_DETECTED)
# define BOOST_COMP_DIAB_EMULATED BOOST_COMP_DIAB_DETECTION
# else
# undef BOOST_COMP_DIAB
# define BOOST_COMP_DIAB BOOST_COMP_DIAB_DETECTION
# endif
# define BOOST_COMP_DIAB_AVAILABLE
# include <boost/predef/detail/comp_detected.h>
#endif
#define BOOST_COMP_DIAB_NAME "Diab C/C++"
#endif
#include <boost/predef/detail/test.h>
BOOST_PREDEF_DECLARE_TEST(BOOST_COMP_DIAB,BOOST_COMP_DIAB_NAME)
#ifdef BOOST_COMP_DIAB_EMULATED
#include <boost/predef/detail/test.h>
BOOST_PREDEF_DECLARE_TEST(BOOST_COMP_DIAB_EMULATED,BOOST_COMP_DIAB_NAME)
#endif
@@ -0,0 +1,269 @@
#ifndef DATE_DURATION_TYPES_HPP___
#define DATE_DURATION_TYPES_HPP___
/* Copyright (c) 2004 CrystalClear Software, Inc.
* Subject to the Boost Software License, Version 1.0.
* (See accompanying file LICENSE_1_0.txt or
* http://www.boost.org/LICENSE_1_0.txt)
* Author: Jeff Garland, Bart Garst
* $Date$
*/
#include <boost/date_time/int_adapter.hpp>
#include <boost/date_time/special_defs.hpp>
#include <boost/date_time/date_duration.hpp>
namespace boost {
namespace date_time {
//! Additional duration type that represents a number of n*7 days
template <class duration_config>
class weeks_duration : public date_duration<duration_config> {
public:
weeks_duration(typename duration_config::impl_type w)
: date_duration<duration_config>(w * 7) {}
weeks_duration(special_values sv)
: date_duration<duration_config>(sv) {}
};
// predeclare
template<class t>
class years_duration;
//! additional duration type that represents a logical month
/*! A logical month enables things like: "date(2002,Mar,2) + months(2) ->
* 2002-May2". If the date is a last day-of-the-month, the result will
* also be a last-day-of-the-month.
*/
template<class base_config>
class months_duration
{
private:
typedef typename base_config::int_rep int_rep;
typedef typename int_rep::int_type int_type;
typedef typename base_config::date_type date_type;
typedef typename date_type::duration_type duration_type;
typedef typename base_config::month_adjustor_type month_adjustor_type;
typedef months_duration<base_config> months_type;
typedef years_duration<base_config> years_type;
public:
months_duration(int_rep num) : _m(num) {}
months_duration(special_values sv) : _m(sv)
{
_m = int_rep::from_special(sv);
}
int_rep number_of_months() const { return _m; }
//! returns a negative duration
duration_type get_neg_offset(const date_type& d) const
{
month_adjustor_type m_adj(_m.as_number());
return duration_type(m_adj.get_neg_offset(d));
}
duration_type get_offset(const date_type& d) const
{
month_adjustor_type m_adj(_m.as_number());
return duration_type(m_adj.get_offset(d));
}
bool operator==(const months_type& rhs) const
{
return(_m == rhs._m);
}
bool operator!=(const months_type& rhs) const
{
return(_m != rhs._m);
}
months_type operator+(const months_type& rhs)const
{
return months_type(_m + rhs._m);
}
months_type& operator+=(const months_type& rhs)
{
_m = _m + rhs._m;
return *this;
}
months_type operator-(const months_type& rhs)const
{
return months_type(_m - rhs._m);
}
months_type& operator-=(const months_type& rhs)
{
_m = _m - rhs._m;
return *this;
}
months_type operator*(const int_type rhs)const
{
return months_type(_m * rhs);
}
months_type& operator*=(const int_type rhs)
{
_m = _m * rhs;
return *this;
}
months_type operator/(const int_type rhs)const
{
return months_type(_m / rhs);
}
months_type& operator/=(const int_type rhs)
{
_m = _m / rhs;
return *this;
}
months_type operator+(const years_type& y)const
{
return months_type(y.number_of_years() * 12 + _m);
}
months_type& operator+=(const years_type& y)
{
_m = y.number_of_years() * 12 + _m;
return *this;
}
months_type operator-(const years_type& y) const
{
return months_type(_m - y.number_of_years() * 12);
}
months_type& operator-=(const years_type& y)
{
_m = _m - y.number_of_years() * 12;
return *this;
}
//
friend date_type operator+(const date_type& d, const months_type& m)
{
return d + m.get_offset(d);
}
friend date_type operator+=(date_type& d, const months_type& m)
{
return d += m.get_offset(d);
}
friend date_type operator-(const date_type& d, const months_type& m)
{
// get_neg_offset returns a negative duration, so we add
return d + m.get_neg_offset(d);
}
friend date_type operator-=(date_type& d, const months_type& m)
{
// get_neg_offset returns a negative duration, so we add
return d += m.get_neg_offset(d);
}
private:
int_rep _m;
};
//! additional duration type that represents a logical year
/*! A logical year enables things like: "date(2002,Mar,2) + years(2) ->
* 2004-Mar-2". If the date is a last day-of-the-month, the result will
* also be a last-day-of-the-month (ie date(2001-Feb-28) + years(3) ->
* 2004-Feb-29).
*/
template<class base_config>
class years_duration
{
private:
typedef typename base_config::int_rep int_rep;
typedef typename int_rep::int_type int_type;
typedef typename base_config::date_type date_type;
typedef typename date_type::duration_type duration_type;
typedef typename base_config::month_adjustor_type month_adjustor_type;
typedef years_duration<base_config> years_type;
typedef months_duration<base_config> months_type;
public:
years_duration(int_rep num) : _y(num) {}
years_duration(special_values sv) : _y(sv)
{
_y = int_rep::from_special(sv);
}
int_rep number_of_years() const { return _y; }
//! returns a negative duration
duration_type get_neg_offset(const date_type& d) const
{
month_adjustor_type m_adj(_y.as_number() * 12);
return duration_type(m_adj.get_neg_offset(d));
}
duration_type get_offset(const date_type& d) const
{
month_adjustor_type m_adj(_y.as_number() * 12);
return duration_type(m_adj.get_offset(d));
}
bool operator==(const years_type& rhs) const
{
return(_y == rhs._y);
}
bool operator!=(const years_type& rhs) const
{
return(_y != rhs._y);
}
years_type operator+(const years_type& rhs)const
{
return years_type(_y + rhs._y);
}
years_type& operator+=(const years_type& rhs)
{
_y = _y + rhs._y;
return *this;
}
years_type operator-(const years_type& rhs)const
{
return years_type(_y - rhs._y);
}
years_type& operator-=(const years_type& rhs)
{
_y = _y - rhs._y;
return *this;
}
years_type operator*(const int_type rhs)const
{
return years_type(_y * rhs);
}
years_type& operator*=(const int_type rhs)
{
_y = _y * rhs;
return *this;
}
years_type operator/(const int_type rhs)const
{
return years_type(_y / rhs);
}
years_type& operator/=(const int_type rhs)
{
_y = _y / rhs;
return *this;
}
months_type operator+(const months_type& m) const
{
return(months_type(_y * 12 + m.number_of_months()));
}
months_type operator-(const months_type& m) const
{
return(months_type(_y * 12 - m.number_of_months()));
}
//
friend date_type operator+(const date_type& d, const years_type& y)
{
return d + y.get_offset(d);
}
friend date_type operator+=(date_type& d, const years_type& y)
{
return d += y.get_offset(d);
}
friend date_type operator-(const date_type& d, const years_type& y)
{
// get_neg_offset returns a negative duration, so we add
return d + y.get_neg_offset(d);
}
friend date_type operator-=(date_type& d, const years_type& y)
{
// get_neg_offset returns a negative duration, so we add
return d += y.get_neg_offset(d);
}
private:
int_rep _y;
};
}} // namespace boost::date_time
#endif // DATE_DURATION_TYPES_HPP___
@@ -0,0 +1,36 @@
// Boost.Units - A C++ library for zero-overhead dimensional analysis and
// unit/quantity manipulation and conversion
//
// Copyright (C) 2003-2008 Matthias Christian Schabel
// Copyright (C) 2008 Steven Watanabe
//
// Distributed under the Boost Software License, Version 1.0. (See
// accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
#ifndef BOOST_UNITS_SI_VELOCITY_HPP
#define BOOST_UNITS_SI_VELOCITY_HPP
#include <boost/units/systems/si/base.hpp>
#include <boost/units/physical_dimensions/velocity.hpp>
namespace boost {
namespace units {
namespace si {
typedef unit<velocity_dimension,si::system> velocity;
BOOST_UNITS_STATIC_CONSTANT(meter_per_second,velocity);
BOOST_UNITS_STATIC_CONSTANT(meters_per_second,velocity);
BOOST_UNITS_STATIC_CONSTANT(metre_per_second,velocity);
BOOST_UNITS_STATIC_CONSTANT(metres_per_second,velocity);
} // namespace si
} // namespace units
} // namespace boost
#endif // BOOST_UNITS_SI_VELOCITY_HPP
@@ -0,0 +1,64 @@
subroutine rectify_msk(c,msg0,imsg,freq2)
parameter (NSPM=1404)
complex c(0:NSPM-1) !Received data
complex cmsg(0:NSPM-1) !Message waveform
complex c1(0:NSPM-1) !Rectified signal
complex c2(0:NSPM-1) !Integral of rectified signal
complex c3(0:2*NSPM-1) !FFT of rectified signal
complex cfac
character*22 msg0,msg,msgsent
integer i4tone(234)
ichk=0
msg=msg0
nsym=234
if(imsg.ge.0) then
ichk=10000+imsg
msg="<C1ALL C2ALL> 73"
nsym=35
endif
call genmsk(msg,ichk,msgsent,i4tone,itype) !Get tone sequence for msg
twopi=8.0*atan(1.0)
dt=1.0/12000.0
f0=1000.0
f1=2000.0
phi=0.
dphi=0.
k=-1
c2=0.
do j=1,nsym !Generate Tx waveform for msg
if(i4tone(j).eq.0) dphi=twopi*f0*dt
if(i4tone(j).eq.1) dphi=twopi*f1*dt
do i=1,6
k=k+1
phi=phi+dphi
cmsg(k)=cmplx(cos(phi),sin(phi))
c1(k)=conjg(cmsg(k))*c(k)
if(k.ge.1) c2(k)=c2(k-1) + c1(k)
enddo
enddo
c2(0)=c2(1)
pha=atan2(aimag(c2(NSPM-1)),real(c2(NSPM-1)))
cfac=cmplx(cos(pha),-sin(pha))
c1=cfac*c1
c2=cfac*c2
nfft=2*NSPM
c3(0:NSPM-1)=c2
c3(NSPM:nfft-1)=0.
df=12000.0/nfft
call four2a(c3,nfft,1,-1,1)
smax=0.
do i=0,nfft-1
f=i*df
if(i.gt.nfft/2) f=f-12000.0
s=1.e-10*(real(c3(i))**2 + aimag(c3(i))**2)
if(s.gt.smax) then
smax=s
freq2=1500.0 + f
endif
enddo
return
end subroutine rectify_msk
@@ -0,0 +1,288 @@
# /* **************************************************************************
# * *
# * (C) Copyright Paul Mensonides 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 for most recent version. */
#
# ifndef BOOST_PREPROCESSOR_SEQ_ENUM_HPP
# define BOOST_PREPROCESSOR_SEQ_ENUM_HPP
#
# include <boost/preprocessor/cat.hpp>
# include <boost/preprocessor/config/config.hpp>
# include <boost/preprocessor/seq/size.hpp>
#
# /* BOOST_PP_SEQ_ENUM */
#
# if BOOST_PP_CONFIG_FLAGS() & BOOST_PP_CONFIG_EDG()
# define BOOST_PP_SEQ_ENUM(seq) BOOST_PP_SEQ_ENUM_I(seq)
# define BOOST_PP_SEQ_ENUM_I(seq) BOOST_PP_CAT(BOOST_PP_SEQ_ENUM_, BOOST_PP_SEQ_SIZE(seq)) seq
# elif BOOST_PP_CONFIG_FLAGS() & BOOST_PP_CONFIG_MWCC()
# define BOOST_PP_SEQ_ENUM(seq) BOOST_PP_SEQ_ENUM_I(BOOST_PP_SEQ_SIZE(seq), seq)
# define BOOST_PP_SEQ_ENUM_I(size, seq) BOOST_PP_CAT(BOOST_PP_SEQ_ENUM_, size) seq
# else
# define BOOST_PP_SEQ_ENUM(seq) BOOST_PP_CAT(BOOST_PP_SEQ_ENUM_, BOOST_PP_SEQ_SIZE(seq)) seq
# endif
#
# define BOOST_PP_SEQ_ENUM_1(x) x
# define BOOST_PP_SEQ_ENUM_2(x) x, BOOST_PP_SEQ_ENUM_1
# define BOOST_PP_SEQ_ENUM_3(x) x, BOOST_PP_SEQ_ENUM_2
# define BOOST_PP_SEQ_ENUM_4(x) x, BOOST_PP_SEQ_ENUM_3
# define BOOST_PP_SEQ_ENUM_5(x) x, BOOST_PP_SEQ_ENUM_4
# define BOOST_PP_SEQ_ENUM_6(x) x, BOOST_PP_SEQ_ENUM_5
# define BOOST_PP_SEQ_ENUM_7(x) x, BOOST_PP_SEQ_ENUM_6
# define BOOST_PP_SEQ_ENUM_8(x) x, BOOST_PP_SEQ_ENUM_7
# define BOOST_PP_SEQ_ENUM_9(x) x, BOOST_PP_SEQ_ENUM_8
# define BOOST_PP_SEQ_ENUM_10(x) x, BOOST_PP_SEQ_ENUM_9
# define BOOST_PP_SEQ_ENUM_11(x) x, BOOST_PP_SEQ_ENUM_10
# define BOOST_PP_SEQ_ENUM_12(x) x, BOOST_PP_SEQ_ENUM_11
# define BOOST_PP_SEQ_ENUM_13(x) x, BOOST_PP_SEQ_ENUM_12
# define BOOST_PP_SEQ_ENUM_14(x) x, BOOST_PP_SEQ_ENUM_13
# define BOOST_PP_SEQ_ENUM_15(x) x, BOOST_PP_SEQ_ENUM_14
# define BOOST_PP_SEQ_ENUM_16(x) x, BOOST_PP_SEQ_ENUM_15
# define BOOST_PP_SEQ_ENUM_17(x) x, BOOST_PP_SEQ_ENUM_16
# define BOOST_PP_SEQ_ENUM_18(x) x, BOOST_PP_SEQ_ENUM_17
# define BOOST_PP_SEQ_ENUM_19(x) x, BOOST_PP_SEQ_ENUM_18
# define BOOST_PP_SEQ_ENUM_20(x) x, BOOST_PP_SEQ_ENUM_19
# define BOOST_PP_SEQ_ENUM_21(x) x, BOOST_PP_SEQ_ENUM_20
# define BOOST_PP_SEQ_ENUM_22(x) x, BOOST_PP_SEQ_ENUM_21
# define BOOST_PP_SEQ_ENUM_23(x) x, BOOST_PP_SEQ_ENUM_22
# define BOOST_PP_SEQ_ENUM_24(x) x, BOOST_PP_SEQ_ENUM_23
# define BOOST_PP_SEQ_ENUM_25(x) x, BOOST_PP_SEQ_ENUM_24
# define BOOST_PP_SEQ_ENUM_26(x) x, BOOST_PP_SEQ_ENUM_25
# define BOOST_PP_SEQ_ENUM_27(x) x, BOOST_PP_SEQ_ENUM_26
# define BOOST_PP_SEQ_ENUM_28(x) x, BOOST_PP_SEQ_ENUM_27
# define BOOST_PP_SEQ_ENUM_29(x) x, BOOST_PP_SEQ_ENUM_28
# define BOOST_PP_SEQ_ENUM_30(x) x, BOOST_PP_SEQ_ENUM_29
# define BOOST_PP_SEQ_ENUM_31(x) x, BOOST_PP_SEQ_ENUM_30
# define BOOST_PP_SEQ_ENUM_32(x) x, BOOST_PP_SEQ_ENUM_31
# define BOOST_PP_SEQ_ENUM_33(x) x, BOOST_PP_SEQ_ENUM_32
# define BOOST_PP_SEQ_ENUM_34(x) x, BOOST_PP_SEQ_ENUM_33
# define BOOST_PP_SEQ_ENUM_35(x) x, BOOST_PP_SEQ_ENUM_34
# define BOOST_PP_SEQ_ENUM_36(x) x, BOOST_PP_SEQ_ENUM_35
# define BOOST_PP_SEQ_ENUM_37(x) x, BOOST_PP_SEQ_ENUM_36
# define BOOST_PP_SEQ_ENUM_38(x) x, BOOST_PP_SEQ_ENUM_37
# define BOOST_PP_SEQ_ENUM_39(x) x, BOOST_PP_SEQ_ENUM_38
# define BOOST_PP_SEQ_ENUM_40(x) x, BOOST_PP_SEQ_ENUM_39
# define BOOST_PP_SEQ_ENUM_41(x) x, BOOST_PP_SEQ_ENUM_40
# define BOOST_PP_SEQ_ENUM_42(x) x, BOOST_PP_SEQ_ENUM_41
# define BOOST_PP_SEQ_ENUM_43(x) x, BOOST_PP_SEQ_ENUM_42
# define BOOST_PP_SEQ_ENUM_44(x) x, BOOST_PP_SEQ_ENUM_43
# define BOOST_PP_SEQ_ENUM_45(x) x, BOOST_PP_SEQ_ENUM_44
# define BOOST_PP_SEQ_ENUM_46(x) x, BOOST_PP_SEQ_ENUM_45
# define BOOST_PP_SEQ_ENUM_47(x) x, BOOST_PP_SEQ_ENUM_46
# define BOOST_PP_SEQ_ENUM_48(x) x, BOOST_PP_SEQ_ENUM_47
# define BOOST_PP_SEQ_ENUM_49(x) x, BOOST_PP_SEQ_ENUM_48
# define BOOST_PP_SEQ_ENUM_50(x) x, BOOST_PP_SEQ_ENUM_49
# define BOOST_PP_SEQ_ENUM_51(x) x, BOOST_PP_SEQ_ENUM_50
# define BOOST_PP_SEQ_ENUM_52(x) x, BOOST_PP_SEQ_ENUM_51
# define BOOST_PP_SEQ_ENUM_53(x) x, BOOST_PP_SEQ_ENUM_52
# define BOOST_PP_SEQ_ENUM_54(x) x, BOOST_PP_SEQ_ENUM_53
# define BOOST_PP_SEQ_ENUM_55(x) x, BOOST_PP_SEQ_ENUM_54
# define BOOST_PP_SEQ_ENUM_56(x) x, BOOST_PP_SEQ_ENUM_55
# define BOOST_PP_SEQ_ENUM_57(x) x, BOOST_PP_SEQ_ENUM_56
# define BOOST_PP_SEQ_ENUM_58(x) x, BOOST_PP_SEQ_ENUM_57
# define BOOST_PP_SEQ_ENUM_59(x) x, BOOST_PP_SEQ_ENUM_58
# define BOOST_PP_SEQ_ENUM_60(x) x, BOOST_PP_SEQ_ENUM_59
# define BOOST_PP_SEQ_ENUM_61(x) x, BOOST_PP_SEQ_ENUM_60
# define BOOST_PP_SEQ_ENUM_62(x) x, BOOST_PP_SEQ_ENUM_61
# define BOOST_PP_SEQ_ENUM_63(x) x, BOOST_PP_SEQ_ENUM_62
# define BOOST_PP_SEQ_ENUM_64(x) x, BOOST_PP_SEQ_ENUM_63
# define BOOST_PP_SEQ_ENUM_65(x) x, BOOST_PP_SEQ_ENUM_64
# define BOOST_PP_SEQ_ENUM_66(x) x, BOOST_PP_SEQ_ENUM_65
# define BOOST_PP_SEQ_ENUM_67(x) x, BOOST_PP_SEQ_ENUM_66
# define BOOST_PP_SEQ_ENUM_68(x) x, BOOST_PP_SEQ_ENUM_67
# define BOOST_PP_SEQ_ENUM_69(x) x, BOOST_PP_SEQ_ENUM_68
# define BOOST_PP_SEQ_ENUM_70(x) x, BOOST_PP_SEQ_ENUM_69
# define BOOST_PP_SEQ_ENUM_71(x) x, BOOST_PP_SEQ_ENUM_70
# define BOOST_PP_SEQ_ENUM_72(x) x, BOOST_PP_SEQ_ENUM_71
# define BOOST_PP_SEQ_ENUM_73(x) x, BOOST_PP_SEQ_ENUM_72
# define BOOST_PP_SEQ_ENUM_74(x) x, BOOST_PP_SEQ_ENUM_73
# define BOOST_PP_SEQ_ENUM_75(x) x, BOOST_PP_SEQ_ENUM_74
# define BOOST_PP_SEQ_ENUM_76(x) x, BOOST_PP_SEQ_ENUM_75
# define BOOST_PP_SEQ_ENUM_77(x) x, BOOST_PP_SEQ_ENUM_76
# define BOOST_PP_SEQ_ENUM_78(x) x, BOOST_PP_SEQ_ENUM_77
# define BOOST_PP_SEQ_ENUM_79(x) x, BOOST_PP_SEQ_ENUM_78
# define BOOST_PP_SEQ_ENUM_80(x) x, BOOST_PP_SEQ_ENUM_79
# define BOOST_PP_SEQ_ENUM_81(x) x, BOOST_PP_SEQ_ENUM_80
# define BOOST_PP_SEQ_ENUM_82(x) x, BOOST_PP_SEQ_ENUM_81
# define BOOST_PP_SEQ_ENUM_83(x) x, BOOST_PP_SEQ_ENUM_82
# define BOOST_PP_SEQ_ENUM_84(x) x, BOOST_PP_SEQ_ENUM_83
# define BOOST_PP_SEQ_ENUM_85(x) x, BOOST_PP_SEQ_ENUM_84
# define BOOST_PP_SEQ_ENUM_86(x) x, BOOST_PP_SEQ_ENUM_85
# define BOOST_PP_SEQ_ENUM_87(x) x, BOOST_PP_SEQ_ENUM_86
# define BOOST_PP_SEQ_ENUM_88(x) x, BOOST_PP_SEQ_ENUM_87
# define BOOST_PP_SEQ_ENUM_89(x) x, BOOST_PP_SEQ_ENUM_88
# define BOOST_PP_SEQ_ENUM_90(x) x, BOOST_PP_SEQ_ENUM_89
# define BOOST_PP_SEQ_ENUM_91(x) x, BOOST_PP_SEQ_ENUM_90
# define BOOST_PP_SEQ_ENUM_92(x) x, BOOST_PP_SEQ_ENUM_91
# define BOOST_PP_SEQ_ENUM_93(x) x, BOOST_PP_SEQ_ENUM_92
# define BOOST_PP_SEQ_ENUM_94(x) x, BOOST_PP_SEQ_ENUM_93
# define BOOST_PP_SEQ_ENUM_95(x) x, BOOST_PP_SEQ_ENUM_94
# define BOOST_PP_SEQ_ENUM_96(x) x, BOOST_PP_SEQ_ENUM_95
# define BOOST_PP_SEQ_ENUM_97(x) x, BOOST_PP_SEQ_ENUM_96
# define BOOST_PP_SEQ_ENUM_98(x) x, BOOST_PP_SEQ_ENUM_97
# define BOOST_PP_SEQ_ENUM_99(x) x, BOOST_PP_SEQ_ENUM_98
# define BOOST_PP_SEQ_ENUM_100(x) x, BOOST_PP_SEQ_ENUM_99
# define BOOST_PP_SEQ_ENUM_101(x) x, BOOST_PP_SEQ_ENUM_100
# define BOOST_PP_SEQ_ENUM_102(x) x, BOOST_PP_SEQ_ENUM_101
# define BOOST_PP_SEQ_ENUM_103(x) x, BOOST_PP_SEQ_ENUM_102
# define BOOST_PP_SEQ_ENUM_104(x) x, BOOST_PP_SEQ_ENUM_103
# define BOOST_PP_SEQ_ENUM_105(x) x, BOOST_PP_SEQ_ENUM_104
# define BOOST_PP_SEQ_ENUM_106(x) x, BOOST_PP_SEQ_ENUM_105
# define BOOST_PP_SEQ_ENUM_107(x) x, BOOST_PP_SEQ_ENUM_106
# define BOOST_PP_SEQ_ENUM_108(x) x, BOOST_PP_SEQ_ENUM_107
# define BOOST_PP_SEQ_ENUM_109(x) x, BOOST_PP_SEQ_ENUM_108
# define BOOST_PP_SEQ_ENUM_110(x) x, BOOST_PP_SEQ_ENUM_109
# define BOOST_PP_SEQ_ENUM_111(x) x, BOOST_PP_SEQ_ENUM_110
# define BOOST_PP_SEQ_ENUM_112(x) x, BOOST_PP_SEQ_ENUM_111
# define BOOST_PP_SEQ_ENUM_113(x) x, BOOST_PP_SEQ_ENUM_112
# define BOOST_PP_SEQ_ENUM_114(x) x, BOOST_PP_SEQ_ENUM_113
# define BOOST_PP_SEQ_ENUM_115(x) x, BOOST_PP_SEQ_ENUM_114
# define BOOST_PP_SEQ_ENUM_116(x) x, BOOST_PP_SEQ_ENUM_115
# define BOOST_PP_SEQ_ENUM_117(x) x, BOOST_PP_SEQ_ENUM_116
# define BOOST_PP_SEQ_ENUM_118(x) x, BOOST_PP_SEQ_ENUM_117
# define BOOST_PP_SEQ_ENUM_119(x) x, BOOST_PP_SEQ_ENUM_118
# define BOOST_PP_SEQ_ENUM_120(x) x, BOOST_PP_SEQ_ENUM_119
# define BOOST_PP_SEQ_ENUM_121(x) x, BOOST_PP_SEQ_ENUM_120
# define BOOST_PP_SEQ_ENUM_122(x) x, BOOST_PP_SEQ_ENUM_121
# define BOOST_PP_SEQ_ENUM_123(x) x, BOOST_PP_SEQ_ENUM_122
# define BOOST_PP_SEQ_ENUM_124(x) x, BOOST_PP_SEQ_ENUM_123
# define BOOST_PP_SEQ_ENUM_125(x) x, BOOST_PP_SEQ_ENUM_124
# define BOOST_PP_SEQ_ENUM_126(x) x, BOOST_PP_SEQ_ENUM_125
# define BOOST_PP_SEQ_ENUM_127(x) x, BOOST_PP_SEQ_ENUM_126
# define BOOST_PP_SEQ_ENUM_128(x) x, BOOST_PP_SEQ_ENUM_127
# define BOOST_PP_SEQ_ENUM_129(x) x, BOOST_PP_SEQ_ENUM_128
# define BOOST_PP_SEQ_ENUM_130(x) x, BOOST_PP_SEQ_ENUM_129
# define BOOST_PP_SEQ_ENUM_131(x) x, BOOST_PP_SEQ_ENUM_130
# define BOOST_PP_SEQ_ENUM_132(x) x, BOOST_PP_SEQ_ENUM_131
# define BOOST_PP_SEQ_ENUM_133(x) x, BOOST_PP_SEQ_ENUM_132
# define BOOST_PP_SEQ_ENUM_134(x) x, BOOST_PP_SEQ_ENUM_133
# define BOOST_PP_SEQ_ENUM_135(x) x, BOOST_PP_SEQ_ENUM_134
# define BOOST_PP_SEQ_ENUM_136(x) x, BOOST_PP_SEQ_ENUM_135
# define BOOST_PP_SEQ_ENUM_137(x) x, BOOST_PP_SEQ_ENUM_136
# define BOOST_PP_SEQ_ENUM_138(x) x, BOOST_PP_SEQ_ENUM_137
# define BOOST_PP_SEQ_ENUM_139(x) x, BOOST_PP_SEQ_ENUM_138
# define BOOST_PP_SEQ_ENUM_140(x) x, BOOST_PP_SEQ_ENUM_139
# define BOOST_PP_SEQ_ENUM_141(x) x, BOOST_PP_SEQ_ENUM_140
# define BOOST_PP_SEQ_ENUM_142(x) x, BOOST_PP_SEQ_ENUM_141
# define BOOST_PP_SEQ_ENUM_143(x) x, BOOST_PP_SEQ_ENUM_142
# define BOOST_PP_SEQ_ENUM_144(x) x, BOOST_PP_SEQ_ENUM_143
# define BOOST_PP_SEQ_ENUM_145(x) x, BOOST_PP_SEQ_ENUM_144
# define BOOST_PP_SEQ_ENUM_146(x) x, BOOST_PP_SEQ_ENUM_145
# define BOOST_PP_SEQ_ENUM_147(x) x, BOOST_PP_SEQ_ENUM_146
# define BOOST_PP_SEQ_ENUM_148(x) x, BOOST_PP_SEQ_ENUM_147
# define BOOST_PP_SEQ_ENUM_149(x) x, BOOST_PP_SEQ_ENUM_148
# define BOOST_PP_SEQ_ENUM_150(x) x, BOOST_PP_SEQ_ENUM_149
# define BOOST_PP_SEQ_ENUM_151(x) x, BOOST_PP_SEQ_ENUM_150
# define BOOST_PP_SEQ_ENUM_152(x) x, BOOST_PP_SEQ_ENUM_151
# define BOOST_PP_SEQ_ENUM_153(x) x, BOOST_PP_SEQ_ENUM_152
# define BOOST_PP_SEQ_ENUM_154(x) x, BOOST_PP_SEQ_ENUM_153
# define BOOST_PP_SEQ_ENUM_155(x) x, BOOST_PP_SEQ_ENUM_154
# define BOOST_PP_SEQ_ENUM_156(x) x, BOOST_PP_SEQ_ENUM_155
# define BOOST_PP_SEQ_ENUM_157(x) x, BOOST_PP_SEQ_ENUM_156
# define BOOST_PP_SEQ_ENUM_158(x) x, BOOST_PP_SEQ_ENUM_157
# define BOOST_PP_SEQ_ENUM_159(x) x, BOOST_PP_SEQ_ENUM_158
# define BOOST_PP_SEQ_ENUM_160(x) x, BOOST_PP_SEQ_ENUM_159
# define BOOST_PP_SEQ_ENUM_161(x) x, BOOST_PP_SEQ_ENUM_160
# define BOOST_PP_SEQ_ENUM_162(x) x, BOOST_PP_SEQ_ENUM_161
# define BOOST_PP_SEQ_ENUM_163(x) x, BOOST_PP_SEQ_ENUM_162
# define BOOST_PP_SEQ_ENUM_164(x) x, BOOST_PP_SEQ_ENUM_163
# define BOOST_PP_SEQ_ENUM_165(x) x, BOOST_PP_SEQ_ENUM_164
# define BOOST_PP_SEQ_ENUM_166(x) x, BOOST_PP_SEQ_ENUM_165
# define BOOST_PP_SEQ_ENUM_167(x) x, BOOST_PP_SEQ_ENUM_166
# define BOOST_PP_SEQ_ENUM_168(x) x, BOOST_PP_SEQ_ENUM_167
# define BOOST_PP_SEQ_ENUM_169(x) x, BOOST_PP_SEQ_ENUM_168
# define BOOST_PP_SEQ_ENUM_170(x) x, BOOST_PP_SEQ_ENUM_169
# define BOOST_PP_SEQ_ENUM_171(x) x, BOOST_PP_SEQ_ENUM_170
# define BOOST_PP_SEQ_ENUM_172(x) x, BOOST_PP_SEQ_ENUM_171
# define BOOST_PP_SEQ_ENUM_173(x) x, BOOST_PP_SEQ_ENUM_172
# define BOOST_PP_SEQ_ENUM_174(x) x, BOOST_PP_SEQ_ENUM_173
# define BOOST_PP_SEQ_ENUM_175(x) x, BOOST_PP_SEQ_ENUM_174
# define BOOST_PP_SEQ_ENUM_176(x) x, BOOST_PP_SEQ_ENUM_175
# define BOOST_PP_SEQ_ENUM_177(x) x, BOOST_PP_SEQ_ENUM_176
# define BOOST_PP_SEQ_ENUM_178(x) x, BOOST_PP_SEQ_ENUM_177
# define BOOST_PP_SEQ_ENUM_179(x) x, BOOST_PP_SEQ_ENUM_178
# define BOOST_PP_SEQ_ENUM_180(x) x, BOOST_PP_SEQ_ENUM_179
# define BOOST_PP_SEQ_ENUM_181(x) x, BOOST_PP_SEQ_ENUM_180
# define BOOST_PP_SEQ_ENUM_182(x) x, BOOST_PP_SEQ_ENUM_181
# define BOOST_PP_SEQ_ENUM_183(x) x, BOOST_PP_SEQ_ENUM_182
# define BOOST_PP_SEQ_ENUM_184(x) x, BOOST_PP_SEQ_ENUM_183
# define BOOST_PP_SEQ_ENUM_185(x) x, BOOST_PP_SEQ_ENUM_184
# define BOOST_PP_SEQ_ENUM_186(x) x, BOOST_PP_SEQ_ENUM_185
# define BOOST_PP_SEQ_ENUM_187(x) x, BOOST_PP_SEQ_ENUM_186
# define BOOST_PP_SEQ_ENUM_188(x) x, BOOST_PP_SEQ_ENUM_187
# define BOOST_PP_SEQ_ENUM_189(x) x, BOOST_PP_SEQ_ENUM_188
# define BOOST_PP_SEQ_ENUM_190(x) x, BOOST_PP_SEQ_ENUM_189
# define BOOST_PP_SEQ_ENUM_191(x) x, BOOST_PP_SEQ_ENUM_190
# define BOOST_PP_SEQ_ENUM_192(x) x, BOOST_PP_SEQ_ENUM_191
# define BOOST_PP_SEQ_ENUM_193(x) x, BOOST_PP_SEQ_ENUM_192
# define BOOST_PP_SEQ_ENUM_194(x) x, BOOST_PP_SEQ_ENUM_193
# define BOOST_PP_SEQ_ENUM_195(x) x, BOOST_PP_SEQ_ENUM_194
# define BOOST_PP_SEQ_ENUM_196(x) x, BOOST_PP_SEQ_ENUM_195
# define BOOST_PP_SEQ_ENUM_197(x) x, BOOST_PP_SEQ_ENUM_196
# define BOOST_PP_SEQ_ENUM_198(x) x, BOOST_PP_SEQ_ENUM_197
# define BOOST_PP_SEQ_ENUM_199(x) x, BOOST_PP_SEQ_ENUM_198
# define BOOST_PP_SEQ_ENUM_200(x) x, BOOST_PP_SEQ_ENUM_199
# define BOOST_PP_SEQ_ENUM_201(x) x, BOOST_PP_SEQ_ENUM_200
# define BOOST_PP_SEQ_ENUM_202(x) x, BOOST_PP_SEQ_ENUM_201
# define BOOST_PP_SEQ_ENUM_203(x) x, BOOST_PP_SEQ_ENUM_202
# define BOOST_PP_SEQ_ENUM_204(x) x, BOOST_PP_SEQ_ENUM_203
# define BOOST_PP_SEQ_ENUM_205(x) x, BOOST_PP_SEQ_ENUM_204
# define BOOST_PP_SEQ_ENUM_206(x) x, BOOST_PP_SEQ_ENUM_205
# define BOOST_PP_SEQ_ENUM_207(x) x, BOOST_PP_SEQ_ENUM_206
# define BOOST_PP_SEQ_ENUM_208(x) x, BOOST_PP_SEQ_ENUM_207
# define BOOST_PP_SEQ_ENUM_209(x) x, BOOST_PP_SEQ_ENUM_208
# define BOOST_PP_SEQ_ENUM_210(x) x, BOOST_PP_SEQ_ENUM_209
# define BOOST_PP_SEQ_ENUM_211(x) x, BOOST_PP_SEQ_ENUM_210
# define BOOST_PP_SEQ_ENUM_212(x) x, BOOST_PP_SEQ_ENUM_211
# define BOOST_PP_SEQ_ENUM_213(x) x, BOOST_PP_SEQ_ENUM_212
# define BOOST_PP_SEQ_ENUM_214(x) x, BOOST_PP_SEQ_ENUM_213
# define BOOST_PP_SEQ_ENUM_215(x) x, BOOST_PP_SEQ_ENUM_214
# define BOOST_PP_SEQ_ENUM_216(x) x, BOOST_PP_SEQ_ENUM_215
# define BOOST_PP_SEQ_ENUM_217(x) x, BOOST_PP_SEQ_ENUM_216
# define BOOST_PP_SEQ_ENUM_218(x) x, BOOST_PP_SEQ_ENUM_217
# define BOOST_PP_SEQ_ENUM_219(x) x, BOOST_PP_SEQ_ENUM_218
# define BOOST_PP_SEQ_ENUM_220(x) x, BOOST_PP_SEQ_ENUM_219
# define BOOST_PP_SEQ_ENUM_221(x) x, BOOST_PP_SEQ_ENUM_220
# define BOOST_PP_SEQ_ENUM_222(x) x, BOOST_PP_SEQ_ENUM_221
# define BOOST_PP_SEQ_ENUM_223(x) x, BOOST_PP_SEQ_ENUM_222
# define BOOST_PP_SEQ_ENUM_224(x) x, BOOST_PP_SEQ_ENUM_223
# define BOOST_PP_SEQ_ENUM_225(x) x, BOOST_PP_SEQ_ENUM_224
# define BOOST_PP_SEQ_ENUM_226(x) x, BOOST_PP_SEQ_ENUM_225
# define BOOST_PP_SEQ_ENUM_227(x) x, BOOST_PP_SEQ_ENUM_226
# define BOOST_PP_SEQ_ENUM_228(x) x, BOOST_PP_SEQ_ENUM_227
# define BOOST_PP_SEQ_ENUM_229(x) x, BOOST_PP_SEQ_ENUM_228
# define BOOST_PP_SEQ_ENUM_230(x) x, BOOST_PP_SEQ_ENUM_229
# define BOOST_PP_SEQ_ENUM_231(x) x, BOOST_PP_SEQ_ENUM_230
# define BOOST_PP_SEQ_ENUM_232(x) x, BOOST_PP_SEQ_ENUM_231
# define BOOST_PP_SEQ_ENUM_233(x) x, BOOST_PP_SEQ_ENUM_232
# define BOOST_PP_SEQ_ENUM_234(x) x, BOOST_PP_SEQ_ENUM_233
# define BOOST_PP_SEQ_ENUM_235(x) x, BOOST_PP_SEQ_ENUM_234
# define BOOST_PP_SEQ_ENUM_236(x) x, BOOST_PP_SEQ_ENUM_235
# define BOOST_PP_SEQ_ENUM_237(x) x, BOOST_PP_SEQ_ENUM_236
# define BOOST_PP_SEQ_ENUM_238(x) x, BOOST_PP_SEQ_ENUM_237
# define BOOST_PP_SEQ_ENUM_239(x) x, BOOST_PP_SEQ_ENUM_238
# define BOOST_PP_SEQ_ENUM_240(x) x, BOOST_PP_SEQ_ENUM_239
# define BOOST_PP_SEQ_ENUM_241(x) x, BOOST_PP_SEQ_ENUM_240
# define BOOST_PP_SEQ_ENUM_242(x) x, BOOST_PP_SEQ_ENUM_241
# define BOOST_PP_SEQ_ENUM_243(x) x, BOOST_PP_SEQ_ENUM_242
# define BOOST_PP_SEQ_ENUM_244(x) x, BOOST_PP_SEQ_ENUM_243
# define BOOST_PP_SEQ_ENUM_245(x) x, BOOST_PP_SEQ_ENUM_244
# define BOOST_PP_SEQ_ENUM_246(x) x, BOOST_PP_SEQ_ENUM_245
# define BOOST_PP_SEQ_ENUM_247(x) x, BOOST_PP_SEQ_ENUM_246
# define BOOST_PP_SEQ_ENUM_248(x) x, BOOST_PP_SEQ_ENUM_247
# define BOOST_PP_SEQ_ENUM_249(x) x, BOOST_PP_SEQ_ENUM_248
# define BOOST_PP_SEQ_ENUM_250(x) x, BOOST_PP_SEQ_ENUM_249
# define BOOST_PP_SEQ_ENUM_251(x) x, BOOST_PP_SEQ_ENUM_250
# define BOOST_PP_SEQ_ENUM_252(x) x, BOOST_PP_SEQ_ENUM_251
# define BOOST_PP_SEQ_ENUM_253(x) x, BOOST_PP_SEQ_ENUM_252
# define BOOST_PP_SEQ_ENUM_254(x) x, BOOST_PP_SEQ_ENUM_253
# define BOOST_PP_SEQ_ENUM_255(x) x, BOOST_PP_SEQ_ENUM_254
# define BOOST_PP_SEQ_ENUM_256(x) x, BOOST_PP_SEQ_ENUM_255
#
# endif
@@ -0,0 +1,443 @@
//---------------------------------------------------------------------------//
// Copyright (c) 2015 Jakub Szuppe <j.szuppe@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_ALGORITHM_DETAIL_FIND_EXTREMA_WITH_REDUCE_HPP
#define BOOST_COMPUTE_ALGORITHM_DETAIL_FIND_EXTREMA_WITH_REDUCE_HPP
#include <algorithm>
#include <boost/compute/types.hpp>
#include <boost/compute/command_queue.hpp>
#include <boost/compute/algorithm/copy.hpp>
#include <boost/compute/allocator/pinned_allocator.hpp>
#include <boost/compute/container/vector.hpp>
#include <boost/compute/detail/meta_kernel.hpp>
#include <boost/compute/detail/iterator_range_size.hpp>
#include <boost/compute/detail/parameter_cache.hpp>
#include <boost/compute/memory/local_buffer.hpp>
#include <boost/compute/type_traits/type_name.hpp>
#include <boost/compute/utility/program_cache.hpp>
namespace boost {
namespace compute {
namespace detail {
template<class InputIterator>
bool find_extrema_with_reduce_requirements_met(InputIterator first,
InputIterator last,
command_queue &queue)
{
typedef typename std::iterator_traits<InputIterator>::value_type input_type;
const device &device = queue.get_device();
// device must have dedicated local memory storage
// otherwise reduction would be highly inefficient
if(device.get_info<CL_DEVICE_LOCAL_MEM_TYPE>() != CL_LOCAL)
{
return false;
}
const size_t max_work_group_size = device.get_info<CL_DEVICE_MAX_WORK_GROUP_SIZE>();
// local memory size in bytes (per compute unit)
const size_t local_mem_size = device.get_info<CL_DEVICE_LOCAL_MEM_SIZE>();
std::string cache_key = std::string("__boost_find_extrema_reduce_")
+ type_name<input_type>();
// load parameters
boost::shared_ptr<parameter_cache> parameters =
detail::parameter_cache::get_global_cache(device);
// Get preferred work group size
size_t work_group_size = parameters->get(cache_key, "wgsize", 256);
work_group_size = (std::min)(max_work_group_size, work_group_size);
// local memory size needed to perform parallel reduction
size_t required_local_mem_size = 0;
// indices size
required_local_mem_size += sizeof(uint_) * work_group_size;
// values size
required_local_mem_size += sizeof(input_type) * work_group_size;
// at least 4 work groups per compute unit otherwise reduction
// would be highly inefficient
return ((required_local_mem_size * 4) <= local_mem_size);
}
/// \internal_
/// Algorithm finds the first extremum in given range, i.e., with the lowest
/// index.
///
/// If \p use_input_idx is false, it's assumed that input data is ordered by
/// increasing index and \p input_idx is not used in the algorithm.
template<class InputIterator, class ResultIterator, class Compare>
inline void find_extrema_with_reduce(InputIterator input,
vector<uint_>::iterator input_idx,
size_t count,
ResultIterator result,
vector<uint_>::iterator result_idx,
size_t work_groups_no,
size_t work_group_size,
Compare compare,
const bool find_minimum,
const bool use_input_idx,
command_queue &queue)
{
typedef typename std::iterator_traits<InputIterator>::value_type input_type;
const context &context = queue.get_context();
meta_kernel k("find_extrema_reduce");
size_t count_arg = k.add_arg<uint_>("count");
size_t block_arg = k.add_arg<input_type *>(memory_object::local_memory, "block");
size_t block_idx_arg = k.add_arg<uint_ *>(memory_object::local_memory, "block_idx");
k <<
// Work item global id
k.decl<const uint_>("gid") << " = get_global_id(0);\n" <<
// Index of element that will be read from input buffer
k.decl<uint_>("idx") << " = gid;\n" <<
k.decl<input_type>("acc") << ";\n" <<
k.decl<uint_>("acc_idx") << ";\n" <<
"if(gid < count) {\n" <<
// Real index of currently best element
"#ifdef BOOST_COMPUTE_USE_INPUT_IDX\n" <<
k.var<uint_>("acc_idx") << " = " << input_idx[k.var<uint_>("idx")] << ";\n" <<
"#else\n" <<
k.var<uint_>("acc_idx") << " = idx;\n" <<
"#endif\n" <<
// Init accumulator with first[get_global_id(0)]
"acc = " << input[k.var<uint_>("idx")] << ";\n" <<
"idx += get_global_size(0);\n" <<
"}\n" <<
k.decl<bool>("compare_result") << ";\n" <<
k.decl<bool>("equal") << ";\n\n" <<
"while( idx < count ){\n" <<
// Next element
k.decl<input_type>("next") << " = " << input[k.var<uint_>("idx")] << ";\n" <<
"#ifdef BOOST_COMPUTE_USE_INPUT_IDX\n" <<
k.decl<uint_>("next_idx") << " = " << input_idx[k.var<uint_>("idx")] << ";\n" <<
"#endif\n" <<
// Comparison between currently best element (acc) and next element
"#ifdef BOOST_COMPUTE_FIND_MAXIMUM\n" <<
"compare_result = " << compare(k.var<input_type>("next"),
k.var<input_type>("acc")) << ";\n" <<
"# ifdef BOOST_COMPUTE_USE_INPUT_IDX\n" <<
"equal = !compare_result && !" <<
compare(k.var<input_type>("acc"),
k.var<input_type>("next")) << ";\n" <<
"# endif\n" <<
"#else\n" <<
"compare_result = " << compare(k.var<input_type>("acc"),
k.var<input_type>("next")) << ";\n" <<
"# ifdef BOOST_COMPUTE_USE_INPUT_IDX\n" <<
"equal = !compare_result && !" <<
compare(k.var<input_type>("next"),
k.var<input_type>("acc")) << ";\n" <<
"# endif\n" <<
"#endif\n" <<
// save the winner
"acc = compare_result ? acc : next;\n" <<
"#ifdef BOOST_COMPUTE_USE_INPUT_IDX\n" <<
"acc_idx = compare_result ? " <<
"acc_idx : " <<
"(equal ? min(acc_idx, next_idx) : next_idx);\n" <<
"#else\n" <<
"acc_idx = compare_result ? acc_idx : idx;\n" <<
"#endif\n" <<
"idx += get_global_size(0);\n" <<
"}\n\n" <<
// Work item local id
k.decl<const uint_>("lid") << " = get_local_id(0);\n" <<
"block[lid] = acc;\n" <<
"block_idx[lid] = acc_idx;\n" <<
"barrier(CLK_LOCAL_MEM_FENCE);\n" <<
k.decl<uint_>("group_offset") <<
" = count - (get_local_size(0) * get_group_id(0));\n\n";
k <<
"#pragma unroll\n"
"for(" << k.decl<uint_>("offset") << " = " << uint_(work_group_size) << " / 2; offset > 0; " <<
"offset = offset / 2) {\n" <<
"if((lid < offset) && ((lid + offset) < group_offset)) { \n" <<
k.decl<input_type>("mine") << " = block[lid];\n" <<
k.decl<input_type>("other") << " = block[lid+offset];\n" <<
"#ifdef BOOST_COMPUTE_FIND_MAXIMUM\n" <<
"compare_result = " << compare(k.var<input_type>("other"),
k.var<input_type>("mine")) << ";\n" <<
"equal = !compare_result && !" <<
compare(k.var<input_type>("mine"),
k.var<input_type>("other")) << ";\n" <<
"#else\n" <<
"compare_result = " << compare(k.var<input_type>("mine"),
k.var<input_type>("other")) << ";\n" <<
"equal = !compare_result && !" <<
compare(k.var<input_type>("other"),
k.var<input_type>("mine")) << ";\n" <<
"#endif\n" <<
"block[lid] = compare_result ? mine : other;\n" <<
k.decl<uint_>("mine_idx") << " = block_idx[lid];\n" <<
k.decl<uint_>("other_idx") << " = block_idx[lid+offset];\n" <<
"block_idx[lid] = compare_result ? " <<
"mine_idx : " <<
"(equal ? min(mine_idx, other_idx) : other_idx);\n" <<
"}\n"
"barrier(CLK_LOCAL_MEM_FENCE);\n" <<
"}\n\n" <<
// write block result to global output
"if(lid == 0){\n" <<
result[k.var<uint_>("get_group_id(0)")] << " = block[0];\n" <<
result_idx[k.var<uint_>("get_group_id(0)")] << " = block_idx[0];\n" <<
"}";
std::string options;
if(!find_minimum){
options = "-DBOOST_COMPUTE_FIND_MAXIMUM";
}
if(use_input_idx){
options += " -DBOOST_COMPUTE_USE_INPUT_IDX";
}
kernel kernel = k.compile(context, options);
kernel.set_arg(count_arg, static_cast<uint_>(count));
kernel.set_arg(block_arg, local_buffer<input_type>(work_group_size));
kernel.set_arg(block_idx_arg, local_buffer<uint_>(work_group_size));
queue.enqueue_1d_range_kernel(kernel,
0,
work_groups_no * work_group_size,
work_group_size);
}
template<class InputIterator, class ResultIterator, class Compare>
inline void find_extrema_with_reduce(InputIterator input,
size_t count,
ResultIterator result,
vector<uint_>::iterator result_idx,
size_t work_groups_no,
size_t work_group_size,
Compare compare,
const bool find_minimum,
command_queue &queue)
{
// dummy will not be used
buffer_iterator<uint_> dummy = result_idx;
return find_extrema_with_reduce(
input, dummy, count, result, result_idx, work_groups_no,
work_group_size, compare, find_minimum, false, queue
);
}
template<class InputIterator, class Compare>
InputIterator find_extrema_with_reduce(InputIterator first,
InputIterator last,
Compare compare,
const bool find_minimum,
command_queue &queue)
{
typedef typename std::iterator_traits<InputIterator>::difference_type difference_type;
typedef typename std::iterator_traits<InputIterator>::value_type input_type;
const context &context = queue.get_context();
const device &device = queue.get_device();
// Getting information about used queue and device
const size_t compute_units_no = device.get_info<CL_DEVICE_MAX_COMPUTE_UNITS>();
const size_t max_work_group_size = device.get_info<CL_DEVICE_MAX_WORK_GROUP_SIZE>();
const size_t count = detail::iterator_range_size(first, last);
std::string cache_key = std::string("__boost_find_extrema_with_reduce_")
+ type_name<input_type>();
// load parameters
boost::shared_ptr<parameter_cache> parameters =
detail::parameter_cache::get_global_cache(device);
// get preferred work group size and preferred number
// of work groups per compute unit
size_t work_group_size = parameters->get(cache_key, "wgsize", 256);
size_t work_groups_per_cu = parameters->get(cache_key, "wgpcu", 100);
// calculate work group size and number of work groups
work_group_size = (std::min)(max_work_group_size, work_group_size);
size_t work_groups_no = compute_units_no * work_groups_per_cu;
work_groups_no = (std::min)(
work_groups_no,
static_cast<size_t>(std::ceil(float(count) / work_group_size))
);
// phase I: finding candidates for extremum
// device buffors for extremum candidates and their indices
// each work-group computes its candidate
vector<input_type> candidates(work_groups_no, context);
vector<uint_> candidates_idx(work_groups_no, context);
// finding candidates for first extremum and their indices
find_extrema_with_reduce(
first, count, candidates.begin(), candidates_idx.begin(),
work_groups_no, work_group_size, compare, find_minimum, queue
);
// phase II: finding extremum from among the candidates
// zero-copy buffers for final result (value and index)
vector<input_type, ::boost::compute::pinned_allocator<input_type> >
result(1, context);
vector<uint_, ::boost::compute::pinned_allocator<uint_> >
result_idx(1, context);
// get extremum from among the candidates
find_extrema_with_reduce(
candidates.begin(), candidates_idx.begin(), work_groups_no, result.begin(),
result_idx.begin(), 1, work_group_size, compare, find_minimum, true, queue
);
// mapping extremum index to host
uint_* result_idx_host_ptr =
static_cast<uint_*>(
queue.enqueue_map_buffer(
result_idx.get_buffer(), command_queue::map_read,
0, sizeof(uint_)
)
);
return first + static_cast<difference_type>(*result_idx_host_ptr);
}
template<class InputIterator>
InputIterator find_extrema_with_reduce(InputIterator first,
InputIterator last,
::boost::compute::less<
typename std::iterator_traits<
InputIterator
>::value_type
>
compare,
const bool find_minimum,
command_queue &queue)
{
typedef typename std::iterator_traits<InputIterator>::difference_type difference_type;
typedef typename std::iterator_traits<InputIterator>::value_type input_type;
const context &context = queue.get_context();
const device &device = queue.get_device();
// Getting information about used queue and device
const size_t compute_units_no = device.get_info<CL_DEVICE_MAX_COMPUTE_UNITS>();
const size_t max_work_group_size = device.get_info<CL_DEVICE_MAX_WORK_GROUP_SIZE>();
const size_t count = detail::iterator_range_size(first, last);
std::string cache_key = std::string("__boost_find_extrema_with_reduce_")
+ type_name<input_type>();
// load parameters
boost::shared_ptr<parameter_cache> parameters =
detail::parameter_cache::get_global_cache(device);
// get preferred work group size and preferred number
// of work groups per compute unit
size_t work_group_size = parameters->get(cache_key, "wgsize", 256);
size_t work_groups_per_cu = parameters->get(cache_key, "wgpcu", 64);
// calculate work group size and number of work groups
work_group_size = (std::min)(max_work_group_size, work_group_size);
size_t work_groups_no = compute_units_no * work_groups_per_cu;
work_groups_no = (std::min)(
work_groups_no,
static_cast<size_t>(std::ceil(float(count) / work_group_size))
);
// phase I: finding candidates for extremum
// device buffors for extremum candidates and their indices
// each work-group computes its candidate
// zero-copy buffers are used to eliminate copying data back to host
vector<input_type, ::boost::compute::pinned_allocator<input_type> >
candidates(work_groups_no, context);
vector<uint_, ::boost::compute::pinned_allocator <uint_> >
candidates_idx(work_groups_no, context);
// finding candidates for first extremum and their indices
find_extrema_with_reduce(
first, count, candidates.begin(), candidates_idx.begin(),
work_groups_no, work_group_size, compare, find_minimum, queue
);
// phase II: finding extremum from among the candidates
// mapping candidates and their indices to host
input_type* candidates_host_ptr =
static_cast<input_type*>(
queue.enqueue_map_buffer(
candidates.get_buffer(), command_queue::map_read,
0, work_groups_no * sizeof(input_type)
)
);
uint_* candidates_idx_host_ptr =
static_cast<uint_*>(
queue.enqueue_map_buffer(
candidates_idx.get_buffer(), command_queue::map_read,
0, work_groups_no * sizeof(uint_)
)
);
input_type* i = candidates_host_ptr;
uint_* idx = candidates_idx_host_ptr;
uint_* extremum_idx = idx;
input_type extremum = *candidates_host_ptr;
i++; idx++;
// find extremum (serial) from among the candidates on host
if(!find_minimum) {
while(idx != (candidates_idx_host_ptr + work_groups_no)) {
input_type next = *i;
bool compare_result = next > extremum;
bool equal = next == extremum;
extremum = compare_result ? next : extremum;
extremum_idx = compare_result ? idx : extremum_idx;
extremum_idx = equal ? ((*extremum_idx < *idx) ? extremum_idx : idx) : extremum_idx;
idx++, i++;
}
}
else {
while(idx != (candidates_idx_host_ptr + work_groups_no)) {
input_type next = *i;
bool compare_result = next < extremum;
bool equal = next == extremum;
extremum = compare_result ? next : extremum;
extremum_idx = compare_result ? idx : extremum_idx;
extremum_idx = equal ? ((*extremum_idx < *idx) ? extremum_idx : idx) : extremum_idx;
idx++, i++;
}
}
return first + static_cast<difference_type>(*extremum_idx);
}
} // end detail namespace
} // end compute namespace
} // end boost namespace
#endif // BOOST_COMPUTE_ALGORITHM_DETAIL_FIND_EXTREMA_WITH_REDUCE_HPP
@@ -0,0 +1,24 @@
#ifndef BOOST_MPL_FRONT_FWD_HPP_INCLUDED
#define BOOST_MPL_FRONT_FWD_HPP_INCLUDED
// Copyright Aleksey Gurtovoy 2000-2004
//
// Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
//
// See http://www.boost.org/libs/mpl for documentation.
// $Id$
// $Date$
// $Revision$
namespace boost { namespace mpl {
template< typename Tag > struct front_impl;
template< typename Sequence > struct front;
}}
#endif // BOOST_MPL_FRONT_FWD_HPP_INCLUDED
@@ -0,0 +1,57 @@
subroutine genft8(msg,mygrid,bcontest,msgsent,msgbits,itone)
! Encode an FT8 message, producing array itone().
use crc
use packjt
include 'ft8_params.f90'
character*22 msg,msgsent
character*6 mygrid
character*87 cbits
logical bcontest
integer*4 i4Msg6BitWords(12) !72-bit message as 6-bit words
integer*1 msgbits(KK),codeword(3*ND)
integer*1, target:: i1Msg8BitBytes(11)
integer itone(NN)
integer icos7(0:6)
data icos7/2,5,6,0,4,1,3/ !Costas 7x7 tone pattern
call packmsg(msg,i4Msg6BitWords,itype,bcontest) !Pack into 12 6-bit bytes
call unpackmsg(i4Msg6BitWords,msgsent,bcontest,mygrid) !Unpack to get msgsent
i3bit=0 !### temporary ###
write(cbits,1000) i4Msg6BitWords,32*i3bit
1000 format(12b6.6,b8.8)
read(cbits,1001) i1Msg8BitBytes(1:10)
1001 format(10b8)
i1Msg8BitBytes(10)=iand(i1Msg8BitBytes(10),128+64+32)
i1Msg8BitBytes(11)=0
icrc12=crc12(c_loc(i1Msg8BitBytes),11)
! For reference, here's how to check the CRC
! i1Msg8BitBytes(10)=icrc12/256
! i1Msg8BitBytes(11)=iand (icrc12,255)
! checksumok = crc12_check(c_loc (i1Msg8BitBytes), 11)
! if( checksumok ) write(*,*) 'Good checksum'
write(cbits,1003) i4Msg6BitWords,i3bit,icrc12
1003 format(12b6.6,b3.3,b12.12)
read(cbits,1004) msgbits
1004 format(87i1)
call encode174(msgbits,codeword) !Encode the test message
! Message structure: S7 D29 S7 D29 S7
itone(1:7)=icos7
itone(36+1:36+7)=icos7
itone(NN-6:NN)=icos7
k=7
do j=1,ND
i=3*j -2
k=k+1
if(j.eq.30) k=k+7
itone(k)=codeword(i)*4 + codeword(i+1)*2 + codeword(i+2)
enddo
return
end subroutine genft8
@@ -0,0 +1,92 @@
#ifndef BOOST_ARCHIVE_ITERATORS_ISTREAM_ITERATOR_HPP
#define BOOST_ARCHIVE_ITERATORS_ISTREAM_ITERATOR_HPP
// MS compatible compilers support #pragma once
#if defined(_MSC_VER)
# pragma once
#endif
/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8
// istream_iterator.hpp
// (C) Copyright 2002 Robert Ramey - http://www.rrsd.com .
// Use, modification and distribution is subject to the Boost Software
// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
// See http://www.boost.org for updates, documentation, and revision history.
// note: this is a custom version of the standard istream_iterator.
// This is necessary as the standard version doesn't work as expected
// for wchar_t based streams on systems for which wchar_t not a true
// type but rather a synonym for some integer type.
#include <cstddef> // NULL
#include <istream>
#include <boost/iterator/iterator_facade.hpp>
namespace boost {
namespace archive {
namespace iterators {
// given a type, make an input iterator based on a pointer to that type
template<class Elem = char>
class istream_iterator :
public boost::iterator_facade<
istream_iterator<Elem>,
Elem,
std::input_iterator_tag,
Elem
>
{
friend class boost::iterator_core_access;
typedef istream_iterator this_t ;
typedef typename boost::iterator_facade<
istream_iterator<Elem>,
Elem,
std::input_iterator_tag,
Elem
> super_t;
typedef typename std::basic_istream<Elem> istream_type;
bool equal(const this_t & rhs) const {
// note: only works for comparison against end of stream
return m_istream == rhs.m_istream;
}
//Access the value referred to
Elem dereference() const {
return m_istream->peek();
}
void increment(){
if(NULL != m_istream){
m_istream->ignore(1);
}
}
istream_type *m_istream;
Elem m_current_value;
public:
istream_iterator(istream_type & is) :
m_istream(& is)
{
//increment();
}
istream_iterator() :
m_istream(NULL)
{}
istream_iterator(const istream_iterator<Elem> & rhs) :
m_istream(rhs.m_istream),
m_current_value(rhs.m_current_value)
{}
};
} // namespace iterators
} // namespace archive
} // namespace boost
#endif // BOOST_ARCHIVE_ITERATORS_ISTREAM_ITERATOR_HPP
@@ -0,0 +1,3 @@
gcc -c gran.c
gfortran -c -Wall fftw3mod.f90
gfortran -o timefft -Wall timefft.f90 timefft_opts.f90 gran.o libfftw3f-3.dll
@@ -0,0 +1,370 @@
// Copyright Aleksey Gurtovoy 2000-2004
// Copyright David Abrahams 2003-2004
//
// Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
//
// Preprocessed version of "boost/mpl/map/map50.hpp" header
// -- DO NOT modify by hand!
namespace boost { namespace mpl {
template< typename Map>
struct m_at< Map,40 >
{
typedef typename Map::item40 type;
};
template< typename Key, typename T, typename Base >
struct m_item< 41,Key,T,Base >
: m_item_< Key,T,Base >
{
typedef pair< Key,T > item40;
};
template<
typename P0, typename P1, typename P2, typename P3, typename P4
, typename P5, typename P6, typename P7, typename P8, typename P9
, typename P10, typename P11, typename P12, typename P13, typename P14
, typename P15, typename P16, typename P17, typename P18, typename P19
, typename P20, typename P21, typename P22, typename P23, typename P24
, typename P25, typename P26, typename P27, typename P28, typename P29
, typename P30, typename P31, typename P32, typename P33, typename P34
, typename P35, typename P36, typename P37, typename P38, typename P39
, typename P40
>
struct map41
: m_item<
41
, typename P40::first
, typename P40::second
, map40< P0,P1,P2,P3,P4,P5,P6,P7,P8,P9,P10,P11,P12,P13,P14,P15,P16,P17,P18,P19,P20,P21,P22,P23,P24,P25,P26,P27,P28,P29,P30,P31,P32,P33,P34,P35,P36,P37,P38,P39 >
>
{
typedef map41 type;
};
template< typename Map>
struct m_at< Map,41 >
{
typedef typename Map::item41 type;
};
template< typename Key, typename T, typename Base >
struct m_item< 42,Key,T,Base >
: m_item_< Key,T,Base >
{
typedef pair< Key,T > item41;
};
template<
typename P0, typename P1, typename P2, typename P3, typename P4
, typename P5, typename P6, typename P7, typename P8, typename P9
, typename P10, typename P11, typename P12, typename P13, typename P14
, typename P15, typename P16, typename P17, typename P18, typename P19
, typename P20, typename P21, typename P22, typename P23, typename P24
, typename P25, typename P26, typename P27, typename P28, typename P29
, typename P30, typename P31, typename P32, typename P33, typename P34
, typename P35, typename P36, typename P37, typename P38, typename P39
, typename P40, typename P41
>
struct map42
: m_item<
42
, typename P41::first
, typename P41::second
, map41< P0,P1,P2,P3,P4,P5,P6,P7,P8,P9,P10,P11,P12,P13,P14,P15,P16,P17,P18,P19,P20,P21,P22,P23,P24,P25,P26,P27,P28,P29,P30,P31,P32,P33,P34,P35,P36,P37,P38,P39,P40 >
>
{
typedef map42 type;
};
template< typename Map>
struct m_at< Map,42 >
{
typedef typename Map::item42 type;
};
template< typename Key, typename T, typename Base >
struct m_item< 43,Key,T,Base >
: m_item_< Key,T,Base >
{
typedef pair< Key,T > item42;
};
template<
typename P0, typename P1, typename P2, typename P3, typename P4
, typename P5, typename P6, typename P7, typename P8, typename P9
, typename P10, typename P11, typename P12, typename P13, typename P14
, typename P15, typename P16, typename P17, typename P18, typename P19
, typename P20, typename P21, typename P22, typename P23, typename P24
, typename P25, typename P26, typename P27, typename P28, typename P29
, typename P30, typename P31, typename P32, typename P33, typename P34
, typename P35, typename P36, typename P37, typename P38, typename P39
, typename P40, typename P41, typename P42
>
struct map43
: m_item<
43
, typename P42::first
, typename P42::second
, map42< P0,P1,P2,P3,P4,P5,P6,P7,P8,P9,P10,P11,P12,P13,P14,P15,P16,P17,P18,P19,P20,P21,P22,P23,P24,P25,P26,P27,P28,P29,P30,P31,P32,P33,P34,P35,P36,P37,P38,P39,P40,P41 >
>
{
typedef map43 type;
};
template< typename Map>
struct m_at< Map,43 >
{
typedef typename Map::item43 type;
};
template< typename Key, typename T, typename Base >
struct m_item< 44,Key,T,Base >
: m_item_< Key,T,Base >
{
typedef pair< Key,T > item43;
};
template<
typename P0, typename P1, typename P2, typename P3, typename P4
, typename P5, typename P6, typename P7, typename P8, typename P9
, typename P10, typename P11, typename P12, typename P13, typename P14
, typename P15, typename P16, typename P17, typename P18, typename P19
, typename P20, typename P21, typename P22, typename P23, typename P24
, typename P25, typename P26, typename P27, typename P28, typename P29
, typename P30, typename P31, typename P32, typename P33, typename P34
, typename P35, typename P36, typename P37, typename P38, typename P39
, typename P40, typename P41, typename P42, typename P43
>
struct map44
: m_item<
44
, typename P43::first
, typename P43::second
, map43< P0,P1,P2,P3,P4,P5,P6,P7,P8,P9,P10,P11,P12,P13,P14,P15,P16,P17,P18,P19,P20,P21,P22,P23,P24,P25,P26,P27,P28,P29,P30,P31,P32,P33,P34,P35,P36,P37,P38,P39,P40,P41,P42 >
>
{
typedef map44 type;
};
template< typename Map>
struct m_at< Map,44 >
{
typedef typename Map::item44 type;
};
template< typename Key, typename T, typename Base >
struct m_item< 45,Key,T,Base >
: m_item_< Key,T,Base >
{
typedef pair< Key,T > item44;
};
template<
typename P0, typename P1, typename P2, typename P3, typename P4
, typename P5, typename P6, typename P7, typename P8, typename P9
, typename P10, typename P11, typename P12, typename P13, typename P14
, typename P15, typename P16, typename P17, typename P18, typename P19
, typename P20, typename P21, typename P22, typename P23, typename P24
, typename P25, typename P26, typename P27, typename P28, typename P29
, typename P30, typename P31, typename P32, typename P33, typename P34
, typename P35, typename P36, typename P37, typename P38, typename P39
, typename P40, typename P41, typename P42, typename P43, typename P44
>
struct map45
: m_item<
45
, typename P44::first
, typename P44::second
, map44< P0,P1,P2,P3,P4,P5,P6,P7,P8,P9,P10,P11,P12,P13,P14,P15,P16,P17,P18,P19,P20,P21,P22,P23,P24,P25,P26,P27,P28,P29,P30,P31,P32,P33,P34,P35,P36,P37,P38,P39,P40,P41,P42,P43 >
>
{
typedef map45 type;
};
template< typename Map>
struct m_at< Map,45 >
{
typedef typename Map::item45 type;
};
template< typename Key, typename T, typename Base >
struct m_item< 46,Key,T,Base >
: m_item_< Key,T,Base >
{
typedef pair< Key,T > item45;
};
template<
typename P0, typename P1, typename P2, typename P3, typename P4
, typename P5, typename P6, typename P7, typename P8, typename P9
, typename P10, typename P11, typename P12, typename P13, typename P14
, typename P15, typename P16, typename P17, typename P18, typename P19
, typename P20, typename P21, typename P22, typename P23, typename P24
, typename P25, typename P26, typename P27, typename P28, typename P29
, typename P30, typename P31, typename P32, typename P33, typename P34
, typename P35, typename P36, typename P37, typename P38, typename P39
, typename P40, typename P41, typename P42, typename P43, typename P44
, typename P45
>
struct map46
: m_item<
46
, typename P45::first
, typename P45::second
, map45< P0,P1,P2,P3,P4,P5,P6,P7,P8,P9,P10,P11,P12,P13,P14,P15,P16,P17,P18,P19,P20,P21,P22,P23,P24,P25,P26,P27,P28,P29,P30,P31,P32,P33,P34,P35,P36,P37,P38,P39,P40,P41,P42,P43,P44 >
>
{
typedef map46 type;
};
template< typename Map>
struct m_at< Map,46 >
{
typedef typename Map::item46 type;
};
template< typename Key, typename T, typename Base >
struct m_item< 47,Key,T,Base >
: m_item_< Key,T,Base >
{
typedef pair< Key,T > item46;
};
template<
typename P0, typename P1, typename P2, typename P3, typename P4
, typename P5, typename P6, typename P7, typename P8, typename P9
, typename P10, typename P11, typename P12, typename P13, typename P14
, typename P15, typename P16, typename P17, typename P18, typename P19
, typename P20, typename P21, typename P22, typename P23, typename P24
, typename P25, typename P26, typename P27, typename P28, typename P29
, typename P30, typename P31, typename P32, typename P33, typename P34
, typename P35, typename P36, typename P37, typename P38, typename P39
, typename P40, typename P41, typename P42, typename P43, typename P44
, typename P45, typename P46
>
struct map47
: m_item<
47
, typename P46::first
, typename P46::second
, map46< P0,P1,P2,P3,P4,P5,P6,P7,P8,P9,P10,P11,P12,P13,P14,P15,P16,P17,P18,P19,P20,P21,P22,P23,P24,P25,P26,P27,P28,P29,P30,P31,P32,P33,P34,P35,P36,P37,P38,P39,P40,P41,P42,P43,P44,P45 >
>
{
typedef map47 type;
};
template< typename Map>
struct m_at< Map,47 >
{
typedef typename Map::item47 type;
};
template< typename Key, typename T, typename Base >
struct m_item< 48,Key,T,Base >
: m_item_< Key,T,Base >
{
typedef pair< Key,T > item47;
};
template<
typename P0, typename P1, typename P2, typename P3, typename P4
, typename P5, typename P6, typename P7, typename P8, typename P9
, typename P10, typename P11, typename P12, typename P13, typename P14
, typename P15, typename P16, typename P17, typename P18, typename P19
, typename P20, typename P21, typename P22, typename P23, typename P24
, typename P25, typename P26, typename P27, typename P28, typename P29
, typename P30, typename P31, typename P32, typename P33, typename P34
, typename P35, typename P36, typename P37, typename P38, typename P39
, typename P40, typename P41, typename P42, typename P43, typename P44
, typename P45, typename P46, typename P47
>
struct map48
: m_item<
48
, typename P47::first
, typename P47::second
, map47< P0,P1,P2,P3,P4,P5,P6,P7,P8,P9,P10,P11,P12,P13,P14,P15,P16,P17,P18,P19,P20,P21,P22,P23,P24,P25,P26,P27,P28,P29,P30,P31,P32,P33,P34,P35,P36,P37,P38,P39,P40,P41,P42,P43,P44,P45,P46 >
>
{
typedef map48 type;
};
template< typename Map>
struct m_at< Map,48 >
{
typedef typename Map::item48 type;
};
template< typename Key, typename T, typename Base >
struct m_item< 49,Key,T,Base >
: m_item_< Key,T,Base >
{
typedef pair< Key,T > item48;
};
template<
typename P0, typename P1, typename P2, typename P3, typename P4
, typename P5, typename P6, typename P7, typename P8, typename P9
, typename P10, typename P11, typename P12, typename P13, typename P14
, typename P15, typename P16, typename P17, typename P18, typename P19
, typename P20, typename P21, typename P22, typename P23, typename P24
, typename P25, typename P26, typename P27, typename P28, typename P29
, typename P30, typename P31, typename P32, typename P33, typename P34
, typename P35, typename P36, typename P37, typename P38, typename P39
, typename P40, typename P41, typename P42, typename P43, typename P44
, typename P45, typename P46, typename P47, typename P48
>
struct map49
: m_item<
49
, typename P48::first
, typename P48::second
, map48< P0,P1,P2,P3,P4,P5,P6,P7,P8,P9,P10,P11,P12,P13,P14,P15,P16,P17,P18,P19,P20,P21,P22,P23,P24,P25,P26,P27,P28,P29,P30,P31,P32,P33,P34,P35,P36,P37,P38,P39,P40,P41,P42,P43,P44,P45,P46,P47 >
>
{
typedef map49 type;
};
template< typename Map>
struct m_at< Map,49 >
{
typedef typename Map::item49 type;
};
template< typename Key, typename T, typename Base >
struct m_item< 50,Key,T,Base >
: m_item_< Key,T,Base >
{
typedef pair< Key,T > item49;
};
template<
typename P0, typename P1, typename P2, typename P3, typename P4
, typename P5, typename P6, typename P7, typename P8, typename P9
, typename P10, typename P11, typename P12, typename P13, typename P14
, typename P15, typename P16, typename P17, typename P18, typename P19
, typename P20, typename P21, typename P22, typename P23, typename P24
, typename P25, typename P26, typename P27, typename P28, typename P29
, typename P30, typename P31, typename P32, typename P33, typename P34
, typename P35, typename P36, typename P37, typename P38, typename P39
, typename P40, typename P41, typename P42, typename P43, typename P44
, typename P45, typename P46, typename P47, typename P48, typename P49
>
struct map50
: m_item<
50
, typename P49::first
, typename P49::second
, map49< P0,P1,P2,P3,P4,P5,P6,P7,P8,P9,P10,P11,P12,P13,P14,P15,P16,P17,P18,P19,P20,P21,P22,P23,P24,P25,P26,P27,P28,P29,P30,P31,P32,P33,P34,P35,P36,P37,P38,P39,P40,P41,P42,P43,P44,P45,P46,P47,P48 >
>
{
typedef map50 type;
};
}}
@@ -0,0 +1,25 @@
//---------------------------------------------------------------------------//
// Copyright (c) 2013 Kyle Lutz <kyle.r.lutz@gmail.com>
//
// Distributed under the Boost Software License, Version 1.0
// See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt
//
// See http://boostorg.github.com/compute for more information.
//---------------------------------------------------------------------------//
#ifndef BOOST_COMPUTE_TYPE_TRAITS_HPP
#define BOOST_COMPUTE_TYPE_TRAITS_HPP
#include <boost/compute/type_traits/common_type.hpp>
#include <boost/compute/type_traits/is_device_iterator.hpp>
#include <boost/compute/type_traits/is_fundamental.hpp>
#include <boost/compute/type_traits/is_vector_type.hpp>
#include <boost/compute/type_traits/make_vector_type.hpp>
#include <boost/compute/type_traits/result_of.hpp>
#include <boost/compute/type_traits/scalar_type.hpp>
#include <boost/compute/type_traits/type_definition.hpp>
#include <boost/compute/type_traits/type_name.hpp>
#include <boost/compute/type_traits/vector_size.hpp>
#endif // BOOST_COMPUTE_TYPE_TRAITS_HPP
@@ -0,0 +1,94 @@
// Copyright Aleksey Gurtovoy 2000-2004
//
// Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
//
// *Preprocessed* version of the main "greater.hpp" header
// -- DO NOT modify by hand!
namespace boost { namespace mpl {
template<
typename Tag1
, typename Tag2
>
struct greater_impl
: if_c<
( BOOST_MPL_AUX_NESTED_VALUE_WKND(int, Tag1)
> BOOST_MPL_AUX_NESTED_VALUE_WKND(int, Tag2)
)
, aux::cast2nd_impl< greater_impl< Tag1,Tag1 >,Tag1, Tag2 >
, aux::cast1st_impl< greater_impl< Tag2,Tag2 >,Tag1, Tag2 >
>::type
{
};
/// for Digital Mars C++/compilers with no CTPS/TTP support
template<> struct greater_impl< na,na >
{
template< typename U1, typename U2 > struct apply
{
typedef apply type;
BOOST_STATIC_CONSTANT(int, value = 0);
};
};
template< typename Tag > struct greater_impl< na,Tag >
{
template< typename U1, typename U2 > struct apply
{
typedef apply type;
BOOST_STATIC_CONSTANT(int, value = 0);
};
};
template< typename Tag > struct greater_impl< Tag,na >
{
template< typename U1, typename U2 > struct apply
{
typedef apply type;
BOOST_STATIC_CONSTANT(int, value = 0);
};
};
template< typename T > struct greater_tag
{
typedef typename T::tag type;
};
template<
typename BOOST_MPL_AUX_NA_PARAM(N1)
, typename BOOST_MPL_AUX_NA_PARAM(N2)
>
struct greater
: greater_impl<
typename greater_tag<N1>::type
, typename greater_tag<N2>::type
>::template apply< N1,N2 >::type
{
BOOST_MPL_AUX_LAMBDA_SUPPORT(2, greater, (N1, N2))
};
BOOST_MPL_AUX_NA_SPEC2(2, 2, greater)
}}
namespace boost { namespace mpl {
template<>
struct greater_impl< integral_c_tag,integral_c_tag >
{
template< typename N1, typename N2 > struct apply
: bool_< ( BOOST_MPL_AUX_VALUE_WKND(N1)::value > BOOST_MPL_AUX_VALUE_WKND(N2)::value ) >
{
};
};
}}