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,71 @@
// (C) Copyright Gennadiy Rozental 2001.
// Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
// See http://www.boost.org/libs/test for the library home page.
//
//!@file
//!@brief contains wrappers, which allows to build Boost.Test with no exception
// ***************************************************************************
#ifndef BOOST_TEST_DETAIL_THROW_EXCEPTION_HPP
#define BOOST_TEST_DETAIL_THROW_EXCEPTION_HPP
// Boost
#include <boost/config.hpp> // BOOST_NO_EXCEPTION
#ifdef BOOST_NO_EXCEPTION
// C RUNTIME
#include <stdlib.h>
#endif
#include <boost/test/detail/suppress_warnings.hpp>
//____________________________________________________________________________//
namespace boost {
namespace unit_test {
namespace ut_detail {
#ifdef BOOST_NO_EXCEPTIONS
template<typename E>
BOOST_NORETURN inline void
throw_exception(E const& e) { abort(); }
#define BOOST_TEST_I_TRY
#define BOOST_TEST_I_CATCH( T, var ) for(T const& var = *(T*)0; false;)
#define BOOST_TEST_I_CATCH0( T ) if(0)
#define BOOST_TEST_I_CATCHALL() if(0)
#define BOOST_TEST_I_RETHROW
#else
template<typename E>
BOOST_NORETURN inline void
throw_exception(E const& e) { throw e; }
#define BOOST_TEST_I_TRY try
#define BOOST_TEST_I_CATCH( T, var ) catch( T const& var )
#define BOOST_TEST_I_CATCH0( T ) catch( T const& )
#define BOOST_TEST_I_CATCHALL() catch(...)
#define BOOST_TEST_I_RETHROW throw
#endif
//____________________________________________________________________________//
#define BOOST_TEST_I_THROW( E ) unit_test::ut_detail::throw_exception( E )
#define BOOST_TEST_I_ASSRT( cond, ex ) if( cond ) {} else BOOST_TEST_I_THROW( ex )
} // namespace ut_detail
} // namespace unit_test
} // namespace boost
//____________________________________________________________________________//
#include <boost/test/detail/enable_warnings.hpp>
#endif // BOOST_TEST_DETAIL_THROW_EXCEPTION_HPP
@@ -0,0 +1,32 @@
subroutine fix_contest_msg(mygrid,msg)
! If distance from mygrid to grid1 is more thsn 10000 km, change "grid1"
! to "R grid2" where grid2 is the antipodes of grid1.
character*6 mygrid
character*22 msg
character*6 g1,g2
logical isgrid
isgrid(g1)=g1(1:1).ge.'A' .and. g1(1:1).le.'R' .and. g1(2:2).ge.'A' .and. &
g1(2:2).le.'R' .and. g1(3:3).ge.'0' .and. g1(3:3).le.'9' .and. &
g1(4:4).ge.'0' .and. g1(4:4).le.'9' .and. g1(1:4).ne.'RR73'
n=len(trim(msg))
if(n.lt.4) return
g1=msg(n-3:n)//' '
if(isgrid(g1)) then
call azdist(mygrid,g1,0.d0,nAz,nEl,nDmiles,nDkm,nHotAz,nHotABetter)
if(ndkm.gt.10000) then
call grid2deg(g1,dlong,dlat)
dlong=dlong+180.0
if(dlong.gt.180.0) dlong=dlong-360.0
dlat=-dlat
call deg2grid(dlong,dlat,g2)
msg=msg(1:n-4)//'R '//g2(1:4)
endif
endif
return
end subroutine fix_contest_msg
@@ -0,0 +1,153 @@
#ifndef BOOST_PROPERTY_TREE_DETAIL_JSON_PARSER_STANDARD_CALLBACKS_HPP
#define BOOST_PROPERTY_TREE_DETAIL_JSON_PARSER_STANDARD_CALLBACKS_HPP
#include <boost/assert.hpp>
#include <boost/property_tree/ptree.hpp>
#include <vector>
namespace boost { namespace property_tree {
namespace json_parser { namespace detail
{
namespace constants
{
template <typename Ch> const Ch* null_value();
template <> inline const char* null_value() { return "null"; }
template <> inline const wchar_t* null_value() { return L"null"; }
template <typename Ch> const Ch* true_value();
template <> inline const char* true_value() { return "true"; }
template <> inline const wchar_t* true_value() { return L"true"; }
template <typename Ch> const Ch* false_value();
template <> inline const char* false_value() { return "false"; }
template <> inline const wchar_t* false_value() { return L"false"; }
}
template <typename Ptree>
class standard_callbacks {
public:
typedef typename Ptree::data_type string;
typedef typename string::value_type char_type;
void on_null() {
new_value() = constants::null_value<char_type>();
}
void on_boolean(bool b) {
new_value() = b ? constants::true_value<char_type>()
: constants::false_value<char_type>();
}
template <typename Range>
void on_number(Range code_units) {
new_value().assign(code_units.begin(), code_units.end());
}
void on_begin_number() {
new_value();
}
void on_digit(char_type d) {
current_value() += d;
}
void on_end_number() {}
void on_begin_string() {
new_value();
}
template <typename Range>
void on_code_units(Range code_units) {
current_value().append(code_units.begin(), code_units.end());
}
void on_code_unit(char_type c) {
current_value() += c;
}
void on_end_string() {}
void on_begin_array() {
new_tree();
stack.back().k = array;
}
void on_end_array() {
if (stack.back().k == leaf) stack.pop_back();
stack.pop_back();
}
void on_begin_object() {
new_tree();
stack.back().k = object;
}
void on_end_object() {
if (stack.back().k == leaf) stack.pop_back();
stack.pop_back();
}
Ptree& output() { return root; }
protected:
bool is_key() const {
return stack.back().k == key;
}
string& current_value() {
layer& l = stack.back();
switch (l.k) {
case key: return key_buffer;
default: return l.t->data();
}
}
private:
Ptree root;
string key_buffer;
enum kind { array, object, key, leaf };
struct layer { kind k; Ptree* t; };
std::vector<layer> stack;
Ptree& new_tree() {
if (stack.empty()) {
layer l = {leaf, &root};
stack.push_back(l);
return root;
}
layer& l = stack.back();
switch (l.k) {
case array: {
l.t->push_back(std::make_pair(string(), Ptree()));
layer nl = {leaf, &l.t->back().second};
stack.push_back(nl);
return *stack.back().t;
}
case object:
default:
BOOST_ASSERT(false); // must start with string, i.e. call new_value
case key: {
l.t->push_back(std::make_pair(key_buffer, Ptree()));
l.k = object;
layer nl = {leaf, &l.t->back().second};
stack.push_back(nl);
return *stack.back().t;
}
case leaf:
stack.pop_back();
return new_tree();
}
}
string& new_value() {
if (stack.empty()) return new_tree().data();
layer& l = stack.back();
switch (l.k) {
case leaf:
stack.pop_back();
return new_value();
case object:
l.k = key;
key_buffer.clear();
return key_buffer;
default:
return new_tree().data();
}
}
};
}}}}
#endif
@@ -0,0 +1,130 @@
/*=============================================================================
Copyright (c) 2005-2012 Joel de Guzman
Copyright (c) 2005-2006 Dan Marsden
Distributed under the Boost Software License, Version 1.0. (See accompanying
file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
==============================================================================*/
#if !defined(BOOST_FUSION_DEQUE_ITERATOR_26112006_2154)
#define BOOST_FUSION_DEQUE_ITERATOR_26112006_2154
#include <boost/fusion/support/config.hpp>
#include <boost/fusion/iterator/iterator_facade.hpp>
#include <boost/fusion/container/deque/detail/keyed_element.hpp>
#include <boost/mpl/int.hpp>
#include <boost/mpl/minus.hpp>
#include <boost/mpl/equal_to.hpp>
#include <boost/mpl/identity.hpp>
#include <boost/mpl/if.hpp>
#include <boost/type_traits/is_const.hpp>
#include <boost/type_traits/add_const.hpp>
#include <boost/type_traits/add_reference.hpp>
namespace boost { namespace fusion {
struct bidirectional_traversal_tag;
template <typename Seq, int Pos>
struct deque_iterator
: iterator_facade<deque_iterator<Seq, Pos>, bidirectional_traversal_tag>
{
typedef Seq sequence;
typedef mpl::int_<Pos> index;
BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
deque_iterator(Seq& seq)
: seq_(seq)
{}
template<typename Iterator>
struct value_of
: detail::keyed_element_value_at<
typename Iterator::sequence, typename Iterator::index>
{};
template<typename Iterator>
struct deref
{
typedef typename detail::keyed_element_value_at<
typename Iterator::sequence, typename Iterator::index>::type element_type;
typedef typename add_reference<
typename mpl::eval_if<
is_const<typename Iterator::sequence>,
add_const<element_type>,
mpl::identity<element_type> >::type>::type type;
BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
static type
call(Iterator const& it)
{
return it.seq_.get(typename Iterator::index());
}
};
template <typename Iterator, typename N>
struct advance
{
typedef typename Iterator::index index;
typedef typename Iterator::sequence sequence;
typedef deque_iterator<sequence, index::value + N::value> type;
BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
static type
call(Iterator const& i)
{
return type(i.seq_);
}
};
template<typename Iterator>
struct next
: advance<Iterator, mpl::int_<1> >
{};
template<typename Iterator>
struct prior
: advance<Iterator, mpl::int_<-1> >
{};
template <typename I1, typename I2>
struct distance : mpl::minus<typename I2::index, typename I1::index>
{
typedef typename
mpl::minus<
typename I2::index, typename I1::index
>::type
type;
BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
static type
call(I1 const&, I2 const&)
{
return type();
}
};
template<typename I1, typename I2>
struct equal_to
: mpl::equal_to<typename I1::index, typename I2::index>
{};
Seq& seq_;
private:
// silence MSVC warning C4512: assignment operator could not be generated
deque_iterator& operator= (deque_iterator const&);
};
}}
#ifdef BOOST_FUSION_WORKAROUND_FOR_LWG_2408
namespace std
{
template <typename Seq, int Pos>
struct iterator_traits< ::boost::fusion::deque_iterator<Seq, Pos> >
{ };
}
#endif
#endif
@@ -0,0 +1,216 @@
//////////////////////////////////////////////////////////////////////////////
//
// (C) Copyright Ion Gaztanaga 2007-2014. Distributed under the Boost
// Software License, Version 1.0. (See accompanying file
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
//
// See http://www.boost.org/libs/interprocess for documentation.
//
//////////////////////////////////////////////////////////////////////////////
#ifndef BOOST_INTERPROCESS_DETAIL_SHARED_DIR_HELPERS_HPP
#define BOOST_INTERPROCESS_DETAIL_SHARED_DIR_HELPERS_HPP
#ifndef BOOST_CONFIG_HPP
# include <boost/config.hpp>
#endif
#
#if defined(BOOST_HAS_PRAGMA_ONCE)
# pragma once
#endif
#include <boost/interprocess/detail/config_begin.hpp>
#include <boost/interprocess/detail/workaround.hpp>
#include <boost/interprocess/detail/os_file_functions.hpp>
#include <boost/interprocess/errors.hpp>
#include <boost/interprocess/exceptions.hpp>
#include <string>
#if defined(BOOST_INTERPROCESS_HAS_KERNEL_BOOTTIME) && defined(BOOST_INTERPROCESS_WINDOWS)
#include <boost/interprocess/detail/windows_intermodule_singleton.hpp>
#endif
namespace boost {
namespace interprocess {
namespace ipcdetail {
#if defined(BOOST_INTERPROCESS_HAS_KERNEL_BOOTTIME)
#if defined(BOOST_INTERPROCESS_WINDOWS)
//This type will initialize the stamp
struct windows_bootstamp
{
windows_bootstamp()
{
//Throw if bootstamp not available
if(!winapi::get_last_bootup_time(stamp)){
error_info err = system_error_code();
throw interprocess_exception(err);
}
}
//Use std::string. Even if this will be constructed in shared memory, all
//modules/dlls are from this process so internal raw pointers to heap are always valid
std::string stamp;
};
inline void get_bootstamp(std::string &s, bool add = false)
{
const windows_bootstamp &bootstamp = windows_intermodule_singleton<windows_bootstamp>::get();
if(add){
s += bootstamp.stamp;
}
else{
s = bootstamp.stamp;
}
}
#elif defined(BOOST_INTERPROCESS_HAS_BSD_KERNEL_BOOTTIME)
inline void get_bootstamp(std::string &s, bool add = false)
{
// FreeBSD specific: sysctl "kern.boottime"
int request[2] = { CTL_KERN, KERN_BOOTTIME };
struct ::timeval result;
std::size_t result_len = sizeof result;
if (::sysctl (request, 2, &result, &result_len, 0, 0) < 0)
return;
char bootstamp_str[256];
const char Characters [] =
{ '0', '1', '2', '3', '4', '5', '6', '7'
, '8', '9', 'A', 'B', 'C', 'D', 'E', 'F' };
std::size_t char_counter = 0;
//32 bit values to allow 32 and 64 bit process IPC
boost::uint32_t fields[2] = { boost::uint32_t(result.tv_sec), boost::uint32_t(result.tv_usec) };
for(std::size_t field = 0; field != 2; ++field){
for(std::size_t i = 0; i != sizeof(fields[0]); ++i){
const char *ptr = (const char *)&fields[field];
bootstamp_str[char_counter++] = Characters[(ptr[i]&0xF0)>>4];
bootstamp_str[char_counter++] = Characters[(ptr[i]&0x0F)];
}
}
bootstamp_str[char_counter] = 0;
if(add){
s += bootstamp_str;
}
else{
s = bootstamp_str;
}
}
#else
#error "BOOST_INTERPROCESS_HAS_KERNEL_BOOTTIME defined with no known implementation"
#endif
#endif //#if defined(BOOST_INTERPROCESS_HAS_KERNEL_BOOTTIME)
inline void get_shared_dir_root(std::string &dir_path)
{
#if defined (BOOST_INTERPROCESS_WINDOWS)
winapi::get_shared_documents_folder(dir_path);
#else
dir_path = "/tmp";
#endif
//We always need this path, so throw on error
if(dir_path.empty()){
error_info err = system_error_code();
throw interprocess_exception(err);
}
//Remove final null.
dir_path += "/boost_interprocess";
}
#if defined(BOOST_INTERPROCESS_SHARED_DIR_FUNC) && defined(BOOST_INTERPROCESS_SHARED_DIR_PATH)
#error "Error: Both BOOST_INTERPROCESS_SHARED_DIR_FUNC and BOOST_INTERPROCESS_SHARED_DIR_PATH defined!"
#endif
#ifdef BOOST_INTERPROCESS_SHARED_DIR_FUNC
namespace boost {
namespace interprocess {
namespace ipcdetail {
// When BOOST_INTERPROCESS_SHARED_DIR_FUNC is defined, users have to implement
// get_shared_dir
void get_shared_dir(std::string &shared_dir);
}
}
}
#else
inline void get_shared_dir(std::string &shared_dir)
{
#if defined(BOOST_INTERPROCESS_SHARED_DIR_PATH)
shared_dir = BOOST_INTERPROCESS_SHARED_DIR_PATH;
#else
get_shared_dir_root(shared_dir);
#if defined(BOOST_INTERPROCESS_HAS_KERNEL_BOOTTIME)
shared_dir += "/";
get_bootstamp(shared_dir, true);
#endif
#endif
}
#endif
inline void shared_filepath(const char *filename, std::string &filepath)
{
get_shared_dir(filepath);
filepath += "/";
filepath += filename;
}
inline void create_shared_dir_and_clean_old(std::string &shared_dir)
{
#if defined(BOOST_INTERPROCESS_SHARED_DIR_PATH) || defined(BOOST_INTERPROCESS_SHARED_DIR_FUNC)
get_shared_dir(shared_dir);
#else
//First get the temp directory
std::string root_shared_dir;
get_shared_dir_root(root_shared_dir);
//If fails, check that it's because already exists
if(!create_directory(root_shared_dir.c_str())){
error_info info(system_error_code());
if(info.get_error_code() != already_exists_error){
throw interprocess_exception(info);
}
}
#if defined(BOOST_INTERPROCESS_HAS_KERNEL_BOOTTIME)
get_shared_dir(shared_dir);
//If fails, check that it's because already exists
if(!create_directory(shared_dir.c_str())){
error_info info(system_error_code());
if(info.get_error_code() != already_exists_error){
throw interprocess_exception(info);
}
}
//Now erase all old directories created in the previous boot sessions
std::string subdir = shared_dir;
subdir.erase(0, root_shared_dir.size()+1);
delete_subdirectories(root_shared_dir, subdir.c_str());
#else
shared_dir = root_shared_dir;
#endif
#endif
}
inline void create_shared_dir_cleaning_old_and_get_filepath(const char *filename, std::string &shared_dir)
{
create_shared_dir_and_clean_old(shared_dir);
shared_dir += "/";
shared_dir += filename;
}
inline void add_leading_slash(const char *name, std::string &new_name)
{
if(name[0] != '/'){
new_name = '/';
}
new_name += name;
}
} //namespace boost{
} //namespace interprocess {
} //namespace ipcdetail {
#include <boost/interprocess/detail/config_end.hpp>
#endif //ifndef BOOST_INTERPROCESS_DETAIL_SHARED_DIR_HELPERS_HPP
@@ -0,0 +1,73 @@
// (C) Copyright 2005 Matthias Troyer
// Use, modification and distribution is subject to the Boost Software
// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
// Authors: Matthias Troyer
#ifndef BOOST_MPI_DETAIL_IGNORE_SKELETON_OARCHIVE_HPP
#define BOOST_MPI_DETAIL_IGNORE_SKELETON_OARCHIVE_HPP
#include <boost/archive/detail/auto_link_archive.hpp>
#include <boost/archive/detail/common_oarchive.hpp>
#include <boost/archive/basic_archive.hpp>
#include <boost/archive/detail/oserializer.hpp>
#include <boost/serialization/collection_size_type.hpp>
#include <boost/serialization/array.hpp>
#include <boost/serialization/item_version_type.hpp>
namespace boost { namespace mpi { namespace detail {
template<class Archive>
class ignore_skeleton_oarchive
: public archive::detail::common_oarchive<Archive>
{
public:
ignore_skeleton_oarchive()
: archive::detail::common_oarchive<Archive>(archive::no_header)
{
}
#ifdef BOOST_NO_MEMBER_TEMPLATE_FRIENDS
public:
#else
friend class archive::detail::interface_oarchive<Archive>;
friend class archive::save_access;
protected:
#endif
template<class T>
void save_override(T const& t)
{
archive::save(* this->This(), t);
}
#define BOOST_ARCHIVE_IGNORE_IMPLEMENTATION(T) \
void save_override(T const &) \
{}
BOOST_ARCHIVE_IGNORE_IMPLEMENTATION(archive::class_id_optional_type)
BOOST_ARCHIVE_IGNORE_IMPLEMENTATION(archive::version_type)
BOOST_ARCHIVE_IGNORE_IMPLEMENTATION(archive::library_version_type)
BOOST_ARCHIVE_IGNORE_IMPLEMENTATION(archive::class_id_type)
BOOST_ARCHIVE_IGNORE_IMPLEMENTATION(archive::class_id_reference_type)
BOOST_ARCHIVE_IGNORE_IMPLEMENTATION(archive::object_id_type)
BOOST_ARCHIVE_IGNORE_IMPLEMENTATION(archive::object_reference_type)
BOOST_ARCHIVE_IGNORE_IMPLEMENTATION(archive::tracking_type)
BOOST_ARCHIVE_IGNORE_IMPLEMENTATION(archive::class_name_type)
BOOST_ARCHIVE_IGNORE_IMPLEMENTATION(serialization::collection_size_type)
BOOST_ARCHIVE_IGNORE_IMPLEMENTATION(serialization::item_version_type)
void save_override(std::string const & s)
{
if (s.size())
save_override(serialization::make_array(s.data(),s.size()));
}
#undef BOOST_ARCHIVE_IGNORE_IMPLEMENTATION
};
} } } // end namespace boost::mpi::detail
#endif // BOOST_MPI_DETAIL_IGNORE_SKELETON_OARCHIVE_HPP
@@ -0,0 +1,37 @@
# /* **************************************************************************
# * *
# * (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_ARRAY_POP_BACK_HPP
# define BOOST_PREPROCESSOR_ARRAY_POP_BACK_HPP
#
# include <boost/preprocessor/arithmetic/dec.hpp>
# include <boost/preprocessor/array/elem.hpp>
# include <boost/preprocessor/array/size.hpp>
# include <boost/preprocessor/repetition/enum.hpp>
# include <boost/preprocessor/repetition/deduce_z.hpp>
#
# /* BOOST_PP_ARRAY_POP_BACK */
#
# define BOOST_PP_ARRAY_POP_BACK(array) BOOST_PP_ARRAY_POP_BACK_Z(BOOST_PP_DEDUCE_Z(), array)
#
# /* BOOST_PP_ARRAY_POP_BACK_Z */
#
# if ~BOOST_PP_CONFIG_FLAGS() & BOOST_PP_CONFIG_EDG()
# define BOOST_PP_ARRAY_POP_BACK_Z(z, array) BOOST_PP_ARRAY_POP_BACK_I(z, BOOST_PP_ARRAY_SIZE(array), array)
# else
# define BOOST_PP_ARRAY_POP_BACK_Z(z, array) BOOST_PP_ARRAY_POP_BACK_Z_D(z, array)
# define BOOST_PP_ARRAY_POP_BACK_Z_D(z, array) BOOST_PP_ARRAY_POP_BACK_I(z, BOOST_PP_ARRAY_SIZE(array), array)
# endif
#
# define BOOST_PP_ARRAY_POP_BACK_I(z, size, array) (BOOST_PP_DEC(size), (BOOST_PP_ENUM_ ## z(BOOST_PP_DEC(size), BOOST_PP_ARRAY_POP_BACK_M, array)))
# define BOOST_PP_ARRAY_POP_BACK_M(z, n, data) BOOST_PP_ARRAY_ELEM(n, data)
#
# endif
@@ -0,0 +1,23 @@
// Copyright David Abrahams 2003.
// Copyright Stefan Seefeld 2016.
// Distributed under the Boost Software License, Version 1.0. (See
// accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
#ifndef boost_python_detail_is_shared_ptr_hpp_
#define boost_python_detail_is_shared_ptr_hpp_
#include <boost/python/detail/is_xxx.hpp>
#include <boost/shared_ptr.hpp>
namespace boost { namespace python { namespace detail {
BOOST_PYTHON_IS_XXX_DEF(shared_ptr, shared_ptr, 1)
#if __cplusplus >= 201103L
template <typename T>
struct is_shared_ptr<std::shared_ptr<T> > : std::true_type {};
#endif
}}} // namespace boost::python::detail
#endif
@@ -0,0 +1,17 @@
# /* **************************************************************************
# * *
# * (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_INC_HPP
# define BOOST_PREPROCESSOR_INC_HPP
#
# include <boost/preprocessor/arithmetic/inc.hpp>
#
# endif
@@ -0,0 +1,65 @@
// (C) Copyright 2009-2011 Frederic Bron.
//
// Use, modification and distribution are subject to the Boost Software License,
// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt).
//
// See http://www.boost.org/libs/type_traits for most recent version including documentation.
#ifndef BOOST_TT_HAS_MINUS_ASSIGN_HPP_INCLUDED
#define BOOST_TT_HAS_MINUS_ASSIGN_HPP_INCLUDED
#define BOOST_TT_TRAIT_NAME has_minus_assign
#define BOOST_TT_TRAIT_OP -=
#define BOOST_TT_FORBIDDEN_IF\
(\
/* Lhs==pointer and Rhs==fundamental and Rhs!=integral */\
(\
::boost::is_pointer< Lhs_noref >::value && \
::boost::is_fundamental< Rhs_nocv >::value && \
(! ::boost::is_integral< Rhs_noref >::value )\
) || \
/* Lhs==void* and Rhs==fundamental */\
(\
::boost::is_pointer< Lhs_noref >::value && \
::boost::is_void< Lhs_noptr >::value && \
::boost::is_fundamental< Rhs_nocv >::value\
) || \
/* Rhs==void* and Lhs==fundamental */\
(\
::boost::is_pointer< Rhs_noref >::value && \
::boost::is_void< Rhs_noptr >::value && \
::boost::is_fundamental< Lhs_nocv >::value\
) || \
/* Lhs=fundamental and Rhs=pointer */\
(\
::boost::is_fundamental< Lhs_nocv >::value && \
::boost::is_pointer< Rhs_noref >::value\
) || \
/* Lhs==pointer and Rhs==pointer */\
(\
::boost::is_pointer< Lhs_noref >::value && \
::boost::is_pointer< Rhs_noref >::value\
) || \
/* (Lhs==fundamental or Lhs==pointer) and (Rhs==fundamental or Rhs==pointer) and (Lhs==const) */\
(\
(\
::boost::is_fundamental< Lhs_nocv >::value || \
::boost::is_pointer< Lhs_noref >::value\
) && \
(\
::boost::is_fundamental< Rhs_nocv >::value || \
::boost::is_pointer< Rhs_noref >::value\
) && \
::boost::is_const< Lhs_noref >::value\
)\
)
#include <boost/type_traits/detail/has_binary_operator.hpp>
#undef BOOST_TT_TRAIT_NAME
#undef BOOST_TT_TRAIT_OP
#undef BOOST_TT_FORBIDDEN_IF
#endif
@@ -0,0 +1,641 @@
///////////////////////////////////////////////////////////////////////////////
// Copyright Christopher Kormanyos 2014.
// Copyright John Maddock 2014.
// Copyright Paul Bristow 2014.
// Distributed under the Boost Software License,
// Version 1.0. (See accompanying file LICENSE_1_0.txt
// or copy at http://www.boost.org/LICENSE_1_0.txt)
//
// Implement a specialization of std::complex<> for *anything* that
// is defined as BOOST_CSTDFLOAT_EXTENDED_COMPLEX_FLOAT_TYPE.
#ifndef _BOOST_CSTDFLOAT_COMPLEX_STD_2014_02_15_HPP_
#define _BOOST_CSTDFLOAT_COMPLEX_STD_2014_02_15_HPP_
#if defined(__GNUC__)
#pragma GCC system_header
#endif
#include <complex>
#include <boost/math/constants/constants.hpp>
namespace std
{
// Forward declarations.
template<class float_type>
class complex;
template<>
class complex<BOOST_CSTDFLOAT_EXTENDED_COMPLEX_FLOAT_TYPE>;
inline BOOST_CSTDFLOAT_EXTENDED_COMPLEX_FLOAT_TYPE real(const complex<BOOST_CSTDFLOAT_EXTENDED_COMPLEX_FLOAT_TYPE>&);
inline BOOST_CSTDFLOAT_EXTENDED_COMPLEX_FLOAT_TYPE imag(const complex<BOOST_CSTDFLOAT_EXTENDED_COMPLEX_FLOAT_TYPE>&);
inline BOOST_CSTDFLOAT_EXTENDED_COMPLEX_FLOAT_TYPE abs (const complex<BOOST_CSTDFLOAT_EXTENDED_COMPLEX_FLOAT_TYPE>&);
inline BOOST_CSTDFLOAT_EXTENDED_COMPLEX_FLOAT_TYPE arg (const complex<BOOST_CSTDFLOAT_EXTENDED_COMPLEX_FLOAT_TYPE>&);
inline BOOST_CSTDFLOAT_EXTENDED_COMPLEX_FLOAT_TYPE norm(const complex<BOOST_CSTDFLOAT_EXTENDED_COMPLEX_FLOAT_TYPE>&);
inline complex<BOOST_CSTDFLOAT_EXTENDED_COMPLEX_FLOAT_TYPE> conj (const complex<BOOST_CSTDFLOAT_EXTENDED_COMPLEX_FLOAT_TYPE>&);
inline complex<BOOST_CSTDFLOAT_EXTENDED_COMPLEX_FLOAT_TYPE> proj (const complex<BOOST_CSTDFLOAT_EXTENDED_COMPLEX_FLOAT_TYPE>&);
inline complex<BOOST_CSTDFLOAT_EXTENDED_COMPLEX_FLOAT_TYPE> polar(const BOOST_CSTDFLOAT_EXTENDED_COMPLEX_FLOAT_TYPE&,
const BOOST_CSTDFLOAT_EXTENDED_COMPLEX_FLOAT_TYPE& = 0);
inline complex<BOOST_CSTDFLOAT_EXTENDED_COMPLEX_FLOAT_TYPE> sqrt (const complex<BOOST_CSTDFLOAT_EXTENDED_COMPLEX_FLOAT_TYPE>&);
inline complex<BOOST_CSTDFLOAT_EXTENDED_COMPLEX_FLOAT_TYPE> sin (const complex<BOOST_CSTDFLOAT_EXTENDED_COMPLEX_FLOAT_TYPE>&);
inline complex<BOOST_CSTDFLOAT_EXTENDED_COMPLEX_FLOAT_TYPE> cos (const complex<BOOST_CSTDFLOAT_EXTENDED_COMPLEX_FLOAT_TYPE>&);
inline complex<BOOST_CSTDFLOAT_EXTENDED_COMPLEX_FLOAT_TYPE> tan (const complex<BOOST_CSTDFLOAT_EXTENDED_COMPLEX_FLOAT_TYPE>&);
inline complex<BOOST_CSTDFLOAT_EXTENDED_COMPLEX_FLOAT_TYPE> asin (const complex<BOOST_CSTDFLOAT_EXTENDED_COMPLEX_FLOAT_TYPE>&);
inline complex<BOOST_CSTDFLOAT_EXTENDED_COMPLEX_FLOAT_TYPE> acos (const complex<BOOST_CSTDFLOAT_EXTENDED_COMPLEX_FLOAT_TYPE>&);
inline complex<BOOST_CSTDFLOAT_EXTENDED_COMPLEX_FLOAT_TYPE> atan (const complex<BOOST_CSTDFLOAT_EXTENDED_COMPLEX_FLOAT_TYPE>&);
inline complex<BOOST_CSTDFLOAT_EXTENDED_COMPLEX_FLOAT_TYPE> exp (const complex<BOOST_CSTDFLOAT_EXTENDED_COMPLEX_FLOAT_TYPE>&);
inline complex<BOOST_CSTDFLOAT_EXTENDED_COMPLEX_FLOAT_TYPE> log (const complex<BOOST_CSTDFLOAT_EXTENDED_COMPLEX_FLOAT_TYPE>&);
inline complex<BOOST_CSTDFLOAT_EXTENDED_COMPLEX_FLOAT_TYPE> log10(const complex<BOOST_CSTDFLOAT_EXTENDED_COMPLEX_FLOAT_TYPE>&);
inline complex<BOOST_CSTDFLOAT_EXTENDED_COMPLEX_FLOAT_TYPE> pow (const complex<BOOST_CSTDFLOAT_EXTENDED_COMPLEX_FLOAT_TYPE>&,
int);
inline complex<BOOST_CSTDFLOAT_EXTENDED_COMPLEX_FLOAT_TYPE> pow (const complex<BOOST_CSTDFLOAT_EXTENDED_COMPLEX_FLOAT_TYPE>&,
const BOOST_CSTDFLOAT_EXTENDED_COMPLEX_FLOAT_TYPE&);
inline complex<BOOST_CSTDFLOAT_EXTENDED_COMPLEX_FLOAT_TYPE> pow (const complex<BOOST_CSTDFLOAT_EXTENDED_COMPLEX_FLOAT_TYPE>&,
const complex<BOOST_CSTDFLOAT_EXTENDED_COMPLEX_FLOAT_TYPE>&);
inline complex<BOOST_CSTDFLOAT_EXTENDED_COMPLEX_FLOAT_TYPE> pow (const BOOST_CSTDFLOAT_EXTENDED_COMPLEX_FLOAT_TYPE&,
const complex<BOOST_CSTDFLOAT_EXTENDED_COMPLEX_FLOAT_TYPE>&);
inline complex<BOOST_CSTDFLOAT_EXTENDED_COMPLEX_FLOAT_TYPE> sinh (const complex<BOOST_CSTDFLOAT_EXTENDED_COMPLEX_FLOAT_TYPE>&);
inline complex<BOOST_CSTDFLOAT_EXTENDED_COMPLEX_FLOAT_TYPE> cosh (const complex<BOOST_CSTDFLOAT_EXTENDED_COMPLEX_FLOAT_TYPE>&);
inline complex<BOOST_CSTDFLOAT_EXTENDED_COMPLEX_FLOAT_TYPE> tanh (const complex<BOOST_CSTDFLOAT_EXTENDED_COMPLEX_FLOAT_TYPE>&);
inline complex<BOOST_CSTDFLOAT_EXTENDED_COMPLEX_FLOAT_TYPE> asinh(const complex<BOOST_CSTDFLOAT_EXTENDED_COMPLEX_FLOAT_TYPE>&);
inline complex<BOOST_CSTDFLOAT_EXTENDED_COMPLEX_FLOAT_TYPE> acosh(const complex<BOOST_CSTDFLOAT_EXTENDED_COMPLEX_FLOAT_TYPE>&);
inline complex<BOOST_CSTDFLOAT_EXTENDED_COMPLEX_FLOAT_TYPE> atanh(const complex<BOOST_CSTDFLOAT_EXTENDED_COMPLEX_FLOAT_TYPE>&);
template<class char_type, class traits_type>
inline std::basic_ostream<char_type, traits_type>& operator<<(std::basic_ostream<char_type, traits_type>&, const std::complex<BOOST_CSTDFLOAT_EXTENDED_COMPLEX_FLOAT_TYPE>&);
template<class char_type, class traits_type>
inline std::basic_istream<char_type, traits_type>& operator>>(std::basic_istream<char_type, traits_type>&, std::complex<BOOST_CSTDFLOAT_EXTENDED_COMPLEX_FLOAT_TYPE>&);
// Template specialization of the complex class.
template<>
class complex<BOOST_CSTDFLOAT_EXTENDED_COMPLEX_FLOAT_TYPE>
{
public:
typedef BOOST_CSTDFLOAT_EXTENDED_COMPLEX_FLOAT_TYPE value_type;
explicit complex(const complex<float>&);
explicit complex(const complex<double>&);
explicit complex(const complex<long double>&);
#if defined(BOOST_NO_CXX11_CONSTEXPR)
complex(const value_type& r = value_type(),
const value_type& i = value_type()) : re(r),
im(i) { }
template<typename X>
complex(const complex<X>& x) : re(x.real()),
im(x.imag()) { }
const value_type& real() const { return re; }
const value_type& imag() const { return im; }
value_type& real() { return re; }
value_type& imag() { return im; }
#else
BOOST_CONSTEXPR complex(const value_type& r = value_type(),
const value_type& i = value_type()) : re(r),
im(i) { }
template<typename X>
BOOST_CONSTEXPR complex(const complex<X>& x) : re(x.real()),
im(x.imag()) { }
value_type real() const { return re; }
value_type imag() const { return im; }
#endif
void real(value_type r) { re = r; }
void imag(value_type i) { im = i; }
complex<value_type>& operator=(const value_type& v)
{
re = v;
im = value_type(0);
return *this;
}
complex<value_type>& operator+=(const value_type& v)
{
re += v;
return *this;
}
complex<value_type>& operator-=(const value_type& v)
{
re -= v;
return *this;
}
complex<value_type>& operator*=(const value_type& v)
{
re *= v;
im *= v;
return *this;
}
complex<value_type>& operator/=(const value_type& v)
{
re /= v;
im /= v;
return *this;
}
template<typename X>
complex<value_type>& operator=(const complex<X>& x)
{
re = x.real();
im = x.imag();
return *this;
}
template<typename X>
complex<value_type>& operator+=(const complex<X>& x)
{
re += x.real();
im += x.imag();
return *this;
}
template<typename X>
complex<value_type>& operator-=(const complex<X>& x)
{
re -= x.real();
im -= x.imag();
return *this;
}
template<typename X>
complex<value_type>& operator*=(const complex<X>& x)
{
const value_type tmp_real = (re * x.real()) - (im * x.imag());
im = (re * x.imag()) + (im * x.real());
re = tmp_real;
return *this;
}
template<typename X>
complex<value_type>& operator/=(const complex<X>& x)
{
const value_type tmp_real = (re * x.real()) + (im * x.imag());
const value_type the_norm = std::norm(x);
im = ((im * x.real()) - (re * x.imag())) / the_norm;
re = tmp_real / the_norm;
return *this;
}
private:
value_type re;
value_type im;
};
// Constructors from built-in complex representation of floating-point types.
inline complex<BOOST_CSTDFLOAT_EXTENDED_COMPLEX_FLOAT_TYPE>::complex(const complex<float>& f) : re(BOOST_CSTDFLOAT_EXTENDED_COMPLEX_FLOAT_TYPE( f.real())), im(BOOST_CSTDFLOAT_EXTENDED_COMPLEX_FLOAT_TYPE( f.imag())) { }
inline complex<BOOST_CSTDFLOAT_EXTENDED_COMPLEX_FLOAT_TYPE>::complex(const complex<double>& d) : re(BOOST_CSTDFLOAT_EXTENDED_COMPLEX_FLOAT_TYPE( d.real())), im(BOOST_CSTDFLOAT_EXTENDED_COMPLEX_FLOAT_TYPE( d.imag())) { }
inline complex<BOOST_CSTDFLOAT_EXTENDED_COMPLEX_FLOAT_TYPE>::complex(const complex<long double>& ld) : re(BOOST_CSTDFLOAT_EXTENDED_COMPLEX_FLOAT_TYPE(ld.real())), im(BOOST_CSTDFLOAT_EXTENDED_COMPLEX_FLOAT_TYPE(ld.imag())) { }
} // namespace std
namespace boost { namespace math { namespace cstdfloat { namespace detail {
template<class float_type> inline std::complex<float_type> multiply_by_i(const std::complex<float_type>& x)
{
// Multiply x (in C) by I (the imaginary component), and return the result.
return std::complex<float_type>(-x.imag(), x.real());
}
} } } } // boost::math::cstdfloat::detail
namespace std
{
// ISO/IEC 14882:2011, Section 26.4.7, specific values.
inline BOOST_CSTDFLOAT_EXTENDED_COMPLEX_FLOAT_TYPE real(const complex<BOOST_CSTDFLOAT_EXTENDED_COMPLEX_FLOAT_TYPE>& x) { return x.real(); }
inline BOOST_CSTDFLOAT_EXTENDED_COMPLEX_FLOAT_TYPE imag(const complex<BOOST_CSTDFLOAT_EXTENDED_COMPLEX_FLOAT_TYPE>& x) { return x.imag(); }
inline BOOST_CSTDFLOAT_EXTENDED_COMPLEX_FLOAT_TYPE abs (const complex<BOOST_CSTDFLOAT_EXTENDED_COMPLEX_FLOAT_TYPE>& x) { using std::sqrt; return sqrt ((real(x) * real(x)) + (imag(x) * imag(x))); }
inline BOOST_CSTDFLOAT_EXTENDED_COMPLEX_FLOAT_TYPE arg (const complex<BOOST_CSTDFLOAT_EXTENDED_COMPLEX_FLOAT_TYPE>& x) { using std::atan2; return atan2(x.imag(), x.real()); }
inline BOOST_CSTDFLOAT_EXTENDED_COMPLEX_FLOAT_TYPE norm(const complex<BOOST_CSTDFLOAT_EXTENDED_COMPLEX_FLOAT_TYPE>& x) { return (real(x) * real(x)) + (imag(x) * imag(x)); }
inline complex<BOOST_CSTDFLOAT_EXTENDED_COMPLEX_FLOAT_TYPE> conj (const complex<BOOST_CSTDFLOAT_EXTENDED_COMPLEX_FLOAT_TYPE>& x) { return complex<BOOST_CSTDFLOAT_EXTENDED_COMPLEX_FLOAT_TYPE>(x.real(), -x.imag()); }
inline complex<BOOST_CSTDFLOAT_EXTENDED_COMPLEX_FLOAT_TYPE> proj (const complex<BOOST_CSTDFLOAT_EXTENDED_COMPLEX_FLOAT_TYPE>& x)
{
const BOOST_CSTDFLOAT_EXTENDED_COMPLEX_FLOAT_TYPE m = (std::numeric_limits<BOOST_CSTDFLOAT_EXTENDED_COMPLEX_FLOAT_TYPE>::max)();
if ((x.real() > m)
|| (x.real() < -m)
|| (x.imag() > m)
|| (x.imag() < -m))
{
// We have an infinity, return a normalized infinity, respecting the sign of the imaginary part:
return complex<BOOST_CSTDFLOAT_EXTENDED_COMPLEX_FLOAT_TYPE>(std::numeric_limits<BOOST_CSTDFLOAT_EXTENDED_COMPLEX_FLOAT_TYPE>::infinity(), x.imag() < 0 ? -0 : 0);
}
return x;
}
inline complex<BOOST_CSTDFLOAT_EXTENDED_COMPLEX_FLOAT_TYPE> polar(const BOOST_CSTDFLOAT_EXTENDED_COMPLEX_FLOAT_TYPE& rho,
const BOOST_CSTDFLOAT_EXTENDED_COMPLEX_FLOAT_TYPE& theta)
{
using std::sin;
using std::cos;
return complex<BOOST_CSTDFLOAT_EXTENDED_COMPLEX_FLOAT_TYPE>(rho * cos(theta), rho * sin(theta));
}
// Global add, sub, mul, div.
inline complex<BOOST_CSTDFLOAT_EXTENDED_COMPLEX_FLOAT_TYPE> operator+(const complex<BOOST_CSTDFLOAT_EXTENDED_COMPLEX_FLOAT_TYPE>& u, const complex<BOOST_CSTDFLOAT_EXTENDED_COMPLEX_FLOAT_TYPE>& v) { return complex<BOOST_CSTDFLOAT_EXTENDED_COMPLEX_FLOAT_TYPE>(u.real() + v.real(), u.imag() + v.imag()); }
inline complex<BOOST_CSTDFLOAT_EXTENDED_COMPLEX_FLOAT_TYPE> operator-(const complex<BOOST_CSTDFLOAT_EXTENDED_COMPLEX_FLOAT_TYPE>& u, const complex<BOOST_CSTDFLOAT_EXTENDED_COMPLEX_FLOAT_TYPE>& v) { return complex<BOOST_CSTDFLOAT_EXTENDED_COMPLEX_FLOAT_TYPE>(u.real() - v.real(), u.imag() - v.imag()); }
inline complex<BOOST_CSTDFLOAT_EXTENDED_COMPLEX_FLOAT_TYPE> operator*(const complex<BOOST_CSTDFLOAT_EXTENDED_COMPLEX_FLOAT_TYPE>& u, const complex<BOOST_CSTDFLOAT_EXTENDED_COMPLEX_FLOAT_TYPE>& v)
{
return complex<BOOST_CSTDFLOAT_EXTENDED_COMPLEX_FLOAT_TYPE>((u.real() * v.real()) - (u.imag() * v.imag()),
(u.real() * v.imag()) + (u.imag() * v.real()));
}
inline complex<BOOST_CSTDFLOAT_EXTENDED_COMPLEX_FLOAT_TYPE> operator/(const complex<BOOST_CSTDFLOAT_EXTENDED_COMPLEX_FLOAT_TYPE>& u, const complex<BOOST_CSTDFLOAT_EXTENDED_COMPLEX_FLOAT_TYPE>& v)
{
const BOOST_CSTDFLOAT_EXTENDED_COMPLEX_FLOAT_TYPE the_norm = std::norm(v);
return complex<BOOST_CSTDFLOAT_EXTENDED_COMPLEX_FLOAT_TYPE>(((u.real() * v.real()) + (u.imag() * v.imag())) / the_norm,
((u.imag() * v.real()) - (u.real() * v.imag())) / the_norm);
}
inline complex<BOOST_CSTDFLOAT_EXTENDED_COMPLEX_FLOAT_TYPE> operator+(const complex<BOOST_CSTDFLOAT_EXTENDED_COMPLEX_FLOAT_TYPE>& u, const BOOST_CSTDFLOAT_EXTENDED_COMPLEX_FLOAT_TYPE& v) { return complex<BOOST_CSTDFLOAT_EXTENDED_COMPLEX_FLOAT_TYPE>(u.real() + v, u.imag()); }
inline complex<BOOST_CSTDFLOAT_EXTENDED_COMPLEX_FLOAT_TYPE> operator-(const complex<BOOST_CSTDFLOAT_EXTENDED_COMPLEX_FLOAT_TYPE>& u, const BOOST_CSTDFLOAT_EXTENDED_COMPLEX_FLOAT_TYPE& v) { return complex<BOOST_CSTDFLOAT_EXTENDED_COMPLEX_FLOAT_TYPE>(u.real() - v, u.imag()); }
inline complex<BOOST_CSTDFLOAT_EXTENDED_COMPLEX_FLOAT_TYPE> operator*(const complex<BOOST_CSTDFLOAT_EXTENDED_COMPLEX_FLOAT_TYPE>& u, const BOOST_CSTDFLOAT_EXTENDED_COMPLEX_FLOAT_TYPE& v) { return complex<BOOST_CSTDFLOAT_EXTENDED_COMPLEX_FLOAT_TYPE>(u.real() * v, u.imag() * v); }
inline complex<BOOST_CSTDFLOAT_EXTENDED_COMPLEX_FLOAT_TYPE> operator/(const complex<BOOST_CSTDFLOAT_EXTENDED_COMPLEX_FLOAT_TYPE>& u, const BOOST_CSTDFLOAT_EXTENDED_COMPLEX_FLOAT_TYPE& v) { return complex<BOOST_CSTDFLOAT_EXTENDED_COMPLEX_FLOAT_TYPE>(u.real() / v, u.imag() / v); }
inline complex<BOOST_CSTDFLOAT_EXTENDED_COMPLEX_FLOAT_TYPE> operator+(const BOOST_CSTDFLOAT_EXTENDED_COMPLEX_FLOAT_TYPE& u, const complex<BOOST_CSTDFLOAT_EXTENDED_COMPLEX_FLOAT_TYPE>& v) { return complex<BOOST_CSTDFLOAT_EXTENDED_COMPLEX_FLOAT_TYPE>(u + v.real(), v.imag()); }
inline complex<BOOST_CSTDFLOAT_EXTENDED_COMPLEX_FLOAT_TYPE> operator-(const BOOST_CSTDFLOAT_EXTENDED_COMPLEX_FLOAT_TYPE& u, const complex<BOOST_CSTDFLOAT_EXTENDED_COMPLEX_FLOAT_TYPE>& v) { return complex<BOOST_CSTDFLOAT_EXTENDED_COMPLEX_FLOAT_TYPE>(u - v.real(), -v.imag()); }
inline complex<BOOST_CSTDFLOAT_EXTENDED_COMPLEX_FLOAT_TYPE> operator*(const BOOST_CSTDFLOAT_EXTENDED_COMPLEX_FLOAT_TYPE& u, const complex<BOOST_CSTDFLOAT_EXTENDED_COMPLEX_FLOAT_TYPE>& v) { return complex<BOOST_CSTDFLOAT_EXTENDED_COMPLEX_FLOAT_TYPE>(u * v.real(), u * v.imag()); }
inline complex<BOOST_CSTDFLOAT_EXTENDED_COMPLEX_FLOAT_TYPE> operator/(const BOOST_CSTDFLOAT_EXTENDED_COMPLEX_FLOAT_TYPE& u, const complex<BOOST_CSTDFLOAT_EXTENDED_COMPLEX_FLOAT_TYPE>& v) { const BOOST_CSTDFLOAT_EXTENDED_COMPLEX_FLOAT_TYPE v_norm = norm(v); return complex<BOOST_CSTDFLOAT_EXTENDED_COMPLEX_FLOAT_TYPE>((u * v.real()) / v_norm, (-u * v.imag()) / v_norm); }
// Unary plus / minus.
inline complex<BOOST_CSTDFLOAT_EXTENDED_COMPLEX_FLOAT_TYPE> operator+(const complex<BOOST_CSTDFLOAT_EXTENDED_COMPLEX_FLOAT_TYPE>& u) { return u; }
inline complex<BOOST_CSTDFLOAT_EXTENDED_COMPLEX_FLOAT_TYPE> operator-(const complex<BOOST_CSTDFLOAT_EXTENDED_COMPLEX_FLOAT_TYPE>& u) { return complex<BOOST_CSTDFLOAT_EXTENDED_COMPLEX_FLOAT_TYPE>(-u.real(), -u.imag()); }
// Equality and inequality.
inline bool operator==(const complex<BOOST_CSTDFLOAT_EXTENDED_COMPLEX_FLOAT_TYPE>& x, const complex<BOOST_CSTDFLOAT_EXTENDED_COMPLEX_FLOAT_TYPE>& y) { return ((x.real() == y.real()) && (x.imag() == y.imag())); }
inline bool operator==(const complex<BOOST_CSTDFLOAT_EXTENDED_COMPLEX_FLOAT_TYPE>& x, const BOOST_CSTDFLOAT_EXTENDED_COMPLEX_FLOAT_TYPE& y) { return ((x.real() == y) && (x.imag() == BOOST_CSTDFLOAT_EXTENDED_COMPLEX_FLOAT_TYPE(0))); }
inline bool operator==(const BOOST_CSTDFLOAT_EXTENDED_COMPLEX_FLOAT_TYPE& x, const complex<BOOST_CSTDFLOAT_EXTENDED_COMPLEX_FLOAT_TYPE>& y) { return ((x == y.real()) && (y.imag() == BOOST_CSTDFLOAT_EXTENDED_COMPLEX_FLOAT_TYPE(0))); }
inline bool operator!=(const complex<BOOST_CSTDFLOAT_EXTENDED_COMPLEX_FLOAT_TYPE>& x, const complex<BOOST_CSTDFLOAT_EXTENDED_COMPLEX_FLOAT_TYPE>& y) { return ((x.real() != y.real()) || (x.imag() != y.imag())); }
inline bool operator!=(const complex<BOOST_CSTDFLOAT_EXTENDED_COMPLEX_FLOAT_TYPE>& x, const BOOST_CSTDFLOAT_EXTENDED_COMPLEX_FLOAT_TYPE& y) { return ((x.real() != y) || (x.imag() != BOOST_CSTDFLOAT_EXTENDED_COMPLEX_FLOAT_TYPE(0))); }
inline bool operator!=(const BOOST_CSTDFLOAT_EXTENDED_COMPLEX_FLOAT_TYPE& x, const complex<BOOST_CSTDFLOAT_EXTENDED_COMPLEX_FLOAT_TYPE>& y) { return ((x != y.real()) || (y.imag() != BOOST_CSTDFLOAT_EXTENDED_COMPLEX_FLOAT_TYPE(0))); }
// ISO/IEC 14882:2011, Section 26.4.8, transcendentals.
inline complex<BOOST_CSTDFLOAT_EXTENDED_COMPLEX_FLOAT_TYPE> sqrt(const complex<BOOST_CSTDFLOAT_EXTENDED_COMPLEX_FLOAT_TYPE>& x)
{
using std::fabs;
using std::sqrt;
// Compute sqrt(x) for x in C:
// sqrt(x) = (s , xi / 2s) : for xr > 0,
// (|xi| / 2s, +-s) : for xr < 0,
// (sqrt(xi), sqrt(xi) : for xr = 0,
// where s = sqrt{ [ |xr| + sqrt(xr^2 + xi^2) ] / 2 },
// and the +- sign is the same as the sign of xi.
if(x.real() > 0)
{
const BOOST_CSTDFLOAT_EXTENDED_COMPLEX_FLOAT_TYPE s = sqrt((fabs(x.real()) + std::abs(x)) / 2);
return complex<BOOST_CSTDFLOAT_EXTENDED_COMPLEX_FLOAT_TYPE>(s, x.imag() / (s * 2));
}
else if(x.real() < 0)
{
const BOOST_CSTDFLOAT_EXTENDED_COMPLEX_FLOAT_TYPE s = sqrt((fabs(x.real()) + std::abs(x)) / 2);
const bool imag_is_neg = (x.imag() < 0);
return complex<BOOST_CSTDFLOAT_EXTENDED_COMPLEX_FLOAT_TYPE>(fabs(x.imag()) / (s * 2), (imag_is_neg ? -s : s));
}
else
{
const BOOST_CSTDFLOAT_EXTENDED_COMPLEX_FLOAT_TYPE sqrt_xi_half = sqrt(x.imag() / 2);
return complex<BOOST_CSTDFLOAT_EXTENDED_COMPLEX_FLOAT_TYPE>(sqrt_xi_half, sqrt_xi_half);
}
}
inline complex<BOOST_CSTDFLOAT_EXTENDED_COMPLEX_FLOAT_TYPE> sin(const complex<BOOST_CSTDFLOAT_EXTENDED_COMPLEX_FLOAT_TYPE>& x)
{
using std::sin;
using std::cos;
using std::exp;
const BOOST_CSTDFLOAT_EXTENDED_COMPLEX_FLOAT_TYPE sin_x = sin (x.real());
const BOOST_CSTDFLOAT_EXTENDED_COMPLEX_FLOAT_TYPE cos_x = cos (x.real());
const BOOST_CSTDFLOAT_EXTENDED_COMPLEX_FLOAT_TYPE exp_yp = exp (x.imag());
const BOOST_CSTDFLOAT_EXTENDED_COMPLEX_FLOAT_TYPE exp_ym = BOOST_CSTDFLOAT_EXTENDED_COMPLEX_FLOAT_TYPE(1) / exp_yp;
const BOOST_CSTDFLOAT_EXTENDED_COMPLEX_FLOAT_TYPE sinh_y = (exp_yp - exp_ym) / 2;
const BOOST_CSTDFLOAT_EXTENDED_COMPLEX_FLOAT_TYPE cosh_y = (exp_yp + exp_ym) / 2;
return complex<BOOST_CSTDFLOAT_EXTENDED_COMPLEX_FLOAT_TYPE>(sin_x * cosh_y, cos_x * sinh_y);
}
inline complex<BOOST_CSTDFLOAT_EXTENDED_COMPLEX_FLOAT_TYPE> cos(const complex<BOOST_CSTDFLOAT_EXTENDED_COMPLEX_FLOAT_TYPE>& x)
{
using std::sin;
using std::cos;
using std::exp;
const BOOST_CSTDFLOAT_EXTENDED_COMPLEX_FLOAT_TYPE sin_x = sin (x.real());
const BOOST_CSTDFLOAT_EXTENDED_COMPLEX_FLOAT_TYPE cos_x = cos (x.real());
const BOOST_CSTDFLOAT_EXTENDED_COMPLEX_FLOAT_TYPE exp_yp = exp (x.imag());
const BOOST_CSTDFLOAT_EXTENDED_COMPLEX_FLOAT_TYPE exp_ym = BOOST_CSTDFLOAT_EXTENDED_COMPLEX_FLOAT_TYPE(1) / exp_yp;
const BOOST_CSTDFLOAT_EXTENDED_COMPLEX_FLOAT_TYPE sinh_y = (exp_yp - exp_ym) / 2;
const BOOST_CSTDFLOAT_EXTENDED_COMPLEX_FLOAT_TYPE cosh_y = (exp_yp + exp_ym) / 2;
return complex<BOOST_CSTDFLOAT_EXTENDED_COMPLEX_FLOAT_TYPE>(cos_x * cosh_y, -(sin_x * sinh_y));
}
inline complex<BOOST_CSTDFLOAT_EXTENDED_COMPLEX_FLOAT_TYPE> tan(const complex<BOOST_CSTDFLOAT_EXTENDED_COMPLEX_FLOAT_TYPE>& x)
{
using std::sin;
using std::cos;
using std::exp;
const BOOST_CSTDFLOAT_EXTENDED_COMPLEX_FLOAT_TYPE sin_x = sin (x.real());
const BOOST_CSTDFLOAT_EXTENDED_COMPLEX_FLOAT_TYPE cos_x = cos (x.real());
const BOOST_CSTDFLOAT_EXTENDED_COMPLEX_FLOAT_TYPE exp_yp = exp (x.imag());
const BOOST_CSTDFLOAT_EXTENDED_COMPLEX_FLOAT_TYPE exp_ym = BOOST_CSTDFLOAT_EXTENDED_COMPLEX_FLOAT_TYPE(1) / exp_yp;
const BOOST_CSTDFLOAT_EXTENDED_COMPLEX_FLOAT_TYPE sinh_y = (exp_yp - exp_ym) / 2;
const BOOST_CSTDFLOAT_EXTENDED_COMPLEX_FLOAT_TYPE cosh_y = (exp_yp + exp_ym) / 2;
return ( complex<BOOST_CSTDFLOAT_EXTENDED_COMPLEX_FLOAT_TYPE>(sin_x * cosh_y, cos_x * sinh_y)
/ complex<BOOST_CSTDFLOAT_EXTENDED_COMPLEX_FLOAT_TYPE>(cos_x * cosh_y, -sin_x * sinh_y));
}
inline complex<BOOST_CSTDFLOAT_EXTENDED_COMPLEX_FLOAT_TYPE> asin(const complex<BOOST_CSTDFLOAT_EXTENDED_COMPLEX_FLOAT_TYPE>& x)
{
return -boost::math::cstdfloat::detail::multiply_by_i(std::log(boost::math::cstdfloat::detail::multiply_by_i(x) + std::sqrt(BOOST_CSTDFLOAT_EXTENDED_COMPLEX_FLOAT_TYPE(1) - (x * x))));
}
inline complex<BOOST_CSTDFLOAT_EXTENDED_COMPLEX_FLOAT_TYPE> acos(const complex<BOOST_CSTDFLOAT_EXTENDED_COMPLEX_FLOAT_TYPE>& x)
{
return boost::math::constants::half_pi<BOOST_CSTDFLOAT_EXTENDED_COMPLEX_FLOAT_TYPE>() - std::asin(x);
}
inline complex<BOOST_CSTDFLOAT_EXTENDED_COMPLEX_FLOAT_TYPE> atan(const complex<BOOST_CSTDFLOAT_EXTENDED_COMPLEX_FLOAT_TYPE>& x)
{
const complex<BOOST_CSTDFLOAT_EXTENDED_COMPLEX_FLOAT_TYPE> izz = boost::math::cstdfloat::detail::multiply_by_i(x);
return boost::math::cstdfloat::detail::multiply_by_i(std::log(BOOST_CSTDFLOAT_EXTENDED_COMPLEX_FLOAT_TYPE(1) - izz) - std::log(BOOST_CSTDFLOAT_EXTENDED_COMPLEX_FLOAT_TYPE(1) + izz)) / 2;
}
inline complex<BOOST_CSTDFLOAT_EXTENDED_COMPLEX_FLOAT_TYPE> exp(const complex<BOOST_CSTDFLOAT_EXTENDED_COMPLEX_FLOAT_TYPE>& x)
{
using std::exp;
return std::polar(exp(x.real()), x.imag());
}
inline complex<BOOST_CSTDFLOAT_EXTENDED_COMPLEX_FLOAT_TYPE> log(const complex<BOOST_CSTDFLOAT_EXTENDED_COMPLEX_FLOAT_TYPE>& x)
{
using std::atan2;
using std::log;
return complex<BOOST_CSTDFLOAT_EXTENDED_COMPLEX_FLOAT_TYPE>(log(std::norm(x)) / 2, atan2(x.imag(), x.real()));
}
inline complex<BOOST_CSTDFLOAT_EXTENDED_COMPLEX_FLOAT_TYPE> log10(const complex<BOOST_CSTDFLOAT_EXTENDED_COMPLEX_FLOAT_TYPE>& x)
{
return std::log(x) / boost::math::constants::ln_ten<BOOST_CSTDFLOAT_EXTENDED_COMPLEX_FLOAT_TYPE>();
}
inline complex<BOOST_CSTDFLOAT_EXTENDED_COMPLEX_FLOAT_TYPE> pow(const complex<BOOST_CSTDFLOAT_EXTENDED_COMPLEX_FLOAT_TYPE>& x,
int p)
{
const bool re_isneg = (x.real() < 0);
const bool re_isnan = (x.real() != x.real());
const bool re_isinf = ((!re_isneg) ? bool(+x.real() > (std::numeric_limits<BOOST_CSTDFLOAT_EXTENDED_COMPLEX_FLOAT_TYPE>::max)())
: bool(-x.real() > (std::numeric_limits<BOOST_CSTDFLOAT_EXTENDED_COMPLEX_FLOAT_TYPE>::max)()));
const bool im_isneg = (x.imag() < 0);
const bool im_isnan = (x.imag() != x.imag());
const bool im_isinf = ((!im_isneg) ? bool(+x.imag() > (std::numeric_limits<BOOST_CSTDFLOAT_EXTENDED_COMPLEX_FLOAT_TYPE>::max)())
: bool(-x.imag() > (std::numeric_limits<BOOST_CSTDFLOAT_EXTENDED_COMPLEX_FLOAT_TYPE>::max)()));
if(re_isnan || im_isnan) { return x; }
if(re_isinf || im_isinf)
{
return complex<BOOST_CSTDFLOAT_EXTENDED_COMPLEX_FLOAT_TYPE>(std::numeric_limits<BOOST_CSTDFLOAT_EXTENDED_COMPLEX_FLOAT_TYPE>::quiet_NaN(),
std::numeric_limits<BOOST_CSTDFLOAT_EXTENDED_COMPLEX_FLOAT_TYPE>::quiet_NaN());
}
if(p < 0)
{
if(std::abs(x) < (std::numeric_limits<BOOST_CSTDFLOAT_EXTENDED_COMPLEX_FLOAT_TYPE>::min)())
{
return complex<BOOST_CSTDFLOAT_EXTENDED_COMPLEX_FLOAT_TYPE>(std::numeric_limits<BOOST_CSTDFLOAT_EXTENDED_COMPLEX_FLOAT_TYPE>::infinity(),
std::numeric_limits<BOOST_CSTDFLOAT_EXTENDED_COMPLEX_FLOAT_TYPE>::infinity());
}
else
{
return BOOST_CSTDFLOAT_EXTENDED_COMPLEX_FLOAT_TYPE(1) / std::pow(x, -p);
}
}
if(p == 0)
{
return complex<BOOST_CSTDFLOAT_EXTENDED_COMPLEX_FLOAT_TYPE>(BOOST_CSTDFLOAT_EXTENDED_COMPLEX_FLOAT_TYPE(1));
}
else
{
if(p == 1) { return x; }
if(std::abs(x) > (std::numeric_limits<BOOST_CSTDFLOAT_EXTENDED_COMPLEX_FLOAT_TYPE>::max)())
{
const BOOST_CSTDFLOAT_EXTENDED_COMPLEX_FLOAT_TYPE re = (re_isneg ? -std::numeric_limits<BOOST_CSTDFLOAT_EXTENDED_COMPLEX_FLOAT_TYPE>::infinity()
: +std::numeric_limits<BOOST_CSTDFLOAT_EXTENDED_COMPLEX_FLOAT_TYPE>::infinity());
const BOOST_CSTDFLOAT_EXTENDED_COMPLEX_FLOAT_TYPE im = (im_isneg ? -std::numeric_limits<BOOST_CSTDFLOAT_EXTENDED_COMPLEX_FLOAT_TYPE>::infinity()
: +std::numeric_limits<BOOST_CSTDFLOAT_EXTENDED_COMPLEX_FLOAT_TYPE>::infinity());
return complex<BOOST_CSTDFLOAT_EXTENDED_COMPLEX_FLOAT_TYPE>(re, im);
}
if (p == 2) { return (x * x); }
else if(p == 3) { return ((x * x) * x); }
else if(p == 4) { const complex<BOOST_CSTDFLOAT_EXTENDED_COMPLEX_FLOAT_TYPE> x2 = (x * x); return (x2 * x2); }
else
{
// The variable xn stores the binary powers of x.
complex<BOOST_CSTDFLOAT_EXTENDED_COMPLEX_FLOAT_TYPE> result(((p % 2) != 0) ? x : complex<BOOST_CSTDFLOAT_EXTENDED_COMPLEX_FLOAT_TYPE>(BOOST_CSTDFLOAT_EXTENDED_COMPLEX_FLOAT_TYPE(1)));
complex<BOOST_CSTDFLOAT_EXTENDED_COMPLEX_FLOAT_TYPE> xn (x);
int p2 = p;
while((p2 /= 2) != 0)
{
// Square xn for each binary power.
xn *= xn;
const bool has_binary_power = ((p2 % 2) != 0);
if(has_binary_power)
{
// Multiply the result with each binary power contained in the exponent.
result *= xn;
}
}
return result;
}
}
}
inline complex<BOOST_CSTDFLOAT_EXTENDED_COMPLEX_FLOAT_TYPE> pow(const complex<BOOST_CSTDFLOAT_EXTENDED_COMPLEX_FLOAT_TYPE>& x,
const BOOST_CSTDFLOAT_EXTENDED_COMPLEX_FLOAT_TYPE& a)
{
return std::exp(a * std::log(x));
}
inline complex<BOOST_CSTDFLOAT_EXTENDED_COMPLEX_FLOAT_TYPE> pow(const complex<BOOST_CSTDFLOAT_EXTENDED_COMPLEX_FLOAT_TYPE>& x,
const complex<BOOST_CSTDFLOAT_EXTENDED_COMPLEX_FLOAT_TYPE>& a)
{
return std::exp(a * std::log(x));
}
inline complex<BOOST_CSTDFLOAT_EXTENDED_COMPLEX_FLOAT_TYPE> pow(const BOOST_CSTDFLOAT_EXTENDED_COMPLEX_FLOAT_TYPE& x,
const complex<BOOST_CSTDFLOAT_EXTENDED_COMPLEX_FLOAT_TYPE>& a)
{
return std::exp(a * std::log(x));
}
inline complex<BOOST_CSTDFLOAT_EXTENDED_COMPLEX_FLOAT_TYPE> sinh(const complex<BOOST_CSTDFLOAT_EXTENDED_COMPLEX_FLOAT_TYPE>& x)
{
using std::sin;
using std::cos;
using std::exp;
const BOOST_CSTDFLOAT_EXTENDED_COMPLEX_FLOAT_TYPE sin_y = sin (x.imag());
const BOOST_CSTDFLOAT_EXTENDED_COMPLEX_FLOAT_TYPE cos_y = cos (x.imag());
const BOOST_CSTDFLOAT_EXTENDED_COMPLEX_FLOAT_TYPE exp_xp = exp (x.real());
const BOOST_CSTDFLOAT_EXTENDED_COMPLEX_FLOAT_TYPE exp_xm = BOOST_CSTDFLOAT_EXTENDED_COMPLEX_FLOAT_TYPE(1) / exp_xp;
const BOOST_CSTDFLOAT_EXTENDED_COMPLEX_FLOAT_TYPE sinh_x = (exp_xp - exp_xm) / 2;
const BOOST_CSTDFLOAT_EXTENDED_COMPLEX_FLOAT_TYPE cosh_x = (exp_xp + exp_xm) / 2;
return complex<BOOST_CSTDFLOAT_EXTENDED_COMPLEX_FLOAT_TYPE>(cos_y * sinh_x, cosh_x * sin_y);
}
inline complex<BOOST_CSTDFLOAT_EXTENDED_COMPLEX_FLOAT_TYPE> cosh(const complex<BOOST_CSTDFLOAT_EXTENDED_COMPLEX_FLOAT_TYPE>& x)
{
using std::sin;
using std::cos;
using std::exp;
const BOOST_CSTDFLOAT_EXTENDED_COMPLEX_FLOAT_TYPE sin_y = sin (x.imag());
const BOOST_CSTDFLOAT_EXTENDED_COMPLEX_FLOAT_TYPE cos_y = cos (x.imag());
const BOOST_CSTDFLOAT_EXTENDED_COMPLEX_FLOAT_TYPE exp_xp = exp (x.real());
const BOOST_CSTDFLOAT_EXTENDED_COMPLEX_FLOAT_TYPE exp_xm = BOOST_CSTDFLOAT_EXTENDED_COMPLEX_FLOAT_TYPE(1) / exp_xp;
const BOOST_CSTDFLOAT_EXTENDED_COMPLEX_FLOAT_TYPE sinh_x = (exp_xp - exp_xm) / 2;
const BOOST_CSTDFLOAT_EXTENDED_COMPLEX_FLOAT_TYPE cosh_x = (exp_xp + exp_xm) / 2;
return complex<BOOST_CSTDFLOAT_EXTENDED_COMPLEX_FLOAT_TYPE>(cos_y * cosh_x, sin_y * sinh_x);
}
inline complex<BOOST_CSTDFLOAT_EXTENDED_COMPLEX_FLOAT_TYPE> tanh(const complex<BOOST_CSTDFLOAT_EXTENDED_COMPLEX_FLOAT_TYPE>& x)
{
const complex<BOOST_CSTDFLOAT_EXTENDED_COMPLEX_FLOAT_TYPE> ex_plus = std::exp(x);
const complex<BOOST_CSTDFLOAT_EXTENDED_COMPLEX_FLOAT_TYPE> ex_minus = BOOST_CSTDFLOAT_EXTENDED_COMPLEX_FLOAT_TYPE(1) / ex_plus;
return (ex_plus - ex_minus) / (ex_plus + ex_minus);
}
inline complex<BOOST_CSTDFLOAT_EXTENDED_COMPLEX_FLOAT_TYPE> asinh(const complex<BOOST_CSTDFLOAT_EXTENDED_COMPLEX_FLOAT_TYPE>& x)
{
return std::log(x + std::sqrt((x * x) + BOOST_CSTDFLOAT_EXTENDED_COMPLEX_FLOAT_TYPE(1)));
}
inline complex<BOOST_CSTDFLOAT_EXTENDED_COMPLEX_FLOAT_TYPE> acosh(const complex<BOOST_CSTDFLOAT_EXTENDED_COMPLEX_FLOAT_TYPE>& x)
{
const BOOST_CSTDFLOAT_EXTENDED_COMPLEX_FLOAT_TYPE my_one(1);
const complex<BOOST_CSTDFLOAT_EXTENDED_COMPLEX_FLOAT_TYPE> zp(x.real() + my_one, x.imag());
const complex<BOOST_CSTDFLOAT_EXTENDED_COMPLEX_FLOAT_TYPE> zm(x.real() - my_one, x.imag());
return std::log(x + (zp * std::sqrt(zm / zp)));
}
inline complex<BOOST_CSTDFLOAT_EXTENDED_COMPLEX_FLOAT_TYPE> atanh(const complex<BOOST_CSTDFLOAT_EXTENDED_COMPLEX_FLOAT_TYPE>& x)
{
return (std::log(BOOST_CSTDFLOAT_EXTENDED_COMPLEX_FLOAT_TYPE(1) + x) - std::log(BOOST_CSTDFLOAT_EXTENDED_COMPLEX_FLOAT_TYPE(1) - x)) / 2.0;
}
template<class char_type, class traits_type>
inline std::basic_ostream<char_type, traits_type>& operator<<(std::basic_ostream<char_type, traits_type>& os, const std::complex<BOOST_CSTDFLOAT_EXTENDED_COMPLEX_FLOAT_TYPE>& x)
{
std::basic_ostringstream<char_type, traits_type> ostr;
ostr.flags(os.flags());
ostr.imbue(os.getloc());
ostr.precision(os.precision());
ostr << char_type('(')
<< x.real()
<< char_type(',')
<< x.imag()
<< char_type(')');
return (os << ostr.str());
}
template<class char_type, class traits_type>
inline std::basic_istream<char_type, traits_type>& operator>>(std::basic_istream<char_type, traits_type>& is, std::complex<BOOST_CSTDFLOAT_EXTENDED_COMPLEX_FLOAT_TYPE>& x)
{
BOOST_CSTDFLOAT_EXTENDED_COMPLEX_FLOAT_TYPE rx;
BOOST_CSTDFLOAT_EXTENDED_COMPLEX_FLOAT_TYPE ix;
char_type the_char;
static_cast<void>(is >> the_char);
if(the_char == static_cast<char_type>('('))
{
static_cast<void>(is >> rx >> the_char);
if(the_char == static_cast<char_type>(','))
{
static_cast<void>(is >> ix >> the_char);
if(the_char == static_cast<char_type>(')'))
{
x = complex<BOOST_CSTDFLOAT_EXTENDED_COMPLEX_FLOAT_TYPE>(rx, ix);
}
else
{
is.setstate(ios_base::failbit);
}
}
else if(the_char == static_cast<char_type>(')'))
{
x = rx;
}
else
{
is.setstate(ios_base::failbit);
}
}
else
{
static_cast<void>(is.putback(the_char));
static_cast<void>(is >> rx);
x = rx;
}
return is;
}
} // namespace std
#endif // _BOOST_CSTDFLOAT_COMPLEX_STD_2014_02_15_HPP_
@@ -0,0 +1,30 @@
subroutine ft8apset(mycall12,mygrid6,hiscall12,hisgrid6,bcontest,apsym,iaptype)
parameter(NAPM=4,KK=87)
character*12 mycall12,hiscall12
character*22 msg,msgsent
character*6 mycall,hiscall
character*6 mygrid6,hisgrid6
character*4 hisgrid
logical bcontest
integer apsym(KK)
integer*1 msgbits(KK)
integer itone(KK)
mycall=mycall12(1:6)
hiscall=hiscall12(1:6)
hisgrid=hisgrid6(1:4)
if(len_trim(hiscall).eq.0) then
iaptype=1
hiscall="K9AN"
else
iaptype=2
endif
hisgrid=hisgrid6(1:4)
! if(len_trim(hisgrid).eq.0) hisgrid="EN50"
if(index(hisgrid," ").eq.0) hisgrid="EN50"
msg=mycall//' '//hiscall//' '//hisgrid
call genft8(msg,mygrid6,bcontest,msgsent,msgbits,itone)
apsym=2*msgbits-1
return
end subroutine ft8apset
@@ -0,0 +1,36 @@
/*==============================================================================
Copyright (c) 2005-2010 Joel de Guzman
Copyright (c) 2010 Thomas Heller
Distributed under the Boost Software License, Version 1.0. (See accompanying
file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
==============================================================================*/
#ifndef BOOST_PHOENIX_OPERATOR_COMPARISON_HPP
#define BOOST_PHOENIX_OPERATOR_COMPARISON_HPP
#include <boost/phoenix/operator/detail/define_operator.hpp>
#include <boost/phoenix/core/expression.hpp>
#include <boost/proto/operators.hpp>
#include <boost/proto/fusion.hpp> // Added to solve bug 6268
namespace boost { namespace phoenix
{
BOOST_PHOENIX_BINARY_OPERATORS(
(equal_to)
(not_equal_to)
(less_equal)
(greater_equal)
(less)
(greater)
)
using proto::exprns_::operator==;
using proto::exprns_::operator!=;
using proto::exprns_::operator<=;
using proto::exprns_::operator>=;
using proto::exprns_::operator<;
using proto::exprns_::operator>;
}}
#include <boost/phoenix/operator/detail/undef_operator.hpp>
#endif
@@ -0,0 +1,38 @@
/*=============================================================================
Copyright (c) 2001-2011 Joel de Guzman
Copyright (c) 2007 Dan Marsden
Distributed under the Boost Software License, Version 1.0. (See accompanying
file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
==============================================================================*/
#if !defined(BOOST_FUSION_APPLY_TRANSFORM_RESULT_02092006_1936)
#define BOOST_FUSION_APPLY_TRANSFORM_RESULT_02092006_1936
#include <boost/fusion/support/config.hpp>
#include <boost/utility/result_of.hpp>
namespace boost { namespace fusion
{
struct void_;
namespace detail
{
template <typename F>
struct apply_transform_result
{
template <typename T0, typename T1 = void_>
struct apply
: boost::result_of<F(T0, T1)>
{};
template <typename T0>
struct apply<T0, void_>
: boost::result_of<F(T0)>
{};
};
}
}}
#endif
File diff suppressed because one or more lines are too long
@@ -0,0 +1,37 @@
/*=============================================================================
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_REMOVE_IF_07162005_0818)
#define FUSION_REMOVE_IF_07162005_0818
#include <boost/fusion/support/config.hpp>
#include <boost/fusion/view/filter_view/filter_view.hpp>
#include <boost/mpl/not.hpp>
#include <boost/type_traits/is_same.hpp>
namespace boost { namespace fusion
{
namespace result_of
{
template <typename Sequence, typename Pred>
struct remove_if
{
typedef filter_view<Sequence, mpl::not_<Pred> > type;
};
}
template <typename Pred, typename Sequence>
BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
inline typename result_of::remove_if<Sequence const, Pred>::type
remove_if(Sequence const& seq)
{
typedef typename result_of::remove_if<Sequence const, Pred>::type result_type;
return result_type(seq);
}
}}
#endif
@@ -0,0 +1,66 @@
/*=============================================================================
Copyright (c) 2016 Kohei Takahashi
Distributed under the Boost Software License, Version 1.0. (See accompanying
file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
==============================================================================*/
#ifndef PHOENIX_BIND_BIND_FUNCTION_HPP
#define PHOENIX_BIND_BIND_FUNCTION_HPP
#include <boost/phoenix/core/limits.hpp>
#if defined(BOOST_PHOENIX_NO_VARIADIC_BIND)
# include <boost/phoenix/bind/detail/cpp03/bind_function.hpp>
#else
#include <boost/phoenix/core/expression.hpp>
#include <boost/phoenix/core/detail/function_eval.hpp>
namespace boost { namespace phoenix
{
namespace detail
{
template <typename RT, typename FP>
struct function_ptr
{
typedef RT result_type;
function_ptr(FP fp_)
: fp(fp_) {}
template <typename... A>
result_type operator()(A&... a) const
{
return fp(a...);
}
bool operator==(function_ptr const& rhs) const
{
return fp == rhs.fp;
}
template <typename RhsRT, typename RhsFP>
bool operator==(function_ptr<RhsRT, RhsFP> const& /*rhs*/) const
{
return false;
}
FP fp;
};
} // namespace boost::phoenix::detail
template <typename RT, typename... T, typename... A>
inline typename detail::expression::function_eval<
detail::function_ptr<RT, RT (*)(T...)>
, A...
>::type const
bind(RT (*f)(T...), A const&... a)
{
typedef detail::function_ptr<RT, RT (*)(T...)> fp_type;
return detail::expression::function_eval<fp_type, A...>::make(fp_type(f), a...);
}
}} // namespace boost::phoenix
#endif
#endif
@@ -0,0 +1,416 @@
__ __ ______ _____ ________ __ __
| \ _ | \ / \ | \| \ | \ | \
| $$ / \ | $$| $$$$$$\ \$$$$$ \$$$$$$$$ | $$ | $$
| $$/ $\| $$| $$___\$$ | $$ | $$ ______ \$$\/ $$
| $$ $$$\ $$ \$$ \ __ | $$ | $$| \ >$$ $$
| $$ $$\$$\$$ _\$$$$$$\| \ | $$ | $$ \$$$$$$/ $$$$\
| $$$$ \$$$$| \__| $$| $$__| $$ | $$ | $$ \$$\
| $$$ \$$$ \$$ $$ \$$ $$ | $$ | $$ | $$
\$$ \$$ \$$$$$$ \$$$$$$ \$$ \$$ \$$
Installing WSJT-X
=================
Binary packages of WSJT-X are available from the project web site:
http://www.physics.princeton.edu/pulsar/K1JT/wsjtx.html
Building from Source
====================
On Linux systems some of the prerequisite libraries are available in
the mainstream distribution repositories. They are Qt v5 and FFTW v3.
For MS Windows see the section "Building from Source on MS Windows"
below. For Apple Mac see the section "Building from Source on Apple
Mac".
Qt v5, preferably v5.1 or later is required to build WSJT-X.
Qt v5 multimedia support and serial port is necessary as well as the
core Qt v5 components, normally installing the Qt multimedia
development package and Qt serialport development package are
sufficient to pull in all the required Qt components and dependants as
a single transaction. On some systems the Qt multimedia plugin
component is separate in the distribution repository an it may also
need installing.
The single precision FFTW v3 library libfftw3f is required along with
the libfftw library development package. Normally installing the
library development package pulls in all the FFTW v3 libraries
including the single precision variant.
The Hamlib library optionally requires the libusb-1.0 library, if the
development version (libusb-1.0-dev) is available Hamlib will
configure its custom USB device back end drivers. Most rigs do not
require this so normally you can choose not to install libusb-1.0-dev
but if you have a SoftRock USB or similar SDR that uses a custom USB
interface then it is required.
The Hamlib library is required. Currently WSJT-X needs to be built
using a forked version of the Hamlib git master. This fork contains
patches not yet accepted by the Hamlib development team which are
essential for correct operation of WSJT-X. To build the Hamlib fork
from sources something like the following recipe should suffice:
$ mkdir ~/hamlib-prefix
$ cd ~/hamlib-prefix
$ git clone git://git.code.sf.net/u/bsomervi/hamlib src
$ cd src
$ git checkout integration
$ ./bootstrap
$ mkdir ../build
$ cd ../build
$ ../src/configure --prefix=$HOME/hamlib-prefix \
--disable-shared --enable-static \
--without-cxx-binding --disable-winradio \
CFLAGS="-g -O2 -fdata-sections -ffunction-sections" \
LDFLAGS="-Wl,--gc-sections"
$ make
$ make install-strip
This will build a binary hamlib package located at ~/hamlib-prefix so
you will need to add that to your CMAKE_PREFIX_PATH variable in your
WSJT-X build. On Linux that is probably the only path you have on
CMAKE_PREFIX_PATH unless you are using a locally installed Qt
installation.
To get the sources either download and extract a source tarball from
the project web site or preferably fetch the sources directly from the
project's subversion repository. The project svn repository has a
non-standard layout in that the WSJT-X project is not on the trunk,
instead the main code line is in a branch at ^/branches/wsjtx
$ mkdir -p ~/wsjtx-prefix/build
$ cd ~/wsjtx-prefix
$ svn checkout svn://svn.code.sf.net/p/wsjt/wsjt/branches/wsjtx src
To build WSJT-X you will need CMake and asciidoc installed.
$ cd ~/wsjtx-prefix/build
$ cmake -D CMAKE_PREFIX_PATH=~/hamlib-prefix ../src
$ cmake --build .
$ cmake --build . --target install
The recipe above will install into /usr by default, if you wish to
install in you own directory you can add a prefix-path to the
configure step like:
$ cd ~/wsjtx-prefix/build
$ cmake -D CMAKE_PREFIX_PATH=~/hamlib-prefix \
-D CMAKE_INSTALL_PREFIX=~/wsjtx-prefix ../src
$ cmake --build .
$ cmake --build . --target install
this will install WSJT-X at ~/wsjtx-prefix.
Building from Source on MS Windows
==================================
Because building on MS Windows is quite complicated there is an
Software Development Kit available that provides all the prerequisite
libraries and tools for building WSJT-X. This SDK is called JT-SDK-QT
which is documented here:
http://physics.princeton.edu/pulsar/K1JT/wsjtx-doc/dev-guide-main.html
If you need to build Hamlib rather than use the Hamlib kit included in
the JT-SDK the following recipe should help. Reasons for building
Hamlib from source might include picking up the very latest patches or
building a different branch that you wish to contribute to.
Hamlib optionally depends upon libusb-1.0, see "Building from Source"
above for more details. If you wish to include support for the
optional custom USB Hamlib rig drivers then you must install
libusb-1.0 before building Hamlib. The package may be obtained from
http://libusb.info/, install it in a convenient location like
C:\Tools.
On Windows there is a complication in that the compilers used to build
Qt and WSJT-X are the MinGW ones bundled with the Qt package but
Hamlib needs to be build from an MSYS shell with the tools required to
build an autotools project. This means that you need to tell the
Hamlib configuration to use the Qt bundled MinGW compilers (if you
don't then the thread support library use by Hamlib will be
incompatible with that used by Qt and WSJT-X). So on Windows the
Hamlib build recipe is something like:
In an MSYS shell:-
$ mkdir ~/hamib-prefix
$ cd ~/hamlib-prefix
$ git clone git://git.code.sf.net/u/bsomervi/hamlib src
$ cd src
$ git checkout integration
$ ./bootstrap
$ mkdir ../build
$ cd ../build
../src/configure --prefix=$HOME/hamlib-prefix \
--disable-shared --enable-static \
--without-cxx-binding --disable-winradio \
CC=<path-to-Qt-MinGW-tools>/gcc \
CXX=<path-to-Qt-MinGW-tools>/g++ \
CFLAGS="-g -O2 -fdata-sections -ffunction-sections -I<path-to-libusb-1.0>/include" \
LDFLAGS="-Wl,--gc-sections" \
LIBUSB_LIBS="-L<path-to-libusb-1.0>/MinGW32/dll -lusb-1.0"
$ make
$ make install
NOTE: <path-to-Qt-MinGQ-tools> should be substituted with the actual
path to your Qt bundled tools e.g on my system it is
C:\Tools\Qt\Tools\mingw530_32\bin
NOTE: <path-to-libusb-1.0> should be substituted with the actual path
to your libusb-1.0 installation directory e.g. on my system it is
C:\Tools\libusb-1.0.20
This will leave a Hamlib binary package installed at
c:/Users/<user-name>/hamlib-prefix which is what needs to be on your
CMAKE_PREFIX_PATH. On Windows you almost certainly will be using a
CMake tool chain file and this is where you will need to specify the
Hamlib binary location as one of the paths in CMAKE_PREFIX_PATH.
Building from Source on Apple Mac
=================================
These instructions are adapted from my Evernote page at:
https://www.evernote.com/pub/bsomervi/wsjt-xmacbuilds
There are several ways to get the required GNU and other open source
tools and libraries installed, my preference is MacPorts because it is
easy to use and does everything we need.
You will need Xcode, MacPorts, CMake and, Qt. The Xcode install
instructions are included in the MacPorts documentation.
MacPorts
--------
Install MacPorts from instructions here:
http://www.macports.org/install.php
More detailed instructions are available in the documentation:
https://guide.macports.org
The ports that need to be installed are:
autoconf
automake
libtool
pkgconfig
texinfo
gcc5
fftw-3-single +gcc5
asciidoc
libusb-devel
These are installed by typing:
$ sudo port install autoconf automake \
libtool pkgconfig texinfo gcc5 asciidoc \
fftw-3-single +gcc5 libusb-devel
Once complete you should have all the tools required to build WSJT-X.
Uninstalling MacPorts
---------------------
If at some point you wish to remove the ports from your machine. The
instructions are here:
https://guide.macports.org/#installing.macports.uninstalling .
Hamlib
------
First fetch hamlib from the repository, in this case my fork of Hamlib
3 until the official repository has all the fixes we need:
$ mkdir -p ~/hamlib-prefix/build
$ cd ~/hamlib-prefix
$ git clone git://git.code.sf.net/u/bsomervi/hamlib src
$ cd src
$ git checkout integration
$ ./bootstrap
The integration branch is my system testing branch which has all my
latest published changes.
To build:
$ cd ~/hamlib-prefix/build
$ ../src/configure \
--enable-static \
--disable-shared \
--disable-winradio \
--prefix=$HOME/hamlib-prefix \
CFLAGS="-g -O2 -mmacosx-version-min=10.7 -I/opt/local/include" \
LIBUSB_LIBS="-L/opt/local/lib -lusb-1.0"
$ make
$ make install-strip
The above commands will build hamlib and install it into
~/hamlib-prefix. If `make install-strip` fails, try `make install`.
Qt
--
NOTE: As of Qt v5.4 building Qt from source on Mac OS X is no longer
necessary since the Qt team have switched to using the modern libc++
Standard C++ Library for all distributable run time
components. Instead you may simply download a binary installer for OS
X 64-bit. The binary installer is here:
http://www.qt.io/download
The binary Qt distributions prior to Qt v5.4 from
http://www.qt.io/download unfortunately are built to use the libstdc++
C++ support library, WSJT-X uses a less geriatric C++ dialect which
uses the libc++ C++ support library. This means that you need to
build Qt from sources. This is not difficult but does take some time.
Download the Qt source tarball from
http://www.qt.io/download-open-source/, the link is about half way
down the page, you want the full sources tar ball shown as a 'tar.gz'
link.
Unpack the sources and cd into the top level directory then type:
$ ./configure -prefix ~/local/qt-macx-clang -opensource \
-confirm-license -platform macx-clang -silent -nomake tests \
-nomake examples -sdk macosx10.10 -skip qtwebkit \
-skip qtwebkit-examples -skip qtquick1 -skip qtconnectivity \
-skip qtlocation -skip qtsensors -skip qtscript \
-skip qtwebsockets -skip qtwebengine -skip qtwebchannel \
-skip qtwayland -skip qtquickcontrols -skip qtdeclarative \
-skip qtxmlpatterns -skip qtenginio
$ make -j4
$ make install
If you are building on 10.8 or don't have the 10.10 Mac SDK (Xcode 6)
available, you can substitute '-sdk macosx10.9' above.
The build above will take a few hours to complete.
CMake
-----
Although CMake is available via MacPorts I prefer to use the binary
installer from cake.org as the MacPorts port doesn't include the
graphical CMake tool cmake-gui which I find quite useful.
Fetch the latest CMake universal 64-bit DMG from
http://www.cmake.org/download/ open the DMG then drag and drop the
application bundle onto the supplied /Applications link.
To complete the install process you need to run the CMake-gui
application as root from a terminal shell as follows:
$ sudo "/Applications/CMake.app/Contents/MacOS/cmake" --install
that installs the CMake command line tools which you can verify by
typing into a terminal window:
$ cmake --version
If the install command above fails with a "No such file or directory"
error, that probably means that /usr/local/bin does not exist. You can
create it correctly with the following commands:
$ sudo mkdir -p /usr/local/bin
$ sudo chmod 755 /usr/local/bin
$ sudo chgrp wheel /usr/local/bin
and then retry the install command.
WSJT-X
------
First fetch the source from the repository:
$ mkdir -p ~/wsjtx-prefix/build
$ cd ~/wsjtx-prefix
$ svn checkout svn://svn.code.sf.net/p/wsjt/wsjt/branches/wsjtx src
this links to the Subversion repository in a read-only fashion, if you
intend to contribute to the project then you probably want to get a
developer login and use a read-write checkout. Even if you don't it
can be upgraded at a later date.
The checkout is of the latest code on the project trunk, i.e. the
development branch. You can easily switch the checkout to another
branch or even a tag if you want to build a prior published
generation. For now we will build the latest development sources. To
configure:
$ cd ~/wsjtx-prefix/build
$ FC=gfortran-mp-5 \
cmake \
-D CMAKE_PREFIX_PATH="~/Qt/5.7/clang_64;~/hamlib-prefix;/opt/local" \
-D CMAKE_INSTALL_PREFIX=~/wsjtx-prefix \
-D CMAKE_OSX_SYSROOT=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.11.sdk \
~/wsjtx-prefix/src
Substitute the Mac OS X SDK version you have installed in the above
command if you have a different version from 10.11.
The CMAKE_PREFIX_PATH variable specifies where CMake should look first
for other packages, the two elements may be different depending where
you have installed Qt and what version you have (~/local/qt-macx-clang
if you have built Qt from sources as described above in the Qt
section) and where you installed Hamlib (i.e. the --prefix configure
option above in the Hamlib section).
If you already have the fftw3-dev package installed on your system it
may well get selected in preference to the one you built above in the
MacPorts installation. It is unlikely that a prior installation of
libfftw3f is correctly configured for use in a WSJT-X package, the
CMAKE_PREFIX_PATH above is augmented with the MacPorts installation
location (/opt/local) to ensure the correct libfftw3f.dylib and
headers are located.
To build:
$ cmake --build .
$ cmake --build . --target install
which installs the WSJT-X application bundle into ~/wsjtx-prefix
Updating and Rebuilding Hamlib
==============================
From time to time new fixes will be pushed to the Hamlib fork
repository integration branch. To pick them up type:
$ cd ~/hamlib-prefix/src
$ git pull
To rebuild hamlib with the changed sources:
$ cd ~/hamlib-prefix/build
$ make
$ make install-strip
Updating and Rebuilding WSJT-X
==============================
To update to the latest sources type:
$ cd ~/wsjtx-prefix/src
$ svn update
$ cd ~/wsjtx-prefix/build
$ cmake --build .
$ cmake --build . --target install
73
Bill
G4WJS.
@@ -0,0 +1,88 @@
// -*- Mode: C++ -*-
#ifndef ASTRO_H
#define ASTRO_H
#include <QDialog>
#include <QScopedPointer>
#include "Radio.hpp"
class QSettings;
class Configuration;
namespace Ui {
class Astro;
}
class Astro final
: public QDialog
{
Q_OBJECT;
public:
using Frequency = Radio::Frequency;
using FrequencyDelta = Radio::FrequencyDelta;
explicit Astro(QSettings * settings, Configuration const *, QWidget * parent = nullptr);
~Astro ();
struct Correction
{
Correction ()
: rx {0}
, tx {0}
{}
Correction (Correction const&) = default;
Correction& operator = (Correction const&) = default;
FrequencyDelta rx;
FrequencyDelta tx;
};
Correction astroUpdate(QDateTime const& t,
QString const& mygrid,
QString const& hisgrid,
Frequency frequency,
bool dx_is_self,
bool bTx,
bool no_tx_QSY,
int TR_period);
bool doppler_tracking () const;
Q_SLOT void nominal_frequency (Frequency rx, Frequency tx);
Q_SIGNAL void tracking_update () const;
protected:
void hideEvent (QHideEvent *) override;
void closeEvent (QCloseEvent *) override;
private slots:
void on_rbConstFreqOnMoon_clicked();
void on_rbFullTrack_clicked();
void on_rbRxOnly_clicked();
void on_rbNoDoppler_clicked();
void on_cbDopplerTracking_toggled(bool);
private:
void read_settings ();
void write_settings ();
void check_split ();
QSettings * settings_;
Configuration const * configuration_;
QScopedPointer<Ui::Astro> ui_;
qint32 m_DopplerMethod;
};
inline
bool operator == (Astro::Correction const& lhs, Astro::Correction const& rhs)
{
return lhs.rx == rhs.rx && lhs.tx == rhs.tx;
}
inline
bool operator != (Astro::Correction const& lhs, Astro::Correction const& rhs)
{
return !(lhs == rhs);
}
#endif // ASTRO_H
@@ -0,0 +1,269 @@
// qra64.h
// Encoding/decoding functions for the QRA64 mode
//
// (c) 2016 - Nico Palermo, IV3NWV
// ------------------------------------------------------------------------------
// This file is part of the qracodes project, a Forward Error Control
// encoding/decoding package based on Q-ary RA (Repeat and Accumulate) LDPC codes.
//
// qracodes is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
// qracodes is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// You should have received a copy of the GNU General Public License
// along with qracodes source distribution.
// If not, see <http://www.gnu.org/licenses/>.
#ifndef _qra64_h_
#define _qra64_h_
// qra64_init(...) initialization flags
#define QRA_NOAP 0 // don't use a-priori knowledge
#define QRA_AUTOAP 1 // use auto a-priori knowledge
#define QRA_USERAP 2 // a-priori knowledge messages provided by the user
// QRA code parameters
#define QRA64_K 12 // information symbols
#define QRA64_N 63 // codeword length
#define QRA64_C 51 // (number of parity checks C=(N-K))
#define QRA64_M 64 // code alphabet size
#define QRA64_m 6 // bits per symbol
// packed predefined callsigns and fields as defined in JT65
#define CALL_CQ 0xFA08319
#define CALL_QRZ 0xFA0831A
#define CALL_CQ000 0xFA0831B
#define CALL_CQ999 0xFA08702
#define CALL_CQDX 0x5624C39
#define CALL_DE 0xFF641D1
#define GRID_BLANK 0x7E91
// Types of a-priori knowledge messages
#define APTYPE_CQQRZ 0 // [cq/qrz ? ?/blank]
#define APTYPE_MYCALL 1 // [mycall ? ?/blank]
#define APTYPE_HISCALL 2 // [? hiscall ?/blank]
#define APTYPE_BOTHCALLS 3 // [mycall hiscall ?]
#define APTYPE_FULL 4 // [mycall hiscall grid]
#define APTYPE_CQHISCALL 5 // [cq/qrz hiscall ?/blank]
#define APTYPE_SIZE (APTYPE_CQHISCALL+1)
typedef struct {
float decEsNoMetric;
int apflags;
int apmsg_set[APTYPE_SIZE]; // indicate which ap type knowledge has
// been set by the user
// ap messages buffers
int apmsg_cqqrz[12]; // [cq/qrz ? ?/blank]
int apmsg_call1[12]; // [mycall ? ?/blank]
int apmsg_call2[12]; // [? hiscall ?/blank]
int apmsg_call1_call2[12]; // [mycall hiscall ?]
int apmsg_call1_call2_grid[12]; // [mycall hiscall grid]
int apmsg_cq_call2[12]; // [cq hiscall ?/blank]
int apmsg_cq_call2_grid[12]; // [cq hiscall grid]
// ap messages masks
int apmask_cqqrz[12];
int apmask_cqqrz_ooo[12];
int apmask_call1[12];
int apmask_call1_ooo[12];
int apmask_call2[12];
int apmask_call2_ooo[12];
int apmask_call1_call2[12];
int apmask_call1_call2_grid[12];
int apmask_cq_call2[12];
int apmask_cq_call2_ooo[12];
} qra64codec;
#ifdef __cplusplus
extern "C" {
#endif
qra64codec *qra64_init(int flags);
// QRA64 mode initialization function
// arguments:
// flags: set the decoder mode
// QRA_NOAP use no a-priori information
// QRA_AUTOAP use any relevant previous decodes
// QRA_USERAP use a-priori information provided via qra64_apset(...)
// returns:
// Pointer to initialized qra64codec data structure
// this pointer should be passed to the encoding/decoding functions
//
// 0 if unsuccessful (can't allocate memory)
// ----------------------------------------------------------------------------
void qra64_encode(qra64codec *pcodec, int *y, const int *x);
// QRA64 encoder
// arguments:
// pcodec = pointer to a qra64codec data structure as returned by qra64_init
// x = pointer to the message to be encoded, int x[12]
// x must point to an array of integers (i.e. defined as int x[12])
// y = pointer to encoded message, int y[63]=
// ----------------------------------------------------------------------------
int qra64_decode(qra64codec *pcodec, float *ebno, int *x, const float *r);
// QRA64 mode decoder
// arguments:
// pcodec = pointer to a qra64codec data structure as returned by qra64_init
// ebno = pointer to a float where the avg Eb/No (in dB) will be stored
// in case of successfull decoding
// (pass a null pointer if not interested)
// x = pointer to decoded message, int x[12]
// r = pointer to received symbol energies (squared amplitudes)
// r must point to an array of length QRA64_M*QRA64_N (=64*63=4032)
// The first QRA_M entries should be the energies of the first
// symbol in the codeword; the last QRA_M entries should be the
// energies of the last symbol in the codeword
//
// return code:
//
// The return code is <0 when decoding is unsuccessful
// -16 indicates that the definition of QRA64_NMSG does not match what required by the code
// If the decoding process is successfull the return code is accordingly to the following table
// rc=0 [? ? ?] AP0 (decoding with no a-priori)
// rc=1 [CQ ? ?] AP27
// rc=2 [CQ ? ] AP44
// rc=3 [CALL ? ?] AP29
// rc=4 [CALL ? ] AP45
// rc=5 [CALL CALL ?] AP57
// rc=6 [? CALL ?] AP29
// rc=7 [? CALL ] AP45
// rc=8 [CALL CALL GRID] AP72 (actually a AP68 mask to reduce false decodes)
// rc=9 [CQ CALL ?] AP55
// rc=10 [CQ CALL ] AP70 (actaully a AP68 mask to reduce false decodes)
// return codes in the range 1-10 indicate the amount and the type of a-priori
// information was required to decode the received message.
// Decode a QRA64 msg using a fast-fading metric
int qra64_decode_fastfading(
qra64codec *pcodec, // ptr to the codec structure
float *ebno, // ptr to where the estimated Eb/No value will be saved
int *x, // ptr to decoded message
const float *rxen, // ptr to received symbol energies array
const int submode, // submode idx (0=QRA64A ... 4=QRA64E)
const float B90, // spread bandwidth (90% fractional energy)
const int fadingModel); // 0=Gaussian 1=Lorentzian fade model
//
// rxen: The array of the received bin energies
// Bins must be spaced by integer multiples of the symbol rate (1/Ts Hz)
// The array must be an array of total length U = L x N where:
// L: is the number of frequency bins per message symbol (see after)
// N: is the number of symbols in a QRA64 msg (63)
//
// The number of bins/symbol L depends on the selected submode accordingly to
// the following rule:
// L = (64+64*2^submode+64) = 64*(2+2^submode)
// Tone 0 is always supposed to be at offset 64 in the array.
// The m-th tone nominal frequency is located at offset 64 + m*2^submode (m=0..63)
//
// Submode A: (2^submode = 1)
// L = 64*3 = 196 bins/symbol
// Total length of the energies array: U = 192*63 = 12096 floats
//
// Submode B: (2^submode = 2)
// L = 64*4 = 256 bins/symbol
// Total length of the energies array: U = 256*63 = 16128 floats
//
// Submode C: (2^submode = 4)
// L = 64*6 = 384 bins/symbol
// Total length of the energies array: U = 384*63 = 24192 floats
//
// Submode D: (2^submode = 8)
// L = 64*10 = 640 bins/symbol
// Total length of the energies array: U = 640*63 = 40320 floats
//
// Submode E: (2^submode = 16)
// L = 64*18 = 1152 bins/symbol
// Total length of the energies array: U = 1152*63 = 72576 floats
//
// Note: The rxen array is modified and reused for internal calculations.
//
//
// B90: spread fading bandwidth in Hz (90% fractional average energy)
//
// B90 should be in the range 1 Hz ... 238 Hz
// The value passed to the call is rounded to the closest value among the
// 64 available values:
// B = 1.09^k Hz, with k=0,1,...,63
//
// I.e. B90=27 Hz will be approximated in this way:
// k = rnd(log(27)/log(1.09)) = 38
// B90 = 1.09^k = 1.09^38 = 26.4 Hz
//
// For any input value the maximum rounding error is not larger than +/- 5%
//
// return codes: same return codes of qra64_decode (+some additional error codes)
// Simulate the fast-fading channel (to be used with qra64_decode_fastfading)
int qra64_fastfading_channel(
float **rxen,
const int *xmsg,
const int submode,
const float EbN0dB,
const float B90,
const int fadingModel);
// Simulate transmission over a fading channel with given B90, fading model and submode
// and non coherent detection.
// Sets rxen to point to an array of bin energies formatted as required
// by the (fast-fading) decoding routine.
// returns 0 on success or negative values on error conditions
int qra64_apset(qra64codec *pcodec, const int mycall, const int hiscall, const int grid, const int aptype);
// Set decoder a-priori knowledge accordingly to the type of the message to
// look up for
// arguments:
// pcodec = pointer to a qra64codec data structure as returned by qra64_init
// mycall = mycall to look for
// hiscall = hiscall to look for
// grid = grid to look for
// aptype = define the type of AP to be set:
// APTYPE_CQQRZ set [cq/qrz ? ?/blank]
// APTYPE_MYCALL set [mycall ? ?/blank]
// APTYPE_HISCALL set [? hiscall ?/blank]
// APTYPE_BOTHCALLS set [mycall hiscall ?]
// APTYPE_FULL set [mycall hiscall grid]
// APTYPE_CQHISCALL set [cq/qrz hiscall ?/blank]
// returns:
// 0 on success
// -1 when qra64_init was called with the QRA_NOAP flag
// -2 invalid apytpe (valid range [APTYPE_CQQRZ..APTYPE_CQHISCALL]
// (APTYPE_CQQRZ [cq/qrz ? ?] is set by default )
void qra64_apdisable(qra64codec *pcodec, const int aptype);
// disable specific AP type
// arguments:
// pcodec = pointer to a qra64codec data structure as returned by qra64_init
// aptype = define the type of AP to be disabled
// APTYPE_CQQRZ disable [cq/qrz ? ?/blank]
// APTYPE_MYCALL disable [mycall ? ?/blank]
// APTYPE_HISCALL disable [ ? hiscall ?/blank]
// APTYPE_BOTHCALLS disable [mycall hiscall ? ]
// APTYPE_FULL disable [mycall hiscall grid]
// APTYPE_CQHISCALL set [cq/qrz hiscall ?/blank]
void qra64_close(qra64codec *pcodec);
// Free memory allocated by qra64_init
// arguments:
// pcodec = pointer to a qra64codec data structure as returned by qra64_init
// ----------------------------------------------------------------------------
// encode/decode std msgs in 12 symbols as done in jt65
void encodemsg_jt65(int *y, const int call1, const int call2, const int grid);
void decodemsg_jt65(int *call1, int *call2, int *grid, const int *x);
#ifdef __cplusplus
}
#endif
#endif // _qra64_h_
@@ -0,0 +1,19 @@
# /* **************************************************************************
# * *
# * (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_PUSH_FRONT_HPP
# define BOOST_PREPROCESSOR_SEQ_PUSH_FRONT_HPP
#
# /* BOOST_PP_SEQ_PUSH_FRONT */
#
# define BOOST_PP_SEQ_PUSH_FRONT(seq, elem) (elem)seq
#
# endif
@@ -0,0 +1,37 @@
// Copyright Nikolay Mladenov 2007.
// 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_PYTHON_OBJECT_PYTHON_TYPE_H
#define BOOST_PYTHON_OBJECT_PYTHON_TYPE_H
#include <boost/python/converter/registered.hpp>
namespace boost {namespace python {namespace detail{
template <class T> struct python_class : PyObject
{
typedef python_class<T> this_type;
typedef T type;
static void *converter (PyObject *p){
return p;
}
static void register_()
{
static bool first_time = true;
if ( !first_time ) return;
first_time = false;
converter::registry::insert(&converter, boost::python::type_id<this_type>(), &converter::registered_pytype_direct<T>::get_pytype);
}
};
}}} //namespace boost :: python :: detail
#endif //BOOST_PYTHON_OBJECT_PYTHON_TYPE_H
@@ -0,0 +1,54 @@
// Status=review
Menus at top of the main window offer many options for configuration
and operation. Most of the items are self-explanatory; a few
additional details are provided below. Keyboard shortcuts for some
frequently used menu items are listed at the right edge of the menu.
==== WSJT-X menu
image::MacAppMenu.png[align="left",alt="Mac App Menu"]
This menu appears on the Macintosh only. *Settings* appears here,
labeled as *Preferences*, rather than on the *File* menu. *About
WSJT-X* appears here rather than on the *Help* menu.
[[FILE_MENU]]
==== File menu
image::file-menu.png[align="left",alt="File Menu"]
[[CONFIG_MENU]]
==== Configuration Menu
image::config-menu.png[align="left",alt="File Menu"]
Many users prefer to create and use entries on the *Configurations*
menu for switching between modes. Simply *Clone* the *Default* entry,
*Rename* it as desired, and then make all desired settings for that
configuration. These settings will be restored whenever you select
that entry.
[[VIEW_MENU]]
==== View Menu
image::view-menu.png[align="left",alt="View Menu"]
[[MODE_MENU]]
==== Mode Menu
image::mode-menu.png[align="left",alt="Mode Menu"]
[[DECODE_MENU]]
==== Decode Menu
image::decode-menu.png[align="left",alt="Decode Menu"]
[[SAVE_MENU]]
[[SAVE-WAV]]
==== Save Menu
image::save-menu.png[align="left",alt="Save Menu"]
[[HELP_MENU]]
==== Help Menu
image::help-menu.png[align="left",alt="Help Menu"]
===== Keyboard Shortcuts (F3)
image::keyboard-shortcuts.png[align="left",alt="Keyboard Shortcuts"]
===== Special Mouse Commands (F5)
image::special-mouse-commands.png[align="left",alt="Special Mouse Commands"]
@@ -0,0 +1,101 @@
/*=============================================================================
Copyright (c) 2003 Jonathan de Halleux (dehalleux@pelikhan.com)
http://spirit.sourceforge.net/
Distributed under the Boost Software License, Version 1.0. (See accompanying
file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
=============================================================================*/
#ifndef BOOST_SPIRIT_ACTOR_PUSH_BACK_ACTOR_HPP
#define BOOST_SPIRIT_ACTOR_PUSH_BACK_ACTOR_HPP
#include <boost/spirit/home/classic/namespace.hpp>
#include <boost/spirit/home/classic/actor/ref_value_actor.hpp>
#include <boost/spirit/home/classic/actor/ref_const_ref_actor.hpp>
namespace boost { namespace spirit {
BOOST_SPIRIT_CLASSIC_NAMESPACE_BEGIN
///////////////////////////////////////////////////////////////////////////
// Summary:
//
// A semantic action policy that appends a value to the back of a
// container.
// (This doc uses convention available in actors.hpp)
//
// Actions (what it does and what ref, value_ref must support):
// ref.push_back( value );
// ref.push_back( T::value_type(first,last) );
// ref.push_back( value_ref );
//
// Policy name:
// push_back_action
//
// Policy holder, corresponding helper method:
// ref_value_actor, push_back_a( ref );
// ref_const_ref_actor, push_back_a( ref, value_ref );
//
// () operators: both
//
// See also ref_value_actor and ref_const_ref_actor for more details.
///////////////////////////////////////////////////////////////////////////
struct push_back_action
{
template<
typename T,
typename ValueT
>
void act(T& ref_, ValueT const& value_) const
{
ref_.push_back( value_ );
}
template<
typename T,
typename IteratorT
>
void act(
T& ref_,
IteratorT const& first_,
IteratorT const& last_
) const
{
typedef typename T::value_type value_type;
value_type value(first_,last_);
ref_.push_back( value );
}
};
// Deprecated interface. Use push_back_a
template<typename T>
inline ref_value_actor<T,push_back_action>
append(T& ref_)
{
return ref_value_actor<T,push_back_action>(ref_);
}
template<typename T>
inline ref_value_actor<T,push_back_action>
push_back_a(T& ref_)
{
return ref_value_actor<T,push_back_action>(ref_);
}
template<
typename T,
typename ValueT
>
inline ref_const_ref_actor<T,ValueT,push_back_action>
push_back_a(
T& ref_,
ValueT const& value_
)
{
return ref_const_ref_actor<T,ValueT,push_back_action>(ref_,value_);
}
BOOST_SPIRIT_CLASSIC_NAMESPACE_END
}}
#endif
@@ -0,0 +1,143 @@
#if !defined(BOOST_PROTO_DONT_USE_PREPROCESSED_FILES)
#include <boost/proto/transform/detail/preprocessed/fold_impl.hpp>
#elif !defined(BOOST_PP_IS_ITERATING)
#define BOOST_PROTO_CHILD_N_TYPE(N) \
BOOST_PP_CAT(proto_child, N) \
/**/
#define BOOST_PROTO_FOLD_STATE_TYPE(Z, N, DATA) \
typedef \
typename when<_, Fun>::template impl< \
typename result_of::child_c<Expr, N>::type \
, BOOST_PP_CAT(state, N) \
, Data \
>::result_type \
BOOST_PP_CAT(state, BOOST_PP_INC(N)); \
/**/
#define BOOST_PROTO_FOLD_STATE(Z, N, DATA) \
BOOST_PP_CAT(state, BOOST_PP_INC(N)) \
BOOST_PP_CAT(s, BOOST_PP_INC(N)) \
= typename when<_, Fun>::template impl< \
typename result_of::child_c<Expr, N>::type \
, BOOST_PP_CAT(state, N) \
, Data \
>()( \
proto::child_c<N>(e) \
, BOOST_PP_CAT(s, N) \
, d \
); \
/**/
#define BOOST_PROTO_REVERSE_FOLD_STATE_TYPE(Z, N, DATA) \
typedef \
typename when<_, Fun>::template impl< \
typename result_of::child_c< \
Expr \
, BOOST_PP_SUB(DATA, BOOST_PP_INC(N)) \
>::type \
, BOOST_PP_CAT(state, BOOST_PP_SUB(DATA, N)) \
, Data \
>::result_type \
BOOST_PP_CAT(state, BOOST_PP_SUB(DATA, BOOST_PP_INC(N))); \
/**/
#define BOOST_PROTO_REVERSE_FOLD_STATE(Z, N, DATA) \
BOOST_PP_CAT(state, BOOST_PP_SUB(DATA, BOOST_PP_INC(N))) \
BOOST_PP_CAT(s, BOOST_PP_SUB(DATA, BOOST_PP_INC(N))) \
= typename when<_, Fun>::template impl< \
typename result_of::child_c< \
Expr \
, BOOST_PP_SUB(DATA, BOOST_PP_INC(N)) \
>::type \
, BOOST_PP_CAT(state, BOOST_PP_SUB(DATA, N)) \
, Data \
>()( \
proto::child_c<BOOST_PP_SUB(DATA, BOOST_PP_INC(N))>(e) \
, BOOST_PP_CAT(s, BOOST_PP_SUB(DATA, N)) \
, d \
); \
/**/
#if defined(__WAVE__) && defined(BOOST_PROTO_CREATE_PREPROCESSED_FILES)
#pragma wave option(preserve: 2, line: 0, output: "preprocessed/fold_impl.hpp")
#endif
///////////////////////////////////////////////////////////////////////////////
/// \file fold_impl.hpp
/// Contains definition of fold_impl<> and reverse_fold_impl<> templates.
//
// Copyright 2008 Eric Niebler. Distributed under the Boost
// Software License, Version 1.0. (See accompanying file
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
#if defined(__WAVE__) && defined(BOOST_PROTO_CREATE_PREPROCESSED_FILES)
#pragma wave option(preserve: 1)
#endif
#define BOOST_PP_ITERATION_PARAMS_1 \
(3, (1, BOOST_PROTO_MAX_ARITY, <boost/proto/transform/detail/fold_impl.hpp>))
#include BOOST_PP_ITERATE()
#if defined(__WAVE__) && defined(BOOST_PROTO_CREATE_PREPROCESSED_FILES)
#pragma wave option(output: null)
#endif
#undef BOOST_PROTO_REVERSE_FOLD_STATE
#undef BOOST_PROTO_REVERSE_FOLD_STATE_TYPE
#undef BOOST_PROTO_FOLD_STATE
#undef BOOST_PROTO_FOLD_STATE_TYPE
#undef BOOST_PROTO_CHILD_N_TYPE
#else
#define N BOOST_PP_ITERATION()
template<typename State0, typename Fun, typename Expr, typename State, typename Data>
struct fold_impl<State0, Fun, Expr, State, Data, N>
: transform_impl<Expr, State, Data>
{
typedef typename when<_, State0>::template impl<Expr, State, Data>::result_type state0;
BOOST_PP_REPEAT(N, BOOST_PROTO_FOLD_STATE_TYPE, N)
typedef BOOST_PP_CAT(state, N) result_type;
result_type operator ()(
typename fold_impl::expr_param e
, typename fold_impl::state_param s
, typename fold_impl::data_param d
) const
{
state0 s0 =
typename when<_, State0>::template impl<Expr, State, Data>()(e, s, d);
BOOST_PP_REPEAT(N, BOOST_PROTO_FOLD_STATE, N)
return BOOST_PP_CAT(s, N);
}
};
template<typename State0, typename Fun, typename Expr, typename State, typename Data>
struct reverse_fold_impl<State0, Fun, Expr, State, Data, N>
: transform_impl<Expr, State, Data>
{
typedef typename when<_, State0>::template impl<Expr, State, Data>::result_type BOOST_PP_CAT(state, N);
BOOST_PP_REPEAT(N, BOOST_PROTO_REVERSE_FOLD_STATE_TYPE, N)
typedef state0 result_type;
result_type operator ()(
typename reverse_fold_impl::expr_param e
, typename reverse_fold_impl::state_param s
, typename reverse_fold_impl::data_param d
) const
{
BOOST_PP_CAT(state, N) BOOST_PP_CAT(s, N) =
typename when<_, State0>::template impl<Expr, State, Data>()(e, s, d);
BOOST_PP_REPEAT(N, BOOST_PROTO_REVERSE_FOLD_STATE, N)
return s0;
}
};
#undef N
#endif
@@ -0,0 +1,293 @@
// Copyright 2008 Gautam Sewani
// Copyright 2008 John Maddock
//
// Use, modification and distribution are subject to the
// Boost Software License, Version 1.0.
// (See accompanying file LICENSE_1_0.txt
// or copy at http://www.boost.org/LICENSE_1_0.txt)
#ifndef BOOST_MATH_DISTRIBUTIONS_HYPERGEOMETRIC_HPP
#define BOOST_MATH_DISTRIBUTIONS_HYPERGEOMETRIC_HPP
#include <boost/math/distributions/detail/common_error_handling.hpp>
#include <boost/math/distributions/complement.hpp>
#include <boost/math/distributions/detail/hypergeometric_pdf.hpp>
#include <boost/math/distributions/detail/hypergeometric_cdf.hpp>
#include <boost/math/distributions/detail/hypergeometric_quantile.hpp>
#include <boost/math/special_functions/fpclassify.hpp>
namespace boost { namespace math {
template <class RealType = double, class Policy = policies::policy<> >
class hypergeometric_distribution
{
public:
typedef RealType value_type;
typedef Policy policy_type;
hypergeometric_distribution(unsigned r, unsigned n, unsigned N) // Constructor.
: m_n(n), m_N(N), m_r(r)
{
static const char* function = "boost::math::hypergeometric_distribution<%1%>::hypergeometric_distribution";
RealType ret;
check_params(function, &ret);
}
// Accessor functions.
unsigned total()const
{
return m_N;
}
unsigned defective()const
{
return m_r;
}
unsigned sample_count()const
{
return m_n;
}
bool check_params(const char* function, RealType* result)const
{
if(m_r > m_N)
{
*result = boost::math::policies::raise_domain_error<RealType>(
function, "Parameter r out of range: must be <= N but got %1%", static_cast<RealType>(m_r), Policy());
return false;
}
if(m_n > m_N)
{
*result = boost::math::policies::raise_domain_error<RealType>(
function, "Parameter n out of range: must be <= N but got %1%", static_cast<RealType>(m_n), Policy());
return false;
}
return true;
}
bool check_x(unsigned x, const char* function, RealType* result)const
{
if(x < static_cast<unsigned>((std::max)(0, (int)(m_n + m_r) - (int)(m_N))))
{
*result = boost::math::policies::raise_domain_error<RealType>(
function, "Random variable out of range: must be > 0 and > m + r - N but got %1%", static_cast<RealType>(x), Policy());
return false;
}
if(x > (std::min)(m_r, m_n))
{
*result = boost::math::policies::raise_domain_error<RealType>(
function, "Random variable out of range: must be less than both n and r but got %1%", static_cast<RealType>(x), Policy());
return false;
}
return true;
}
private:
// Data members:
unsigned m_n; // number of items picked
unsigned m_N; // number of "total" items
unsigned m_r; // number of "defective" items
}; // class hypergeometric_distribution
typedef hypergeometric_distribution<double> hypergeometric;
template <class RealType, class Policy>
inline const std::pair<unsigned, unsigned> range(const hypergeometric_distribution<RealType, Policy>& dist)
{ // Range of permissible values for random variable x.
#ifdef BOOST_MSVC
# pragma warning(push)
# pragma warning(disable:4267)
#endif
unsigned r = dist.defective();
unsigned n = dist.sample_count();
unsigned N = dist.total();
unsigned l = static_cast<unsigned>((std::max)(0, (int)(n + r) - (int)(N)));
unsigned u = (std::min)(r, n);
return std::pair<unsigned, unsigned>(l, u);
#ifdef BOOST_MSVC
# pragma warning(pop)
#endif
}
template <class RealType, class Policy>
inline const std::pair<unsigned, unsigned> support(const hypergeometric_distribution<RealType, Policy>& d)
{
return range(d);
}
template <class RealType, class Policy>
inline RealType pdf(const hypergeometric_distribution<RealType, Policy>& dist, const unsigned& x)
{
static const char* function = "boost::math::pdf(const hypergeometric_distribution<%1%>&, const %1%&)";
RealType result = 0;
if(!dist.check_params(function, &result))
return result;
if(!dist.check_x(x, function, &result))
return result;
return boost::math::detail::hypergeometric_pdf<RealType>(
x, dist.defective(), dist.sample_count(), dist.total(), Policy());
}
template <class RealType, class Policy, class U>
inline RealType pdf(const hypergeometric_distribution<RealType, Policy>& dist, const U& x)
{
BOOST_MATH_STD_USING
static const char* function = "boost::math::pdf(const hypergeometric_distribution<%1%>&, const %1%&)";
RealType r = static_cast<RealType>(x);
unsigned u = itrunc(r, typename policies::normalise<Policy, policies::rounding_error<policies::ignore_error> >::type());
if(u != r)
{
return boost::math::policies::raise_domain_error<RealType>(
function, "Random variable out of range: must be an integer but got %1%", r, Policy());
}
return pdf(dist, u);
}
template <class RealType, class Policy>
inline RealType cdf(const hypergeometric_distribution<RealType, Policy>& dist, const unsigned& x)
{
static const char* function = "boost::math::cdf(const hypergeometric_distribution<%1%>&, const %1%&)";
RealType result = 0;
if(!dist.check_params(function, &result))
return result;
if(!dist.check_x(x, function, &result))
return result;
return boost::math::detail::hypergeometric_cdf<RealType>(
x, dist.defective(), dist.sample_count(), dist.total(), false, Policy());
}
template <class RealType, class Policy, class U>
inline RealType cdf(const hypergeometric_distribution<RealType, Policy>& dist, const U& x)
{
BOOST_MATH_STD_USING
static const char* function = "boost::math::cdf(const hypergeometric_distribution<%1%>&, const %1%&)";
RealType r = static_cast<RealType>(x);
unsigned u = itrunc(r, typename policies::normalise<Policy, policies::rounding_error<policies::ignore_error> >::type());
if(u != r)
{
return boost::math::policies::raise_domain_error<RealType>(
function, "Random variable out of range: must be an integer but got %1%", r, Policy());
}
return cdf(dist, u);
}
template <class RealType, class Policy>
inline RealType cdf(const complemented2_type<hypergeometric_distribution<RealType, Policy>, unsigned>& c)
{
static const char* function = "boost::math::cdf(const hypergeometric_distribution<%1%>&, const %1%&)";
RealType result = 0;
if(!c.dist.check_params(function, &result))
return result;
if(!c.dist.check_x(c.param, function, &result))
return result;
return boost::math::detail::hypergeometric_cdf<RealType>(
c.param, c.dist.defective(), c.dist.sample_count(), c.dist.total(), true, Policy());
}
template <class RealType, class Policy, class U>
inline RealType cdf(const complemented2_type<hypergeometric_distribution<RealType, Policy>, U>& c)
{
BOOST_MATH_STD_USING
static const char* function = "boost::math::cdf(const hypergeometric_distribution<%1%>&, const %1%&)";
RealType r = static_cast<RealType>(c.param);
unsigned u = itrunc(r, typename policies::normalise<Policy, policies::rounding_error<policies::ignore_error> >::type());
if(u != r)
{
return boost::math::policies::raise_domain_error<RealType>(
function, "Random variable out of range: must be an integer but got %1%", r, Policy());
}
return cdf(complement(c.dist, u));
}
template <class RealType, class Policy>
inline RealType quantile(const hypergeometric_distribution<RealType, Policy>& dist, const RealType& p)
{
BOOST_MATH_STD_USING // for ADL of std functions
// Checking function argument
RealType result = 0;
const char* function = "boost::math::quantile(const hypergeometric_distribution<%1%>&, %1%)";
if (false == dist.check_params(function, &result)) return result;
if(false == detail::check_probability(function, p, &result, Policy())) return result;
return static_cast<RealType>(detail::hypergeometric_quantile(p, RealType(1 - p), dist.defective(), dist.sample_count(), dist.total(), Policy()));
} // quantile
template <class RealType, class Policy>
inline RealType quantile(const complemented2_type<hypergeometric_distribution<RealType, Policy>, RealType>& c)
{
BOOST_MATH_STD_USING // for ADL of std functions
// Checking function argument
RealType result = 0;
const char* function = "quantile(const complemented2_type<hypergeometric_distribution<%1%>, %1%>&)";
if (false == c.dist.check_params(function, &result)) return result;
if(false == detail::check_probability(function, c.param, &result, Policy())) return result;
return static_cast<RealType>(detail::hypergeometric_quantile(RealType(1 - c.param), c.param, c.dist.defective(), c.dist.sample_count(), c.dist.total(), Policy()));
} // quantile
template <class RealType, class Policy>
inline RealType mean(const hypergeometric_distribution<RealType, Policy>& dist)
{
return static_cast<RealType>(dist.defective() * dist.sample_count()) / dist.total();
} // RealType mean(const hypergeometric_distribution<RealType, Policy>& dist)
template <class RealType, class Policy>
inline RealType variance(const hypergeometric_distribution<RealType, Policy>& dist)
{
RealType r = static_cast<RealType>(dist.defective());
RealType n = static_cast<RealType>(dist.sample_count());
RealType N = static_cast<RealType>(dist.total());
return n * r * (N - r) * (N - n) / (N * N * (N - 1));
} // RealType variance(const hypergeometric_distribution<RealType, Policy>& dist)
template <class RealType, class Policy>
inline RealType mode(const hypergeometric_distribution<RealType, Policy>& dist)
{
BOOST_MATH_STD_USING
RealType r = static_cast<RealType>(dist.defective());
RealType n = static_cast<RealType>(dist.sample_count());
RealType N = static_cast<RealType>(dist.total());
return floor((r + 1) * (n + 1) / (N + 2));
}
template <class RealType, class Policy>
inline RealType skewness(const hypergeometric_distribution<RealType, Policy>& dist)
{
BOOST_MATH_STD_USING
RealType r = static_cast<RealType>(dist.defective());
RealType n = static_cast<RealType>(dist.sample_count());
RealType N = static_cast<RealType>(dist.total());
return (N - 2 * r) * sqrt(N - 1) * (N - 2 * n) / (sqrt(n * r * (N - r) * (N - n)) * (N - 2));
} // RealType skewness(const hypergeometric_distribution<RealType, Policy>& dist)
template <class RealType, class Policy>
inline RealType kurtosis_excess(const hypergeometric_distribution<RealType, Policy>& dist)
{
RealType r = static_cast<RealType>(dist.defective());
RealType n = static_cast<RealType>(dist.sample_count());
RealType N = static_cast<RealType>(dist.total());
RealType t1 = N * N * (N - 1) / (r * (N - 2) * (N - 3) * (N - r));
RealType t2 = (N * (N + 1) - 6 * N * (N - r)) / (n * (N - n))
+ 3 * r * (N - r) * (N + 6) / (N * N) - 6;
return t1 * t2;
} // RealType kurtosis_excess(const hypergeometric_distribution<RealType, Policy>& dist)
template <class RealType, class Policy>
inline RealType kurtosis(const hypergeometric_distribution<RealType, Policy>& dist)
{
return kurtosis_excess(dist) + 3;
} // RealType kurtosis_excess(const hypergeometric_distribution<RealType, Policy>& dist)
}} // namespaces
// 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 // include guard
@@ -0,0 +1,19 @@
# /* Copyright (C) 2001
# * Housemarque Oy
# * http://www.housemarque.com
# *
# * Distributed under the Boost Software License, Version 1.0. (See
# * accompanying file LICENSE_1_0.txt or copy at
# * http://www.boost.org/LICENSE_1_0.txt)
# */
#
# /* Revised by Paul Mensonides (2002) */
#
# /* See http://www.boost.org/libs/preprocessor for documentation. */
#
# ifndef BOOST_PREPROCESSOR_HPP
# define BOOST_PREPROCESSOR_HPP
#
# include <boost/preprocessor/library.hpp>
#
# endif
@@ -0,0 +1,106 @@
// Copyright David Abrahams 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)
#ifndef CAST_DWA200269_HPP
# define CAST_DWA200269_HPP
# include <boost/python/detail/prefix.hpp>
# include <boost/type_traits/same_traits.hpp>
# include <boost/type_traits/cv_traits.hpp>
# include <boost/type.hpp>
# include <boost/python/base_type_traits.hpp>
# include <boost/python/detail/convertible.hpp>
namespace boost { namespace python {
namespace detail
{
template <class Source, class Target> inline Target* upcast_impl(Source*, Target*);
template <class Source, class Target>
inline Target* upcast(Source* p, yes_convertible, no_convertible, Target*)
{
return p;
}
template <class Source, class Target>
inline Target* upcast(Source* p, no_convertible, no_convertible, Target*)
{
typedef typename base_type_traits<Source>::type base;
return detail::upcast_impl((base*)p, (Target*)0);
}
template <bool is_same = true>
struct upcaster
{
template <class T>
static inline T* execute(T* x, T*) { return x; }
};
template <>
struct upcaster<false>
{
template <class Source, class Target>
static inline Target* execute(Source* x, Target*)
{
return detail::upcast(
x, detail::convertible<Target*>::check(x)
, detail::convertible<Source*>::check((Target*)0)
, (Target*)0);
}
};
template <class Target, class Source>
inline Target* downcast(Source* p, yes_convertible)
{
return static_cast<Target*>(p);
}
template <class Target, class Source>
inline Target* downcast(Source* p, no_convertible, boost::type<Target>* = 0)
{
typedef typename base_type_traits<Source>::type base;
return (Target*)detail::downcast<base>(p, convertible<Source*>::check((base*)0));
}
template <class T>
inline void assert_castable(boost::type<T>* = 0)
{
typedef char must_be_a_complete_type[sizeof(T)] BOOST_ATTRIBUTE_UNUSED;
}
template <class Source, class Target>
inline Target* upcast_impl(Source* x, Target*)
{
typedef typename add_cv<Source>::type src_t;
typedef typename add_cv<Target>::type target_t;
bool const same = is_same<src_t,target_t>::value;
return detail::upcaster<same>::execute(x, (Target*)0);
}
}
template <class Target, class Source>
inline Target* upcast(Source* x, Target* = 0)
{
detail::assert_castable<Source>();
detail::assert_castable<Target>();
return detail::upcast_impl(x, (Target*)0);
}
template <class Target, class Source>
inline Target* downcast(Source* x, Target* = 0)
{
detail::assert_castable<Source>();
detail::assert_castable<Target>();
return detail::downcast<Target>(x, detail::convertible<Source*>::check((Target*)0));
}
}} // namespace boost::python
#endif // CAST_DWA200269_HPP
@@ -0,0 +1,120 @@
// (C) Copyright John Maddock 2007.
// Use, modification and distribution are subject to the
// Boost Software License, Version 1.0. (See accompanying file
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
//
// This file is machine generated, do not edit by hand
// Polynomial evaluation using Horners rule
#ifndef BOOST_MATH_TOOLS_POLY_EVAL_16_HPP
#define BOOST_MATH_TOOLS_POLY_EVAL_16_HPP
namespace boost{ namespace math{ namespace tools{ namespace detail{
template <class T, class V>
inline V evaluate_polynomial_c_imp(const T*, const V&, const mpl::int_<0>*) BOOST_MATH_NOEXCEPT(V)
{
return static_cast<V>(0);
}
template <class T, class V>
inline V evaluate_polynomial_c_imp(const T* a, const V&, const mpl::int_<1>*) BOOST_MATH_NOEXCEPT(V)
{
return static_cast<V>(a[0]);
}
template <class T, class V>
inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<2>*) BOOST_MATH_NOEXCEPT(V)
{
return static_cast<V>(a[1] * x + a[0]);
}
template <class T, class V>
inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<3>*) BOOST_MATH_NOEXCEPT(V)
{
return static_cast<V>((a[2] * x + a[1]) * x + a[0]);
}
template <class T, class V>
inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<4>*) BOOST_MATH_NOEXCEPT(V)
{
return static_cast<V>(((a[3] * x + a[2]) * x + a[1]) * x + a[0]);
}
template <class T, class V>
inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<5>*) BOOST_MATH_NOEXCEPT(V)
{
return static_cast<V>((((a[4] * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]);
}
template <class T, class V>
inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<6>*) BOOST_MATH_NOEXCEPT(V)
{
return static_cast<V>(((((a[5] * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]);
}
template <class T, class V>
inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<7>*) BOOST_MATH_NOEXCEPT(V)
{
return static_cast<V>((((((a[6] * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]);
}
template <class T, class V>
inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<8>*) BOOST_MATH_NOEXCEPT(V)
{
return static_cast<V>(((((((a[7] * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]);
}
template <class T, class V>
inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<9>*) BOOST_MATH_NOEXCEPT(V)
{
return static_cast<V>((((((((a[8] * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]);
}
template <class T, class V>
inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<10>*) BOOST_MATH_NOEXCEPT(V)
{
return static_cast<V>(((((((((a[9] * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]);
}
template <class T, class V>
inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<11>*) BOOST_MATH_NOEXCEPT(V)
{
return static_cast<V>((((((((((a[10] * x + a[9]) * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]);
}
template <class T, class V>
inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<12>*) BOOST_MATH_NOEXCEPT(V)
{
return static_cast<V>(((((((((((a[11] * x + a[10]) * x + a[9]) * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]);
}
template <class T, class V>
inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<13>*) BOOST_MATH_NOEXCEPT(V)
{
return static_cast<V>((((((((((((a[12] * x + a[11]) * x + a[10]) * x + a[9]) * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]);
}
template <class T, class V>
inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<14>*) BOOST_MATH_NOEXCEPT(V)
{
return static_cast<V>(((((((((((((a[13] * x + a[12]) * x + a[11]) * x + a[10]) * x + a[9]) * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]);
}
template <class T, class V>
inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<15>*) BOOST_MATH_NOEXCEPT(V)
{
return static_cast<V>((((((((((((((a[14] * x + a[13]) * x + a[12]) * x + a[11]) * x + a[10]) * x + a[9]) * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]);
}
template <class T, class V>
inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<16>*) BOOST_MATH_NOEXCEPT(V)
{
return static_cast<V>(((((((((((((((a[15] * x + a[14]) * x + a[13]) * x + a[12]) * x + a[11]) * x + a[10]) * x + a[9]) * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]);
}
}}}} // namespaces
#endif // include guard
@@ -0,0 +1,20 @@
// (C) Copyright Steve Cleary, Beman Dawes, Howard Hinnant & John Maddock 2000.
// Use, modification and distribution are subject to the Boost Software License,
// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt).
//
// See http://www.boost.org/libs/utility for most recent version including documentation.
// See boost/detail/call_traits.hpp
// for full copyright notices.
#ifndef BOOST_CALL_TRAITS_HPP
#define BOOST_CALL_TRAITS_HPP
#ifndef BOOST_CONFIG_HPP
#include <boost/config.hpp>
#endif
#include <boost/detail/call_traits.hpp>
#endif // BOOST_CALL_TRAITS_HPP
@@ -0,0 +1,20 @@
// These instructions are up-to-date for WSJT-X v1.4
*OS X 10.7* and later: Download the file {osx} to your desktop,
double-click on it and consult its `ReadMe` file for important
installation notes.
If you have already installed a previous version, you can retain it by
changing its name in the *Applications* folder (say, from _WSJT-X_ to
_WSJT-X_1.6_). You can then proceed to the installation phase.
Take note also of the following:
* Use the Mac's *Audio MIDI Setup* utility to configure your sound
card for 48000 Hz, two-channel, 16-bit format.
* Use *System Preferences* to select an external time source to keep
your system clock synchronized to UTC.
* To uninstall simply drag the _WSJT-X_ application from *Applications*
to the *Trash Can*.
@@ -0,0 +1,181 @@
// Copyright 2005 Alexander Nasonov.
// 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 FILE_boost_type_traits_integral_promotion_hpp_INCLUDED
#define FILE_boost_type_traits_integral_promotion_hpp_INCLUDED
#include <boost/config.hpp>
#include <boost/type_traits/integral_constant.hpp>
#include <boost/type_traits/is_const.hpp>
#include <boost/type_traits/is_enum.hpp>
#include <boost/type_traits/is_volatile.hpp>
#include <boost/type_traits/remove_cv.hpp>
namespace boost {
namespace type_traits { namespace detail {
// 4.5/2
template <class T> struct need_promotion : public boost::is_enum<T> {};
// 4.5/1
template<> struct need_promotion<char > : public true_type {};
template<> struct need_promotion<signed char > : public true_type {};
template<> struct need_promotion<unsigned char > : public true_type {};
template<> struct need_promotion<signed short int > : public true_type {};
template<> struct need_promotion<unsigned short int> : public true_type {};
// Specializations for non-standard types.
// Type is promoted if it's smaller then int.
#define BOOST_TT_AUX_PROMOTE_NONSTANDARD_TYPE(T) \
template<> struct need_promotion<T> \
: public integral_constant<bool, (sizeof(T) < sizeof(int))> {};
// Same set of integral types as in boost/type_traits/is_integral.hpp.
// Please, keep in sync.
#if (defined(BOOST_INTEL_CXX_VERSION) && defined(_MSC_VER) && (BOOST_INTEL_CXX_VERSION <= 600)) \
|| (defined(__BORLANDC__) && (__BORLANDC__ == 0x600) && (_MSC_VER < 1300))
// TODO: common macro for this #if. Or better yet, PP SEQ of non-standard types.
BOOST_TT_AUX_PROMOTE_NONSTANDARD_TYPE(__int8 )
BOOST_TT_AUX_PROMOTE_NONSTANDARD_TYPE(unsigned __int8 )
BOOST_TT_AUX_PROMOTE_NONSTANDARD_TYPE(__int16 )
BOOST_TT_AUX_PROMOTE_NONSTANDARD_TYPE(unsigned __int16)
BOOST_TT_AUX_PROMOTE_NONSTANDARD_TYPE(__int32 )
BOOST_TT_AUX_PROMOTE_NONSTANDARD_TYPE(unsigned __int32)
#ifdef __BORLANDC__
BOOST_TT_AUX_PROMOTE_NONSTANDARD_TYPE(unsigned __int64)
BOOST_TT_AUX_PROMOTE_NONSTANDARD_TYPE( __int64)
#endif
#endif
#if defined(BOOST_HAS_LONG_LONG)
BOOST_TT_AUX_PROMOTE_NONSTANDARD_TYPE(boost::ulong_long_type)
BOOST_TT_AUX_PROMOTE_NONSTANDARD_TYPE(boost::long_long_type )
#elif defined(BOOST_HAS_MS_INT64)
BOOST_TT_AUX_PROMOTE_NONSTANDARD_TYPE(unsigned __int64)
BOOST_TT_AUX_PROMOTE_NONSTANDARD_TYPE( __int64)
#endif
#undef BOOST_TT_AUX_PROMOTE_NONSTANDARD_TYPE
#ifndef BOOST_NO_INTRINSIC_WCHAR_T
// 4.5/2
template<> struct need_promotion<wchar_t> : public true_type {};
#endif
// 4.5/3 (integral bit-field) is not supported.
// 4.5/4
template<> struct need_promotion<bool> : public true_type {};
// Get promoted type by index and cv qualifiers.
template<int Index, int IsConst, int IsVolatile> struct promote_from_index;
#define BOOST_TT_AUX_PROMOTE_FROM_INDEX(N,T) \
template<> struct promote_from_index<N,0,0> { typedef T type; }; \
template<> struct promote_from_index<N,0,1> { typedef T volatile type; }; \
template<> struct promote_from_index<N,1,0> { typedef T const type; }; \
template<> struct promote_from_index<N,1,1> { typedef T const volatile type; };
BOOST_TT_AUX_PROMOTE_FROM_INDEX(1, int )
BOOST_TT_AUX_PROMOTE_FROM_INDEX(2, unsigned int )
BOOST_TT_AUX_PROMOTE_FROM_INDEX(3, long )
BOOST_TT_AUX_PROMOTE_FROM_INDEX(4, unsigned long)
// WARNING: integral promotions to non-standard types
// long long and __int64 are not defined by the standard.
// Additional specialisations and overloads shouldn't
// introduce ambiguity, though.
#if defined(BOOST_HAS_LONG_LONG)
BOOST_TT_AUX_PROMOTE_FROM_INDEX(5, boost::long_long_type )
BOOST_TT_AUX_PROMOTE_FROM_INDEX(6, boost::ulong_long_type)
#elif defined(BOOST_HAS_MS_INT64)
BOOST_TT_AUX_PROMOTE_FROM_INDEX(7, __int64 )
BOOST_TT_AUX_PROMOTE_FROM_INDEX(8, unsigned __int64)
#endif
#undef BOOST_TT_AUX_PROMOTE_FROM_INDEX
// Define BOOST_TT_AUX_PROMOTED_INDEX_TESTER:
#if !defined(BOOST_MSVC)
template<int N>
struct sized_type_for_promotion
{
typedef char (&type)[N];
};
#define BOOST_TT_AUX_PROMOTED_INDEX_TESTER(I,T) \
sized_type_for_promotion<I>::type promoted_index_tester(T);
#else
#define BOOST_TT_AUX_PROMOTED_INDEX_TESTER(I,T) \
char (&promoted_index_tester(T))[I];
#endif
BOOST_TT_AUX_PROMOTED_INDEX_TESTER(1, int )
BOOST_TT_AUX_PROMOTED_INDEX_TESTER(2, unsigned int )
BOOST_TT_AUX_PROMOTED_INDEX_TESTER(3, long )
BOOST_TT_AUX_PROMOTED_INDEX_TESTER(4, unsigned long)
#if defined(BOOST_HAS_LONG_LONG)
BOOST_TT_AUX_PROMOTED_INDEX_TESTER(5, boost::long_long_type )
BOOST_TT_AUX_PROMOTED_INDEX_TESTER(6, boost::ulong_long_type)
#elif defined(BOOST_HAS_MS_INT64)
BOOST_TT_AUX_PROMOTED_INDEX_TESTER(7, __int64 )
BOOST_TT_AUX_PROMOTED_INDEX_TESTER(8, unsigned __int64)
#endif
#undef BOOST_TT_AUX_PROMOTED_INDEX_TESTER
// Get an index of promoted type for type T.
// Precondition: need_promotion<T>
template<class T>
struct promoted_index
{
static T testee; // undefined
BOOST_STATIC_CONSTANT(int, value = sizeof(promoted_index_tester(+testee)) );
// Unary plus promotes testee LOOK HERE ---> ^
};
template<class T>
struct integral_promotion_impl
{
typedef BOOST_DEDUCED_TYPENAME promote_from_index<
(boost::type_traits::detail::promoted_index<T>::value)
, (boost::is_const<T>::value)
, (boost::is_volatile<T>::value)
>::type type;
};
template<class T, bool b> struct integral_promotion { typedef T type; };
template<class T> struct integral_promotion<T, true> : public integral_promotion_impl<T>{};
} }
template <class T> struct integral_promotion
{
private:
typedef boost::type_traits::detail::need_promotion<typename remove_cv<T>::type> tag_type;
public:
typedef typename boost::type_traits::detail::integral_promotion<T, tag_type::value>::type type;
};
}
#endif // #ifndef FILE_boost_type_traits_integral_promotion_hpp_INCLUDED
@@ -0,0 +1,19 @@
#ifndef BOOST_MPL_MIN_HPP_INCLUDED
#define BOOST_MPL_MIN_HPP_INCLUDED
// Copyright Aleksey Gurtovoy 2004
//
// Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
//
// See http://www.boost.org/libs/mpl for documentation.
// $Id$
// $Date$
// $Revision$
#include <boost/mpl/min_max.hpp>
#endif // BOOST_MPL_MIN_HPP_INCLUDED
@@ -0,0 +1,738 @@
// (C) Copyright Gennadiy Rozental 2001.
// Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
// See http://www.boost.org/libs/test for the library home page.
//
// File : $RCSfile$
//
// Version : $Revision$
//
// Description : class basic_cstring wraps C string and provide std_string like
// interface
// ***************************************************************************
#ifndef BOOST_TEST_UTILS_BASIC_CSTRING_HPP
#define BOOST_TEST_UTILS_BASIC_CSTRING_HPP
// Boost.Test
#include <boost/test/utils/basic_cstring/basic_cstring_fwd.hpp>
#include <boost/test/utils/basic_cstring/bcs_char_traits.hpp>
// Boost
#include <boost/type_traits/remove_cv.hpp>
// STL
#include <string>
#include <boost/test/detail/suppress_warnings.hpp>
//____________________________________________________________________________//
namespace boost {
namespace unit_test {
// ************************************************************************** //
// ************** basic_cstring ************** //
// ************************************************************************** //
template<typename CharT>
class basic_cstring {
typedef basic_cstring<CharT> self_type;
public:
// Subtypes
typedef ut_detail::bcs_char_traits<CharT> traits_type;
typedef typename ut_detail::bcs_char_traits<CharT>::std_string std_string;
typedef CharT value_type;
typedef typename remove_cv<value_type>::type value_ret_type;
typedef value_type* pointer;
typedef value_type const* const_pointer;
typedef value_type& reference;
typedef const value_type& const_reference;
typedef std::size_t size_type;
typedef std::ptrdiff_t difference_type;
typedef value_type const* const_iterator;
typedef value_type* iterator;
// !! should also present reverse_iterator, const_reverse_iterator
#if !BOOST_WORKAROUND(__IBMCPP__, BOOST_TESTED_AT(600))
enum npos_type { npos = static_cast<size_type>(-1) };
#else
// IBM/VisualAge version 6 is not able to handle enums larger than 4 bytes.
// But size_type is 8 bytes in 64bit mode.
static const size_type npos = -1 ;
#endif
static pointer null_str();
// Constructors; default copy constructor is generated by compiler
basic_cstring();
basic_cstring( std_string const& s );
basic_cstring( pointer s );
template<typename LenType>
basic_cstring( pointer s, LenType len ) : m_begin( s ), m_end( m_begin + len ) {}
basic_cstring( pointer first, pointer last );
// data access methods
value_ret_type operator[]( size_type index ) const;
value_ret_type at( size_type index ) const;
// size operators
size_type size() const;
bool is_empty() const;
void clear();
void resize( size_type new_len );
// !! only for STL container conformance use is_empty instead
bool empty() const;
// Trimming
self_type& trim_right( size_type trim_size );
self_type& trim_left( size_type trim_size );
self_type& trim_right( iterator it );
self_type& trim_left( iterator it );
#if !BOOST_WORKAROUND(__IBMCPP__, BOOST_TESTED_AT(800))
self_type& trim_left( self_type exclusions = self_type() ) ;
self_type& trim_right( self_type exclusions = self_type() ) ;
self_type& trim( self_type exclusions = self_type() ) ;
#else
// VA C++/XL C++ v6 and v8 has in this case a problem with the default arguments.
self_type& trim_left( self_type exclusions );
self_type& trim_right( self_type exclusions );
self_type& trim( self_type exclusions );
self_type& trim_left() { return trim_left( self_type() ); }
self_type& trim_right() { return trim_right( self_type() ); }
self_type& trim() { return trim( self_type() ); }
#endif
// Assignment operators
basic_cstring& operator=( self_type const& s );
basic_cstring& operator=( std_string const& s );
basic_cstring& operator=( pointer s );
template<typename CharT2>
basic_cstring& assign( basic_cstring<CharT2> const& s )
{
return *this = basic_cstring<CharT>( s.begin(), s.end() );
}
template<typename PosType, typename LenType>
basic_cstring& assign( self_type const& s, PosType pos, LenType len )
{
return *this = self_type( s.m_begin + pos, len );
}
basic_cstring& assign( std_string const& s );
template<typename PosType, typename LenType>
basic_cstring& assign( std_string const& s, PosType pos, LenType len )
{
return *this = self_type( s.c_str() + pos, len );
}
basic_cstring& assign( pointer s );
template<typename LenType>
basic_cstring& assign( pointer s, LenType len )
{
return *this = self_type( s, len );
}
basic_cstring& assign( pointer f, pointer l );
// swapping
void swap( self_type& s );
// Iterators
iterator begin();
const_iterator begin() const;
iterator end();
const_iterator end() const;
// !! should have rbegin, rend
// substring search operation
size_type find( basic_cstring ) const;
size_type rfind( basic_cstring ) const;
self_type substr( size_type beg_index, size_type end_index = npos ) const;
private:
static self_type default_trim_ex();
// Data members
iterator m_begin;
iterator m_end;
};
//____________________________________________________________________________//
template<typename CharT>
inline typename basic_cstring<CharT>::pointer
basic_cstring<CharT>::null_str()
{
static CharT null = 0;
return &null;
}
//____________________________________________________________________________//
template<typename CharT>
inline
basic_cstring<CharT>::basic_cstring()
: m_begin( null_str() )
, m_end( m_begin )
{
}
//____________________________________________________________________________//
template<typename CharT>
inline
basic_cstring<CharT>::basic_cstring( std_string const& s )
: m_begin( s.c_str() )
, m_end( m_begin + s.size() )
{
}
//____________________________________________________________________________//
template<typename CharT>
inline
basic_cstring<CharT>::basic_cstring( pointer s )
: m_begin( s ? s : null_str() )
, m_end ( m_begin + (s ? traits_type::length( s ) : 0 ) )
{
}
//____________________________________________________________________________//
template<typename CharT>
inline
basic_cstring<CharT>::basic_cstring( pointer first, pointer last )
: m_begin( first )
, m_end( last )
{
}
//____________________________________________________________________________//
template<typename CharT>
inline typename basic_cstring<CharT>::value_ret_type
basic_cstring<CharT>::operator[]( size_type index ) const
{
return m_begin[index];
}
//____________________________________________________________________________//
template<typename CharT>
inline typename basic_cstring<CharT>::value_ret_type
basic_cstring<CharT>::at( size_type index ) const
{
if( m_begin + index >= m_end )
return static_cast<value_type>(0);
return m_begin[index];
}
//____________________________________________________________________________//
template<typename CharT>
inline typename basic_cstring<CharT>::size_type
basic_cstring<CharT>::size() const
{
return static_cast<size_type>(m_end - m_begin);
}
//____________________________________________________________________________//
template<typename CharT>
inline bool
basic_cstring<CharT>::is_empty() const
{
return m_end == m_begin;
}
//____________________________________________________________________________//
template<typename CharT>
inline bool
basic_cstring<CharT>::empty() const
{
return is_empty();
}
//____________________________________________________________________________//
template<typename CharT>
inline void
basic_cstring<CharT>::clear()
{
m_begin = m_end;
}
//____________________________________________________________________________//
template<typename CharT>
inline void
basic_cstring<CharT>::resize( size_type new_len )
{
if( m_begin + new_len < m_end )
m_end = m_begin + new_len;
}
//____________________________________________________________________________//
template<typename CharT>
inline basic_cstring<CharT>&
basic_cstring<CharT>::trim_left( size_type trim_size )
{
m_begin += trim_size;
if( m_end <= m_begin )
clear();
return *this;
}
//____________________________________________________________________________//
template<typename CharT>
inline basic_cstring<CharT>&
basic_cstring<CharT>::trim_left( iterator it )
{
m_begin = it;
if( m_end <= m_begin )
clear();
return *this;
}
//____________________________________________________________________________//
template<typename CharT>
inline basic_cstring<CharT>&
basic_cstring<CharT>::trim_left( basic_cstring exclusions )
{
if( exclusions.is_empty() )
exclusions = default_trim_ex();
iterator it;
for( it = begin(); it != end(); ++it ) {
if( traits_type::find( exclusions.begin(), exclusions.size(), *it ) == reinterpret_cast<pointer>(0) )
break;
}
return trim_left( it );
}
//____________________________________________________________________________//
template<typename CharT>
inline basic_cstring<CharT>&
basic_cstring<CharT>::trim_right( size_type trim_size )
{
m_end -= trim_size;
if( m_end <= m_begin )
clear();
return *this;
}
//____________________________________________________________________________//
template<typename CharT>
inline basic_cstring<CharT>&
basic_cstring<CharT>::trim_right( iterator it )
{
m_end = it;
if( m_end <= m_begin )
clear();
return *this;
}
//____________________________________________________________________________//
template<typename CharT>
inline basic_cstring<CharT>&
basic_cstring<CharT>::trim_right( basic_cstring exclusions )
{
if( exclusions.is_empty() )
exclusions = default_trim_ex();
iterator it;
for( it = end()-1; it != begin()-1; --it ) {
if( self_type::traits_type::find( exclusions.begin(), exclusions.size(), *it ) == reinterpret_cast<pointer>(0) )
break;
}
return trim_right( it+1 );
}
//____________________________________________________________________________//
template<typename CharT>
inline basic_cstring<CharT>&
basic_cstring<CharT>::trim( basic_cstring exclusions )
{
trim_left( exclusions );
trim_right( exclusions );
return *this;
}
//____________________________________________________________________________//
template<typename CharT>
inline basic_cstring<CharT>&
basic_cstring<CharT>::operator=( basic_cstring<CharT> const& s )
{
m_begin = s.m_begin;
m_end = s.m_end;
return *this;
}
//____________________________________________________________________________//
template<typename CharT>
inline basic_cstring<CharT>&
basic_cstring<CharT>::operator=( std_string const& s )
{
return *this = self_type( s );
}
//____________________________________________________________________________//
template<typename CharT>
inline basic_cstring<CharT>&
basic_cstring<CharT>::operator=( pointer s )
{
return *this = self_type( s );
}
//____________________________________________________________________________//
template<typename CharT>
inline basic_cstring<CharT>&
basic_cstring<CharT>::assign( std_string const& s )
{
return *this = self_type( s );
}
//____________________________________________________________________________//
template<typename CharT>
inline basic_cstring<CharT>&
basic_cstring<CharT>::assign( pointer s )
{
return *this = self_type( s );
}
//____________________________________________________________________________//
template<typename CharT>
inline basic_cstring<CharT>&
basic_cstring<CharT>::assign( pointer f, pointer l )
{
return *this = self_type( f, l );
}
//____________________________________________________________________________//
template<typename CharT>
inline void
basic_cstring<CharT>::swap( basic_cstring<CharT>& s )
{
// do not want to include alogrithm
pointer tmp1 = m_begin;
pointer tmp2 = m_end;
m_begin = s.m_begin;
m_end = s.m_end;
s.m_begin = tmp1;
s.m_end = tmp2;
}
//____________________________________________________________________________//
template<typename CharT>
inline typename basic_cstring<CharT>::iterator
basic_cstring<CharT>::begin()
{
return m_begin;
}
//____________________________________________________________________________//
template<typename CharT>
inline typename basic_cstring<CharT>::const_iterator
basic_cstring<CharT>::begin() const
{
return m_begin;
}
//____________________________________________________________________________//
template<typename CharT>
inline typename basic_cstring<CharT>::iterator
basic_cstring<CharT>::end()
{
return m_end;
}
//____________________________________________________________________________//
template<typename CharT>
inline typename basic_cstring<CharT>::const_iterator
basic_cstring<CharT>::end() const
{
return m_end;
}
//____________________________________________________________________________//
template<typename CharT>
inline typename basic_cstring<CharT>::size_type
basic_cstring<CharT>::find( basic_cstring<CharT> str ) const
{
if( str.is_empty() || str.size() > size() )
return static_cast<size_type>(npos);
const_iterator it = begin();
const_iterator last = end() - str.size() + 1;
while( it != last ) {
if( traits_type::compare( it, str.begin(), str.size() ) == 0 )
break;
++it;
}
return it == last ? npos : static_cast<size_type>(it - begin());
}
//____________________________________________________________________________//
template<typename CharT>
inline typename basic_cstring<CharT>::size_type
basic_cstring<CharT>::rfind( basic_cstring<CharT> str ) const
{
if( str.is_empty() || str.size() > size() )
return static_cast<size_type>(npos);
const_iterator it = end() - str.size();
const_iterator last = begin()-1;
while( it != last ) {
if( traits_type::compare( it, str.begin(), str.size() ) == 0 )
break;
--it;
}
return it == last ? static_cast<size_type>(npos) : static_cast<size_type>(it - begin());
}
//____________________________________________________________________________//
template<typename CharT>
inline basic_cstring<CharT>
basic_cstring<CharT>::substr( size_type beg_index, size_type end_index ) const
{
return beg_index > size()
? self_type()
: end_index > size()
? self_type( m_begin + beg_index, m_end )
: self_type( m_begin + beg_index, m_begin + end_index );
}
//____________________________________________________________________________//
template<typename CharT>
inline basic_cstring<CharT>
basic_cstring<CharT>::default_trim_ex()
{
static CharT ws[3] = { CharT(' '), CharT('\t'), CharT('\n') }; // !! wide case
return self_type( ws, 3 );
}
//____________________________________________________________________________//
// ************************************************************************** //
// ************** comparison operators ************** //
// ************************************************************************** //
template<typename CharT1,typename CharT2>
inline bool
operator==( basic_cstring<CharT1> const& s1, basic_cstring<CharT2> const& s2 )
{
typedef typename basic_cstring<CharT1>::traits_type traits_type;
return s1.size() == s2.size() &&
traits_type::compare( s1.begin(), s2.begin(), s1.size() ) == 0;
}
//____________________________________________________________________________//
template<typename CharT1,typename CharT2>
inline bool
operator==( basic_cstring<CharT1> const& s1, CharT2* s2 )
{
#if !defined(__DMC__)
return s1 == basic_cstring<CharT2>( s2 );
#else
return s1 == basic_cstring<CharT2 const>( s2 );
#endif
}
//____________________________________________________________________________//
template<typename CharT>
inline bool
operator==( basic_cstring<CharT> const& s1, typename basic_cstring<CharT>::std_string const& s2 )
{
return s1 == basic_cstring<CharT>( s2 );
}
//____________________________________________________________________________//
template<typename CharT1,typename CharT2>
inline bool
operator==( CharT1* s2, basic_cstring<CharT2> const& s1 )
{
return s1 == s2;
}
//____________________________________________________________________________//
template<typename CharT>
inline bool
operator==( typename basic_cstring<CharT>::std_string const& s2, basic_cstring<CharT> const& s1 )
{
return s1 == s2;
}
//____________________________________________________________________________//
template<typename CharT>
inline bool
operator!=( basic_cstring<CharT> const& s1, CharT* s2 )
{
return !(s1 == s2);
}
//____________________________________________________________________________//
template<typename CharT>
inline bool
operator!=( CharT* s2, basic_cstring<CharT> const& s1 )
{
return !(s1 == s2);
}
//____________________________________________________________________________//
template<typename CharT>
inline bool
operator!=( basic_cstring<CharT> const& s1, basic_cstring<CharT> const& s2 )
{
return !(s1 == s2);
}
//____________________________________________________________________________//
template<typename CharT>
inline bool
operator!=( basic_cstring<CharT> const& s1, typename basic_cstring<CharT>::std_string const& s2 )
{
return !(s1 == s2);
}
//____________________________________________________________________________//
template<typename CharT>
inline bool
operator!=( typename basic_cstring<CharT>::std_string const& s2, basic_cstring<CharT> const& s1 )
{
return !(s1 == s2);
}
//____________________________________________________________________________//
// ************************************************************************** //
// ************** first_char ************** //
// ************************************************************************** //
template<typename CharT>
inline typename basic_cstring<CharT>::value_ret_type
first_char( basic_cstring<CharT> source )
{
typedef typename basic_cstring<CharT>::value_ret_type res_type;
return source.is_empty() ? static_cast<res_type>(0) : *source.begin();
}
//____________________________________________________________________________//
// ************************************************************************** //
// ************** last_char ************** //
// ************************************************************************** //
template<typename CharT>
inline typename basic_cstring<CharT>::value_ret_type
last_char( basic_cstring<CharT> source )
{
typedef typename basic_cstring<CharT>::value_ret_type res_type;
return source.is_empty() ? static_cast<res_type>(0) : *(source.end()-1);
}
//____________________________________________________________________________//
// ************************************************************************** //
// ************** assign_op ************** //
// ************************************************************************** //
template<typename CharT1, typename CharT2>
inline void
assign_op( std::basic_string<CharT1>& target, basic_cstring<CharT2> src, int )
{
target.assign( src.begin(), src.size() );
}
//____________________________________________________________________________//
template<typename CharT1, typename CharT2>
inline std::basic_string<CharT1>&
operator+=( std::basic_string<CharT1>& target, basic_cstring<CharT2> const& str )
{
target.append( str.begin(), str.end() );
return target;
}
//____________________________________________________________________________//
template<typename CharT1, typename CharT2>
inline std::basic_string<CharT1>
operator+( std::basic_string<CharT1> const& lhs, basic_cstring<CharT2> const& rhs )
{
std::basic_string<CharT1> res( lhs );
res.append( rhs.begin(), rhs.end() );
return res;
}
//____________________________________________________________________________//
} // namespace unit_test
} // namespace boost
//____________________________________________________________________________//
#include <boost/test/detail/enable_warnings.hpp>
#endif // BOOST_TEST_UTILS_BASIC_CSTRING_HPP
@@ -0,0 +1,25 @@
/*==============================================================================
Copyright (c) 2011 Hartmut Kaiser
Distributed under the Boost Software License, Version 1.0. (See accompanying
file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
==============================================================================*/
#if !defined(BOOST_PHOENIX_PREPROCESSED_ACTOR_RESULT_OF)
#define BOOST_PHOENIX_PREPROCESSED_ACTOR_RESULT_OF
#if BOOST_PHOENIX_LIMIT <= 10
#include <boost/phoenix/core/detail/cpp03/preprocessed/actor_result_of_10.hpp>
#elif BOOST_PHOENIX_LIMIT <= 20
#include <boost/phoenix/core/detail/cpp03/preprocessed/actor_result_of_20.hpp>
#elif BOOST_PHOENIX_LIMIT <= 30
#include <boost/phoenix/core/detail/cpp03/preprocessed/actor_result_of_30.hpp>
#elif BOOST_PHOENIX_LIMIT <= 40
#include <boost/phoenix/core/detail/cpp03/preprocessed/actor_result_of_40.hpp>
#elif BOOST_PHOENIX_LIMIT <= 50
#include <boost/phoenix/core/detail/cpp03/preprocessed/actor_result_of_50.hpp>
#else
#error "BOOST_PHOENIX_LIMIT out of bounds for preprocessed headers"
#endif
#endif