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,20 @@
/*=============================================================================
Copyright (c) 2001-2011 Joel de Guzman
Copyright (c) 2005-2006 Dan Marsden
Copyright (c) 2009-2010 Christopher Schmidt
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_FUSION_ADAPTED_STD_PAIR_HPP
#define BOOST_FUSION_ADAPTED_STD_PAIR_HPP
#include <boost/fusion/support/config.hpp>
#include <boost/fusion/adapted/struct/adapt_struct.hpp>
#include <utility>
BOOST_FUSION_ADAPT_TPL_STRUCT(
(T1)(T2),(std::pair)(T1)(T2),(T1, first)(T2, second))
#endif
@@ -0,0 +1,167 @@
#include "MessageAggregatorMainWindow.hpp"
#include <QtWidgets>
#include <QDateTime>
#include "DecodesModel.hpp"
#include "BeaconsModel.hpp"
#include "ClientWidget.hpp"
using port_type = MessageServer::port_type;
namespace
{
char const * const headings[] = {
QT_TRANSLATE_NOOP ("MessageAggregatorMainWindow", "Time On"),
QT_TRANSLATE_NOOP ("MessageAggregatorMainWindow", "Time Off"),
QT_TRANSLATE_NOOP ("MessageAggregatorMainWindow", "Callsign"),
QT_TRANSLATE_NOOP ("MessageAggregatorMainWindow", "Grid"),
QT_TRANSLATE_NOOP ("MessageAggregatorMainWindow", "Name"),
QT_TRANSLATE_NOOP ("MessageAggregatorMainWindow", "Frequency"),
QT_TRANSLATE_NOOP ("MessageAggregatorMainWindow", "Mode"),
QT_TRANSLATE_NOOP ("MessageAggregatorMainWindow", "Sent"),
QT_TRANSLATE_NOOP ("MessageAggregatorMainWindow", "Rec'd"),
QT_TRANSLATE_NOOP ("MessageAggregatorMainWindow", "Power"),
QT_TRANSLATE_NOOP ("MessageAggregatorMainWindow", "Comments"),
};
}
MessageAggregatorMainWindow::MessageAggregatorMainWindow ()
: log_ {new QStandardItemModel {0, 11, this}}
, decodes_model_ {new DecodesModel {this}}
, beacons_model_ {new BeaconsModel {this}}
, server_ {new MessageServer {this}}
, multicast_group_line_edit_ {new QLineEdit}
, log_table_view_ {new QTableView}
{
// logbook
int column {0};
for (auto const& heading : headings)
{
log_->setHeaderData (column++, Qt::Horizontal, tr (heading));
}
connect (server_, &MessageServer::qso_logged, this, &MessageAggregatorMainWindow::log_qso);
// menu bar
auto file_menu = menuBar ()->addMenu (tr ("&File"));
auto exit_action = new QAction {tr ("E&xit"), this};
exit_action->setShortcuts (QKeySequence::Quit);
exit_action->setToolTip (tr ("Exit the application"));
file_menu->addAction (exit_action);
connect (exit_action, &QAction::triggered, this, &MessageAggregatorMainWindow::close);
view_menu_ = menuBar ()->addMenu (tr ("&View"));
// central layout
auto central_layout = new QVBoxLayout;
// server details
auto port_spin_box = new QSpinBox;
port_spin_box->setMinimum (1);
port_spin_box->setMaximum (std::numeric_limits<port_type>::max ());
auto group_box_layout = new QFormLayout;
group_box_layout->addRow (tr ("Port number:"), port_spin_box);
group_box_layout->addRow (tr ("Multicast Group (blank for unicast server):"), multicast_group_line_edit_);
auto group_box = new QGroupBox {tr ("Server Details")};
group_box->setLayout (group_box_layout);
central_layout->addWidget (group_box);
log_table_view_->setModel (log_);
log_table_view_->verticalHeader ()->hide ();
central_layout->addWidget (log_table_view_);
// central widget
auto central_widget = new QWidget;
central_widget->setLayout (central_layout);
// main window setup
setCentralWidget (central_widget);
setDockOptions (AnimatedDocks | AllowNestedDocks | AllowTabbedDocks);
setTabPosition (Qt::BottomDockWidgetArea, QTabWidget::North);
// connect up server
connect (server_, &MessageServer::error, [this] (QString const& message) {
QMessageBox::warning (this, QApplication::applicationName (), tr ("Network Error"), message);
});
connect (server_, &MessageServer::client_opened, this, &MessageAggregatorMainWindow::add_client);
connect (server_, &MessageServer::client_closed, this, &MessageAggregatorMainWindow::remove_client);
connect (server_, &MessageServer::client_closed, decodes_model_, &DecodesModel::clear_decodes);
connect (server_, &MessageServer::client_closed, beacons_model_, &BeaconsModel::clear_decodes);
connect (server_, &MessageServer::decode, [this] (bool is_new, QString const& id, QTime time
, qint32 snr, float delta_time
, quint32 delta_frequency, QString const& mode
, QString const& message, bool low_confidence
, bool off_air) {
decodes_model_->add_decode (is_new, id, time, snr, delta_time, delta_frequency, mode, message
, low_confidence, off_air, dock_widgets_[id]->fast_mode ());});
connect (server_, &MessageServer::WSPR_decode, beacons_model_, &BeaconsModel::add_beacon_spot);
connect (server_, &MessageServer::clear_decodes, decodes_model_, &DecodesModel::clear_decodes);
connect (server_, &MessageServer::clear_decodes, beacons_model_, &BeaconsModel::clear_decodes);
connect (decodes_model_, &DecodesModel::reply, server_, &MessageServer::reply);
// UI behaviour
connect (port_spin_box, static_cast<void (QSpinBox::*)(int)> (&QSpinBox::valueChanged)
, [this] (port_type port) {server_->start (port);});
connect (multicast_group_line_edit_, &QLineEdit::editingFinished, [this, port_spin_box] () {
server_->start (port_spin_box->value (), QHostAddress {multicast_group_line_edit_->text ()});
});
port_spin_box->setValue (2237); // start up in unicast mode
show ();
}
void MessageAggregatorMainWindow::log_qso (QString const& /*id*/, QDateTime time_off, QString const& dx_call, QString const& dx_grid
, Frequency dial_frequency, QString const& mode, QString const& report_sent
, QString const& report_received, QString const& tx_power, QString const& comments
, QString const& name, QDateTime time_on)
{
QList<QStandardItem *> row;
row << new QStandardItem {time_on.toString ("dd-MMM-yyyy hh:mm:ss")}
<< new QStandardItem {time_off.toString ("dd-MMM-yyyy hh:mm:ss")}
<< new QStandardItem {dx_call}
<< new QStandardItem {dx_grid}
<< new QStandardItem {name}
<< new QStandardItem {Radio::frequency_MHz_string (dial_frequency)}
<< new QStandardItem {mode}
<< new QStandardItem {report_sent}
<< new QStandardItem {report_received}
<< new QStandardItem {tx_power}
<< new QStandardItem {comments};
log_->appendRow (row);
log_table_view_->resizeColumnsToContents ();
log_table_view_->horizontalHeader ()->setStretchLastSection (true);
log_table_view_->scrollToBottom ();
}
void MessageAggregatorMainWindow::add_client (QString const& id, QString const& version, QString const& revision)
{
auto dock = new ClientWidget {decodes_model_, beacons_model_, id, version, revision, this};
dock->setAttribute (Qt::WA_DeleteOnClose);
auto view_action = dock->toggleViewAction ();
view_action->setEnabled (true);
view_menu_->addAction (view_action);
addDockWidget (Qt::BottomDockWidgetArea, dock);
connect (server_, &MessageServer::status_update, dock, &ClientWidget::update_status);
connect (server_, &MessageServer::decode, dock, &ClientWidget::decode_added);
connect (server_, &MessageServer::WSPR_decode, dock, &ClientWidget::beacon_spot_added);
connect (server_, &MessageServer::clear_decodes, dock, &ClientWidget::clear_decodes);
connect (dock, &ClientWidget::do_reply, decodes_model_, &DecodesModel::do_reply);
connect (dock, &ClientWidget::do_halt_tx, server_, &MessageServer::halt_tx);
connect (dock, &ClientWidget::do_free_text, server_, &MessageServer::free_text);
connect (view_action, &QAction::toggled, dock, &ClientWidget::setVisible);
dock_widgets_[id] = dock;
server_->replay (id);
}
void MessageAggregatorMainWindow::remove_client (QString const& id)
{
auto iter = dock_widgets_.find (id);
if (iter != std::end (dock_widgets_))
{
(*iter)->close ();
dock_widgets_.erase (iter);
}
}
#include "moc_MessageAggregatorMainWindow.cpp"
@@ -0,0 +1,643 @@
// -*- Mode: C++ -*-
#ifndef MAINWINDOW_H
#define MAINWINDOW_H
#ifdef QT5
#include <QtWidgets>
#else
#include <QtGui>
#endif
#include <QThread>
#include <QTimer>
#include <QDateTime>
#include <QList>
#include <QAudioDeviceInfo>
#include <QScopedPointer>
#include <QDir>
#include <QProgressDialog>
#include <QAbstractSocket>
#include <QHostAddress>
#include <QPointer>
#include <QSet>
#include <QVector>
#include <QFuture>
#include <QFutureWatcher>
#include "AudioDevice.hpp"
#include "commons.h"
#include "Radio.hpp"
#include "Modes.hpp"
#include "FrequencyList.hpp"
#include "Configuration.hpp"
#include "WSPRBandHopping.hpp"
#include "Transceiver.hpp"
#include "DisplayManual.hpp"
#include "psk_reporter.h"
#include "logbook/logbook.h"
#include "commons.h"
#include "astro.h"
#include "MessageBox.hpp"
#include "NetworkAccessManager.hpp"
#define NUM_JT4_SYMBOLS 206 //(72+31)*2, embedded sync
#define NUM_JT65_SYMBOLS 126 //63 data + 63 sync
#define NUM_JT9_SYMBOLS 85 //69 data + 16 sync
#define NUM_WSPR_SYMBOLS 162 //(50+31)*2, embedded sync
#define NUM_WSPR_LF_SYMBOLS 412 //300 data + 109 sync + 3 ramp
#define NUM_ISCAT_SYMBOLS 1291 //30*11025/256
#define NUM_MSK144_SYMBOLS 144 //s8 + d48 + s8 + d80
#define NUM_QRA64_SYMBOLS 84 //63 data + 21 sync
#define NUM_FT8_SYMBOLS 79
#define NUM_CW_SYMBOLS 250
#define TX_SAMPLE_RATE 48000
#define N_WIDGETS 24
extern int volatile itone[NUM_ISCAT_SYMBOLS]; //Audio tones for all Tx symbols
extern int volatile icw[NUM_CW_SYMBOLS]; //Dits for CW ID
//--------------------------------------------------------------- MainWindow
namespace Ui {
class MainWindow;
}
class QSettings;
class QLineEdit;
class QFont;
class QHostInfo;
class EchoGraph;
class FastGraph;
class WideGraph;
class LogQSO;
class Transceiver;
class MessageAveraging;
class MessageClient;
class QTime;
class WSPRBandHopping;
class HelpTextWindow;
class WSPRNet;
class SoundOutput;
class Modulator;
class SoundInput;
class Detector;
class SampleDownloader;
class MultiSettings;
class EqualizationToolsDialog;
class DecodedText;
class MainWindow : public QMainWindow
{
Q_OBJECT;
public:
using Frequency = Radio::Frequency;
using FrequencyDelta = Radio::FrequencyDelta;
using Mode = Modes::Mode;
explicit MainWindow(QDir const& temp_directory, bool multiple, MultiSettings *,
QSharedMemory *shdmem, unsigned downSampleFactor,
QSplashScreen *,
QWidget *parent = nullptr);
~MainWindow();
public slots:
void showSoundInError(const QString& errorMsg);
void showSoundOutError(const QString& errorMsg);
void showStatusMessage(const QString& statusMsg);
void dataSink(qint64 frames);
void fastSink(qint64 frames);
void diskDat();
void freezeDecode(int n);
void guiUpdate();
void doubleClickOnCall(bool shift, bool ctrl);
void doubleClickOnCall2(bool shift, bool ctrl);
void readFromStdout();
void p1ReadFromStdout();
void setXIT(int n, Frequency base = 0u);
void setFreq4(int rxFreq, int txFreq);
void msgAvgDecode2();
void fastPick(int x0, int x1, int y);
protected:
void keyPressEvent (QKeyEvent *) override;
void closeEvent(QCloseEvent *) override;
void childEvent(QChildEvent *) override;
bool eventFilter(QObject *, QEvent *) override;
private slots:
void on_tx1_editingFinished();
void on_tx2_editingFinished();
void on_tx3_editingFinished();
void on_tx4_editingFinished();
void on_tx5_currentTextChanged (QString const&);
void on_tx6_editingFinished();
void on_actionSettings_triggered();
void on_monitorButton_clicked (bool);
void on_actionAbout_triggered();
void on_autoButton_clicked (bool);
void on_stopTxButton_clicked();
void on_stopButton_clicked();
void on_actionRelease_Notes_triggered ();
void on_actionOnline_User_Guide_triggered();
void on_actionLocal_User_Guide_triggered();
void on_actionWide_Waterfall_triggered();
void on_actionOpen_triggered();
void on_actionOpen_next_in_directory_triggered();
void on_actionDecode_remaining_files_in_directory_triggered();
void on_actionDelete_all_wav_files_in_SaveDir_triggered();
void on_actionOpen_log_directory_triggered ();
void on_actionNone_triggered();
void on_actionSave_all_triggered();
void on_actionKeyboard_shortcuts_triggered();
void on_actionSpecial_mouse_commands_triggered();
void on_DecodeButton_clicked (bool);
void decode();
void decodeBusy(bool b);
void on_EraseButton_clicked();
void on_txFirstCheckBox_stateChanged(int arg1);
void set_dateTimeQSO(int m_ntx);
void set_ntx(int n);
void on_txrb1_toggled(bool status);
void on_txrb1_doubleClicked ();
void on_txrb2_toggled(bool status);
void on_txrb3_toggled(bool status);
void on_txrb4_toggled(bool status);
void on_txrb4_doubleClicked ();
void on_txrb5_toggled(bool status);
void on_txrb5_doubleClicked ();
void on_txrb6_toggled(bool status);
void on_txb1_clicked();
void on_txb1_doubleClicked ();
void on_txb2_clicked();
void on_txb3_clicked();
void on_txb4_clicked();
void on_txb4_doubleClicked ();
void on_txb5_clicked();
void on_txb5_doubleClicked ();
void on_txb6_clicked();
void on_lookupButton_clicked();
void on_addButton_clicked();
void on_dxCallEntry_textChanged (QString const&);
void on_dxGridEntry_textChanged (QString const&);
void on_dxCallEntry_returnPressed ();
void on_genStdMsgsPushButton_clicked();
void on_logQSOButton_clicked();
void on_actionJT9_triggered();
void on_actionJT65_triggered();
void on_actionJT9_JT65_triggered();
void on_actionJT4_triggered();
void on_actionFT8_triggered();
void on_TxFreqSpinBox_valueChanged(int arg1);
void on_actionSave_decoded_triggered();
void on_actionQuickDecode_toggled (bool);
void on_actionMediumDecode_toggled (bool);
void on_actionDeepestDecode_toggled (bool);
void bumpFqso(int n);
void on_actionErase_ALL_TXT_triggered();
void on_actionErase_wsjtx_log_adi_triggered();
void startTx2();
void startP1();
void stopTx();
void stopTx2();
void on_pbCallCQ_clicked();
void on_pbAnswerCaller_clicked();
void on_pbSendRRR_clicked();
void on_pbAnswerCQ_clicked();
void on_pbSendReport_clicked();
void on_pbSend73_clicked();
void on_rbGenMsg_clicked(bool checked);
void on_rbFreeText_clicked(bool checked);
void on_freeTextMsg_currentTextChanged (QString const&);
void on_rptSpinBox_valueChanged(int n);
void killFile();
void on_tuneButton_clicked (bool);
void on_pbR2T_clicked();
void on_pbT2R_clicked();
void acceptQSO2(QDateTime const&, QString const& call, QString const& grid
, Frequency dial_freq, QString const& mode
, QString const& rpt_sent, QString const& rpt_received
, QString const& tx_power, QString const& comments
, QString const& name, QDateTime const&);
void on_bandComboBox_currentIndexChanged (int index);
void on_bandComboBox_activated (int index);
void on_readFreq_clicked();
void on_pbTxMode_clicked();
void on_RxFreqSpinBox_valueChanged(int n);
void on_cbTxLock_clicked(bool checked);
void on_outAttenuation_valueChanged (int);
void rigOpen ();
void handle_transceiver_update (Transceiver::TransceiverState const&);
void handle_transceiver_failure (QString const& reason);
void on_actionAstronomical_data_toggled (bool);
void on_actionShort_list_of_add_on_prefixes_and_suffixes_triggered();
void band_changed (Frequency);
void monitor (bool);
void stop_tuning ();
void stopTuneATU();
void auto_tx_mode(bool);
void on_actionMessage_averaging_triggered();
void on_actionInclude_averaging_toggled (bool);
void on_actionInclude_correlation_toggled (bool);
void on_actionEnable_AP_DXcall_toggled (bool);
void VHF_features_enabled(bool b);
void on_sbSubmode_valueChanged(int n);
void on_cbShMsgs_toggled(bool b);
void on_cbSWL_toggled(bool b);
void on_cbTx6_toggled(bool b);
void on_cbMenus_toggled(bool b);
void on_cbFirst_toggled(bool b);
void on_cbAutoSeq_toggled(bool b);
void networkError (QString const&);
void on_ClrAvgButton_clicked();
void on_actionWSPR_triggered();
void on_actionWSPR_LF_triggered();
void on_syncSpinBox_valueChanged(int n);
void on_TxPowerComboBox_currentIndexChanged(const QString &arg1);
void on_sbTxPercent_valueChanged(int n);
void on_cbUploadWSPR_Spots_toggled(bool b);
void WSPR_config(bool b);
void uploadSpots();
void TxAgain();
void uploadResponse(QString response);
void on_WSPRfreqSpinBox_valueChanged(int n);
void on_pbTxNext_clicked(bool b);
void on_actionEcho_Graph_triggered();
void on_actionEcho_triggered();
void on_actionISCAT_triggered();
void on_actionFast_Graph_triggered();
void fast_decode_done();
void on_actionMeasure_reference_spectrum_triggered();
void on_actionErase_reference_spectrum_triggered();
void on_actionMeasure_phase_response_triggered();
void on_sbTR_valueChanged (int);
void on_sbFtol_valueChanged (int);
void on_cbFast9_clicked(bool b);
void on_sbCQTxFreq_valueChanged(int n);
void on_cbCQTx_toggled(bool b);
void on_actionMSK144_triggered();
void on_actionQRA64_triggered();
void on_actionFreqCal_triggered();
void splash_done ();
private:
Q_SIGNAL void initializeAudioOutputStream (QAudioDeviceInfo,
unsigned channels, unsigned msBuffered) const;
Q_SIGNAL void stopAudioOutputStream () const;
Q_SIGNAL void startAudioInputStream (QAudioDeviceInfo const&,
int framesPerBuffer, AudioDevice * sink,
unsigned downSampleFactor, AudioDevice::Channel) const;
Q_SIGNAL void suspendAudioInputStream () const;
Q_SIGNAL void resumeAudioInputStream () const;
Q_SIGNAL void startDetector (AudioDevice::Channel) const;
Q_SIGNAL void FFTSize (unsigned) const;
Q_SIGNAL void detectorClose () const;
Q_SIGNAL void finished () const;
Q_SIGNAL void transmitFrequency (double) const;
Q_SIGNAL void endTransmitMessage (bool quick = false) const;
Q_SIGNAL void tune (bool = true) const;
Q_SIGNAL void sendMessage (unsigned symbolsLength, double framesPerSymbol,
double frequency, double toneSpacing,
SoundOutput *, AudioDevice::Channel = AudioDevice::Mono,
bool synchronize = true, bool fastMode = false, double dBSNR = 99.,
int TRperiod=60) const;
Q_SIGNAL void outAttenuationChanged (qreal) const;
Q_SIGNAL void toggleShorthand () const;
private:
void astroUpdate ();
void writeAllTxt(QString message);
void auto_sequence (QString const& message, unsigned start_tolerance, unsigned stop_tolerance);
void hideMenus(bool b);
NetworkAccessManager m_network_manager;
bool m_valid;
QSplashScreen * m_splash;
QString m_revision;
bool m_multiple;
MultiSettings * m_multi_settings;
QPushButton * m_configurations_button;
QSettings * m_settings;
QScopedPointer<Ui::MainWindow> ui;
// other windows
Configuration m_config;
WSPRBandHopping m_WSPR_band_hopping;
bool m_WSPR_tx_next;
MessageBox m_rigErrorMessageBox;
QScopedPointer<SampleDownloader> m_sampleDownloader;
QScopedPointer<EqualizationToolsDialog> m_equalizationToolsDialog;
QScopedPointer<WideGraph> m_wideGraph;
QScopedPointer<EchoGraph> m_echoGraph;
QScopedPointer<FastGraph> m_fastGraph;
QScopedPointer<LogQSO> m_logDlg;
QScopedPointer<Astro> m_astroWidget;
QScopedPointer<HelpTextWindow> m_shortcuts;
QScopedPointer<HelpTextWindow> m_prefixes;
QScopedPointer<HelpTextWindow> m_mouseCmnds;
QScopedPointer<MessageAveraging> m_msgAvgWidget;
Transceiver::TransceiverState m_rigState;
Frequency m_lastDialFreq;
QString m_lastBand;
QString m_lastCallsign;
Frequency m_dialFreqRxWSPR; // best guess at WSPR QRG
Detector * m_detector;
unsigned m_FFTSize;
SoundInput * m_soundInput;
Modulator * m_modulator;
SoundOutput * m_soundOutput;
QThread m_audioThread;
qint64 m_msErase;
qint64 m_secBandChanged;
qint64 m_freqMoon;
Frequency m_freqNominal;
Frequency m_freqTxNominal;
Astro::Correction m_astroCorrection;
double m_s6;
double m_tRemaining;
float m_DTtol;
float m_t0;
float m_t1;
float m_t0Pick;
float m_t1Pick;
float m_fCPUmskrtd;
qint32 m_waterfallAvg;
qint32 m_ntx;
bool m_gen_message_is_cq;
bool m_send_RR73;
qint32 m_timeout;
qint32 m_XIT;
qint32 m_setftx;
qint32 m_ndepth;
qint32 m_sec0;
qint32 m_RxLog;
qint32 m_nutc0;
qint32 m_ntr;
qint32 m_tx;
qint32 m_hsym;
qint32 m_TRperiod;
qint32 m_nsps;
qint32 m_hsymStop;
qint32 m_inGain;
qint32 m_ncw;
qint32 m_secID;
qint32 m_idleMinutes;
qint32 m_nSubMode;
qint32 m_nclearave;
qint32 m_minSync;
qint32 m_dBm;
qint32 m_pctx;
qint32 m_nseq;
qint32 m_nWSPRdecodes;
qint32 m_k0;
qint32 m_kdone;
qint32 m_nPick;
FrequencyList_v2::const_iterator m_frequency_list_fcal_iter;
qint32 m_nTx73;
qint32 m_UTCdisk;
qint32 m_wait;
bool m_btxok; //True if OK to transmit
bool m_diskData;
bool m_loopall;
bool m_decoderBusy;
bool m_txFirst;
bool m_auto;
bool m_restart;
bool m_startAnother;
bool m_saveDecoded;
bool m_saveAll;
bool m_widebandDecode;
bool m_call3Modified;
bool m_dataAvailable;
bool m_bDecoded;
bool m_noSuffix;
bool m_blankLine;
bool m_decodedText2;
bool m_freeText;
bool m_sentFirst73;
int m_currentMessageType;
QString m_currentMessage;
int m_lastMessageType;
QString m_lastMessageSent;
bool m_lockTxFreq;
bool m_bShMsgs;
bool m_bSWL;
bool m_uploadSpots;
bool m_uploading;
bool m_txNext;
bool m_grid6;
bool m_tuneup;
bool m_bTxTime;
bool m_rxDone;
bool m_bSimplex; // not using split even if it is available
bool m_bEchoTxOK;
bool m_bTransmittedEcho;
bool m_bEchoTxed;
bool m_bFastMode;
bool m_bFast9;
bool m_bFastDecodeCalled;
bool m_bDoubleClickAfterCQnnn;
bool m_bRefSpec;
bool m_bClearRefSpec;
bool m_bTrain;
bool m_bUseRef;
bool m_bFastDone;
bool m_bAltV;
bool m_bNoMoreFiles;
bool m_bQRAsyncWarned;
bool m_bDoubleClicked;
bool m_bCallingCQ;
bool m_bAutoReply;
enum
{
CALLING,
REPLYING,
REPORT,
ROGER_REPORT,
ROGERS,
SIGNOFF
}
m_QSOProgress;
int m_ihsym;
int m_nzap;
int m_npts8;
float m_px;
float m_pxmax;
float m_df3;
int m_iptt0;
bool m_btxok0;
int m_nsendingsh;
double m_onAirFreq0;
bool m_first_error;
char m_msg[100][80];
// labels in status bar
QLabel tx_status_label;
QLabel config_label;
QLabel mode_label;
QLabel last_tx_label;
QLabel auto_tx_label;
QLabel band_hopping_label;
QProgressBar progressBar;
QLabel watchdog_label;
QFuture<void> m_wav_future;
QFutureWatcher<void> m_wav_future_watcher;
QFutureWatcher<void> watcher3;
QFutureWatcher<QString> m_saveWAVWatcher;
QProcess proc_jt9;
QProcess p1;
QProcess p3;
WSPRNet *wsprNet;
QTimer m_guiTimer;
QTimer ptt1Timer; //StartTx delay
QTimer ptt0Timer; //StopTx delay
QTimer logQSOTimer;
QTimer killFileTimer;
QTimer tuneButtonTimer;
QTimer uploadTimer;
QTimer tuneATU_Timer;
QTimer TxAgainTimer;
QTimer minuteTimer;
QTimer splashTimer;
QTimer p1Timer;
QString m_path;
QString m_baseCall;
QString m_hisCall;
QString m_hisGrid;
QString m_appDir;
QString m_palette;
QString m_dateTime;
QString m_mode;
QString m_modeTx;
QString m_fnameWE; // save path without extension
QString m_rpt;
QString m_rptSent;
QString m_rptRcvd;
QString m_qsoStart;
QString m_qsoStop;
QString m_cmnd;
QString m_cmndP1;
QString m_msgSent0;
QString m_fileToSave;
QString m_calls;
QString m_CQtype;
QSet<QString> m_pfx;
QSet<QString> m_sfx;
QDateTime m_dateTimeQSOOn;
QSharedMemory *mem_jt9;
LogBook m_logBook;
QString m_QSOText;
unsigned m_msAudioOutputBuffered;
unsigned m_framesAudioInputBuffered;
unsigned m_downSampleFactor;
QThread::Priority m_audioThreadPriority;
bool m_bandEdited;
bool m_splitMode;
bool m_monitoring;
bool m_tx_when_ready;
bool m_transmitting;
bool m_tune;
bool m_tx_watchdog; // true when watchdog triggered
bool m_block_pwr_tooltip;
bool m_PwrBandSetOK;
bool m_bVHFwarned;
Frequency m_lastMonitoredFrequency;
double m_toneSpacing;
int m_firstDecode;
QProgressDialog m_optimizingProgress;
QTimer m_heartbeat;
MessageClient * m_messageClient;
PSK_Reporter *psk_Reporter;
DisplayManual m_manual;
QHash<QString, QVariant> m_pwrBandTxMemory; // Remembers power level by band
QHash<QString, QVariant> m_pwrBandTuneMemory; // Remembers power level by band for tuning
QByteArray m_geometryNoControls;
QVector<double> m_phaseEqCoefficients;
//---------------------------------------------------- private functions
void readSettings();
void setDecodedTextFont (QFont const&);
void writeSettings();
void createStatusBar();
void updateStatusBar();
void genStdMsgs(QString rpt, bool unconditional = false);
void genCQMsg();
void clearDX ();
void lookup();
void ba2msg(QByteArray ba, char* message);
void msgtype(QString t, QLineEdit* tx);
void stub();
void statusChanged();
void fixStop();
bool shortList(QString callsign);
void transmit (double snr = 99.);
void rigFailure (QString const& reason);
void pskSetLocal ();
void pskPost(DecodedText const& decodedtext);
void displayDialFrequency ();
void transmitDisplay (bool);
void processMessage(QString const& messages, qint32 position, bool ctrl = false, bool alt = false);
void replyToCQ (QTime, qint32 snr, float delta_time, quint32 delta_frequency, QString const& mode, QString const& message_text);
void replayDecodes ();
void postDecode (bool is_new, QString const& message);
void postWSPRDecode (bool is_new, QStringList message_parts);
void enable_DXCC_entity (bool on);
void switch_mode (Mode);
void WSPR_scheduling ();
void freqCalStep();
void setRig (Frequency = 0); // zero frequency means no change
void WSPR_history(Frequency dialFreq, int ndecodes);
QString WSPR_hhmm(int n);
void fast_config(bool b);
void CQTxFreq();
QString save_wave_file (QString const& name
, short const * data
, int seconds
, QString const& my_callsign
, QString const& my_grid
, QString const& mode
, qint32 sub_mode
, Frequency frequency
, QString const& his_call
, QString const& his_grid) const;
void read_wav_file (QString const& fname);
void decodeDone ();
void subProcessFailed (QProcess *, int exit_code, QProcess::ExitStatus);
void subProcessError (QProcess *, QProcess::ProcessError);
void statusUpdate () const;
void update_watchdog_label ();
void on_the_minute ();
void add_child_to_event_filter (QObject *);
void remove_child_from_event_filter (QObject *);
void setup_status_bar (bool vhf);
void tx_watchdog (bool triggered);
int nWidgets(QString t);
void displayWidgets(int n);
void vhfWarning();
QChar current_submode () const; // returns QChar {0} if sub mode is
// not appropriate
void write_transmit_entry (QString const& file_name);
};
extern int killbyname(const char* progName);
extern void getDev(int* numDevices,char hostAPI_DeviceName[][50],
int minChan[], int maxChan[],
int minSpeed[], int maxSpeed[]);
extern int next_tx_state(int pctx);
#endif // MAINWINDOW_H
@@ -0,0 +1,429 @@
subroutine ft8b(dd0,newdat,nQSOProgress,nfqso,nftx,ndepth,lapon,napwid, &
lsubtract,nagain,iaptype,mygrid6,bcontest,sync0,f1,xdt,xbase,apsym, &
nharderrors,dmin,nbadcrc,ipass,iera,message,xsnr)
use timer_module, only: timer
include 'ft8_params.f90'
parameter(NRECENT=10,NP2=2812)
character message*22,msgsent*22
character*12 recent_calls(NRECENT)
character*6 mygrid6
logical bcontest
real a(5)
real s1(0:7,ND),s2(0:7,NN),s1sort(8*ND)
real ps(0:7),psl(0:7)
real bmeta(3*ND),bmetb(3*ND),bmetap(3*ND)
real llr(3*ND),llra(3*ND),llr0(3*ND),llr1(3*ND),llrap(3*ND) !Soft symbols
real dd0(15*12000)
integer*1 decoded(KK),apmask(3*ND),cw(3*ND)
integer*1 msgbits(KK)
integer apsym(KK)
integer mcq(28),mde(28),mrrr(16),m73(16),mrr73(16)
integer itone(NN)
integer indxs1(8*ND)
integer icos7(0:6),ip(1)
integer nappasses(0:5) ! the number of decoding passes to use for each QSO state
integer naptypes(0:5,4) ! (nQSOProgress, decoding pass) maximum of 4 passes for now
complex cd0(3200)
complex ctwk(32)
complex csymb(32)
logical first,newdat,lsubtract,lapon,nagain
equivalence (s1,s1sort)
data icos7/2,5,6,0,4,1,3/
data mcq/1,1,1,1,1,0,1,0,0,0,0,0,1,0,0,0,0,0,1,1,0,0,0,1,1,0,0,1/
data mrrr/0,1,1,1,1,1,1,0,1,1,0,0,1,1,1,1/
data m73/0,1,1,1,1,1,1,0,1,1,0,1,0,0,0,0/
data mde/1,1,1,1,1,1,1,1,0,1,1,0,0,1,0,0,0,0,0,1,1,1,0,1,0,0,0,1/
data mrr73/0,0,0,0,0,0,1,0,0,0,0,1,0,1,0,1/
data first/.true./
save nappasses,naptypes
if(first) then
mcq=2*mcq-1
mde=2*mde-1
mrrr=2*mrrr-1
m73=2*m73-1
mrr73=2*mrr73-1
nappasses(0)=2
nappasses(1)=2
nappasses(2)=2
nappasses(3)=4
nappasses(4)=4
nappasses(5)=3
! iaptype
!------------------------
! 1 CQ ??? ???
! 2 MyCall ??? ???
! 3 MyCall DxCall ???
! 4 MyCall DxCall RRR
! 5 MyCall DxCall 73
! 6 MyCall DxCall RR73
! 7 ??? DxCall ???
naptypes(0,1:4)=(/1,2,0,0/)
naptypes(1,1:4)=(/2,3,0,0/)
naptypes(2,1:4)=(/2,3,0,0/)
naptypes(3,1:4)=(/3,4,5,6/)
naptypes(4,1:4)=(/3,4,5,6/)
naptypes(5,1:4)=(/3,1,2,0/) !?
first=.false.
endif
max_iterations=30
nharderrors=-1
fs2=12000.0/NDOWN
dt2=1.0/fs2
twopi=8.0*atan(1.0)
delfbest=0.
ibest=0
call timer('ft8_down',0)
call ft8_downsample(dd0,newdat,f1,cd0) !Mix f1 to baseband and downsample
call timer('ft8_down',1)
i0=nint((xdt+0.5)*fs2) !Initial guess for start of signal
smax=0.0
do idt=i0-8,i0+8 !Search over +/- one quarter symbol
call sync8d(cd0,idt,ctwk,0,sync)
if(sync.gt.smax) then
smax=sync
ibest=idt
endif
enddo
xdt2=ibest*dt2 !Improved estimate for DT
! Now peak up in frequency
i0=nint(xdt2*fs2)
smax=0.0
do ifr=-5,5 !Search over +/- 2.5 Hz
delf=ifr*0.5
dphi=twopi*delf*dt2
phi=0.0
do i=1,32
ctwk(i)=cmplx(cos(phi),sin(phi))
phi=mod(phi+dphi,twopi)
enddo
call sync8d(cd0,i0,ctwk,1,sync)
if( sync .gt. smax ) then
smax=sync
delfbest=delf
endif
enddo
a=0.0
a(1)=-delfbest
call twkfreq1(cd0,NP2,fs2,a,cd0)
xdt=xdt2
f1=f1+delfbest !Improved estimate of DF
call sync8d(cd0,i0,ctwk,2,sync)
j=0
do k=1,NN
i1=ibest+(k-1)*32
csymb=cmplx(0.0,0.0)
if( i1.ge.1 .and. i1+31 .le. NP2 ) csymb=cd0(i1:i1+31)
call four2a(csymb,32,1,-1,1)
s2(0:7,k)=abs(csymb(1:8))/1e3
enddo
! sync quality check
is1=0
is2=0
is3=0
do k=1,7
ip=maxloc(s2(:,k))
if(icos7(k-1).eq.(ip(1)-1)) is1=is1+1
ip=maxloc(s2(:,k+36))
if(icos7(k-1).eq.(ip(1)-1)) is2=is2+1
ip=maxloc(s2(:,k+72))
if(icos7(k-1).eq.(ip(1)-1)) is3=is3+1
enddo
! hard sync sum - max is 21
nsync=is1+is2+is3
if(nsync .le. 6) then ! bail out
nbadcrc=1
return
endif
j=0
do k=1,NN
if(k.le.7) cycle
if(k.ge.37 .and. k.le.43) cycle
if(k.gt.72) cycle
j=j+1
s1(0:7,j)=s2(0:7,k)
enddo
call indexx(s1sort,8*ND,indxs1)
xmeds1=s1sort(indxs1(nint(0.5*8*ND)))
s1=s1/xmeds1
do j=1,ND
i4=3*j-2
i2=3*j-1
i1=3*j
! Max amplitude
ps=s1(0:7,j)
r1=max(ps(1),ps(3),ps(5),ps(7))-max(ps(0),ps(2),ps(4),ps(6))
r2=max(ps(2),ps(3),ps(6),ps(7))-max(ps(0),ps(1),ps(4),ps(5))
r4=max(ps(4),ps(5),ps(6),ps(7))-max(ps(0),ps(1),ps(2),ps(3))
bmeta(i4)=r4
bmeta(i2)=r2
bmeta(i1)=r1
bmetap(i4)=r4
bmetap(i2)=r2
bmetap(i1)=r1
! Max log metric
psl=log(ps)
r1=max(psl(1),psl(3),psl(5),psl(7))-max(psl(0),psl(2),psl(4),psl(6))
r2=max(psl(2),psl(3),psl(6),psl(7))-max(psl(0),psl(1),psl(4),psl(5))
r4=max(psl(4),psl(5),psl(6),psl(7))-max(psl(0),psl(1),psl(2),psl(3))
bmetb(i4)=r4
bmetb(i2)=r2
bmetb(i1)=r1
! Metric for Cauchy noise
! r1=log(ps(1)**3+ps(3)**3+ps(5)**3+ps(7)**3)- &
! log(ps(0)**3+ps(2)**3+ps(4)**3+ps(6)**3)
! r2=log(ps(2)**3+ps(3)**3+ps(6)**3+ps(7)**3)- &
! log(ps(0)**3+ps(1)**3+ps(4)**3+ps(5)**3)
! r4=log(ps(4)**3+ps(5)**3+ps(6)**3+ps(7)**3)- &
! log(ps(0)**3+ps(1)**3+ps(2)**3+ps(3)**3)
! Metric for AWGN, no fading
! bscale=2.5
! b0=bessi0(bscale*ps(0))
! b1=bessi0(bscale*ps(1))
! b2=bessi0(bscale*ps(2))
! b3=bessi0(bscale*ps(3))
! b4=bessi0(bscale*ps(4))
! b5=bessi0(bscale*ps(5))
! b6=bessi0(bscale*ps(6))
! b7=bessi0(bscale*ps(7))
! r1=log(b1+b3+b5+b7)-log(b0+b2+b4+b6)
! r2=log(b2+b3+b6+b7)-log(b0+b1+b4+b5)
! r4=log(b4+b5+b6+b7)-log(b0+b1+b2+b3)
if(nQSOProgress .eq. 0 .or. nQSOProgress .eq. 5) then
! When bits 88:115 are set as ap bits, bit 115 lives in symbol 39 along
! with no-ap bits 116 and 117. Take care of metrics for bits 116 and 117.
if(j.eq.39) then ! take care of bits that live in symbol 39
if(apsym(28).lt.0) then
bmetap(i2)=max(ps(2),ps(3))-max(ps(0),ps(1))
bmetap(i1)=max(ps(1),ps(3))-max(ps(0),ps(2))
else
bmetap(i2)=max(ps(6),ps(7))-max(ps(4),ps(5))
bmetap(i1)=max(ps(5),ps(7))-max(ps(4),ps(6))
endif
endif
endif
! When bits 116:143 are set as ap bits, bit 115 lives in symbol 39 along
! with ap bits 116 and 117. Take care of metric for bit 115.
! if(j.eq.39) then ! take care of bit 115
! iii=2*(apsym(29)+1)/2 + (apsym(30)+1)/2 ! known values of bits 116 & 117
! if(iii.eq.0) bmetap(i4)=ps(4)-ps(0)
! if(iii.eq.1) bmetap(i4)=ps(5)-ps(1)
! if(iii.eq.2) bmetap(i4)=ps(6)-ps(2)
! if(iii.eq.3) bmetap(i4)=ps(7)-ps(3)
! endif
! bit 144 lives in symbol 48 and will be 1 if it is set as an ap bit.
! take care of metrics for bits 142 and 143
if(j.eq.48) then ! bit 144 is always 1
bmetap(i4)=max(ps(5),ps(7))-max(ps(1),ps(3))
bmetap(i2)=max(ps(3),ps(7))-max(ps(1),ps(5))
endif
! bit 154 lives in symbol 52 and will be 0 if it is set as an ap bit
! take care of metrics for bits 155 and 156
if(j.eq.52) then ! bit 154 will be 0 if it is set as an ap bit.
bmetap(i2)=max(ps(2),ps(3))-max(ps(0),ps(1))
bmetap(i1)=max(ps(1),ps(3))-max(ps(0),ps(2))
endif
enddo
call normalizebmet(bmeta,3*ND)
call normalizebmet(bmetb,3*ND)
call normalizebmet(bmetap,3*ND)
scalefac=2.83
llr0=scalefac*bmeta
llr1=scalefac*bmetb
llra=scalefac*bmetap ! llr's for use with ap
apmag=scalefac*(maxval(abs(bmetap))*1.01)
! pass #
!------------------------------
! 1 regular decoding
! 2 erase 24
! 3 erase 48
! 4 ap pass 1
! 5 ap pass 2
! 6 ap pass 3
! 7 ap pass 4, etc.
if(lapon) then
npasses=4+nappasses(nQSOProgress)
else
npasses=4
endif
do ipass=1,npasses
llr=llr0
if(ipass.eq.2) llr=llr1
if(ipass.eq.3) llr(1:24)=0.
if(ipass.eq.4) llr(1:48)=0.
if(ipass.le.4) then
apmask=0
llrap=llr
iaptype=0
endif
if(ipass .gt. 4) then
iaptype=naptypes(nQSOProgress,ipass-4)
if(iaptype.ge.3 .and. (abs(f1-nfqso).gt.napwid .and. abs(f1-nftx).gt.napwid) ) cycle
if(iaptype.eq.1 .or. iaptype.eq.2 ) then ! AP,???,???
apmask=0
apmask(88:115)=1 ! first 28 bits are AP
apmask(144)=1 ! not free text
llrap=llr
if(iaptype.eq.1) llrap(88:115)=apmag*mcq
if(iaptype.eq.2) llrap(88:115)=apmag*apsym(1:28)
llrap(116:117)=llra(116:117)
llrap(142:143)=llra(142:143)
llrap(144)=-apmag
endif
if(iaptype.eq.3) then ! mycall, dxcall, ???
apmask=0
apmask(88:115)=1 ! mycall
apmask(116:143)=1 ! hiscall
apmask(144)=1 ! not free text
llrap=llr
llrap(88:143)=apmag*apsym(1:56)
llrap(144)=-apmag
endif
if(iaptype.eq.4 .or. iaptype.eq.5 .or. iaptype.eq.6) then
apmask=0
apmask(88:115)=1 ! mycall
apmask(116:143)=1 ! hiscall
apmask(144:159)=1 ! RRR or 73 or RR73
llrap=llr
llrap(88:143)=apmag*apsym(1:56)
if(iaptype.eq.4) llrap(144:159)=apmag*mrrr
if(iaptype.eq.5) llrap(144:159)=apmag*m73
if(iaptype.eq.6) llrap(144:159)=apmag*mrr73
endif
if(iaptype.eq.7) then ! ???, dxcall, ???
apmask=0
apmask(116:143)=1 ! hiscall
apmask(144)=1 ! not free text
llrap=llr
llrap(115)=llra(115)
llrap(116:143)=apmag*apsym(29:56)
llrap(144)=-apmag
endif
endif
cw=0
call timer('bpd174 ',0)
call bpdecode174(llrap,apmask,max_iterations,decoded,cw,nharderrors, &
niterations)
call timer('bpd174 ',1)
dmin=0.0
if(ndepth.eq.3 .and. nharderrors.lt.0) then
ndeep=3
if(abs(nfqso-f1).le.napwid .or. abs(nftx-f1).le.napwid) then
if((ipass.eq.3 .or. ipass.eq.4) .and. .not.nagain) then
ndeep=3
else
ndeep=4
endif
endif
if(nagain) ndeep=5
call timer('osd174 ',0)
call osd174(llrap,apmask,ndeep,decoded,cw,nharderrors,dmin)
call timer('osd174 ',1)
endif
nbadcrc=1
message=' '
xsnr=-99.0
if(count(cw.eq.0).eq.174) cycle !Reject the all-zero codeword
if(any(decoded(73:75).ne.0)) cycle !Reject if any of the 3 extra bits are nonzero
if(nharderrors.ge.0 .and. nharderrors+dmin.lt.60.0 .and. &
.not.(sync.lt.2.0 .and. nharderrors.gt.35) .and. &
.not.(ipass.gt.2 .and. nharderrors.gt.39) .and. &
.not.(ipass.eq.4 .and. nharderrors.gt.30) &
) then
call chkcrc12a(decoded,nbadcrc)
else
nharderrors=-1
cycle
endif
if(nbadcrc.eq.0) then
call extractmessage174(decoded,message,ncrcflag,recent_calls,nrecent)
call genft8(message,mygrid6,bcontest,msgsent,msgbits,itone)
if(lsubtract) call subtractft8(dd0,itone,f1,xdt2)
xsig=0.0
xnoi=0.0
do i=1,79
xsig=xsig+s2(itone(i),i)**2
ios=mod(itone(i)+4,7)
xnoi=xnoi+s2(ios,i)**2
enddo
xsnr=0.001
if(xnoi.gt.0 .and. xnoi.lt.xsig) xsnr=xsig/xnoi-1.0
xsnr=10.0*log10(xsnr)-27.0
xsnr2=db(xsig/xbase - 1.0) - 32.0
! write(52,3052) f1,xdt,xsig,xnoi,xbase,xsnr,xsnr2
!3052 format(7f10.2)
if(.not.nagain) xsnr=xsnr2
if(xsnr .lt. -24.0) xsnr=-24.0
return
endif
enddo
return
end subroutine ft8b
subroutine normalizebmet(bmet,n)
real bmet(n)
bmetav=sum(bmet)/real(n)
bmet2av=sum(bmet*bmet)/real(n)
var=bmet2av-bmetav*bmetav
if( var .gt. 0.0 ) then
bmetsig=sqrt(var)
else
bmetsig=sqrt(bmet2av)
endif
bmet=bmet/bmetsig
return
end subroutine normalizebmet
function bessi0(x)
! From Numerical Recipes
real bessi0,x
double precision p1,p2,p3,p4,p5,p6,p7,q1,q2,q3,q4,q5,q6,q7,q8,q9,y
save p1,p2,p3,p4,p5,p6,p7,q1,q2,q3,q4,q5,q6,q7,q8,q9
data p1,p2,p3,p4,p5,p6,p7/1.0d0,3.5156229d0,3.0899424d0,1.2067492d0, &
0.2659732d0,0.360768d-1,0.45813d-2/
data q1,q2,q3,q4,q5,q6,q7,q8,q9/0.39894228d0,0.1328592d-1, &
0.225319d-2,-0.157565d-2,0.916281d-2,-0.2057706d-1, &
0.2635537d-1,-0.1647633d-1,0.392377d-2/
if (abs(x).lt.3.75) then
y=(x/3.75)**2
bessi0=p1+y*(p2+y*(p3+y*(p4+y*(p5+y*(p6+y*p7)))))
else
ax=abs(x)
y=3.75/ax
bessi0=(exp(ax)/sqrt(ax))*(q1+y*(q2+y*(q3+y*(q4 &
+y*(q5+y*(q6+y*(q7+y*(q8+y*q9))))))))
endif
return
end function bessi0
@@ -0,0 +1,33 @@
subroutine encode232(dat,nsym,symbol)
! Convolutional encoder for a K=32, r=1/2 code.
integer*1 dat(13) !User data, packed 8 bits per byte
integer*1 symbol(206) !Channel symbols, one bit per byte
integer*1 i1
include 'conv232.f90'
nstate=0
k=0
do j=1,nsym
do i=7,0,-1
i1=dat(j)
i4=i1
if (i4.lt.0) i4=i4+256
nstate=ior(ishft(nstate,1),iand(ishft(i4,-i),1))
n=iand(nstate,npoly1)
n=ieor(n,ishft(n,-16))
k=k+1
symbol(k)=partab(iand(ieor(n,ishft(n,-8)),255))
n=iand(nstate,npoly2)
n=ieor(n,ishft(n,-16))
k=k+1
symbol(k)=partab(iand(ieor(n,ishft(n,-8)),255))
if(k.ge.nsym) go to 100
enddo
enddo
100 continue
return
end subroutine encode232
@@ -0,0 +1,64 @@
// (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 second order Horners rule
#ifndef BOOST_MATH_TOOLS_RAT_EVAL_5_HPP
#define BOOST_MATH_TOOLS_RAT_EVAL_5_HPP
namespace boost{ namespace math{ namespace tools{ namespace detail{
template <class T, class U, class V>
inline V evaluate_rational_c_imp(const T*, const U*, const V&, const mpl::int_<0>*) BOOST_MATH_NOEXCEPT(V)
{
return static_cast<V>(0);
}
template <class T, class U, class V>
inline V evaluate_rational_c_imp(const T* a, const U* b, const V&, const mpl::int_<1>*) BOOST_MATH_NOEXCEPT(V)
{
return static_cast<V>(a[0]) / static_cast<V>(b[0]);
}
template <class T, class U, class V>
inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<2>*) BOOST_MATH_NOEXCEPT(V)
{
return static_cast<V>((a[1] * x + a[0]) / (b[1] * x + b[0]));
}
template <class T, class U, class V>
inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<3>*) BOOST_MATH_NOEXCEPT(V)
{
return static_cast<V>(((a[2] * x + a[1]) * x + a[0]) / ((b[2] * x + b[1]) * x + b[0]));
}
template <class T, class U, class V>
inline V evaluate_rational_c_imp(const T* a, const U* b, 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]) / (((b[3] * x + b[2]) * x + b[1]) * x + b[0]));
}
template <class T, class U, class V>
inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<5>*) BOOST_MATH_NOEXCEPT(V)
{
if(x <= 1)
{
V x2 = x * x;
return static_cast<V>(((a[4] * x2 + a[2]) * x2 + a[0] + (a[3] * x2 + a[1]) * x) / ((b[4] * x2 + b[2]) * x2 + b[0] + (b[3] * x2 + b[1]) * x));
}
else
{
V z = 1 / x;
V z2 = 1 / (x * x);
return static_cast<V>(((a[0] * z2 + a[2]) * z2 + a[4] + (a[1] * z2 + a[3]) * z) / ((b[0] * z2 + b[2]) * z2 + b[4] + (b[1] * z2 + b[3]) * z));
}
}
}}}} // namespaces
#endif // include guard
@@ -0,0 +1,204 @@
//---------------------------------------------------------------------------//
// Copyright (c) 2013-2015 Kyle Lutz <kyle.r.lutz@gmail.com>
//
// Distributed under the Boost Software License, Version 1.0
// See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt
//
// See http://boostorg.github.com/compute for more information.
//---------------------------------------------------------------------------//
#ifndef BOOST_COMPUTE_IMAGE_IMAGE1D_HPP
#define BOOST_COMPUTE_IMAGE_IMAGE1D_HPP
#include <boost/throw_exception.hpp>
#include <boost/compute/config.hpp>
#include <boost/compute/exception/opencl_error.hpp>
#include <boost/compute/image/image_format.hpp>
#include <boost/compute/image/image_object.hpp>
#include <boost/compute/type_traits/type_name.hpp>
#include <boost/compute/utility/extents.hpp>
namespace boost {
namespace compute {
// forward declarations
class command_queue;
/// \class image1d
/// \brief An OpenCL 1D image object
///
/// \opencl_version_warning{1,2}
///
/// \see image_format, image2d
class image1d : public image_object
{
public:
/// Creates a null image1d object.
image1d()
: image_object()
{
}
/// Creates a new image1d object.
///
/// \see_opencl_ref{clCreateImage}
image1d(const context &context,
size_t image_width,
const image_format &format,
cl_mem_flags flags = read_write,
void *host_ptr = 0)
{
#ifdef CL_VERSION_1_2
cl_image_desc desc;
desc.image_type = CL_MEM_OBJECT_IMAGE1D;
desc.image_width = image_width;
desc.image_height = 1;
desc.image_depth = 1;
desc.image_array_size = 0;
desc.image_row_pitch = 0;
desc.image_slice_pitch = 0;
desc.num_mip_levels = 0;
desc.num_samples = 0;
#ifdef CL_VERSION_2_0
desc.mem_object = 0;
#else
desc.buffer = 0;
#endif
cl_int error = 0;
m_mem = clCreateImage(
context, flags, format.get_format_ptr(), &desc, host_ptr, &error
);
if(!m_mem){
BOOST_THROW_EXCEPTION(opencl_error(error));
}
#else
// image1d objects are only supported in OpenCL 1.2 and later
BOOST_THROW_EXCEPTION(opencl_error(CL_IMAGE_FORMAT_NOT_SUPPORTED));
#endif
}
/// Creates a new image1d as a copy of \p other.
image1d(const image1d &other)
: image_object(other)
{
}
/// Copies the image1d from \p other.
image1d& operator=(const image1d &other)
{
image_object::operator=(other);
return *this;
}
#ifndef BOOST_COMPUTE_NO_RVALUE_REFERENCES
/// Move-constructs a new image object from \p other.
image1d(image1d&& other) BOOST_NOEXCEPT
: image_object(std::move(other))
{
}
/// Move-assigns the image from \p other to \c *this.
image1d& operator=(image1d&& other) BOOST_NOEXCEPT
{
image_object::operator=(std::move(other));
return *this;
}
#endif // BOOST_COMPUTE_NO_RVALUE_REFERENCES
/// Destroys the image1d object.
~image1d()
{
}
/// Returns the size (width) of the image.
extents<1> size() const
{
extents<1> size;
size[0] = get_info<size_t>(CL_IMAGE_WIDTH);
return size;
}
/// Returns the origin of the image (\c 0).
extents<1> origin() const
{
return extents<1>();
}
/// Returns information about the image.
///
/// \see_opencl_ref{clGetImageInfo}
template<class T>
T get_info(cl_image_info info) const
{
return get_image_info<T>(info);
}
/// \overload
template<int Enum>
typename detail::get_object_info_type<image1d, Enum>::type
get_info() const;
/// Returns the supported image formats for the context.
///
/// \see_opencl_ref{clGetSupportedImageFormats}
static std::vector<image_format>
get_supported_formats(const context &context, cl_mem_flags flags = read_write)
{
#ifdef CL_VERSION_1_2
return image_object::get_supported_formats(context, CL_MEM_OBJECT_IMAGE1D, flags);
#else
return std::vector<image_format>();
#endif
}
/// Returns \c true if \p format is a supported 1D image format for
/// \p context.
static bool is_supported_format(const image_format &format,
const context &context,
cl_mem_flags flags = read_write)
{
#ifdef CL_VERSION_1_2
return image_object::is_supported_format(
format, context, CL_MEM_OBJECT_IMAGE1D, flags
);
#else
return false;
#endif
}
/// Creates a new image with a copy of the data in \c *this. Uses \p queue
/// to perform the copy operation.
image1d clone(command_queue &queue) const;
};
/// \internal_ define get_info() specializations for image1d
BOOST_COMPUTE_DETAIL_DEFINE_GET_INFO_SPECIALIZATIONS(image1d,
((cl_image_format, CL_IMAGE_FORMAT))
((size_t, CL_IMAGE_ELEMENT_SIZE))
((size_t, CL_IMAGE_ROW_PITCH))
((size_t, CL_IMAGE_SLICE_PITCH))
((size_t, CL_IMAGE_WIDTH))
((size_t, CL_IMAGE_HEIGHT))
((size_t, CL_IMAGE_DEPTH))
)
namespace detail {
// set_kernel_arg() specialization for image1d
template<>
struct set_kernel_arg<image1d> : public set_kernel_arg<image_object> { };
} // end detail namespace
} // end compute namespace
} // end boost namespace
BOOST_COMPUTE_TYPE_NAME(boost::compute::image1d, image1d_t)
#endif // BOOST_COMPUTE_IMAGE_IMAGE1D_HPP
@@ -0,0 +1,132 @@
// Copyright Aleksey Gurtovoy 2000-2004
//
// Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
//
// Preprocessed version of "boost/mpl/aux_/advance_backward.hpp" header
// -- DO NOT modify by hand!
namespace boost { namespace mpl { namespace aux {
template< long N > struct advance_backward;
template<>
struct advance_backward<0>
{
template< typename Iterator > struct apply
{
typedef Iterator iter0;
typedef iter0 type;
};
/// ETI workaround
template<> struct apply<int>
{
typedef int type;
};
};
template<>
struct advance_backward<1>
{
template< typename Iterator > struct apply
{
typedef Iterator iter0;
typedef typename prior<iter0>::type iter1;
typedef iter1 type;
};
/// ETI workaround
template<> struct apply<int>
{
typedef int type;
};
};
template<>
struct advance_backward<2>
{
template< typename Iterator > struct apply
{
typedef Iterator iter0;
typedef typename prior<iter0>::type iter1;
typedef typename prior<iter1>::type iter2;
typedef iter2 type;
};
/// ETI workaround
template<> struct apply<int>
{
typedef int type;
};
};
template<>
struct advance_backward<3>
{
template< typename Iterator > struct apply
{
typedef Iterator iter0;
typedef typename prior<iter0>::type iter1;
typedef typename prior<iter1>::type iter2;
typedef typename prior<iter2>::type iter3;
typedef iter3 type;
};
/// ETI workaround
template<> struct apply<int>
{
typedef int type;
};
};
template<>
struct advance_backward<4>
{
template< typename Iterator > struct apply
{
typedef Iterator iter0;
typedef typename prior<iter0>::type iter1;
typedef typename prior<iter1>::type iter2;
typedef typename prior<iter2>::type iter3;
typedef typename prior<iter3>::type iter4;
typedef iter4 type;
};
/// ETI workaround
template<> struct apply<int>
{
typedef int type;
};
};
template< long N >
struct advance_backward
{
template< typename Iterator > struct apply
{
typedef typename apply_wrap1<
advance_backward<4>
, Iterator
>::type chunk_result_;
typedef typename apply_wrap1<
advance_backward<(
(N - 4) < 0
? 0
: N - 4
)>
, chunk_result_
>::type type;
};
};
}}}
@@ -0,0 +1,697 @@
// Boost.Range library
//
// Copyright Neil Groves 2007. Use, modification and
// distribution is subject to the Boost Software License, Version
// 1.0. (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
//
//
// For more information, see http://www.boost.org/libs/range/
//
#ifndef BOOST_RANGE_ADAPTOR_STRIDED_HPP_INCLUDED
#define BOOST_RANGE_ADAPTOR_STRIDED_HPP_INCLUDED
#include <boost/range/adaptor/argument_fwd.hpp>
#include <boost/range/iterator_range.hpp>
#include <boost/iterator/iterator_facade.hpp>
#include <iterator>
namespace boost
{
namespace range_detail
{
// strided_iterator for wrapping a forward traversal iterator
template<class BaseIterator, class Category>
class strided_iterator
: public iterator_facade<
strided_iterator<BaseIterator, Category>
, typename iterator_value<BaseIterator>::type
, forward_traversal_tag
, typename iterator_reference<BaseIterator>::type
, typename iterator_difference<BaseIterator>::type
>
{
friend class ::boost::iterator_core_access;
typedef iterator_facade<
strided_iterator<BaseIterator, Category>
, typename iterator_value<BaseIterator>::type
, forward_traversal_tag
, typename iterator_reference<BaseIterator>::type
, typename iterator_difference<BaseIterator>::type
> super_t;
public:
typedef typename super_t::difference_type difference_type;
typedef typename super_t::reference reference;
typedef BaseIterator base_iterator;
typedef std::forward_iterator_tag iterator_category;
strided_iterator()
: m_it()
, m_last()
, m_stride()
{
}
strided_iterator(base_iterator it,
base_iterator last,
difference_type stride)
: m_it(it)
, m_last(last)
, m_stride(stride)
{
}
template<class OtherIterator>
strided_iterator(
const strided_iterator<OtherIterator, Category>& other,
typename enable_if_convertible<
OtherIterator,
base_iterator
>::type* = 0
)
: m_it(other.base())
, m_last(other.base_end())
, m_stride(other.get_stride())
{
}
base_iterator base() const
{
return m_it;
}
base_iterator base_end() const
{
return m_last;
}
difference_type get_stride() const
{
return m_stride;
}
private:
void increment()
{
for (difference_type i = 0;
(m_it != m_last) && (i < m_stride); ++i)
{
++m_it;
}
}
reference dereference() const
{
return *m_it;
}
template<class OtherIterator>
bool equal(
const strided_iterator<OtherIterator, Category>& other,
typename enable_if_convertible<
OtherIterator,
base_iterator
>::type* = 0) const
{
return m_it == other.m_it;
}
base_iterator m_it;
base_iterator m_last;
difference_type m_stride;
};
// strided_iterator for wrapping a bidirectional iterator
template<class BaseIterator>
class strided_iterator<BaseIterator, bidirectional_traversal_tag>
: public iterator_facade<
strided_iterator<BaseIterator, bidirectional_traversal_tag>
, typename iterator_value<BaseIterator>::type
, bidirectional_traversal_tag
, typename iterator_reference<BaseIterator>::type
, typename iterator_difference<BaseIterator>::type
>
{
friend class ::boost::iterator_core_access;
typedef iterator_facade<
strided_iterator<BaseIterator, bidirectional_traversal_tag>
, typename iterator_value<BaseIterator>::type
, bidirectional_traversal_tag
, typename iterator_reference<BaseIterator>::type
, typename iterator_difference<BaseIterator>::type
> super_t;
public:
typedef typename super_t::difference_type difference_type;
typedef typename super_t::reference reference;
typedef BaseIterator base_iterator;
typedef typename boost::make_unsigned<difference_type>::type
size_type;
typedef std::bidirectional_iterator_tag iterator_category;
strided_iterator()
: m_it()
, m_offset()
, m_index()
, m_stride()
{
}
strided_iterator(base_iterator it,
size_type index,
difference_type stride)
: m_it(it)
, m_offset()
, m_index(index)
, m_stride(stride)
{
if (stride && ((m_index % stride) != 0))
m_index += (stride - (m_index % stride));
}
template<class OtherIterator>
strided_iterator(
const strided_iterator<
OtherIterator,
bidirectional_traversal_tag
>& other,
typename enable_if_convertible<
OtherIterator,
base_iterator
>::type* = 0
)
: m_it(other.base())
, m_offset(other.get_offset())
, m_index(other.get_index())
, m_stride(other.get_stride())
{
}
base_iterator base() const
{
return m_it;
}
difference_type get_offset() const
{
return m_offset;
}
size_type get_index() const
{
return m_index;
}
difference_type get_stride() const
{
return m_stride;
}
private:
void increment()
{
m_offset += m_stride;
}
void decrement()
{
m_offset -= m_stride;
}
reference dereference() const
{
update();
return *m_it;
}
void update() const
{
std::advance(m_it, m_offset);
m_index += m_offset;
m_offset = 0;
}
template<class OtherIterator>
bool equal(
const strided_iterator<
OtherIterator,
bidirectional_traversal_tag
>& other,
typename enable_if_convertible<
OtherIterator,
base_iterator
>::type* = 0) const
{
return (m_index + m_offset) ==
(other.get_index() + other.get_offset());
}
mutable base_iterator m_it;
mutable difference_type m_offset;
mutable size_type m_index;
difference_type m_stride;
};
// strided_iterator implementation for wrapping a random access iterator
template<class BaseIterator>
class strided_iterator<BaseIterator, random_access_traversal_tag>
: public iterator_facade<
strided_iterator<BaseIterator, random_access_traversal_tag>
, typename iterator_value<BaseIterator>::type
, random_access_traversal_tag
, typename iterator_reference<BaseIterator>::type
, typename iterator_difference<BaseIterator>::type
>
{
friend class ::boost::iterator_core_access;
typedef iterator_facade<
strided_iterator<BaseIterator, random_access_traversal_tag>
, typename iterator_value<BaseIterator>::type
, random_access_traversal_tag
, typename iterator_reference<BaseIterator>::type
, typename iterator_difference<BaseIterator>::type
> super_t;
public:
typedef typename super_t::difference_type difference_type;
typedef typename super_t::reference reference;
typedef BaseIterator base_iterator;
typedef std::random_access_iterator_tag iterator_category;
strided_iterator()
: m_it()
, m_first()
, m_index(0)
, m_stride()
{
}
strided_iterator(
base_iterator first,
base_iterator it,
difference_type stride
)
: m_it(it)
, m_first(first)
, m_index(stride ? (it - first) : difference_type())
, m_stride(stride)
{
if (stride && ((m_index % stride) != 0))
m_index += (stride - (m_index % stride));
}
template<class OtherIterator>
strided_iterator(
const strided_iterator<
OtherIterator,
random_access_traversal_tag
>& other,
typename enable_if_convertible<
OtherIterator,
base_iterator
>::type* = 0
)
: m_it(other.base())
, m_first(other.base_begin())
, m_index(other.get_index())
, m_stride(other.get_stride())
{
}
base_iterator base_begin() const
{
return m_first;
}
base_iterator base() const
{
return m_it;
}
difference_type get_stride() const
{
return m_stride;
}
difference_type get_index() const
{
return m_index;
}
private:
void increment()
{
m_index += m_stride;
}
void decrement()
{
m_index -= m_stride;
}
void advance(difference_type offset)
{
m_index += (m_stride * offset);
}
// Implementation detail: only update the actual underlying iterator
// at the point of dereference. This is done so that the increment
// and decrement can overshoot the valid sequence as is required
// by striding. Since we can do all comparisons just with the index
// simply, and all dereferences must be within the valid range.
void update() const
{
m_it = m_first + m_index;
}
template<class OtherIterator>
difference_type distance_to(
const strided_iterator<
OtherIterator,
random_access_traversal_tag
>& other,
typename enable_if_convertible<
OtherIterator, base_iterator>::type* = 0) const
{
BOOST_ASSERT((other.m_index - m_index) % m_stride == difference_type());
return (other.m_index - m_index) / m_stride;
}
template<class OtherIterator>
bool equal(
const strided_iterator<
OtherIterator,
random_access_traversal_tag
>& other,
typename enable_if_convertible<
OtherIterator, base_iterator>::type* = 0) const
{
return m_index == other.m_index;
}
reference dereference() const
{
update();
return *m_it;
}
private:
mutable base_iterator m_it;
base_iterator m_first;
difference_type m_index;
difference_type m_stride;
};
template<class Rng, class Difference> inline
strided_iterator<
typename range_iterator<Rng>::type,
forward_traversal_tag
>
make_begin_strided_iterator(
Rng& rng,
Difference stride,
forward_traversal_tag)
{
return strided_iterator<
typename range_iterator<Rng>::type,
forward_traversal_tag
>(boost::begin(rng), boost::end(rng), stride);
}
template<class Rng, class Difference> inline
strided_iterator<
typename range_iterator<const Rng>::type,
forward_traversal_tag
>
make_begin_strided_iterator(
const Rng& rng,
Difference stride,
forward_traversal_tag)
{
return strided_iterator<
typename range_iterator<const Rng>::type,
forward_traversal_tag
>(boost::begin(rng), boost::end(rng), stride);
}
template<class Rng, class Difference> inline
strided_iterator<
typename range_iterator<Rng>::type,
forward_traversal_tag
>
make_end_strided_iterator(
Rng& rng,
Difference stride,
forward_traversal_tag)
{
return strided_iterator<
typename range_iterator<Rng>::type,
forward_traversal_tag
>(boost::end(rng), boost::end(rng), stride);
}
template<class Rng, class Difference> inline
strided_iterator<
typename range_iterator<const Rng>::type,
forward_traversal_tag
>
make_end_strided_iterator(
const Rng& rng,
Difference stride,
forward_traversal_tag)
{
return strided_iterator<
typename range_iterator<const Rng>::type,
forward_traversal_tag
>(boost::end(rng), boost::end(rng), stride);
}
template<class Rng, class Difference> inline
strided_iterator<
typename range_iterator<Rng>::type,
bidirectional_traversal_tag
>
make_begin_strided_iterator(
Rng& rng,
Difference stride,
bidirectional_traversal_tag)
{
typedef typename range_difference<Rng>::type difference_type;
return strided_iterator<
typename range_iterator<Rng>::type,
bidirectional_traversal_tag
>(boost::begin(rng), difference_type(), stride);
}
template<class Rng, class Difference> inline
strided_iterator<
typename range_iterator<const Rng>::type,
bidirectional_traversal_tag
>
make_begin_strided_iterator(
const Rng& rng,
Difference stride,
bidirectional_traversal_tag)
{
typedef typename range_difference<const Rng>::type difference_type;
return strided_iterator<
typename range_iterator<const Rng>::type,
bidirectional_traversal_tag
>(boost::begin(rng), difference_type(), stride);
}
template<class Rng, class Difference> inline
strided_iterator<
typename range_iterator<Rng>::type,
bidirectional_traversal_tag
>
make_end_strided_iterator(
Rng& rng,
Difference stride,
bidirectional_traversal_tag)
{
return strided_iterator<
typename range_iterator<Rng>::type,
bidirectional_traversal_tag
>(boost::end(rng), boost::size(rng), stride);
}
template<class Rng, class Difference> inline
strided_iterator<
typename range_iterator<const Rng>::type,
bidirectional_traversal_tag
>
make_end_strided_iterator(
const Rng& rng,
Difference stride,
bidirectional_traversal_tag)
{
return strided_iterator<
typename range_iterator<const Rng>::type,
bidirectional_traversal_tag
>(boost::end(rng), boost::size(rng), stride);
}
template<class Rng, class Difference> inline
strided_iterator<
typename range_iterator<Rng>::type,
random_access_traversal_tag
>
make_begin_strided_iterator(
Rng& rng,
Difference stride,
random_access_traversal_tag)
{
return strided_iterator<
typename range_iterator<Rng>::type,
random_access_traversal_tag
>(boost::begin(rng), boost::begin(rng), stride);
}
template<class Rng, class Difference> inline
strided_iterator<
typename range_iterator<const Rng>::type,
random_access_traversal_tag
>
make_begin_strided_iterator(
const Rng& rng,
Difference stride,
random_access_traversal_tag)
{
return strided_iterator<
typename range_iterator<const Rng>::type,
random_access_traversal_tag
>(boost::begin(rng), boost::begin(rng), stride);
}
template<class Rng, class Difference> inline
strided_iterator<
typename range_iterator<Rng>::type,
random_access_traversal_tag
>
make_end_strided_iterator(
Rng& rng,
Difference stride,
random_access_traversal_tag)
{
return strided_iterator<
typename range_iterator<Rng>::type,
random_access_traversal_tag
>(boost::begin(rng), boost::end(rng), stride);
}
template<class Rng, class Difference> inline
strided_iterator<
typename range_iterator<const Rng>::type,
random_access_traversal_tag
>
make_end_strided_iterator(
const Rng& rng,
Difference stride,
random_access_traversal_tag)
{
return strided_iterator<
typename range_iterator<const Rng>::type,
random_access_traversal_tag
>(boost::begin(rng), boost::end(rng), stride);
}
template<
class Rng,
class Category =
typename iterators::pure_iterator_traversal<
typename range_iterator<Rng>::type
>::type
>
class strided_range
: public iterator_range<
range_detail::strided_iterator<
typename range_iterator<Rng>::type,
Category
>
>
{
typedef range_detail::strided_iterator<
typename range_iterator<Rng>::type,
Category
> iter_type;
typedef iterator_range<iter_type> super_t;
public:
template<class Difference>
strided_range(Difference stride, Rng& rng)
: super_t(
range_detail::make_begin_strided_iterator(
rng, stride,
typename iterator_traversal<
typename range_iterator<Rng>::type
>::type()),
range_detail::make_end_strided_iterator(
rng, stride,
typename iterator_traversal<
typename range_iterator<Rng>::type
>::type()))
{
BOOST_ASSERT( stride >= 0 );
}
};
template<class Difference>
class strided_holder : public holder<Difference>
{
public:
explicit strided_holder(Difference value)
: holder<Difference>(value)
{
}
};
template<class Rng, class Difference>
inline strided_range<Rng>
operator|(Rng& rng, const strided_holder<Difference>& stride)
{
return strided_range<Rng>(stride.val, rng);
}
template<class Rng, class Difference>
inline strided_range<const Rng>
operator|(const Rng& rng, const strided_holder<Difference>& stride)
{
return strided_range<const Rng>(stride.val, rng);
}
} // namespace range_detail
using range_detail::strided_range;
namespace adaptors
{
namespace
{
const range_detail::forwarder<range_detail::strided_holder>
strided = range_detail::forwarder<
range_detail::strided_holder>();
}
template<class Range, class Difference>
inline strided_range<Range>
stride(Range& rng, Difference step)
{
return strided_range<Range>(step, rng);
}
template<class Range, class Difference>
inline strided_range<const Range>
stride(const Range& rng, Difference step)
{
return strided_range<const Range>(step, rng);
}
} // namespace 'adaptors'
} // namespace 'boost'
#endif
@@ -0,0 +1,27 @@
#ifndef BOOST_MPL_BEGIN_END_FWD_HPP_INCLUDED
#define BOOST_MPL_BEGIN_END_FWD_HPP_INCLUDED
// Copyright Aleksey Gurtovoy 2000-2004
//
// Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
//
// See http://www.boost.org/libs/mpl for documentation.
// $Id$
// $Date$
// $Revision$
namespace boost { namespace mpl {
template< typename Tag > struct begin_impl;
template< typename Tag > struct end_impl;
template< typename Sequence > struct begin;
template< typename Sequence > struct end;
}}
#endif // BOOST_MPL_BEGIN_END_FWD_HPP_INCLUDED
@@ -0,0 +1,91 @@
program contest72
use packjt
integer dat(12)
logical text,bcontest,ok
character*22 msg,msg0,msg1
character*72 ct1,ct2
character*12 callsign1,callsign2
character*1 c0
character*42 c
character*6 mygrid
data c/'0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ +-./?'/
data bcontest/.true./
data mygrid/"EM48 "/
! itype Message Type
!--------------------
! 1 Standardd message
! 2 Type 1 prefix
! 3 Type 1 suffix
! 4 Type 2 prefix
! 5 Type 2 suffix
! 6 Free text
! -1 Does not decode correctly
nargs=iargc()
if(nargs.eq.0) open(10,file='contest_msgs.txt',status='old')
nn=0
do imsg=1,9999
if(nargs.eq.1) then
if(imsg.gt.1) exit
call getarg(1,msg0)
else
read(10,1001,end=999) msg0
1001 format(a22)
endif
msg=msg0
if(bcontest) call to_contest_msg(msg0,msg)
call packmsg(msg,dat,itype)
call unpackmsg(dat,msg1)
call fix_contest_msg(mygrid,msg1)
ok=msg1.eq.msg0
if(msg0.eq.' ') then
write(*,1002)
else
if(jt_c2(1:1).eq.'W') msg0=' '//msg0(1:20)
nn=nn+1
write(*,1002) nn,msg0,ok,jt_itype,jt_nc1,jt_nc2,jt_ng,jt_k1,jt_k2
1002 format(i1,'. ',a22,L2,i2,2i10,i6,2i8)
if(index(msg1,' 73 ').gt.4) nn=0
endif
if(.not.ok) print*,msg0,msg1
if(itype.lt.0 .or. itype.eq.6) cycle
if(msg(1:3).eq.'CQ ') then
m=2
write(ct1,1010) dat
1010 format(12b6.6)
! write(*,1014) ct1
1014 format(a72)
cycle
endif
i1=index(msg,'<')
if(i1.eq.1) then
m=0
cycle
endif
if(i.ge.5) then
m=3
cycle
endif
if(msg(1:6).eq.'73 CQ ') then
m=4
cycle
endif
call packmsg(msg,dat,itype)
write(ct1,1010) dat
call packtext(msg,nc1,nc2,ng)
! write(ct2,1012) nc1,nc2,ng+32768
!1012 format(2b28.28,b16.16)
! write(*,1014) ct1
! write(*,1014) ct2
! write(*,1014)
enddo
999 end program contest72
@@ -0,0 +1,95 @@
#ifndef BOOST_MPL_AUX_NA_HPP_INCLUDED
#define BOOST_MPL_AUX_NA_HPP_INCLUDED
// Copyright Aleksey Gurtovoy 2001-2004
//
// Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
//
// See http://www.boost.org/libs/mpl for documentation.
// $Id$
// $Date$
// $Revision$
#include <boost/mpl/bool.hpp>
#include <boost/mpl/aux_/na_fwd.hpp>
#include <boost/mpl/aux_/config/msvc.hpp>
#include <boost/mpl/aux_/config/ctps.hpp>
namespace boost { namespace mpl {
template< typename T >
struct is_na
: false_
{
#if BOOST_WORKAROUND(BOOST_MSVC, < 1300)
using false_::value;
#endif
};
template<>
struct is_na<na>
: true_
{
#if BOOST_WORKAROUND(BOOST_MSVC, < 1300)
using true_::value;
#endif
};
template< typename T >
struct is_not_na
: true_
{
#if BOOST_WORKAROUND(BOOST_MSVC, < 1300)
using true_::value;
#endif
};
template<>
struct is_not_na<na>
: false_
{
#if BOOST_WORKAROUND(BOOST_MSVC, < 1300)
using false_::value;
#endif
};
#if !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION)
template< typename T, typename U > struct if_na
{
typedef T type;
};
template< typename U > struct if_na<na,U>
{
typedef U type;
};
#else
template< typename T > struct if_na_impl
{
template< typename U > struct apply
{
typedef T type;
};
};
template<> struct if_na_impl<na>
{
template< typename U > struct apply
{
typedef U type;
};
};
template< typename T, typename U > struct if_na
: if_na_impl<T>::template apply<U>
{
};
#endif
}}
#endif // BOOST_MPL_AUX_NA_HPP_INCLUDED
@@ -0,0 +1,60 @@
// Status=review
.Main Window:
- Select *FT8* on the *Mode* menu.
- Set Tx and Rx frequencies to 1200 Hz.
- Double-click on *Erase* to clear both text windows.
.Wide Graph Settings:
- *Bins/Pixel* = 4, *Start* = 200 Hz, *N Avg* = 2
- Adjust the width of the Wide Graph window so that the upper
frequency limit is approximately 2600 Hz.
.Open a Wave File:
- Select *File | Open* and navigate to
+...\save\samples\FT8\170709_135615.wav+. The waterfall and decoded
text window should look something like the following screen shots:
[[X15]]
image::170709_135615.wav.png[align="left",alt="Wide Graph Decode 170709_135615"]
image::ft8_decodes.png[align="left"]
- Click with the mouse anywhere on the waterfall display. The green Rx
frequency marker will jump to your selected frequency, and the Rx
frequency control on the main window will be updated accordingly.
- Do the same thing with the *Shift* key held down. Now the red Tx
frequency marker and its associated control on the main window will
follow your frequency selections.
- Do the same thing with the *Ctrl* key held down. Now the both colored
markers and both spinner controls will follow your selections.
- Double-clicking at any frequency on the waterfall does all the
things just described and also invokes the decoder in a small range
around the Rx frequency. To decode a particular signal, double-click
near the left edge of its waterfall trace.
- Now double-click on any of the the lines of decoded text in the main
window. All three lines will show the same behavior, setting Rx
frequency to that of the selected message and leaving Tx frequency
unchanged. To change both Rx and Tx frequencies, hold *Ctrl* down
when double-clicking.
NOTE: To avoid QRM from competing callers, it is frequently desirable
to answer a CQ on a different frequency from that of the CQing
station. Choose a Tx frequency that appears to be not in use. The
same is true when you tail-end another QSO.
NOTE: The FT8 decoder can often copy several overlapping signals at
nearly the same frequency. Keyboard shortcuts *Shift+F11* and
*Shift+F12* provide an easy way to move your Tx frequency down or up
in 60 Hz steps.
NOTE: Further helpful tips on FT8 operating procedures are available
{ft8_tips}. Thanks to ZL2IFB!
IMPORTANT: When finished with this Tutorial, don't forget to re-enter
your own callsign as *My Call* on the *Settings | General* tab.
@@ -0,0 +1,292 @@
/////////////////////////////////////////////////////////////////////////////
//
// (C) Copyright Joaquin M Lopez Munoz 2006-2013
// (C) Copyright Ion Gaztanaga 2014-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/intrusive for documentation.
//
/////////////////////////////////////////////////////////////////////////////
#ifndef BOOST_INTRUSIVE_DETAIL_EBO_HOLDER_HPP
#define BOOST_INTRUSIVE_DETAIL_EBO_HOLDER_HPP
#ifndef BOOST_CONFIG_HPP
# include <boost/config.hpp>
#endif
#if defined(BOOST_HAS_PRAGMA_ONCE)
# pragma once
#endif
#include <boost/intrusive/detail/workaround.hpp>
#include <boost/move/utility_core.hpp>
namespace boost {
namespace intrusive {
namespace detail {
#if defined(BOOST_MSVC) || defined(__BORLANDC_)
#define BOOST_INTRUSIVE_TT_DECL __cdecl
#else
#define BOOST_INTRUSIVE_TT_DECL
#endif
#if defined(_MSC_EXTENSIONS) && !defined(__BORLAND__) && !defined(_WIN64) && !defined(_M_ARM) && !defined(UNDER_CE)
#define BOOST_INTRUSIVE_TT_TEST_MSC_FUNC_SIGS
#endif
template <typename T>
struct is_unary_or_binary_function_impl
{ static const bool value = false; };
// see boost ticket #4094
// avoid duplicate definitions of is_unary_or_binary_function_impl
#ifndef BOOST_INTRUSIVE_TT_TEST_MSC_FUNC_SIGS
template <typename R>
struct is_unary_or_binary_function_impl<R (*)()>
{ static const bool value = true; };
template <typename R>
struct is_unary_or_binary_function_impl<R (*)(...)>
{ static const bool value = true; };
#else // BOOST_INTRUSIVE_TT_TEST_MSC_FUNC_SIGS
template <typename R>
struct is_unary_or_binary_function_impl<R (__stdcall*)()>
{ static const bool value = true; };
#ifndef _MANAGED
template <typename R>
struct is_unary_or_binary_function_impl<R (__fastcall*)()>
{ static const bool value = true; };
#endif
template <typename R>
struct is_unary_or_binary_function_impl<R (__cdecl*)()>
{ static const bool value = true; };
template <typename R>
struct is_unary_or_binary_function_impl<R (__cdecl*)(...)>
{ static const bool value = true; };
#endif
// see boost ticket #4094
// avoid duplicate definitions of is_unary_or_binary_function_impl
#ifndef BOOST_INTRUSIVE_TT_TEST_MSC_FUNC_SIGS
template <typename R, class T0>
struct is_unary_or_binary_function_impl<R (*)(T0)>
{ static const bool value = true; };
template <typename R, class T0>
struct is_unary_or_binary_function_impl<R (*)(T0...)>
{ static const bool value = true; };
#else // BOOST_INTRUSIVE_TT_TEST_MSC_FUNC_SIGS
template <typename R, class T0>
struct is_unary_or_binary_function_impl<R (__stdcall*)(T0)>
{ static const bool value = true; };
#ifndef _MANAGED
template <typename R, class T0>
struct is_unary_or_binary_function_impl<R (__fastcall*)(T0)>
{ static const bool value = true; };
#endif
template <typename R, class T0>
struct is_unary_or_binary_function_impl<R (__cdecl*)(T0)>
{ static const bool value = true; };
template <typename R, class T0>
struct is_unary_or_binary_function_impl<R (__cdecl*)(T0...)>
{ static const bool value = true; };
#endif
// see boost ticket #4094
// avoid duplicate definitions of is_unary_or_binary_function_impl
#ifndef BOOST_INTRUSIVE_TT_TEST_MSC_FUNC_SIGS
template <typename R, class T0, class T1>
struct is_unary_or_binary_function_impl<R (*)(T0, T1)>
{ static const bool value = true; };
template <typename R, class T0, class T1>
struct is_unary_or_binary_function_impl<R (*)(T0, T1...)>
{ static const bool value = true; };
#else // BOOST_INTRUSIVE_TT_TEST_MSC_FUNC_SIGS
template <typename R, class T0, class T1>
struct is_unary_or_binary_function_impl<R (__stdcall*)(T0, T1)>
{ static const bool value = true; };
#ifndef _MANAGED
template <typename R, class T0, class T1>
struct is_unary_or_binary_function_impl<R (__fastcall*)(T0, T1)>
{ static const bool value = true; };
#endif
template <typename R, class T0, class T1>
struct is_unary_or_binary_function_impl<R (__cdecl*)(T0, T1)>
{ static const bool value = true; };
template <typename R, class T0, class T1>
struct is_unary_or_binary_function_impl<R (__cdecl*)(T0, T1...)>
{ static const bool value = true; };
#endif
template <typename T>
struct is_unary_or_binary_function_impl<T&>
{ static const bool value = false; };
template<typename T>
struct is_unary_or_binary_function : is_unary_or_binary_function_impl<T>
{};
template<typename T, bool = is_unary_or_binary_function<T>::value>
class ebo_functor_holder
{
BOOST_COPYABLE_AND_MOVABLE(ebo_functor_holder)
public:
typedef T functor_type;
BOOST_INTRUSIVE_FORCEINLINE ebo_functor_holder()
: t_()
{}
BOOST_INTRUSIVE_FORCEINLINE explicit ebo_functor_holder(const T &t)
: t_(t)
{}
BOOST_INTRUSIVE_FORCEINLINE explicit ebo_functor_holder(BOOST_RV_REF(T) t)
: t_(::boost::move(t))
{}
template<class Arg1, class Arg2>
BOOST_INTRUSIVE_FORCEINLINE ebo_functor_holder(BOOST_FWD_REF(Arg1) arg1, BOOST_FWD_REF(Arg2) arg2)
: t_(::boost::forward<Arg1>(arg1), ::boost::forward<Arg2>(arg2))
{}
BOOST_INTRUSIVE_FORCEINLINE ebo_functor_holder(const ebo_functor_holder &x)
: t_(x.t_)
{}
BOOST_INTRUSIVE_FORCEINLINE ebo_functor_holder(BOOST_RV_REF(ebo_functor_holder) x)
: t_(x.t_)
{}
BOOST_INTRUSIVE_FORCEINLINE ebo_functor_holder& operator=(BOOST_COPY_ASSIGN_REF(ebo_functor_holder) x)
{
this->get() = x.get();
return *this;
}
BOOST_INTRUSIVE_FORCEINLINE ebo_functor_holder& operator=(BOOST_RV_REF(ebo_functor_holder) x)
{
this->get() = ::boost::move(x.get());
return *this;
}
BOOST_INTRUSIVE_FORCEINLINE ebo_functor_holder& operator=(const T &x)
{
this->get() = x;
return *this;
}
BOOST_INTRUSIVE_FORCEINLINE ebo_functor_holder& operator=(BOOST_RV_REF(T) x)
{
this->get() = ::boost::move(x);
return *this;
}
BOOST_INTRUSIVE_FORCEINLINE T& get(){return t_;}
BOOST_INTRUSIVE_FORCEINLINE const T& get()const{return t_;}
private:
T t_;
};
template<typename T>
class ebo_functor_holder<T, false>
: public T
{
BOOST_COPYABLE_AND_MOVABLE(ebo_functor_holder)
public:
typedef T functor_type;
BOOST_INTRUSIVE_FORCEINLINE ebo_functor_holder()
: T()
{}
BOOST_INTRUSIVE_FORCEINLINE explicit ebo_functor_holder(const T &t)
: T(t)
{}
BOOST_INTRUSIVE_FORCEINLINE explicit ebo_functor_holder(BOOST_RV_REF(T) t)
: T(::boost::move(t))
{}
template<class Arg1, class Arg2>
BOOST_INTRUSIVE_FORCEINLINE ebo_functor_holder(BOOST_FWD_REF(Arg1) arg1, BOOST_FWD_REF(Arg2) arg2)
: T(::boost::forward<Arg1>(arg1), ::boost::forward<Arg2>(arg2))
{}
BOOST_INTRUSIVE_FORCEINLINE ebo_functor_holder(const ebo_functor_holder &x)
: T(static_cast<const T&>(x))
{}
BOOST_INTRUSIVE_FORCEINLINE ebo_functor_holder(BOOST_RV_REF(ebo_functor_holder) x)
: T(BOOST_MOVE_BASE(T, x))
{}
BOOST_INTRUSIVE_FORCEINLINE ebo_functor_holder& operator=(BOOST_COPY_ASSIGN_REF(ebo_functor_holder) x)
{
const ebo_functor_holder&r = x;
this->get() = r;
return *this;
}
BOOST_INTRUSIVE_FORCEINLINE ebo_functor_holder& operator=(BOOST_RV_REF(ebo_functor_holder) x)
{
this->get() = ::boost::move(x.get());
return *this;
}
BOOST_INTRUSIVE_FORCEINLINE ebo_functor_holder& operator=(const T &x)
{
this->get() = x;
return *this;
}
BOOST_INTRUSIVE_FORCEINLINE ebo_functor_holder& operator=(BOOST_RV_REF(T) x)
{
this->get() = ::boost::move(x);
return *this;
}
BOOST_INTRUSIVE_FORCEINLINE T& get(){return *this;}
BOOST_INTRUSIVE_FORCEINLINE const T& get()const{return *this;}
};
} //namespace detail {
} //namespace intrusive {
} //namespace boost {
#endif //#ifndef BOOST_INTRUSIVE_DETAIL_EBO_HOLDER_HPP
@@ -0,0 +1,183 @@
// -*- Mode: C++ -*-
///////////////////////////////////////////////////////////////////////////
// Some code in this file and accompanying files is based on work by
// Moe Wheatley, AE4Y, released under the "Simplified BSD License".
// For more details see the accompanying file LICENSE_WHEATLEY.TXT
///////////////////////////////////////////////////////////////////////////
#ifndef PLOTTER_H
#define PLOTTER_H
#ifdef QT5
#include <QtWidgets>
#else
#include <QtGui>
#endif
#include <QFrame>
#include <QImage>
#include <QVector>
#include <cstring>
#define VERT_DIVS 7 //specify grid screen divisions
#define HORZ_DIVS 20
extern bool g_single_decode;
class CPlotter : public QFrame
{
Q_OBJECT;
public:
explicit CPlotter(QWidget *parent = 0);
~CPlotter();
QSize minimumSizeHint() const;
QSize sizeHint() const;
bool m_bScaleOK;
void draw(float swide[], bool bScroll, bool bRed); //Update the waterfall
void SetRunningState(bool running);
void setPlotZero(int plotZero);
int plotZero();
void setPlotGain(int plotGain);
int plotGain();
int plot2dGain();
void setPlot2dGain(int n);
int plot2dZero();
void setPlot2dZero(int plot2dZero);
void setStartFreq(int f);
int startFreq();
int plotWidth();
void UpdateOverlay();
void setDataFromDisk(bool b);
void setRxRange(int fMin);
void setBinsPerPixel(int n);
int binsPerPixel();
void setWaterfallAvg(int n);
void setRxFreq(int n);
void DrawOverlay();
int rxFreq();
void setFsample(int n);
void setNsps(int ntrperiod, int nsps);
void setTxFreq(int n);
void setMode(QString mode);
void setSubMode(int n);
void setModeTx(QString modeTx);
void SetPercent2DScreen(int percent);
int Fmax();
void setDialFreq(double d);
void setCurrent(bool b) {m_bCurrent = b;}
bool current() const {return m_bCurrent;}
void setCumulative(bool b) {m_bCumulative = b;}
bool cumulative() const {return m_bCumulative;}
void setLinearAvg(bool b) {m_bLinearAvg = b;}
bool linearAvg() const {return m_bLinearAvg;}
void setBreadth(qint32 w) {m_w = w;}
qint32 breadth() const {return m_w;}
float fSpan() const {return m_fSpan;}
void setLockTxFreq(bool b) {m_lockTxFreq = b;}
void setColours(QVector<QColor> const& cl);
void setFlatten(bool b1, bool b2);
void setTol(int n);
void setRxBand(QString band);
void setReference(bool b) {m_bReference = b;}
bool Reference() const {return m_bReference;}
void drawRed(int ia, int ib, float swide[]);
void setVHF(bool bVHF);
void setRedFile(QString fRed);
signals:
void freezeDecode1(int n);
void setFreq1(int rxFreq, int txFreq);
protected:
//re-implemented widget event handlers
void paintEvent(QPaintEvent *event);
void resizeEvent(QResizeEvent* event);
private:
void MakeFrequencyStrs();
int XfromFreq(float f);
float FreqfromX(int x);
bool m_bCurrent;
bool m_bCumulative;
bool m_bLinearAvg;
bool m_bReference;
bool m_bReference0;
bool m_lockTxFreq;
bool m_bVHF;
float m_fSpan;
qint32 m_plotZero;
qint32 m_plotGain;
qint32 m_plot2dGain;
qint32 m_plot2dZero;
qint32 m_binsPerPixel;
qint32 m_waterfallAvg;
qint32 m_w;
qint32 m_Flatten;
qint32 m_nSubMode;
qint32 m_ia;
qint32 m_ib;
QPixmap m_WaterfallPixmap;
QPixmap m_2DPixmap;
QPixmap m_ScalePixmap;
QPixmap m_OverlayPixmap;
QSize m_Size;
QString m_Str;
QString m_HDivText[483];
QString m_mode;
QString m_modeTx;
QString m_rxBand;
QString m_redFile;
bool m_Running;
bool m_paintEventBusy;
bool m_dataFromDisk;
double m_fftBinWidth;
double m_dialFreq;
double m_xOffset;
float m_sum[2048];
qint32 m_dBStepSize;
qint32 m_FreqUnits;
qint32 m_hdivs;
qint32 m_line;
qint32 m_fSample;
qint32 m_xClick;
qint32 m_freqPerDiv;
qint32 m_nsps;
qint32 m_Percent2DScreen;
qint32 m_Percent2DScreen0;
qint32 m_h;
qint32 m_h1;
qint32 m_h2;
qint32 m_TRperiod;
qint32 m_rxFreq;
qint32 m_txFreq;
qint32 m_fMin;
qint32 m_fMax;
qint32 m_startFreq;
qint32 m_tol;
char m_sutc[6];
private slots:
void mousePressEvent(QMouseEvent *event);
void mouseDoubleClickEvent(QMouseEvent *event);
};
extern QVector<QColor> g_ColorTbl;
extern "C" {
void flat4_(float swide[], int* iz, int* nflatten);
}
#endif // PLOTTER_H
@@ -0,0 +1,68 @@
// 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 POINTER_TYPE_ID_DWA2002222_HPP
# define POINTER_TYPE_ID_DWA2002222_HPP
# include <boost/python/type_id.hpp>
# include <boost/type_traits/composite_traits.hpp>
namespace boost { namespace python { namespace converter {
namespace detail
{
template <bool is_ref = false>
struct pointer_typeid_select
{
template <class T>
static inline type_info execute(T*(*)() = 0)
{
return type_id<T>();
}
};
template <>
struct pointer_typeid_select<true>
{
template <class T>
static inline type_info execute(T* const volatile&(*)() = 0)
{
return type_id<T>();
}
template <class T>
static inline type_info execute(T*volatile&(*)() = 0)
{
return type_id<T>();
}
template <class T>
static inline type_info execute(T*const&(*)() = 0)
{
return type_id<T>();
}
template <class T>
static inline type_info execute(T*&(*)() = 0)
{
return type_id<T>();
}
};
}
// Usage: pointer_type_id<T>()
//
// Returns a type_info associated with the type pointed
// to by T, which may be a pointer or a reference to a pointer.
template <class T>
type_info pointer_type_id(T(*)() = 0)
{
return detail::pointer_typeid_select<
is_reference<T>::value
>::execute((T(*)())0);
}
}}} // namespace boost::python::converter
#endif // POINTER_TYPE_ID_DWA2002222_HPP
@@ -0,0 +1,28 @@
//---------------------------------------------------------------------------//
// Copyright (c) 2013 Kyle Lutz <kyle.r.lutz@gmail.com>
//
// Distributed under the Boost Software License, Version 1.0
// See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt
//
// See http://boostorg.github.com/compute for more information.
//---------------------------------------------------------------------------//
#ifndef BOOST_COMPUTE_RANDOM_HPP
#define BOOST_COMPUTE_RANDOM_HPP
/// \file
///
/// Meta-header to include all Boost.Compute random headers.
#include <boost/compute/random/bernoulli_distribution.hpp>
#include <boost/compute/random/default_random_engine.hpp>
#include <boost/compute/random/discrete_distribution.hpp>
#include <boost/compute/random/linear_congruential_engine.hpp>
#include <boost/compute/random/mersenne_twister_engine.hpp>
#include <boost/compute/random/threefry_engine.hpp>
#include <boost/compute/random/normal_distribution.hpp>
#include <boost/compute/random/uniform_int_distribution.hpp>
#include <boost/compute/random/uniform_real_distribution.hpp>
#endif // BOOST_COMPUTE_RANDOM_HPP
@@ -0,0 +1,67 @@
<HTML><HEAD>
<TITLE> Github Facilities </TITLE>
</HEAD><BODY>
<H1> Github Facilities </H1>
<P>Starting with the Version of 2012-02-11, the source code repository
for this software is hosted by <A HREF="http://github.com">Github</A>,
and is located at <A
HREF="http://github.com/radfordneal/LDPC-codes">http://github.com/radfordneal/LDPC-codes</A>.
This repository includes the annotated log of changes made since the
Version of 2006-02-08.
<P>You can use the facilities at Github to obtain the source-code
repository, report bugs, and contribute to the wiki.
<H2>Obtaining the source repository, and modifying it</H2>
<P>To obtain a copy of the source-code repository, issue the following
command (in a Unix/Linux/Cygwin environment that has git installed):
<BLOCKQUOTE><PRE>
git clone git://github.com/radfordneal/LDPC-codes
</PRE></BLOCKQUOTE>
This will retrieve the current state of the software, storing it
in the directory <TT>LDPC-codes</TT>, which you should ensure does not
exist before issuing this command above.
<P>Note that if all you want to do is compile and use the current
version, you can instead download the source without development
history as described in the <A HREF="install.html">installation
instructions</A>.
<P>The <TT>LDPC-codes</TT> directory created by the <TT>git clone</TT>
command is a git repository, which can be manipulated with the various
forms of the <TT>git</TT> command, which are documented, for example,
<A HREF="http://git-scm.com/documentation">here</A>.
<P>Each stable version of the software is a separate branch of the
repository. The documentation on the most recent stable version is in
the "gh-pages" branch. The current development version is on the
"master" branch. The are other branches for each stable version that
was released.
<P>You can make local changes to your copy of the repository, and use
the modified software. If you wish, you can ask me
(radfordneal@gmail.com) to include your changes in a new release, or,
if you register as a <A HREF="http://github.com">Github</A> user, you can set
up your own fork of the software for you and other people to use.
<H2>Reporting Bugs</H2>
You can use the Github "Issues" facility to report bugs in the
software. You have to register as a <A HREF="github.com">Github</A>
user to do this (which is free). You can then go <A
HREF="https://github.com/radfordneal/LDPC-codes/issues">here</A> and
click on "New issue" to report a bug. You can also use this facility
to suggest new features or other revisions. I may not have time to
implement them, but perhaps someone else will.
<HR>
<A HREF="index.html">Back to index for LDPC software</A>
</BODY></HTML>
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,173 @@
The _WSJT-X_ packages include program *`rigctl-wsjtx[.exe]`*, which
can be used to send CAT sequences to a rig from the command line, or
from a batch file or shell script; and program *`rigctld-wsjtx[.exe]`*,
which allows other compatible applications to share a CAT connection
to a rig. These program versions include the latest Hamlib rig
drivers -- the same ones used by _WSJT-X_ itself.
Additional utility programs *`jt4code`*, *`jt9code`*, and *`jt65code`*
let you explore the conversion of user-level messages into channel
symbols or "`tone numbers,`" and back again. These programs can be
useful to someone designing a beacon generator, for understanding the
permissible structure of transmitted messages, and for studying
behavior of the error-control codes.
Channel-symbol values for JT4 run from 0 to 3. The total number of
symbols in a transmitted message is 206. To run `jt4code`, enter the
program name followed by a JT4 message enclosed in quotes. In Windows
the command and program output might look like this:
C:\WSJTX\bin> jt4code "G0XYZ K1ABC FN42"
Message Decoded Err? Type
-------------------------------------------------------------------
1. G0XYZ K1ABC FN42 G0XYZ K1ABC FN42 1: Std Msg
Channel symbols
2 0 0 1 3 2 0 2 3 1 0 3 3 2 2 1 2 1 0 0 0 2 0 0 2 1 1 2 0 0
2 0 2 0 2 0 2 0 2 3 0 3 1 0 3 1 0 3 0 1 1 1 1 1 0 1 0 0 2 3
2 2 3 0 2 1 3 3 3 3 2 0 2 1 2 3 0 0 2 3 1 1 1 0 3 1 2 0 3 2
0 2 3 3 0 1 2 1 2 1 0 1 0 1 1 1 1 3 0 3 0 3 2 3 3 0 3 0 1 0
3 3 3 0 0 3 2 1 3 2 3 1 3 3 2 2 0 2 3 3 2 1 1 0 2 2 3 3 1 2
3 1 1 2 1 1 1 0 2 1 2 0 2 3 1 2 3 1 2 2 1 2 0 0 3 3 1 1 1 1
2 0 3 3 0 2 2 2 3 3 0 0 0 1 2 3 3 2 1 1 1 3 2 3 0 3
Channel-symbol values for JT9 run from 0 to 8, with 0 representing the
sync tone. The total number of symbols in a transmitted message is
85. Enter the program name followed by a JT9 message enclosed in
quotes:
C:\WSJTX\bin> jt9code "G0XYZ K1ABC FN42"
Message Decoded Err? Type
-------------------------------------------------------------------
1. G0XYZ K1ABC FN42 G0XYZ K1ABC FN42 1: Std Msg
Channel symbols
0 0 7 3 0 3 2 5 4 0 1 7 7 7 8 0 4 8 8 2 2 1 0 1 1 3 5 4 5 6
8 7 0 6 0 1 8 3 3 7 8 1 1 2 4 5 8 1 5 2 0 0 8 6 0 5 8 5 1 0
5 8 7 7 2 0 4 6 6 6 7 6 0 1 8 8 5 7 2 5 1 5 0 4 0
For the corresponding program *`jt65code`* only the
information-carrying channel symbols are shown, and the symbol values
range from 0 to 63. Sync symbols lie two tone intervals below data
tone 0, and the sequential locations of sync symbols are described in
the <<JT65PRO,JT65 Protocol>> section of this Guide.
A typical execution of `jt65code` is shown below. The program
displays the packed message of 72 bits, shown here as 12 six-bit
symbol values, followed by the channel symbols:
C:\WSJTX\bin> jt65code "G0XYZ K1ABC FN42"
Message Decoded Err? Type
----------------------------------------------------------------------
1. G0XYZ K1ABC FN42 G0XYZ K1ABC FN42 1: Std Msg
Packed message, 6-bit symbols 61 36 45 30 3 55 3 2 14 5 33 40
Information-carrying channel symbols
56 40 8 40 51 47 50 34 44 53 22 53 28 31 13 60 46 2 14 58 43
41 58 35 8 35 3 24 1 21 41 43 0 25 54 9 41 54 7 25 21 9
62 59 7 43 31 21 57 13 59 41 17 49 19 54 21 39 33 42 18 2 60
For an illustration of the power of the strong error-control coding in
JT9 and JT65, try looking at the channel symbols after changing a
single character in the message. For example, change the grid locator
from FN42 to FN43 in the JT65 message:
C:\WSJTX\bin> jt65code "G0XYZ K1ABC FN43"
Message Decoded Err? Type
----------------------------------------------------------------------
1. G0XYZ K1ABC FN43 G0XYZ K1ABC FN43 1: Std Msg
Packed message, 6-bit symbols 61 36 45 30 3 55 3 2 14 5 33 41
Information-carrying channel symbols
25 35 47 8 13 9 61 40 44 9 51 6 8 40 38 34 8 2 21 23 30
51 32 56 39 35 3 50 48 30 8 5 40 18 54 9 24 30 26 61 23 11
3 59 7 7 39 1 25 24 4 50 17 49 52 19 34 7 4 34 61 2 61
You will discover that every possible JT65 message differs from every
other possible JT65 message in at least 52 of the 63
information-carrying channel symbols.
Here's an example using the QRA64 mode:
C:\WSJTX\bin qra64code "KA1ABC WB9XYZ EN37"
Message Decoded Err? Type
--------------------------------------------------------------------------
1 KA1ABC WB9XYZ EN37 KA1ABC WB9XYZ EN37 1: Std Msg
Packed message, 6-bit symbols 34 16 49 32 51 26 31 40 41 22 0 41
Information-carrying channel symbols
34 16 49 32 51 26 31 40 41 22 0 41 16 46 14 24 58 45 22 45 38 54 7 23 2 49 32 50 20 33
55 51 7 31 31 46 41 25 55 14 62 33 29 24 2 49 4 38 15 21 1 41 56 56 16 44 17 30 46 36
23 23 41
Channel symbols including sync
20 50 60 0 40 10 30 34 16 49 32 51 26 31 40 41 22 0 41 16 46 14 24 58 45 22 45 38 54 7
23 2 49 32 50 20 33 55 51 20 50 60 0 40 10 30 7 31 31 46 41 25 55 14 62 33 29 24 2 49
4 38 15 21 1 41 56 56 16 44 17 30 46 36 23 23 41 20 50 60 0 40 10 30
Execution of any of these utility programs with "-t" as the only
command-line argument produces examples of all supported message
types. For example, using `jt65code -t`:
C:\WSJTX\bin> jt65code -t
Message Decoded Err? Type
--------------------------------------------------------------------------
1. CQ WB9XYZ EN34 CQ WB9XYZ EN34 1: Std Msg
2. CQ DX WB9XYZ EN34 CQ DX WB9XYZ EN34 1: Std Msg
3. QRZ WB9XYZ EN34 QRZ WB9XYZ EN34 1: Std Msg
4. KA1ABC WB9XYZ EN34 KA1ABC WB9XYZ EN34 1: Std Msg
5. KA1ABC WB9XYZ RO KA1ABC WB9XYZ RO 1: Std Msg
6. KA1ABC WB9XYZ -21 KA1ABC WB9XYZ -21 1: Std Msg
7. KA1ABC WB9XYZ R-19 KA1ABC WB9XYZ R-19 1: Std Msg
8. KA1ABC WB9XYZ RRR KA1ABC WB9XYZ RRR 1: Std Msg
9. KA1ABC WB9XYZ 73 KA1ABC WB9XYZ 73 1: Std Msg
10. KA1ABC WB9XYZ KA1ABC WB9XYZ 1: Std Msg
11. CQ 000 WB9XYZ EN34 CQ 000 WB9XYZ EN34 1: Std Msg
12. CQ 999 WB9XYZ EN34 CQ 999 WB9XYZ EN34 1: Std Msg
13. CQ EU WB9XYZ EN34 CQ EU WB9XYZ EN34 1: Std Msg
14. CQ WY WB9XYZ EN34 CQ WY WB9XYZ EN34 1: Std Msg
15. ZL/KA1ABC WB9XYZ ZL/KA1ABC WB9XYZ 2: Type 1 pfx
16. KA1ABC ZL/WB9XYZ KA1ABC ZL/WB9XYZ 2: Type 1 pfx
17. KA1ABC/4 WB9XYZ KA1ABC/4 WB9XYZ 3: Type 1 sfx
18. KA1ABC WB9XYZ/4 KA1ABC WB9XYZ/4 3: Type 1 sfx
19. CQ ZL4/KA1ABC CQ ZL4/KA1ABC 4: Type 2 pfx
20. DE ZL4/KA1ABC DE ZL4/KA1ABC 4: Type 2 pfx
21. QRZ ZL4/KA1ABC QRZ ZL4/KA1ABC 4: Type 2 pfx
22. CQ WB9XYZ/VE4 CQ WB9XYZ/VE4 5: Type 2 sfx
23. HELLO WORLD HELLO WORLD 6: Free text
24. ZL4/KA1ABC 73 ZL4/KA1ABC 73 6: Free text
25. KA1ABC XL/WB9XYZ KA1ABC XL/WB9 * 6: Free text
26. KA1ABC WB9XYZ/W4 KA1ABC WB9XYZ * 6: Free text
27. 123456789ABCDEFGH 123456789ABCD * 6: Free text
28. KA1ABC WB9XYZ EN34 OOO KA1ABC WB9XYZ EN34 OOO 1: Std Msg
29. KA1ABC WB9XYZ OOO KA1ABC WB9XYZ OOO 1: Std Msg
30. RO RO -1: Shorthand
31. RRR RRR -1: Shorthand
32. 73 73 -1: Shorthand
MSK144 uses a binary channel code, so transmitted symbols have the value
0 or 1. Even numbered symbols (index starting at 0) are transmitted on
the I (in-phase) channel, odd numbered symbols on the Q (quadrature)
channel. A typical execution of `msk144code` is shown below.
C:\WSJTX\bin> msk144code "K1ABC W9XYZ EN37"
Message Decoded Err? Type
--------------------------------------------------------------------------
1. K1ABC W9XYZ EN37 K1ABC W9XYZ EN37 1: Std Msg
Channel symbols
110000100011001101010101001000111111001001001100110010011100001001000000
010110001011101111001010111011001100110101011000111101100010111100100011
C:\WSJTX\bin> msk144code "<KA1ABC WB9XYZ> R-03"
Message Decoded Err? Type
--------------------------------------------------------------------------
1. <KA1ABC WB9XYZ> R-03 <KA1ABC WB9XYZ> R-03 7: Hashed calls
Channel symbols
1000011100001000111011111010011011111010
@@ -0,0 +1,9 @@
0; 0; 0
94;114;114
138;162;162
171;201;201
199;232;232
216;243;243
228;247;247
241;251;251
255;255;255
@@ -0,0 +1,43 @@
/*
[auto_generated]
boost/numeric/odeint/algebra/detail/macros.hpp
[begin_description]
Some macros for type checking.
[end_description]
Copyright 2010-2012 Karsten Ahnert
Copyright 2010 Mario Mulansky
Distributed under the Boost Software License, Version 1.0.
(See accompanying file LICENSE_1_0.txt or
copy at http://www.boost.org/LICENSE_1_0.txt)
*/
#ifndef BOOST_NUMERIC_ODEINT_ALGEBRA_DETAIL_MACROS_HPP_INCLUDED
#define BOOST_NUMERIC_ODEINT_ALGEBRA_DETAIL_MACROS_HPP_INCLUDED
//type traits aren't working with nvcc
#ifndef __CUDACC__
#include <boost/type_traits.hpp>
#include <boost/static_assert.hpp>
#define BOOST_ODEINT_CHECK_CONTAINER_TYPE( Type1 , Type2 ) \
BOOST_STATIC_ASSERT(( boost::is_same< typename boost::remove_const< Type1 >::type , Type2 >::value ))
#else
//empty macro for nvcc
#define BOOST_ODEINT_CHECK_CONTAINER_TYPE( Type1 , Type2 )
#endif // __CUDACC__
/*
#define BOOST_ODEINT_CHECK_OPERATION_ARITY( Operation , Arity ) \
BOOST_STATIC_ASSERT(( boost::function_traits< Operation >::arity == Arity ))
*/
#endif // BOOST_NUMERIC_ODEINT_ALGEBRA_DETAIL_MACROS_HPP_INCLUDED
@@ -0,0 +1,186 @@
// (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_RAT_14_HPP
#define BOOST_MATH_TOOLS_POLY_RAT_14_HPP
namespace boost{ namespace math{ namespace tools{ namespace detail{
template <class T, class U, class V>
inline V evaluate_rational_c_imp(const T*, const U*, const V&, const mpl::int_<0>*) BOOST_MATH_NOEXCEPT(V)
{
return static_cast<V>(0);
}
template <class T, class U, class V>
inline V evaluate_rational_c_imp(const T* a, const U* b, const V&, const mpl::int_<1>*) BOOST_MATH_NOEXCEPT(V)
{
return static_cast<V>(a[0]) / static_cast<V>(b[0]);
}
template <class T, class U, class V>
inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<2>*) BOOST_MATH_NOEXCEPT(V)
{
if(x <= 1)
return static_cast<V>((a[1] * x + a[0]) / (b[1] * x + b[0]));
else
{
V z = 1 / x;
return static_cast<V>((a[0] * z + a[1]) / (b[0] * z + b[1]));
}
}
template <class T, class U, class V>
inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<3>*) BOOST_MATH_NOEXCEPT(V)
{
if(x <= 1)
return static_cast<V>(((a[2] * x + a[1]) * x + a[0]) / ((b[2] * x + b[1]) * x + b[0]));
else
{
V z = 1 / x;
return static_cast<V>(((a[0] * z + a[1]) * z + a[2]) / ((b[0] * z + b[1]) * z + b[2]));
}
}
template <class T, class U, class V>
inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<4>*) BOOST_MATH_NOEXCEPT(V)
{
if(x <= 1)
return static_cast<V>((((a[3] * x + a[2]) * x + a[1]) * x + a[0]) / (((b[3] * x + b[2]) * x + b[1]) * x + b[0]));
else
{
V z = 1 / x;
return static_cast<V>((((a[0] * z + a[1]) * z + a[2]) * z + a[3]) / (((b[0] * z + b[1]) * z + b[2]) * z + b[3]));
}
}
template <class T, class U, class V>
inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<5>*) BOOST_MATH_NOEXCEPT(V)
{
if(x <= 1)
return static_cast<V>(((((a[4] * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / ((((b[4] * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0]));
else
{
V z = 1 / x;
return static_cast<V>(((((a[0] * z + a[1]) * z + a[2]) * z + a[3]) * z + a[4]) / ((((b[0] * z + b[1]) * z + b[2]) * z + b[3]) * z + b[4]));
}
}
template <class T, class U, class V>
inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<6>*) BOOST_MATH_NOEXCEPT(V)
{
if(x <= 1)
return static_cast<V>((((((a[5] * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / (((((b[5] * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0]));
else
{
V z = 1 / x;
return static_cast<V>((((((a[0] * z + a[1]) * z + a[2]) * z + a[3]) * z + a[4]) * z + a[5]) / (((((b[0] * z + b[1]) * z + b[2]) * z + b[3]) * z + b[4]) * z + b[5]));
}
}
template <class T, class U, class V>
inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<7>*) BOOST_MATH_NOEXCEPT(V)
{
if(x <= 1)
return static_cast<V>(((((((a[6] * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / ((((((b[6] * x + b[5]) * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0]));
else
{
V z = 1 / x;
return static_cast<V>(((((((a[0] * z + a[1]) * z + a[2]) * z + a[3]) * z + a[4]) * z + a[5]) * z + a[6]) / ((((((b[0] * z + b[1]) * z + b[2]) * z + b[3]) * z + b[4]) * z + b[5]) * z + b[6]));
}
}
template <class T, class U, class V>
inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<8>*) BOOST_MATH_NOEXCEPT(V)
{
if(x <= 1)
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]) / (((((((b[7] * x + b[6]) * x + b[5]) * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0]));
else
{
V z = 1 / x;
return static_cast<V>((((((((a[0] * z + a[1]) * z + a[2]) * z + a[3]) * z + a[4]) * z + a[5]) * z + a[6]) * z + a[7]) / (((((((b[0] * z + b[1]) * z + b[2]) * z + b[3]) * z + b[4]) * z + b[5]) * z + b[6]) * z + b[7]));
}
}
template <class T, class U, class V>
inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<9>*) BOOST_MATH_NOEXCEPT(V)
{
if(x <= 1)
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]) / ((((((((b[8] * x + b[7]) * x + b[6]) * x + b[5]) * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0]));
else
{
V z = 1 / x;
return static_cast<V>(((((((((a[0] * z + a[1]) * z + a[2]) * z + a[3]) * z + a[4]) * z + a[5]) * z + a[6]) * z + a[7]) * z + a[8]) / ((((((((b[0] * z + b[1]) * z + b[2]) * z + b[3]) * z + b[4]) * z + b[5]) * z + b[6]) * z + b[7]) * z + b[8]));
}
}
template <class T, class U, class V>
inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<10>*) BOOST_MATH_NOEXCEPT(V)
{
if(x <= 1)
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]) / (((((((((b[9] * x + b[8]) * x + b[7]) * x + b[6]) * x + b[5]) * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0]));
else
{
V z = 1 / x;
return static_cast<V>((((((((((a[0] * z + a[1]) * z + a[2]) * z + a[3]) * z + a[4]) * z + a[5]) * z + a[6]) * z + a[7]) * z + a[8]) * z + a[9]) / (((((((((b[0] * z + b[1]) * z + b[2]) * z + b[3]) * z + b[4]) * z + b[5]) * z + b[6]) * z + b[7]) * z + b[8]) * z + b[9]));
}
}
template <class T, class U, class V>
inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<11>*) BOOST_MATH_NOEXCEPT(V)
{
if(x <= 1)
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]) / ((((((((((b[10] * x + b[9]) * x + b[8]) * x + b[7]) * x + b[6]) * x + b[5]) * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0]));
else
{
V z = 1 / x;
return static_cast<V>(((((((((((a[0] * z + a[1]) * z + a[2]) * z + a[3]) * z + a[4]) * z + a[5]) * z + a[6]) * z + a[7]) * z + a[8]) * z + a[9]) * z + a[10]) / ((((((((((b[0] * z + b[1]) * z + b[2]) * z + b[3]) * z + b[4]) * z + b[5]) * z + b[6]) * z + b[7]) * z + b[8]) * z + b[9]) * z + b[10]));
}
}
template <class T, class U, class V>
inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<12>*) BOOST_MATH_NOEXCEPT(V)
{
if(x <= 1)
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]) / (((((((((((b[11] * x + b[10]) * x + b[9]) * x + b[8]) * x + b[7]) * x + b[6]) * x + b[5]) * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0]));
else
{
V z = 1 / x;
return static_cast<V>((((((((((((a[0] * z + a[1]) * z + a[2]) * z + a[3]) * z + a[4]) * z + a[5]) * z + a[6]) * z + a[7]) * z + a[8]) * z + a[9]) * z + a[10]) * z + a[11]) / (((((((((((b[0] * z + b[1]) * z + b[2]) * z + b[3]) * z + b[4]) * z + b[5]) * z + b[6]) * z + b[7]) * z + b[8]) * z + b[9]) * z + b[10]) * z + b[11]));
}
}
template <class T, class U, class V>
inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<13>*) BOOST_MATH_NOEXCEPT(V)
{
if(x <= 1)
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]) / ((((((((((((b[12] * x + b[11]) * x + b[10]) * x + b[9]) * x + b[8]) * x + b[7]) * x + b[6]) * x + b[5]) * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0]));
else
{
V z = 1 / x;
return static_cast<V>(((((((((((((a[0] * z + a[1]) * z + a[2]) * z + a[3]) * z + a[4]) * z + a[5]) * z + a[6]) * z + a[7]) * z + a[8]) * z + a[9]) * z + a[10]) * z + a[11]) * z + a[12]) / ((((((((((((b[0] * z + b[1]) * z + b[2]) * z + b[3]) * z + b[4]) * z + b[5]) * z + b[6]) * z + b[7]) * z + b[8]) * z + b[9]) * z + b[10]) * z + b[11]) * z + b[12]));
}
}
template <class T, class U, class V>
inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<14>*) BOOST_MATH_NOEXCEPT(V)
{
if(x <= 1)
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]) / (((((((((((((b[13] * x + b[12]) * x + b[11]) * x + b[10]) * x + b[9]) * x + b[8]) * x + b[7]) * x + b[6]) * x + b[5]) * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0]));
else
{
V z = 1 / x;
return static_cast<V>((((((((((((((a[0] * z + a[1]) * z + a[2]) * z + a[3]) * z + a[4]) * z + a[5]) * z + a[6]) * z + a[7]) * z + a[8]) * z + a[9]) * z + a[10]) * z + a[11]) * z + a[12]) * z + a[13]) / (((((((((((((b[0] * z + b[1]) * z + b[2]) * z + b[3]) * z + b[4]) * z + b[5]) * z + b[6]) * z + b[7]) * z + b[8]) * z + b[9]) * z + b[10]) * z + b[11]) * z + b[12]) * z + b[13]));
}
}
}}}} // namespaces
#endif // include guard
@@ -0,0 +1,123 @@
subroutine sync8(iwave,nfa,nfb,nfqso,s,candidate,ncand)
include 'ft8_params.f90'
parameter (JZ=20)
complex cx(0:NH1)
real s(NH1,NHSYM)
real savg(NH1)
real x(NFFT1)
real sync2d(NH1,-JZ:JZ)
real red(NH1)
real candidate0(3,100)
real candidate(3,100)
integer*2 iwave(NMAX)
integer jpeak(NH1)
integer indx(NH1)
integer ii(1)
integer icos7(0:6)
data icos7/2,5,6,0,4,1,3/ !Costas 7x7 tone pattern
equivalence (x,cx)
! Compute symbol spectra at half-symbol steps.
savg=0.
istep=NSPS/2 !1024
tstep=istep/12000.0 !0.085333 s
df=12000.0/NFFT1 !2.93 Hz
! Compute symbol spectra at half-symbol steps
fac=1.0/300.0
do j=1,NHSYM
ia=(j-1)*istep + 1
ib=ia+NSPS-1
x(1:NSPS)=fac*iwave(ia:ib)
x(NSPS+1:)=0.
call four2a(x,NFFT1,1,-1,0) !r2c FFT
do i=1,NH1
s(i,j)=real(cx(i))**2 + aimag(cx(i))**2
enddo
savg=savg + s(1:NH1,j) !Average spectrum
enddo
savg=savg/NHSYM
ia=max(1,nint(nfa/df))
ib=nint(nfb/df)
do i=ia,ib
do j=-JZ,JZ
t=0.
t0=0.
do n=0,6
k=j+2*n
if(k.ge.1) then
t=t + s(i+2*icos7(n),k)
t0=t0 + sum(s(i:i+12:2,k))
endif
t=t + s(i+2*icos7(n),k+72)
t0=t0 + sum(s(i:i+12:2,k+72))
if(k+144.le.NHSYM) then
t=t + s(i+2*icos7(n),k+144)
t0=t0 + sum(s(i:i+12:2,k+144))
endif
enddo
t0=(t0-t)/6.0
sync2d(i,j)=t/t0
enddo
enddo
red=0.
do i=ia,ib
ii=maxloc(sync2d(i,-JZ:JZ)) - 1 - JZ
j0=ii(1)
jpeak(i)=j0
red(i)=sync2d(i,j0)
! write(52,3052) i*df,red(i),db(red(i))
!3052 format(3f12.3)
enddo
iz=ib-ia+1
call indexx(red(ia:ib),iz,indx)
ibase=indx(nint(0.40*iz)) - 1 + ia
base=red(ibase)
red=red/base
candidate0=0.
k=0
syncmin=1.5
do i=1,100
n=ia + indx(iz+1-i) - 1
if(red(n).lt.syncmin) exit
k=k+1
candidate0(1,k)=n*df
candidate0(2,k)=(jpeak(n)-1)*tstep
candidate0(3,k)=red(n)
enddo
ncand=min(100,k)
! Put nfqso at top of list, and save only the best of near-dupe freqs.
do i=1,ncand
if(abs(candidate0(1,i)-nfqso).lt.10.0) candidate0(1,i)=-candidate0(1,i)
if(i.ge.2) then
do j=1,i-1
fdiff=abs(candidate0(1,i))-abs(candidate0(1,j))
if(abs(fdiff).lt.4.0) then
if(candidate0(3,i).ge.candidate0(3,j)) candidate0(3,j)=0.
if(candidate0(3,i).lt.candidate0(3,j)) candidate0(3,i)=0.
endif
enddo
! write(*,3001) i,candidate0(1,i-1),candidate0(1,i),candidate0(3,i-1), &
! candidate0(3,i)
!3001 format(i2,4f8.1)
endif
enddo
fac=20.0/maxval(s)
s=fac*s
call indexx(candidate0(1,1:ncand),ncand,indx)
do i=1,ncand
j=indx(i)
candidate(1,i)=abs(candidate0(1,j))
candidate(2,i)=candidate0(2,j)
candidate(3,i)=candidate0(3,j)
enddo
return
end subroutine sync8