第一次提交

This commit is contained in:
Zhang0626 2022-07-30 11:50:01 +08:00
commit a25359713e
791 changed files with 105049 additions and 0 deletions

1
.gitignore vendored Normal file
View File

@ -0,0 +1 @@
ChaosDataPlayer/out/

View File

@ -0,0 +1,75 @@
#include "Adddeviceform.h"
#include "ui_Adddeviceform.h"
#include <QUdpSocket>
#include "cidwudp.h"
#include <synchapi.h>
#include <qvalidator.h>
#include "QMessageBox"
AddDeviceForm::AddDeviceForm(QWidget *parent) :
BaseWgt(parent),
ui(new Ui::AddDeviceForm)
{
ui->setupUi(m_pMainWgt);
resize(500,320);
setWindowTitle("增加终端");
strIP = "";
connect(ui->Btn_AutoSearch, SIGNAL(clicked()), this, SLOT(AutoSearch()));
connect(ui->Btn_Search, SIGNAL(clicked()), this, SLOT(Search()));
connect(ui->Btn_OK, SIGNAL(clicked()), this, SLOT(AddDevice()));
connect(ui->Btn_Cancel, SIGNAL(clicked()), this, SLOT(Cancel()));
QRegExp rx("\\b(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\.)"
"{3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\b");
QRegExpValidator *validator = new QRegExpValidator(rx, this);
ui->lineEdit->setValidator(validator);
}
AddDeviceForm::~AddDeviceForm()
{
delete ui;
}
void AddDeviceForm::AutoSearch()
{
emit AutoSearchIP();
}
void AddDeviceForm::Search()
{
ui->label_4->setText("");
ui->label_5->setText("");
strIP = ui->lineEdit->text();
if(strIP == ""){
MyMsgBox(QMessageBox::Question,"问题","请输入完整信息");
return;
}
emit AddDeviceIP(strIP,false);
}
void AddDeviceForm::AddDevice()
{
strIP = ui->lineEdit->text();
if(strIP == ""){
MyMsgBox(QMessageBox::Question,"问题","请输入完整信息");
return;
}
emit AddDeviceIP(strIP,false);
}
void AddDeviceForm::UpdateDeviceInfo()
{
qDebug() << "MacAddr_G:" << global::MacAddr_G;
ui->label_4->setText(global::MacAddr_G);
ui->label_5->setText("正常");
qDebug() << "DeviceNO:" << DeviceNO;
}
void AddDeviceForm::Cancel()
{
this->close();
}
void AddDeviceForm::keyPressEvent(QKeyEvent *event)
{
//Enter事件好像这两个都要写只写event->key() == Qt::Key_Enter无法实现
if (event->key() == Qt::Key_Enter || event->key() == Qt::Key_Return)
{
Search();
}
}

View File

@ -0,0 +1,36 @@
#ifndef ADDDEVICEFORM_H
#define ADDDEVICEFORM_H
#include <QWidget>
#include "BaseWgt.h"
#include <QKeyEvent>
#include "msgbox.h"
namespace Ui {
class AddDeviceForm;
}
class AddDeviceForm : public BaseWgt
{
Q_OBJECT
public:
explicit AddDeviceForm(QWidget *parent = nullptr);
~AddDeviceForm();
void UpdateDeviceInfo();
private:
Ui::AddDeviceForm *ui;
QString strIP;
private slots:
void Search();
void AutoSearch();
void AddDevice();
void Cancel();
protected:
virtual void keyPressEvent(QKeyEvent *event);
signals:
void AddDeviceIP(QString,bool);
void AutoSearchIP();
};
#endif // ADDDEVICEFORM_H

View File

@ -0,0 +1,198 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>AddDeviceForm</class>
<widget class="QWidget" name="AddDeviceForm">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>491</width>
<height>300</height>
</rect>
</property>
<property name="windowTitle">
<string>Form</string>
</property>
<property name="styleSheet">
<string notr="true">#Btn_Search { border-image:url(:/images/images/imgModelAction/Search.png) 5; }
#Btn_Search:hover { border-image:url(:/images/images/imgModelAction/Search-h.png) 5; }
#Btn_Search:pressed {border-image:url(:/images/images/imgModelAction/Search-p.png) 5; }
#Btn_Search:checked {border-image:url(:/images/images/imgModelAction/Search.png) 5; }</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<widget class="QWidget" name="widget" native="true">
<property name="minimumSize">
<size>
<width>0</width>
<height>200</height>
</size>
</property>
<widget class="QLineEdit" name="lineEdit">
<property name="geometry">
<rect>
<x>170</x>
<y>50</y>
<width>151</width>
<height>31</height>
</rect>
</property>
<property name="styleSheet">
<string notr="true">background-color: rgb(28, 28, 36);
border-width:0;border-style:outset;
text-align:center;
</string>
</property>
<property name="inputMask">
<string/>
</property>
</widget>
<widget class="QLabel" name="label">
<property name="geometry">
<rect>
<x>113</x>
<y>50</y>
<width>61</width>
<height>31</height>
</rect>
</property>
<property name="text">
<string>IP地址</string>
</property>
</widget>
<widget class="QLabel" name="label_2">
<property name="geometry">
<rect>
<x>110</x>
<y>100</y>
<width>61</width>
<height>31</height>
</rect>
</property>
<property name="text">
<string>设备名称:</string>
</property>
</widget>
<widget class="QLabel" name="label_3">
<property name="geometry">
<rect>
<x>110</x>
<y>130</y>
<width>61</width>
<height>31</height>
</rect>
</property>
<property name="text">
<string>设备状态:</string>
</property>
</widget>
<widget class="QPushButton" name="Btn_Search">
<property name="geometry">
<rect>
<x>330</x>
<y>50</y>
<width>31</width>
<height>31</height>
</rect>
</property>
<property name="styleSheet">
<string notr="true">background-image: url(:/images/images/imgModelAction/Search.png);</string>
</property>
<property name="text">
<string/>
</property>
</widget>
<widget class="QLabel" name="label_4">
<property name="geometry">
<rect>
<x>190</x>
<y>110</y>
<width>141</width>
<height>16</height>
</rect>
</property>
<property name="text">
<string/>
</property>
</widget>
<widget class="QLabel" name="label_5">
<property name="geometry">
<rect>
<x>190</x>
<y>140</y>
<width>141</width>
<height>16</height>
</rect>
</property>
<property name="text">
<string/>
</property>
</widget>
</widget>
</item>
<item>
<widget class="QWidget" name="widget_2" native="true">
<property name="minimumSize">
<size>
<width>0</width>
<height>30</height>
</size>
</property>
<widget class="QPushButton" name="Btn_OK">
<property name="geometry">
<rect>
<x>270</x>
<y>40</y>
<width>75</width>
<height>23</height>
</rect>
</property>
<property name="styleSheet">
<string notr="true">background-color: rgb(69, 90, 108);</string>
</property>
<property name="text">
<string>确认</string>
</property>
</widget>
<widget class="QPushButton" name="Btn_Cancel">
<property name="geometry">
<rect>
<x>370</x>
<y>40</y>
<width>75</width>
<height>23</height>
</rect>
</property>
<property name="layoutDirection">
<enum>Qt::LeftToRight</enum>
</property>
<property name="styleSheet">
<string notr="true">background-color: rgb(69, 90, 108);</string>
</property>
<property name="text">
<string>取消</string>
</property>
</widget>
<widget class="QPushButton" name="Btn_AutoSearch">
<property name="geometry">
<rect>
<x>150</x>
<y>40</y>
<width>75</width>
<height>23</height>
</rect>
</property>
<property name="styleSheet">
<string notr="true">background-color: rgb(69, 90, 108);</string>
</property>
<property name="text">
<string>自动搜索</string>
</property>
</widget>
</widget>
</item>
</layout>
</widget>
<resources/>
<connections/>
</ui>

413
ChaosDataPlayer/BaseWgt.cpp Normal file
View File

@ -0,0 +1,413 @@
#include "BaseWgt.h"
#include <QHoverEvent>
#include <QApplication>
#include <QDesktopWidget>
#include <QDebug>
#include <QDir>
enum MouseStyle{ NORMAL, RIGHT, BOTTOMRIGHT, BOTTOM } mouseStyle;
BaseWgt::BaseWgt(QWidget *parent)
: QWidget(parent)
, m_bResizable(true)
, m_iMarginWidth(6)
, m_bPressed(false)
, m_ptPressPos(0, 0)
, m_bIsMaxState(false)
{
//this->setAttribute(Qt::WA_TranslucentBackground);
this->setWindowFlags(Qt::FramelessWindowHint | Qt::Window);
this->initUiControl();
this->initSignalSlotConn();
this->setAttribute(Qt::WA_Hover);
this->installEventFilter(this);
}
BaseWgt::~BaseWgt()
{
}
bool BaseWgt::eventFilter(QObject *obj, QEvent *event)
{
if (obj != this && obj != m_pTopWgt)
{
return false;
}
switch(event->type())
{
case QEvent::MouseMove:
{
QMouseEvent *mouseEvent = dynamic_cast<QMouseEvent *>(event);
if (m_bPressed && mouseStyle == NORMAL && NULL != mouseEvent)
{
//如果是最大化,则先恢复正常状态
if (m_bIsMaxState)
{
QPoint pt = this->mapFromGlobal(QCursor::pos());
int iMaxWidth = this->width();
m_bIsMaxState = !m_bIsMaxState;
this->resize(m_normalRect.size());
m_pMaxBtn->setProperty("maxState", false);
m_pMaxBtn->setToolTip("最大化");
QStyle *pStyle = this->style();
pStyle->unpolish(m_pMaxBtn);
pStyle->polish(m_pMaxBtn);
m_ptPressPos.setY(pt.y());
m_ptPressPos.setX(pt.x() * (this->width() - 100) / (iMaxWidth - 100));
}
this->move(this->mapToGlobal(mouseEvent->pos()) - m_ptPressPos);
return true;
}
break;
}
//[1]鼠标在界面上移动
case QEvent::HoverMove:
{
QHoverEvent *hoverEvent = dynamic_cast<QHoverEvent *>(event);
if (m_bPressed)
{
//只能在界面右边或者右下角缩放界面
QPoint ptGlobalPos = this->mapToGlobal(hoverEvent->pos());
QPoint ptTopLeft = this->frameGeometry().topLeft();
QPoint ptBottomRight = this->frameGeometry().bottomRight();
switch(mouseStyle)
{
case BOTTOM:
if (ptGlobalPos.y() - ptTopLeft.y() > this->minimumHeight())
{
ptBottomRight.setY(ptGlobalPos.y());
}
else
{
ptBottomRight.setY(ptTopLeft.y() + this->minimumHeight());
}
break;
case RIGHT:
if (ptGlobalPos.x() - ptTopLeft.x() > this->minimumWidth())
{
ptBottomRight.setX(ptGlobalPos.x());
}
else
{
ptBottomRight.setX(ptTopLeft.x() + this->minimumWidth());
}
break;
case BOTTOMRIGHT:
if (ptGlobalPos.y() - ptTopLeft.y() > this->minimumHeight())
{
ptBottomRight.setY(ptGlobalPos.y());
}
else
{
ptBottomRight.setY(ptTopLeft.y() + this->minimumHeight());
}
if (ptGlobalPos.x() - ptTopLeft.x() > this->minimumWidth())
{
ptBottomRight.setX(ptGlobalPos.x());
}
else
{
ptBottomRight.setX(ptTopLeft.x() + this->minimumWidth());
}
break;
}
this->setGeometry(QRect(ptTopLeft, ptBottomRight));
return true;
}
else
{
changeMouseStyle(hoverEvent->pos());
}
}
break;
//[1]end 鼠标在界面上移动
//[2]鼠标按下
case QEvent::MouseButtonPress:
{
//在顶部/右方边缘/右下角时,鼠标按下时做标记
QMouseEvent *mouseEvent = dynamic_cast<QMouseEvent *>(event);
if (mouseEvent->button() == Qt::LeftButton)
{
if (mouseEvent->pos().y() <= TOP_HEIGHT | mouseStyle != NORMAL)
{
qDebug()<<"pressed in";
m_bPressed = true;
m_ptPressPos = mouseEvent->globalPos() - this->frameGeometry().topLeft();
}
}
}
break;
//[2]end 鼠标按下
//[3]鼠标左键松开
case QEvent::MouseButtonRelease:
{
QMouseEvent *mouseEvent = dynamic_cast<QMouseEvent *>(event);
if (mouseEvent->button() == Qt::LeftButton)
{
qDebug()<<"release in";
m_bPressed = false;
changeMouseStyle(mouseEvent->pos());
}
}
break;
//[3]end 鼠标左键松开
//[4]鼠标双击
case QEvent::MouseButtonDblClick:
{
QMouseEvent *mouseEvent = dynamic_cast<QMouseEvent *>(event);
if (mouseEvent->button() == Qt::LeftButton && mouseEvent->pos().y() <= TOP_HEIGHT)
{
qDebug()<<"dbc in";
maximumBtnClickedSlot();
return true;
}
}
break;
//[4]鼠标双击
case QEvent::Show:
{
repaint();
}
default:
break;
}
return false;
}
void BaseWgt::changeMouseStyle(const QPoint &ptMousePos)
{
if (!m_bResizable)
{
setCursor(Qt::ArrowCursor);//正常样式
mouseStyle = NORMAL;
return;
}
if (m_bIsMaxState)
{
setCursor(Qt::ArrowCursor);//正常样式
mouseStyle = NORMAL;
return;
}
int iPosX = ptMousePos.x();
int iPosY = ptMousePos.y();
int iWidth = this->width();
int iHeight = this->height();
if (iPosX >= iWidth - m_iMarginWidth && iPosX <= iWidth)
{
if (iPosY >= iHeight - m_iMarginWidth && iPosY <= iHeight)
{
setCursor(Qt::SizeFDiagCursor);//右下
mouseStyle = BOTTOMRIGHT;
return;
}
setCursor(Qt::SizeHorCursor);
mouseStyle = RIGHT;//右
return;
}
if (iPosY >= iHeight - m_iMarginWidth && iPosY <= iHeight)
{
setCursor(Qt::SizeVerCursor);//下
mouseStyle = BOTTOM;
return;
}
setCursor(Qt::ArrowCursor);
mouseStyle = NORMAL;
return;
}
//[4]设置是否可以伸缩
void BaseWgt::setResizable(bool bResizable)
{
m_bResizable = bResizable;
}
//[4]end 设置是否可以伸缩
//[5]设置鼠标样式在界面边缘改变的范围
void BaseWgt::setMargin(const int &iMargin)
{
m_iMarginWidth = iMargin;
}
//[5]end 设置鼠标样式在界面边缘改变的范围
void BaseWgt::initUiControl()
{
//设置使程序支持中文字符
QTextCodec *codec = QTextCodec::codecForName("System"); // 获取系统编码
QTextCodec::setCodecForLocale(codec);
// QTextCodec::setCodecForCStrings(codec);
// QTextCodec::setCodecForTr(codec);
QDesktopWidget*pDeskTop = QApplication::desktop();
if(pDeskTop->screenCount() >= 2)
{
m_screenRect = pDeskTop->screenGeometry(pDeskTop->primaryScreen() == 0?1:0);
}
else
{
m_screenRect = pDeskTop->availableGeometry();//保存屏幕大小
}
m_pBottomWgt = new QWidget(this);
m_pBottomWgt->setObjectName("m_pBottomWgt");
QVBoxLayout *pVBoxLayoutBottom = new QVBoxLayout(this);
pVBoxLayoutBottom->setMargin(0);
pVBoxLayoutBottom->setSpacing(0);
pVBoxLayoutBottom->addWidget(m_pBottomWgt);
m_pTopWgt = new QWidget(this);
m_pTopWgt->installEventFilter(this);
m_pTopWgt->setObjectName("m_pTopWgt");
m_pTopWgt->setMinimumHeight(TOP_HEIGHT);
m_pTopWgt->setMaximumHeight(TOP_HEIGHT);
//m_pTopWgt->setAttribute(Qt::WA_Hover);
m_pMainWgt = new QWidget(this);
m_pMainWgt->setObjectName("m_pMainWgt");
QVBoxLayout *pVBoxLayout = new QVBoxLayout(m_pBottomWgt);
pVBoxLayout->setMargin(0);
pVBoxLayout->setSpacing(0);
pVBoxLayout->addWidget(m_pTopWgt);
pVBoxLayout->addWidget(m_pMainWgt);
m_pIconLabel = new QLabel(this);
m_pTitleLbl = new QLabel(this);
m_pMinBtn = new QPushButton(this);
m_pMaxBtn = new QPushButton(this);
m_pCloseBtn = new QPushButton(this);
m_pIconLabel->setMinimumSize(20, 20);
m_pIconLabel->setMaximumSize(20, 20);
m_pMinBtn->setMinimumSize(27, 22);
m_pMinBtn->setMaximumSize(27, 22);
m_pMaxBtn->setMinimumSize(27, 22);
m_pMaxBtn->setMaximumSize(27, 22);
m_pCloseBtn->setMinimumSize(42, 22);
m_pCloseBtn->setMaximumSize(42, 22);
m_pMinBtn->setToolTip("最小化");
m_pMaxBtn->setToolTip("最大化");
m_pCloseBtn->setToolTip("关闭");
m_pIconLabel->setObjectName("m_pIconLabel");
m_pTitleLbl->setObjectName("m_pTitleLbl");
m_pMinBtn->setObjectName("m_pMinBtn");
m_pMaxBtn->setObjectName("m_pMaxBtn");
m_pCloseBtn->setObjectName("m_pCloseBtn");
QHBoxLayout *pHBoxLayout = new QHBoxLayout;
pHBoxLayout->setContentsMargins(8, 2, 2, 2);
pHBoxLayout->setSpacing(1);
pHBoxLayout->addWidget(m_pIconLabel);
pHBoxLayout->addSpacing(5);
pHBoxLayout->addWidget(m_pTitleLbl);
pHBoxLayout->addStretch();
pHBoxLayout->addWidget(m_pMinBtn);
pHBoxLayout->addWidget(m_pMaxBtn);
pHBoxLayout->addWidget(m_pCloseBtn);
m_pTopWgt->setLayout(pHBoxLayout);
//载入样式表
QFile file(WGT_STYLE_PATH);
if (file.open(QIODevice::ReadOnly))
{
QString strSheet = file.readAll();
setStyleSheet(strSheet);
}
}
//初始化信号槽连接
void BaseWgt::initSignalSlotConn()
{
connect(m_pMinBtn, SIGNAL(clicked()), this, SLOT(minimumBtnClickedSlot()));
connect(m_pMaxBtn, SIGNAL(clicked()), this, SLOT(maximumBtnClickedSlot()));
connect(m_pCloseBtn, SIGNAL(clicked()), this, SLOT(close()));
}
//最小化按钮单击槽函数
void BaseWgt::minimumBtnClickedSlot()
{
showMinimized();
}
//最大化按钮单击槽函数
void BaseWgt::maximumBtnClickedSlot()
{
m_bIsMaxState = !m_bIsMaxState;
if (m_bIsMaxState)
{
//记录下正常窗口的状态
m_normalRect.setTopLeft(this->frameGeometry().topLeft());
m_normalRect.setSize(this->size());
this->setGeometry(m_screenRect);
m_pMaxBtn->setProperty("maxState", true);
m_pMaxBtn->setToolTip("restore");
}
else
{
this->setGeometry(m_normalRect);
m_pMaxBtn->setProperty("maxState", false);
m_pMaxBtn->setToolTip("最大化");
}
QStyle *pStyle = this->style();
pStyle->unpolish(m_pMaxBtn);
pStyle->polish(m_pMaxBtn);
}
void BaseWgt::setSysIcon(const QString &url)
{
qDebug()<<QDir::currentPath();
QPixmap *pixmap = new QPixmap(url);
m_pTitleLbl->setPixmap(*pixmap);
}
//设置窗口标题
void BaseWgt::setWindowTitle(const QString &strTitle)
{
m_pTitleLbl->setText(strTitle);
m_pTitleLbl->setFixedSize(m_pTitleLbl->sizeHint());
m_pTitleLbl->setFixedHeight(22);
}
void BaseWgt::hideTopWgt()
{
m_pTopWgt->hide();
}
void BaseWgt::setTopWgtHiddent(bool bHide)
{
if(bHide)
{
m_pTopWgt->hide();
}
else
{
m_pTopWgt->show();
}
}
void BaseWgt::setCloseBtnVisible(bool bVisible)
{
if(!m_pCloseBtn) return;
m_pCloseBtn->setVisible(bVisible);
}

66
ChaosDataPlayer/BaseWgt.h Normal file
View File

@ -0,0 +1,66 @@
#ifndef BASEWGT_H
#define BASEWGT_H
#include <QWidget>
#include <QLabel>
#include <QPushButton>
#include <QEvent>
#include <QVBoxLayout>
#include <QHBoxLayout>
#include <QStyle>
#include <QTextCodec>
#define TOP_HEIGHT 25
#define WGT_STYLE_PATH ":/qss/mainui.css"
class BaseWgt : public QWidget
{
Q_OBJECT
public:
BaseWgt(QWidget *parent = 0);
~BaseWgt();
void setResizable(bool bResizable); //设置是否可以伸缩
void setMargin(const int &iMargin); //设置鼠标样式在界面边缘改变的范围
void setSysIcon(const QString &url);
void setWindowTitle(const QString &); //设置窗口标题
void hideTopWgt(); //隐藏标题
void setTopWgtHiddent(bool bHide);
void setCloseBtnVisible(bool bVisible);
protected:
virtual bool eventFilter(QObject *, QEvent *);
private:
void changeMouseStyle(const QPoint &); //改变鼠标样式
void initUiControl(); //初始化界面控件
void initSignalSlotConn(); //初始化信号槽连接
private slots:
void minimumBtnClickedSlot(); //最小化按钮单击槽函数
void maximumBtnClickedSlot(); //最大化按钮单击槽函数
protected:
QWidget *m_pTopWgt; //顶部
QWidget *m_pBottomWgt; //底部窗口
QWidget *m_pMainWgt; //主体
QLabel *m_pIconLabel; //系统图标
QPushButton *m_pMinBtn; //最小化
QPushButton *m_pMaxBtn; //最大化
QPushButton *m_pCloseBtn; //关闭
QRect m_screenRect; //最大化窗口
private:
bool m_bResizable; //是否可拉伸
int m_iMarginWidth; //边缘距离
bool m_bPressed; //标记鼠标是否按下
QPoint m_ptPressPos; //鼠标按下的位置
bool m_bIsMaxState; //是否是最大化
QLabel *m_pTitleLbl; //标题
QRect m_normalRect; //正常窗口
};
#endif // BASEWGT_H

View File

@ -0,0 +1,700 @@
#include "Calculation.hpp"
#define PI 3.1415926535
Calculation::Calculation()
{
}
Calculation::~Calculation()
{
}
/************************************************************************/
/* 一维数据的复数快速傅里叶变换 */
/************************************************************************/
void Calculation::FFT(int n, fftw_complex* in, fftw_complex* out)
{
if (in == NULL || out == NULL) return;
fftw_plan p;
p = fftw_plan_dft_1d(n, in, out, FFTW_FORWARD, FFTW_ESTIMATE);
fftw_execute(p);
fftw_destroy_plan(p);
fftw_cleanup();
}
/************************************************************************/
/* 一维数据的实数快速傅里叶变换 */
/************************************************************************/
void Calculation::FFT_R(int n, QVector<float> & vecData, fftw_complex* out)
{
double in[n];
for (int i = 0; i < n; i++) {
in[i] = vecData[i];
}
for (int i = 0; i < n; i++)
{
out[i][0] = (double)vecData[i];
out[i][1] = 0;
}
//create a DFT plan and execute it
fftw_plan plan = fftw_plan_dft_r2c_1d(n, in, out, FFTW_ESTIMATE);
fftw_execute(plan);
//destroy the plan to prevent a memory leak
fftw_destroy_plan(plan);
fftw_cleanup();
}
/************************************************************************/
/* 一维数据的快速傅里叶逆变换 */
/************************************************************************/
void Calculation::iFFT(int n, fftw_complex* in, fftw_complex* out)
{
if (in == NULL || out == NULL) return;
fftw_plan p;
p = fftw_plan_dft_1d(n, in, out, FFTW_BACKWARD, FFTW_ESTIMATE);
fftw_execute(p);
fftw_destroy_plan(p);
fftw_cleanup();
}
//************************************
// Method: caculateAmp_Pha
// FullName: Calculation::caculateAmp_Pha
// Access: public static
// Returns: void
// Qualifier:
// Parameter: int n
// Parameter: fftw_complex * in
// Parameter: int frequency
// Parameter: double & amplitude
// Parameter: double & phase
// 函数功能是计算特定频率的幅值和相位,原来的讨论中是传入一个特定的频率,然后在给定的频率左右范围内找幅值和相位
// 目前的函数实现是计算FFT变换后特定点的幅值和相位
// 然后还有一个地方需要修改即给定频率和FFT变换结果序列
//************************************
void Calculation::caculateAmp_Pha(int n, fftw_complex* in, int frequency, double &amplitude, double &phase)
{
int index = frequency;
amplitude = 2 * sqrt((in[index][0] / n) * (in[index][0] / n) + (in[index][1] / n) * (in[index][1] / n));
phase = 180 * atan(in[index][1] / in[index][0]) / M_PI;
}
void Calculation::absVec(QVector<float> & vecAbsData,QVector<float> & vecData)
{
for (int i = 0; i < vecData.size(); i++) {
vecAbsData.push_back(fabs(vecData[i]));
}
return;
}
float Calculation::mean(QVector<float> & vecData)
{
double meanTemp = 0;
for (int i = 0; i < vecData.size(); i++) {
meanTemp += (double)vecData[i];
}
return meanTemp / vecData.size();
}
void Calculation::drop_mean(QVector<float> & vecDropMeanData, QVector<float> & vecData)
{
float fMean = mean(vecData);
for (int i = 0; i < vecData.size(); i++) {
vecDropMeanData.push_back(vecData[i] - fMean);
}
return;
}
float Calculation::srm(QVector<float> & vecData)
{
double dSrmTemp = 0;
for (int i = 0; i < vecData.size(); i++){
dSrmTemp = dSrmTemp + sqrt(vecData[i]);
}
dSrmTemp = dSrmTemp / vecData.size();
return dSrmTemp * dSrmTemp;
}
float Calculation::rms(QVector<float> & vecData)
{
double rmsTemp = 0;
for (int i = 0; i < vecData.size(); i++) {
rmsTemp = rmsTemp += (vecData[i] * vecData[i]);
}
rmsTemp = rmsTemp / vecData.size();
return sqrt(rmsTemp);
}
float Calculation::variance(QVector<float> & vecDropMeanData)
{
double varianceTemp = 0;
for (int i = 0; i < vecDropMeanData.size(); i++) {
varianceTemp = varianceTemp += (vecDropMeanData[i] * vecDropMeanData[i]);
}
return varianceTemp/vecDropMeanData.size();
}
float Calculation::skew_state(QVector<float> & vecDropMeanData, float fVariance)
{
double tempSkew = 0;
for (int i = 0; i < vecDropMeanData.size(); i++) {
tempSkew = tempSkew + pow(vecDropMeanData[i], 3);
}
tempSkew = tempSkew / vecDropMeanData.size();
tempSkew = tempSkew / pow(fVariance, 1.5);
return tempSkew;
}
float Calculation::kurtosis(QVector<float> & vecDropMeanData, float fVariance)
{
double tempkurtosis = 0;
for (int i = 0; i < vecDropMeanData.size(); i++) {
tempkurtosis = tempkurtosis + pow(vecDropMeanData[i], 4);
}
tempkurtosis = tempkurtosis / vecDropMeanData.size();
tempkurtosis = tempkurtosis / pow(fVariance, 2);
return tempkurtosis;
}
void Calculation::hilbert(QVector<double> & vecData, QVector<double> & vecHilbertData, int N)
{
double in[N];
for (int i = 0; i < N; i++) {
in[i] = vecData[i];
}
fftw_complex *out;
out = (fftw_complex *)fftw_malloc(sizeof(fftw_complex) * N);
for (int i = 0; i < N; ++i)
{
out[i][0] = (double)vecData[i];
out[i][1] = 0;
}
//create a DFT plan and execute it
fftw_plan plan = fftw_plan_dft_r2c_1d(N, in, out, FFTW_ESTIMATE);
fftw_execute(plan);
//destroy the plan to prevent a memory leak
fftw_destroy_plan(plan);
int hN = N >> 1; // half of the length (N /2)
int numRem = hN; // the number of remaining elements
// multiply the appropriate values by 2
// (those that should be multiplied by 1 are left intact because they wouldn't change)
for (int i = 1; i < hN; ++i) // 1,2,...,N/2 - 1 的项乘以2
{
out[i][0] *= 2;
out[i][1] *= 2;
}
// if the length is even, the number of remaining elements decreases by 1
if (N % 2 == 0)
numRem--;
// if it's odd and greater than 1, the middle value must be multiplied by 2
else if (N > 1) // 奇数非空
{
out[hN][0] *= 2;
out[hN][1] *= 2;
}
// set the remaining values to 0
// (multiplying by 0 gives 0, so we don't care about the multiplicands)
memset(&out[hN + 1][0], 0, numRem * sizeof(fftw_complex));
// create an IDFT plan and execute it
plan = fftw_plan_dft_1d(N, out, out, FFTW_BACKWARD, FFTW_ESTIMATE);
fftw_execute(plan);
// do some cleaning
fftw_destroy_plan(plan);
fftw_cleanup();
// scale the IDFT output
for (int i = 0; i < N; ++i)
{
out[i][0] /= N;
out[i][1] /= N;
}
for( int n=0; n<N; n++ )//输出
{
// xr[n]=cos(n*pi/6);//原始信号
// y_r[n] = s_i[n];
complex complex_after;
complex_after.real = out[n][1];
complex_after.imag = out[n][0];
float amp = sqrt(complex_after.real * complex_after.real +complex_after.imag * complex_after.imag);
vecHilbertData.push_back(amp);
// printf("%d %f\n",n,vecHilbertData[n]);
}
fftw_free(out);
}
void Calculation::fftShift(fftw_complex* in, int l)
{
double temp;
double temp2;
for (int j = 0;j<l/2;j++) {
temp = in[j+l/2][0];
temp2 = in[j+l/2][1];
in[j+l/2][0] = in[j][0];
in[j+l/2][1] = in[j][1];
in[j][0] = temp;
in[j][1] = temp2;
}
}
void Calculation::FFTSpec(QVector<double> & vecData, QVector<double> & vecFFTSpecData)
{
fftw_complex *inFFt, *outFFt;
inFFt = (fftw_complex *)fftw_malloc(sizeof(fftw_complex) * vecData.size());
outFFt = (fftw_complex *)fftw_malloc(sizeof(fftw_complex) * vecData.size());
for (int j = 0; j < vecData.size(); j++) {
inFFt[j][0] = (double)vecData[j];
inFFt[j][1] = 0;
}
FFT(vecData.size(),inFFt, outFFt);
for(int j = 0; j < vecData.size()/2; j++) {
vecFFTSpecData.push_back(sqrt(outFFt[j][0]*outFFt[j][0] + outFFt[j][1]*outFFt[j][1])*2/vecData.size());
}
fftw_free(inFFt);
fftw_free(outFFt);
}
void Calculation::_iFFT( QVector<double> & vecrealData,QVector<double> & vecimageData,QVector<double> & veciFFTData)
{
fftw_complex *inFFt, *outFFt;
int N = vecrealData.size();
inFFt = (fftw_complex *)fftw_malloc(sizeof(fftw_complex) * N);
outFFt = (fftw_complex *)fftw_malloc(sizeof(fftw_complex) * N);
for (int j = 0; j < N; j++) {
inFFt[j][0] = (double)vecrealData[j];
inFFt[j][1] = (double)vecimageData[j];
}
iFFT(N,inFFt, outFFt);
for (int i = 0; i < N; i++) {
outFFt[i][0] *= 1./N;
outFFt[i][1] *= 1./N;
veciFFTData.push_back(outFFt[i][0]);
}
fftw_free(inFFt);
fftw_free(outFFt);
}
void Calculation::_FFT(QVector<double> & vecData, QVector<double> & vecFFTrealData,QVector<double> & vecFFTimageData)
{
fftw_complex *inHilFFt, *outHilFFt;
inHilFFt = (fftw_complex *)fftw_malloc(sizeof(fftw_complex) * vecData.size());
outHilFFt = (fftw_complex *)fftw_malloc(sizeof(fftw_complex) * vecData.size());
for (int j = 0; j < vecData.size(); j++) {
inHilFFt[j][0] = (double)vecData[j];
inHilFFt[j][1] = 0;
}
FFT(vecData.size(), inHilFFt, outHilFFt);
//fftShift(outHilFFt, vecData.size());
for (int i = 0; i < vecData.size(); i++) {
vecFFTrealData.push_back(outHilFFt[i][0]);
vecFFTimageData.push_back(outHilFFt[i][1]);
}
fftw_free(inHilFFt);
fftw_free(outHilFFt);
}
void Calculation::_fft(QVector<double> & vecData, QVector<double> & vecFFTrealData,QVector<double> & vecFFTimageData)
{
fftw_complex *inHilFFt, *outHilFFt;
inHilFFt = (fftw_complex *)fftw_malloc(sizeof(fftw_complex) * vecData.size());
outHilFFt = (fftw_complex *)fftw_malloc(sizeof(fftw_complex) * vecData.size());
for (int j = 0; j < vecData.size(); j++) {
inHilFFt[j][0] = (double)vecData[j];
inHilFFt[j][1] = 0;
}
FFT(vecData.size(), inHilFFt, outHilFFt);
fftShift(outHilFFt, vecData.size());
for (int i = 0; i < vecData.size(); i++) {
vecFFTrealData.push_back(outHilFFt[i][0]);
vecFFTimageData.push_back(outHilFFt[i][1]);
}
fftw_free(inHilFFt);
fftw_free(outHilFFt);
}
void Calculation::envSpec(QVector<double> & vecData, QVector<double> & vecEnvSpecData,int StartFrequency,int EndFrequency,bool PolarPlot)
{
QVector<double> vecFFTrealData,vecFFTimageData;
QVector<double> vecRealData,vecImageData;
QVector<double> veciFFtData;
QVector<double> veciFFtData2;
QVector<double> vecHilbertData;
_FFT(vecData,vecFFTrealData,vecFFTimageData);
for(int i = 0; i < vecFFTrealData.size();i++){
if(i < StartFrequency || i > EndFrequency){
vecFFTrealData.replace(i,0.0);
vecFFTimageData.replace(i,0.0);
}
}
_iFFT(vecFFTrealData,vecFFTimageData,veciFFtData);
for(int j = 0; j < veciFFtData.size();j++){
veciFFtData2.push_back(veciFFtData[j]*2);
}
if(!PolarPlot){
hilbert(veciFFtData2,vecHilbertData,veciFFtData2.size());
FFTSpec(vecHilbertData, vecEnvSpecData);
}else{
vecEnvSpecData = veciFFtData2;
}
}
//w(n) = 0.5 0.5*cos(2*πn/N); for n=0,1,2,…………………………N-1
void Calculation::Hanning(QVector<double> & vecData,QVector<double> & vecHanningData)
{
int N = vecData.size();
float* w = NULL;
w = (float*)calloc(N, sizeof(float));
int half, i, idx;
if (N % 2 == 0)
{
half = N / 2;
for (i = 0; i < half; i++) //CALC_HANNING Calculates Hanning window samples.
w[i] = 0.5 * (1 - cos(2 * PI * (i + 1) / (N + 1)));
idx = half - 1;
for (i = half; i < N; i++) {
w[i] = w[idx];
idx--;
}
}
else
{
half = (N + 1) / 2;
for (i = 0; i < half; i++) //CALC_HANNING Calculates Hanning window samples.
w[i] = 0.5 * (1 - cos(2 * PI * (i + 1) / (N + 1)));
idx = half - 2;
for (i = half; i < N; i++) {
w[i] = w[idx];
idx--;
}
}
for(int j = 0; j < N;j++){
vecHanningData.push_back(w[j]);
}
free(w);
}
double Calculation::Phase(QVector<double> & vecData)
{
fftw_complex *inHilFFt, *outHilFFt;
inHilFFt = (fftw_complex *)fftw_malloc(sizeof(fftw_complex) * vecData.size());
outHilFFt = (fftw_complex *)fftw_malloc(sizeof(fftw_complex) * vecData.size());
for (int j = 0; j < vecData.size(); j++) {
inHilFFt[j][0] = (double)vecData[j];
inHilFFt[j][1] = 0;
}
FFT(vecData.size(), inHilFFt, outHilFFt);
QVector<double> vecFFTrealData;
QVector<double> vecFFTimageData;
for (int i = 0; i < vecData.size(); i++) {
vecFFTrealData.push_back(outHilFFt[i][0]);
vecFFTimageData.push_back(outHilFFt[i][1]);
}
fftw_free(inHilFFt);
fftw_free(outHilFFt);
double Phase1 = atan2(vecFFTrealData[0],vecFFTimageData[0]) *180/PI;
double Phase2 = atan2(vecFFTrealData[vecData.size()-1],vecFFTimageData[vecData.size()-1]) *180/PI;
return Phase2 - Phase1;
}
QVector<double> Calculation::ComputeDenCoeffs(int FilterOrder, double Lcutoff, double Ucutoff)
{
int k; // loop variables
double theta; // PI * (Ucutoff - Lcutoff) / 2.0
double cp; // cosine of phi
double st; // sine of theta
double ct; // cosine of theta
double s2t; // sine of 2*theta
double c2t; // cosine 0f 2*theta
QVector<double> RCoeffs(2 * FilterOrder); // z^-2 coefficients
QVector<double> TCoeffs(2 * FilterOrder); // z^-1 coefficients
QVector<double> DenomCoeffs; // dk coefficients
double PoleAngle; // pole angle
double SinPoleAngle; // sine of pole angle
double CosPoleAngle; // cosine of pole angle
double a; // workspace variables
cp = cos(PI * (Ucutoff + Lcutoff) / 2.0);
theta = PI * (Ucutoff - Lcutoff) / 2.0;
st = sin(theta);
ct = cos(theta);
s2t = 2.0*st*ct; // sine of 2*theta
c2t = 2.0*ct*ct - 1.0; // cosine of 2*theta
for (k = 0; k < FilterOrder; ++k)
{
PoleAngle = PI * (double)(2 * k + 1) / (double)(2 * FilterOrder);
SinPoleAngle = sin(PoleAngle);
CosPoleAngle = cos(PoleAngle);
a = 1.0 + s2t*SinPoleAngle;
RCoeffs[2 * k] = c2t / a;
RCoeffs[2 * k + 1] = s2t*CosPoleAngle / a;
TCoeffs[2 * k] = -2.0*cp*(ct + st*SinPoleAngle) / a;
TCoeffs[2 * k + 1] = -2.0*cp*st*CosPoleAngle / a;
}
DenomCoeffs = TrinomialMultiply(FilterOrder, TCoeffs, RCoeffs);
DenomCoeffs[1] = DenomCoeffs[0];
DenomCoeffs[0] = 1.0;
for (k = 3; k <= 2 * FilterOrder; ++k)
DenomCoeffs[k] = DenomCoeffs[2 * k - 2];
for (int i = DenomCoeffs.size() - 1; i > FilterOrder * 2 + 1; i--)
DenomCoeffs.pop_back();
return DenomCoeffs;
}
QVector<double> Calculation::TrinomialMultiply(int FilterOrder, QVector<double>& b, QVector<double>& c)
{
int i, j;
QVector<double> RetVal(4 * FilterOrder);
RetVal[2] = c[0];
RetVal[3] = c[1];
RetVal[0] = b[0];
RetVal[1] = b[1];
for (i = 1; i < FilterOrder; ++i)
{
RetVal[2 * (2 * i + 1)] += c[2 * i] * RetVal[2 * (2 * i - 1)] - c[2 * i + 1] * RetVal[2 * (2 * i - 1) + 1];
RetVal[2 * (2 * i + 1) + 1] += c[2 * i] * RetVal[2 * (2 * i - 1) + 1] + c[2 * i + 1] * RetVal[2 * (2 * i - 1)];
for (j = 2 * i; j > 1; --j)
{
RetVal[2 * j] += b[2 * i] * RetVal[2 * (j - 1)] - b[2 * i + 1] * RetVal[2 * (j - 1) + 1] +
c[2 * i] * RetVal[2 * (j - 2)] - c[2 * i + 1] * RetVal[2 * (j - 2) + 1];
RetVal[2 * j + 1] += b[2 * i] * RetVal[2 * (j - 1) + 1] + b[2 * i + 1] * RetVal[2 * (j - 1)] +
c[2 * i] * RetVal[2 * (j - 2) + 1] + c[2 * i + 1] * RetVal[2 * (j - 2)];
}
RetVal[2] += b[2 * i] * RetVal[0] - b[2 * i + 1] * RetVal[1] + c[2 * i];
RetVal[3] += b[2 * i] * RetVal[1] + b[2 * i + 1] * RetVal[0] + c[2 * i + 1];
RetVal[0] += b[2 * i];
RetVal[1] += b[2 * i + 1];
}
return RetVal;
}
QVector<double> Calculation::ComputeNumCoeffs(int FilterOrder, double Lcutoff, double Ucutoff, QVector<double>& DenC)
{
QVector<double> TCoeffs;
QVector<double> NumCoeffs(2 * FilterOrder + 1);
QVector<std::complex<double>> NormalizedKernel(2 * FilterOrder + 1);
QVector<double> Numbers;
for (double n = 0; n < FilterOrder * 2 + 1; n++)
Numbers.push_back(n);
int i;
TCoeffs = ComputeHP(FilterOrder);
for (i = 0; i < FilterOrder; ++i)
{
NumCoeffs[2 * i] = TCoeffs[i];
NumCoeffs[2 * i + 1] = 0.0;
}
NumCoeffs[2 * FilterOrder] = TCoeffs[FilterOrder];
double cp[2];
double Bw, Wn;
cp[0] = 2 * 2.0*tan(PI * Lcutoff / 2.0);
cp[1] = 2 * 2.0*tan(PI * Ucutoff / 2.0);
Bw = cp[1] - cp[0];
//center frequency
Wn = sqrt(cp[0] * cp[1]);
Wn = 2 * atan2(Wn, 4);
double kern;
const std::complex<double> result = std::complex<double>(-1, 0);
for (int k = 0; k< FilterOrder * 2 + 1; k++)
{
NormalizedKernel[k] = std::exp(-sqrt(result)*Wn*Numbers[k]);
}
double b = 0;
double den = 0;
for (int d = 0; d < FilterOrder * 2 + 1; d++)
{
b += real(NormalizedKernel[d] * NumCoeffs[d]);
den += real(NormalizedKernel[d] * DenC[d]);
}
for (int c = 0; c < FilterOrder * 2 + 1; c++)
{
NumCoeffs[c] = (NumCoeffs[c] * den) / b;
}
for (int i = NumCoeffs.size() - 1; i > FilterOrder * 2 + 1; i--)
NumCoeffs.pop_back();
return NumCoeffs;
}
QVector<double> Calculation::ComputeLP(int FilterOrder)
{
QVector<double> NumCoeffs(FilterOrder + 1);
int m;
int i;
NumCoeffs[0] = 1;
NumCoeffs[1] = FilterOrder;
m = FilterOrder / 2;
for (i = 2; i <= m; ++i)
{
NumCoeffs[i] = (double)(FilterOrder - i + 1)*NumCoeffs[i - 1] / i;
NumCoeffs[FilterOrder - i] = NumCoeffs[i];
}
NumCoeffs[FilterOrder - 1] = FilterOrder;
NumCoeffs[FilterOrder] = 1;
return NumCoeffs;
}
QVector<double> Calculation::ComputeHP(int FilterOrder)
{
QVector<double> NumCoeffs;
int i;
NumCoeffs = ComputeLP(FilterOrder);
for (i = 0; i <= FilterOrder; ++i)
if (i % 2) NumCoeffs[i] = -NumCoeffs[i];
return NumCoeffs;
}
//vector<double> filter(int ord, vector<double> a, vector<double> b, vector<double> x)
//{
// int np = x.size();
// vector<double> y(np);
//
// int i, j;
// y[0] = b[0] * x[0];
// for (i = 1; i<ord + 1; i++)
// {
// y[i] = 0.0;
// for (j = 0; j<i + 1; j++)
// y[i] = y[i] + b[j] * x[i - j];
// for (j = 0; j<i; j++)
// y[i] = y[i] - a[j + 1] * y[i - j - 1];
// }
// for (i = ord + 1; i<np + 1; i++)
// {
// y[i] = 0.0;
// for (j = 0; j<ord + 1; j++)
// y[i] = y[i] + b[j] * x[i - j];
// for (j = 0; j<ord; j++)
// y[i] = y[i] - a[j + 1] * y[i - j - 1];
// }
//
// return y;
//}
QVector<double> Calculation::filter(QVector<double>&x, QVector<double>& coeff_b, QVector<double>& coeff_a)
{
int len_x = x.size();
int len_b = coeff_b.size();
int len_a = coeff_a.size();
QVector<double> zi(len_b);
QVector<double> filter_x(len_x);
if (len_a == 1)
{
for (int m = 0; m<len_x; m++)
{
filter_x[m] = coeff_b[0] * x[m] + zi[0];
for (int i = 1; i<len_b; i++)
{
zi[i - 1] = coeff_b[i] * x[m] + zi[i];//-coeff_a[i]*filter_x[m];
}
}
}
else
{
for (int m = 0; m<len_x; m++)
{
filter_x[m] = coeff_b[0] * x[m] + zi[0];
for (int i = 1; i<len_b; i++)
{
zi[i - 1] = coeff_b[i] * x[m] + zi[i] - coeff_a[i] * filter_x[m];
}
}
}
return filter_x;
}
//vector<double> bandpass(vector<double> input, double lowpass, double highpass, double fps)
//{
// double N = input.size();
// cv::Mat x = cv::Mat::zeros(1, input.size(), CV_64FC1);
//
// for (int i = 0; i < input.size(); i++)
// {
// x.at<double>(0, i) = input[i];
// }
//
// Mat x_fre;
// dft(x, x_fre, DFT_COMPLEX_OUTPUT);
//
// Mat W = Mat::zeros(1, input.size(), CV_64FC1);
//
// for (int i = 0; i < input.size(); i++)
// {
// if ((double)i / N *)
// }
//}
void Calculation::ButterWorth(QVector<double>&inData,double *FrequencyBands,QVector<double>& outData)
{
int FiltOrd = 4;
QVector<double> a,b;
a = ComputeDenCoeffs(FiltOrd, FrequencyBands[0], FrequencyBands[1]);
b = ComputeNumCoeffs(FiltOrd, FrequencyBands[0], FrequencyBands[1], a);
outData = filter(inData,b,a);
}

View File

@ -0,0 +1,104 @@
#ifndef CALCULATION_H_
#define CALCULATION_H_
#include <QVector>
#include <QDebug>
#include <math.h>
#include "fftw3.h"
#include <QMath.h>
#include <complex>
typedef struct
{
float real,imag;
}complex;
class Calculation
{
public:
Calculation();
~Calculation();
//将数据取绝对值
void absVec(QVector<float> & vecAbsData, QVector<float> & vecData);
//将数据取平均值
static float mean(QVector<float> & vecData);
//将数据平方处理 数据有效值
float rms(QVector<float> & vecData);
//去数据的直流分量
static void drop_mean(QVector<float> & vecDropMeanData, QVector<float> & vecData);
//方根幅值
float srm(QVector<float> & vecData);
//方差
float variance(QVector<float> & vecDropMeanData);
//偏态指标
float skew_state(QVector<float> & vecDropMeanData, float fVariance);
//峭度指标
float kurtosis(QVector<float> & vecDropMeanData, float fVariance);
//快速傅里叶变换函数
static void FFT(int n, fftw_complex* in, fftw_complex* out);
//快速傅里叶实数变换函数
void FFT_R(int n, QVector<float> & vecData, fftw_complex* out);
//快速傅里叶逆变换
void iFFT(int n, fftw_complex* in, fftw_complex* out);
//通道幅值和相位提取
//输入为FFT变换后的数据长度及数据指定的频率输出为计算后得到的幅值 和 相位
void caculateAmp_Pha(int n, fftw_complex* in, int frequency, double &amplitude, double &phase);
//希尔伯特变换
static void hilbert(QVector<double> & vecData, QVector<double> & vecHilbertData, int N);
//FFT shift
static void fftShift(fftw_complex* in, int l);
//频谱图数据
static void FFTSpec(QVector<double> & vecData, QVector<double> & vecFFTSpecData);
void _FFT(QVector<double> & vecData, QVector<double> & vecFFTrealData,QVector<double> & vecFFTimageData);
void _fft(QVector<double> & vecData, QVector<double> & vecFFTrealData,QVector<double> & vecFFTimageData);
void _iFFT(QVector<double> & vecData, QVector<double> & vecFFTSpecData,QVector<double> & veciFFTData);
//包络图谱数据
void envSpec(QVector<double> & vecData, QVector<double> & vecEnvSpecData,int StartFrequency,int EndFrequency,bool PolarPlot=false);
//hanning 窗
void Hanning(QVector<double> & vecData,QVector<double> & vecHanningData);
//相位计算
double Phase(QVector<double> & vecData);
QVector<double> ComputeDenCoeffs(int FilterOrder, double Lcutoff, double Ucutoff);
QVector<double> TrinomialMultiply(int FilterOrder, QVector<double>& b, QVector<double>& c);
QVector<double> ComputeNumCoeffs(int FilterOrder, double Lcutoff, double Ucutoff, QVector<double>& DenC);
QVector<double> ComputeLP(int FilterOrder);
QVector<double> ComputeHP(int FilterOrder);
//vector<double> filter(int ord, vector<double> a, vector<double> b, int np, vector<double> x);
//巴特沃斯滤波
QVector<double> filter(QVector<double>&x, QVector<double>& coeff_b, QVector<double>& coeff_a);
void ButterWorth(QVector<double>& inData,double *FrequencyBands,QVector<double>& outData);
};
#endif

View File

@ -0,0 +1,121 @@
QT += core gui charts script axcontainer network multimedia
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets printsupport opengl sql
CONFIG += c++11
RC_FILE += ICON.rc
# The following define makes your compiler emit warnings if you use
# any Qt feature that has been marked deprecated (the exact warnings
# depend on your compiler). Please consult the documentation of the
# deprecated API in order to know how to port your code away from it.
#DEFINES += QT_DEPRECATED_WARNINGS
#DEFINES += GSL_DLL
DEFINES += QCUSTOMPLOT_USE_OPENGL
# You can also make your code fail to compile if it uses deprecated APIs.
# In order to do so, uncomment the following line.
# You can also select to disable deprecated APIs only up to a certain version of Qt.
#DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0
SOURCES += \
Adddeviceform.cpp \
BaseWgt.cpp \
Calculation.cpp \
ChartView.cpp \
ChildForm.cpp \
CreateReport.cpp \
DataParsing.cpp \
FilterForm.cpp \
LegendForm.cpp \
LoadingDialog.cpp \
MqttClient.cpp \
NetMgr.cpp \
PlayWaveSound.cpp \
Reportform.cpp \
SetScalesform.cpp \
SettingForm.cpp \
WordOperate.cpp \
cidwudp.cpp \
global.cpp \
main.cpp \
MainWidget.cpp \
msgbox.cpp \
qcustomplot.cpp \
secure.cpp \
sqlitedb.cpp
HEADERS += \
Adddeviceform.h \
BaseWgt.h \
Calculation.hpp \
ChartView.h \
ChildForm.h \
CreateReport.h \
DataParsing.h \
FilterForm.h \
LegendForm.h \
LoadingDialog.h \
MainWidget.h \
MqttClient.h \
NetMgr.h \
PlayWaveSound.h \
Reportform.h \
ResizableWiget.h \
SH_MySingleton.hpp \
SetScalesform.h \
SettingForm.h \
WordOperate.h \
cidwudp.h \
fftw3.h \
global.h \
msgbox.h \
qcustomplot.h \
secure.h \
sqlitedb.h
FORMS += \
Adddeviceform.ui \
ChildForm.ui \
FilterForm.ui \
LegendForm.ui \
MainWidget.ui \
Reportform.ui \
SetScalesForm.ui \
SettingForm.ui \
WebForm.ui
win32:CONFIG(release, debug|release): LIBS += -L$$PWD/lib/ -lfreeglut
else:win32:CONFIG(debug, debug|release): LIBS += -L$$PWD/lib/ -lfreeglut
else:unix: LIBS += -L$$PWD/lib/
INCLUDEPATH += $$PWD/.
INCLUDEPATH += $$PWD/GSL/include
DEPENDPATH += $$PWD/.
INCLUDEPATH += $$PWD/mqtt
# Default rules for deployment.
qnx: target.path = /tmp/$${TARGET}/bin
else: unix:!android: target.path = /opt/$${TARGET}/bin
!isEmpty(target.path): INSTALLS += target
RESOURCES += \
qrc.qrc
LIBS += -L$$PWD/fftwlib/ -llibfftw3-3 -llibfftw3f-3 -llibfftw3l-3
LIBS += -lopengl32 -lglu32 -lglut
LIBS += -L$$PWD/GSL/lib/ -llibgsl -llibgslcblas
#LIBS += -LD:C:\Qt\Qt5.12.11\5.12.11\mingw73_32\lib -lopengl32
unix|win32: LIBS += -L$$PWD/lib/ -lportaudio
INCLUDEPATH += $$PWD/include
DEPENDPATH += $$PWD/include
win32:CONFIG(release, debug|release): LIBS += -L$$PWD/lib/MQTT/ -lQt5Qmqtt
else:win32:CONFIG(debug, debug|release): LIBS += -L$$PWD/lib/MQTT/ -lQt5Qmqttd
else:unix: LIBS += -L$$PWD/lib/MQTT/ -lQt5Qmqtt
INCLUDEPATH += $$PWD/lib/MQTT
DEPENDPATH += $$PWD/lib/MQTT

View File

@ -0,0 +1,159 @@
#include "ChartView.h"
#include <QApplication>
#include <QValueAxis>
ChartView::ChartView( QWidget *parent)
: QChartView( parent)
{
m_isPress = false;
m_ctrlPress = false;
m_alreadySaveRange = false;
m_coordItem = nullptr;
this->setDragMode(QGraphicsView::RubberBandDrag);
this->setMouseTracking(false);
setCursor(QCursor(Qt::PointingHandCursor)); //设置鼠标指针为手指形
}
ChartView::~ChartView()
{
}
void ChartView::SetChart(QChart *chart){
setChart(chart);
}
void ChartView::mousePressEvent(QMouseEvent *event)
{
if (event->button() == Qt::LeftButton)
{
m_lastPoint = event->pos();
m_isPress = true;
}
}
void ChartView::mouseMoveEvent(QMouseEvent *event)
{
if (!m_coordItem)
{
m_coordItem = new QGraphicsSimpleTextItem(this->chart());
m_coordItem->setZValue(5);
m_coordItem->setPos(100, 20);
m_coordItem->show();
}
const QPoint curPos = event->pos();
QPointF curVal = this->chart()->mapToValue(QPointF(curPos));
QString coordStr = QString("X = %1, Y = %2").arg(curVal.x()).arg(curVal.y());
m_coordItem->setText(coordStr);
if (m_isPress)
{
QPoint offset = curPos - m_lastPoint;
m_lastPoint = curPos;
if (!m_alreadySaveRange)
{
this->saveAxisRange();
m_alreadySaveRange = true;
}
this->chart()->scroll(-offset.x(), offset.y());
}
}
void ChartView::mouseReleaseEvent(QMouseEvent *event)
{
m_isPress = false;
if (event->button() == Qt::RightButton)
{
if (m_alreadySaveRange)
{
this->chart()->axisX()->setRange(m_xMin, m_xMax);
this->chart()->axisY()->setRange(m_yMin, m_yMax);
}
}else if(event->button() == Qt::LeftButton)
{
return;
}
}
void ChartView::wheelEvent(QWheelEvent *event)
{
const QPoint curPos = event->pos();
QPointF curVal = this->chart()->mapToValue(QPointF(curPos));
if (!m_alreadySaveRange)
{
this->saveAxisRange();
m_alreadySaveRange = true;
}
const double factor = 1.5;//缩放比例
if (m_ctrlPress)
{//Y轴
QValueAxis *axisY = dynamic_cast<QValueAxis*>(this->chart()->axisY());
const double yMin = axisY->min();
const double yMax = axisY->max();
const double yCentral = curVal.y();
double bottomOffset;
double topOffset;
if (event->delta() > 0)
{//放大
bottomOffset = 1.0 / factor * (yCentral - yMin);
topOffset = 1.0 / factor * (yMax - yCentral);
}
else
{//缩小
bottomOffset = 1.0 * factor * (yCentral - yMin);
topOffset = 1.0 * factor * (yMax - yCentral);
}
this->chart()->axisY()->setRange(yCentral - bottomOffset, yCentral + topOffset);
}
else
{//X轴
QValueAxis *axisX = dynamic_cast<QValueAxis*>(this->chart()->axisX());
const double xMin = axisX->min();
const double xMax = axisX->max();
const double xCentral = curVal.x();
double leftOffset;
double rightOffset;
if (event->delta() > 0)
{//放大
leftOffset = 1.0 / factor * (xCentral - xMin);
rightOffset = 1.0 / factor * (xMax - xCentral);
}
else
{//缩小
leftOffset = 1.0 * factor * (xCentral - xMin);
rightOffset = 1.0 * factor * (xMax - xCentral);
}
this->chart()->axisX()->setRange(xCentral - leftOffset, xCentral + rightOffset);
}
}
void ChartView::keyPressEvent(QKeyEvent *event)
{
if (event->key() == Qt::Key_Control)
{
m_ctrlPress = true;
}
}
void ChartView::keyReleaseEvent(QKeyEvent *event)
{
if (event->key() == Qt::Key_Control)
{
m_ctrlPress = false;
}
}
void ChartView::saveAxisRange()
{
QValueAxis *axisX = dynamic_cast<QValueAxis*>(this->chart()->axisX());
m_xMin = axisX->min();
m_xMax = axisX->max();
QValueAxis *axisY = dynamic_cast<QValueAxis*>(this->chart()->axisY());
m_yMin = axisY->min();
m_yMax = axisY->max();
}

View File

@ -0,0 +1,35 @@
#pragma once
#include <QChartView>
#include <QMouseEvent>
#include <QGraphicsSimpleTextItem>
QT_CHARTS_USE_NAMESPACE
class ChartView : public QChartView
{
Q_OBJECT
public:
ChartView(QWidget *parent = nullptr);
~ChartView();
void SetChart(QChart *chart);
// 保存坐标区域,用于复位
void saveAxisRange();
QGraphicsSimpleTextItem* m_coordItem;
protected:
void mousePressEvent(QMouseEvent *event);
void mouseMoveEvent(QMouseEvent *event);
void mouseReleaseEvent(QMouseEvent *event);
void wheelEvent(QWheelEvent *event);
void keyPressEvent(QKeyEvent *event);
void keyReleaseEvent(QKeyEvent *event);
private:
QPoint m_lastPoint;
bool m_isPress;
bool m_ctrlPress;
bool m_alreadySaveRange;
double m_xMin, m_xMax, m_yMin, m_yMax;
// QGraphicsSimpleTextItem* m_coordItem;
};

View File

@ -0,0 +1,59 @@
#include "Child3dFrom.h"
#include "ui_Child3dFrom.h"
#include "mylineplot3d.h"
#include <include/qwt3d_enrichment_std.h>
Child3DFrom::Child3DFrom(QWidget *parent) :
QWidget(parent),
ui(new Ui::Child3DFrom)
{
ui->setupUi(this);
connect(ui->ChannelBtn, SIGNAL(clicked()), this, SLOT(ChannelBtnSlot())); //打开通道选择
ui->ChannelWgt->setVisible(false);
ui->tableWidget->setColumnWidth(0, 180);
ui->tableWidget->setColumnWidth(1, 40);
myL3d = new mylineplot3d();
QVBoxLayout * qvl = new QVBoxLayout(ui->widget_4);
qvl->addWidget(myL3d);
this->setLayout(qvl);
myL3d->init();
myL3d->resize(800,600);
this->resize(800,600);
Qwt3D::Line3D l3d;
mypL3d_1 = dynamic_cast< Qwt3D::Line3D*>(myL3d->addEnrichment(l3d));
myL3d->init();
myL3d->coordinates()->setGridLines(true,true,Qwt3D::LEFT|Qwt3D::BACK|Qwt3D::FLOOR);
myL3d->setTitle(tr("瀑布图"));
mypL3d_1->configure(3,true);
mypL3d_1->setLineColor(Qwt3D::RGBA(0,0,1,1));
myL3d->setCurMaxMin(0,1000,0,20,0,60);
mypL3d_1->add(Qwt3D::Triple(x,y,z));
myL3d->tick();
}
Child3DFrom::~Child3DFrom()
{
delete ui;
}
void Child3DFrom::ChannelBtnSlot()
{
ui->ChannelWgt->setVisible(!ui->ChannelWgt->isVisible());
QString strStyle;
if(ui->ChannelWgt->isVisible())
{
strStyle = "#ChannelBtn{border-image:url(:/images/images/hideChannel.png);}";
}
else
{
strStyle = "#ChannelBtn{border-image:url(:/images/images/showChannel.png);}";
}
ui->ChannelBtn->setStyleSheet(strStyle);
}

View File

@ -0,0 +1,33 @@
#ifndef CHILD3DFROM_H
#define CHILD3DFROM_H
#include <QWidget>
#include"mylineplot3d.h"
namespace Ui {
class Child3DFrom;
}
class Child3DFrom : public QWidget
{
Q_OBJECT
public:
explicit Child3DFrom(QWidget *parent = nullptr);
~Child3DFrom();
public slots:
void ChannelBtnSlot();
private:
Ui::Child3DFrom *ui;
mylineplot3d *myL3d;
Qwt3D::Line3D * mypL3d_1;
double x;
double y;
double z;
};
#endif // CHILD3DFROM_H

View File

@ -0,0 +1,793 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>Child3DFrom</class>
<widget class="QWidget" name="Child3DFrom">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>1014</width>
<height>481</height>
</rect>
</property>
<property name="windowTitle">
<string>Form</string>
</property>
<property name="styleSheet">
<string notr="true">#outBtn{border-image:url(:/images/images/imgModelAction/657.png);}
#returnBtn{border-image:url(:/images/images/imgModelAction/344.png);}
#label_title{color: #aac3cf;}
#tableWidget
{
background:transparent;
border-top: 2px solid #50707f;
}
#tableWidget::item
{
height: 24px;
border-width: 1;
}
#tableWidget::item:hover
{
border: none;
}
#tableWidget::item:selected
{
border: none;
color:#ffa405;
}
#ChannelBtn{border-image:url(:/images/images/showChannel.png);}
#line_3{border-image:url(:/images/images/line.png);}
#line_4{border-image:url(:/images/images/line.png);}
#zoomBtn_X { border-image:url(:/images/images/imgModelAction/axisX.png) 5; }
#zoomBtn_X:hover { border-image:url(:/images/images/imgModelAction/axisX-h.png) 5; }
#zoomBtn_X:pressed {border-image:url(:/images/images/imgModelAction/axisX-p.png) 5; }
#zoomBtn_X:checked {border-image:url(:/images/images/imgModelAction/axisX-p.png) 5; }
#zoomBtn_Y { border-image:url(:/images/images/imgModelAction/axisY.png) 5; }
#zoomBtn_Y:hover { border-image:url(:/images/images/imgModelAction/axisY-h.png) 5; }
#zoomBtn_Y:pressed {border-image:url(:/images/images/imgModelAction/axisY-p.png) 5; }
#zoomBtn_Y:checked {border-image:url(:/images/images/imgModelAction/axisY-p.png) 5; }
#zoomBtn_hand { border-image:url(:/images/images/imgModelAction/hand.png) 5; }
#zoomBtn_hand:hover { border-image:url(:/images/images/imgModelAction/hand-h.png) 5; }
#zoomBtn_hand:pressed {border-image:url(:/images/images/imgModelAction/hand-p.png) 5; }
#zoomBtn_hand:checked {border-image:url(:/images/images/imgModelAction/hand-p.png) 5; }
#measureBtn { border-image:url(:/images/images/imgModelAction/measure.png) 5; }
#measureBtn:hover { border-image:url(:/images/images/imgModelAction/measure-h.png) 5; }
#measureBtn:pressed {border-image:url(:/images/images/imgModelAction/measure-p.png) 5; }
#measureBtn:checked {border-image:url(:/images/images/imgModelAction/measure-p.png) 5; }
#realTimeDataBtn { border-image:url(:/images/images/imgModelAction/realTime.png) 5; }
#realTimeDataBtn:hover { border-image:url(:/images/images/imgModelAction/realTime.png) 5; }
#realTimeDataBtn:pressed {border-image:url(:/images/images/imgModelAction/realTime-p.png) 5; }
#realTimeDataBtn:checked {border-image:url(:/images/images/imgModelAction/realTime-p.png) 5; }
#temBtn { border-image:url(:/images/images/imgModelAction/HZ.png) 5; }
#temBtn:hover { border-image:url(:/images/images/imgModelAction/HZ-h.png) 5; }
#temBtn:pressed {border-image:url(:/images/images/imgModelAction/HZ-h.png) 5; }
#temBtn_2 { border-image:url(:/images/images/imgModelAction/AC.png) 5; }
#temBtn_2:hover { border-image:url(:/images/images/imgModelAction/AC-h.png) 5; }
#temBtn_2:pressed {border-image:url(:/images/images/imgModelAction/AC-h.png) 5; }
#temBtn_3 { border-image:url(:/images/images/imgModelAction/arf.png) 5; }
#temBtn_3:hover { border-image:url(:/images/images/imgModelAction/arf-h.png) 5; }
#temBtn_3:pressed {border-image:url(:/images/images/imgModelAction/arf-h.png) 5; }
#temBtn_4 { border-image:url(:/images/images/imgModelAction/lvbo.png) 5; }
#temBtn_4:hover { border-image:url(:/images/images/imgModelAction/lvbo-h.png) 5; }
#temBtn_4:pressed {border-image:url(:/images/images/imgModelAction/lvbo-p.png) 5; }
#temBtn_5 { border-image:url(:/images/images/imgModelAction/TDBC.png) 5; }
#temBtn_5:hover { border-image:url(:/images/images/imgModelAction/TDBC-h.png) 5; }
#temBtn_5:pressed {border-image:url(:/images/images/imgModelAction/TDBC-P.png) 5; }
#temBtn_6 { border-image:url(:/images/images/imgModelAction/gb1.png) 5; }
#temBtn_6:hover { border-image:url(:/images/images/imgModelAction/gb1.png) 5; }
#temBtn_6:pressed {border-image:url(:/images/images/imgModelAction/gb1.png) 5; }
</string>
</property>
<layout class="QHBoxLayout" name="horizontalLayout" stretch="0,1">
<property name="spacing">
<number>0</number>
</property>
<property name="leftMargin">
<number>0</number>
</property>
<property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
<item>
<widget class="QWidget" name="widget_2" native="true">
<property name="minimumSize">
<size>
<width>0</width>
<height>0</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>300</width>
<height>16777215</height>
</size>
</property>
<layout class="QHBoxLayout" name="horizontalLayout_4">
<property name="spacing">
<number>0</number>
</property>
<property name="leftMargin">
<number>0</number>
</property>
<property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
<item>
<widget class="QWidget" name="ChannelWgt" native="true">
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<widget class="QLabel" name="label">
<property name="minimumSize">
<size>
<width>0</width>
<height>38</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>16777215</width>
<height>38</height>
</size>
</property>
<property name="styleSheet">
<string notr="true">color: rgb(170, 195, 207);</string>
</property>
<property name="text">
<string>TextLabel</string>
</property>
</widget>
</item>
<item>
<widget class="QTableWidget" name="tableWidget">
<property name="styleSheet">
<string notr="true"/>
</property>
<property name="showGrid">
<bool>false</bool>
</property>
<property name="columnCount">
<number>2</number>
</property>
<attribute name="horizontalHeaderVisible">
<bool>false</bool>
</attribute>
<attribute name="horizontalHeaderStretchLastSection">
<bool>true</bool>
</attribute>
<attribute name="verticalHeaderVisible">
<bool>false</bool>
</attribute>
<column/>
<column/>
</widget>
</item>
</layout>
</widget>
</item>
<item>
<layout class="QVBoxLayout" name="verticalLayout_2">
<property name="spacing">
<number>0</number>
</property>
<property name="leftMargin">
<number>2</number>
</property>
<item>
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QPushButton" name="ChannelBtn">
<property name="minimumSize">
<size>
<width>16</width>
<height>120</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>16</width>
<height>120</height>
</size>
</property>
<property name="styleSheet">
<string notr="true"/>
</property>
<property name="text">
<string/>
</property>
</widget>
</item>
<item>
<spacer name="verticalSpacer_2">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
</layout>
</widget>
</item>
<item>
<widget class="QWidget" name="widget" native="true">
<layout class="QVBoxLayout" name="verticalLayout_3">
<property name="spacing">
<number>0</number>
</property>
<property name="leftMargin">
<number>0</number>
</property>
<property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
<item>
<widget class="QWidget" name="widget_3" native="true">
<property name="minimumSize">
<size>
<width>0</width>
<height>41</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>16777215</width>
<height>41</height>
</size>
</property>
<layout class="QHBoxLayout" name="horizontalLayout_2">
<item>
<widget class="QPushButton" name="outBtn">
<property name="minimumSize">
<size>
<width>30</width>
<height>30</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>30</width>
<height>30</height>
</size>
</property>
<property name="styleSheet">
<string notr="true"/>
</property>
<property name="text">
<string/>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="returnBtn">
<property name="minimumSize">
<size>
<width>30</width>
<height>30</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>30</width>
<height>30</height>
</size>
</property>
<property name="styleSheet">
<string notr="true"/>
</property>
<property name="text">
<string/>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="zoomBtn_X">
<property name="minimumSize">
<size>
<width>30</width>
<height>30</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>30</width>
<height>30</height>
</size>
</property>
<property name="styleSheet">
<string notr="true"/>
</property>
<property name="text">
<string/>
</property>
<property name="checkable">
<bool>true</bool>
</property>
<property name="checked">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="zoomBtn_Y">
<property name="minimumSize">
<size>
<width>30</width>
<height>30</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>30</width>
<height>30</height>
</size>
</property>
<property name="styleSheet">
<string notr="true"/>
</property>
<property name="text">
<string/>
</property>
<property name="checkable">
<bool>true</bool>
</property>
<property name="checked">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="zoomBtn_hand">
<property name="minimumSize">
<size>
<width>30</width>
<height>30</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>30</width>
<height>30</height>
</size>
</property>
<property name="styleSheet">
<string notr="true"/>
</property>
<property name="text">
<string/>
</property>
<property name="checkable">
<bool>true</bool>
</property>
<property name="checked">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="measureBtn">
<property name="minimumSize">
<size>
<width>30</width>
<height>30</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>30</width>
<height>30</height>
</size>
</property>
<property name="styleSheet">
<string notr="true"/>
</property>
<property name="text">
<string/>
</property>
<property name="checkable">
<bool>true</bool>
</property>
<property name="checked">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="realTimeDataBtn">
<property name="minimumSize">
<size>
<width>30</width>
<height>30</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>30</width>
<height>30</height>
</size>
</property>
<property name="styleSheet">
<string notr="true"/>
</property>
<property name="text">
<string/>
</property>
<property name="checkable">
<bool>true</bool>
</property>
<property name="checked">
<bool>false</bool>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="line_3">
<property name="minimumSize">
<size>
<width>2</width>
<height>28</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>2</width>
<height>28</height>
</size>
</property>
<property name="text">
<string/>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="temBtn">
<property name="minimumSize">
<size>
<width>30</width>
<height>30</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>30</width>
<height>30</height>
</size>
</property>
<property name="styleSheet">
<string notr="true"/>
</property>
<property name="text">
<string/>
</property>
<property name="checkable">
<bool>true</bool>
</property>
<property name="checked">
<bool>false</bool>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="temBtn_2">
<property name="minimumSize">
<size>
<width>30</width>
<height>30</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>30</width>
<height>30</height>
</size>
</property>
<property name="styleSheet">
<string notr="true"/>
</property>
<property name="text">
<string/>
</property>
<property name="checkable">
<bool>true</bool>
</property>
<property name="checked">
<bool>false</bool>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="temBtn_3">
<property name="minimumSize">
<size>
<width>30</width>
<height>30</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>30</width>
<height>30</height>
</size>
</property>
<property name="styleSheet">
<string notr="true"/>
</property>
<property name="text">
<string/>
</property>
<property name="checkable">
<bool>true</bool>
</property>
<property name="checked">
<bool>false</bool>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="line_4">
<property name="minimumSize">
<size>
<width>2</width>
<height>28</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>2</width>
<height>28</height>
</size>
</property>
<property name="text">
<string/>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="temBtn_4">
<property name="minimumSize">
<size>
<width>30</width>
<height>30</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>30</width>
<height>30</height>
</size>
</property>
<property name="styleSheet">
<string notr="true"/>
</property>
<property name="text">
<string/>
</property>
<property name="checkable">
<bool>true</bool>
</property>
<property name="checked">
<bool>false</bool>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="temBtn_5">
<property name="minimumSize">
<size>
<width>30</width>
<height>30</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>30</width>
<height>30</height>
</size>
</property>
<property name="styleSheet">
<string notr="true"/>
</property>
<property name="text">
<string/>
</property>
<property name="checkable">
<bool>true</bool>
</property>
<property name="checked">
<bool>false</bool>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="temBtn_6">
<property name="minimumSize">
<size>
<width>30</width>
<height>30</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>30</width>
<height>30</height>
</size>
</property>
<property name="styleSheet">
<string notr="true"/>
</property>
<property name="text">
<string/>
</property>
<property name="checkable">
<bool>true</bool>
</property>
<property name="checked">
<bool>false</bool>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
</item>
<item>
<widget class="QWidget" name="widget_4" native="true">
<property name="styleSheet">
<string notr="true">#outBtn{border-image:url(:/images/images/imgModelAction/657.png);}
#returnBtn{border-image:url(:/images/images/imgModelAction/344.png);}
#label_title{color: #aac3cf;}
#tableWidget
{
background:transparent;
border-top: 2px solid #50707f;
}
#tableWidget::item
{
height: 24px;
border-width: 1;
}
#tableWidget::item:hover
{
border: none;
}
#tableWidget::item:selected
{
border: none;
color:#ffa405;
}
#ChannelBtn{border-image:url(:/images/images/showChannel.png);}
#line_3{border-image:url(:/images/images/line.png);}
#line_4{border-image:url(:/images/images/line.png);}
#zoomBtn_X { border-image:url(:/images/images/imgModelAction/axisX.png) 5; }
#zoomBtn_X:hover { border-image:url(:/images/images/imgModelAction/axisX-h.png) 5; }
#zoomBtn_X:pressed {border-image:url(:/images/images/imgModelAction/axisX-p.png) 5; }
#zoomBtn_X:checked {border-image:url(:/images/images/imgModelAction/axisX-p.png) 5; }
#zoomBtn_Y { border-image:url(:/images/images/imgModelAction/axisY.png) 5; }
#zoomBtn_Y:hover { border-image:url(:/images/images/imgModelAction/axisY-h.png) 5; }
#zoomBtn_Y:pressed {border-image:url(:/images/images/imgModelAction/axisY-p.png) 5; }
#zoomBtn_Y:checked {border-image:url(:/images/images/imgModelAction/axisY-p.png) 5; }
#zoomBtn_hand { border-image:url(:/images/images/imgModelAction/hand.png) 5; }
#zoomBtn_hand:hover { border-image:url(:/images/images/imgModelAction/hand-h.png) 5; }
#zoomBtn_hand:pressed {border-image:url(:/images/images/imgModelAction/hand-p.png) 5; }
#zoomBtn_hand:checked {border-image:url(:/images/images/imgModelAction/hand-p.png) 5; }
#measureBtn { border-image:url(:/images/images/imgModelAction/measure.png) 5; }
#measureBtn:hover { border-image:url(:/images/images/imgModelAction/measure-h.png) 5; }
#measureBtn:pressed {border-image:url(:/images/images/imgModelAction/measure-p.png) 5; }
#measureBtn:checked {border-image:url(:/images/images/imgModelAction/measure-p.png) 5; }
#realTimeDataBtn { border-image:url(:/images/images/imgModelAction/realTime.png) 5; }
#realTimeDataBtn:hover { border-image:url(:/images/images/imgModelAction/realTime.png) 5; }
#realTimeDataBtn:pressed {border-image:url(:/images/images/imgModelAction/realTime-p.png) 5; }
#realTimeDataBtn:checked {border-image:url(:/images/images/imgModelAction/realTime-p.png) 5; }
#temBtn { border-image:url(:/images/images/imgModelAction/HZ.png) 5; }
#temBtn:hover { border-image:url(:/images/images/imgModelAction/HZ-h.png) 5; }
#temBtn:pressed {border-image:url(:/images/images/imgModelAction/HZ-h.png) 5; }
#temBtn_2 { border-image:url(:/images/images/imgModelAction/AC.png) 5; }
#temBtn_2:hover { border-image:url(:/images/images/imgModelAction/AC-h.png) 5; }
#temBtn_2:pressed {border-image:url(:/images/images/imgModelAction/AC-h.png) 5; }
#temBtn_3 { border-image:url(:/images/images/imgModelAction/arf.png) 5; }
#temBtn_3:hover { border-image:url(:/images/images/imgModelAction/arf-h.png) 5; }
#temBtn_3:pressed {border-image:url(:/images/images/imgModelAction/arf-h.png) 5; }
#temBtn_4 { border-image:url(:/images/images/imgModelAction/lvbo.png) 5; }
#temBtn_4:hover { border-image:url(:/images/images/imgModelAction/lvbo-h.png) 5; }
#temBtn_4:pressed {border-image:url(:/images/images/imgModelAction/lvbo-p.png) 5; }
#temBtn_5 { border-image:url(:/images/images/imgModelAction/TDBC.png) 5; }
#temBtn_5:hover { border-image:url(:/images/images/imgModelAction/TDBC-h.png) 5; }
#temBtn_5:pressed {border-image:url(:/images/images/imgModelAction/TDBC-P.png) 5; }
#temBtn_6 { border-image:url(:/images/images/imgModelAction/gb1.png) 5; }
#temBtn_6:hover { border-image:url(:/images/images/imgModelAction/gb1.png) 5; }
#temBtn_6:pressed {border-image:url(:/images/images/imgModelAction/gb1.png) 5; }
</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
</layout>
</widget>
<resources/>
<connections/>
</ui>

File diff suppressed because it is too large Load Diff

252
ChaosDataPlayer/ChildForm.h Normal file
View File

@ -0,0 +1,252 @@
#ifndef CHILDFORM_H
#define CHILDFORM_H
#include <QWidget>
#include "BaseWgt.h"
#include <QtCharts>
#include <QChartView>
#include <QVector>
#include <QTableWidgetItem>
#include <QTimerEvent>
#include "ChartView.h"
#include "global.h"
#include <qmath.h>
#include "Calculation.hpp"
#include "qcustomplot.h"
#include "SetScalesform.h"
#include "FilterForm.h"
#include "Mqttclient.h"
#include "PlayWaveSound.h"
enum FormType
{
TimeDomainPlot, //时域图
FrequencyDomainPlot, //频域图
TrendChartPlot, //趋势图
SpecChartPlot, //频谱图
EnvChartPlot, //包络图
WaterFallPlot, //瀑布图
OrbitPlot, //轴心轨迹
PolarPlot, //极坐标
BodePlot, //伯德图
ShaftCenterline, //轴心位置图
AllWavePlot //全谱图
};
typedef struct {
int key1;
int key2;
float fSpeed;
}RPM;
typedef struct _ChannelData
{
QString ChannelId;
}ChannelData;
class ChartView;
class Chart;
class QAbstractAxis;
class LegendForm;
namespace Ui {
class ChildForm;
}
class ChildForm : public BaseWgt
{
Q_OBJECT
public:
explicit ChildForm(FormType iType,QString m_strName = "",DEVICE_INFO* DeviceInfo = NULL, QWidget *parent = nullptr);
~ChildForm();
void SetName(QString strName)
{
m_strName = strName;
}
QString GetName()
{
return m_strName;
}
QHBoxLayout *pLayout;
Calculation *pCalculation;
QMetaObject::Connection dismove;
QMetaObject::Connection disDoubleclick;
QMetaObject::Connection disPress;
QMetaObject::Connection dis1;
WAVE_DATA m_waveData;
FormType m_iFormType;
void InitDisPaly();
void InitRpmDisPaly();
void ShowCharts();
void SetFormType(FormType iType) {m_iFormType = iType;}
FormType GetFormType() { return m_iFormType;}
void SetWaveData(QString strID, QVector<WAVE_DATA>& waveData);
void SetDataIDs(const QStringList &strIDList, QString strTitle,const QStringList& strChannleTypeList,\
const QStringList& strChannleNameList);
void handlePlayWave(double position = 0,double size = 131072); //
void AddOrbitSeries(QString strID, const QVector<WAVE_DATA>& wavexData,const QVector<WAVE_DATA>& waveyData,\
const QVector<WAVE_DATA>& waveSpeedData);
void AddBodeSeries(QString strID, const QVector<WAVE_DATA>& wavexData,const QVector<WAVE_DATA>& waveSpeedData);
void AddShaftCenterlineSeries(QString strID, const QVector<WAVE_DATA>& wavexData,const QVector<WAVE_DATA>& waveData);
void AddPolarPlotSeries(QString strID, const QVector<WAVE_DATA>& wavexData,const QVector<WAVE_DATA>& waveSpeedData);
void UpdateEnvSerises(QString Start,QString End);
QPixmap GetSerise(QString& strImagePath);
void AddSeries(QString strID, QVector<WAVE_DATA>& waveData);
QCPGraph* MultiyAxis(QString strID,QString sensorType,QString sensorEngineeringUnit);
void SecondData(const QString& strID,WAVE_DATA& waveData,WAVE_DISPALYDATA& waveShowData);
void CalculateRPM();
void CalculateIntegration(bool isDoubleIntegration = false);
void CalculateDifferentiation(bool isDoubleDifferentiation = false);
void EnableBtn();
void UpdateDiffMenu();
QVector<WAVE_DATA> childWave;
QVector<WAVE_DATA> OrbitXWave,OrbitYWave;
QVector<KeyPhasor> vecKeyPhasor;
QList<QString> listChannelID;
QCPGraph *mainGraph1,*mainGraph2,*keyPhasor;
QCPCurve *fermatSpiral1;
QCPAxisRect *wideAxisRect1;
QCPAxisRect *wideAxisRect2;
QCPAxisRect *wideAxisRectOrbit;
QMap<QString,QVector<WAVE_DATA>> mapBodeData;
PlayWaveSound *m_pPlaySound;
QThread *m_pThread;
signals:
void ItemCheckStateSignal(QString strID, bool bChecked);
void OutSig();
void ReturnSig();
void PlayWaveSig();
void InitWaveSig();
protected:
public slots:
void ZoomBtnSlot_X();
void ZoomBtnSlot_Y();
void ZoomBtnSlot_XY();
void ZoomBtnSlot_Hand();
void ToRpm();
void Btn_ZoomSlot();
void IntegrationSlot();
void DoubleIntegrationSlot();
void DifferentiationSlot();
void DoubleDifferentiationSlot();
void ScalesBox();
void ScalesX();
void ScalesY();
void ScalesXY();
void Cursor();
void SetScales();
void SetFilter();
void SetDC();
void realTimeData();
void mouseMoveEvent(QMouseEvent *event);
void mouseDoubleClickEvent(QMouseEvent *event);
void mouseWheelEvent(QWheelEvent *event);
void ChannelBtnSlot();
void ItemChangedSlot(QTableWidgetItem *item);
void ItemPressSlot(QTableWidgetItem *item);
void slotSetScales(QString str);
void slotSetFilter(QString str);
void OnPlotClick(QCPAbstractPlottable *plottable, int dataIndex, QMouseEvent *event);
void RealTimeWave(QByteArray payLoad);
void OnPlayWaveSound();
void PlaySoundThread();
private:
bool m_bDC;
bool m_bRpm;
bool m_bIntegration;
bool m_bDifferentiation;
bool m_bDoubleIntegration;
bool m_bDoubleDifferentiation;
bool m_isPause;
bool m_isStop;
std::condition_variable m_cv;
std::mutex mu;
WAVE_CSVDATA m_vecCsvData[32];
int m_nStart;
int m_nEnd;
QMenu *remove_menu;
QAction *remove_selected_action;
QAction *remove_all_action;
QAction *Hz;
QAction *Ord;
QAction *Rad;
QCPAxis *yAxis3;
QList<QCPAxis*> axes;
QCPItemTracer *tracer; //游标
QCPItemTracer *tracer2; //游标
QMap<QString,QCPItemText*> maptracerLabel;
QCPItemText *tracerLabel; //游标标签
QCPItemText *tracerLabel2; //游标标签
QCPItemText *tracerLabel3; //游标标签
QCPItemText *tracerLabel4; //游标标签
QCPItemText *tracerLabel5; //游标标签
QCPItemText *tracerLabel6; //游标标签
QCPItemText *tracerLabel7; //游标标签
QCPItemText *tracerLabel8; //游标标签
QMap<QString,WAVE_DISPALYDATA> mapWaveDisplayData;
QMap<QString,WAVE_DISPALYDATA> mapWaveDisplayData_RPM;
QMap<QString,QVector<WAVE_DATA>> mapWaveData;
QMap<QString,QVector<double>> waveTrendData;
QMap<QString,QVector<QVector<double>>> waveDataDC;
QMap<QString,QCPGraph*> waveGraph;
QMap<QString,QCPAxis*> waveYAxis;
QList<QString> listChannelType;
QMap<QString,QMap<QString,QCPAxis*>> mapMultiGraph; //<通道类型,<通道IDY轴>>
RotatingSpeed _rotatingSpeed;
QVector<double> x,y;
SetScalesForm *pSetScales;
FilterForm *pSetFilter;
MqttClient *mqttclient;
void InitWidget();
void ClearAllSerise();
void ClearTable();
void RemoveSeries(QString strID);
int m_position;
QTableWidgetItem * AddTableWgtItem(QString strText, QString clolor, QString strID);
QMenu *differentiationMenu;
QAction *Integration;
QAction *doubleIntegration;
QAction *differentiation;
QAction *doubleDifferentiation;
private:
Ui::ChildForm *ui;
int line ;
QString m_strName;
ChartView *m_pChartView;
QChart *m_pChart;
QLineSeries *series;
QStringList m_listChannelID;
QMap<QString, QTableWidgetItem *> m_mapChannelIDtoLabel;
bool m_bAttach;
DEVICE_INFO *m_DeviceInfo;
LegendForm *m_pLegendForm;
QTimer *m_pTimer;
int m_iRealTimer; //实时数据定时器ID
QString m_sServer; // 服务器地址
QString m_sEquipNo; // 终端号
//QMqttClient *m_client;
bool m_isconnect; // 是否已连接服务器
bool m_bRealTime;
};
#endif // CHILDFORM_H

1014
ChaosDataPlayer/ChildForm.ui Normal file

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,293 @@
/********************************************************************
created: 2018/03/27
author: wangyuanyuan@vishee.com
edit_by:
description:
*********************************************************************/
#include "CreateReport.h"
#include <QDateTime>
#include <QDebug>
CreateReport::CreateReport()
{
m_wordOperate = NULL;
titleFontName = "SongTi";
infoFontName = "Microsoft YaHei";
tableFontName = "Microsoft YaHei";
wordFontName = "Microsoft YaHei";
titleFontSize = 18;
infoFontSize = 11;
tableFontSize = 11;
wordFontSize = 9;
}
CreateReport::~CreateReport()
{
ReleaseWord();
}
void CreateReport::GetReport(REPORT_INFO& reportInfo,QStringList& strImagePathList)
{
_reportInfo = reportInfo;
_strImagePathList = strImagePathList;
if(!CreateWord())
{
}
}
bool CreateReport::CreateWord()//创建word
{
qDebug() << "CreateWord" << endl;
if(InitWord() == false)
{
// LOG_ERROR("Init Word Failure");
return false;
}
SetPageMargin();
m_wordOperate->SetVisible(false);
DrawTitle();
DrawPatientInfo();
//DrawTable();
//DrawExplain();
//DrawMark();
//DrawPic();
m_wordOperate->insertEnter();
for(int i = 0; i < _strImagePathList.size();i++){
qDebug() << _strImagePathList.at(i) << endl;
m_wordOperate->SetAlign(WordOperate::AlignmentTypeCenter);
m_wordOperate->InsertPicture(_strImagePathList.at(i));
m_wordOperate->insertEnter();
if(_strImagePathList.at(i).contains("TimeDomain"))
m_wordOperate->SetText("时域图");
if(_strImagePathList.at(i).contains("FrequencyDomain"))
m_wordOperate->SetText("频域图");
if(_strImagePathList.at(i).contains("TrendChart"))
m_wordOperate->SetText("趋势图");
if(_strImagePathList.at(i).contains("EnvChart"))
m_wordOperate->SetText("包络图");
m_wordOperate->insertEnter();
}
DrawTable();
m_wordOperate->SetVisible(true);
return true;
}
bool CreateReport::InitWord()//初始化word
{
if(m_wordOperate == NULL)
m_wordOperate = new WordOperate();
return m_wordOperate->open(false);
}
void CreateReport::ReleaseWord()//释放word
{
if(m_wordOperate != NULL)
{
m_wordOperate->close();
delete m_wordOperate;
m_wordOperate = NULL;
}
}
void CreateReport::SetPageMargin()//设置边距
{
double dbLeft = 0.0,dbRight = 0.0,dbTop = 0.0,dbBottom = 0.0;
m_wordOperate->GetPageMargin(dbLeft,dbTop,dbRight,dbBottom);
m_wordOperate->SetPageMargin(dbLeft/2,dbTop/2,dbRight/2,dbBottom/2);
}
void CreateReport::DrawTitle()//画标题
{
m_wordOperate->SetFont(titleFontName,titleFontSize,true);
m_wordOperate->SetAlign(WordOperate::AlignmentTypeCenter);
m_wordOperate->SetText("故障分析诊断报告");
m_wordOperate->SetText("\n");
/*m_wordOperate->SetFont(titleFontName,titleFontSize,true);
m_wordOperate->SetText(QStringLiteral("XXX\n"));*/
}
void CreateReport::DrawPatientInfo()
{
int iLength=35;
m_wordOperate->SetAlign(WordOperate::AlignmentTypeLeft);
m_wordOperate->SetFont(infoFontName,infoFontSize,false);
QString str,temp;
QString strName,strSex,strAge,strDate,strCount,strTime;
str=QStringLiteral("终端名称Data Watch");
temp = _reportInfo.DeviceName;
str+=temp;
strName=QString("%1%2").arg(str).arg("\t",iLength-str.count()*2);
iLength = 28;
str=QStringLiteral("终端MAC");
temp = _reportInfo.DeviceMac;
str+=temp;
strSex=QString("%1%2").arg(str).arg("\t",iLength-str.count()*2);
iLength = 15;
str=QStringLiteral("采集时间:");
str+=_reportInfo.DevicemCollectTime;
strAge=QString("%1%2").arg(str).arg("\t",iLength-str.count()*2);
str = strName+strSex+strAge;
m_wordOperate->SetText(str);
m_wordOperate->moveForEnd();
m_wordOperate->SetAlign(WordOperate::AlignmentTypeLeft);
m_wordOperate->SetFont(infoFontName,infoFontSize,false);
iLength = 35;
str = QString("%1").arg(QStringLiteral("报告时间:"));
QDateTime current_date_time = QDateTime::currentDateTime();
QString current_date = current_date_time.toString("yyyy-MM-dd hh:mm:ss");
str = str + current_date;
m_wordOperate->SetText(str);
m_wordOperate->moveForEnd();
}
void CreateReport::DrawTable()
{
// wps
int nTable=1;
m_wordOperate->SetAlign(WordOperate::AlignmentTypeCenter);
m_wordOperate->SetParagraphSpacing(WordOperate::SpaceExactly,30);
m_wordOperate->SetFont(tableFontName,tableFontSize,false);
m_wordOperate->intsertTable(4,1);
m_wordOperate->SetTableRowHeight(nTable,2,200);
m_wordOperate->SetTableRowHeight(nTable,4,300);
QAxObject *cell=NULL;
cell = m_wordOperate->setCellString(nTable,1,1,QStringLiteral("报告概述"));
cell = m_wordOperate->setCellString(nTable,3,1,QStringLiteral("详细报告"));
//m_wordOperate->insertCellPic(nTable, 4,1,"E://WorkSpace//QT//build-ChaosDataPlayer-Desktop_Qt_5_12_11_MinGW_32_bit-Release//release//report//standard.png");
/*m_wordOperate->MergeCell(nTable,1,1,1,3,true);
m_wordOperate->MergeCell(nTable,3,1,3,3,true);
m_wordOperate->SetTableRowHeight(nTable,3,300);*/
/*m_wordOperate->insertCellPic(nTable, 2,1,"E://WorkSpace//QT//ChaosDataPlayerDemo//images//logo.png");
m_wordOperate->moveForEnd();
m_wordOperate->insertCellPic(nTable, 2,1,"E://WorkSpace//QT//ChaosDataPlayerDemo//images//logo.png");
m_wordOperate->moveForEnd();
m_wordOperate->insertCellPic(nTable, 2,1,"E://WorkSpace//QT//ChaosDataPlayerDemo//images//logo.png");
QAxObject *cell=NULL;
cell = m_wordOperate->setCellString(nTable,1,1,QStringLiteral("诊断结果"));
cell = m_wordOperate->setCellString(nTable,2,1,QStringLiteral("时域图"));
cell = m_wordOperate->setCellString(nTable,2,2,QStringLiteral("频域图"));
cell = m_wordOperate->setCellString(nTable,2,3,QStringLiteral("包络图"));
m_wordOperate->insertCellPic(nTable, 2,1,"E://WorkSpace//QT//ChaosDataPlayerDemo//images//logo.png");
m_wordOperate->insertCellPic(nTable, 2,2,"E://WorkSpace//QT//ChaosDataPlayerDemo//images//logo.png");
m_wordOperate->insertCellPic(nTable, 2,3,"E://WorkSpace//QT//ChaosDataPlayerDemo//images//logo.png");
/* m_wordOperate->SetTableFont(nTable,1,1,tableFontName,tableFontSize,true);
cell = m_wordOperate->setCellString(nTable,1,2,QStringLiteral("XX"));
m_wordOperate->SetTableFont(nTable,1,2,tableFontName,tableFontSize,true);
m_wordOperate->MergeCell(nTable,1,3,1,4,true);
cell = m_wordOperate->setCellString(nTable,1,3,QStringLiteral("XX"));
m_wordOperate->SetTableFont(nTable,1,3,tableFontName,tableFontSize,true);
cell = m_wordOperate->setCellString(nTable,1,4,QStringLiteral("XX"));
m_wordOperate->SetTableFont(nTable,1,4,tableFontName,tableFontSize,true);
/*m_wordOperate->MergeCell(nTable,2,1,10,1,true);
cell= m_wordOperate->setCellString(nTable,2,1,QStringLiteral("XX"));
m_wordOperate->MergeCell(nTable,2,2,6,2,true);
m_wordOperate->setCellString(nTable,2,2,QStringLiteral("XX"));
m_wordOperate->MergeCell(nTable,2,3,4,3,true);
m_wordOperate->setCellString(nTable,2,3,QStringLiteral("XX"));
m_wordOperate->setCellString(nTable,5,3,QStringLiteral("XX"));
m_wordOperate->setCellString(nTable,6,3,QStringLiteral("XX"));
m_wordOperate->MergeCell(nTable,7,2,10,2,true);
m_wordOperate->setCellString(nTable,7,2,QStringLiteral("XX"));
m_wordOperate->MergeCell(nTable,7,3,9,3,true);
m_wordOperate->setCellString(nTable,7,3,QStringLiteral("XX"));
m_wordOperate->setCellString(nTable,10,3,QStringLiteral("XX"));
cell = m_wordOperate->setCellString(nTable,11,1,QStringLiteral("XX"));
m_wordOperate->setCellString(nTable,11,2,QStringLiteral("XX"));
m_wordOperate->setCellString(nTable,11,3,QStringLiteral("XX"));
m_wordOperate->setCellString(nTable,2,4,QStringLiteral("XX"));
m_wordOperate->setCellString(nTable,3,4,QStringLiteral("XX"));
m_wordOperate->setCellString(nTable,4,4,QStringLiteral("XX"));
m_wordOperate->setCellString(nTable,5,4,QStringLiteral("XX"));
m_wordOperate->setCellString(nTable,6,4,QStringLiteral("XX"));
m_wordOperate->setCellString(nTable,7,4,QStringLiteral("XX"));
m_wordOperate->setCellString(nTable,8,4,QStringLiteral("XX"));
m_wordOperate->setCellString(nTable,9,4,QStringLiteral("XX"));
m_wordOperate->setCellString(nTable,10,4,QStringLiteral("XX"));
m_wordOperate->setCellString(nTable,11,4,QStringLiteral("XX"));*/
}
void CreateReport::DrawExplain()
{
m_wordOperate->moveForEnd();
m_wordOperate->SetFont(wordFontName,wordFontSize);
m_wordOperate->SetAlign(WordOperate::AlignmentTypeLeft);
m_wordOperate->SetParagraphSpacing(WordOperate::Space1);
QString str;
str = QStringLiteral("简要报告解读:");
str += "\n";
m_wordOperate->SetText(str);
m_wordOperate->SetFont(wordFontName,wordFontSize);
str = QStringLiteral("1、XXXXXXXX");
str +="\n";
m_wordOperate->SetText(str);
str = QStringLiteral("2、XXXXX。");
str += "\n";
m_wordOperate->SetText(str);
str = QStringLiteral("3、XX。");
str += "\n";
m_wordOperate->SetText(str);
m_wordOperate->SetFont(wordFontName,wordFontSize);
}
void CreateReport::DrawMark()
{
//备注:
QString str;
m_wordOperate->moveForEnd();
m_wordOperate->SetAlign(WordOperate::AlignmentTypeLeft);
m_wordOperate->SetFont(wordFontName,12,false,false,true);
str = QStringLiteral("备注:\n");
m_wordOperate->SetText(str);
m_wordOperate->SetFont(wordFontName,12,false,false,false);
m_wordOperate->intsertTable(2,1);
m_wordOperate->MergeCell(2,1,1,2,1);
m_wordOperate->setCellString(2,1,1,"xxx");
m_wordOperate->moveForEnd();
m_wordOperate->SetAlign(WordOperate::AlignmentTypeLeft);
m_wordOperate->SetFont(wordFontName,11,false,false,false);
str=QStringLiteral("xxx");
m_wordOperate->SetText(str);
m_wordOperate->SetFont(wordFontName,11,false,false,false);
m_wordOperate->SetText("____________________________");
}
void CreateReport::DrawPic()
{
m_wordOperate->SetMarkPic("Pic1", "E://WorkSpace//QT//ChaosDataPlayerDemo//images//logo.png");
}

View File

@ -0,0 +1,50 @@
/********************************************************************
created: 2018/03/27
author: wangyuanyuan@vishee.com
edit_by:
description:
*********************************************************************/
#ifndef CREATREPORT_H
#define CREATEREPORT_H
#include "WordOperate.h"
#include "global.h"
class CreateReport
{
public:
CreateReport();
~CreateReport();
public:
void GetReport(REPORT_INFO& reportInfo,QStringList& strImagePathList);
private:
WordOperate *m_wordOperate;
QString hospitalName;
bool CreateWord();//创建word
bool InitWord();//初始化word
void ReleaseWord();//释放word
void SetPageMargin();//设置边距
void DrawTitle();//画标题
void DrawPatientInfo();
void DrawTable();
void DrawMark();
void DrawExplain();
void DrawPic();
QString titleFontName;
QString infoFontName;
QString tableFontName;
QString wordFontName;
double titleFontSize;
double infoFontSize;
double tableFontSize;
double wordFontSize;
REPORT_INFO _reportInfo;
QStringList _strImagePathList;
};
#endif // CREATEREPORT_H

Binary file not shown.

View File

@ -0,0 +1,81 @@
#include "DataParsing.h"
#include <QDebug>
DataParsing::DataParsing(QObject *parent) : QObject(parent)
{
}
DataParsing::~DataParsing()
{
}
void DataParsing::SetChannelSetting(const QString &str)
{
QByteArray bytes = str.toLatin1();
QJsonParseError jsonError;
QJsonDocument docunment = QJsonDocument::fromJson(bytes,&jsonError);
if (!docunment.isNull() && (jsonError.error == QJsonParseError::NoError))
{
// qDebug() << "文件解析成功!";
if(docunment.isObject()) //判断第一级对象是否存在
{
QJsonObject objec = docunment.object();
if(objec.contains("groups"))
{
QJsonValue arrays_value = objec.take("groups");
if(arrays_value.isArray()) //判断它是不是json组
{
QJsonArray array = arrays_value.toArray();
int nsize = array.size();
for(int i = 0; i< nsize; ++i)//groups
{
GroupData groupdata;
groupdata.ChannelType = array.at(i).toObject().value("ChannelType").toString();
groupdata.Channelid = array.at(i).toObject().value("name").toString();
if(array.at(i).toObject().value("channels").isArray())
{
QJsonArray channelArray = array.at(i).toObject().value("channels").toArray();
for(int i = 0;i < channelArray.size(); i++)//channels
{
//groupdata.mChannelData.clear();
QString dataType = channelArray.at(i).toObject().value("name").toString();
if(channelArray.at(i).toObject().value("data").isArray())
{
QVector<float> vec;
QJsonArray dataArray = channelArray.at(i).toObject().value("data").toArray();
for(int i = 0; i < dataArray.size(); i++)
{
QJsonValue value = dataArray.at(i);
float t = value.toVariant().toFloat();
vec.push_back(t);
// global::m_featureData.push_back(t);
}
groupdata.mapNametoData[dataType] = vec;
}
}
qDebug()<<"::Dealdat::SetChannelSetting() groupdata.mapNametoData.size()"<<groupdata.mapNametoData.size();
}
m_groupdata.push_back(groupdata);
}
}
}
}
qDebug()<<"::Dealdat::SetChannelSetting() m_groupdata.size()"<<m_groupdata.size();
}
}
QVector<GroupData> &DataParsing::getFeatureData()
{
if(m_groupdata.size() == 0)
{
qDebug() << "解析失败";
}
else
{
qDebug() << "解析成功";
}
return m_groupdata;
}

View File

@ -0,0 +1,42 @@
#ifndef DATAPARSING_H
#define DATAPARSING_H
#include <QObject>
#include <QJsonValue>
#include <QJsonObject>
#include <QJsonArray>
#include <QJsonDocument>
#include <QJsonParseError>
#include <QScriptEngine>
#include <QVector>
#include <QMap>
#include <QString>
//通道组数据格式
typedef struct
{
QString Channelid;
QString ChannelType;
QMap<QString, QVector<float>> mapNametoData;
}GroupData;
class DataParsing : public QObject
{
Q_OBJECT
public:
explicit DataParsing(QObject *parent = nullptr);
~DataParsing();
void SetChannelSetting(const QString& str);
QVector<GroupData> & getFeatureData();
signals:
private:
QJsonObject mJsonChannelSetting;
QVector<GroupData> m_groupdata; //通道组数据
};
#endif // DATAPARSING_H

View File

@ -0,0 +1,56 @@
#include "FilterForm.h"
#include "ui_FilterForm.h"
#include "QMessageBox"
#include <qvalidator.h>
#include "msgbox.h"
FilterForm::FilterForm(QWidget *parent) :
BaseWgt(parent),
ui(new Ui::FilterForm)
{
ui->setupUi(this);
resize(500,320);
setWindowTitle("滤波");
connect(ui->Btn_OK, SIGNAL(clicked()), this, SLOT(SetFilter()));
connect(ui->Btn_Cancel, SIGNAL(clicked()), this, SLOT(Cancel()));
QRegExp rx("[0-9\.]+$");
QRegExpValidator *validator = new QRegExpValidator(rx, this);
ui->lineEdit->setValidator(validator);
ui->lineEdit_2->setValidator(validator);
}
FilterForm::~FilterForm()
{
delete ui;
}
void FilterForm::Cancel()
{
this->close();
}
void FilterForm::SetFilter()
{
QString Xstart = ui->lineEdit->text();
QString Xend = ui->lineEdit_2->text();
if((Xstart.length() == 0 && Xend.length() == 0))
{
MyMsgBox(QMessageBox::Warning,"警告","请输入正确信息!");
return;
}
if(Xstart.toInt() > Xend.toInt())
{
MyMsgBox(QMessageBox::Warning,"警告","请输入正确信息!");
return;
}
emit sgSetFilter(Xstart+","+Xend);
this->close();
}
void FilterForm::keyPressEvent(QKeyEvent *event)
{
//Enter事件好像这两个都要写只写event->key() == Qt::Key_Enter无法实现
if (event->key() == Qt::Key_Enter || event->key() == Qt::Key_Return)
{
SetFilter();
}
}

View File

@ -0,0 +1,31 @@
#ifndef FILTERFORM_H
#define FILTERFORM_H
#include <QWidget>
#include "BaseWgt.h"
#include <QKeyEvent>
namespace Ui {
class FilterForm;
}
class FilterForm : public BaseWgt
{
Q_OBJECT
public:
explicit FilterForm(QWidget *parent = nullptr);
~FilterForm();
private:
Ui::FilterForm *ui;
private slots:
void SetFilter();
void Cancel();
protected:
virtual void keyPressEvent(QKeyEvent *event);
signals:
void sgSetFilter(QString);
};
#endif // FILTERFORM_H

View File

@ -0,0 +1,167 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>FilterForm</class>
<widget class="QWidget" name="FilterForm">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>494</width>
<height>304</height>
</rect>
</property>
<property name="windowTitle">
<string>Form</string>
</property>
<widget class="QWidget" name="widget_2" native="true">
<property name="geometry">
<rect>
<x>-10</x>
<y>220</y>
<width>494</width>
<height>76</height>
</rect>
</property>
<property name="minimumSize">
<size>
<width>0</width>
<height>30</height>
</size>
</property>
<widget class="QPushButton" name="Btn_OK">
<property name="geometry">
<rect>
<x>270</x>
<y>40</y>
<width>75</width>
<height>23</height>
</rect>
</property>
<property name="styleSheet">
<string notr="true">background-color: rgb(69, 90, 108);</string>
</property>
<property name="text">
<string>确认</string>
</property>
</widget>
<widget class="QPushButton" name="Btn_Cancel">
<property name="geometry">
<rect>
<x>370</x>
<y>40</y>
<width>75</width>
<height>23</height>
</rect>
</property>
<property name="styleSheet">
<string notr="true">background-color: rgb(69, 90, 108);</string>
</property>
<property name="text">
<string>取消</string>
</property>
</widget>
</widget>
<widget class="QWidget" name="widget" native="true">
<property name="geometry">
<rect>
<x>-10</x>
<y>14</y>
<width>494</width>
<height>200</height>
</rect>
</property>
<property name="minimumSize">
<size>
<width>0</width>
<height>200</height>
</size>
</property>
<widget class="QLineEdit" name="lineEdit">
<property name="geometry">
<rect>
<x>160</x>
<y>90</y>
<width>71</width>
<height>31</height>
</rect>
</property>
<property name="styleSheet">
<string notr="true">background-color: rgb(28, 28, 36);
border-width:0;border-style:outset;
text-align:center;
</string>
</property>
</widget>
<widget class="QLabel" name="label">
<property name="geometry">
<rect>
<x>113</x>
<y>90</y>
<width>31</width>
<height>31</height>
</rect>
</property>
<property name="text">
<string>滤波</string>
</property>
</widget>
<widget class="QLineEdit" name="lineEdit_2">
<property name="geometry">
<rect>
<x>300</x>
<y>90</y>
<width>71</width>
<height>31</height>
</rect>
</property>
<property name="styleSheet">
<string notr="true">background-color: rgb(28, 28, 36);
border-width:0;border-style:outset;
text-align:center;
</string>
</property>
</widget>
<widget class="QLabel" name="label_2">
<property name="geometry">
<rect>
<x>250</x>
<y>100</y>
<width>54</width>
<height>12</height>
</rect>
</property>
<property name="text">
<string>-----</string>
</property>
</widget>
<widget class="QLabel" name="label_5">
<property name="geometry">
<rect>
<x>180</x>
<y>60</y>
<width>54</width>
<height>21</height>
</rect>
</property>
<property name="text">
<string>起始</string>
</property>
</widget>
<widget class="QLabel" name="label_6">
<property name="geometry">
<rect>
<x>310</x>
<y>60</y>
<width>54</width>
<height>21</height>
</rect>
</property>
<property name="text">
<string>结束</string>
</property>
</widget>
</widget>
</widget>
<resources/>
<connections/>
</ui>

View File

@ -0,0 +1,22 @@
#ifndef __FREEGLUT_H__
#define __FREEGLUT_H__
/*
* freeglut.h
*
* The freeglut library include file
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* PAWEL W. OLSZTA BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
#include "freeglut_std.h"
#include "freeglut_ext.h"
/*** END OF FILE ***/
#endif /* __FREEGLUT_H__ */

View File

@ -0,0 +1,271 @@
#ifndef __FREEGLUT_EXT_H__
#define __FREEGLUT_EXT_H__
/*
* freeglut_ext.h
*
* The non-GLUT-compatible extensions to the freeglut library include file
*
* Copyright (c) 1999-2000 Pawel W. Olszta. All Rights Reserved.
* Written by Pawel W. Olszta, <olszta@sourceforge.net>
* Creation date: Thu Dec 2 1999
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included
* in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* PAWEL W. OLSZTA BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
#ifdef __cplusplus
extern "C" {
#endif
/*
* Additional GLUT Key definitions for the Special key function
*/
#define GLUT_KEY_NUM_LOCK 0x006D
#define GLUT_KEY_BEGIN 0x006E
#define GLUT_KEY_DELETE 0x006F
#define GLUT_KEY_SHIFT_L 0x0070
#define GLUT_KEY_SHIFT_R 0x0071
#define GLUT_KEY_CTRL_L 0x0072
#define GLUT_KEY_CTRL_R 0x0073
#define GLUT_KEY_ALT_L 0x0074
#define GLUT_KEY_ALT_R 0x0075
/*
* GLUT API Extension macro definitions -- behaviour when the user clicks on an "x" to close a window
*/
#define GLUT_ACTION_EXIT 0
#define GLUT_ACTION_GLUTMAINLOOP_RETURNS 1
#define GLUT_ACTION_CONTINUE_EXECUTION 2
/*
* Create a new rendering context when the user opens a new window?
*/
#define GLUT_CREATE_NEW_CONTEXT 0
#define GLUT_USE_CURRENT_CONTEXT 1
/*
* Direct/Indirect rendering context options (has meaning only in Unix/X11)
*/
#define GLUT_FORCE_INDIRECT_CONTEXT 0
#define GLUT_ALLOW_DIRECT_CONTEXT 1
#define GLUT_TRY_DIRECT_CONTEXT 2
#define GLUT_FORCE_DIRECT_CONTEXT 3
/*
* GLUT API Extension macro definitions -- the glutGet parameters
*/
#define GLUT_INIT_STATE 0x007C
#define GLUT_ACTION_ON_WINDOW_CLOSE 0x01F9
#define GLUT_WINDOW_BORDER_WIDTH 0x01FA
#define GLUT_WINDOW_BORDER_HEIGHT 0x01FB
#define GLUT_WINDOW_HEADER_HEIGHT 0x01FB /* Docs say it should always have been GLUT_WINDOW_BORDER_HEIGHT, keep this for backward compatibility */
#define GLUT_VERSION 0x01FC
#define GLUT_RENDERING_CONTEXT 0x01FD
#define GLUT_DIRECT_RENDERING 0x01FE
#define GLUT_FULL_SCREEN 0x01FF
#define GLUT_SKIP_STALE_MOTION_EVENTS 0x0204
#define GLUT_GEOMETRY_VISUALIZE_NORMALS 0x0205
#define GLUT_STROKE_FONT_DRAW_JOIN_DOTS 0x0206 /* Draw dots between line segments of stroke fonts? */
/*
* New tokens for glutInitDisplayMode.
* Only one GLUT_AUXn bit may be used at a time.
* Value 0x0400 is defined in OpenGLUT.
*/
#define GLUT_AUX 0x1000
#define GLUT_AUX1 0x1000
#define GLUT_AUX2 0x2000
#define GLUT_AUX3 0x4000
#define GLUT_AUX4 0x8000
/*
* Context-related flags, see fg_state.c
* Set the requested OpenGL version
*/
#define GLUT_INIT_MAJOR_VERSION 0x0200
#define GLUT_INIT_MINOR_VERSION 0x0201
#define GLUT_INIT_FLAGS 0x0202
#define GLUT_INIT_PROFILE 0x0203
/*
* Flags for glutInitContextFlags, see fg_init.c
*/
#define GLUT_DEBUG 0x0001
#define GLUT_FORWARD_COMPATIBLE 0x0002
/*
* Flags for glutInitContextProfile, see fg_init.c
*/
#define GLUT_CORE_PROFILE 0x0001
#define GLUT_COMPATIBILITY_PROFILE 0x0002
/*
* Process loop function, see fg_main.c
*/
FGAPI void FGAPIENTRY glutMainLoopEvent( void );
FGAPI void FGAPIENTRY glutLeaveMainLoop( void );
FGAPI void FGAPIENTRY glutExit ( void );
/*
* Window management functions, see fg_window.c
*/
FGAPI void FGAPIENTRY glutFullScreenToggle( void );
FGAPI void FGAPIENTRY glutLeaveFullScreen( void );
/*
* Menu functions
*/
FGAPI void FGAPIENTRY glutSetMenuFont( int menuID, void* font );
/*
* Window-specific callback functions, see fg_callbacks.c
*/
FGAPI void FGAPIENTRY glutMouseWheelFunc( void (* callback)( int, int, int, int ) );
FGAPI void FGAPIENTRY glutPositionFunc( void (* callback)( int, int ) );
FGAPI void FGAPIENTRY glutCloseFunc( void (* callback)( void ) );
FGAPI void FGAPIENTRY glutWMCloseFunc( void (* callback)( void ) );
/* And also a destruction callback for menus */
FGAPI void FGAPIENTRY glutMenuDestroyFunc( void (* callback)( void ) );
/*
* State setting and retrieval functions, see fg_state.c
*/
FGAPI void FGAPIENTRY glutSetOption ( GLenum option_flag, int value );
FGAPI int * FGAPIENTRY glutGetModeValues(GLenum mode, int * size);
/* A.Donev: User-data manipulation */
FGAPI void* FGAPIENTRY glutGetWindowData( void );
FGAPI void FGAPIENTRY glutSetWindowData(void* data);
FGAPI void* FGAPIENTRY glutGetMenuData( void );
FGAPI void FGAPIENTRY glutSetMenuData(void* data);
/*
* Font stuff, see fg_font.c
*/
FGAPI int FGAPIENTRY glutBitmapHeight( void* font );
FGAPI GLfloat FGAPIENTRY glutStrokeHeight( void* font );
FGAPI void FGAPIENTRY glutBitmapString( void* font, const unsigned char *string );
FGAPI void FGAPIENTRY glutStrokeString( void* font, const unsigned char *string );
/*
* Geometry functions, see fg_geometry.c
*/
FGAPI void FGAPIENTRY glutWireRhombicDodecahedron( void );
FGAPI void FGAPIENTRY glutSolidRhombicDodecahedron( void );
FGAPI void FGAPIENTRY glutWireSierpinskiSponge ( int num_levels, double offset[3], double scale );
FGAPI void FGAPIENTRY glutSolidSierpinskiSponge ( int num_levels, double offset[3], double scale );
FGAPI void FGAPIENTRY glutWireCylinder( double radius, double height, GLint slices, GLint stacks);
FGAPI void FGAPIENTRY glutSolidCylinder( double radius, double height, GLint slices, GLint stacks);
/*
* Rest of functions for rendering Newell's teaset, found in fg_teapot.c
* NB: front facing polygons have clockwise winding, not counter clockwise
*/
FGAPI void FGAPIENTRY glutWireTeacup( double size );
FGAPI void FGAPIENTRY glutSolidTeacup( double size );
FGAPI void FGAPIENTRY glutWireTeaspoon( double size );
FGAPI void FGAPIENTRY glutSolidTeaspoon( double size );
/*
* Extension functions, see fg_ext.c
*/
typedef void (*GLUTproc)();
FGAPI GLUTproc FGAPIENTRY glutGetProcAddress( const char *procName );
/*
* Multi-touch/multi-pointer extensions
*/
#define GLUT_HAS_MULTI 1
/* TODO: add device_id parameter,
cf. http://sourceforge.net/mailarchive/forum.php?thread_name=20120518071314.GA28061%40perso.beuc.net&forum_name=freeglut-developer */
FGAPI void FGAPIENTRY glutMultiEntryFunc( void (* callback)( int, int ) );
FGAPI void FGAPIENTRY glutMultiButtonFunc( void (* callback)( int, int, int, int, int ) );
FGAPI void FGAPIENTRY glutMultiMotionFunc( void (* callback)( int, int, int ) );
FGAPI void FGAPIENTRY glutMultiPassiveFunc( void (* callback)( int, int, int ) );
/*
* Joystick functions, see fg_joystick.c
*/
/* USE OF THESE FUNCTIONS IS DEPRECATED !!!!! */
/* If you have a serious need for these functions in your application, please either
* contact the "freeglut" developer community at freeglut-developer@lists.sourceforge.net,
* switch to the OpenGLUT library, or else port your joystick functionality over to PLIB's
* "js" library.
*/
int glutJoystickGetNumAxes( int ident );
int glutJoystickGetNumButtons( int ident );
int glutJoystickNotWorking( int ident );
float glutJoystickGetDeadBand( int ident, int axis );
void glutJoystickSetDeadBand( int ident, int axis, float db );
float glutJoystickGetSaturation( int ident, int axis );
void glutJoystickSetSaturation( int ident, int axis, float st );
void glutJoystickSetMinRange( int ident, float *axes );
void glutJoystickSetMaxRange( int ident, float *axes );
void glutJoystickSetCenter( int ident, float *axes );
void glutJoystickGetMinRange( int ident, float *axes );
void glutJoystickGetMaxRange( int ident, float *axes );
void glutJoystickGetCenter( int ident, float *axes );
/*
* Initialization functions, see fg_init.c
*/
/* to get the typedef for va_list */
#include <stdarg.h>
FGAPI void FGAPIENTRY glutInitContextVersion( int majorVersion, int minorVersion );
FGAPI void FGAPIENTRY glutInitContextFlags( int flags );
FGAPI void FGAPIENTRY glutInitContextProfile( int profile );
FGAPI void FGAPIENTRY glutInitErrorFunc( void (* callback)( const char *fmt, va_list ap ) );
FGAPI void FGAPIENTRY glutInitWarningFunc( void (* callback)( const char *fmt, va_list ap ) );
/* OpenGL >= 2.0 support */
FGAPI void FGAPIENTRY glutSetVertexAttribCoord3(GLint attrib);
FGAPI void FGAPIENTRY glutSetVertexAttribNormal(GLint attrib);
FGAPI void FGAPIENTRY glutSetVertexAttribTexCoord2(GLint attrib);
/* Mobile platforms lifecycle */
FGAPI void FGAPIENTRY glutInitContextFunc(void (* callback)());
FGAPI void FGAPIENTRY glutAppStatusFunc(void (* callback)(int));
/* state flags that can be passed to callback set by glutAppStatusFunc */
#define GLUT_APPSTATUS_PAUSE 0x0001
#define GLUT_APPSTATUS_RESUME 0x0002
/*
* GLUT API macro definitions -- the display mode definitions
*/
#define GLUT_CAPTIONLESS 0x0400
#define GLUT_BORDERLESS 0x0800
#define GLUT_SRGB 0x1000
#ifdef __cplusplus
}
#endif
/*** END OF FILE ***/
#endif /* __FREEGLUT_EXT_H__ */

View File

@ -0,0 +1,638 @@
#ifndef __FREEGLUT_STD_H__
#define __FREEGLUT_STD_H__
/*
* freeglut_std.h
*
* The GLUT-compatible part of the freeglut library include file
*
* Copyright (c) 1999-2000 Pawel W. Olszta. All Rights Reserved.
* Written by Pawel W. Olszta, <olszta@sourceforge.net>
* Creation date: Thu Dec 2 1999
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included
* in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* PAWEL W. OLSZTA BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
#ifdef __cplusplus
extern "C" {
#endif
/*
* Under windows, we have to differentiate between static and dynamic libraries
*/
#ifdef _WIN32
/* #pragma may not be supported by some compilers.
* Discussion by FreeGLUT developers suggests that
* Visual C++ specific code involving pragmas may
* need to move to a separate header. 24th Dec 2003
*/
/* Define FREEGLUT_LIB_PRAGMAS to 1 to include library
* pragmas or to 0 to exclude library pragmas.
* The default behavior depends on the compiler/platform.
*/
# ifndef FREEGLUT_LIB_PRAGMAS
# if ( defined(_MSC_VER) || defined(__WATCOMC__) ) && !defined(_WIN32_WCE)
# define FREEGLUT_LIB_PRAGMAS 1
# else
# define FREEGLUT_LIB_PRAGMAS 0
# endif
# endif
# ifndef WIN32_LEAN_AND_MEAN
# define WIN32_LEAN_AND_MEAN 1
# endif
# ifndef NOMINMAX
# define NOMINMAX
# endif
# include <windows.h>
/* Windows static library */
# ifdef FREEGLUT_STATIC
#error Static linking is not supported with this build. Please remove the FREEGLUT_STATIC preprocessor directive, or download the source code from http://freeglut.sf.net/ and build against that.
/* Windows shared library (DLL) */
# else
# define FGAPIENTRY __stdcall
# if defined(FREEGLUT_EXPORTS)
# define FGAPI __declspec(dllexport)
# else
# define FGAPI __declspec(dllimport)
/* Link with Win32 shared freeglut lib */
# if FREEGLUT_LIB_PRAGMAS
# pragma comment (lib, "freeglut.lib")
# endif
# endif
# endif
/* Drag in other Windows libraries as required by FreeGLUT */
# if FREEGLUT_LIB_PRAGMAS
# pragma comment (lib, "glu32.lib") /* link OpenGL Utility lib */
# pragma comment (lib, "opengl32.lib") /* link Microsoft OpenGL lib */
# pragma comment (lib, "gdi32.lib") /* link Windows GDI lib */
# pragma comment (lib, "winmm.lib") /* link Windows MultiMedia lib */
# pragma comment (lib, "user32.lib") /* link Windows user lib */
# endif
#else
/* Non-Windows definition of FGAPI and FGAPIENTRY */
# define FGAPI
# define FGAPIENTRY
#endif
/*
* The freeglut and GLUT API versions
*/
#define FREEGLUT 1
#define GLUT_API_VERSION 4
#define GLUT_XLIB_IMPLEMENTATION 13
/* Deprecated:
cf. http://sourceforge.net/mailarchive/forum.php?thread_name=CABcAi1hw7cr4xtigckaGXB5X8wddLfMcbA_rZ3NAuwMrX_zmsw%40mail.gmail.com&forum_name=freeglut-developer */
#define FREEGLUT_VERSION_2_0 1
/*
* Always include OpenGL and GLU headers
*/
/* Note: FREEGLUT_GLES is only used to cleanly bootstrap headers
inclusion here; use GLES constants directly
(e.g. GL_ES_VERSION_2_0) for all other needs */
#ifdef FREEGLUT_GLES
# include <EGL/egl.h>
# include <GLES/gl.h>
# include <GLES2/gl2.h>
#elif __APPLE__
# include <OpenGL/gl.h>
# include <OpenGL/glu.h>
#else
# include <GL/gl.h>
# include <GL/glu.h>
#endif
/*
* GLUT API macro definitions -- the special key codes:
*/
#define GLUT_KEY_F1 0x0001
#define GLUT_KEY_F2 0x0002
#define GLUT_KEY_F3 0x0003
#define GLUT_KEY_F4 0x0004
#define GLUT_KEY_F5 0x0005
#define GLUT_KEY_F6 0x0006
#define GLUT_KEY_F7 0x0007
#define GLUT_KEY_F8 0x0008
#define GLUT_KEY_F9 0x0009
#define GLUT_KEY_F10 0x000A
#define GLUT_KEY_F11 0x000B
#define GLUT_KEY_F12 0x000C
#define GLUT_KEY_LEFT 0x0064
#define GLUT_KEY_UP 0x0065
#define GLUT_KEY_RIGHT 0x0066
#define GLUT_KEY_DOWN 0x0067
#define GLUT_KEY_PAGE_UP 0x0068
#define GLUT_KEY_PAGE_DOWN 0x0069
#define GLUT_KEY_HOME 0x006A
#define GLUT_KEY_END 0x006B
#define GLUT_KEY_INSERT 0x006C
/*
* GLUT API macro definitions -- mouse state definitions
*/
#define GLUT_LEFT_BUTTON 0x0000
#define GLUT_MIDDLE_BUTTON 0x0001
#define GLUT_RIGHT_BUTTON 0x0002
#define GLUT_DOWN 0x0000
#define GLUT_UP 0x0001
#define GLUT_LEFT 0x0000
#define GLUT_ENTERED 0x0001
/*
* GLUT API macro definitions -- the display mode definitions
*/
#define GLUT_RGB 0x0000
#define GLUT_RGBA 0x0000
#define GLUT_INDEX 0x0001
#define GLUT_SINGLE 0x0000
#define GLUT_DOUBLE 0x0002
#define GLUT_ACCUM 0x0004
#define GLUT_ALPHA 0x0008
#define GLUT_DEPTH 0x0010
#define GLUT_STENCIL 0x0020
#define GLUT_MULTISAMPLE 0x0080
#define GLUT_STEREO 0x0100
#define GLUT_LUMINANCE 0x0200
/*
* GLUT API macro definitions -- windows and menu related definitions
*/
#define GLUT_MENU_NOT_IN_USE 0x0000
#define GLUT_MENU_IN_USE 0x0001
#define GLUT_NOT_VISIBLE 0x0000
#define GLUT_VISIBLE 0x0001
#define GLUT_HIDDEN 0x0000
#define GLUT_FULLY_RETAINED 0x0001
#define GLUT_PARTIALLY_RETAINED 0x0002
#define GLUT_FULLY_COVERED 0x0003
/*
* GLUT API macro definitions -- fonts definitions
*
* Steve Baker suggested to make it binary compatible with GLUT:
*/
#if defined(_MSC_VER) || defined(__CYGWIN__) || defined(__MINGW32__) || defined(__WATCOMC__)
# define GLUT_STROKE_ROMAN ((void *)0x0000)
# define GLUT_STROKE_MONO_ROMAN ((void *)0x0001)
# define GLUT_BITMAP_9_BY_15 ((void *)0x0002)
# define GLUT_BITMAP_8_BY_13 ((void *)0x0003)
# define GLUT_BITMAP_TIMES_ROMAN_10 ((void *)0x0004)
# define GLUT_BITMAP_TIMES_ROMAN_24 ((void *)0x0005)
# define GLUT_BITMAP_HELVETICA_10 ((void *)0x0006)
# define GLUT_BITMAP_HELVETICA_12 ((void *)0x0007)
# define GLUT_BITMAP_HELVETICA_18 ((void *)0x0008)
#else
/*
* I don't really know if it's a good idea... But here it goes:
*/
extern void* glutStrokeRoman;
extern void* glutStrokeMonoRoman;
extern void* glutBitmap9By15;
extern void* glutBitmap8By13;
extern void* glutBitmapTimesRoman10;
extern void* glutBitmapTimesRoman24;
extern void* glutBitmapHelvetica10;
extern void* glutBitmapHelvetica12;
extern void* glutBitmapHelvetica18;
/*
* Those pointers will be used by following definitions:
*/
# define GLUT_STROKE_ROMAN ((void *) &glutStrokeRoman)
# define GLUT_STROKE_MONO_ROMAN ((void *) &glutStrokeMonoRoman)
# define GLUT_BITMAP_9_BY_15 ((void *) &glutBitmap9By15)
# define GLUT_BITMAP_8_BY_13 ((void *) &glutBitmap8By13)
# define GLUT_BITMAP_TIMES_ROMAN_10 ((void *) &glutBitmapTimesRoman10)
# define GLUT_BITMAP_TIMES_ROMAN_24 ((void *) &glutBitmapTimesRoman24)
# define GLUT_BITMAP_HELVETICA_10 ((void *) &glutBitmapHelvetica10)
# define GLUT_BITMAP_HELVETICA_12 ((void *) &glutBitmapHelvetica12)
# define GLUT_BITMAP_HELVETICA_18 ((void *) &glutBitmapHelvetica18)
#endif
/*
* GLUT API macro definitions -- the glutGet parameters
*/
#define GLUT_WINDOW_X 0x0064
#define GLUT_WINDOW_Y 0x0065
#define GLUT_WINDOW_WIDTH 0x0066
#define GLUT_WINDOW_HEIGHT 0x0067
#define GLUT_WINDOW_BUFFER_SIZE 0x0068
#define GLUT_WINDOW_STENCIL_SIZE 0x0069
#define GLUT_WINDOW_DEPTH_SIZE 0x006A
#define GLUT_WINDOW_RED_SIZE 0x006B
#define GLUT_WINDOW_GREEN_SIZE 0x006C
#define GLUT_WINDOW_BLUE_SIZE 0x006D
#define GLUT_WINDOW_ALPHA_SIZE 0x006E
#define GLUT_WINDOW_ACCUM_RED_SIZE 0x006F
#define GLUT_WINDOW_ACCUM_GREEN_SIZE 0x0070
#define GLUT_WINDOW_ACCUM_BLUE_SIZE 0x0071
#define GLUT_WINDOW_ACCUM_ALPHA_SIZE 0x0072
#define GLUT_WINDOW_DOUBLEBUFFER 0x0073
#define GLUT_WINDOW_RGBA 0x0074
#define GLUT_WINDOW_PARENT 0x0075
#define GLUT_WINDOW_NUM_CHILDREN 0x0076
#define GLUT_WINDOW_COLORMAP_SIZE 0x0077
#define GLUT_WINDOW_NUM_SAMPLES 0x0078
#define GLUT_WINDOW_STEREO 0x0079
#define GLUT_WINDOW_CURSOR 0x007A
#define GLUT_SCREEN_WIDTH 0x00C8
#define GLUT_SCREEN_HEIGHT 0x00C9
#define GLUT_SCREEN_WIDTH_MM 0x00CA
#define GLUT_SCREEN_HEIGHT_MM 0x00CB
#define GLUT_MENU_NUM_ITEMS 0x012C
#define GLUT_DISPLAY_MODE_POSSIBLE 0x0190
#define GLUT_INIT_WINDOW_X 0x01F4
#define GLUT_INIT_WINDOW_Y 0x01F5
#define GLUT_INIT_WINDOW_WIDTH 0x01F6
#define GLUT_INIT_WINDOW_HEIGHT 0x01F7
#define GLUT_INIT_DISPLAY_MODE 0x01F8
#define GLUT_ELAPSED_TIME 0x02BC
#define GLUT_WINDOW_FORMAT_ID 0x007B
/*
* GLUT API macro definitions -- the glutDeviceGet parameters
*/
#define GLUT_HAS_KEYBOARD 0x0258
#define GLUT_HAS_MOUSE 0x0259
#define GLUT_HAS_SPACEBALL 0x025A
#define GLUT_HAS_DIAL_AND_BUTTON_BOX 0x025B
#define GLUT_HAS_TABLET 0x025C
#define GLUT_NUM_MOUSE_BUTTONS 0x025D
#define GLUT_NUM_SPACEBALL_BUTTONS 0x025E
#define GLUT_NUM_BUTTON_BOX_BUTTONS 0x025F
#define GLUT_NUM_DIALS 0x0260
#define GLUT_NUM_TABLET_BUTTONS 0x0261
#define GLUT_DEVICE_IGNORE_KEY_REPEAT 0x0262
#define GLUT_DEVICE_KEY_REPEAT 0x0263
#define GLUT_HAS_JOYSTICK 0x0264
#define GLUT_OWNS_JOYSTICK 0x0265
#define GLUT_JOYSTICK_BUTTONS 0x0266
#define GLUT_JOYSTICK_AXES 0x0267
#define GLUT_JOYSTICK_POLL_RATE 0x0268
/*
* GLUT API macro definitions -- the glutLayerGet parameters
*/
#define GLUT_OVERLAY_POSSIBLE 0x0320
#define GLUT_LAYER_IN_USE 0x0321
#define GLUT_HAS_OVERLAY 0x0322
#define GLUT_TRANSPARENT_INDEX 0x0323
#define GLUT_NORMAL_DAMAGED 0x0324
#define GLUT_OVERLAY_DAMAGED 0x0325
/*
* GLUT API macro definitions -- the glutVideoResizeGet parameters
*/
#define GLUT_VIDEO_RESIZE_POSSIBLE 0x0384
#define GLUT_VIDEO_RESIZE_IN_USE 0x0385
#define GLUT_VIDEO_RESIZE_X_DELTA 0x0386
#define GLUT_VIDEO_RESIZE_Y_DELTA 0x0387
#define GLUT_VIDEO_RESIZE_WIDTH_DELTA 0x0388
#define GLUT_VIDEO_RESIZE_HEIGHT_DELTA 0x0389
#define GLUT_VIDEO_RESIZE_X 0x038A
#define GLUT_VIDEO_RESIZE_Y 0x038B
#define GLUT_VIDEO_RESIZE_WIDTH 0x038C
#define GLUT_VIDEO_RESIZE_HEIGHT 0x038D
/*
* GLUT API macro definitions -- the glutUseLayer parameters
*/
#define GLUT_NORMAL 0x0000
#define GLUT_OVERLAY 0x0001
/*
* GLUT API macro definitions -- the glutGetModifiers parameters
*/
#define GLUT_ACTIVE_SHIFT 0x0001
#define GLUT_ACTIVE_CTRL 0x0002
#define GLUT_ACTIVE_ALT 0x0004
/*
* GLUT API macro definitions -- the glutSetCursor parameters
*/
#define GLUT_CURSOR_RIGHT_ARROW 0x0000
#define GLUT_CURSOR_LEFT_ARROW 0x0001
#define GLUT_CURSOR_INFO 0x0002
#define GLUT_CURSOR_DESTROY 0x0003
#define GLUT_CURSOR_HELP 0x0004
#define GLUT_CURSOR_CYCLE 0x0005
#define GLUT_CURSOR_SPRAY 0x0006
#define GLUT_CURSOR_WAIT 0x0007
#define GLUT_CURSOR_TEXT 0x0008
#define GLUT_CURSOR_CROSSHAIR 0x0009
#define GLUT_CURSOR_UP_DOWN 0x000A
#define GLUT_CURSOR_LEFT_RIGHT 0x000B
#define GLUT_CURSOR_TOP_SIDE 0x000C
#define GLUT_CURSOR_BOTTOM_SIDE 0x000D
#define GLUT_CURSOR_LEFT_SIDE 0x000E
#define GLUT_CURSOR_RIGHT_SIDE 0x000F
#define GLUT_CURSOR_TOP_LEFT_CORNER 0x0010
#define GLUT_CURSOR_TOP_RIGHT_CORNER 0x0011
#define GLUT_CURSOR_BOTTOM_RIGHT_CORNER 0x0012
#define GLUT_CURSOR_BOTTOM_LEFT_CORNER 0x0013
#define GLUT_CURSOR_INHERIT 0x0064
#define GLUT_CURSOR_NONE 0x0065
#define GLUT_CURSOR_FULL_CROSSHAIR 0x0066
/*
* GLUT API macro definitions -- RGB color component specification definitions
*/
#define GLUT_RED 0x0000
#define GLUT_GREEN 0x0001
#define GLUT_BLUE 0x0002
/*
* GLUT API macro definitions -- additional keyboard and joystick definitions
*/
#define GLUT_KEY_REPEAT_OFF 0x0000
#define GLUT_KEY_REPEAT_ON 0x0001
#define GLUT_KEY_REPEAT_DEFAULT 0x0002
#define GLUT_JOYSTICK_BUTTON_A 0x0001
#define GLUT_JOYSTICK_BUTTON_B 0x0002
#define GLUT_JOYSTICK_BUTTON_C 0x0004
#define GLUT_JOYSTICK_BUTTON_D 0x0008
/*
* GLUT API macro definitions -- game mode definitions
*/
#define GLUT_GAME_MODE_ACTIVE 0x0000
#define GLUT_GAME_MODE_POSSIBLE 0x0001
#define GLUT_GAME_MODE_WIDTH 0x0002
#define GLUT_GAME_MODE_HEIGHT 0x0003
#define GLUT_GAME_MODE_PIXEL_DEPTH 0x0004
#define GLUT_GAME_MODE_REFRESH_RATE 0x0005
#define GLUT_GAME_MODE_DISPLAY_CHANGED 0x0006
/*
* Initialization functions, see fglut_init.c
*/
FGAPI void FGAPIENTRY glutInit( int* pargc, char** argv );
FGAPI void FGAPIENTRY glutInitWindowPosition( int x, int y );
FGAPI void FGAPIENTRY glutInitWindowSize( int width, int height );
FGAPI void FGAPIENTRY glutInitDisplayMode( unsigned int displayMode );
FGAPI void FGAPIENTRY glutInitDisplayString( const char* displayMode );
/*
* Process loop function, see fg_main.c
*/
FGAPI void FGAPIENTRY glutMainLoop( void );
/*
* Window management functions, see fg_window.c
*/
FGAPI int FGAPIENTRY glutCreateWindow( const char* title );
FGAPI int FGAPIENTRY glutCreateSubWindow( int window, int x, int y, int width, int height );
FGAPI void FGAPIENTRY glutDestroyWindow( int window );
FGAPI void FGAPIENTRY glutSetWindow( int window );
FGAPI int FGAPIENTRY glutGetWindow( void );
FGAPI void FGAPIENTRY glutSetWindowTitle( const char* title );
FGAPI void FGAPIENTRY glutSetIconTitle( const char* title );
FGAPI void FGAPIENTRY glutReshapeWindow( int width, int height );
FGAPI void FGAPIENTRY glutPositionWindow( int x, int y );
FGAPI void FGAPIENTRY glutShowWindow( void );
FGAPI void FGAPIENTRY glutHideWindow( void );
FGAPI void FGAPIENTRY glutIconifyWindow( void );
FGAPI void FGAPIENTRY glutPushWindow( void );
FGAPI void FGAPIENTRY glutPopWindow( void );
FGAPI void FGAPIENTRY glutFullScreen( void );
/*
* Display-related functions, see fg_display.c
*/
FGAPI void FGAPIENTRY glutPostWindowRedisplay( int window );
FGAPI void FGAPIENTRY glutPostRedisplay( void );
FGAPI void FGAPIENTRY glutSwapBuffers( void );
/*
* Mouse cursor functions, see fg_cursor.c
*/
FGAPI void FGAPIENTRY glutWarpPointer( int x, int y );
FGAPI void FGAPIENTRY glutSetCursor( int cursor );
/*
* Overlay stuff, see fg_overlay.c
*/
FGAPI void FGAPIENTRY glutEstablishOverlay( void );
FGAPI void FGAPIENTRY glutRemoveOverlay( void );
FGAPI void FGAPIENTRY glutUseLayer( GLenum layer );
FGAPI void FGAPIENTRY glutPostOverlayRedisplay( void );
FGAPI void FGAPIENTRY glutPostWindowOverlayRedisplay( int window );
FGAPI void FGAPIENTRY glutShowOverlay( void );
FGAPI void FGAPIENTRY glutHideOverlay( void );
/*
* Menu stuff, see fg_menu.c
*/
FGAPI int FGAPIENTRY glutCreateMenu( void (* callback)( int menu ) );
FGAPI void FGAPIENTRY glutDestroyMenu( int menu );
FGAPI int FGAPIENTRY glutGetMenu( void );
FGAPI void FGAPIENTRY glutSetMenu( int menu );
FGAPI void FGAPIENTRY glutAddMenuEntry( const char* label, int value );
FGAPI void FGAPIENTRY glutAddSubMenu( const char* label, int subMenu );
FGAPI void FGAPIENTRY glutChangeToMenuEntry( int item, const char* label, int value );
FGAPI void FGAPIENTRY glutChangeToSubMenu( int item, const char* label, int value );
FGAPI void FGAPIENTRY glutRemoveMenuItem( int item );
FGAPI void FGAPIENTRY glutAttachMenu( int button );
FGAPI void FGAPIENTRY glutDetachMenu( int button );
/*
* Global callback functions, see fg_callbacks.c
*/
FGAPI void FGAPIENTRY glutTimerFunc( unsigned int time, void (* callback)( int ), int value );
FGAPI void FGAPIENTRY glutIdleFunc( void (* callback)( void ) );
/*
* Window-specific callback functions, see fg_callbacks.c
*/
FGAPI void FGAPIENTRY glutKeyboardFunc( void (* callback)( unsigned char, int, int ) );
FGAPI void FGAPIENTRY glutSpecialFunc( void (* callback)( int, int, int ) );
FGAPI void FGAPIENTRY glutReshapeFunc( void (* callback)( int, int ) );
FGAPI void FGAPIENTRY glutVisibilityFunc( void (* callback)( int ) );
FGAPI void FGAPIENTRY glutDisplayFunc( void (* callback)( void ) );
FGAPI void FGAPIENTRY glutMouseFunc( void (* callback)( int, int, int, int ) );
FGAPI void FGAPIENTRY glutMotionFunc( void (* callback)( int, int ) );
FGAPI void FGAPIENTRY glutPassiveMotionFunc( void (* callback)( int, int ) );
FGAPI void FGAPIENTRY glutEntryFunc( void (* callback)( int ) );
FGAPI void FGAPIENTRY glutKeyboardUpFunc( void (* callback)( unsigned char, int, int ) );
FGAPI void FGAPIENTRY glutSpecialUpFunc( void (* callback)( int, int, int ) );
FGAPI void FGAPIENTRY glutJoystickFunc( void (* callback)( unsigned int, int, int, int ), int pollInterval );
FGAPI void FGAPIENTRY glutMenuStateFunc( void (* callback)( int ) );
FGAPI void FGAPIENTRY glutMenuStatusFunc( void (* callback)( int, int, int ) );
FGAPI void FGAPIENTRY glutOverlayDisplayFunc( void (* callback)( void ) );
FGAPI void FGAPIENTRY glutWindowStatusFunc( void (* callback)( int ) );
FGAPI void FGAPIENTRY glutSpaceballMotionFunc( void (* callback)( int, int, int ) );
FGAPI void FGAPIENTRY glutSpaceballRotateFunc( void (* callback)( int, int, int ) );
FGAPI void FGAPIENTRY glutSpaceballButtonFunc( void (* callback)( int, int ) );
FGAPI void FGAPIENTRY glutButtonBoxFunc( void (* callback)( int, int ) );
FGAPI void FGAPIENTRY glutDialsFunc( void (* callback)( int, int ) );
FGAPI void FGAPIENTRY glutTabletMotionFunc( void (* callback)( int, int ) );
FGAPI void FGAPIENTRY glutTabletButtonFunc( void (* callback)( int, int, int, int ) );
/*
* State setting and retrieval functions, see fg_state.c
*/
FGAPI int FGAPIENTRY glutGet( GLenum query );
FGAPI int FGAPIENTRY glutDeviceGet( GLenum query );
FGAPI int FGAPIENTRY glutGetModifiers( void );
FGAPI int FGAPIENTRY glutLayerGet( GLenum query );
/*
* Font stuff, see fg_font.c
*/
FGAPI void FGAPIENTRY glutBitmapCharacter( void* font, int character );
FGAPI int FGAPIENTRY glutBitmapWidth( void* font, int character );
FGAPI void FGAPIENTRY glutStrokeCharacter( void* font, int character );
FGAPI int FGAPIENTRY glutStrokeWidth( void* font, int character );
FGAPI GLfloat FGAPIENTRY glutStrokeWidthf( void* font, int character ); /* GLUT 3.8 */
FGAPI int FGAPIENTRY glutBitmapLength( void* font, const unsigned char* string );
FGAPI int FGAPIENTRY glutStrokeLength( void* font, const unsigned char* string );
FGAPI GLfloat FGAPIENTRY glutStrokeLengthf( void* font, const unsigned char *string ); /* GLUT 3.8 */
/*
* Geometry functions, see fg_geometry.c
*/
FGAPI void FGAPIENTRY glutWireCube( double size );
FGAPI void FGAPIENTRY glutSolidCube( double size );
FGAPI void FGAPIENTRY glutWireSphere( double radius, GLint slices, GLint stacks );
FGAPI void FGAPIENTRY glutSolidSphere( double radius, GLint slices, GLint stacks );
FGAPI void FGAPIENTRY glutWireCone( double base, double height, GLint slices, GLint stacks );
FGAPI void FGAPIENTRY glutSolidCone( double base, double height, GLint slices, GLint stacks );
FGAPI void FGAPIENTRY glutWireTorus( double innerRadius, double outerRadius, GLint sides, GLint rings );
FGAPI void FGAPIENTRY glutSolidTorus( double innerRadius, double outerRadius, GLint sides, GLint rings );
FGAPI void FGAPIENTRY glutWireDodecahedron( void );
FGAPI void FGAPIENTRY glutSolidDodecahedron( void );
FGAPI void FGAPIENTRY glutWireOctahedron( void );
FGAPI void FGAPIENTRY glutSolidOctahedron( void );
FGAPI void FGAPIENTRY glutWireTetrahedron( void );
FGAPI void FGAPIENTRY glutSolidTetrahedron( void );
FGAPI void FGAPIENTRY glutWireIcosahedron( void );
FGAPI void FGAPIENTRY glutSolidIcosahedron( void );
/*
* Teapot rendering functions, found in fg_teapot.c
* NB: front facing polygons have clockwise winding, not counter clockwise
*/
FGAPI void FGAPIENTRY glutWireTeapot( double size );
FGAPI void FGAPIENTRY glutSolidTeapot( double size );
/*
* Game mode functions, see fg_gamemode.c
*/
FGAPI void FGAPIENTRY glutGameModeString( const char* string );
FGAPI int FGAPIENTRY glutEnterGameMode( void );
FGAPI void FGAPIENTRY glutLeaveGameMode( void );
FGAPI int FGAPIENTRY glutGameModeGet( GLenum query );
/*
* Video resize functions, see fg_videoresize.c
*/
FGAPI int FGAPIENTRY glutVideoResizeGet( GLenum query );
FGAPI void FGAPIENTRY glutSetupVideoResizing( void );
FGAPI void FGAPIENTRY glutStopVideoResizing( void );
FGAPI void FGAPIENTRY glutVideoResize( int x, int y, int width, int height );
FGAPI void FGAPIENTRY glutVideoPan( int x, int y, int width, int height );
/*
* Colormap functions, see fg_misc.c
*/
FGAPI void FGAPIENTRY glutSetColor( int color, GLfloat red, GLfloat green, GLfloat blue );
FGAPI GLfloat FGAPIENTRY glutGetColor( int color, int component );
FGAPI void FGAPIENTRY glutCopyColormap( int window );
/*
* Misc keyboard and joystick functions, see fg_misc.c
*/
FGAPI void FGAPIENTRY glutIgnoreKeyRepeat( int ignore );
FGAPI void FGAPIENTRY glutSetKeyRepeat( int repeatMode );
FGAPI void FGAPIENTRY glutForceJoystickFunc( void );
/*
* Misc functions, see fg_misc.c
*/
FGAPI int FGAPIENTRY glutExtensionSupported( const char* extension );
FGAPI void FGAPIENTRY glutReportErrors( void );
/* Comment from glut.h of classic GLUT:
Win32 has an annoying issue where there are multiple C run-time
libraries (CRTs). If the executable is linked with a different CRT
from the GLUT DLL, the GLUT DLL will not share the same CRT static
data seen by the executable. In particular, atexit callbacks registered
in the executable will not be called if GLUT calls its (different)
exit routine). GLUT is typically built with the
"/MD" option (the CRT with multithreading DLL support), but the Visual
C++ linker default is "/ML" (the single threaded CRT).
One workaround to this issue is requiring users to always link with
the same CRT as GLUT is compiled with. That requires users supply a
non-standard option. GLUT 3.7 has its own built-in workaround where
the executable's "exit" function pointer is covertly passed to GLUT.
GLUT then calls the executable's exit function pointer to ensure that
any "atexit" calls registered by the application are called if GLUT
needs to exit.
Note that the __glut*WithExit routines should NEVER be called directly.
To avoid the atexit workaround, #define GLUT_DISABLE_ATEXIT_HACK. */
/* to get the prototype for exit() */
#include <stdlib.h>
#if defined(_WIN32) && !defined(GLUT_DISABLE_ATEXIT_HACK) && !defined(__WATCOMC__)
FGAPI void FGAPIENTRY __glutInitWithExit(int *argcp, char **argv, void (__cdecl *exitfunc)(int));
FGAPI int FGAPIENTRY __glutCreateWindowWithExit(const char *title, void (__cdecl *exitfunc)(int));
FGAPI int FGAPIENTRY __glutCreateMenuWithExit(void (* func)(int), void (__cdecl *exitfunc)(int));
#ifndef FREEGLUT_BUILDING_LIB
#if defined(__GNUC__)
#define FGUNUSED __attribute__((unused))
#else
#define FGUNUSED
#endif
static void FGAPIENTRY FGUNUSED glutInit_ATEXIT_HACK(int *argcp, char **argv) { __glutInitWithExit(argcp, argv, exit); }
#define glutInit glutInit_ATEXIT_HACK
static int FGAPIENTRY FGUNUSED glutCreateWindow_ATEXIT_HACK(const char *title) { return __glutCreateWindowWithExit(title, exit); }
#define glutCreateWindow glutCreateWindow_ATEXIT_HACK
static int FGAPIENTRY FGUNUSED glutCreateMenu_ATEXIT_HACK(void (* func)(int)) { return __glutCreateMenuWithExit(func, exit); }
#define glutCreateMenu glutCreateMenu_ATEXIT_HACK
#endif
#endif
#ifdef __cplusplus
}
#endif
/*** END OF FILE ***/
#endif /* __FREEGLUT_STD_H__ */

21
ChaosDataPlayer/GL/glut.h Normal file
View File

@ -0,0 +1,21 @@
#ifndef __GLUT_H__
#define __GLUT_H__
/*
* glut.h
*
* The freeglut library include file
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* PAWEL W. OLSZTA BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
#include "freeglut_std.h"
/*** END OF FILE ***/
#endif /* __GLUT_H__ */

View File

@ -0,0 +1,159 @@
#!/bin/bash
# -*- shell-script -*-
# Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007, 2008,
# 2009 Rocky Bernstein rocky@gnu.org
#
# bashdb is free software; you can redistribute it and/or modify it under
# the terms of the GNU General Public License as published by the Free
# Software Foundation; either version 2, or (at your option) any later
# version.
#
# bashdb is distributed in the hope that it will be useful, but WITHOUT ANY
# WARRANTY; without even the implied warranty of MERCHANTABILITY or
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
# for more details.
#
# You should have received a copy of the GNU General Public License along
# with bashdb; see the file COPYING. If not, write to the Free Software
# Foundation, 59 Temple Place, Suite 330, Boston, MA 02111 USA.
#
# The alternate way to invoke debugger, "bash --debugger", has some
# advantages: it sets $0 correctly and doesn't show this script in
# the call trace. However the bash has been a bit inflexible and
# quirky so sadly this script seems to be needed more than it would
# normally.
[[ -z $_Dbg_ver ]] && typeset _Dbg_ver=\
'$Id: bashdb.in,v 1.48 2008/10/30 08:22:23 rockyb Exp $'
# This routine gets called via the -c or --command option and its sole
# purpose is to capture the command string such as via "x $*" or
# in a traceback ("where").
function _Dbg_eval {
eval $*
}
# Name we refer to ourselves by
typeset _Dbg_debugger_name='bashdb'
# The shell we are configured to run under.
typeset _Dbg_shell='/bin/bash'
# The release name we are configured to run under.
typeset _Dbg_release='4.0-0.4'
# The short shell name. Helps keep code common in bash, zsh, and ksh debuggers.
typeset _Dbg_shell_name=${_Dbg_shell##*/} # Equivalent to basename(_Dbg_shell)
# Original $0. Note we can't set this in an include.
typeset _Dbg_orig_0=$0
# Equivalent to basename $0; the short program name
typeset _Dbg_pname=${0##*/}
## Stuff set by autoconf/configure ###
typeset prefix=/usr/local
typeset _Dbg_libdir=${prefix}/share/bashdb
###
[[ ! -d $_Dbg_libdir ]] && _Dbg_libdir='.'
# Parse just the libdir option
# Show basename only in location listing. This is needed in regression tests
typeset -i _Dbg_basename_only=${BASHDB_BASENAME_ONLY:-0}
typeset _Dbg_bashdb_main=/usr/local/lib/bashdb/bashdb-main.inc
typeset -x _Dbg_libdir=${_Dbg_bashdb_main%/*} # dirname(_Dbg_bashdb_main)
# typeset _Dbg_libdir=${prefix}/share/bashdb
typeset _Dbg_main=dbg-main.sh
typeset _Dbg_bindir=$(dirname $0)
# What to set for location of helper routines?
if [[ ! -e $_Dbg_libdir/$_Dbg_main ]] ; then
# Use bindir/../share as fallback
_Dbg_libdir=
if [[ -d $_Dbg_bindir/../share/bashdb ]] ; then
_Dbg_libdir=$_Dbg_bindir/../share/bashdb
fi
fi
# Parse just the library option
typeset -ax _Dbg_script_args=("$@")
typeset -i _Dbg_i
for ((_Dbg_i=0; _Dbg_i<${#_Dbg_script_args[@]}-1; _Dbg_i++)) ; do
typeset arg=${_Dbg_script_args[$_Dbg_i]}
if [[ $arg == '-L' || $arg == '--library' ]] ; then
((_Dbg_i++))
_Dbg_libdir="${_Dbg_script_args[$_Dbg_i]}"
break
fi
done
if [[ ! -d $_Dbg_libdir ]] && [[ ! -d $_Dbg_libdir ]] ; then
echo "${_Dbg_pname}: Can't read debugger library directory '${_Dbg_libdir}'."
echo "${_Dbg_pname}: Perhaps bashdb is installed wrong (if its installed)." >&2
echo "${_Dbg_pname}: Try running bashdb using -L (with a different directory)." >&2
echo "${_Dbg_pname}: Run bashdb --help for a list and explanation of options." >&2
exit 1
fi
# Pull in the rest of the debugger code.
typeset _Dbg_main="$_Dbg_libdir/dbg-main.sh"
if [[ ! -r $_Dbg_main ]] ; then
print "${_Dbg_pname}: Can't read debugger library file '${_Dbg_main}'."
print "${_Dbg_pname}: Perhaps bashdb is installed wrong (if its installed)." >&2
print "${_Dbg_pname}: Try running bashdb using -L (with a different directory)." >&2
print "${_Dbg_pname}: Run bashdb --help for a list and explanation of options." >&2
exit 1
fi
. $_Dbg_libdir/dbg-main.sh ;
# I don't know why when this is done in dbg-opts.sh it doesn't have
# an effect.
((OPTLIND > 0)) && shift "$((OPTLIND - 1))"
if (($# == 0)) && [[ -z $_Dbg_EXECUTION_STRING ]] ; then
echo >&2 "${_Dbg_pname}: need to give a script to debug or use the -c option."
exit 1
fi
_Dbg_script_file="$1"
shift
if [[ ! -d $_Dbg_tmpdir ]] && [[ ! -w $_Dbg_tmpdir ]] ; then
echo "${_Dbg_pname}: cannot write to temp directory $_Dbg_tmpdir." >&2
echo "${_Dbg_pname}: Use -T try directory location." >&2
exit 1
fi
# Note that this is called via bashdb rather than "bash --debugger"
_Dbg_script=1
if [[ -n $_Dbg_EXECUTION_STRING ]] ; then
_Dbg_script_file=$(_Dbg_tempname cmd)
echo "$_Dbg_EXECUTION_STRING" >$_Dbg_script_file
fi
if [[ ! -r "$_Dbg_script_file" ]] ; then
echo "${_Dbg_pname}: cannot read program to debug: ${_Dbg_script_file}." >&2
exit 1
fi
typeset -r _Dbg_Dbg_script_file=$(_Dbg_expand_filename $_Dbg_script_file)
if ((_Dbg_linetrace)) ; then
# No stepping.
_Dbg_write_journal_eval "_Dbg_step_ignore=-1"
_Dbg_QUIT_ON_QUIT=1
else
# Set to skip over statements up to ". $_Dbg_script_file"
_Dbg_write_journal_eval "_Dbg_step_ignore=3"
fi
_Dbg_init_default_traps
trap '_Dbg_debug_trap_handler 0 "$BASH_COMMAND" "$@"' DEBUG
set -o functrace
. "$_Dbg_script_file"
# end of bashdb

View File

@ -0,0 +1,123 @@
#!/bin/sh
#
# git-flow -- A collection of Git extensions to provide high-level
# repository operations for Vincent Driessen's branching model.
#
# Original blog post presenting this model is found at:
# http://nvie.com/git-model
#
# Feel free to contribute to this project at:
# http://github.com/nvie/gitflow
#
# Copyright 2010 Vincent Driessen. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# 1. Redistributions of source code must retain the above copyright notice,
# this list of conditions and the following disclaimer.
#
# 2. Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
#
# THIS SOFTWARE IS PROVIDED BY VINCENT DRIESSEN ``AS IS'' AND ANY EXPRESS OR
# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
# MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
# EVENT SHALL VINCENT DRIESSEN OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
# INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
# OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
# NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
# EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#
# The views and conclusions contained in the software and documentation are
# those of the authors and should not be interpreted as representing official
# policies, either expressed or implied, of Vincent Driessen.
#
# set this to workaround expr problems in shFlags on freebsd
if uname -s | egrep -iq 'bsd'; then export EXPR_COMPAT=1; fi
# enable debug mode
if [ "$DEBUG" = "yes" ]; then
set -x
fi
# The sed expression here replaces all backslashes by forward slashes.
# This helps our Windows users, while not bothering our Unix users.
export GITFLOW_DIR=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')")
usage() {
echo "usage: git flow <subcommand>"
echo
echo "Available subcommands are:"
echo " init Initialize a new git repo with support for the branching model."
echo " feature Manage your feature branches."
echo " release Manage your release branches."
echo " hotfix Manage your hotfix branches."
echo " support Manage your support branches."
echo " version Shows version information."
echo
echo "Try 'git flow <subcommand> help' for details."
}
main() {
if [ $# -lt 1 ]; then
usage
exit 1
fi
# load common functionality
. "$GITFLOW_DIR/gitflow-common"
# This environmental variable fixes non-POSIX getopt style argument
# parsing, effectively breaking git-flow subcommand parsing on several
# Linux platforms.
export POSIXLY_CORRECT=1
# use the shFlags project to parse the command line arguments
. "$GITFLOW_DIR/shflags"
FLAGS_PARENT="git flow"
# allow user to request git action logging
DEFINE_boolean show_commands false 'show actions taken (git commands)' g
# do actual parsing
FLAGS "$@" || exit $?
eval set -- "${FLAGS_ARGV}"
# sanity checks
SUBCOMMAND="$1"; shift
if [ ! -e "$GITFLOW_DIR/git-flow-$SUBCOMMAND" ]; then
usage
exit 1
fi
# run command
. "$GITFLOW_DIR/git-flow-$SUBCOMMAND"
FLAGS_PARENT="git flow $SUBCOMMAND"
# test if the first argument is a flag (i.e. starts with '-')
# in that case, we interpret this arg as a flag for the default
# command
SUBACTION="default"
if [ "$1" != "" ] && { ! echo "$1" | grep -q "^-"; } then
SUBACTION="$1"; shift
fi
if ! type "cmd_$SUBACTION" >/dev/null 2>&1; then
warn "Unknown subcommand: '$SUBACTION'"
usage
exit 1
fi
# run the specified action
if [ $SUBACTION != "help" ] && [ $SUBCOMMAND != "init" ] ; then
init
fi
cmd_$SUBACTION "$@"
}
main "$@"

View File

@ -0,0 +1,530 @@
#
# git-flow -- A collection of Git extensions to provide high-level
# repository operations for Vincent Driessen's branching model.
#
# Original blog post presenting this model is found at:
# http://nvie.com/git-model
#
# Feel free to contribute to this project at:
# http://github.com/nvie/gitflow
#
# Copyright 2010 Vincent Driessen. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# 1. Redistributions of source code must retain the above copyright notice,
# this list of conditions and the following disclaimer.
#
# 2. Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
#
# THIS SOFTWARE IS PROVIDED BY VINCENT DRIESSEN ``AS IS'' AND ANY EXPRESS OR
# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
# MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
# EVENT SHALL VINCENT DRIESSEN OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
# INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
# OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
# NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
# EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#
# The views and conclusions contained in the software and documentation are
# those of the authors and should not be interpreted as representing official
# policies, either expressed or implied, of Vincent Driessen.
#
init() {
require_git_repo
require_gitflow_initialized
gitflow_load_settings
PREFIX=$(git config --get gitflow.prefix.feature)
}
usage() {
echo "usage: git flow feature [list] [-v]"
echo " git flow feature start [-F] <name> [<base>]"
echo " git flow feature finish [-rFkDS] [<name|nameprefix>]"
echo " git flow feature publish <name>"
echo " git flow feature track <name>"
echo " git flow feature diff [<name|nameprefix>]"
echo " git flow feature rebase [-i] [<name|nameprefix>]"
echo " git flow feature checkout [<name|nameprefix>]"
echo " git flow feature pull [-r] <remote> [<name>]"
}
cmd_default() {
cmd_list "$@"
}
cmd_list() {
DEFINE_boolean verbose false 'verbose (more) output' v
parse_args "$@"
local feature_branches
local current_branch
local short_names
feature_branches=$(echo "$(git_local_branches)" | grep "^$PREFIX")
if [ -z "$feature_branches" ]; then
warn "No feature branches exist."
warn ""
warn "You can start a new feature branch:"
warn ""
warn " git flow feature start <name> [<base>]"
warn ""
exit 0
fi
current_branch=$(git branch --no-color | grep '^\* ' | grep -v 'no branch' | sed 's/^* //g')
short_names=$(echo "$feature_branches" | sed "s ^$PREFIX g")
# determine column width first
local width=0
local branch
for branch in $short_names; do
local len=${#branch}
width=$(max $width $len)
done
width=$(($width+3))
local branch
for branch in $short_names; do
local fullname=$PREFIX$branch
local base=$(git merge-base "$fullname" "$DEVELOP_BRANCH")
local develop_sha=$(git rev-parse "$DEVELOP_BRANCH")
local branch_sha=$(git rev-parse "$fullname")
if [ "$fullname" = "$current_branch" ]; then
printf "* "
else
printf " "
fi
if flag verbose; then
printf "%-${width}s" "$branch"
if [ "$branch_sha" = "$develop_sha" ]; then
printf "(no commits yet)"
elif [ "$base" = "$branch_sha" ]; then
printf "(is behind develop, may ff)"
elif [ "$base" = "$develop_sha" ]; then
printf "(based on latest develop)"
else
printf "(may be rebased)"
fi
else
printf "%s" "$branch"
fi
echo
done
}
cmd_help() {
usage
exit 0
}
require_name_arg() {
if [ "$NAME" = "" ]; then
warn "Missing argument <name>"
usage
exit 1
fi
}
expand_nameprefix_arg() {
require_name_arg
local expanded_name
local exitcode
expanded_name=$(gitflow_resolve_nameprefix "$NAME" "$PREFIX")
exitcode=$?
case $exitcode in
0) NAME=$expanded_name
BRANCH=$PREFIX$NAME
;;
*) exit 1 ;;
esac
}
use_current_feature_branch_name() {
local current_branch=$(git_current_branch)
if startswith "$current_branch" "$PREFIX"; then
BRANCH=$current_branch
NAME=${BRANCH#$PREFIX}
else
warn "The current HEAD is no feature branch."
warn "Please specify a <name> argument."
exit 1
fi
}
expand_nameprefix_arg_or_current() {
if [ "$NAME" != "" ]; then
expand_nameprefix_arg
require_branch "$PREFIX$NAME"
else
use_current_feature_branch_name
fi
}
name_or_current() {
if [ -z "$NAME" ]; then
use_current_feature_branch_name
fi
}
parse_args() {
# parse options
FLAGS "$@" || exit $?
eval set -- "${FLAGS_ARGV}"
# read arguments into global variables
NAME=$1
BRANCH=$PREFIX$NAME
}
parse_remote_name() {
# parse options
FLAGS "$@" || exit $?
eval set -- "${FLAGS_ARGV}"
# read arguments into global variables
REMOTE=$1
NAME=$2
BRANCH=$PREFIX$NAME
}
cmd_start() {
DEFINE_boolean fetch false 'fetch from origin before performing local operation' F
parse_args "$@"
BASE=${2:-$DEVELOP_BRANCH}
require_name_arg
# sanity checks
require_branch_absent "$BRANCH"
# update the local repo with remote changes, if asked
if flag fetch; then
git_do fetch -q "$ORIGIN" "$DEVELOP_BRANCH"
fi
# if the origin branch counterpart exists, assert that the local branch
# isn't behind it (to avoid unnecessary rebasing)
if git_branch_exists "$ORIGIN/$DEVELOP_BRANCH"; then
require_branches_equal "$DEVELOP_BRANCH" "$ORIGIN/$DEVELOP_BRANCH"
fi
# create branch
if ! git_do checkout -b "$BRANCH" "$BASE"; then
die "Could not create feature branch '$BRANCH'"
fi
echo
echo "Summary of actions:"
echo "- A new branch '$BRANCH' was created, based on '$BASE'"
echo "- You are now on branch '$BRANCH'"
echo ""
echo "Now, start committing on your feature. When done, use:"
echo ""
echo " git flow feature finish $NAME"
echo
}
cmd_finish() {
DEFINE_boolean fetch false "fetch from $ORIGIN before performing finish" F
DEFINE_boolean rebase false "rebase instead of merge" r
DEFINE_boolean keep false "keep branch after performing finish" k
DEFINE_boolean force_delete false "force delete feature branch after finish" D
DEFINE_boolean squash false "squash feature during merge" S
parse_args "$@"
expand_nameprefix_arg_or_current
# sanity checks
require_branch "$BRANCH"
# detect if we're restoring from a merge conflict
if [ -f "$DOT_GIT_DIR/.gitflow/MERGE_BASE" ]; then
#
# TODO: detect that we're working on the correct branch here!
# The user need not necessarily have given the same $NAME twice here
# (although he/she should).
#
# TODO: git_is_clean_working_tree() should provide an alternative
# exit code for "unmerged changes in working tree", which we should
# actually be testing for here
if git_is_clean_working_tree; then
FINISH_BASE=$(cat "$DOT_GIT_DIR/.gitflow/MERGE_BASE")
# Since the working tree is now clean, either the user did a
# succesfull merge manually, or the merge was cancelled.
# We detect this using git_is_branch_merged_into()
if git_is_branch_merged_into "$BRANCH" "$FINISH_BASE"; then
rm -f "$DOT_GIT_DIR/.gitflow/MERGE_BASE"
helper_finish_cleanup
exit 0
else
# If the user cancelled the merge and decided to wait until later,
# that's fine. But we have to acknowledge this by removing the
# MERGE_BASE file and continuing normal execution of the finish
rm -f "$DOT_GIT_DIR/.gitflow/MERGE_BASE"
fi
else
echo
echo "Merge conflicts not resolved yet, use:"
echo " git mergetool"
echo " git commit"
echo
echo "You can then complete the finish by running it again:"
echo " git flow feature finish $NAME"
echo
exit 1
fi
fi
# sanity checks
require_clean_working_tree
# update local repo with remote changes first, if asked
if has "$ORIGIN/$BRANCH" $(git_remote_branches); then
if flag fetch; then
git_do fetch -q "$ORIGIN" "$BRANCH"
git_do fetch -q "$ORIGIN" "$DEVELOP_BRANCH"
fi
fi
if has "$ORIGIN/$BRANCH" $(git_remote_branches); then
require_branches_equal "$BRANCH" "$ORIGIN/$BRANCH"
fi
if has "$ORIGIN/$DEVELOP_BRANCH" $(git_remote_branches); then
require_branches_equal "$DEVELOP_BRANCH" "$ORIGIN/$DEVELOP_BRANCH"
fi
# if the user wants to rebase, do that first
if flag rebase; then
if ! git flow feature rebase "$NAME" "$DEVELOP_BRANCH"; then
warn "Finish was aborted due to conflicts during rebase."
warn "Please finish the rebase manually now."
warn "When finished, re-run:"
warn " git flow feature finish '$NAME' '$DEVELOP_BRANCH'"
exit 1
fi
fi
# merge into BASE
git_do checkout "$DEVELOP_BRANCH"
if [ "$(git rev-list -n2 "$DEVELOP_BRANCH..$BRANCH" | wc -l)" -eq 1 ]; then
git_do merge --ff "$BRANCH"
else
if noflag squash; then
git_do merge --no-ff "$BRANCH"
else
git_do merge --squash "$BRANCH"
git_do commit
git_do merge "$BRANCH"
fi
fi
if [ $? -ne 0 ]; then
# oops.. we have a merge conflict!
# write the given $DEVELOP_BRANCH to a temporary file (we need it later)
mkdir -p "$DOT_GIT_DIR/.gitflow"
echo "$DEVELOP_BRANCH" > "$DOT_GIT_DIR/.gitflow/MERGE_BASE"
echo
echo "There were merge conflicts. To resolve the merge conflict manually, use:"
echo " git mergetool"
echo " git commit"
echo
echo "You can then complete the finish by running it again:"
echo " git flow feature finish $NAME"
echo
exit 1
fi
# when no merge conflict is detected, just clean up the feature branch
helper_finish_cleanup
}
helper_finish_cleanup() {
# sanity checks
require_branch "$BRANCH"
require_clean_working_tree
# delete branch
if flag fetch; then
git_do push "$ORIGIN" ":refs/heads/$BRANCH"
fi
if noflag keep; then
if flag force_delete; then
git_do branch -D "$BRANCH"
else
git_do branch -d "$BRANCH"
fi
fi
echo
echo "Summary of actions:"
echo "- The feature branch '$BRANCH' was merged into '$DEVELOP_BRANCH'"
#echo "- Merge conflicts were resolved" # TODO: Add this line when it's supported
if flag keep; then
echo "- Feature branch '$BRANCH' is still available"
else
echo "- Feature branch '$BRANCH' has been removed"
fi
echo "- You are now on branch '$DEVELOP_BRANCH'"
echo
}
cmd_publish() {
parse_args "$@"
expand_nameprefix_arg
# sanity checks
require_clean_working_tree
require_branch "$BRANCH"
git_do fetch -q "$ORIGIN"
require_branch_absent "$ORIGIN/$BRANCH"
# create remote branch
git_do push "$ORIGIN" "$BRANCH:refs/heads/$BRANCH"
git_do fetch -q "$ORIGIN"
# configure remote tracking
git_do config "branch.$BRANCH.remote" "$ORIGIN"
git_do config "branch.$BRANCH.merge" "refs/heads/$BRANCH"
git_do checkout "$BRANCH"
echo
echo "Summary of actions:"
echo "- A new remote branch '$BRANCH' was created"
echo "- The local branch '$BRANCH' was configured to track the remote branch"
echo "- You are now on branch '$BRANCH'"
echo
}
cmd_track() {
parse_args "$@"
require_name_arg
# sanity checks
require_clean_working_tree
require_branch_absent "$BRANCH"
git_do fetch -q "$ORIGIN"
require_branch "$ORIGIN/$BRANCH"
# create tracking branch
git_do checkout -b "$BRANCH" "$ORIGIN/$BRANCH"
echo
echo "Summary of actions:"
echo "- A new remote tracking branch '$BRANCH' was created"
echo "- You are now on branch '$BRANCH'"
echo
}
cmd_diff() {
parse_args "$@"
if [ "$NAME" != "" ]; then
expand_nameprefix_arg
BASE=$(git merge-base "$DEVELOP_BRANCH" "$BRANCH")
git diff "$BASE..$BRANCH"
else
if ! git_current_branch | grep -q "^$PREFIX"; then
die "Not on a feature branch. Name one explicitly."
fi
BASE=$(git merge-base "$DEVELOP_BRANCH" HEAD)
git diff "$BASE"
fi
}
cmd_checkout() {
parse_args "$@"
if [ "$NAME" != "" ]; then
expand_nameprefix_arg
git_do checkout "$BRANCH"
else
die "Name a feature branch explicitly."
fi
}
cmd_co() {
# Alias for checkout
cmd_checkout "$@"
}
cmd_rebase() {
DEFINE_boolean interactive false 'do an interactive rebase' i
parse_args "$@"
expand_nameprefix_arg_or_current
warn "Will try to rebase '$NAME'..."
require_clean_working_tree
require_branch "$BRANCH"
git_do checkout -q "$BRANCH"
local OPTS=
if flag interactive; then
OPTS="$OPTS -i"
fi
git_do rebase $OPTS "$DEVELOP_BRANCH"
}
avoid_accidental_cross_branch_action() {
local current_branch=$(git_current_branch)
if [ "$BRANCH" != "$current_branch" ]; then
warn "Trying to pull from '$BRANCH' while currently on branch '$current_branch'."
warn "To avoid unintended merges, git-flow aborted."
return 1
fi
return 0
}
cmd_pull() {
#DEFINE_string prefix false 'alternative remote feature branch name prefix' p
DEFINE_boolean rebase false "pull with rebase" r
parse_remote_name "$@"
if [ -z "$REMOTE" ]; then
die "Name a remote explicitly."
fi
name_or_current
# To avoid accidentally merging different feature branches into each other,
# die if the current feature branch differs from the requested $NAME
# argument.
local current_branch=$(git_current_branch)
if startswith "$current_branch" "$PREFIX"; then
# we are on a local feature branch already, so $BRANCH must be equal to
# the current branch
avoid_accidental_cross_branch_action || die
fi
require_clean_working_tree
if git_branch_exists "$BRANCH"; then
# Again, avoid accidental merges
avoid_accidental_cross_branch_action || die
# we already have a local branch called like this, so simply pull the
# remote changes in
if flag rebase; then
if ! git_do pull --rebase -q "$REMOTE" "$BRANCH"; then
warn "Pull was aborted. There might be conflicts during rebase or '$REMOTE' might be inaccessible."
exit 1
fi
else
git_do pull -q "$REMOTE" "$BRANCH" || die "Failed to pull from remote '$REMOTE'."
fi
echo "Pulled $REMOTE's changes into $BRANCH."
else
# setup the local branch clone for the first time
git_do fetch -q "$REMOTE" "$BRANCH" || die "Fetch failed." # stores in FETCH_HEAD
git_do branch --no-track "$BRANCH" FETCH_HEAD || die "Branch failed."
git_do checkout -q "$BRANCH" || die "Checking out new local branch failed."
echo "Created local branch $BRANCH based on $REMOTE's $BRANCH."
fi
}

View File

@ -0,0 +1,349 @@
#
# git-flow -- A collection of Git extensions to provide high-level
# repository operations for Vincent Driessen's branching model.
#
# Original blog post presenting this model is found at:
# http://nvie.com/git-model
#
# Feel free to contribute to this project at:
# http://github.com/nvie/gitflow
#
# Copyright 2010 Vincent Driessen. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# 1. Redistributions of source code must retain the above copyright notice,
# this list of conditions and the following disclaimer.
#
# 2. Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
#
# THIS SOFTWARE IS PROVIDED BY VINCENT DRIESSEN ``AS IS'' AND ANY EXPRESS OR
# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
# MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
# EVENT SHALL VINCENT DRIESSEN OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
# INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
# OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
# NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
# EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#
# The views and conclusions contained in the software and documentation are
# those of the authors and should not be interpreted as representing official
# policies, either expressed or implied, of Vincent Driessen.
#
init() {
require_git_repo
require_gitflow_initialized
gitflow_load_settings
VERSION_PREFIX=$(eval "echo `git config --get gitflow.prefix.versiontag`")
PREFIX=$(git config --get gitflow.prefix.hotfix)
}
usage() {
echo "usage: git flow hotfix [list] [-v]"
echo " git flow hotfix start [-F] <version> [<base>]"
echo " git flow hotfix finish [-Fsumpk] <version>"
echo " git flow hotfix publish <version>"
echo " git flow hotfix track <version>"
}
cmd_default() {
cmd_list "$@"
}
cmd_list() {
DEFINE_boolean verbose false 'verbose (more) output' v
parse_args "$@"
local hotfix_branches
local current_branch
local short_names
hotfix_branches=$(echo "$(git_local_branches)" | grep "^$PREFIX")
if [ -z "$hotfix_branches" ]; then
warn "No hotfix branches exist."
warn ""
warn "You can start a new hotfix branch:"
warn ""
warn " git flow hotfix start <version> [<base>]"
warn ""
exit 0
fi
current_branch=$(git branch --no-color | grep '^\* ' | grep -v 'no branch' | sed 's/^* //g')
short_names=$(echo "$hotfix_branches" | sed "s ^$PREFIX g")
# determine column width first
local width=0
local branch
for branch in $short_names; do
local len=${#branch}
width=$(max $width $len)
done
width=$(($width+3))
local branch
for branch in $short_names; do
local fullname=$PREFIX$branch
local base=$(git merge-base "$fullname" "$MASTER_BRANCH")
local master_sha=$(git rev-parse "$MASTER_BRANCH")
local branch_sha=$(git rev-parse "$fullname")
if [ "$fullname" = "$current_branch" ]; then
printf "* "
else
printf " "
fi
if flag verbose; then
printf "%-${width}s" "$branch"
if [ "$branch_sha" = "$master_sha" ]; then
printf "(no commits yet)"
else
local tagname=$(git name-rev --tags --no-undefined --name-only "$base")
local nicename
if [ "$tagname" != "" ]; then
nicename=$tagname
else
nicename=$(git rev-parse --short "$base")
fi
printf "(based on $nicename)"
fi
else
printf "%s" "$branch"
fi
echo
done
}
cmd_help() {
usage
exit 0
}
parse_args() {
# parse options
FLAGS "$@" || exit $?
eval set -- "${FLAGS_ARGV}"
# read arguments into global variables
VERSION=$1
BRANCH=$PREFIX$VERSION
}
require_version_arg() {
if [ "$VERSION" = "" ]; then
warn "Missing argument <version>"
usage
exit 1
fi
}
require_base_is_on_master() {
if ! git branch --no-color --contains "$BASE" 2>/dev/null \
| sed 's/[* ] //g' \
| grep -q "^$MASTER_BRANCH\$"; then
die "fatal: Given base '$BASE' is not a valid commit on '$MASTER_BRANCH'."
fi
}
require_no_existing_hotfix_branches() {
local hotfix_branches=$(echo "$(git_local_branches)" | grep "^$PREFIX")
local first_branch=$(echo ${hotfix_branches} | head -n1)
first_branch=${first_branch#$PREFIX}
[ -z "$hotfix_branches" ] || \
die "There is an existing hotfix branch ($first_branch). Finish that one first."
}
cmd_start() {
DEFINE_boolean fetch false "fetch from $ORIGIN before performing finish" F
parse_args "$@"
BASE=${2:-$MASTER_BRANCH}
require_version_arg
require_base_is_on_master
require_no_existing_hotfix_branches
# sanity checks
require_clean_working_tree
require_branch_absent "$BRANCH"
require_tag_absent "$VERSION_PREFIX$VERSION"
if flag fetch; then
git_do fetch -q "$ORIGIN" "$MASTER_BRANCH"
fi
if has "$ORIGIN/$MASTER_BRANCH" $(git_remote_branches); then
require_branches_equal "$MASTER_BRANCH" "$ORIGIN/$MASTER_BRANCH"
fi
# create branch
git_do checkout -b "$BRANCH" "$BASE"
echo
echo "Summary of actions:"
echo "- A new branch '$BRANCH' was created, based on '$BASE'"
echo "- You are now on branch '$BRANCH'"
echo
echo "Follow-up actions:"
echo "- Bump the version number now!"
echo "- Start committing your hot fixes"
echo "- When done, run:"
echo
echo " git flow hotfix finish '$VERSION'"
echo
}
cmd_publish() {
parse_args "$@"
require_version_arg
# sanity checks
require_clean_working_tree
require_branch "$BRANCH"
git_do fetch -q "$ORIGIN"
require_branch_absent "$ORIGIN/$BRANCH"
# create remote branch
git_do push "$ORIGIN" "$BRANCH:refs/heads/$BRANCH"
git_do fetch -q "$ORIGIN"
# configure remote tracking
git config "branch.$BRANCH.remote" "$ORIGIN"
git config "branch.$BRANCH.merge" "refs/heads/$BRANCH"
git_do checkout "$BRANCH"
echo
echo "Summary of actions:"
echo "- A new remote branch '$BRANCH' was created"
echo "- The local branch '$BRANCH' was configured to track the remote branch"
echo "- You are now on branch '$BRANCH'"
echo
}
cmd_track() {
parse_args "$@"
require_version_arg
# sanity checks
require_clean_working_tree
require_branch_absent "$BRANCH"
git_do fetch -q "$ORIGIN"
require_branch "$ORIGIN/$BRANCH"
# create tracking branch
git_do checkout -b "$BRANCH" "$ORIGIN/$BRANCH"
echo
echo "Summary of actions:"
echo "- A new remote tracking branch '$BRANCH' was created"
echo "- You are now on branch '$BRANCH'"
echo
}
cmd_finish() {
DEFINE_boolean fetch false "fetch from $ORIGIN before performing finish" F
DEFINE_boolean sign false "sign the release tag cryptographically" s
DEFINE_string signingkey "" "use the given GPG-key for the digital signature (implies -s)" u
DEFINE_string message "" "use the given tag message" m
DEFINE_string messagefile "" "use the contents of the given file as tag message" f
DEFINE_boolean push false "push to $ORIGIN after performing finish" p
DEFINE_boolean keep false "keep branch after performing finish" k
DEFINE_boolean notag false "don't tag this release" n
parse_args "$@"
require_version_arg
# handle flags that imply other flags
if [ "$FLAGS_signingkey" != "" ]; then
FLAGS_sign=$FLAGS_TRUE
fi
# sanity checks
require_branch "$BRANCH"
require_clean_working_tree
if flag fetch; then
git_do fetch -q "$ORIGIN" "$MASTER_BRANCH" || \
die "Could not fetch $MASTER_BRANCH from $ORIGIN."
git_do fetch -q "$ORIGIN" "$DEVELOP_BRANCH" || \
die "Could not fetch $DEVELOP_BRANCH from $ORIGIN."
fi
if has "$ORIGIN/$MASTER_BRANCH" $(git_remote_branches); then
require_branches_equal "$MASTER_BRANCH" "$ORIGIN/$MASTER_BRANCH"
fi
if has "$ORIGIN/$DEVELOP_BRANCH" $(git_remote_branches); then
require_branches_equal "$DEVELOP_BRANCH" "$ORIGIN/$DEVELOP_BRANCH"
fi
# try to merge into master
# in case a previous attempt to finish this release branch has failed,
# but the merge into master was successful, we skip it now
if ! git_is_branch_merged_into "$BRANCH" "$MASTER_BRANCH"; then
git_do checkout "$MASTER_BRANCH" || \
die "Could not check out $MASTER_BRANCH."
git_do merge --no-ff "$BRANCH" || \
die "There were merge conflicts."
# TODO: What do we do now?
fi
if noflag notag; then
# try to tag the release
# in case a previous attempt to finish this release branch has failed,
# but the tag was set successful, we skip it now
local tagname=$VERSION_PREFIX$VERSION
if ! git_tag_exists "$tagname"; then
local opts="-a"
flag sign && opts="$opts -s"
[ "$FLAGS_signingkey" != "" ] && opts="$opts -u '$FLAGS_signingkey'"
[ "$FLAGS_message" != "" ] && opts="$opts -m '$FLAGS_message'"
[ "$FLAGS_messagefile" != "" ] && opts="$opts -F '$FLAGS_messagefile'"
eval git_do tag $opts "$VERSION_PREFIX$VERSION" "$BRANCH" || \
die "Tagging failed. Please run finish again to retry."
fi
fi
# try to merge into develop
# in case a previous attempt to finish this release branch has failed,
# but the merge into develop was successful, we skip it now
if ! git_is_branch_merged_into "$BRANCH" "$DEVELOP_BRANCH"; then
git_do checkout "$DEVELOP_BRANCH" || \
die "Could not check out $DEVELOP_BRANCH."
# TODO: Actually, accounting for 'git describe' pays, so we should
# ideally git merge --no-ff $tagname here, instead!
git_do merge --no-ff "$BRANCH" || \
die "There were merge conflicts."
# TODO: What do we do now?
fi
# delete branch
if noflag keep; then
git_do branch -d "$BRANCH"
fi
if flag push; then
git_do push "$ORIGIN" "$DEVELOP_BRANCH" || \
die "Could not push to $DEVELOP_BRANCH from $ORIGIN."
git_do push "$ORIGIN" "$MASTER_BRANCH" || \
die "Could not push to $MASTER_BRANCH from $ORIGIN."
if noflag notag; then
git_do push --tags "$ORIGIN" || \
die "Could not push tags to $ORIGIN."
fi
fi
echo
echo "Summary of actions:"
echo "- Latest objects have been fetched from '$ORIGIN'"
echo "- Hotfix branch has been merged into '$MASTER_BRANCH'"
if noflag notag; then
echo "- The hotfix was tagged '$VERSION_PREFIX$VERSION'"
fi
echo "- Hotfix branch has been back-merged into '$DEVELOP_BRANCH'"
if flag keep; then
echo "- Hotfix branch '$BRANCH' is still available"
else
echo "- Hotfix branch '$BRANCH' has been deleted"
fi
if flag push; then
echo "- '$DEVELOP_BRANCH', '$MASTER_BRANCH' and tags have been pushed to '$ORIGIN'"
fi
echo
}

View File

@ -0,0 +1,319 @@
#
# git-flow -- A collection of Git extensions to provide high-level
# repository operations for Vincent Driessen's branching model.
#
# Original blog post presenting this model is found at:
# http://nvie.com/git-model
#
# Feel free to contribute to this project at:
# http://github.com/nvie/gitflow
#
# Copyright 2010 Vincent Driessen. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# 1. Redistributions of source code must retain the above copyright notice,
# this list of conditions and the following disclaimer.
#
# 2. Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
#
# THIS SOFTWARE IS PROVIDED BY VINCENT DRIESSEN ``AS IS'' AND ANY EXPRESS OR
# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
# MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
# EVENT SHALL VINCENT DRIESSEN OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
# INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
# OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
# NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
# EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#
# The views and conclusions contained in the software and documentation are
# those of the authors and should not be interpreted as representing official
# policies, either expressed or implied, of Vincent Driessen.
#
usage() {
echo "usage: git flow init [-fd]"
}
parse_args() {
# parse options
FLAGS "$@" || exit $?
eval set -- "${FLAGS_ARGV}"
}
# Default entry when no SUBACTION is given
cmd_default() {
DEFINE_boolean force false 'force setting of gitflow branches, even if already configured' f
DEFINE_boolean defaults false 'use default branch naming conventions' d
parse_args "$@"
if ! git rev-parse --git-dir >/dev/null 2>&1; then
git_do init
else
# assure that we are not working in a repo with local changes
git_repo_is_headless || require_clean_working_tree
fi
# running git flow init on an already initialized repo is fine
if gitflow_is_initialized && ! flag force; then
warn "Already initialized for gitflow."
warn "To force reinitialization, use: git flow init -f"
exit 0
fi
local branch_count
local answer
if flag defaults; then
warn "Using default branch names."
fi
# add a master branch if no such branch exists yet
local master_branch
if gitflow_has_master_configured && ! flag force; then
master_branch=$(git config --get gitflow.branch.master)
else
# Two cases are distinguished:
# 1. A fresh git repo (without any branches)
# We will create a new master/develop branch for the user
# 2. Some branches do already exist
# We will disallow creation of new master/develop branches and
# rather allow to use existing branches for git-flow.
local default_suggestion
local should_check_existence
branch_count=$(git_local_branches | wc -l)
if [ "$branch_count" -eq 0 ]; then
echo "No branches exist yet. Base branches must be created now."
should_check_existence=NO
default_suggestion=$(git config --get gitflow.branch.master || echo master)
else
echo
echo "Which branch should be used for bringing forth production releases?"
git_local_branches | sed 's/^.*$/ - &/g'
should_check_existence=YES
default_suggestion=
for guess in $(git config --get gitflow.branch.master) \
'production' 'main' 'master'; do
if git_local_branch_exists "$guess"; then
default_suggestion="$guess"
break
fi
done
fi
printf "Branch name for production releases: [$default_suggestion] "
if noflag defaults; then
read answer
else
printf "\n"
fi
master_branch=${answer:-$default_suggestion}
# check existence in case of an already existing repo
if [ "$should_check_existence" = "YES" ]; then
# if no local branch exists and a remote branch of the same
# name exists, checkout that branch and use it for master
if ! git_local_branch_exists "$master_branch" && \
git_remote_branch_exists "origin/$master_branch"; then
git_do branch "$master_branch" "origin/$master_branch" >/dev/null 2>&1
elif ! git_local_branch_exists "$master_branch"; then
die "Local branch '$master_branch' does not exist."
fi
fi
# store the name of the master branch
git_do config gitflow.branch.master "$master_branch"
fi
# add a develop branch if no such branch exists yet
local develop_branch
if gitflow_has_develop_configured && ! flag force; then
develop_branch=$(git config --get gitflow.branch.develop)
else
# Again, the same two cases as with the master selection are
# considered (fresh repo or repo that contains branches)
local default_suggestion
local should_check_existence
branch_count=$(git_local_branches | grep -v "^${master_branch}\$" | wc -l)
if [ "$branch_count" -eq 0 ]; then
should_check_existence=NO
default_suggestion=$(git config --get gitflow.branch.develop || echo develop)
else
echo
echo "Which branch should be used for integration of the \"next release\"?"
git_local_branches | grep -v "^${master_branch}\$" | sed 's/^.*$/ - &/g'
should_check_existence=YES
default_suggestion=
for guess in $(git config --get gitflow.branch.develop) \
'develop' 'int' 'integration' 'master'; do
if git_local_branch_exists "$guess" && [ "$guess" != "$master_branch" ]; then
default_suggestion="$guess"
break
fi
done
if [ -z $default_suggestion ]; then
should_check_existence=NO
default_suggestion=$(git config --get gitflow.branch.develop || echo develop)
fi
fi
printf "Branch name for \"next release\" development: [$default_suggestion] "
if noflag defaults; then
read answer
else
printf "\n"
fi
develop_branch=${answer:-$default_suggestion}
if [ "$master_branch" = "$develop_branch" ]; then
die "Production and integration branches should differ."
fi
# check existence in case of an already existing repo
if [ "$should_check_existence" = "YES" ]; then
git_local_branch_exists "$develop_branch" || \
die "Local branch '$develop_branch' does not exist."
fi
# store the name of the develop branch
git_do config gitflow.branch.develop "$develop_branch"
fi
# Creation of HEAD
# ----------------
# We create a HEAD now, if it does not exist yet (in a fresh repo). We need
# it to be able to create new branches.
local created_gitflow_branch=0
if ! git rev-parse --quiet --verify HEAD >/dev/null 2>&1; then
git_do symbolic-ref HEAD "refs/heads/$master_branch"
git_do commit --allow-empty --quiet -m "Initial commit"
created_gitflow_branch=1
fi
# Creation of master
# ------------------
# At this point, there always is a master branch: either it existed already
# (and was picked interactively as the production branch) or it has just
# been created in a fresh repo
# Creation of develop
# -------------------
# The develop branch possibly does not exist yet. This is the case when,
# in a git init'ed repo with one or more commits, master was picked as the
# default production branch and develop was "created". We should create
# the develop branch now in that case (we base it on master, of course)
if ! git_local_branch_exists "$develop_branch"; then
if git_remote_branch_exists "origin/$develop_branch"; then
git_do branch "$develop_branch" "origin/$develop_branch" >/dev/null 2>&1
else
git_do branch --no-track "$develop_branch" "$master_branch"
fi
created_gitflow_branch=1
fi
# assert the gitflow repo has been correctly initialized
gitflow_is_initialized
# switch to develop branch if its newly created
if [ $created_gitflow_branch -eq 1 ]; then
git_do checkout -q "$develop_branch"
fi
# finally, ask the user for naming conventions (branch and tag prefixes)
if flag force || \
! git config --get gitflow.prefix.feature >/dev/null 2>&1 ||
! git config --get gitflow.prefix.release >/dev/null 2>&1 ||
! git config --get gitflow.prefix.hotfix >/dev/null 2>&1 ||
! git config --get gitflow.prefix.support >/dev/null 2>&1 ||
! git config --get gitflow.prefix.versiontag >/dev/null 2>&1; then
echo
echo "How to name your supporting branch prefixes?"
fi
local prefix
# Feature branches
if ! git config --get gitflow.prefix.feature >/dev/null 2>&1 || flag force; then
default_suggestion=$(git config --get gitflow.prefix.feature || echo feature/)
printf "Feature branches? [$default_suggestion] "
if noflag defaults; then
read answer
else
printf "\n"
fi
[ "$answer" = "-" ] && prefix= || prefix=${answer:-$default_suggestion}
git_do config gitflow.prefix.feature "$prefix"
fi
# Release branches
if ! git config --get gitflow.prefix.release >/dev/null 2>&1 || flag force; then
default_suggestion=$(git config --get gitflow.prefix.release || echo release/)
printf "Release branches? [$default_suggestion] "
if noflag defaults; then
read answer
else
printf "\n"
fi
[ "$answer" = "-" ] && prefix= || prefix=${answer:-$default_suggestion}
git_do config gitflow.prefix.release "$prefix"
fi
# Hotfix branches
if ! git config --get gitflow.prefix.hotfix >/dev/null 2>&1 || flag force; then
default_suggestion=$(git config --get gitflow.prefix.hotfix || echo hotfix/)
printf "Hotfix branches? [$default_suggestion] "
if noflag defaults; then
read answer
else
printf "\n"
fi
[ "$answer" = "-" ] && prefix= || prefix=${answer:-$default_suggestion}
git_do config gitflow.prefix.hotfix "$prefix"
fi
# Support branches
if ! git config --get gitflow.prefix.support >/dev/null 2>&1 || flag force; then
default_suggestion=$(git config --get gitflow.prefix.support || echo support/)
printf "Support branches? [$default_suggestion] "
if noflag defaults; then
read answer
else
printf "\n"
fi
[ "$answer" = "-" ] && prefix= || prefix=${answer:-$default_suggestion}
git_do config gitflow.prefix.support "$prefix"
fi
# Version tag prefix
if ! git config --get gitflow.prefix.versiontag >/dev/null 2>&1 || flag force; then
default_suggestion=$(git config --get gitflow.prefix.versiontag || echo "")
printf "Version tag prefix? [$default_suggestion] "
if noflag defaults; then
read answer
else
printf "\n"
fi
[ "$answer" = "-" ] && prefix= || prefix=${answer:-$default_suggestion}
git_do config gitflow.prefix.versiontag "$prefix"
fi
# TODO: what to do with origin?
}
cmd_help() {
usage
exit 0
}

View File

@ -0,0 +1,365 @@
#
# git-flow -- A collection of Git extensions to provide high-level
# repository operations for Vincent Driessen's branching model.
#
# Original blog post presenting this model is found at:
# http://nvie.com/git-model
#
# Feel free to contribute to this project at:
# http://github.com/nvie/gitflow
#
# Copyright 2010 Vincent Driessen. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# 1. Redistributions of source code must retain the above copyright notice,
# this list of conditions and the following disclaimer.
#
# 2. Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
#
# THIS SOFTWARE IS PROVIDED BY VINCENT DRIESSEN ``AS IS'' AND ANY EXPRESS OR
# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
# MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
# EVENT SHALL VINCENT DRIESSEN OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
# INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
# OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
# NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
# EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#
# The views and conclusions contained in the software and documentation are
# those of the authors and should not be interpreted as representing official
# policies, either expressed or implied, of Vincent Driessen.
#
init() {
require_git_repo
require_gitflow_initialized
gitflow_load_settings
VERSION_PREFIX=$(eval "echo `git config --get gitflow.prefix.versiontag`")
PREFIX=$(git config --get gitflow.prefix.release)
}
usage() {
echo "usage: git flow release [list] [-v]"
echo " git flow release start [-F] <version> [<base>]"
echo " git flow release finish [-FsumpkS] <version>"
echo " git flow release publish <name>"
echo " git flow release track <name>"
}
cmd_default() {
cmd_list "$@"
}
cmd_list() {
DEFINE_boolean verbose false 'verbose (more) output' v
parse_args "$@"
local release_branches
local current_branch
local short_names
release_branches=$(echo "$(git_local_branches)" | grep "^$PREFIX")
if [ -z "$release_branches" ]; then
warn "No release branches exist."
warn ""
warn "You can start a new release branch:"
warn ""
warn " git flow release start <name> [<base>]"
warn ""
exit 0
fi
current_branch=$(git branch --no-color | grep '^\* ' | grep -v 'no branch' | sed 's/^* //g')
short_names=$(echo "$release_branches" | sed "s ^$PREFIX g")
# determine column width first
local width=0
local branch
for branch in $short_names; do
local len=${#branch}
width=$(max $width $len)
done
width=$(($width+3))
local branch
for branch in $short_names; do
local fullname=$PREFIX$branch
local base=$(git merge-base "$fullname" "$DEVELOP_BRANCH")
local develop_sha=$(git rev-parse "$DEVELOP_BRANCH")
local branch_sha=$(git rev-parse "$fullname")
if [ "$fullname" = "$current_branch" ]; then
printf "* "
else
printf " "
fi
if flag verbose; then
printf "%-${width}s" "$branch"
if [ "$branch_sha" = "$develop_sha" ]; then
printf "(no commits yet)"
else
local nicename=$(git rev-parse --short "$base")
printf "(based on $nicename)"
fi
else
printf "%s" "$branch"
fi
echo
done
}
cmd_help() {
usage
exit 0
}
parse_args() {
# parse options
FLAGS "$@" || exit $?
eval set -- "${FLAGS_ARGV}"
# read arguments into global variables
VERSION=$1
BRANCH=$PREFIX$VERSION
}
require_version_arg() {
if [ "$VERSION" = "" ]; then
warn "Missing argument <version>"
usage
exit 1
fi
}
require_base_is_on_develop() {
if ! git_do branch --no-color --contains "$BASE" 2>/dev/null \
| sed 's/[* ] //g' \
| grep -q "^$DEVELOP_BRANCH\$"; then
die "fatal: Given base '$BASE' is not a valid commit on '$DEVELOP_BRANCH'."
fi
}
require_no_existing_release_branches() {
local release_branches=$(echo "$(git_local_branches)" | grep "^$PREFIX")
local first_branch=$(echo ${release_branches} | head -n1)
first_branch=${first_branch#$PREFIX}
[ -z "$release_branches" ] || \
die "There is an existing release branch ($first_branch). Finish that one first."
}
cmd_start() {
DEFINE_boolean fetch false "fetch from $ORIGIN before performing finish" F
parse_args "$@"
BASE=${2:-$DEVELOP_BRANCH}
require_version_arg
require_base_is_on_develop
require_no_existing_release_branches
# sanity checks
require_clean_working_tree
require_branch_absent "$BRANCH"
require_tag_absent "$VERSION_PREFIX$VERSION"
if flag fetch; then
git_do fetch -q "$ORIGIN" "$DEVELOP_BRANCH"
fi
if has "$ORIGIN/$DEVELOP_BRANCH" $(git_remote_branches); then
require_branches_equal "$DEVELOP_BRANCH" "$ORIGIN/$DEVELOP_BRANCH"
fi
# create branch
git_do checkout -b "$BRANCH" "$BASE"
echo
echo "Summary of actions:"
echo "- A new branch '$BRANCH' was created, based on '$BASE'"
echo "- You are now on branch '$BRANCH'"
echo
echo "Follow-up actions:"
echo "- Bump the version number now!"
echo "- Start committing last-minute fixes in preparing your release"
echo "- When done, run:"
echo
echo " git flow release finish '$VERSION'"
echo
}
cmd_finish() {
DEFINE_boolean fetch false "fetch from $ORIGIN before performing finish" F
DEFINE_boolean sign false "sign the release tag cryptographically" s
DEFINE_string signingkey "" "use the given GPG-key for the digital signature (implies -s)" u
DEFINE_string message "" "use the given tag message" m
DEFINE_string messagefile "" "use the contents of the given file as a tag message" f
DEFINE_boolean push false "push to $ORIGIN after performing finish" p
DEFINE_boolean keep false "keep branch after performing finish" k
DEFINE_boolean notag false "don't tag this release" n
DEFINE_boolean squash false "squash release during merge" S
parse_args "$@"
require_version_arg
# handle flags that imply other flags
if [ "$FLAGS_signingkey" != "" ]; then
FLAGS_sign=$FLAGS_TRUE
fi
# sanity checks
require_branch "$BRANCH"
require_clean_working_tree
if flag fetch; then
git_do fetch -q "$ORIGIN" "$MASTER_BRANCH" || \
die "Could not fetch $MASTER_BRANCH from $ORIGIN."
git_do fetch -q "$ORIGIN" "$DEVELOP_BRANCH" || \
die "Could not fetch $DEVELOP_BRANCH from $ORIGIN."
fi
if has "$ORIGIN/$MASTER_BRANCH" $(git_remote_branches); then
require_branches_equal "$MASTER_BRANCH" "$ORIGIN/$MASTER_BRANCH"
fi
if has "$ORIGIN/$DEVELOP_BRANCH" $(git_remote_branches); then
require_branches_equal "$DEVELOP_BRANCH" "$ORIGIN/$DEVELOP_BRANCH"
fi
# try to merge into master
# in case a previous attempt to finish this release branch has failed,
# but the merge into master was successful, we skip it now
if ! git_is_branch_merged_into "$BRANCH" "$MASTER_BRANCH"; then
git_do checkout "$MASTER_BRANCH" || \
die "Could not check out $MASTER_BRANCH."
if noflag squash; then
git_do merge --no-ff "$BRANCH" || \
die "There were merge conflicts."
# TODO: What do we do now?
else
git_do merge --squash "$BRANCH" || \
die "There were merge conflicts."
git_do commit
fi
fi
if noflag notag; then
# try to tag the release
# in case a previous attempt to finish this release branch has failed,
# but the tag was set successful, we skip it now
local tagname=$VERSION_PREFIX$VERSION
if ! git_tag_exists "$tagname"; then
local opts="-a"
flag sign && opts="$opts -s"
[ "$FLAGS_signingkey" != "" ] && opts="$opts -u '$FLAGS_signingkey'"
[ "$FLAGS_message" != "" ] && opts="$opts -m '$FLAGS_message'"
[ "$FLAGS_messagefile" != "" ] && opts="$opts -F '$FLAGS_messagefile'"
eval git_do tag $opts "$tagname" "$BRANCH" || \
die "Tagging failed. Please run finish again to retry."
fi
fi
# try to merge into develop
# in case a previous attempt to finish this release branch has failed,
# but the merge into develop was successful, we skip it now
if ! git_is_branch_merged_into "$BRANCH" "$DEVELOP_BRANCH"; then
git_do checkout "$DEVELOP_BRANCH" || \
die "Could not check out $DEVELOP_BRANCH."
# TODO: Actually, accounting for 'git describe' pays, so we should
# ideally git merge --no-ff $tagname here, instead!
if noflag squash; then
git_do merge --no-ff "$BRANCH" || \
die "There were merge conflicts."
# TODO: What do we do now?
else
git_do merge --squash "$BRANCH" || \
die "There were merge conflicts."
# TODO: What do we do now?
git_do commit
fi
fi
# delete branch
if noflag keep; then
if [ "$BRANCH" = "$(git_current_branch)" ]; then
git_do checkout "$MASTER_BRANCH"
fi
git_do branch -d "$BRANCH"
fi
if flag push; then
git_do push "$ORIGIN" "$DEVELOP_BRANCH" || \
die "Could not push to $DEVELOP_BRANCH from $ORIGIN."
git_do push "$ORIGIN" "$MASTER_BRANCH" || \
die "Could not push to $MASTER_BRANCH from $ORIGIN."
if noflag notag; then
git_do push --tags "$ORIGIN" || \
die "Could not push tags to $ORIGIN."
fi
git_do push "$ORIGIN" :"$BRANCH" || \
die "Could not delete the remote $BRANCH in $ORIGIN."
fi
echo
echo "Summary of actions:"
echo "- Latest objects have been fetched from '$ORIGIN'"
echo "- Release branch has been merged into '$MASTER_BRANCH'"
if noflag notag; then
echo "- The release was tagged '$tagname'"
fi
echo "- Release branch has been back-merged into '$DEVELOP_BRANCH'"
if flag keep; then
echo "- Release branch '$BRANCH' is still available"
else
echo "- Release branch '$BRANCH' has been deleted"
fi
if flag push; then
echo "- '$DEVELOP_BRANCH', '$MASTER_BRANCH' and tags have been pushed to '$ORIGIN'"
echo "- Release branch '$BRANCH' in '$ORIGIN' has been deleted."
fi
echo
}
cmd_publish() {
parse_args "$@"
require_version_arg
# sanity checks
require_clean_working_tree
require_branch "$BRANCH"
git_do fetch -q "$ORIGIN"
require_branch_absent "$ORIGIN/$BRANCH"
# create remote branch
git_do push "$ORIGIN" "$BRANCH:refs/heads/$BRANCH"
git_do fetch -q "$ORIGIN"
# configure remote tracking
git_do config "branch.$BRANCH.remote" "$ORIGIN"
git_do config "branch.$BRANCH.merge" "refs/heads/$BRANCH"
git_do checkout "$BRANCH"
echo
echo "Summary of actions:"
echo "- A new remote branch '$BRANCH' was created"
echo "- The local branch '$BRANCH' was configured to track the remote branch"
echo "- You are now on branch '$BRANCH'"
echo
}
cmd_track() {
parse_args "$@"
require_version_arg
# sanity checks
require_clean_working_tree
require_branch_absent "$BRANCH"
git_do fetch -q "$ORIGIN"
require_branch "$ORIGIN/$BRANCH"
# create tracking branch
git_do checkout -b "$BRANCH" "$ORIGIN/$BRANCH"
echo
echo "Summary of actions:"
echo "- A new remote tracking branch '$BRANCH' was created"
echo "- You are now on branch '$BRANCH'"
echo
}

View File

@ -0,0 +1,184 @@
#
# git-flow -- A collection of Git extensions to provide high-level
# repository operations for Vincent Driessen's branching model.
#
# Original blog post presenting this model is found at:
# http://nvie.com/git-model
#
# Feel free to contribute to this project at:
# http://github.com/nvie/gitflow
#
# Copyright 2010 Vincent Driessen. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# 1. Redistributions of source code must retain the above copyright notice,
# this list of conditions and the following disclaimer.
#
# 2. Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
#
# THIS SOFTWARE IS PROVIDED BY VINCENT DRIESSEN ``AS IS'' AND ANY EXPRESS OR
# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
# MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
# EVENT SHALL VINCENT DRIESSEN OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
# INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
# OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
# NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
# EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#
# The views and conclusions contained in the software and documentation are
# those of the authors and should not be interpreted as representing official
# policies, either expressed or implied, of Vincent Driessen.
#
init() {
require_git_repo
require_gitflow_initialized
gitflow_load_settings
VERSION_PREFIX=$(eval "echo `git config --get gitflow.prefix.versiontag`")
PREFIX=$(git config --get gitflow.prefix.support)
}
warn "note: The support subcommand is still very EXPERIMENTAL!"
warn "note: DO NOT use it in a production situation."
usage() {
echo "usage: git flow support [list] [-v]"
echo " git flow support start [-F] <version> <base>"
}
cmd_default() {
cmd_list "$@"
}
cmd_list() {
DEFINE_boolean verbose false 'verbose (more) output' v
parse_args "$@"
local support_branches
local current_branch
local short_names
support_branches=$(echo "$(git_local_branches)" | grep "^$PREFIX")
if [ -z "$support_branches" ]; then
warn "No support branches exist."
warn ""
warn "You can start a new support branch:"
warn ""
warn " git flow support start <name> <base>"
warn ""
exit 0
fi
current_branch=$(git branch --no-color | grep '^\* ' | grep -v 'no branch' | sed 's/^* //g')
short_names=$(echo "$support_branches" | sed "s ^$PREFIX g")
# determine column width first
local width=0
local branch
for branch in $short_names; do
local len=${#branch}
width=$(max $width $len)
done
width=$(($width+3))
local branch
for branch in $short_names; do
local fullname=$PREFIX$branch
local base=$(git merge-base "$fullname" "$MASTER_BRANCH")
local master_sha=$(git rev-parse "$MASTER_BRANCH")
local branch_sha=$(git rev-parse "$fullname")
if [ "$fullname" = "$current_branch" ]; then
printf "* "
else
printf " "
fi
if flag verbose; then
printf "%-${width}s" "$branch"
if [ "$branch_sha" = "$master_sha" ]; then
printf "(no commits yet)"
else
local tagname=$(git name-rev --tags --no-undefined --name-only "$base")
local nicename
if [ "$tagname" != "" ]; then
nicename=$tagname
else
nicename=$(git rev-parse --short "$base")
fi
printf "(based on $nicename)"
fi
else
printf "%s" "$branch"
fi
echo
done
}
cmd_help() {
usage
exit 0
}
parse_args() {
# parse options
FLAGS "$@" || exit $?
eval set -- "${FLAGS_ARGV}"
# read arguments into global variables
VERSION=$1
BASE=$2
BRANCH=$PREFIX$VERSION
}
require_version_arg() {
if [ "$VERSION" = "" ]; then
warn "Missing argument <version>"
usage
exit 1
fi
}
require_base_arg() {
if [ "$BASE" = "" ]; then
warn "Missing argument <base>"
usage
exit 1
fi
}
require_base_is_on_master() {
if ! git branch --no-color --contains "$BASE" 2>/dev/null \
| sed 's/[* ] //g' \
| grep -q "^$MASTER_BRANCH\$"; then
die "fatal: Given base '$BASE' is not a valid commit on '$MASTER_BRANCH'."
fi
}
cmd_start() {
DEFINE_boolean fetch false "fetch from $ORIGIN before performing finish" F
parse_args "$@"
require_version_arg
require_base_arg
require_base_is_on_master
# sanity checks
require_clean_working_tree
# fetch remote changes
if flag fetch; then
git_do fetch -q "$ORIGIN" "$BASE"
fi
require_branch_absent "$BRANCH"
# create branch
git_do checkout -b "$BRANCH" "$BASE"
echo
echo "Summary of actions:"
echo "- A new branch '$BRANCH' was created, based on '$BASE'"
echo "- You are now on branch '$BRANCH'"
echo
}

View File

@ -0,0 +1,52 @@
#
# git-flow -- A collection of Git extensions to provide high-level
# repository operations for Vincent Driessen's branching model.
#
# Original blog post presenting this model is found at:
# http://nvie.com/git-model
#
# Feel free to contribute to this project at:
# http://github.com/nvie/gitflow
#
# Copyright 2010 Vincent Driessen. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# 1. Redistributions of source code must retain the above copyright notice,
# this list of conditions and the following disclaimer.
#
# 2. Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
#
# THIS SOFTWARE IS PROVIDED BY VINCENT DRIESSEN ``AS IS'' AND ANY EXPRESS OR
# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
# MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
# EVENT SHALL VINCENT DRIESSEN OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
# INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
# OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
# NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
# EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#
# The views and conclusions contained in the software and documentation are
# those of the authors and should not be interpreted as representing official
# policies, either expressed or implied, of Vincent Driessen.
#
GITFLOW_VERSION=0.4.2-pre
usage() {
echo "usage: git flow version"
}
cmd_default() {
echo "$GITFLOW_VERSION"
}
cmd_help() {
usage
exit 0
}

View File

@ -0,0 +1,326 @@
#
# git-flow -- A collection of Git extensions to provide high-level
# repository operations for Vincent Driessen's branching model.
#
# Original blog post presenting this model is found at:
# http://nvie.com/git-model
#
# Feel free to contribute to this project at:
# http://github.com/nvie/gitflow
#
# Copyright 2010 Vincent Driessen. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# 1. Redistributions of source code must retain the above copyright notice,
# this list of conditions and the following disclaimer.
#
# 2. Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
#
# THIS SOFTWARE IS PROVIDED BY VINCENT DRIESSEN ``AS IS'' AND ANY EXPRESS OR
# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
# MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
# EVENT SHALL VINCENT DRIESSEN OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
# INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
# OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
# NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
# EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#
# The views and conclusions contained in the software and documentation are
# those of the authors and should not be interpreted as representing official
# policies, either expressed or implied, of Vincent Driessen.
#
#
# Common functionality
#
# shell output
warn() { echo "$@" >&2; }
die() { warn "$@"; exit 1; }
escape() {
echo "$1" | sed 's/\([\.\$\*]\)/\\\1/g'
}
# set logic
has() {
local item=$1; shift
echo " $@ " | grep -q " $(escape $item) "
}
# basic math
min() { [ "$1" -le "$2" ] && echo "$1" || echo "$2"; }
max() { [ "$1" -ge "$2" ] && echo "$1" || echo "$2"; }
# basic string matching
startswith() { [ "$1" != "${1#$2}" ]; }
endswith() { [ "$1" != "${1%$2}" ]; }
# convenience functions for checking shFlags flags
flag() { local FLAG; eval FLAG='$FLAGS_'$1; [ $FLAG -eq $FLAGS_TRUE ]; }
noflag() { local FLAG; eval FLAG='$FLAGS_'$1; [ $FLAG -ne $FLAGS_TRUE ]; }
#
# Git specific common functionality
#
git_do() {
# equivalent to git, used to indicate actions that make modifications
if flag show_commands; then
echo "git $@" >&2
fi
git "$@"
}
git_local_branches() { git branch --no-color | sed 's/^[* ] //'; }
git_remote_branches() { git branch -r --no-color | sed 's/^[* ] //'; }
git_all_branches() { ( git branch --no-color; git branch -r --no-color) | sed 's/^[* ] //'; }
git_all_tags() { git tag; }
git_current_branch() {
git branch --no-color | grep '^\* ' | grep -v 'no branch' | sed 's/^* //g'
}
git_is_clean_working_tree() {
if ! git diff --no-ext-diff --ignore-submodules --quiet --exit-code; then
return 1
elif ! git diff-index --cached --quiet --ignore-submodules HEAD --; then
return 2
else
return 0
fi
}
git_repo_is_headless() {
! git rev-parse --quiet --verify HEAD >/dev/null 2>&1
}
git_local_branch_exists() {
has $1 $(git_local_branches)
}
git_remote_branch_exists() {
has $1 $(git_remote_branches)
}
git_branch_exists() {
has $1 $(git_all_branches)
}
git_tag_exists() {
has $1 $(git_all_tags)
}
#
# git_compare_branches()
#
# Tests whether branches and their "origin" counterparts have diverged and need
# merging first. It returns error codes to provide more detail, like so:
#
# 0 Branch heads point to the same commit
# 1 First given branch needs fast-forwarding
# 2 Second given branch needs fast-forwarding
# 3 Branch needs a real merge
# 4 There is no merge base, i.e. the branches have no common ancestors
#
git_compare_branches() {
local commit1=$(git rev-parse "$1")
local commit2=$(git rev-parse "$2")
if [ "$commit1" != "$commit2" ]; then
local base=$(git merge-base "$commit1" "$commit2")
if [ $? -ne 0 ]; then
return 4
elif [ "$commit1" = "$base" ]; then
return 1
elif [ "$commit2" = "$base" ]; then
return 2
else
return 3
fi
else
return 0
fi
}
#
# git_is_branch_merged_into()
#
# Checks whether branch $1 is succesfully merged into $2
#
git_is_branch_merged_into() {
local subject=$1
local base=$2
local all_merges="$(git branch --no-color --contains $subject | sed 's/^[* ] //')"
has $base $all_merges
}
#
# gitflow specific common functionality
#
# check if this repo has been inited for gitflow
gitflow_has_master_configured() {
local master=$(git config --get gitflow.branch.master)
[ "$master" != "" ] && git_local_branch_exists "$master"
}
gitflow_has_develop_configured() {
local develop=$(git config --get gitflow.branch.develop)
[ "$develop" != "" ] && git_local_branch_exists "$develop"
}
gitflow_has_prefixes_configured() {
git config --get gitflow.prefix.feature >/dev/null 2>&1 && \
git config --get gitflow.prefix.release >/dev/null 2>&1 && \
git config --get gitflow.prefix.hotfix >/dev/null 2>&1 && \
git config --get gitflow.prefix.support >/dev/null 2>&1 && \
git config --get gitflow.prefix.versiontag >/dev/null 2>&1
}
gitflow_is_initialized() {
gitflow_has_master_configured && \
gitflow_has_develop_configured && \
[ "$(git config --get gitflow.branch.master)" != \
"$(git config --get gitflow.branch.develop)" ] && \
gitflow_has_prefixes_configured
}
# loading settings that can be overridden using git config
gitflow_load_settings() {
export DOT_GIT_DIR=$(git rev-parse --git-dir 2>/dev/null)
export MASTER_BRANCH=$(git config --get gitflow.branch.master)
export DEVELOP_BRANCH=$(git config --get gitflow.branch.develop)
export ORIGIN=$(git config --get gitflow.origin || echo origin)
}
#
# gitflow_resolve_nameprefix
#
# Inputs:
# $1 = name prefix to resolve
# $2 = branch prefix to use
#
# Searches branch names from git_local_branches() to look for a unique
# branch name whose name starts with the given name prefix.
#
# There are multiple exit codes possible:
# 0: The unambiguous full name of the branch is written to stdout
# (success)
# 1: No match is found.
# 2: Multiple matches found. These matches are written to stderr
#
gitflow_resolve_nameprefix() {
local name=$1
local prefix=$2
local matches
local num_matches
# first, check if there is a perfect match
if git_local_branch_exists "$prefix$name"; then
echo "$name"
return 0
fi
matches=$(echo "$(git_local_branches)" | grep "^$(escape "$prefix$name")")
num_matches=$(echo "$matches" | wc -l)
if [ -z "$matches" ]; then
# no prefix match, so take it literally
warn "No branch matches prefix '$name'"
return 1
else
if [ $num_matches -eq 1 ]; then
echo "${matches#$prefix}"
return 0
else
# multiple matches, cannot decide
warn "Multiple branches match prefix '$name':"
for match in $matches; do
warn "- $match"
done
return 2
fi
fi
}
#
# Assertions for use in git-flow subcommands
#
require_git_repo() {
if ! git rev-parse --git-dir >/dev/null 2>&1; then
die "fatal: Not a git repository"
fi
}
require_gitflow_initialized() {
if ! gitflow_is_initialized; then
die "fatal: Not a gitflow-enabled repo yet. Please run \"git flow init\" first."
fi
}
require_clean_working_tree() {
git_is_clean_working_tree
local result=$?
if [ $result -eq 1 ]; then
die "fatal: Working tree contains unstaged changes. Aborting."
fi
if [ $result -eq 2 ]; then
die "fatal: Index contains uncommited changes. Aborting."
fi
}
require_local_branch() {
if ! git_local_branch_exists $1; then
die "fatal: Local branch '$1' does not exist and is required."
fi
}
require_remote_branch() {
if ! has $1 $(git_remote_branches); then
die "Remote branch '$1' does not exist and is required."
fi
}
require_branch() {
if ! has $1 $(git_all_branches); then
die "Branch '$1' does not exist and is required."
fi
}
require_branch_absent() {
if has $1 $(git_all_branches); then
die "Branch '$1' already exists. Pick another name."
fi
}
require_tag_absent() {
for tag in $(git_all_tags); do
if [ "$1" = "$tag" ]; then
die "Tag '$1' already exists. Pick another name."
fi
done
}
require_branches_equal() {
require_local_branch "$1"
require_remote_branch "$2"
git_compare_branches "$1" "$2"
local status=$?
if [ $status -gt 0 ]; then
warn "Branches '$1' and '$2' have diverged."
if [ $status -eq 1 ]; then
die "And branch '$1' may be fast-forwarded."
elif [ $status -eq 2 ]; then
# Warn here, since there is no harm in being ahead
warn "And local branch '$1' is ahead of '$2'."
else
die "Branches need merging first."
fi
fi
}

View File

@ -0,0 +1,80 @@
#! /bin/sh
prefix=/usr/local
exec_prefix=/usr/local
includedir=/usr/local/include
usage()
{
cat <<EOF
Usage: gsl-config [OPTION]
Known values for OPTION are:
--prefix show GSL installation prefix
--libs print library linking information, with cblas
--libs-without-cblas print library linking information, without cblas
--cflags print pre-processor and compiler flags
--help display this help and exit
--version output version information
An external CBLAS library can be specified using the GSL_CBLAS_LIB
environment variable. The GSL CBLAS library is used by default.
EOF
exit $1
}
if test $# -eq 0; then
usage 1
fi
cflags=false
libs=false
while test $# -gt 0; do
case "$1" in
-*=*) optarg=`echo "$1" | sed 's/[-_a-zA-Z0-9]*=//'` ;;
*) optarg= ;;
esac
case "$1" in
--prefix=*)
prefix=$optarg
;;
--prefix)
echo $prefix
;;
--version)
echo 2.7
exit 0
;;
--help)
usage 0
;;
--cflags)
echo -I/usr/local/include
;;
--libs)
: ${GSL_CBLAS_LIB=-lgslcblas}
echo -L/usr/local/lib -lgsl $GSL_CBLAS_LIB -lm
;;
--libs-without-cblas)
echo -L/usr/local/lib -lgsl -lm
;;
*)
usage
exit 1
;;
esac
shift
done
exit 0

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,602 @@
/* blas/gsl_blas.h
*
* Copyright (C) 1996, 1997, 1998, 1999, 2000 Gerard Jungman
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or (at
* your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
/*
* Author: G. Jungman
*/
#ifndef __GSL_BLAS_H__
#define __GSL_BLAS_H__
#include <gsl/gsl_vector.h>
#include <gsl/gsl_matrix.h>
#include <gsl/gsl_blas_types.h>
#undef __BEGIN_DECLS
#undef __END_DECLS
#ifdef __cplusplus
# define __BEGIN_DECLS extern "C" {
# define __END_DECLS }
#else
# define __BEGIN_DECLS /* empty */
# define __END_DECLS /* empty */
#endif
__BEGIN_DECLS
/* ========================================================================
* Level 1
* ========================================================================
*/
int gsl_blas_sdsdot (float alpha,
const gsl_vector_float * X,
const gsl_vector_float * Y,
float * result
);
int gsl_blas_dsdot (const gsl_vector_float * X,
const gsl_vector_float * Y,
double * result
);
int gsl_blas_sdot (const gsl_vector_float * X,
const gsl_vector_float * Y,
float * result
);
int gsl_blas_ddot (const gsl_vector * X,
const gsl_vector * Y,
double * result
);
int gsl_blas_cdotu (const gsl_vector_complex_float * X,
const gsl_vector_complex_float * Y,
gsl_complex_float * dotu);
int gsl_blas_cdotc (const gsl_vector_complex_float * X,
const gsl_vector_complex_float * Y,
gsl_complex_float * dotc);
int gsl_blas_zdotu (const gsl_vector_complex * X,
const gsl_vector_complex * Y,
gsl_complex * dotu);
int gsl_blas_zdotc (const gsl_vector_complex * X,
const gsl_vector_complex * Y,
gsl_complex * dotc);
float gsl_blas_snrm2 (const gsl_vector_float * X);
float gsl_blas_sasum (const gsl_vector_float * X);
double gsl_blas_dnrm2 (const gsl_vector * X);
double gsl_blas_dasum (const gsl_vector * X);
float gsl_blas_scnrm2 (const gsl_vector_complex_float * X);
float gsl_blas_scasum (const gsl_vector_complex_float * X);
double gsl_blas_dznrm2 (const gsl_vector_complex * X);
double gsl_blas_dzasum (const gsl_vector_complex * X);
CBLAS_INDEX_t gsl_blas_isamax (const gsl_vector_float * X);
CBLAS_INDEX_t gsl_blas_idamax (const gsl_vector * X);
CBLAS_INDEX_t gsl_blas_icamax (const gsl_vector_complex_float * X);
CBLAS_INDEX_t gsl_blas_izamax (const gsl_vector_complex * X);
int gsl_blas_sswap (gsl_vector_float * X,
gsl_vector_float * Y);
int gsl_blas_scopy (const gsl_vector_float * X,
gsl_vector_float * Y);
int gsl_blas_saxpy (float alpha,
const gsl_vector_float * X,
gsl_vector_float * Y);
int gsl_blas_dswap (gsl_vector * X,
gsl_vector * Y);
int gsl_blas_dcopy (const gsl_vector * X,
gsl_vector * Y);
int gsl_blas_daxpy (double alpha,
const gsl_vector * X,
gsl_vector * Y);
int gsl_blas_cswap (gsl_vector_complex_float * X,
gsl_vector_complex_float * Y);
int gsl_blas_ccopy (const gsl_vector_complex_float * X,
gsl_vector_complex_float * Y);
int gsl_blas_caxpy (const gsl_complex_float alpha,
const gsl_vector_complex_float * X,
gsl_vector_complex_float * Y);
int gsl_blas_zswap (gsl_vector_complex * X,
gsl_vector_complex * Y);
int gsl_blas_zcopy (const gsl_vector_complex * X,
gsl_vector_complex * Y);
int gsl_blas_zaxpy (const gsl_complex alpha,
const gsl_vector_complex * X,
gsl_vector_complex * Y);
int gsl_blas_srotg (float a[], float b[], float c[], float s[]);
int gsl_blas_srotmg (float d1[], float d2[], float b1[], float b2, float P[]);
int gsl_blas_srot (gsl_vector_float * X,
gsl_vector_float * Y,
float c, float s);
int gsl_blas_srotm (gsl_vector_float * X,
gsl_vector_float * Y,
const float P[]);
int gsl_blas_drotg (double a[], double b[], double c[], double s[]);
int gsl_blas_drotmg (double d1[], double d2[], double b1[],
double b2, double P[]);
int gsl_blas_drot (gsl_vector * X,
gsl_vector * Y,
const double c, const double s);
int gsl_blas_drotm (gsl_vector * X,
gsl_vector * Y,
const double P[]);
void gsl_blas_sscal (float alpha, gsl_vector_float * X);
void gsl_blas_dscal (double alpha, gsl_vector * X);
void gsl_blas_cscal (const gsl_complex_float alpha, gsl_vector_complex_float * X);
void gsl_blas_zscal (const gsl_complex alpha, gsl_vector_complex * X);
void gsl_blas_csscal (float alpha, gsl_vector_complex_float * X);
void gsl_blas_zdscal (double alpha, gsl_vector_complex * X);
/* ===========================================================================
* Level 2
* ===========================================================================
*/
/*
* Routines with standard 4 prefixes (S, D, C, Z)
*/
int gsl_blas_sgemv (CBLAS_TRANSPOSE_t TransA,
float alpha,
const gsl_matrix_float * A,
const gsl_vector_float * X,
float beta,
gsl_vector_float * Y);
int gsl_blas_strmv (CBLAS_UPLO_t Uplo,
CBLAS_TRANSPOSE_t TransA, CBLAS_DIAG_t Diag,
const gsl_matrix_float * A,
gsl_vector_float * X);
int gsl_blas_strsv (CBLAS_UPLO_t Uplo,
CBLAS_TRANSPOSE_t TransA, CBLAS_DIAG_t Diag,
const gsl_matrix_float * A,
gsl_vector_float * X);
int gsl_blas_dgemv (CBLAS_TRANSPOSE_t TransA,
double alpha,
const gsl_matrix * A,
const gsl_vector * X,
double beta,
gsl_vector * Y);
int gsl_blas_dtrmv (CBLAS_UPLO_t Uplo,
CBLAS_TRANSPOSE_t TransA, CBLAS_DIAG_t Diag,
const gsl_matrix * A,
gsl_vector * X);
int gsl_blas_dtrsv (CBLAS_UPLO_t Uplo,
CBLAS_TRANSPOSE_t TransA, CBLAS_DIAG_t Diag,
const gsl_matrix * A,
gsl_vector * X);
int gsl_blas_cgemv (CBLAS_TRANSPOSE_t TransA,
const gsl_complex_float alpha,
const gsl_matrix_complex_float * A,
const gsl_vector_complex_float * X,
const gsl_complex_float beta,
gsl_vector_complex_float * Y);
int gsl_blas_ctrmv (CBLAS_UPLO_t Uplo,
CBLAS_TRANSPOSE_t TransA, CBLAS_DIAG_t Diag,
const gsl_matrix_complex_float * A,
gsl_vector_complex_float * X);
int gsl_blas_ctrsv (CBLAS_UPLO_t Uplo,
CBLAS_TRANSPOSE_t TransA, CBLAS_DIAG_t Diag,
const gsl_matrix_complex_float * A,
gsl_vector_complex_float * X);
int gsl_blas_zgemv (CBLAS_TRANSPOSE_t TransA,
const gsl_complex alpha,
const gsl_matrix_complex * A,
const gsl_vector_complex * X,
const gsl_complex beta,
gsl_vector_complex * Y);
int gsl_blas_ztrmv (CBLAS_UPLO_t Uplo,
CBLAS_TRANSPOSE_t TransA, CBLAS_DIAG_t Diag,
const gsl_matrix_complex * A,
gsl_vector_complex * X);
int gsl_blas_ztrsv (CBLAS_UPLO_t Uplo,
CBLAS_TRANSPOSE_t TransA, CBLAS_DIAG_t Diag,
const gsl_matrix_complex * A,
gsl_vector_complex *X);
/*
* Routines with S and D prefixes only
*/
int gsl_blas_ssymv (CBLAS_UPLO_t Uplo,
float alpha,
const gsl_matrix_float * A,
const gsl_vector_float * X,
float beta,
gsl_vector_float * Y);
int gsl_blas_sger (float alpha,
const gsl_vector_float * X,
const gsl_vector_float * Y,
gsl_matrix_float * A);
int gsl_blas_ssyr (CBLAS_UPLO_t Uplo,
float alpha,
const gsl_vector_float * X,
gsl_matrix_float * A);
int gsl_blas_ssyr2 (CBLAS_UPLO_t Uplo,
float alpha,
const gsl_vector_float * X,
const gsl_vector_float * Y,
gsl_matrix_float * A);
int gsl_blas_dsymv (CBLAS_UPLO_t Uplo,
double alpha,
const gsl_matrix * A,
const gsl_vector * X,
double beta,
gsl_vector * Y);
int gsl_blas_dger (double alpha,
const gsl_vector * X,
const gsl_vector * Y,
gsl_matrix * A);
int gsl_blas_dsyr (CBLAS_UPLO_t Uplo,
double alpha,
const gsl_vector * X,
gsl_matrix * A);
int gsl_blas_dsyr2 (CBLAS_UPLO_t Uplo,
double alpha,
const gsl_vector * X,
const gsl_vector * Y,
gsl_matrix * A);
/*
* Routines with C and Z prefixes only
*/
int gsl_blas_chemv (CBLAS_UPLO_t Uplo,
const gsl_complex_float alpha,
const gsl_matrix_complex_float * A,
const gsl_vector_complex_float * X,
const gsl_complex_float beta,
gsl_vector_complex_float * Y);
int gsl_blas_cgeru (const gsl_complex_float alpha,
const gsl_vector_complex_float * X,
const gsl_vector_complex_float * Y,
gsl_matrix_complex_float * A);
int gsl_blas_cgerc (const gsl_complex_float alpha,
const gsl_vector_complex_float * X,
const gsl_vector_complex_float * Y,
gsl_matrix_complex_float * A);
int gsl_blas_cher (CBLAS_UPLO_t Uplo,
float alpha,
const gsl_vector_complex_float * X,
gsl_matrix_complex_float * A);
int gsl_blas_cher2 (CBLAS_UPLO_t Uplo,
const gsl_complex_float alpha,
const gsl_vector_complex_float * X,
const gsl_vector_complex_float * Y,
gsl_matrix_complex_float * A);
int gsl_blas_zhemv (CBLAS_UPLO_t Uplo,
const gsl_complex alpha,
const gsl_matrix_complex * A,
const gsl_vector_complex * X,
const gsl_complex beta,
gsl_vector_complex * Y);
int gsl_blas_zgeru (const gsl_complex alpha,
const gsl_vector_complex * X,
const gsl_vector_complex * Y,
gsl_matrix_complex * A);
int gsl_blas_zgerc (const gsl_complex alpha,
const gsl_vector_complex * X,
const gsl_vector_complex * Y,
gsl_matrix_complex * A);
int gsl_blas_zher (CBLAS_UPLO_t Uplo,
double alpha,
const gsl_vector_complex * X,
gsl_matrix_complex * A);
int gsl_blas_zher2 (CBLAS_UPLO_t Uplo,
const gsl_complex alpha,
const gsl_vector_complex * X,
const gsl_vector_complex * Y,
gsl_matrix_complex * A);
/*
* ===========================================================================
* Prototypes for level 3 BLAS
* ===========================================================================
*/
/*
* Routines with standard 4 prefixes (S, D, C, Z)
*/
int gsl_blas_sgemm (CBLAS_TRANSPOSE_t TransA,
CBLAS_TRANSPOSE_t TransB,
float alpha,
const gsl_matrix_float * A,
const gsl_matrix_float * B,
float beta,
gsl_matrix_float * C);
int gsl_blas_ssymm (CBLAS_SIDE_t Side, CBLAS_UPLO_t Uplo,
float alpha,
const gsl_matrix_float * A,
const gsl_matrix_float * B,
float beta,
gsl_matrix_float * C);
int gsl_blas_ssyrk (CBLAS_UPLO_t Uplo, CBLAS_TRANSPOSE_t Trans,
float alpha,
const gsl_matrix_float * A,
float beta,
gsl_matrix_float * C);
int gsl_blas_ssyr2k (CBLAS_UPLO_t Uplo, CBLAS_TRANSPOSE_t Trans,
float alpha,
const gsl_matrix_float * A,
const gsl_matrix_float * B,
float beta,
gsl_matrix_float * C);
int gsl_blas_strmm (CBLAS_SIDE_t Side,
CBLAS_UPLO_t Uplo, CBLAS_TRANSPOSE_t TransA,
CBLAS_DIAG_t Diag,
float alpha,
const gsl_matrix_float * A,
gsl_matrix_float * B);
int gsl_blas_strsm (CBLAS_SIDE_t Side,
CBLAS_UPLO_t Uplo, CBLAS_TRANSPOSE_t TransA,
CBLAS_DIAG_t Diag,
float alpha,
const gsl_matrix_float * A,
gsl_matrix_float * B);
int gsl_blas_dgemm (CBLAS_TRANSPOSE_t TransA,
CBLAS_TRANSPOSE_t TransB,
double alpha,
const gsl_matrix * A,
const gsl_matrix * B,
double beta,
gsl_matrix * C);
int gsl_blas_dsymm (CBLAS_SIDE_t Side,
CBLAS_UPLO_t Uplo,
double alpha,
const gsl_matrix * A,
const gsl_matrix * B,
double beta,
gsl_matrix * C);
int gsl_blas_dsyrk (CBLAS_UPLO_t Uplo,
CBLAS_TRANSPOSE_t Trans,
double alpha,
const gsl_matrix * A,
double beta,
gsl_matrix * C);
int gsl_blas_dsyr2k (CBLAS_UPLO_t Uplo,
CBLAS_TRANSPOSE_t Trans,
double alpha,
const gsl_matrix * A,
const gsl_matrix * B,
double beta,
gsl_matrix * C);
int gsl_blas_dtrmm (CBLAS_SIDE_t Side,
CBLAS_UPLO_t Uplo, CBLAS_TRANSPOSE_t TransA,
CBLAS_DIAG_t Diag,
double alpha,
const gsl_matrix * A,
gsl_matrix * B);
int gsl_blas_dtrsm (CBLAS_SIDE_t Side,
CBLAS_UPLO_t Uplo, CBLAS_TRANSPOSE_t TransA,
CBLAS_DIAG_t Diag,
double alpha,
const gsl_matrix * A,
gsl_matrix * B);
int gsl_blas_cgemm (CBLAS_TRANSPOSE_t TransA,
CBLAS_TRANSPOSE_t TransB,
const gsl_complex_float alpha,
const gsl_matrix_complex_float * A,
const gsl_matrix_complex_float * B,
const gsl_complex_float beta,
gsl_matrix_complex_float * C);
int gsl_blas_csymm (CBLAS_SIDE_t Side,
CBLAS_UPLO_t Uplo,
const gsl_complex_float alpha,
const gsl_matrix_complex_float * A,
const gsl_matrix_complex_float * B,
const gsl_complex_float beta,
gsl_matrix_complex_float * C);
int gsl_blas_csyrk (CBLAS_UPLO_t Uplo,
CBLAS_TRANSPOSE_t Trans,
const gsl_complex_float alpha,
const gsl_matrix_complex_float * A,
const gsl_complex_float beta,
gsl_matrix_complex_float * C);
int gsl_blas_csyr2k (CBLAS_UPLO_t Uplo,
CBLAS_TRANSPOSE_t Trans,
const gsl_complex_float alpha,
const gsl_matrix_complex_float * A,
const gsl_matrix_complex_float * B,
const gsl_complex_float beta,
gsl_matrix_complex_float * C);
int gsl_blas_ctrmm (CBLAS_SIDE_t Side,
CBLAS_UPLO_t Uplo, CBLAS_TRANSPOSE_t TransA,
CBLAS_DIAG_t Diag,
const gsl_complex_float alpha,
const gsl_matrix_complex_float * A,
gsl_matrix_complex_float * B);
int gsl_blas_ctrsm (CBLAS_SIDE_t Side,
CBLAS_UPLO_t Uplo, CBLAS_TRANSPOSE_t TransA,
CBLAS_DIAG_t Diag,
const gsl_complex_float alpha,
const gsl_matrix_complex_float * A,
gsl_matrix_complex_float * B);
int gsl_blas_zgemm (CBLAS_TRANSPOSE_t TransA,
CBLAS_TRANSPOSE_t TransB,
const gsl_complex alpha,
const gsl_matrix_complex * A,
const gsl_matrix_complex * B,
const gsl_complex beta,
gsl_matrix_complex * C);
int gsl_blas_zsymm (CBLAS_SIDE_t Side,
CBLAS_UPLO_t Uplo,
const gsl_complex alpha,
const gsl_matrix_complex * A,
const gsl_matrix_complex * B,
const gsl_complex beta,
gsl_matrix_complex * C);
int gsl_blas_zsyrk (CBLAS_UPLO_t Uplo,
CBLAS_TRANSPOSE_t Trans,
const gsl_complex alpha,
const gsl_matrix_complex * A,
const gsl_complex beta,
gsl_matrix_complex * C);
int gsl_blas_zsyr2k (CBLAS_UPLO_t Uplo,
CBLAS_TRANSPOSE_t Trans,
const gsl_complex alpha,
const gsl_matrix_complex * A,
const gsl_matrix_complex * B,
const gsl_complex beta,
gsl_matrix_complex *C);
int gsl_blas_ztrmm (CBLAS_SIDE_t Side,
CBLAS_UPLO_t Uplo, CBLAS_TRANSPOSE_t TransA,
CBLAS_DIAG_t Diag,
const gsl_complex alpha,
const gsl_matrix_complex * A,
gsl_matrix_complex * B);
int gsl_blas_ztrsm (CBLAS_SIDE_t Side,
CBLAS_UPLO_t Uplo, CBLAS_TRANSPOSE_t TransA,
CBLAS_DIAG_t Diag,
const gsl_complex alpha,
const gsl_matrix_complex * A,
gsl_matrix_complex * B);
/*
* Routines with prefixes C and Z only
*/
int gsl_blas_chemm (CBLAS_SIDE_t Side,
CBLAS_UPLO_t Uplo,
const gsl_complex_float alpha,
const gsl_matrix_complex_float * A,
const gsl_matrix_complex_float * B,
const gsl_complex_float beta,
gsl_matrix_complex_float * C);
int gsl_blas_cherk (CBLAS_UPLO_t Uplo,
CBLAS_TRANSPOSE_t Trans,
float alpha,
const gsl_matrix_complex_float * A,
float beta,
gsl_matrix_complex_float * C);
int gsl_blas_cher2k (CBLAS_UPLO_t Uplo,
CBLAS_TRANSPOSE_t Trans,
const gsl_complex_float alpha,
const gsl_matrix_complex_float * A,
const gsl_matrix_complex_float * B,
float beta,
gsl_matrix_complex_float * C);
int gsl_blas_zhemm (CBLAS_SIDE_t Side,
CBLAS_UPLO_t Uplo,
const gsl_complex alpha,
const gsl_matrix_complex * A,
const gsl_matrix_complex * B,
const gsl_complex beta,
gsl_matrix_complex * C);
int gsl_blas_zherk (CBLAS_UPLO_t Uplo,
CBLAS_TRANSPOSE_t Trans,
double alpha,
const gsl_matrix_complex * A,
double beta,
gsl_matrix_complex * C);
int gsl_blas_zher2k (CBLAS_UPLO_t Uplo,
CBLAS_TRANSPOSE_t Trans,
const gsl_complex alpha,
const gsl_matrix_complex * A,
const gsl_matrix_complex * B,
double beta,
gsl_matrix_complex * C);
__END_DECLS
#endif /* __GSL_BLAS_H__ */

View File

@ -0,0 +1,54 @@
/* blas/gsl_blas_types.h
*
* Copyright (C) 1996, 1997, 1998, 1999, 2000 Gerard Jungman
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or (at
* your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
/*
* Author: G. Jungman
*/
/* Based on draft BLAST C interface specification [Jul 7 1998]
*/
#ifndef __GSL_BLAS_TYPES_H__
#define __GSL_BLAS_TYPES_H__
#include <gsl/gsl_cblas.h>
#undef __BEGIN_DECLS
#undef __END_DECLS
#ifdef __cplusplus
# define __BEGIN_DECLS extern "C" {
# define __END_DECLS }
#else
# define __BEGIN_DECLS /* empty */
# define __END_DECLS /* empty */
#endif
__BEGIN_DECLS
typedef CBLAS_INDEX CBLAS_INDEX_t;
typedef enum CBLAS_ORDER CBLAS_ORDER_t;
typedef enum CBLAS_TRANSPOSE CBLAS_TRANSPOSE_t;
typedef enum CBLAS_UPLO CBLAS_UPLO_t;
typedef enum CBLAS_DIAG CBLAS_DIAG_t;
typedef enum CBLAS_SIDE CBLAS_SIDE_t;
/* typedef gsl_complex COMPLEX; */
__END_DECLS
#endif /* __GSL_BLAS_TYPES_H__ */

View File

@ -0,0 +1,24 @@
#ifndef __GSL_BLOCK_H__
#define __GSL_BLOCK_H__
#include <gsl/gsl_block_complex_long_double.h>
#include <gsl/gsl_block_complex_double.h>
#include <gsl/gsl_block_complex_float.h>
#include <gsl/gsl_block_long_double.h>
#include <gsl/gsl_block_double.h>
#include <gsl/gsl_block_float.h>
#include <gsl/gsl_block_ulong.h>
#include <gsl/gsl_block_long.h>
#include <gsl/gsl_block_uint.h>
#include <gsl/gsl_block_int.h>
#include <gsl/gsl_block_ushort.h>
#include <gsl/gsl_block_short.h>
#include <gsl/gsl_block_uchar.h>
#include <gsl/gsl_block_char.h>
#endif /* __GSL_BLOCK_H__ */

View File

@ -0,0 +1,65 @@
/* block/gsl_block_char.h
*
* Copyright (C) 1996, 1997, 1998, 1999, 2000, 2007 Gerard Jungman, Brian Gough
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or (at
* your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef __GSL_BLOCK_CHAR_H__
#define __GSL_BLOCK_CHAR_H__
#include <stdlib.h>
#include <gsl/gsl_errno.h>
#undef __BEGIN_DECLS
#undef __END_DECLS
#ifdef __cplusplus
# define __BEGIN_DECLS extern "C" {
# define __END_DECLS }
#else
# define __BEGIN_DECLS /* empty */
# define __END_DECLS /* empty */
#endif
__BEGIN_DECLS
struct gsl_block_char_struct
{
size_t size;
char *data;
};
typedef struct gsl_block_char_struct gsl_block_char;
gsl_block_char *gsl_block_char_alloc (const size_t n);
gsl_block_char *gsl_block_char_calloc (const size_t n);
void gsl_block_char_free (gsl_block_char * b);
int gsl_block_char_fread (FILE * stream, gsl_block_char * b);
int gsl_block_char_fwrite (FILE * stream, const gsl_block_char * b);
int gsl_block_char_fscanf (FILE * stream, gsl_block_char * b);
int gsl_block_char_fprintf (FILE * stream, const gsl_block_char * b, const char *format);
int gsl_block_char_raw_fread (FILE * stream, char * b, const size_t n, const size_t stride);
int gsl_block_char_raw_fwrite (FILE * stream, const char * b, const size_t n, const size_t stride);
int gsl_block_char_raw_fscanf (FILE * stream, char * b, const size_t n, const size_t stride);
int gsl_block_char_raw_fprintf (FILE * stream, const char * b, const size_t n, const size_t stride, const char *format);
size_t gsl_block_char_size (const gsl_block_char * b);
char * gsl_block_char_data (const gsl_block_char * b);
__END_DECLS
#endif /* __GSL_BLOCK_CHAR_H__ */

View File

@ -0,0 +1,65 @@
/* block/gsl_block_complex_double.h
*
* Copyright (C) 1996, 1997, 1998, 1999, 2000, 2007 Gerard Jungman, Brian Gough
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or (at
* your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef __GSL_BLOCK_COMPLEX_DOUBLE_H__
#define __GSL_BLOCK_COMPLEX_DOUBLE_H__
#include <stdlib.h>
#include <gsl/gsl_errno.h>
#undef __BEGIN_DECLS
#undef __END_DECLS
#ifdef __cplusplus
# define __BEGIN_DECLS extern "C" {
# define __END_DECLS }
#else
# define __BEGIN_DECLS /* empty */
# define __END_DECLS /* empty */
#endif
__BEGIN_DECLS
struct gsl_block_complex_struct
{
size_t size;
double *data;
};
typedef struct gsl_block_complex_struct gsl_block_complex;
gsl_block_complex *gsl_block_complex_alloc (const size_t n);
gsl_block_complex *gsl_block_complex_calloc (const size_t n);
void gsl_block_complex_free (gsl_block_complex * b);
int gsl_block_complex_fread (FILE * stream, gsl_block_complex * b);
int gsl_block_complex_fwrite (FILE * stream, const gsl_block_complex * b);
int gsl_block_complex_fscanf (FILE * stream, gsl_block_complex * b);
int gsl_block_complex_fprintf (FILE * stream, const gsl_block_complex * b, const char *format);
int gsl_block_complex_raw_fread (FILE * stream, double * b, const size_t n, const size_t stride);
int gsl_block_complex_raw_fwrite (FILE * stream, const double * b, const size_t n, const size_t stride);
int gsl_block_complex_raw_fscanf (FILE * stream, double * b, const size_t n, const size_t stride);
int gsl_block_complex_raw_fprintf (FILE * stream, const double * b, const size_t n, const size_t stride, const char *format);
size_t gsl_block_complex_size (const gsl_block_complex * b);
double * gsl_block_complex_data (const gsl_block_complex * b);
__END_DECLS
#endif /* __GSL_BLOCK_COMPLEX_DOUBLE_H__ */

View File

@ -0,0 +1,65 @@
/* block/gsl_block_complex_float.h
*
* Copyright (C) 1996, 1997, 1998, 1999, 2000, 2007 Gerard Jungman, Brian Gough
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or (at
* your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef __GSL_BLOCK_COMPLEX_FLOAT_H__
#define __GSL_BLOCK_COMPLEX_FLOAT_H__
#include <stdlib.h>
#include <gsl/gsl_errno.h>
#undef __BEGIN_DECLS
#undef __END_DECLS
#ifdef __cplusplus
# define __BEGIN_DECLS extern "C" {
# define __END_DECLS }
#else
# define __BEGIN_DECLS /* empty */
# define __END_DECLS /* empty */
#endif
__BEGIN_DECLS
struct gsl_block_complex_float_struct
{
size_t size;
float *data;
};
typedef struct gsl_block_complex_float_struct gsl_block_complex_float;
gsl_block_complex_float *gsl_block_complex_float_alloc (const size_t n);
gsl_block_complex_float *gsl_block_complex_float_calloc (const size_t n);
void gsl_block_complex_float_free (gsl_block_complex_float * b);
int gsl_block_complex_float_fread (FILE * stream, gsl_block_complex_float * b);
int gsl_block_complex_float_fwrite (FILE * stream, const gsl_block_complex_float * b);
int gsl_block_complex_float_fscanf (FILE * stream, gsl_block_complex_float * b);
int gsl_block_complex_float_fprintf (FILE * stream, const gsl_block_complex_float * b, const char *format);
int gsl_block_complex_float_raw_fread (FILE * stream, float * b, const size_t n, const size_t stride);
int gsl_block_complex_float_raw_fwrite (FILE * stream, const float * b, const size_t n, const size_t stride);
int gsl_block_complex_float_raw_fscanf (FILE * stream, float * b, const size_t n, const size_t stride);
int gsl_block_complex_float_raw_fprintf (FILE * stream, const float * b, const size_t n, const size_t stride, const char *format);
size_t gsl_block_complex_float_size (const gsl_block_complex_float * b);
float * gsl_block_complex_float_data (const gsl_block_complex_float * b);
__END_DECLS
#endif /* __GSL_BLOCK_COMPLEX_FLOAT_H__ */

View File

@ -0,0 +1,65 @@
/* block/gsl_block_complex_long_double.h
*
* Copyright (C) 1996, 1997, 1998, 1999, 2000, 2007 Gerard Jungman, Brian Gough
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or (at
* your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef __GSL_BLOCK_COMPLEX_LONG_DOUBLE_H__
#define __GSL_BLOCK_COMPLEX_LONG_DOUBLE_H__
#include <stdlib.h>
#include <gsl/gsl_errno.h>
#undef __BEGIN_DECLS
#undef __END_DECLS
#ifdef __cplusplus
# define __BEGIN_DECLS extern "C" {
# define __END_DECLS }
#else
# define __BEGIN_DECLS /* empty */
# define __END_DECLS /* empty */
#endif
__BEGIN_DECLS
struct gsl_block_complex_long_double_struct
{
size_t size;
long double *data;
};
typedef struct gsl_block_complex_long_double_struct gsl_block_complex_long_double;
gsl_block_complex_long_double *gsl_block_complex_long_double_alloc (const size_t n);
gsl_block_complex_long_double *gsl_block_complex_long_double_calloc (const size_t n);
void gsl_block_complex_long_double_free (gsl_block_complex_long_double * b);
int gsl_block_complex_long_double_fread (FILE * stream, gsl_block_complex_long_double * b);
int gsl_block_complex_long_double_fwrite (FILE * stream, const gsl_block_complex_long_double * b);
int gsl_block_complex_long_double_fscanf (FILE * stream, gsl_block_complex_long_double * b);
int gsl_block_complex_long_double_fprintf (FILE * stream, const gsl_block_complex_long_double * b, const char *format);
int gsl_block_complex_long_double_raw_fread (FILE * stream, long double * b, const size_t n, const size_t stride);
int gsl_block_complex_long_double_raw_fwrite (FILE * stream, const long double * b, const size_t n, const size_t stride);
int gsl_block_complex_long_double_raw_fscanf (FILE * stream, long double * b, const size_t n, const size_t stride);
int gsl_block_complex_long_double_raw_fprintf (FILE * stream, const long double * b, const size_t n, const size_t stride, const char *format);
size_t gsl_block_complex_long_double_size (const gsl_block_complex_long_double * b);
long double * gsl_block_complex_long_double_data (const gsl_block_complex_long_double * b);
__END_DECLS
#endif /* __GSL_BLOCK_COMPLEX_LONG_DOUBLE_H__ */

View File

@ -0,0 +1,65 @@
/* block/gsl_block_double.h
*
* Copyright (C) 1996, 1997, 1998, 1999, 2000, 2007 Gerard Jungman, Brian Gough
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or (at
* your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef __GSL_BLOCK_DOUBLE_H__
#define __GSL_BLOCK_DOUBLE_H__
#include <stdlib.h>
#include <gsl/gsl_errno.h>
#undef __BEGIN_DECLS
#undef __END_DECLS
#ifdef __cplusplus
# define __BEGIN_DECLS extern "C" {
# define __END_DECLS }
#else
# define __BEGIN_DECLS /* empty */
# define __END_DECLS /* empty */
#endif
__BEGIN_DECLS
struct gsl_block_struct
{
size_t size;
double *data;
};
typedef struct gsl_block_struct gsl_block;
gsl_block *gsl_block_alloc (const size_t n);
gsl_block *gsl_block_calloc (const size_t n);
void gsl_block_free (gsl_block * b);
int gsl_block_fread (FILE * stream, gsl_block * b);
int gsl_block_fwrite (FILE * stream, const gsl_block * b);
int gsl_block_fscanf (FILE * stream, gsl_block * b);
int gsl_block_fprintf (FILE * stream, const gsl_block * b, const char *format);
int gsl_block_raw_fread (FILE * stream, double * b, const size_t n, const size_t stride);
int gsl_block_raw_fwrite (FILE * stream, const double * b, const size_t n, const size_t stride);
int gsl_block_raw_fscanf (FILE * stream, double * b, const size_t n, const size_t stride);
int gsl_block_raw_fprintf (FILE * stream, const double * b, const size_t n, const size_t stride, const char *format);
size_t gsl_block_size (const gsl_block * b);
double * gsl_block_data (const gsl_block * b);
__END_DECLS
#endif /* __GSL_BLOCK_DOUBLE_H__ */

View File

@ -0,0 +1,65 @@
/* block/gsl_block_float.h
*
* Copyright (C) 1996, 1997, 1998, 1999, 2000, 2007 Gerard Jungman, Brian Gough
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or (at
* your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef __GSL_BLOCK_FLOAT_H__
#define __GSL_BLOCK_FLOAT_H__
#include <stdlib.h>
#include <gsl/gsl_errno.h>
#undef __BEGIN_DECLS
#undef __END_DECLS
#ifdef __cplusplus
# define __BEGIN_DECLS extern "C" {
# define __END_DECLS }
#else
# define __BEGIN_DECLS /* empty */
# define __END_DECLS /* empty */
#endif
__BEGIN_DECLS
struct gsl_block_float_struct
{
size_t size;
float *data;
};
typedef struct gsl_block_float_struct gsl_block_float;
gsl_block_float *gsl_block_float_alloc (const size_t n);
gsl_block_float *gsl_block_float_calloc (const size_t n);
void gsl_block_float_free (gsl_block_float * b);
int gsl_block_float_fread (FILE * stream, gsl_block_float * b);
int gsl_block_float_fwrite (FILE * stream, const gsl_block_float * b);
int gsl_block_float_fscanf (FILE * stream, gsl_block_float * b);
int gsl_block_float_fprintf (FILE * stream, const gsl_block_float * b, const char *format);
int gsl_block_float_raw_fread (FILE * stream, float * b, const size_t n, const size_t stride);
int gsl_block_float_raw_fwrite (FILE * stream, const float * b, const size_t n, const size_t stride);
int gsl_block_float_raw_fscanf (FILE * stream, float * b, const size_t n, const size_t stride);
int gsl_block_float_raw_fprintf (FILE * stream, const float * b, const size_t n, const size_t stride, const char *format);
size_t gsl_block_float_size (const gsl_block_float * b);
float * gsl_block_float_data (const gsl_block_float * b);
__END_DECLS
#endif /* __GSL_BLOCK_FLOAT_H__ */

View File

@ -0,0 +1,65 @@
/* block/gsl_block_int.h
*
* Copyright (C) 1996, 1997, 1998, 1999, 2000, 2007 Gerard Jungman, Brian Gough
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or (at
* your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef __GSL_BLOCK_INT_H__
#define __GSL_BLOCK_INT_H__
#include <stdlib.h>
#include <gsl/gsl_errno.h>
#undef __BEGIN_DECLS
#undef __END_DECLS
#ifdef __cplusplus
# define __BEGIN_DECLS extern "C" {
# define __END_DECLS }
#else
# define __BEGIN_DECLS /* empty */
# define __END_DECLS /* empty */
#endif
__BEGIN_DECLS
struct gsl_block_int_struct
{
size_t size;
int *data;
};
typedef struct gsl_block_int_struct gsl_block_int;
gsl_block_int *gsl_block_int_alloc (const size_t n);
gsl_block_int *gsl_block_int_calloc (const size_t n);
void gsl_block_int_free (gsl_block_int * b);
int gsl_block_int_fread (FILE * stream, gsl_block_int * b);
int gsl_block_int_fwrite (FILE * stream, const gsl_block_int * b);
int gsl_block_int_fscanf (FILE * stream, gsl_block_int * b);
int gsl_block_int_fprintf (FILE * stream, const gsl_block_int * b, const char *format);
int gsl_block_int_raw_fread (FILE * stream, int * b, const size_t n, const size_t stride);
int gsl_block_int_raw_fwrite (FILE * stream, const int * b, const size_t n, const size_t stride);
int gsl_block_int_raw_fscanf (FILE * stream, int * b, const size_t n, const size_t stride);
int gsl_block_int_raw_fprintf (FILE * stream, const int * b, const size_t n, const size_t stride, const char *format);
size_t gsl_block_int_size (const gsl_block_int * b);
int * gsl_block_int_data (const gsl_block_int * b);
__END_DECLS
#endif /* __GSL_BLOCK_INT_H__ */

View File

@ -0,0 +1,65 @@
/* block/gsl_block_long.h
*
* Copyright (C) 1996, 1997, 1998, 1999, 2000, 2007 Gerard Jungman, Brian Gough
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or (at
* your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef __GSL_BLOCK_LONG_H__
#define __GSL_BLOCK_LONG_H__
#include <stdlib.h>
#include <gsl/gsl_errno.h>
#undef __BEGIN_DECLS
#undef __END_DECLS
#ifdef __cplusplus
# define __BEGIN_DECLS extern "C" {
# define __END_DECLS }
#else
# define __BEGIN_DECLS /* empty */
# define __END_DECLS /* empty */
#endif
__BEGIN_DECLS
struct gsl_block_long_struct
{
size_t size;
long *data;
};
typedef struct gsl_block_long_struct gsl_block_long;
gsl_block_long *gsl_block_long_alloc (const size_t n);
gsl_block_long *gsl_block_long_calloc (const size_t n);
void gsl_block_long_free (gsl_block_long * b);
int gsl_block_long_fread (FILE * stream, gsl_block_long * b);
int gsl_block_long_fwrite (FILE * stream, const gsl_block_long * b);
int gsl_block_long_fscanf (FILE * stream, gsl_block_long * b);
int gsl_block_long_fprintf (FILE * stream, const gsl_block_long * b, const char *format);
int gsl_block_long_raw_fread (FILE * stream, long * b, const size_t n, const size_t stride);
int gsl_block_long_raw_fwrite (FILE * stream, const long * b, const size_t n, const size_t stride);
int gsl_block_long_raw_fscanf (FILE * stream, long * b, const size_t n, const size_t stride);
int gsl_block_long_raw_fprintf (FILE * stream, const long * b, const size_t n, const size_t stride, const char *format);
size_t gsl_block_long_size (const gsl_block_long * b);
long * gsl_block_long_data (const gsl_block_long * b);
__END_DECLS
#endif /* __GSL_BLOCK_LONG_H__ */

View File

@ -0,0 +1,65 @@
/* block/gsl_block_long_double.h
*
* Copyright (C) 1996, 1997, 1998, 1999, 2000, 2007 Gerard Jungman, Brian Gough
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or (at
* your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef __GSL_BLOCK_LONG_DOUBLE_H__
#define __GSL_BLOCK_LONG_DOUBLE_H__
#include <stdlib.h>
#include <gsl/gsl_errno.h>
#undef __BEGIN_DECLS
#undef __END_DECLS
#ifdef __cplusplus
# define __BEGIN_DECLS extern "C" {
# define __END_DECLS }
#else
# define __BEGIN_DECLS /* empty */
# define __END_DECLS /* empty */
#endif
__BEGIN_DECLS
struct gsl_block_long_double_struct
{
size_t size;
long double *data;
};
typedef struct gsl_block_long_double_struct gsl_block_long_double;
gsl_block_long_double *gsl_block_long_double_alloc (const size_t n);
gsl_block_long_double *gsl_block_long_double_calloc (const size_t n);
void gsl_block_long_double_free (gsl_block_long_double * b);
int gsl_block_long_double_fread (FILE * stream, gsl_block_long_double * b);
int gsl_block_long_double_fwrite (FILE * stream, const gsl_block_long_double * b);
int gsl_block_long_double_fscanf (FILE * stream, gsl_block_long_double * b);
int gsl_block_long_double_fprintf (FILE * stream, const gsl_block_long_double * b, const char *format);
int gsl_block_long_double_raw_fread (FILE * stream, long double * b, const size_t n, const size_t stride);
int gsl_block_long_double_raw_fwrite (FILE * stream, const long double * b, const size_t n, const size_t stride);
int gsl_block_long_double_raw_fscanf (FILE * stream, long double * b, const size_t n, const size_t stride);
int gsl_block_long_double_raw_fprintf (FILE * stream, const long double * b, const size_t n, const size_t stride, const char *format);
size_t gsl_block_long_double_size (const gsl_block_long_double * b);
long double * gsl_block_long_double_data (const gsl_block_long_double * b);
__END_DECLS
#endif /* __GSL_BLOCK_LONG_DOUBLE_H__ */

View File

@ -0,0 +1,65 @@
/* block/gsl_block_short.h
*
* Copyright (C) 1996, 1997, 1998, 1999, 2000, 2007 Gerard Jungman, Brian Gough
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or (at
* your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef __GSL_BLOCK_SHORT_H__
#define __GSL_BLOCK_SHORT_H__
#include <stdlib.h>
#include <gsl/gsl_errno.h>
#undef __BEGIN_DECLS
#undef __END_DECLS
#ifdef __cplusplus
# define __BEGIN_DECLS extern "C" {
# define __END_DECLS }
#else
# define __BEGIN_DECLS /* empty */
# define __END_DECLS /* empty */
#endif
__BEGIN_DECLS
struct gsl_block_short_struct
{
size_t size;
short *data;
};
typedef struct gsl_block_short_struct gsl_block_short;
gsl_block_short *gsl_block_short_alloc (const size_t n);
gsl_block_short *gsl_block_short_calloc (const size_t n);
void gsl_block_short_free (gsl_block_short * b);
int gsl_block_short_fread (FILE * stream, gsl_block_short * b);
int gsl_block_short_fwrite (FILE * stream, const gsl_block_short * b);
int gsl_block_short_fscanf (FILE * stream, gsl_block_short * b);
int gsl_block_short_fprintf (FILE * stream, const gsl_block_short * b, const char *format);
int gsl_block_short_raw_fread (FILE * stream, short * b, const size_t n, const size_t stride);
int gsl_block_short_raw_fwrite (FILE * stream, const short * b, const size_t n, const size_t stride);
int gsl_block_short_raw_fscanf (FILE * stream, short * b, const size_t n, const size_t stride);
int gsl_block_short_raw_fprintf (FILE * stream, const short * b, const size_t n, const size_t stride, const char *format);
size_t gsl_block_short_size (const gsl_block_short * b);
short * gsl_block_short_data (const gsl_block_short * b);
__END_DECLS
#endif /* __GSL_BLOCK_SHORT_H__ */

View File

@ -0,0 +1,65 @@
/* block/gsl_block_uchar.h
*
* Copyright (C) 1996, 1997, 1998, 1999, 2000, 2007 Gerard Jungman, Brian Gough
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or (at
* your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef __GSL_BLOCK_UCHAR_H__
#define __GSL_BLOCK_UCHAR_H__
#include <stdlib.h>
#include <gsl/gsl_errno.h>
#undef __BEGIN_DECLS
#undef __END_DECLS
#ifdef __cplusplus
# define __BEGIN_DECLS extern "C" {
# define __END_DECLS }
#else
# define __BEGIN_DECLS /* empty */
# define __END_DECLS /* empty */
#endif
__BEGIN_DECLS
struct gsl_block_uchar_struct
{
size_t size;
unsigned char *data;
};
typedef struct gsl_block_uchar_struct gsl_block_uchar;
gsl_block_uchar *gsl_block_uchar_alloc (const size_t n);
gsl_block_uchar *gsl_block_uchar_calloc (const size_t n);
void gsl_block_uchar_free (gsl_block_uchar * b);
int gsl_block_uchar_fread (FILE * stream, gsl_block_uchar * b);
int gsl_block_uchar_fwrite (FILE * stream, const gsl_block_uchar * b);
int gsl_block_uchar_fscanf (FILE * stream, gsl_block_uchar * b);
int gsl_block_uchar_fprintf (FILE * stream, const gsl_block_uchar * b, const char *format);
int gsl_block_uchar_raw_fread (FILE * stream, unsigned char * b, const size_t n, const size_t stride);
int gsl_block_uchar_raw_fwrite (FILE * stream, const unsigned char * b, const size_t n, const size_t stride);
int gsl_block_uchar_raw_fscanf (FILE * stream, unsigned char * b, const size_t n, const size_t stride);
int gsl_block_uchar_raw_fprintf (FILE * stream, const unsigned char * b, const size_t n, const size_t stride, const char *format);
size_t gsl_block_uchar_size (const gsl_block_uchar * b);
unsigned char * gsl_block_uchar_data (const gsl_block_uchar * b);
__END_DECLS
#endif /* __GSL_BLOCK_UCHAR_H__ */

View File

@ -0,0 +1,65 @@
/* block/gsl_block_uint.h
*
* Copyright (C) 1996, 1997, 1998, 1999, 2000, 2007 Gerard Jungman, Brian Gough
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or (at
* your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef __GSL_BLOCK_UINT_H__
#define __GSL_BLOCK_UINT_H__
#include <stdlib.h>
#include <gsl/gsl_errno.h>
#undef __BEGIN_DECLS
#undef __END_DECLS
#ifdef __cplusplus
# define __BEGIN_DECLS extern "C" {
# define __END_DECLS }
#else
# define __BEGIN_DECLS /* empty */
# define __END_DECLS /* empty */
#endif
__BEGIN_DECLS
struct gsl_block_uint_struct
{
size_t size;
unsigned int *data;
};
typedef struct gsl_block_uint_struct gsl_block_uint;
gsl_block_uint *gsl_block_uint_alloc (const size_t n);
gsl_block_uint *gsl_block_uint_calloc (const size_t n);
void gsl_block_uint_free (gsl_block_uint * b);
int gsl_block_uint_fread (FILE * stream, gsl_block_uint * b);
int gsl_block_uint_fwrite (FILE * stream, const gsl_block_uint * b);
int gsl_block_uint_fscanf (FILE * stream, gsl_block_uint * b);
int gsl_block_uint_fprintf (FILE * stream, const gsl_block_uint * b, const char *format);
int gsl_block_uint_raw_fread (FILE * stream, unsigned int * b, const size_t n, const size_t stride);
int gsl_block_uint_raw_fwrite (FILE * stream, const unsigned int * b, const size_t n, const size_t stride);
int gsl_block_uint_raw_fscanf (FILE * stream, unsigned int * b, const size_t n, const size_t stride);
int gsl_block_uint_raw_fprintf (FILE * stream, const unsigned int * b, const size_t n, const size_t stride, const char *format);
size_t gsl_block_uint_size (const gsl_block_uint * b);
unsigned int * gsl_block_uint_data (const gsl_block_uint * b);
__END_DECLS
#endif /* __GSL_BLOCK_UINT_H__ */

View File

@ -0,0 +1,65 @@
/* block/gsl_block_ulong.h
*
* Copyright (C) 1996, 1997, 1998, 1999, 2000, 2007 Gerard Jungman, Brian Gough
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or (at
* your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef __GSL_BLOCK_ULONG_H__
#define __GSL_BLOCK_ULONG_H__
#include <stdlib.h>
#include <gsl/gsl_errno.h>
#undef __BEGIN_DECLS
#undef __END_DECLS
#ifdef __cplusplus
# define __BEGIN_DECLS extern "C" {
# define __END_DECLS }
#else
# define __BEGIN_DECLS /* empty */
# define __END_DECLS /* empty */
#endif
__BEGIN_DECLS
struct gsl_block_ulong_struct
{
size_t size;
unsigned long *data;
};
typedef struct gsl_block_ulong_struct gsl_block_ulong;
gsl_block_ulong *gsl_block_ulong_alloc (const size_t n);
gsl_block_ulong *gsl_block_ulong_calloc (const size_t n);
void gsl_block_ulong_free (gsl_block_ulong * b);
int gsl_block_ulong_fread (FILE * stream, gsl_block_ulong * b);
int gsl_block_ulong_fwrite (FILE * stream, const gsl_block_ulong * b);
int gsl_block_ulong_fscanf (FILE * stream, gsl_block_ulong * b);
int gsl_block_ulong_fprintf (FILE * stream, const gsl_block_ulong * b, const char *format);
int gsl_block_ulong_raw_fread (FILE * stream, unsigned long * b, const size_t n, const size_t stride);
int gsl_block_ulong_raw_fwrite (FILE * stream, const unsigned long * b, const size_t n, const size_t stride);
int gsl_block_ulong_raw_fscanf (FILE * stream, unsigned long * b, const size_t n, const size_t stride);
int gsl_block_ulong_raw_fprintf (FILE * stream, const unsigned long * b, const size_t n, const size_t stride, const char *format);
size_t gsl_block_ulong_size (const gsl_block_ulong * b);
unsigned long * gsl_block_ulong_data (const gsl_block_ulong * b);
__END_DECLS
#endif /* __GSL_BLOCK_ULONG_H__ */

View File

@ -0,0 +1,65 @@
/* block/gsl_block_ushort.h
*
* Copyright (C) 1996, 1997, 1998, 1999, 2000, 2007 Gerard Jungman, Brian Gough
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or (at
* your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef __GSL_BLOCK_USHORT_H__
#define __GSL_BLOCK_USHORT_H__
#include <stdlib.h>
#include <gsl/gsl_errno.h>
#undef __BEGIN_DECLS
#undef __END_DECLS
#ifdef __cplusplus
# define __BEGIN_DECLS extern "C" {
# define __END_DECLS }
#else
# define __BEGIN_DECLS /* empty */
# define __END_DECLS /* empty */
#endif
__BEGIN_DECLS
struct gsl_block_ushort_struct
{
size_t size;
unsigned short *data;
};
typedef struct gsl_block_ushort_struct gsl_block_ushort;
gsl_block_ushort *gsl_block_ushort_alloc (const size_t n);
gsl_block_ushort *gsl_block_ushort_calloc (const size_t n);
void gsl_block_ushort_free (gsl_block_ushort * b);
int gsl_block_ushort_fread (FILE * stream, gsl_block_ushort * b);
int gsl_block_ushort_fwrite (FILE * stream, const gsl_block_ushort * b);
int gsl_block_ushort_fscanf (FILE * stream, gsl_block_ushort * b);
int gsl_block_ushort_fprintf (FILE * stream, const gsl_block_ushort * b, const char *format);
int gsl_block_ushort_raw_fread (FILE * stream, unsigned short * b, const size_t n, const size_t stride);
int gsl_block_ushort_raw_fwrite (FILE * stream, const unsigned short * b, const size_t n, const size_t stride);
int gsl_block_ushort_raw_fscanf (FILE * stream, unsigned short * b, const size_t n, const size_t stride);
int gsl_block_ushort_raw_fprintf (FILE * stream, const unsigned short * b, const size_t n, const size_t stride, const char *format);
size_t gsl_block_ushort_size (const gsl_block_ushort * b);
unsigned short * gsl_block_ushort_data (const gsl_block_ushort * b);
__END_DECLS
#endif /* __GSL_BLOCK_USHORT_H__ */

View File

@ -0,0 +1,108 @@
/* bspline/gsl_bspline.h
*
* Copyright (C) 2006 Patrick Alken
* Copyright (C) 2008 Rhys Ulerich
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or (at
* your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef __GSL_BSPLINE_H__
#define __GSL_BSPLINE_H__
#include <stdlib.h>
#include <gsl/gsl_math.h>
#include <gsl/gsl_vector.h>
#include <gsl/gsl_matrix.h>
#undef __BEGIN_DECLS
#undef __END_DECLS
#ifdef __cplusplus
# define __BEGIN_DECLS extern "C" {
# define __END_DECLS }
#else
# define __BEGIN_DECLS /* empty */
# define __END_DECLS /* empty */
#endif
__BEGIN_DECLS
typedef struct
{
size_t k; /* spline order */
size_t km1; /* k - 1 (polynomial order) */
size_t l; /* number of polynomial pieces on interval */
size_t nbreak; /* number of breakpoints (l + 1) */
size_t n; /* number of bspline basis functions (l + k - 1) */
gsl_vector *knots; /* knots vector */
gsl_vector *deltal; /* left delta */
gsl_vector *deltar; /* right delta */
gsl_vector *B; /* temporary spline results */
/* bspline derivative parameters */
gsl_matrix *A; /* work matrix */
gsl_matrix *dB; /* temporary derivative results */
} gsl_bspline_workspace;
gsl_bspline_workspace *
gsl_bspline_alloc(const size_t k, const size_t nbreak);
void gsl_bspline_free(gsl_bspline_workspace *w);
size_t gsl_bspline_ncoeffs(gsl_bspline_workspace * w);
size_t gsl_bspline_order(gsl_bspline_workspace * w);
size_t gsl_bspline_nbreak(gsl_bspline_workspace * w);
double gsl_bspline_breakpoint(size_t i, gsl_bspline_workspace * w);
double gsl_bspline_greville_abscissa(size_t i, gsl_bspline_workspace *w);
int
gsl_bspline_knots(const gsl_vector *breakpts, gsl_bspline_workspace *w);
int gsl_bspline_knots_uniform(const double a, const double b,
gsl_bspline_workspace *w);
int
gsl_bspline_knots_greville(const gsl_vector *abscissae,
gsl_bspline_workspace *w,
double *abserr);
int
gsl_bspline_eval(const double x, gsl_vector *B,
gsl_bspline_workspace *w);
int
gsl_bspline_eval_nonzero(const double x,
gsl_vector *Bk,
size_t *istart,
size_t *iend,
gsl_bspline_workspace *w);
int
gsl_bspline_deriv_eval(const double x,
const size_t nderiv,
gsl_matrix *dB,
gsl_bspline_workspace *w);
int
gsl_bspline_deriv_eval_nonzero(const double x,
const size_t nderiv,
gsl_matrix *dB,
size_t *istart,
size_t *iend,
gsl_bspline_workspace *w);
__END_DECLS
#endif /* __GSL_BSPLINE_H__ */

View File

@ -0,0 +1,117 @@
/* bst/gsl_bst.h
*
* Copyright (C) 2018, 2019 Patrick Alken
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or (at
* your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef __GSL_BST_H__
#define __GSL_BST_H__
#include <stdlib.h>
#include <gsl/gsl_math.h>
#include <gsl/gsl_bst_avl.h>
#include <gsl/gsl_bst_rb.h>
#include <gsl/gsl_bst_types.h>
#undef __BEGIN_DECLS
#undef __END_DECLS
#ifdef __cplusplus
# define __BEGIN_DECLS extern "C" {
# define __END_DECLS }
#else
# define __BEGIN_DECLS /* empty */
# define __END_DECLS /* empty */
#endif
__BEGIN_DECLS
/* type of binary search tree */
typedef struct
{
const char *name;
const size_t node_size;
int (*init)(const gsl_bst_allocator * allocator,
gsl_bst_cmp_function * compare, void * params, void * vtable);
size_t (*nodes) (const void * vtable);
void * (*insert) (void * item, void * vtable);
void * (*find) (const void *item, const void * vtable);
void * (*remove) (const void *item, void * vtable);
int (*empty) (void * vtable);
int (*trav_init) (void * vtrav, const void * vtable);
void * (*trav_first) (void * vtrav, const void * vtable);
void * (*trav_last) (void * vtrav, const void * vtable);
void * (*trav_find) (const void * item, void * vtrav, const void * vtable);
void * (*trav_insert) (void * item, void * vtrav, void * vtable);
void * (*trav_copy) (void * vtrav, const void * vsrc);
void * (*trav_next) (void * vtrav);
void * (*trav_prev) (void * vtrav);
void * (*trav_cur) (const void * vtrav);
void * (*trav_replace) (void * vtrav, void * new_item);
} gsl_bst_type;
typedef struct
{
const gsl_bst_type * type; /* binary search tree type */
union
{
gsl_bst_avl_table avl_table;
gsl_bst_rb_table rb_table;
} table;
} gsl_bst_workspace;
typedef struct
{
const gsl_bst_type * type; /* binary search tree type */
union
{
gsl_bst_avl_traverser avl_trav;
gsl_bst_rb_traverser rb_trav;
} trav_data;
} gsl_bst_trav;
/* tree types */
GSL_VAR const gsl_bst_type * gsl_bst_avl;
GSL_VAR const gsl_bst_type * gsl_bst_rb;
/*
* Prototypes
*/
gsl_bst_workspace * gsl_bst_alloc(const gsl_bst_type * T, const gsl_bst_allocator * allocator,
gsl_bst_cmp_function * compare, void * params);
void gsl_bst_free(gsl_bst_workspace * w);
int gsl_bst_empty(gsl_bst_workspace * w);
void * gsl_bst_insert(void * item, gsl_bst_workspace * w);
void * gsl_bst_find(const void * item, const gsl_bst_workspace * w);
void * gsl_bst_remove(const void * item, gsl_bst_workspace * w);
size_t gsl_bst_nodes(const gsl_bst_workspace * w);
size_t gsl_bst_node_size(const gsl_bst_workspace * w);
const char * gsl_bst_name(const gsl_bst_workspace * w);
int gsl_bst_trav_init(gsl_bst_trav * trav, const gsl_bst_workspace * w);
void * gsl_bst_trav_first(gsl_bst_trav * trav, const gsl_bst_workspace * w);
void * gsl_bst_trav_last (gsl_bst_trav * trav, const gsl_bst_workspace * w);
void * gsl_bst_trav_find (const void * item, gsl_bst_trav * trav, const gsl_bst_workspace * w);
void * gsl_bst_trav_insert (void * item, gsl_bst_trav * trav, gsl_bst_workspace * w);
void * gsl_bst_trav_copy(gsl_bst_trav * dest, const gsl_bst_trav * src);
void * gsl_bst_trav_next(gsl_bst_trav * trav);
void * gsl_bst_trav_prev(gsl_bst_trav * trav);
void * gsl_bst_trav_cur(const gsl_bst_trav * trav);
void * gsl_bst_trav_replace (gsl_bst_trav * trav, void * new_item);
__END_DECLS
#endif /* __GSL_BST_H__ */

View File

@ -0,0 +1,73 @@
/* bst/gsl_bst_avl.h
*
* Copyright (C) 2018 Patrick Alken
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or (at
* your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef __GSL_BST_AVL_H__
#define __GSL_BST_AVL_H__
#include <stdlib.h>
#include <gsl/gsl_bst_types.h>
#undef __BEGIN_DECLS
#undef __END_DECLS
#ifdef __cplusplus
# define __BEGIN_DECLS extern "C" {
# define __END_DECLS }
#else
# define __BEGIN_DECLS /* empty */
# define __END_DECLS /* empty */
#endif
__BEGIN_DECLS
#ifndef GSL_BST_AVL_MAX_HEIGHT
#define GSL_BST_AVL_MAX_HEIGHT 32
#endif
/* AVL node */
struct gsl_bst_avl_node
{
struct gsl_bst_avl_node *avl_link[2]; /* subtrees */
void *avl_data; /* pointer to data */
signed char avl_balance; /* balance factor */
};
/* tree data structure */
typedef struct
{
struct gsl_bst_avl_node *avl_root; /* tree's root */
gsl_bst_cmp_function *avl_compare; /* comparison function */
void *avl_param; /* extra argument to |avl_compare| */
const gsl_bst_allocator *avl_alloc; /* memory allocator */
size_t avl_count; /* number of items in tree */
unsigned long avl_generation; /* generation number */
} gsl_bst_avl_table;
/* AVL traverser structure */
typedef struct
{
const gsl_bst_avl_table *avl_table; /* tree being traversed */
struct gsl_bst_avl_node *avl_node; /* current node in tree */
struct gsl_bst_avl_node *avl_stack[GSL_BST_AVL_MAX_HEIGHT]; /* all the nodes above |avl_node| */
size_t avl_height; /* number of nodes in |avl_parent| */
unsigned long avl_generation; /* generation number */
} gsl_bst_avl_traverser;
__END_DECLS
#endif /* __GSL_BST_AVL_H__ */

View File

@ -0,0 +1,74 @@
/* bst/gsl_bst_rb.h
*
* Copyright (C) 2018 Patrick Alken
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or (at
* your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef __GSL_BST_RB_H__
#define __GSL_BST_RB_H__
#include <stdlib.h>
#include <gsl/gsl_bst_types.h>
#undef __BEGIN_DECLS
#undef __END_DECLS
#ifdef __cplusplus
# define __BEGIN_DECLS extern "C" {
# define __END_DECLS }
#else
# define __BEGIN_DECLS /* empty */
# define __END_DECLS /* empty */
#endif
__BEGIN_DECLS
#ifndef GSL_BST_RB_MAX_HEIGHT
#define GSL_BST_RB_MAX_HEIGHT 48
#endif
/* red-black node */
struct gsl_bst_rb_node
{
struct gsl_bst_rb_node *rb_link[2]; /* subtrees */
void *rb_data; /* pointer to data */
unsigned char rb_color; /* color */
};
/* red-black tree data structure */
typedef struct
{
struct gsl_bst_rb_node *rb_root; /* tree's root */
gsl_bst_cmp_function *rb_compare; /* comparison function */
void *rb_param; /* extra argument to |rb_compare| */
const gsl_bst_allocator *rb_alloc; /* memory allocator */
size_t rb_count; /* number of items in tree */
unsigned long rb_generation; /* generation number */
} gsl_bst_rb_table;
/* red-black traverser structure */
typedef struct
{
const gsl_bst_rb_table *rb_table; /* tree being traversed */
struct gsl_bst_rb_node *rb_node; /* current node in tree */
struct gsl_bst_rb_node *rb_stack[GSL_BST_RB_MAX_HEIGHT];
/* all the nodes above |rb_node| */
size_t rb_height; /* number of nodes in |rb_parent| */
unsigned long rb_generation; /* generation number */
} gsl_bst_rb_traverser;
__END_DECLS
#endif /* __GSL_BST_RB_H__ */

View File

@ -0,0 +1,48 @@
/* bst/gsl_bst_types.h
*
* Copyright (C) 2019 Patrick Alken
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or (at
* your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef __GSL_BST_TYPES_H__
#define __GSL_BST_TYPES_H__
#include <stdlib.h>
#undef __BEGIN_DECLS
#undef __END_DECLS
#ifdef __cplusplus
# define __BEGIN_DECLS extern "C" {
# define __END_DECLS }
#else
# define __BEGIN_DECLS /* empty */
# define __END_DECLS /* empty */
#endif
__BEGIN_DECLS
typedef int gsl_bst_cmp_function (const void * a, const void * b, void * params);
/* allocation routines */
typedef struct
{
void * (*alloc) (size_t size, void * params);
void (*free) (void * block, void * params);
} gsl_bst_allocator;
__END_DECLS
#endif /* __GSL_BST_TYPES_H__ */

View File

@ -0,0 +1,606 @@
/* blas/gsl_cblas.h
*
* Copyright (C) 1996, 1997, 1998, 1999, 2000 Gerard Jungman
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or (at
* your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
/* This is a copy of the CBLAS standard header.
* We carry this around so we do not have to
* break our model for flexible BLAS functionality.
*/
#ifndef __GSL_CBLAS_H__
#define __GSL_CBLAS_H__
#include <stddef.h>
#undef __BEGIN_DECLS
#undef __END_DECLS
#ifdef __cplusplus
#define __BEGIN_DECLS extern "C" {
#define __END_DECLS }
#else
#define __BEGIN_DECLS /* empty */
#define __END_DECLS /* empty */
#endif
__BEGIN_DECLS
/*
* Enumerated and derived types
*/
#define CBLAS_INDEX size_t /* this may vary between platforms */
enum CBLAS_ORDER {CblasRowMajor=101, CblasColMajor=102};
enum CBLAS_TRANSPOSE {CblasNoTrans=111, CblasTrans=112, CblasConjTrans=113};
enum CBLAS_UPLO {CblasUpper=121, CblasLower=122};
enum CBLAS_DIAG {CblasNonUnit=131, CblasUnit=132};
enum CBLAS_SIDE {CblasLeft=141, CblasRight=142};
/*
* ===========================================================================
* Prototypes for level 1 BLAS functions (complex are recast as routines)
* ===========================================================================
*/
float cblas_sdsdot(const int N, const float alpha, const float *X,
const int incX, const float *Y, const int incY);
double cblas_dsdot(const int N, const float *X, const int incX, const float *Y,
const int incY);
float cblas_sdot(const int N, const float *X, const int incX,
const float *Y, const int incY);
double cblas_ddot(const int N, const double *X, const int incX,
const double *Y, const int incY);
/*
* Functions having prefixes Z and C only
*/
void cblas_cdotu_sub(const int N, const void *X, const int incX,
const void *Y, const int incY, void *dotu);
void cblas_cdotc_sub(const int N, const void *X, const int incX,
const void *Y, const int incY, void *dotc);
void cblas_zdotu_sub(const int N, const void *X, const int incX,
const void *Y, const int incY, void *dotu);
void cblas_zdotc_sub(const int N, const void *X, const int incX,
const void *Y, const int incY, void *dotc);
/*
* Functions having prefixes S D SC DZ
*/
float cblas_snrm2(const int N, const float *X, const int incX);
float cblas_sasum(const int N, const float *X, const int incX);
double cblas_dnrm2(const int N, const double *X, const int incX);
double cblas_dasum(const int N, const double *X, const int incX);
float cblas_scnrm2(const int N, const void *X, const int incX);
float cblas_scasum(const int N, const void *X, const int incX);
double cblas_dznrm2(const int N, const void *X, const int incX);
double cblas_dzasum(const int N, const void *X, const int incX);
/*
* Functions having standard 4 prefixes (S D C Z)
*/
CBLAS_INDEX cblas_isamax(const int N, const float *X, const int incX);
CBLAS_INDEX cblas_idamax(const int N, const double *X, const int incX);
CBLAS_INDEX cblas_icamax(const int N, const void *X, const int incX);
CBLAS_INDEX cblas_izamax(const int N, const void *X, const int incX);
/*
* ===========================================================================
* Prototypes for level 1 BLAS routines
* ===========================================================================
*/
/*
* Routines with standard 4 prefixes (s, d, c, z)
*/
void cblas_sswap(const int N, float *X, const int incX,
float *Y, const int incY);
void cblas_scopy(const int N, const float *X, const int incX,
float *Y, const int incY);
void cblas_saxpy(const int N, const float alpha, const float *X,
const int incX, float *Y, const int incY);
void cblas_dswap(const int N, double *X, const int incX,
double *Y, const int incY);
void cblas_dcopy(const int N, const double *X, const int incX,
double *Y, const int incY);
void cblas_daxpy(const int N, const double alpha, const double *X,
const int incX, double *Y, const int incY);
void cblas_cswap(const int N, void *X, const int incX,
void *Y, const int incY);
void cblas_ccopy(const int N, const void *X, const int incX,
void *Y, const int incY);
void cblas_caxpy(const int N, const void *alpha, const void *X,
const int incX, void *Y, const int incY);
void cblas_zswap(const int N, void *X, const int incX,
void *Y, const int incY);
void cblas_zcopy(const int N, const void *X, const int incX,
void *Y, const int incY);
void cblas_zaxpy(const int N, const void *alpha, const void *X,
const int incX, void *Y, const int incY);
/*
* Routines with S and D prefix only
*/
void cblas_srotg(float *a, float *b, float *c, float *s);
void cblas_srotmg(float *d1, float *d2, float *b1, const float b2, float *P);
void cblas_srot(const int N, float *X, const int incX,
float *Y, const int incY, const float c, const float s);
void cblas_srotm(const int N, float *X, const int incX,
float *Y, const int incY, const float *P);
void cblas_drotg(double *a, double *b, double *c, double *s);
void cblas_drotmg(double *d1, double *d2, double *b1, const double b2, double *P);
void cblas_drot(const int N, double *X, const int incX,
double *Y, const int incY, const double c, const double s);
void cblas_drotm(const int N, double *X, const int incX,
double *Y, const int incY, const double *P);
/*
* Routines with S D C Z CS and ZD prefixes
*/
void cblas_sscal(const int N, const float alpha, float *X, const int incX);
void cblas_dscal(const int N, const double alpha, double *X, const int incX);
void cblas_cscal(const int N, const void *alpha, void *X, const int incX);
void cblas_zscal(const int N, const void *alpha, void *X, const int incX);
void cblas_csscal(const int N, const float alpha, void *X, const int incX);
void cblas_zdscal(const int N, const double alpha, void *X, const int incX);
/*
* ===========================================================================
* Prototypes for level 2 BLAS
* ===========================================================================
*/
/*
* Routines with standard 4 prefixes (S, D, C, Z)
*/
void cblas_sgemv(const enum CBLAS_ORDER order,
const enum CBLAS_TRANSPOSE TransA, const int M, const int N,
const float alpha, const float *A, const int lda,
const float *X, const int incX, const float beta,
float *Y, const int incY);
void cblas_sgbmv(const enum CBLAS_ORDER order,
const enum CBLAS_TRANSPOSE TransA, const int M, const int N,
const int KL, const int KU, const float alpha,
const float *A, const int lda, const float *X,
const int incX, const float beta, float *Y, const int incY);
void cblas_strmv(const enum CBLAS_ORDER order, const enum CBLAS_UPLO Uplo,
const enum CBLAS_TRANSPOSE TransA, const enum CBLAS_DIAG Diag,
const int N, const float *A, const int lda,
float *X, const int incX);
void cblas_stbmv(const enum CBLAS_ORDER order, const enum CBLAS_UPLO Uplo,
const enum CBLAS_TRANSPOSE TransA, const enum CBLAS_DIAG Diag,
const int N, const int K, const float *A, const int lda,
float *X, const int incX);
void cblas_stpmv(const enum CBLAS_ORDER order, const enum CBLAS_UPLO Uplo,
const enum CBLAS_TRANSPOSE TransA, const enum CBLAS_DIAG Diag,
const int N, const float *Ap, float *X, const int incX);
void cblas_strsv(const enum CBLAS_ORDER order, const enum CBLAS_UPLO Uplo,
const enum CBLAS_TRANSPOSE TransA, const enum CBLAS_DIAG Diag,
const int N, const float *A, const int lda, float *X,
const int incX);
void cblas_stbsv(const enum CBLAS_ORDER order, const enum CBLAS_UPLO Uplo,
const enum CBLAS_TRANSPOSE TransA, const enum CBLAS_DIAG Diag,
const int N, const int K, const float *A, const int lda,
float *X, const int incX);
void cblas_stpsv(const enum CBLAS_ORDER order, const enum CBLAS_UPLO Uplo,
const enum CBLAS_TRANSPOSE TransA, const enum CBLAS_DIAG Diag,
const int N, const float *Ap, float *X, const int incX);
void cblas_dgemv(const enum CBLAS_ORDER order,
const enum CBLAS_TRANSPOSE TransA, const int M, const int N,
const double alpha, const double *A, const int lda,
const double *X, const int incX, const double beta,
double *Y, const int incY);
void cblas_dgbmv(const enum CBLAS_ORDER order,
const enum CBLAS_TRANSPOSE TransA, const int M, const int N,
const int KL, const int KU, const double alpha,
const double *A, const int lda, const double *X,
const int incX, const double beta, double *Y, const int incY);
void cblas_dtrmv(const enum CBLAS_ORDER order, const enum CBLAS_UPLO Uplo,
const enum CBLAS_TRANSPOSE TransA, const enum CBLAS_DIAG Diag,
const int N, const double *A, const int lda,
double *X, const int incX);
void cblas_dtbmv(const enum CBLAS_ORDER order, const enum CBLAS_UPLO Uplo,
const enum CBLAS_TRANSPOSE TransA, const enum CBLAS_DIAG Diag,
const int N, const int K, const double *A, const int lda,
double *X, const int incX);
void cblas_dtpmv(const enum CBLAS_ORDER order, const enum CBLAS_UPLO Uplo,
const enum CBLAS_TRANSPOSE TransA, const enum CBLAS_DIAG Diag,
const int N, const double *Ap, double *X, const int incX);
void cblas_dtrsv(const enum CBLAS_ORDER order, const enum CBLAS_UPLO Uplo,
const enum CBLAS_TRANSPOSE TransA, const enum CBLAS_DIAG Diag,
const int N, const double *A, const int lda, double *X,
const int incX);
void cblas_dtbsv(const enum CBLAS_ORDER order, const enum CBLAS_UPLO Uplo,
const enum CBLAS_TRANSPOSE TransA, const enum CBLAS_DIAG Diag,
const int N, const int K, const double *A, const int lda,
double *X, const int incX);
void cblas_dtpsv(const enum CBLAS_ORDER order, const enum CBLAS_UPLO Uplo,
const enum CBLAS_TRANSPOSE TransA, const enum CBLAS_DIAG Diag,
const int N, const double *Ap, double *X, const int incX);
void cblas_cgemv(const enum CBLAS_ORDER order,
const enum CBLAS_TRANSPOSE TransA, const int M, const int N,
const void *alpha, const void *A, const int lda,
const void *X, const int incX, const void *beta,
void *Y, const int incY);
void cblas_cgbmv(const enum CBLAS_ORDER order,
const enum CBLAS_TRANSPOSE TransA, const int M, const int N,
const int KL, const int KU, const void *alpha,
const void *A, const int lda, const void *X,
const int incX, const void *beta, void *Y, const int incY);
void cblas_ctrmv(const enum CBLAS_ORDER order, const enum CBLAS_UPLO Uplo,
const enum CBLAS_TRANSPOSE TransA, const enum CBLAS_DIAG Diag,
const int N, const void *A, const int lda,
void *X, const int incX);
void cblas_ctbmv(const enum CBLAS_ORDER order, const enum CBLAS_UPLO Uplo,
const enum CBLAS_TRANSPOSE TransA, const enum CBLAS_DIAG Diag,
const int N, const int K, const void *A, const int lda,
void *X, const int incX);
void cblas_ctpmv(const enum CBLAS_ORDER order, const enum CBLAS_UPLO Uplo,
const enum CBLAS_TRANSPOSE TransA, const enum CBLAS_DIAG Diag,
const int N, const void *Ap, void *X, const int incX);
void cblas_ctrsv(const enum CBLAS_ORDER order, const enum CBLAS_UPLO Uplo,
const enum CBLAS_TRANSPOSE TransA, const enum CBLAS_DIAG Diag,
const int N, const void *A, const int lda, void *X,
const int incX);
void cblas_ctbsv(const enum CBLAS_ORDER order, const enum CBLAS_UPLO Uplo,
const enum CBLAS_TRANSPOSE TransA, const enum CBLAS_DIAG Diag,
const int N, const int K, const void *A, const int lda,
void *X, const int incX);
void cblas_ctpsv(const enum CBLAS_ORDER order, const enum CBLAS_UPLO Uplo,
const enum CBLAS_TRANSPOSE TransA, const enum CBLAS_DIAG Diag,
const int N, const void *Ap, void *X, const int incX);
void cblas_zgemv(const enum CBLAS_ORDER order,
const enum CBLAS_TRANSPOSE TransA, const int M, const int N,
const void *alpha, const void *A, const int lda,
const void *X, const int incX, const void *beta,
void *Y, const int incY);
void cblas_zgbmv(const enum CBLAS_ORDER order,
const enum CBLAS_TRANSPOSE TransA, const int M, const int N,
const int KL, const int KU, const void *alpha,
const void *A, const int lda, const void *X,
const int incX, const void *beta, void *Y, const int incY);
void cblas_ztrmv(const enum CBLAS_ORDER order, const enum CBLAS_UPLO Uplo,
const enum CBLAS_TRANSPOSE TransA, const enum CBLAS_DIAG Diag,
const int N, const void *A, const int lda,
void *X, const int incX);
void cblas_ztbmv(const enum CBLAS_ORDER order, const enum CBLAS_UPLO Uplo,
const enum CBLAS_TRANSPOSE TransA, const enum CBLAS_DIAG Diag,
const int N, const int K, const void *A, const int lda,
void *X, const int incX);
void cblas_ztpmv(const enum CBLAS_ORDER order, const enum CBLAS_UPLO Uplo,
const enum CBLAS_TRANSPOSE TransA, const enum CBLAS_DIAG Diag,
const int N, const void *Ap, void *X, const int incX);
void cblas_ztrsv(const enum CBLAS_ORDER order, const enum CBLAS_UPLO Uplo,
const enum CBLAS_TRANSPOSE TransA, const enum CBLAS_DIAG Diag,
const int N, const void *A, const int lda, void *X,
const int incX);
void cblas_ztbsv(const enum CBLAS_ORDER order, const enum CBLAS_UPLO Uplo,
const enum CBLAS_TRANSPOSE TransA, const enum CBLAS_DIAG Diag,
const int N, const int K, const void *A, const int lda,
void *X, const int incX);
void cblas_ztpsv(const enum CBLAS_ORDER order, const enum CBLAS_UPLO Uplo,
const enum CBLAS_TRANSPOSE TransA, const enum CBLAS_DIAG Diag,
const int N, const void *Ap, void *X, const int incX);
/*
* Routines with S and D prefixes only
*/
void cblas_ssymv(const enum CBLAS_ORDER order, const enum CBLAS_UPLO Uplo,
const int N, const float alpha, const float *A,
const int lda, const float *X, const int incX,
const float beta, float *Y, const int incY);
void cblas_ssbmv(const enum CBLAS_ORDER order, const enum CBLAS_UPLO Uplo,
const int N, const int K, const float alpha, const float *A,
const int lda, const float *X, const int incX,
const float beta, float *Y, const int incY);
void cblas_sspmv(const enum CBLAS_ORDER order, const enum CBLAS_UPLO Uplo,
const int N, const float alpha, const float *Ap,
const float *X, const int incX,
const float beta, float *Y, const int incY);
void cblas_sger(const enum CBLAS_ORDER order, const int M, const int N,
const float alpha, const float *X, const int incX,
const float *Y, const int incY, float *A, const int lda);
void cblas_ssyr(const enum CBLAS_ORDER order, const enum CBLAS_UPLO Uplo,
const int N, const float alpha, const float *X,
const int incX, float *A, const int lda);
void cblas_sspr(const enum CBLAS_ORDER order, const enum CBLAS_UPLO Uplo,
const int N, const float alpha, const float *X,
const int incX, float *Ap);
void cblas_ssyr2(const enum CBLAS_ORDER order, const enum CBLAS_UPLO Uplo,
const int N, const float alpha, const float *X,
const int incX, const float *Y, const int incY, float *A,
const int lda);
void cblas_sspr2(const enum CBLAS_ORDER order, const enum CBLAS_UPLO Uplo,
const int N, const float alpha, const float *X,
const int incX, const float *Y, const int incY, float *A);
void cblas_dsymv(const enum CBLAS_ORDER order, const enum CBLAS_UPLO Uplo,
const int N, const double alpha, const double *A,
const int lda, const double *X, const int incX,
const double beta, double *Y, const int incY);
void cblas_dsbmv(const enum CBLAS_ORDER order, const enum CBLAS_UPLO Uplo,
const int N, const int K, const double alpha, const double *A,
const int lda, const double *X, const int incX,
const double beta, double *Y, const int incY);
void cblas_dspmv(const enum CBLAS_ORDER order, const enum CBLAS_UPLO Uplo,
const int N, const double alpha, const double *Ap,
const double *X, const int incX,
const double beta, double *Y, const int incY);
void cblas_dger(const enum CBLAS_ORDER order, const int M, const int N,
const double alpha, const double *X, const int incX,
const double *Y, const int incY, double *A, const int lda);
void cblas_dsyr(const enum CBLAS_ORDER order, const enum CBLAS_UPLO Uplo,
const int N, const double alpha, const double *X,
const int incX, double *A, const int lda);
void cblas_dspr(const enum CBLAS_ORDER order, const enum CBLAS_UPLO Uplo,
const int N, const double alpha, const double *X,
const int incX, double *Ap);
void cblas_dsyr2(const enum CBLAS_ORDER order, const enum CBLAS_UPLO Uplo,
const int N, const double alpha, const double *X,
const int incX, const double *Y, const int incY, double *A,
const int lda);
void cblas_dspr2(const enum CBLAS_ORDER order, const enum CBLAS_UPLO Uplo,
const int N, const double alpha, const double *X,
const int incX, const double *Y, const int incY, double *A);
/*
* Routines with C and Z prefixes only
*/
void cblas_chemv(const enum CBLAS_ORDER order, const enum CBLAS_UPLO Uplo,
const int N, const void *alpha, const void *A,
const int lda, const void *X, const int incX,
const void *beta, void *Y, const int incY);
void cblas_chbmv(const enum CBLAS_ORDER order, const enum CBLAS_UPLO Uplo,
const int N, const int K, const void *alpha, const void *A,
const int lda, const void *X, const int incX,
const void *beta, void *Y, const int incY);
void cblas_chpmv(const enum CBLAS_ORDER order, const enum CBLAS_UPLO Uplo,
const int N, const void *alpha, const void *Ap,
const void *X, const int incX,
const void *beta, void *Y, const int incY);
void cblas_cgeru(const enum CBLAS_ORDER order, const int M, const int N,
const void *alpha, const void *X, const int incX,
const void *Y, const int incY, void *A, const int lda);
void cblas_cgerc(const enum CBLAS_ORDER order, const int M, const int N,
const void *alpha, const void *X, const int incX,
const void *Y, const int incY, void *A, const int lda);
void cblas_cher(const enum CBLAS_ORDER order, const enum CBLAS_UPLO Uplo,
const int N, const float alpha, const void *X, const int incX,
void *A, const int lda);
void cblas_chpr(const enum CBLAS_ORDER order, const enum CBLAS_UPLO Uplo,
const int N, const float alpha, const void *X,
const int incX, void *A);
void cblas_cher2(const enum CBLAS_ORDER order, const enum CBLAS_UPLO Uplo, const int N,
const void *alpha, const void *X, const int incX,
const void *Y, const int incY, void *A, const int lda);
void cblas_chpr2(const enum CBLAS_ORDER order, const enum CBLAS_UPLO Uplo, const int N,
const void *alpha, const void *X, const int incX,
const void *Y, const int incY, void *Ap);
void cblas_zhemv(const enum CBLAS_ORDER order, const enum CBLAS_UPLO Uplo,
const int N, const void *alpha, const void *A,
const int lda, const void *X, const int incX,
const void *beta, void *Y, const int incY);
void cblas_zhbmv(const enum CBLAS_ORDER order, const enum CBLAS_UPLO Uplo,
const int N, const int K, const void *alpha, const void *A,
const int lda, const void *X, const int incX,
const void *beta, void *Y, const int incY);
void cblas_zhpmv(const enum CBLAS_ORDER order, const enum CBLAS_UPLO Uplo,
const int N, const void *alpha, const void *Ap,
const void *X, const int incX,
const void *beta, void *Y, const int incY);
void cblas_zgeru(const enum CBLAS_ORDER order, const int M, const int N,
const void *alpha, const void *X, const int incX,
const void *Y, const int incY, void *A, const int lda);
void cblas_zgerc(const enum CBLAS_ORDER order, const int M, const int N,
const void *alpha, const void *X, const int incX,
const void *Y, const int incY, void *A, const int lda);
void cblas_zher(const enum CBLAS_ORDER order, const enum CBLAS_UPLO Uplo,
const int N, const double alpha, const void *X, const int incX,
void *A, const int lda);
void cblas_zhpr(const enum CBLAS_ORDER order, const enum CBLAS_UPLO Uplo,
const int N, const double alpha, const void *X,
const int incX, void *A);
void cblas_zher2(const enum CBLAS_ORDER order, const enum CBLAS_UPLO Uplo, const int N,
const void *alpha, const void *X, const int incX,
const void *Y, const int incY, void *A, const int lda);
void cblas_zhpr2(const enum CBLAS_ORDER order, const enum CBLAS_UPLO Uplo, const int N,
const void *alpha, const void *X, const int incX,
const void *Y, const int incY, void *Ap);
/*
* ===========================================================================
* Prototypes for level 3 BLAS
* ===========================================================================
*/
/*
* Routines with standard 4 prefixes (S, D, C, Z)
*/
void cblas_sgemm(const enum CBLAS_ORDER Order, const enum CBLAS_TRANSPOSE TransA,
const enum CBLAS_TRANSPOSE TransB, const int M, const int N,
const int K, const float alpha, const float *A,
const int lda, const float *B, const int ldb,
const float beta, float *C, const int ldc);
void cblas_ssymm(const enum CBLAS_ORDER Order, const enum CBLAS_SIDE Side,
const enum CBLAS_UPLO Uplo, const int M, const int N,
const float alpha, const float *A, const int lda,
const float *B, const int ldb, const float beta,
float *C, const int ldc);
void cblas_ssyrk(const enum CBLAS_ORDER Order, const enum CBLAS_UPLO Uplo,
const enum CBLAS_TRANSPOSE Trans, const int N, const int K,
const float alpha, const float *A, const int lda,
const float beta, float *C, const int ldc);
void cblas_ssyr2k(const enum CBLAS_ORDER Order, const enum CBLAS_UPLO Uplo,
const enum CBLAS_TRANSPOSE Trans, const int N, const int K,
const float alpha, const float *A, const int lda,
const float *B, const int ldb, const float beta,
float *C, const int ldc);
void cblas_strmm(const enum CBLAS_ORDER Order, const enum CBLAS_SIDE Side,
const enum CBLAS_UPLO Uplo, const enum CBLAS_TRANSPOSE TransA,
const enum CBLAS_DIAG Diag, const int M, const int N,
const float alpha, const float *A, const int lda,
float *B, const int ldb);
void cblas_strsm(const enum CBLAS_ORDER Order, const enum CBLAS_SIDE Side,
const enum CBLAS_UPLO Uplo, const enum CBLAS_TRANSPOSE TransA,
const enum CBLAS_DIAG Diag, const int M, const int N,
const float alpha, const float *A, const int lda,
float *B, const int ldb);
void cblas_dgemm(const enum CBLAS_ORDER Order, const enum CBLAS_TRANSPOSE TransA,
const enum CBLAS_TRANSPOSE TransB, const int M, const int N,
const int K, const double alpha, const double *A,
const int lda, const double *B, const int ldb,
const double beta, double *C, const int ldc);
void cblas_dsymm(const enum CBLAS_ORDER Order, const enum CBLAS_SIDE Side,
const enum CBLAS_UPLO Uplo, const int M, const int N,
const double alpha, const double *A, const int lda,
const double *B, const int ldb, const double beta,
double *C, const int ldc);
void cblas_dsyrk(const enum CBLAS_ORDER Order, const enum CBLAS_UPLO Uplo,
const enum CBLAS_TRANSPOSE Trans, const int N, const int K,
const double alpha, const double *A, const int lda,
const double beta, double *C, const int ldc);
void cblas_dsyr2k(const enum CBLAS_ORDER Order, const enum CBLAS_UPLO Uplo,
const enum CBLAS_TRANSPOSE Trans, const int N, const int K,
const double alpha, const double *A, const int lda,
const double *B, const int ldb, const double beta,
double *C, const int ldc);
void cblas_dtrmm(const enum CBLAS_ORDER Order, const enum CBLAS_SIDE Side,
const enum CBLAS_UPLO Uplo, const enum CBLAS_TRANSPOSE TransA,
const enum CBLAS_DIAG Diag, const int M, const int N,
const double alpha, const double *A, const int lda,
double *B, const int ldb);
void cblas_dtrsm(const enum CBLAS_ORDER Order, const enum CBLAS_SIDE Side,
const enum CBLAS_UPLO Uplo, const enum CBLAS_TRANSPOSE TransA,
const enum CBLAS_DIAG Diag, const int M, const int N,
const double alpha, const double *A, const int lda,
double *B, const int ldb);
void cblas_cgemm(const enum CBLAS_ORDER Order, const enum CBLAS_TRANSPOSE TransA,
const enum CBLAS_TRANSPOSE TransB, const int M, const int N,
const int K, const void *alpha, const void *A,
const int lda, const void *B, const int ldb,
const void *beta, void *C, const int ldc);
void cblas_csymm(const enum CBLAS_ORDER Order, const enum CBLAS_SIDE Side,
const enum CBLAS_UPLO Uplo, const int M, const int N,
const void *alpha, const void *A, const int lda,
const void *B, const int ldb, const void *beta,
void *C, const int ldc);
void cblas_csyrk(const enum CBLAS_ORDER Order, const enum CBLAS_UPLO Uplo,
const enum CBLAS_TRANSPOSE Trans, const int N, const int K,
const void *alpha, const void *A, const int lda,
const void *beta, void *C, const int ldc);
void cblas_csyr2k(const enum CBLAS_ORDER Order, const enum CBLAS_UPLO Uplo,
const enum CBLAS_TRANSPOSE Trans, const int N, const int K,
const void *alpha, const void *A, const int lda,
const void *B, const int ldb, const void *beta,
void *C, const int ldc);
void cblas_ctrmm(const enum CBLAS_ORDER Order, const enum CBLAS_SIDE Side,
const enum CBLAS_UPLO Uplo, const enum CBLAS_TRANSPOSE TransA,
const enum CBLAS_DIAG Diag, const int M, const int N,
const void *alpha, const void *A, const int lda,
void *B, const int ldb);
void cblas_ctrsm(const enum CBLAS_ORDER Order, const enum CBLAS_SIDE Side,
const enum CBLAS_UPLO Uplo, const enum CBLAS_TRANSPOSE TransA,
const enum CBLAS_DIAG Diag, const int M, const int N,
const void *alpha, const void *A, const int lda,
void *B, const int ldb);
void cblas_zgemm(const enum CBLAS_ORDER Order, const enum CBLAS_TRANSPOSE TransA,
const enum CBLAS_TRANSPOSE TransB, const int M, const int N,
const int K, const void *alpha, const void *A,
const int lda, const void *B, const int ldb,
const void *beta, void *C, const int ldc);
void cblas_zsymm(const enum CBLAS_ORDER Order, const enum CBLAS_SIDE Side,
const enum CBLAS_UPLO Uplo, const int M, const int N,
const void *alpha, const void *A, const int lda,
const void *B, const int ldb, const void *beta,
void *C, const int ldc);
void cblas_zsyrk(const enum CBLAS_ORDER Order, const enum CBLAS_UPLO Uplo,
const enum CBLAS_TRANSPOSE Trans, const int N, const int K,
const void *alpha, const void *A, const int lda,
const void *beta, void *C, const int ldc);
void cblas_zsyr2k(const enum CBLAS_ORDER Order, const enum CBLAS_UPLO Uplo,
const enum CBLAS_TRANSPOSE Trans, const int N, const int K,
const void *alpha, const void *A, const int lda,
const void *B, const int ldb, const void *beta,
void *C, const int ldc);
void cblas_ztrmm(const enum CBLAS_ORDER Order, const enum CBLAS_SIDE Side,
const enum CBLAS_UPLO Uplo, const enum CBLAS_TRANSPOSE TransA,
const enum CBLAS_DIAG Diag, const int M, const int N,
const void *alpha, const void *A, const int lda,
void *B, const int ldb);
void cblas_ztrsm(const enum CBLAS_ORDER Order, const enum CBLAS_SIDE Side,
const enum CBLAS_UPLO Uplo, const enum CBLAS_TRANSPOSE TransA,
const enum CBLAS_DIAG Diag, const int M, const int N,
const void *alpha, const void *A, const int lda,
void *B, const int ldb);
/*
* Routines with prefixes C and Z only
*/
void cblas_chemm(const enum CBLAS_ORDER Order, const enum CBLAS_SIDE Side,
const enum CBLAS_UPLO Uplo, const int M, const int N,
const void *alpha, const void *A, const int lda,
const void *B, const int ldb, const void *beta,
void *C, const int ldc);
void cblas_cherk(const enum CBLAS_ORDER Order, const enum CBLAS_UPLO Uplo,
const enum CBLAS_TRANSPOSE Trans, const int N, const int K,
const float alpha, const void *A, const int lda,
const float beta, void *C, const int ldc);
void cblas_cher2k(const enum CBLAS_ORDER Order, const enum CBLAS_UPLO Uplo,
const enum CBLAS_TRANSPOSE Trans, const int N, const int K,
const void *alpha, const void *A, const int lda,
const void *B, const int ldb, const float beta,
void *C, const int ldc);
void cblas_zhemm(const enum CBLAS_ORDER Order, const enum CBLAS_SIDE Side,
const enum CBLAS_UPLO Uplo, const int M, const int N,
const void *alpha, const void *A, const int lda,
const void *B, const int ldb, const void *beta,
void *C, const int ldc);
void cblas_zherk(const enum CBLAS_ORDER Order, const enum CBLAS_UPLO Uplo,
const enum CBLAS_TRANSPOSE Trans, const int N, const int K,
const double alpha, const void *A, const int lda,
const double beta, void *C, const int ldc);
void cblas_zher2k(const enum CBLAS_ORDER Order, const enum CBLAS_UPLO Uplo,
const enum CBLAS_TRANSPOSE Trans, const int N, const int K,
const void *alpha, const void *A, const int lda,
const void *B, const int ldb, const double beta,
void *C, const int ldc);
void cblas_xerbla(int p, const char *rout, const char *form, ...);
__END_DECLS
#endif /* __GSL_CBLAS_H__ */

View File

@ -0,0 +1,170 @@
/* cdf/gsl_cdf.h
*
* Copyright (C) 2002 Jason H. Stover.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or (at
* your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
/* Author: J. Stover */
#ifndef __GSL_CDF_H__
#define __GSL_CDF_H__
#undef __BEGIN_DECLS
#undef __END_DECLS
#ifdef __cplusplus
# define __BEGIN_DECLS extern "C" {
# define __END_DECLS }
#else
# define __BEGIN_DECLS /* empty */
# define __END_DECLS /* empty */
#endif
__BEGIN_DECLS
double gsl_cdf_ugaussian_P (const double x);
double gsl_cdf_ugaussian_Q (const double x);
double gsl_cdf_ugaussian_Pinv (const double P);
double gsl_cdf_ugaussian_Qinv (const double Q);
double gsl_cdf_gaussian_P (const double x, const double sigma);
double gsl_cdf_gaussian_Q (const double x, const double sigma);
double gsl_cdf_gaussian_Pinv (const double P, const double sigma);
double gsl_cdf_gaussian_Qinv (const double Q, const double sigma);
double gsl_cdf_gamma_P (const double x, const double a, const double b);
double gsl_cdf_gamma_Q (const double x, const double a, const double b);
double gsl_cdf_gamma_Pinv (const double P, const double a, const double b);
double gsl_cdf_gamma_Qinv (const double Q, const double a, const double b);
double gsl_cdf_cauchy_P (const double x, const double a);
double gsl_cdf_cauchy_Q (const double x, const double a);
double gsl_cdf_cauchy_Pinv (const double P, const double a);
double gsl_cdf_cauchy_Qinv (const double Q, const double a);
double gsl_cdf_laplace_P (const double x, const double a);
double gsl_cdf_laplace_Q (const double x, const double a);
double gsl_cdf_laplace_Pinv (const double P, const double a);
double gsl_cdf_laplace_Qinv (const double Q, const double a);
double gsl_cdf_rayleigh_P (const double x, const double sigma);
double gsl_cdf_rayleigh_Q (const double x, const double sigma);
double gsl_cdf_rayleigh_Pinv (const double P, const double sigma);
double gsl_cdf_rayleigh_Qinv (const double Q, const double sigma);
double gsl_cdf_chisq_P (const double x, const double nu);
double gsl_cdf_chisq_Q (const double x, const double nu);
double gsl_cdf_chisq_Pinv (const double P, const double nu);
double gsl_cdf_chisq_Qinv (const double Q, const double nu);
double gsl_cdf_exponential_P (const double x, const double mu);
double gsl_cdf_exponential_Q (const double x, const double mu);
double gsl_cdf_exponential_Pinv (const double P, const double mu);
double gsl_cdf_exponential_Qinv (const double Q, const double mu);
double gsl_cdf_exppow_P (const double x, const double a, const double b);
double gsl_cdf_exppow_Q (const double x, const double a, const double b);
double gsl_cdf_tdist_P (const double x, const double nu);
double gsl_cdf_tdist_Q (const double x, const double nu);
double gsl_cdf_tdist_Pinv (const double P, const double nu);
double gsl_cdf_tdist_Qinv (const double Q, const double nu);
double gsl_cdf_fdist_P (const double x, const double nu1, const double nu2);
double gsl_cdf_fdist_Q (const double x, const double nu1, const double nu2);
double gsl_cdf_fdist_Pinv (const double P, const double nu1, const double nu2);
double gsl_cdf_fdist_Qinv (const double Q, const double nu1, const double nu2);
double gsl_cdf_beta_P (const double x, const double a, const double b);
double gsl_cdf_beta_Q (const double x, const double a, const double b);
double gsl_cdf_beta_Pinv (const double P, const double a, const double b);
double gsl_cdf_beta_Qinv (const double Q, const double a, const double b);
double gsl_cdf_flat_P (const double x, const double a, const double b);
double gsl_cdf_flat_Q (const double x, const double a, const double b);
double gsl_cdf_flat_Pinv (const double P, const double a, const double b);
double gsl_cdf_flat_Qinv (const double Q, const double a, const double b);
double gsl_cdf_lognormal_P (const double x, const double zeta, const double sigma);
double gsl_cdf_lognormal_Q (const double x, const double zeta, const double sigma);
double gsl_cdf_lognormal_Pinv (const double P, const double zeta, const double sigma);
double gsl_cdf_lognormal_Qinv (const double Q, const double zeta, const double sigma);
double gsl_cdf_gumbel1_P (const double x, const double a, const double b);
double gsl_cdf_gumbel1_Q (const double x, const double a, const double b);
double gsl_cdf_gumbel1_Pinv (const double P, const double a, const double b);
double gsl_cdf_gumbel1_Qinv (const double Q, const double a, const double b);
double gsl_cdf_gumbel2_P (const double x, const double a, const double b);
double gsl_cdf_gumbel2_Q (const double x, const double a, const double b);
double gsl_cdf_gumbel2_Pinv (const double P, const double a, const double b);
double gsl_cdf_gumbel2_Qinv (const double Q, const double a, const double b);
double gsl_cdf_weibull_P (const double x, const double a, const double b);
double gsl_cdf_weibull_Q (const double x, const double a, const double b);
double gsl_cdf_weibull_Pinv (const double P, const double a, const double b);
double gsl_cdf_weibull_Qinv (const double Q, const double a, const double b);
double gsl_cdf_pareto_P (const double x, const double a, const double b);
double gsl_cdf_pareto_Q (const double x, const double a, const double b);
double gsl_cdf_pareto_Pinv (const double P, const double a, const double b);
double gsl_cdf_pareto_Qinv (const double Q, const double a, const double b);
double gsl_cdf_logistic_P (const double x, const double a);
double gsl_cdf_logistic_Q (const double x, const double a);
double gsl_cdf_logistic_Pinv (const double P, const double a);
double gsl_cdf_logistic_Qinv (const double Q, const double a);
double gsl_cdf_binomial_P (const unsigned int k, const double p, const unsigned int n);
double gsl_cdf_binomial_Q (const unsigned int k, const double p, const unsigned int n);
double gsl_cdf_poisson_P (const unsigned int k, const double mu);
double gsl_cdf_poisson_Q (const unsigned int k, const double mu);
double gsl_cdf_geometric_P (const unsigned int k, const double p);
double gsl_cdf_geometric_Q (const unsigned int k, const double p);
double gsl_cdf_negative_binomial_P (const unsigned int k, const double p, const double n);
double gsl_cdf_negative_binomial_Q (const unsigned int k, const double p, const double n);
double gsl_cdf_pascal_P (const unsigned int k, const double p, const unsigned int n);
double gsl_cdf_pascal_Q (const unsigned int k, const double p, const unsigned int n);
double gsl_cdf_hypergeometric_P (const unsigned int k, const unsigned int n1,
const unsigned int n2, const unsigned int t);
double gsl_cdf_hypergeometric_Q (const unsigned int k, const unsigned int n1,
const unsigned int n2, const unsigned int t);
__END_DECLS
#endif /* __GSL_CDF_H__ */

View File

@ -0,0 +1,134 @@
/* cheb/gsl_chebyshev.h
*
* Copyright (C) 1996, 1997, 1998, 1999, 2000 Gerard Jungman
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or (at
* your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef __GSL_CHEBYSHEV_H__
#define __GSL_CHEBYSHEV_H__
#include <stdlib.h>
#include <gsl/gsl_math.h>
#include <gsl/gsl_mode.h>
#undef __BEGIN_DECLS
#undef __END_DECLS
#ifdef __cplusplus
# define __BEGIN_DECLS extern "C" {
# define __END_DECLS }
#else
# define __BEGIN_DECLS /* empty */
# define __END_DECLS /* empty */
#endif
__BEGIN_DECLS
/* data for a Chebyshev series over a given interval */
struct gsl_cheb_series_struct {
double * c; /* coefficients */
size_t order; /* order of expansion */
double a; /* lower interval point */
double b; /* upper interval point */
/* The following exists (mostly) for the benefit
* of the implementation. It is an effective single
* precision order, for use in single precision
* evaluation. Users can use it if they like, but
* only they know how to calculate it, since it is
* specific to the approximated function. By default,
* order_sp = order.
* It is used explicitly only by the gsl_cheb_eval_mode
* functions, which are not meant for casual use.
*/
size_t order_sp;
/* Additional elements not used by specfunc */
double * f; /* function evaluated at chebyschev points */
};
typedef struct gsl_cheb_series_struct gsl_cheb_series;
/* Calculate a Chebyshev series of specified order over
* a specified interval, for a given function.
* Return 0 on failure.
*/
gsl_cheb_series * gsl_cheb_alloc(const size_t order);
/* Free a Chebyshev series previously calculated with gsl_cheb_alloc().
*/
void gsl_cheb_free(gsl_cheb_series * cs);
/* Calculate a Chebyshev series using the storage provided.
* Uses the interval (a,b) and the order with which it
* was initially created.
*
*/
int gsl_cheb_init(gsl_cheb_series * cs, const gsl_function * func,
const double a, const double b);
/* Return the order, size of coefficient array and coefficient array ptr */
size_t gsl_cheb_order (const gsl_cheb_series * cs);
size_t gsl_cheb_size (const gsl_cheb_series * cs);
double *gsl_cheb_coeffs (const gsl_cheb_series * cs);
/* Evaluate a Chebyshev series at a given point.
* No errors can occur for a struct obtained from gsl_cheb_new().
*/
double gsl_cheb_eval(const gsl_cheb_series * cs, const double x);
int gsl_cheb_eval_err(const gsl_cheb_series * cs, const double x,
double * result, double * abserr);
/* Evaluate a Chebyshev series at a given point, to (at most) the given order.
* No errors can occur for a struct obtained from gsl_cheb_new().
*/
double gsl_cheb_eval_n(const gsl_cheb_series * cs, const size_t order,
const double x);
int gsl_cheb_eval_n_err(const gsl_cheb_series * cs, const size_t order,
const double x, double * result, double * abserr);
/* Evaluate a Chebyshev series at a given point, using the default
* order for double precision mode(s) and the single precision
* order for other modes.
* No errors can occur for a struct obtained from gsl_cheb_new().
*/
double gsl_cheb_eval_mode(const gsl_cheb_series * cs, const double x, gsl_mode_t mode);
int gsl_cheb_eval_mode_e(const gsl_cheb_series * cs, const double x, gsl_mode_t mode, double * result, double * abserr);
/* Compute the derivative of a Chebyshev series.
*/
int gsl_cheb_calc_deriv(gsl_cheb_series * deriv, const gsl_cheb_series * cs);
/* Compute the integral of a Chebyshev series. The
* integral is fixed by the condition that it equals zero at
* the left end-point, ie it is precisely
* Integrate[cs(t; a,b), {t, a, x}]
*/
int gsl_cheb_calc_integ(gsl_cheb_series * integ, const gsl_cheb_series * cs);
__END_DECLS
#endif /* __GSL_CHEBYSHEV_H__ */

View File

@ -0,0 +1,57 @@
/* vector/gsl_check_range.h
*
* Copyright (C) 2003, 2004, 2007 Brian Gough
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or (at
* your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef __GSL_CHECK_RANGE_H__
#define __GSL_CHECK_RANGE_H__
#include <stdlib.h>
#include <gsl/gsl_types.h>
#undef __BEGIN_DECLS
#undef __END_DECLS
#ifdef __cplusplus
# define __BEGIN_DECLS extern "C" {
# define __END_DECLS }
#else
# define __BEGIN_DECLS /* empty */
# define __END_DECLS /* empty */
#endif
__BEGIN_DECLS
GSL_VAR int gsl_check_range;
/* Turn range checking on by default, unless the user defines
GSL_RANGE_CHECK_OFF, or defines GSL_RANGE_CHECK to 0 explicitly */
#ifdef GSL_RANGE_CHECK_OFF
# ifndef GSL_RANGE_CHECK
# define GSL_RANGE_CHECK 0
# else
# error "cannot set both GSL_RANGE_CHECK and GSL_RANGE_CHECK_OFF"
# endif
#else
# ifndef GSL_RANGE_CHECK
# define GSL_RANGE_CHECK 1
# endif
#endif
__END_DECLS
#endif /* __GSL_CHECK_RANGE_H__ */

View File

@ -0,0 +1,92 @@
/* combination/gsl_combination.h
* based on permutation/gsl_permutation.h by Brian Gough
*
* Copyright (C) 2001 Szymon Jaroszewicz
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or (at
* your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef __GSL_COMBINATION_H__
#define __GSL_COMBINATION_H__
#include <stdlib.h>
#include <gsl/gsl_errno.h>
#include <gsl/gsl_types.h>
#include <gsl/gsl_inline.h>
#include <gsl/gsl_check_range.h>
#undef __BEGIN_DECLS
#undef __END_DECLS
#ifdef __cplusplus
# define __BEGIN_DECLS extern "C" {
# define __END_DECLS }
#else
# define __BEGIN_DECLS /* empty */
# define __END_DECLS /* empty */
#endif
__BEGIN_DECLS
struct gsl_combination_struct
{
size_t n;
size_t k;
size_t *data;
};
typedef struct gsl_combination_struct gsl_combination;
gsl_combination *gsl_combination_alloc (const size_t n, const size_t k);
gsl_combination *gsl_combination_calloc (const size_t n, const size_t k);
void gsl_combination_init_first (gsl_combination * c);
void gsl_combination_init_last (gsl_combination * c);
void gsl_combination_free (gsl_combination * c);
int gsl_combination_memcpy (gsl_combination * dest, const gsl_combination * src);
int gsl_combination_fread (FILE * stream, gsl_combination * c);
int gsl_combination_fwrite (FILE * stream, const gsl_combination * c);
int gsl_combination_fscanf (FILE * stream, gsl_combination * c);
int gsl_combination_fprintf (FILE * stream, const gsl_combination * c, const char *format);
size_t gsl_combination_n (const gsl_combination * c);
size_t gsl_combination_k (const gsl_combination * c);
size_t * gsl_combination_data (const gsl_combination * c);
int gsl_combination_valid (gsl_combination * c);
int gsl_combination_next (gsl_combination * c);
int gsl_combination_prev (gsl_combination * c);
INLINE_DECL size_t gsl_combination_get (const gsl_combination * c, const size_t i);
#ifdef HAVE_INLINE
INLINE_FUN
size_t
gsl_combination_get (const gsl_combination * c, const size_t i)
{
#if GSL_RANGE_CHECK
if (GSL_RANGE_COND(i >= c->k)) /* size_t is unsigned, can't be negative */
{
GSL_ERROR_VAL ("index out of range", GSL_EINVAL, 0);
}
#endif
return c->data[i];
}
#endif /* HAVE_INLINE */
__END_DECLS
#endif /* __GSL_COMBINATION_H__ */

View File

@ -0,0 +1,144 @@
/* complex/gsl_complex.h
*
* Copyright (C) 1996, 1997, 1998, 1999, 2000, 2007 Gerard Jungman, Brian Gough
* Copyright (C) 2020, 2021 Patrick Alken
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or (at
* your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef __GSL_COMPLEX_H__
#define __GSL_COMPLEX_H__
#undef __BEGIN_DECLS
#undef __END_DECLS
#ifdef __cplusplus
# define __BEGIN_DECLS extern "C" {
# define __END_DECLS }
#else
# define __BEGIN_DECLS /* empty */
# define __END_DECLS /* empty */
#endif
__BEGIN_DECLS
/* two consecutive built-in types as a complex number */
typedef double * gsl_complex_packed ;
typedef float * gsl_complex_packed_float ;
typedef long double * gsl_complex_packed_long_double ;
typedef const double * gsl_const_complex_packed ;
typedef const float * gsl_const_complex_packed_float ;
typedef const long double * gsl_const_complex_packed_long_double ;
/* 2N consecutive built-in types as N complex numbers */
typedef double * gsl_complex_packed_array ;
typedef float * gsl_complex_packed_array_float ;
typedef long double * gsl_complex_packed_array_long_double ;
typedef const double * gsl_const_complex_packed_array ;
typedef const float * gsl_const_complex_packed_array_float ;
typedef const long double * gsl_const_complex_packed_array_long_double ;
/* Yes... this seems weird. Trust us. The point is just that
sometimes you want to make it obvious that something is
an output value. The fact that it lacks a 'const' may not
be enough of a clue for people in some contexts.
*/
typedef double * gsl_complex_packed_ptr ;
typedef float * gsl_complex_packed_float_ptr ;
typedef long double * gsl_complex_packed_long_double_ptr ;
typedef const double * gsl_const_complex_packed_ptr ;
typedef const float * gsl_const_complex_packed_float_ptr ;
typedef const long double * gsl_const_complex_packed_long_double_ptr ;
/*
* If <complex.h> is included, use the C99 complex type. Otherwise
* define a type bit-compatible with C99 complex. The GSL_REAL and GSL_IMAG
* macros require C11 functionality also (_Generic)
*/
/* older gcc compilers claim to be C11 compliant but do not support _Generic */
#if defined(__GNUC__) && (__GNUC__ < 7)
# define GSL_COMPLEX_LEGACY 1
#endif
#if !defined(GSL_COMPLEX_LEGACY) && \
defined(_Complex_I) && \
defined(complex) && \
defined(I) && \
defined(__STDC__) && (__STDC__ == 1) && \
defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 201112L) /* C11 */
# define GSL_COMPLEX_DEFINE(R, C) typedef R _Complex C ;
# define GSL_COMPLEX_P(zp) (&(zp))
# define GSL_COMPLEX_EQ(z1,z2) ((z1) == (z2))
# define GSL_SET_COMPLEX(zp,x,y) (*(zp) = (x) + I * (y))
# define GSL_REAL(z) (_Generic((z), \
complex float : ((float *) &(z)), \
complex double : ((double *) &(z)), \
complex long double : ((long double *) &(z)))[0])
# define GSL_IMAG(z) (_Generic((z), \
complex float : ((float *) &(z)), \
complex double : ((double *) &(z)), \
complex long double : ((long double *) &(z)))[1])
# define GSL_COMPLEX_P_REAL(zp) GSL_REAL(*(zp))
# define GSL_COMPLEX_P_IMAG(zp) GSL_IMAG(*(zp))
# define GSL_SET_REAL(zp,x) do { GSL_REAL(*(zp)) = (x); } while(0)
# define GSL_SET_IMAG(zp,x) do { GSL_IMAG(*(zp)) = (x); } while(0)
#else /* legacy complex definitions */
/*
* According to the C17 standard, 6.2.5 paragraph 13:
*
* "Each complex type has the same representation and alignment requirements
* as an array type containing exactly two elements of the corresponding real
* type; the first element is equal to the real part, and the second element to
* the imaginary part, of the complex number."
*/
/*# define GSL_COMPLEX_DEFINE(R, C) typedef R C[2]*/
# define GSL_COMPLEX_DEFINE(R, C) typedef struct { R dat[2]; } C ;
# define GSL_REAL(z) ((z).dat[0])
# define GSL_IMAG(z) ((z).dat[1])
# define GSL_COMPLEX_P(zp) ((zp)->dat)
# define GSL_COMPLEX_P_REAL(zp) ((zp)->dat[0])
# define GSL_COMPLEX_P_IMAG(zp) ((zp)->dat[1])
# define GSL_COMPLEX_EQ(z1,z2) (((z1).dat[0] == (z2).dat[0]) && ((z1).dat[1] == (z2).dat[1]))
# define GSL_SET_COMPLEX(zp,x,y) do {(zp)->dat[0]=(x); (zp)->dat[1]=(y);} while(0)
# define GSL_SET_REAL(zp,x) do {(zp)->dat[0]=(x);} while(0)
# define GSL_SET_IMAG(zp,y) do {(zp)->dat[1]=(y);} while(0)
#endif
GSL_COMPLEX_DEFINE(double, gsl_complex)
GSL_COMPLEX_DEFINE(long double, gsl_complex_long_double)
GSL_COMPLEX_DEFINE(float, gsl_complex_float)
#define GSL_SET_COMPLEX_PACKED(zp,n,x,y) do {*((zp)+2*(n))=(x); *((zp)+(2*(n)+1))=(y);} while(0)
__END_DECLS
#endif /* __GSL_COMPLEX_H__ */

View File

@ -0,0 +1,142 @@
/* complex/gsl_complex_math.h
*
* Copyright (C) 1996, 1997, 1998, 1999, 2000, 2004, 2007 Jorma Olavi Tähtinen, Brian Gough
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or (at
* your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef __GSL_COMPLEX_MATH_H__
#define __GSL_COMPLEX_MATH_H__
#include <gsl/gsl_inline.h>
#include <gsl/gsl_complex.h>
#undef __BEGIN_DECLS
#undef __END_DECLS
#ifdef __cplusplus
#define __BEGIN_DECLS extern "C" {
#define __END_DECLS }
#else
#define __BEGIN_DECLS /* empty */
#define __END_DECLS /* empty */
#endif
__BEGIN_DECLS
/* Complex numbers */
gsl_complex gsl_complex_polar (double r, double theta); /* r= r e^(i theta) */
INLINE_DECL gsl_complex gsl_complex_rect (double x, double y); /* r= real+i*imag */
#ifdef HAVE_INLINE
INLINE_FUN gsl_complex
gsl_complex_rect (double x, double y)
{ /* return z = x + i y */
gsl_complex z;
GSL_SET_COMPLEX (&z, x, y);
return z;
}
#endif
#define GSL_COMPLEX_ONE (gsl_complex_rect(1.0,0.0))
#define GSL_COMPLEX_ZERO (gsl_complex_rect(0.0,0.0))
#define GSL_COMPLEX_NEGONE (gsl_complex_rect(-1.0,0.0))
/* Properties of complex numbers */
double gsl_complex_arg (gsl_complex z); /* return arg(z), -pi< arg(z) <=+pi */
double gsl_complex_abs (gsl_complex z); /* return |z| */
double gsl_complex_abs2 (gsl_complex z); /* return |z|^2 */
double gsl_complex_logabs (gsl_complex z); /* return log|z| */
/* Complex arithmetic operators */
gsl_complex gsl_complex_add (gsl_complex a, gsl_complex b); /* r=a+b */
gsl_complex gsl_complex_sub (gsl_complex a, gsl_complex b); /* r=a-b */
gsl_complex gsl_complex_mul (gsl_complex a, gsl_complex b); /* r=a*b */
gsl_complex gsl_complex_div (gsl_complex a, gsl_complex b); /* r=a/b */
gsl_complex gsl_complex_add_real (gsl_complex a, double x); /* r=a+x */
gsl_complex gsl_complex_sub_real (gsl_complex a, double x); /* r=a-x */
gsl_complex gsl_complex_mul_real (gsl_complex a, double x); /* r=a*x */
gsl_complex gsl_complex_div_real (gsl_complex a, double x); /* r=a/x */
gsl_complex gsl_complex_add_imag (gsl_complex a, double y); /* r=a+iy */
gsl_complex gsl_complex_sub_imag (gsl_complex a, double y); /* r=a-iy */
gsl_complex gsl_complex_mul_imag (gsl_complex a, double y); /* r=a*iy */
gsl_complex gsl_complex_div_imag (gsl_complex a, double y); /* r=a/iy */
gsl_complex gsl_complex_conjugate (gsl_complex z); /* r=conj(z) */
gsl_complex gsl_complex_inverse (gsl_complex a); /* r=1/a */
gsl_complex gsl_complex_negative (gsl_complex a); /* r=-a */
/* Elementary Complex Functions */
gsl_complex gsl_complex_sqrt (gsl_complex z); /* r=sqrt(z) */
gsl_complex gsl_complex_sqrt_real (double x); /* r=sqrt(x) (x<0 ok) */
gsl_complex gsl_complex_pow (gsl_complex a, gsl_complex b); /* r=a^b */
gsl_complex gsl_complex_pow_real (gsl_complex a, double b); /* r=a^b */
gsl_complex gsl_complex_exp (gsl_complex a); /* r=exp(a) */
gsl_complex gsl_complex_log (gsl_complex a); /* r=log(a) (base e) */
gsl_complex gsl_complex_log10 (gsl_complex a); /* r=log10(a) (base 10) */
gsl_complex gsl_complex_log_b (gsl_complex a, gsl_complex b); /* r=log_b(a) (base=b) */
/* Complex Trigonometric Functions */
gsl_complex gsl_complex_sin (gsl_complex a); /* r=sin(a) */
gsl_complex gsl_complex_cos (gsl_complex a); /* r=cos(a) */
gsl_complex gsl_complex_sec (gsl_complex a); /* r=sec(a) */
gsl_complex gsl_complex_csc (gsl_complex a); /* r=csc(a) */
gsl_complex gsl_complex_tan (gsl_complex a); /* r=tan(a) */
gsl_complex gsl_complex_cot (gsl_complex a); /* r=cot(a) */
/* Inverse Complex Trigonometric Functions */
gsl_complex gsl_complex_arcsin (gsl_complex a); /* r=arcsin(a) */
gsl_complex gsl_complex_arcsin_real (double a); /* r=arcsin(a) */
gsl_complex gsl_complex_arccos (gsl_complex a); /* r=arccos(a) */
gsl_complex gsl_complex_arccos_real (double a); /* r=arccos(a) */
gsl_complex gsl_complex_arcsec (gsl_complex a); /* r=arcsec(a) */
gsl_complex gsl_complex_arcsec_real (double a); /* r=arcsec(a) */
gsl_complex gsl_complex_arccsc (gsl_complex a); /* r=arccsc(a) */
gsl_complex gsl_complex_arccsc_real (double a); /* r=arccsc(a) */
gsl_complex gsl_complex_arctan (gsl_complex a); /* r=arctan(a) */
gsl_complex gsl_complex_arccot (gsl_complex a); /* r=arccot(a) */
/* Complex Hyperbolic Functions */
gsl_complex gsl_complex_sinh (gsl_complex a); /* r=sinh(a) */
gsl_complex gsl_complex_cosh (gsl_complex a); /* r=coshh(a) */
gsl_complex gsl_complex_sech (gsl_complex a); /* r=sech(a) */
gsl_complex gsl_complex_csch (gsl_complex a); /* r=csch(a) */
gsl_complex gsl_complex_tanh (gsl_complex a); /* r=tanh(a) */
gsl_complex gsl_complex_coth (gsl_complex a); /* r=coth(a) */
/* Inverse Complex Hyperbolic Functions */
gsl_complex gsl_complex_arcsinh (gsl_complex a); /* r=arcsinh(a) */
gsl_complex gsl_complex_arccosh (gsl_complex a); /* r=arccosh(a) */
gsl_complex gsl_complex_arccosh_real (double a); /* r=arccosh(a) */
gsl_complex gsl_complex_arcsech (gsl_complex a); /* r=arcsech(a) */
gsl_complex gsl_complex_arccsch (gsl_complex a); /* r=arccsch(a) */
gsl_complex gsl_complex_arctanh (gsl_complex a); /* r=arctanh(a) */
gsl_complex gsl_complex_arctanh_real (double a); /* r=arctanh(a) */
gsl_complex gsl_complex_arccoth (gsl_complex a); /* r=arccoth(a) */
__END_DECLS
#endif /* __GSL_COMPLEX_MATH_H__ */

View File

@ -0,0 +1,31 @@
/* const/gsl_const.h
*
* Copyright (C) 1996, 1997, 1998, 1999, 2000, 2004, 2007 Brian Gough
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or (at
* your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef __GSL_CONST__
#define __GSL_CONST__
#include <gsl/gsl_const_num.h>
#include <gsl/gsl_const_cgs.h>
#include <gsl/gsl_const_mks.h>
#include <gsl/gsl_const_cgsm.h>
#include <gsl/gsl_const_mksa.h>
#endif /* __GSL_CONST__ */

View File

@ -0,0 +1,116 @@
/* const/gsl_const_cgs.h
*
* Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005,
* 2006, 2007, 2008, 2009 Brian Gough
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or (at
* your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef __GSL_CONST_CGS__
#define __GSL_CONST_CGS__
#define GSL_CONST_CGS_SPEED_OF_LIGHT (2.99792458e10) /* cm / s */
#define GSL_CONST_CGS_GRAVITATIONAL_CONSTANT (6.673e-8) /* cm^3 / g s^2 */
#define GSL_CONST_CGS_PLANCKS_CONSTANT_H (6.62606896e-27) /* g cm^2 / s */
#define GSL_CONST_CGS_PLANCKS_CONSTANT_HBAR (1.05457162825e-27) /* g cm^2 / s */
#define GSL_CONST_CGS_ASTRONOMICAL_UNIT (1.49597870691e13) /* cm */
#define GSL_CONST_CGS_LIGHT_YEAR (9.46053620707e17) /* cm */
#define GSL_CONST_CGS_PARSEC (3.08567758135e18) /* cm */
#define GSL_CONST_CGS_GRAV_ACCEL (9.80665e2) /* cm / s^2 */
#define GSL_CONST_CGS_ELECTRON_VOLT (1.602176487e-12) /* g cm^2 / s^2 */
#define GSL_CONST_CGS_MASS_ELECTRON (9.10938188e-28) /* g */
#define GSL_CONST_CGS_MASS_MUON (1.88353109e-25) /* g */
#define GSL_CONST_CGS_MASS_PROTON (1.67262158e-24) /* g */
#define GSL_CONST_CGS_MASS_NEUTRON (1.67492716e-24) /* g */
#define GSL_CONST_CGS_RYDBERG (2.17987196968e-11) /* g cm^2 / s^2 */
#define GSL_CONST_CGS_BOLTZMANN (1.3806504e-16) /* g cm^2 / K s^2 */
#define GSL_CONST_CGS_MOLAR_GAS (8.314472e7) /* g cm^2 / K mol s^2 */
#define GSL_CONST_CGS_STANDARD_GAS_VOLUME (2.2710981e4) /* cm^3 / mol */
#define GSL_CONST_CGS_MINUTE (6e1) /* s */
#define GSL_CONST_CGS_HOUR (3.6e3) /* s */
#define GSL_CONST_CGS_DAY (8.64e4) /* s */
#define GSL_CONST_CGS_WEEK (6.048e5) /* s */
#define GSL_CONST_CGS_INCH (2.54e0) /* cm */
#define GSL_CONST_CGS_FOOT (3.048e1) /* cm */
#define GSL_CONST_CGS_YARD (9.144e1) /* cm */
#define GSL_CONST_CGS_MILE (1.609344e5) /* cm */
#define GSL_CONST_CGS_NAUTICAL_MILE (1.852e5) /* cm */
#define GSL_CONST_CGS_FATHOM (1.8288e2) /* cm */
#define GSL_CONST_CGS_MIL (2.54e-3) /* cm */
#define GSL_CONST_CGS_POINT (3.52777777778e-2) /* cm */
#define GSL_CONST_CGS_TEXPOINT (3.51459803515e-2) /* cm */
#define GSL_CONST_CGS_MICRON (1e-4) /* cm */
#define GSL_CONST_CGS_ANGSTROM (1e-8) /* cm */
#define GSL_CONST_CGS_HECTARE (1e8) /* cm^2 */
#define GSL_CONST_CGS_ACRE (4.04685642241e7) /* cm^2 */
#define GSL_CONST_CGS_BARN (1e-24) /* cm^2 */
#define GSL_CONST_CGS_LITER (1e3) /* cm^3 */
#define GSL_CONST_CGS_US_GALLON (3.78541178402e3) /* cm^3 */
#define GSL_CONST_CGS_QUART (9.46352946004e2) /* cm^3 */
#define GSL_CONST_CGS_PINT (4.73176473002e2) /* cm^3 */
#define GSL_CONST_CGS_CUP (2.36588236501e2) /* cm^3 */
#define GSL_CONST_CGS_FLUID_OUNCE (2.95735295626e1) /* cm^3 */
#define GSL_CONST_CGS_TABLESPOON (1.47867647813e1) /* cm^3 */
#define GSL_CONST_CGS_TEASPOON (4.92892159375e0) /* cm^3 */
#define GSL_CONST_CGS_CANADIAN_GALLON (4.54609e3) /* cm^3 */
#define GSL_CONST_CGS_UK_GALLON (4.546092e3) /* cm^3 */
#define GSL_CONST_CGS_MILES_PER_HOUR (4.4704e1) /* cm / s */
#define GSL_CONST_CGS_KILOMETERS_PER_HOUR (2.77777777778e1) /* cm / s */
#define GSL_CONST_CGS_KNOT (5.14444444444e1) /* cm / s */
#define GSL_CONST_CGS_POUND_MASS (4.5359237e2) /* g */
#define GSL_CONST_CGS_OUNCE_MASS (2.8349523125e1) /* g */
#define GSL_CONST_CGS_TON (9.0718474e5) /* g */
#define GSL_CONST_CGS_METRIC_TON (1e6) /* g */
#define GSL_CONST_CGS_UK_TON (1.0160469088e6) /* g */
#define GSL_CONST_CGS_TROY_OUNCE (3.1103475e1) /* g */
#define GSL_CONST_CGS_CARAT (2e-1) /* g */
#define GSL_CONST_CGS_UNIFIED_ATOMIC_MASS (1.660538782e-24) /* g */
#define GSL_CONST_CGS_GRAM_FORCE (9.80665e2) /* cm g / s^2 */
#define GSL_CONST_CGS_POUND_FORCE (4.44822161526e5) /* cm g / s^2 */
#define GSL_CONST_CGS_KILOPOUND_FORCE (4.44822161526e8) /* cm g / s^2 */
#define GSL_CONST_CGS_POUNDAL (1.38255e4) /* cm g / s^2 */
#define GSL_CONST_CGS_CALORIE (4.1868e7) /* g cm^2 / s^2 */
#define GSL_CONST_CGS_BTU (1.05505585262e10) /* g cm^2 / s^2 */
#define GSL_CONST_CGS_THERM (1.05506e15) /* g cm^2 / s^2 */
#define GSL_CONST_CGS_HORSEPOWER (7.457e9) /* g cm^2 / s^3 */
#define GSL_CONST_CGS_BAR (1e6) /* g / cm s^2 */
#define GSL_CONST_CGS_STD_ATMOSPHERE (1.01325e6) /* g / cm s^2 */
#define GSL_CONST_CGS_TORR (1.33322368421e3) /* g / cm s^2 */
#define GSL_CONST_CGS_METER_OF_MERCURY (1.33322368421e6) /* g / cm s^2 */
#define GSL_CONST_CGS_INCH_OF_MERCURY (3.38638815789e4) /* g / cm s^2 */
#define GSL_CONST_CGS_INCH_OF_WATER (2.490889e3) /* g / cm s^2 */
#define GSL_CONST_CGS_PSI (6.89475729317e4) /* g / cm s^2 */
#define GSL_CONST_CGS_POISE (1e0) /* g / cm s */
#define GSL_CONST_CGS_STOKES (1e0) /* cm^2 / s */
#define GSL_CONST_CGS_STILB (1e0) /* cd / cm^2 */
#define GSL_CONST_CGS_LUMEN (1e0) /* cd sr */
#define GSL_CONST_CGS_LUX (1e-4) /* cd sr / cm^2 */
#define GSL_CONST_CGS_PHOT (1e0) /* cd sr / cm^2 */
#define GSL_CONST_CGS_FOOTCANDLE (1.076e-3) /* cd sr / cm^2 */
#define GSL_CONST_CGS_LAMBERT (1e0) /* cd sr / cm^2 */
#define GSL_CONST_CGS_FOOTLAMBERT (1.07639104e-3) /* cd sr / cm^2 */
#define GSL_CONST_CGS_CURIE (3.7e10) /* 1 / s */
#define GSL_CONST_CGS_ROENTGEN (2.58e-7) /* A s / g */
#define GSL_CONST_CGS_RAD (1e2) /* cm^2 / s^2 */
#define GSL_CONST_CGS_SOLAR_MASS (1.98892e33) /* g */
#define GSL_CONST_CGS_BOHR_RADIUS (5.291772083e-9) /* cm */
#define GSL_CONST_CGS_NEWTON (1e5) /* cm g / s^2 */
#define GSL_CONST_CGS_DYNE (1e0) /* cm g / s^2 */
#define GSL_CONST_CGS_JOULE (1e7) /* g cm^2 / s^2 */
#define GSL_CONST_CGS_ERG (1e0) /* g cm^2 / s^2 */
#define GSL_CONST_CGS_STEFAN_BOLTZMANN_CONSTANT (5.67040047374e-5) /* g / K^4 s^3 */
#define GSL_CONST_CGS_THOMSON_CROSS_SECTION (6.65245893699e-25) /* cm^2 */
#endif /* __GSL_CONST_CGS__ */

View File

@ -0,0 +1,122 @@
/* const/gsl_const_cgsm.h
*
* Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005,
* 2006, 2007, 2008, 2009 Brian Gough
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or (at
* your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef __GSL_CONST_CGSM__
#define __GSL_CONST_CGSM__
#define GSL_CONST_CGSM_SPEED_OF_LIGHT (2.99792458e10) /* cm / s */
#define GSL_CONST_CGSM_GRAVITATIONAL_CONSTANT (6.673e-8) /* cm^3 / g s^2 */
#define GSL_CONST_CGSM_PLANCKS_CONSTANT_H (6.62606896e-27) /* g cm^2 / s */
#define GSL_CONST_CGSM_PLANCKS_CONSTANT_HBAR (1.05457162825e-27) /* g cm^2 / s */
#define GSL_CONST_CGSM_ASTRONOMICAL_UNIT (1.49597870691e13) /* cm */
#define GSL_CONST_CGSM_LIGHT_YEAR (9.46053620707e17) /* cm */
#define GSL_CONST_CGSM_PARSEC (3.08567758135e18) /* cm */
#define GSL_CONST_CGSM_GRAV_ACCEL (9.80665e2) /* cm / s^2 */
#define GSL_CONST_CGSM_ELECTRON_VOLT (1.602176487e-12) /* g cm^2 / s^2 */
#define GSL_CONST_CGSM_MASS_ELECTRON (9.10938188e-28) /* g */
#define GSL_CONST_CGSM_MASS_MUON (1.88353109e-25) /* g */
#define GSL_CONST_CGSM_MASS_PROTON (1.67262158e-24) /* g */
#define GSL_CONST_CGSM_MASS_NEUTRON (1.67492716e-24) /* g */
#define GSL_CONST_CGSM_RYDBERG (2.17987196968e-11) /* g cm^2 / s^2 */
#define GSL_CONST_CGSM_BOLTZMANN (1.3806504e-16) /* g cm^2 / K s^2 */
#define GSL_CONST_CGSM_MOLAR_GAS (8.314472e7) /* g cm^2 / K mol s^2 */
#define GSL_CONST_CGSM_STANDARD_GAS_VOLUME (2.2710981e4) /* cm^3 / mol */
#define GSL_CONST_CGSM_MINUTE (6e1) /* s */
#define GSL_CONST_CGSM_HOUR (3.6e3) /* s */
#define GSL_CONST_CGSM_DAY (8.64e4) /* s */
#define GSL_CONST_CGSM_WEEK (6.048e5) /* s */
#define GSL_CONST_CGSM_INCH (2.54e0) /* cm */
#define GSL_CONST_CGSM_FOOT (3.048e1) /* cm */
#define GSL_CONST_CGSM_YARD (9.144e1) /* cm */
#define GSL_CONST_CGSM_MILE (1.609344e5) /* cm */
#define GSL_CONST_CGSM_NAUTICAL_MILE (1.852e5) /* cm */
#define GSL_CONST_CGSM_FATHOM (1.8288e2) /* cm */
#define GSL_CONST_CGSM_MIL (2.54e-3) /* cm */
#define GSL_CONST_CGSM_POINT (3.52777777778e-2) /* cm */
#define GSL_CONST_CGSM_TEXPOINT (3.51459803515e-2) /* cm */
#define GSL_CONST_CGSM_MICRON (1e-4) /* cm */
#define GSL_CONST_CGSM_ANGSTROM (1e-8) /* cm */
#define GSL_CONST_CGSM_HECTARE (1e8) /* cm^2 */
#define GSL_CONST_CGSM_ACRE (4.04685642241e7) /* cm^2 */
#define GSL_CONST_CGSM_BARN (1e-24) /* cm^2 */
#define GSL_CONST_CGSM_LITER (1e3) /* cm^3 */
#define GSL_CONST_CGSM_US_GALLON (3.78541178402e3) /* cm^3 */
#define GSL_CONST_CGSM_QUART (9.46352946004e2) /* cm^3 */
#define GSL_CONST_CGSM_PINT (4.73176473002e2) /* cm^3 */
#define GSL_CONST_CGSM_CUP (2.36588236501e2) /* cm^3 */
#define GSL_CONST_CGSM_FLUID_OUNCE (2.95735295626e1) /* cm^3 */
#define GSL_CONST_CGSM_TABLESPOON (1.47867647813e1) /* cm^3 */
#define GSL_CONST_CGSM_TEASPOON (4.92892159375e0) /* cm^3 */
#define GSL_CONST_CGSM_CANADIAN_GALLON (4.54609e3) /* cm^3 */
#define GSL_CONST_CGSM_UK_GALLON (4.546092e3) /* cm^3 */
#define GSL_CONST_CGSM_MILES_PER_HOUR (4.4704e1) /* cm / s */
#define GSL_CONST_CGSM_KILOMETERS_PER_HOUR (2.77777777778e1) /* cm / s */
#define GSL_CONST_CGSM_KNOT (5.14444444444e1) /* cm / s */
#define GSL_CONST_CGSM_POUND_MASS (4.5359237e2) /* g */
#define GSL_CONST_CGSM_OUNCE_MASS (2.8349523125e1) /* g */
#define GSL_CONST_CGSM_TON (9.0718474e5) /* g */
#define GSL_CONST_CGSM_METRIC_TON (1e6) /* g */
#define GSL_CONST_CGSM_UK_TON (1.0160469088e6) /* g */
#define GSL_CONST_CGSM_TROY_OUNCE (3.1103475e1) /* g */
#define GSL_CONST_CGSM_CARAT (2e-1) /* g */
#define GSL_CONST_CGSM_UNIFIED_ATOMIC_MASS (1.660538782e-24) /* g */
#define GSL_CONST_CGSM_GRAM_FORCE (9.80665e2) /* cm g / s^2 */
#define GSL_CONST_CGSM_POUND_FORCE (4.44822161526e5) /* cm g / s^2 */
#define GSL_CONST_CGSM_KILOPOUND_FORCE (4.44822161526e8) /* cm g / s^2 */
#define GSL_CONST_CGSM_POUNDAL (1.38255e4) /* cm g / s^2 */
#define GSL_CONST_CGSM_CALORIE (4.1868e7) /* g cm^2 / s^2 */
#define GSL_CONST_CGSM_BTU (1.05505585262e10) /* g cm^2 / s^2 */
#define GSL_CONST_CGSM_THERM (1.05506e15) /* g cm^2 / s^2 */
#define GSL_CONST_CGSM_HORSEPOWER (7.457e9) /* g cm^2 / s^3 */
#define GSL_CONST_CGSM_BAR (1e6) /* g / cm s^2 */
#define GSL_CONST_CGSM_STD_ATMOSPHERE (1.01325e6) /* g / cm s^2 */
#define GSL_CONST_CGSM_TORR (1.33322368421e3) /* g / cm s^2 */
#define GSL_CONST_CGSM_METER_OF_MERCURY (1.33322368421e6) /* g / cm s^2 */
#define GSL_CONST_CGSM_INCH_OF_MERCURY (3.38638815789e4) /* g / cm s^2 */
#define GSL_CONST_CGSM_INCH_OF_WATER (2.490889e3) /* g / cm s^2 */
#define GSL_CONST_CGSM_PSI (6.89475729317e4) /* g / cm s^2 */
#define GSL_CONST_CGSM_POISE (1e0) /* g / cm s */
#define GSL_CONST_CGSM_STOKES (1e0) /* cm^2 / s */
#define GSL_CONST_CGSM_STILB (1e0) /* cd / cm^2 */
#define GSL_CONST_CGSM_LUMEN (1e0) /* cd sr */
#define GSL_CONST_CGSM_LUX (1e-4) /* cd sr / cm^2 */
#define GSL_CONST_CGSM_PHOT (1e0) /* cd sr / cm^2 */
#define GSL_CONST_CGSM_FOOTCANDLE (1.076e-3) /* cd sr / cm^2 */
#define GSL_CONST_CGSM_LAMBERT (1e0) /* cd sr / cm^2 */
#define GSL_CONST_CGSM_FOOTLAMBERT (1.07639104e-3) /* cd sr / cm^2 */
#define GSL_CONST_CGSM_CURIE (3.7e10) /* 1 / s */
#define GSL_CONST_CGSM_ROENTGEN (2.58e-8) /* abamp s / g */
#define GSL_CONST_CGSM_RAD (1e2) /* cm^2 / s^2 */
#define GSL_CONST_CGSM_SOLAR_MASS (1.98892e33) /* g */
#define GSL_CONST_CGSM_BOHR_RADIUS (5.291772083e-9) /* cm */
#define GSL_CONST_CGSM_NEWTON (1e5) /* cm g / s^2 */
#define GSL_CONST_CGSM_DYNE (1e0) /* cm g / s^2 */
#define GSL_CONST_CGSM_JOULE (1e7) /* g cm^2 / s^2 */
#define GSL_CONST_CGSM_ERG (1e0) /* g cm^2 / s^2 */
#define GSL_CONST_CGSM_STEFAN_BOLTZMANN_CONSTANT (5.67040047374e-5) /* g / K^4 s^3 */
#define GSL_CONST_CGSM_THOMSON_CROSS_SECTION (6.65245893699e-25) /* cm^2 */
#define GSL_CONST_CGSM_BOHR_MAGNETON (9.27400899e-21) /* abamp cm^2 */
#define GSL_CONST_CGSM_NUCLEAR_MAGNETON (5.05078317e-24) /* abamp cm^2 */
#define GSL_CONST_CGSM_ELECTRON_MAGNETIC_MOMENT (9.28476362e-21) /* abamp cm^2 */
#define GSL_CONST_CGSM_PROTON_MAGNETIC_MOMENT (1.410606633e-23) /* abamp cm^2 */
#define GSL_CONST_CGSM_FARADAY (9.64853429775e3) /* abamp s / mol */
#define GSL_CONST_CGSM_ELECTRON_CHARGE (1.602176487e-20) /* abamp s */
#endif /* __GSL_CONST_CGSM__ */

View File

@ -0,0 +1,126 @@
/* const/gsl_const_mks.h
*
* Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005,
* 2006, 2007, 2008, 2009 Brian Gough
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or (at
* your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef __GSL_CONST_MKS__
#define __GSL_CONST_MKS__
#define GSL_CONST_MKS_SPEED_OF_LIGHT (2.99792458e8) /* m / s */
#define GSL_CONST_MKS_GRAVITATIONAL_CONSTANT (6.673e-11) /* m^3 / kg s^2 */
#define GSL_CONST_MKS_PLANCKS_CONSTANT_H (6.62606896e-34) /* kg m^2 / s */
#define GSL_CONST_MKS_PLANCKS_CONSTANT_HBAR (1.05457162825e-34) /* kg m^2 / s */
#define GSL_CONST_MKS_ASTRONOMICAL_UNIT (1.49597870691e11) /* m */
#define GSL_CONST_MKS_LIGHT_YEAR (9.46053620707e15) /* m */
#define GSL_CONST_MKS_PARSEC (3.08567758135e16) /* m */
#define GSL_CONST_MKS_GRAV_ACCEL (9.80665e0) /* m / s^2 */
#define GSL_CONST_MKS_ELECTRON_VOLT (1.602176487e-19) /* kg m^2 / s^2 */
#define GSL_CONST_MKS_MASS_ELECTRON (9.10938188e-31) /* kg */
#define GSL_CONST_MKS_MASS_MUON (1.88353109e-28) /* kg */
#define GSL_CONST_MKS_MASS_PROTON (1.67262158e-27) /* kg */
#define GSL_CONST_MKS_MASS_NEUTRON (1.67492716e-27) /* kg */
#define GSL_CONST_MKS_RYDBERG (2.17987196968e-18) /* kg m^2 / s^2 */
#define GSL_CONST_MKS_BOLTZMANN (1.3806504e-23) /* kg m^2 / K s^2 */
#define GSL_CONST_MKS_MOLAR_GAS (8.314472e0) /* kg m^2 / K mol s^2 */
#define GSL_CONST_MKS_STANDARD_GAS_VOLUME (2.2710981e-2) /* m^3 / mol */
#define GSL_CONST_MKS_MINUTE (6e1) /* s */
#define GSL_CONST_MKS_HOUR (3.6e3) /* s */
#define GSL_CONST_MKS_DAY (8.64e4) /* s */
#define GSL_CONST_MKS_WEEK (6.048e5) /* s */
#define GSL_CONST_MKS_INCH (2.54e-2) /* m */
#define GSL_CONST_MKS_FOOT (3.048e-1) /* m */
#define GSL_CONST_MKS_YARD (9.144e-1) /* m */
#define GSL_CONST_MKS_MILE (1.609344e3) /* m */
#define GSL_CONST_MKS_NAUTICAL_MILE (1.852e3) /* m */
#define GSL_CONST_MKS_FATHOM (1.8288e0) /* m */
#define GSL_CONST_MKS_MIL (2.54e-5) /* m */
#define GSL_CONST_MKS_POINT (3.52777777778e-4) /* m */
#define GSL_CONST_MKS_TEXPOINT (3.51459803515e-4) /* m */
#define GSL_CONST_MKS_MICRON (1e-6) /* m */
#define GSL_CONST_MKS_ANGSTROM (1e-10) /* m */
#define GSL_CONST_MKS_HECTARE (1e4) /* m^2 */
#define GSL_CONST_MKS_ACRE (4.04685642241e3) /* m^2 */
#define GSL_CONST_MKS_BARN (1e-28) /* m^2 */
#define GSL_CONST_MKS_LITER (1e-3) /* m^3 */
#define GSL_CONST_MKS_US_GALLON (3.78541178402e-3) /* m^3 */
#define GSL_CONST_MKS_QUART (9.46352946004e-4) /* m^3 */
#define GSL_CONST_MKS_PINT (4.73176473002e-4) /* m^3 */
#define GSL_CONST_MKS_CUP (2.36588236501e-4) /* m^3 */
#define GSL_CONST_MKS_FLUID_OUNCE (2.95735295626e-5) /* m^3 */
#define GSL_CONST_MKS_TABLESPOON (1.47867647813e-5) /* m^3 */
#define GSL_CONST_MKS_TEASPOON (4.92892159375e-6) /* m^3 */
#define GSL_CONST_MKS_CANADIAN_GALLON (4.54609e-3) /* m^3 */
#define GSL_CONST_MKS_UK_GALLON (4.546092e-3) /* m^3 */
#define GSL_CONST_MKS_MILES_PER_HOUR (4.4704e-1) /* m / s */
#define GSL_CONST_MKS_KILOMETERS_PER_HOUR (2.77777777778e-1) /* m / s */
#define GSL_CONST_MKS_KNOT (5.14444444444e-1) /* m / s */
#define GSL_CONST_MKS_POUND_MASS (4.5359237e-1) /* kg */
#define GSL_CONST_MKS_OUNCE_MASS (2.8349523125e-2) /* kg */
#define GSL_CONST_MKS_TON (9.0718474e2) /* kg */
#define GSL_CONST_MKS_METRIC_TON (1e3) /* kg */
#define GSL_CONST_MKS_UK_TON (1.0160469088e3) /* kg */
#define GSL_CONST_MKS_TROY_OUNCE (3.1103475e-2) /* kg */
#define GSL_CONST_MKS_CARAT (2e-4) /* kg */
#define GSL_CONST_MKS_UNIFIED_ATOMIC_MASS (1.660538782e-27) /* kg */
#define GSL_CONST_MKS_GRAM_FORCE (9.80665e-3) /* kg m / s^2 */
#define GSL_CONST_MKS_POUND_FORCE (4.44822161526e0) /* kg m / s^2 */
#define GSL_CONST_MKS_KILOPOUND_FORCE (4.44822161526e3) /* kg m / s^2 */
#define GSL_CONST_MKS_POUNDAL (1.38255e-1) /* kg m / s^2 */
#define GSL_CONST_MKS_CALORIE (4.1868e0) /* kg m^2 / s^2 */
#define GSL_CONST_MKS_BTU (1.05505585262e3) /* kg m^2 / s^2 */
#define GSL_CONST_MKS_THERM (1.05506e8) /* kg m^2 / s^2 */
#define GSL_CONST_MKS_HORSEPOWER (7.457e2) /* kg m^2 / s^3 */
#define GSL_CONST_MKS_BAR (1e5) /* kg / m s^2 */
#define GSL_CONST_MKS_STD_ATMOSPHERE (1.01325e5) /* kg / m s^2 */
#define GSL_CONST_MKS_TORR (1.33322368421e2) /* kg / m s^2 */
#define GSL_CONST_MKS_METER_OF_MERCURY (1.33322368421e5) /* kg / m s^2 */
#define GSL_CONST_MKS_INCH_OF_MERCURY (3.38638815789e3) /* kg / m s^2 */
#define GSL_CONST_MKS_INCH_OF_WATER (2.490889e2) /* kg / m s^2 */
#define GSL_CONST_MKS_PSI (6.89475729317e3) /* kg / m s^2 */
#define GSL_CONST_MKS_POISE (1e-1) /* kg m^-1 s^-1 */
#define GSL_CONST_MKS_STOKES (1e-4) /* m^2 / s */
#define GSL_CONST_MKS_STILB (1e4) /* cd / m^2 */
#define GSL_CONST_MKS_LUMEN (1e0) /* cd sr */
#define GSL_CONST_MKS_LUX (1e0) /* cd sr / m^2 */
#define GSL_CONST_MKS_PHOT (1e4) /* cd sr / m^2 */
#define GSL_CONST_MKS_FOOTCANDLE (1.076e1) /* cd sr / m^2 */
#define GSL_CONST_MKS_LAMBERT (1e4) /* cd sr / m^2 */
#define GSL_CONST_MKS_FOOTLAMBERT (1.07639104e1) /* cd sr / m^2 */
#define GSL_CONST_MKS_CURIE (3.7e10) /* 1 / s */
#define GSL_CONST_MKS_ROENTGEN (2.58e-4) /* A s / kg */
#define GSL_CONST_MKS_RAD (1e-2) /* m^2 / s^2 */
#define GSL_CONST_MKS_SOLAR_MASS (1.98892e30) /* kg */
#define GSL_CONST_MKS_BOHR_RADIUS (5.291772083e-11) /* m */
#define GSL_CONST_MKS_NEWTON (1e0) /* kg m / s^2 */
#define GSL_CONST_MKS_DYNE (1e-5) /* kg m / s^2 */
#define GSL_CONST_MKS_JOULE (1e0) /* kg m^2 / s^2 */
#define GSL_CONST_MKS_ERG (1e-7) /* kg m^2 / s^2 */
#define GSL_CONST_MKS_STEFAN_BOLTZMANN_CONSTANT (5.67040047374e-8) /* kg / K^4 s^3 */
#define GSL_CONST_MKS_THOMSON_CROSS_SECTION (6.65245893699e-29) /* m^2 */
#define GSL_CONST_MKS_BOHR_MAGNETON (9.27400899e-24) /* A m^2 */
#define GSL_CONST_MKS_NUCLEAR_MAGNETON (5.05078317e-27) /* A m^2 */
#define GSL_CONST_MKS_ELECTRON_MAGNETIC_MOMENT (9.28476362e-24) /* A m^2 */
#define GSL_CONST_MKS_PROTON_MAGNETIC_MOMENT (1.410606633e-26) /* A m^2 */
#define GSL_CONST_MKS_FARADAY (9.64853429775e4) /* A s / mol */
#define GSL_CONST_MKS_ELECTRON_CHARGE (1.602176487e-19) /* A s */
#define GSL_CONST_MKS_VACUUM_PERMITTIVITY (8.854187817e-12) /* A^2 s^4 / kg m^3 */
#define GSL_CONST_MKS_VACUUM_PERMEABILITY (1.25663706144e-6) /* kg m / A^2 s^2 */
#define GSL_CONST_MKS_DEBYE (3.33564095198e-30) /* A s^2 / m^2 */
#define GSL_CONST_MKS_GAUSS (1e-4) /* kg / A s^2 */
#endif /* __GSL_CONST_MKS__ */

View File

@ -0,0 +1,126 @@
/* const/gsl_const_mksa.h
*
* Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005,
* 2006, 2007, 2008, 2009 Brian Gough
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or (at
* your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef __GSL_CONST_MKSA__
#define __GSL_CONST_MKSA__
#define GSL_CONST_MKSA_SPEED_OF_LIGHT (2.99792458e8) /* m / s */
#define GSL_CONST_MKSA_GRAVITATIONAL_CONSTANT (6.673e-11) /* m^3 / kg s^2 */
#define GSL_CONST_MKSA_PLANCKS_CONSTANT_H (6.62606896e-34) /* kg m^2 / s */
#define GSL_CONST_MKSA_PLANCKS_CONSTANT_HBAR (1.05457162825e-34) /* kg m^2 / s */
#define GSL_CONST_MKSA_ASTRONOMICAL_UNIT (1.49597870691e11) /* m */
#define GSL_CONST_MKSA_LIGHT_YEAR (9.46053620707e15) /* m */
#define GSL_CONST_MKSA_PARSEC (3.08567758135e16) /* m */
#define GSL_CONST_MKSA_GRAV_ACCEL (9.80665e0) /* m / s^2 */
#define GSL_CONST_MKSA_ELECTRON_VOLT (1.602176487e-19) /* kg m^2 / s^2 */
#define GSL_CONST_MKSA_MASS_ELECTRON (9.10938188e-31) /* kg */
#define GSL_CONST_MKSA_MASS_MUON (1.88353109e-28) /* kg */
#define GSL_CONST_MKSA_MASS_PROTON (1.67262158e-27) /* kg */
#define GSL_CONST_MKSA_MASS_NEUTRON (1.67492716e-27) /* kg */
#define GSL_CONST_MKSA_RYDBERG (2.17987196968e-18) /* kg m^2 / s^2 */
#define GSL_CONST_MKSA_BOLTZMANN (1.3806504e-23) /* kg m^2 / K s^2 */
#define GSL_CONST_MKSA_MOLAR_GAS (8.314472e0) /* kg m^2 / K mol s^2 */
#define GSL_CONST_MKSA_STANDARD_GAS_VOLUME (2.2710981e-2) /* m^3 / mol */
#define GSL_CONST_MKSA_MINUTE (6e1) /* s */
#define GSL_CONST_MKSA_HOUR (3.6e3) /* s */
#define GSL_CONST_MKSA_DAY (8.64e4) /* s */
#define GSL_CONST_MKSA_WEEK (6.048e5) /* s */
#define GSL_CONST_MKSA_INCH (2.54e-2) /* m */
#define GSL_CONST_MKSA_FOOT (3.048e-1) /* m */
#define GSL_CONST_MKSA_YARD (9.144e-1) /* m */
#define GSL_CONST_MKSA_MILE (1.609344e3) /* m */
#define GSL_CONST_MKSA_NAUTICAL_MILE (1.852e3) /* m */
#define GSL_CONST_MKSA_FATHOM (1.8288e0) /* m */
#define GSL_CONST_MKSA_MIL (2.54e-5) /* m */
#define GSL_CONST_MKSA_POINT (3.52777777778e-4) /* m */
#define GSL_CONST_MKSA_TEXPOINT (3.51459803515e-4) /* m */
#define GSL_CONST_MKSA_MICRON (1e-6) /* m */
#define GSL_CONST_MKSA_ANGSTROM (1e-10) /* m */
#define GSL_CONST_MKSA_HECTARE (1e4) /* m^2 */
#define GSL_CONST_MKSA_ACRE (4.04685642241e3) /* m^2 */
#define GSL_CONST_MKSA_BARN (1e-28) /* m^2 */
#define GSL_CONST_MKSA_LITER (1e-3) /* m^3 */
#define GSL_CONST_MKSA_US_GALLON (3.78541178402e-3) /* m^3 */
#define GSL_CONST_MKSA_QUART (9.46352946004e-4) /* m^3 */
#define GSL_CONST_MKSA_PINT (4.73176473002e-4) /* m^3 */
#define GSL_CONST_MKSA_CUP (2.36588236501e-4) /* m^3 */
#define GSL_CONST_MKSA_FLUID_OUNCE (2.95735295626e-5) /* m^3 */
#define GSL_CONST_MKSA_TABLESPOON (1.47867647813e-5) /* m^3 */
#define GSL_CONST_MKSA_TEASPOON (4.92892159375e-6) /* m^3 */
#define GSL_CONST_MKSA_CANADIAN_GALLON (4.54609e-3) /* m^3 */
#define GSL_CONST_MKSA_UK_GALLON (4.546092e-3) /* m^3 */
#define GSL_CONST_MKSA_MILES_PER_HOUR (4.4704e-1) /* m / s */
#define GSL_CONST_MKSA_KILOMETERS_PER_HOUR (2.77777777778e-1) /* m / s */
#define GSL_CONST_MKSA_KNOT (5.14444444444e-1) /* m / s */
#define GSL_CONST_MKSA_POUND_MASS (4.5359237e-1) /* kg */
#define GSL_CONST_MKSA_OUNCE_MASS (2.8349523125e-2) /* kg */
#define GSL_CONST_MKSA_TON (9.0718474e2) /* kg */
#define GSL_CONST_MKSA_METRIC_TON (1e3) /* kg */
#define GSL_CONST_MKSA_UK_TON (1.0160469088e3) /* kg */
#define GSL_CONST_MKSA_TROY_OUNCE (3.1103475e-2) /* kg */
#define GSL_CONST_MKSA_CARAT (2e-4) /* kg */
#define GSL_CONST_MKSA_UNIFIED_ATOMIC_MASS (1.660538782e-27) /* kg */
#define GSL_CONST_MKSA_GRAM_FORCE (9.80665e-3) /* kg m / s^2 */
#define GSL_CONST_MKSA_POUND_FORCE (4.44822161526e0) /* kg m / s^2 */
#define GSL_CONST_MKSA_KILOPOUND_FORCE (4.44822161526e3) /* kg m / s^2 */
#define GSL_CONST_MKSA_POUNDAL (1.38255e-1) /* kg m / s^2 */
#define GSL_CONST_MKSA_CALORIE (4.1868e0) /* kg m^2 / s^2 */
#define GSL_CONST_MKSA_BTU (1.05505585262e3) /* kg m^2 / s^2 */
#define GSL_CONST_MKSA_THERM (1.05506e8) /* kg m^2 / s^2 */
#define GSL_CONST_MKSA_HORSEPOWER (7.457e2) /* kg m^2 / s^3 */
#define GSL_CONST_MKSA_BAR (1e5) /* kg / m s^2 */
#define GSL_CONST_MKSA_STD_ATMOSPHERE (1.01325e5) /* kg / m s^2 */
#define GSL_CONST_MKSA_TORR (1.33322368421e2) /* kg / m s^2 */
#define GSL_CONST_MKSA_METER_OF_MERCURY (1.33322368421e5) /* kg / m s^2 */
#define GSL_CONST_MKSA_INCH_OF_MERCURY (3.38638815789e3) /* kg / m s^2 */
#define GSL_CONST_MKSA_INCH_OF_WATER (2.490889e2) /* kg / m s^2 */
#define GSL_CONST_MKSA_PSI (6.89475729317e3) /* kg / m s^2 */
#define GSL_CONST_MKSA_POISE (1e-1) /* kg m^-1 s^-1 */
#define GSL_CONST_MKSA_STOKES (1e-4) /* m^2 / s */
#define GSL_CONST_MKSA_STILB (1e4) /* cd / m^2 */
#define GSL_CONST_MKSA_LUMEN (1e0) /* cd sr */
#define GSL_CONST_MKSA_LUX (1e0) /* cd sr / m^2 */
#define GSL_CONST_MKSA_PHOT (1e4) /* cd sr / m^2 */
#define GSL_CONST_MKSA_FOOTCANDLE (1.076e1) /* cd sr / m^2 */
#define GSL_CONST_MKSA_LAMBERT (1e4) /* cd sr / m^2 */
#define GSL_CONST_MKSA_FOOTLAMBERT (1.07639104e1) /* cd sr / m^2 */
#define GSL_CONST_MKSA_CURIE (3.7e10) /* 1 / s */
#define GSL_CONST_MKSA_ROENTGEN (2.58e-4) /* A s / kg */
#define GSL_CONST_MKSA_RAD (1e-2) /* m^2 / s^2 */
#define GSL_CONST_MKSA_SOLAR_MASS (1.98892e30) /* kg */
#define GSL_CONST_MKSA_BOHR_RADIUS (5.291772083e-11) /* m */
#define GSL_CONST_MKSA_NEWTON (1e0) /* kg m / s^2 */
#define GSL_CONST_MKSA_DYNE (1e-5) /* kg m / s^2 */
#define GSL_CONST_MKSA_JOULE (1e0) /* kg m^2 / s^2 */
#define GSL_CONST_MKSA_ERG (1e-7) /* kg m^2 / s^2 */
#define GSL_CONST_MKSA_STEFAN_BOLTZMANN_CONSTANT (5.67040047374e-8) /* kg / K^4 s^3 */
#define GSL_CONST_MKSA_THOMSON_CROSS_SECTION (6.65245893699e-29) /* m^2 */
#define GSL_CONST_MKSA_BOHR_MAGNETON (9.27400899e-24) /* A m^2 */
#define GSL_CONST_MKSA_NUCLEAR_MAGNETON (5.05078317e-27) /* A m^2 */
#define GSL_CONST_MKSA_ELECTRON_MAGNETIC_MOMENT (9.28476362e-24) /* A m^2 */
#define GSL_CONST_MKSA_PROTON_MAGNETIC_MOMENT (1.410606633e-26) /* A m^2 */
#define GSL_CONST_MKSA_FARADAY (9.64853429775e4) /* A s / mol */
#define GSL_CONST_MKSA_ELECTRON_CHARGE (1.602176487e-19) /* A s */
#define GSL_CONST_MKSA_VACUUM_PERMITTIVITY (8.854187817e-12) /* A^2 s^4 / kg m^3 */
#define GSL_CONST_MKSA_VACUUM_PERMEABILITY (1.25663706144e-6) /* kg m / A^2 s^2 */
#define GSL_CONST_MKSA_DEBYE (3.33564095198e-30) /* A s^2 / m^2 */
#define GSL_CONST_MKSA_GAUSS (1e-4) /* kg / A s^2 */
#endif /* __GSL_CONST_MKSA__ */

View File

@ -0,0 +1,43 @@
/* const/gsl_const_num.h
*
* Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005,
* 2006, 2007, 2008, 2009 Brian Gough
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or (at
* your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef __GSL_CONST_NUM__
#define __GSL_CONST_NUM__
#define GSL_CONST_NUM_FINE_STRUCTURE (7.297352533e-3) /* 1 */
#define GSL_CONST_NUM_AVOGADRO (6.02214199e23) /* 1 / mol */
#define GSL_CONST_NUM_YOTTA (1e24) /* 1 */
#define GSL_CONST_NUM_ZETTA (1e21) /* 1 */
#define GSL_CONST_NUM_EXA (1e18) /* 1 */
#define GSL_CONST_NUM_PETA (1e15) /* 1 */
#define GSL_CONST_NUM_TERA (1e12) /* 1 */
#define GSL_CONST_NUM_GIGA (1e9) /* 1 */
#define GSL_CONST_NUM_MEGA (1e6) /* 1 */
#define GSL_CONST_NUM_KILO (1e3) /* 1 */
#define GSL_CONST_NUM_MILLI (1e-3) /* 1 */
#define GSL_CONST_NUM_MICRO (1e-6) /* 1 */
#define GSL_CONST_NUM_NANO (1e-9) /* 1 */
#define GSL_CONST_NUM_PICO (1e-12) /* 1 */
#define GSL_CONST_NUM_FEMTO (1e-15) /* 1 */
#define GSL_CONST_NUM_ATTO (1e-18) /* 1 */
#define GSL_CONST_NUM_ZEPTO (1e-21) /* 1 */
#define GSL_CONST_NUM_YOCTO (1e-24) /* 1 */
#endif /* __GSL_CONST_NUM__ */

View File

@ -0,0 +1,50 @@
/* deriv/gsl_deriv.h
*
* Copyright (C) 2000 David Morrison
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or (at
* your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef __GSL_DERIV_H__
#define __GSL_DERIV_H__
#include <gsl/gsl_math.h>
#undef __BEGIN_DECLS
#undef __END_DECLS
#ifdef __cplusplus
# define __BEGIN_DECLS extern "C" {
# define __END_DECLS }
#else
# define __BEGIN_DECLS /* empty */
# define __END_DECLS /* empty */
#endif
__BEGIN_DECLS
int gsl_deriv_central (const gsl_function *f,
double x, double h,
double *result, double *abserr);
int gsl_deriv_backward (const gsl_function *f,
double x, double h,
double *result, double *abserr);
int gsl_deriv_forward (const gsl_function *f,
double x, double h,
double *result, double *abserr);
__END_DECLS
#endif /* __GSL_DERIV_H__ */

View File

@ -0,0 +1,55 @@
/* fft/gsl_dft_complex.h
*
* Copyright (C) 1996, 1997, 1998, 1999, 2000, 2007 Brian Gough
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or (at
* your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef __GSL_DFT_COMPLEX_H__
#define __GSL_DFT_COMPLEX_H__
#include <stddef.h>
#include <gsl/gsl_math.h>
#include <gsl/gsl_complex.h>
#include <gsl/gsl_fft.h>
#undef __BEGIN_DECLS
#undef __END_DECLS
#ifdef __cplusplus
# define __BEGIN_DECLS extern "C" {
# define __END_DECLS }
#else
# define __BEGIN_DECLS /* empty */
# define __END_DECLS /* empty */
#endif
__BEGIN_DECLS
int gsl_dft_complex_forward (const double data[], const size_t stride, const size_t n,
double result[]);
int gsl_dft_complex_backward (const double data[], const size_t stride, const size_t n,
double result[]);
int gsl_dft_complex_inverse (const double data[], const size_t stride, const size_t n,
double result[]);
int gsl_dft_complex_transform (const double data[], const size_t stride, const size_t n,
double result[], const gsl_fft_direction sign);
__END_DECLS
#endif /* __GSL_DFT_COMPLEX_H__ */

View File

@ -0,0 +1,55 @@
/* fft/gsl_dft_complex_float.h
*
* Copyright (C) 1996, 1997, 1998, 1999, 2000, 2007 Brian Gough
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or (at
* your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef __GSL_DFT_COMPLEX_FLOAT_H__
#define __GSL_DFT_COMPLEX_FLOAT_H__
#include <stddef.h>
#include <gsl/gsl_math.h>
#include <gsl/gsl_complex.h>
#include <gsl/gsl_fft.h>
#undef __BEGIN_DECLS
#undef __END_DECLS
#ifdef __cplusplus
# define __BEGIN_DECLS extern "C" {
# define __END_DECLS }
#else
# define __BEGIN_DECLS /* empty */
# define __END_DECLS /* empty */
#endif
__BEGIN_DECLS
int gsl_dft_complex_float_forward (const float data[], const size_t stride, const size_t n,
float result[]);
int gsl_dft_complex_float_backward (const float data[], const size_t stride, const size_t n,
float result[]);
int gsl_dft_complex_float_inverse (const float data[], const size_t stride, const size_t n,
float result[]);
int gsl_dft_complex_float_transform (const float data[], const size_t stride, const size_t n,
float result[], const gsl_fft_direction sign);
__END_DECLS
#endif /* __GSL_DFT_COMPLEX_FLOAT_H__ */

View File

@ -0,0 +1,89 @@
/* dht/gsl_dht.h
*
* Copyright (C) 1996, 1997, 1998, 1999, 2000 Gerard Jungman
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or (at
* your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
/* Author: G. Jungman
*/
#ifndef __GSL_DHT_H__
#define __GSL_DHT_H__
#include <stdlib.h>
#undef __BEGIN_DECLS
#undef __END_DECLS
#ifdef __cplusplus
# define __BEGIN_DECLS extern "C" {
# define __END_DECLS }
#else
# define __BEGIN_DECLS /* empty */
# define __END_DECLS /* empty */
#endif
__BEGIN_DECLS
struct gsl_dht_struct {
size_t size; /* size of the sample arrays to be transformed */
double nu; /* Bessel function order */
double xmax; /* the upper limit to the x-sampling domain */
double kmax; /* the upper limit to the k-sampling domain */
double * j; /* array of computed J_nu zeros, j_{nu,s} = j[s] */
double * Jjj; /* transform numerator, J_nu(j_i j_m / j_N) */
double * J2; /* transform denominator, J_{nu+1}^2(j_m) */
};
typedef struct gsl_dht_struct gsl_dht;
/* Create a new transform object for a given size
* sampling array on the domain [0, xmax].
*/
gsl_dht * gsl_dht_alloc(size_t size);
gsl_dht * gsl_dht_new(size_t size, double nu, double xmax);
/* Recalculate a transform object for given values of nu, xmax.
* You cannot change the size of the object since the internal
* allocation is reused.
*/
int gsl_dht_init(gsl_dht * t, double nu, double xmax);
/* The n'th computed x sample point for a given transform.
* 0 <= n <= size-1
*/
double gsl_dht_x_sample(const gsl_dht * t, int n);
/* The n'th computed k sample point for a given transform.
* 0 <= n <= size-1
*/
double gsl_dht_k_sample(const gsl_dht * t, int n);
/* Free a transform object.
*/
void gsl_dht_free(gsl_dht * t);
/* Perform a transform on a sampled array.
* f_in[0] ... f_in[size-1] and similarly for f_out[]
*/
int gsl_dht_apply(const gsl_dht * t, double * f_in, double * f_out);
__END_DECLS
#endif /* __GSL_DHT_H__ */

View File

@ -0,0 +1,52 @@
/* diff/gsl_diff.h
*
* Copyright (C) 2000 David Morrison
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or (at
* your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef __GSL_DIFF_H__
#define __GSL_DIFF_H__
#include <gsl/gsl_math.h>
#undef __BEGIN_DECLS
#undef __END_DECLS
#ifdef __cplusplus
# define __BEGIN_DECLS extern "C" {
# define __END_DECLS }
#else
# define __BEGIN_DECLS /* empty */
# define __END_DECLS /* empty */
#endif
__BEGIN_DECLS
#ifndef GSL_DISABLE_DEPRECATED
int gsl_diff_central (const gsl_function *f,
double x,
double *result, double *abserr);
int gsl_diff_backward (const gsl_function *f,
double x,
double *result, double *abserr);
int gsl_diff_forward (const gsl_function *f,
double x,
double *result, double *abserr);
#endif
__END_DECLS
#endif /* __GSL_DIFF_H__ */

View File

@ -0,0 +1,347 @@
/* eigen/gsl_eigen.h
*
* Copyright (C) 1996, 1997, 1998, 1999, 2000, 2006, 2007 Gerard Jungman, Brian Gough, Patrick Alken
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or (at
* your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef __GSL_EIGEN_H__
#define __GSL_EIGEN_H__
#include <gsl/gsl_vector.h>
#include <gsl/gsl_matrix.h>
#undef __BEGIN_DECLS
#undef __END_DECLS
#ifdef __cplusplus
# define __BEGIN_DECLS extern "C" {
# define __END_DECLS }
#else
# define __BEGIN_DECLS /* empty */
# define __END_DECLS /* empty */
#endif
__BEGIN_DECLS
typedef struct {
size_t size;
double * d;
double * sd;
} gsl_eigen_symm_workspace;
gsl_eigen_symm_workspace * gsl_eigen_symm_alloc (const size_t n);
void gsl_eigen_symm_free (gsl_eigen_symm_workspace * w);
int gsl_eigen_symm (gsl_matrix * A, gsl_vector * eval, gsl_eigen_symm_workspace * w);
typedef struct {
size_t size;
double * d;
double * sd;
double * gc;
double * gs;
} gsl_eigen_symmv_workspace;
gsl_eigen_symmv_workspace * gsl_eigen_symmv_alloc (const size_t n);
void gsl_eigen_symmv_free (gsl_eigen_symmv_workspace * w);
int gsl_eigen_symmv (gsl_matrix * A, gsl_vector * eval, gsl_matrix * evec, gsl_eigen_symmv_workspace * w);
typedef struct {
size_t size;
double * d;
double * sd;
double * tau;
} gsl_eigen_herm_workspace;
gsl_eigen_herm_workspace * gsl_eigen_herm_alloc (const size_t n);
void gsl_eigen_herm_free (gsl_eigen_herm_workspace * w);
int gsl_eigen_herm (gsl_matrix_complex * A, gsl_vector * eval,
gsl_eigen_herm_workspace * w);
typedef struct {
size_t size;
double * d;
double * sd;
double * tau;
double * gc;
double * gs;
} gsl_eigen_hermv_workspace;
gsl_eigen_hermv_workspace * gsl_eigen_hermv_alloc (const size_t n);
void gsl_eigen_hermv_free (gsl_eigen_hermv_workspace * w);
int gsl_eigen_hermv (gsl_matrix_complex * A, gsl_vector * eval,
gsl_matrix_complex * evec,
gsl_eigen_hermv_workspace * w);
typedef struct {
size_t size; /* matrix size */
size_t max_iterations; /* max iterations since last eigenvalue found */
size_t n_iter; /* number of iterations since last eigenvalue found */
size_t n_evals; /* number of eigenvalues found so far */
int compute_t; /* compute Schur form T = Z^t A Z */
gsl_matrix *H; /* pointer to Hessenberg matrix */
gsl_matrix *Z; /* pointer to Schur vector matrix */
} gsl_eigen_francis_workspace;
gsl_eigen_francis_workspace * gsl_eigen_francis_alloc (void);
void gsl_eigen_francis_free (gsl_eigen_francis_workspace * w);
void gsl_eigen_francis_T (const int compute_t,
gsl_eigen_francis_workspace * w);
int gsl_eigen_francis (gsl_matrix * H, gsl_vector_complex * eval,
gsl_eigen_francis_workspace * w);
int gsl_eigen_francis_Z (gsl_matrix * H, gsl_vector_complex * eval,
gsl_matrix * Z,
gsl_eigen_francis_workspace * w);
typedef struct {
size_t size; /* size of matrices */
gsl_vector *diag; /* diagonal matrix elements from balancing */
gsl_vector *tau; /* Householder coefficients */
gsl_matrix *Z; /* pointer to Z matrix */
int do_balance; /* perform balancing transformation? */
size_t n_evals; /* number of eigenvalues found */
gsl_eigen_francis_workspace *francis_workspace_p;
} gsl_eigen_nonsymm_workspace;
gsl_eigen_nonsymm_workspace * gsl_eigen_nonsymm_alloc (const size_t n);
void gsl_eigen_nonsymm_free (gsl_eigen_nonsymm_workspace * w);
void gsl_eigen_nonsymm_params (const int compute_t, const int balance,
gsl_eigen_nonsymm_workspace *w);
int gsl_eigen_nonsymm (gsl_matrix * A, gsl_vector_complex * eval,
gsl_eigen_nonsymm_workspace * w);
int gsl_eigen_nonsymm_Z (gsl_matrix * A, gsl_vector_complex * eval,
gsl_matrix * Z, gsl_eigen_nonsymm_workspace * w);
typedef struct {
size_t size; /* size of matrices */
gsl_vector *work; /* scratch workspace */
gsl_vector *work2; /* scratch workspace */
gsl_vector *work3; /* scratch workspace */
gsl_matrix *Z; /* pointer to Schur vectors */
gsl_eigen_nonsymm_workspace *nonsymm_workspace_p;
} gsl_eigen_nonsymmv_workspace;
gsl_eigen_nonsymmv_workspace * gsl_eigen_nonsymmv_alloc (const size_t n);
void gsl_eigen_nonsymmv_free (gsl_eigen_nonsymmv_workspace * w);
void gsl_eigen_nonsymmv_params (const int balance,
gsl_eigen_nonsymmv_workspace *w);
int gsl_eigen_nonsymmv (gsl_matrix * A, gsl_vector_complex * eval,
gsl_matrix_complex * evec,
gsl_eigen_nonsymmv_workspace * w);
int gsl_eigen_nonsymmv_Z (gsl_matrix * A, gsl_vector_complex * eval,
gsl_matrix_complex * evec, gsl_matrix * Z,
gsl_eigen_nonsymmv_workspace * w);
typedef struct {
size_t size; /* size of matrices */
gsl_eigen_symm_workspace *symm_workspace_p;
} gsl_eigen_gensymm_workspace;
gsl_eigen_gensymm_workspace * gsl_eigen_gensymm_alloc (const size_t n);
void gsl_eigen_gensymm_free (gsl_eigen_gensymm_workspace * w);
int gsl_eigen_gensymm (gsl_matrix * A, gsl_matrix * B,
gsl_vector * eval, gsl_eigen_gensymm_workspace * w);
int gsl_eigen_gensymm_standardize (gsl_matrix * A, const gsl_matrix * B);
typedef struct {
size_t size; /* size of matrices */
gsl_eigen_symmv_workspace *symmv_workspace_p;
} gsl_eigen_gensymmv_workspace;
gsl_eigen_gensymmv_workspace * gsl_eigen_gensymmv_alloc (const size_t n);
void gsl_eigen_gensymmv_free (gsl_eigen_gensymmv_workspace * w);
int gsl_eigen_gensymmv (gsl_matrix * A, gsl_matrix * B,
gsl_vector * eval, gsl_matrix * evec,
gsl_eigen_gensymmv_workspace * w);
typedef struct {
size_t size; /* size of matrices */
gsl_eigen_herm_workspace *herm_workspace_p;
} gsl_eigen_genherm_workspace;
gsl_eigen_genherm_workspace * gsl_eigen_genherm_alloc (const size_t n);
void gsl_eigen_genherm_free (gsl_eigen_genherm_workspace * w);
int gsl_eigen_genherm (gsl_matrix_complex * A, gsl_matrix_complex * B,
gsl_vector * eval, gsl_eigen_genherm_workspace * w);
int gsl_eigen_genherm_standardize (gsl_matrix_complex * A,
const gsl_matrix_complex * B);
typedef struct {
size_t size; /* size of matrices */
gsl_eigen_hermv_workspace *hermv_workspace_p;
} gsl_eigen_genhermv_workspace;
gsl_eigen_genhermv_workspace * gsl_eigen_genhermv_alloc (const size_t n);
void gsl_eigen_genhermv_free (gsl_eigen_genhermv_workspace * w);
int gsl_eigen_genhermv (gsl_matrix_complex * A, gsl_matrix_complex * B,
gsl_vector * eval, gsl_matrix_complex * evec,
gsl_eigen_genhermv_workspace * w);
typedef struct {
size_t size; /* size of matrices */
gsl_vector *work; /* scratch workspace */
size_t n_evals; /* number of eigenvalues found */
size_t max_iterations; /* maximum QZ iterations allowed */
size_t n_iter; /* number of iterations since last eigenvalue found */
double eshift; /* exceptional shift counter */
int needtop; /* need to compute top index? */
double atol; /* tolerance for splitting A matrix */
double btol; /* tolerance for splitting B matrix */
double ascale; /* scaling factor for shifts */
double bscale; /* scaling factor for shifts */
gsl_matrix *H; /* pointer to hessenberg matrix */
gsl_matrix *R; /* pointer to upper triangular matrix */
int compute_s; /* compute generalized Schur form S */
int compute_t; /* compute generalized Schur form T */
gsl_matrix *Q; /* pointer to left Schur vectors */
gsl_matrix *Z; /* pointer to right Schur vectors */
} gsl_eigen_gen_workspace;
gsl_eigen_gen_workspace * gsl_eigen_gen_alloc (const size_t n);
void gsl_eigen_gen_free (gsl_eigen_gen_workspace * w);
void gsl_eigen_gen_params (const int compute_s, const int compute_t,
const int balance, gsl_eigen_gen_workspace * w);
int gsl_eigen_gen (gsl_matrix * A, gsl_matrix * B,
gsl_vector_complex * alpha, gsl_vector * beta,
gsl_eigen_gen_workspace * w);
int gsl_eigen_gen_QZ (gsl_matrix * A, gsl_matrix * B,
gsl_vector_complex * alpha, gsl_vector * beta,
gsl_matrix * Q, gsl_matrix * Z,
gsl_eigen_gen_workspace * w);
typedef struct {
size_t size; /* size of matrices */
gsl_vector *work1; /* 1-norm of columns of A */
gsl_vector *work2; /* 1-norm of columns of B */
gsl_vector *work3; /* real part of eigenvector */
gsl_vector *work4; /* imag part of eigenvector */
gsl_vector *work5; /* real part of back-transformed eigenvector */
gsl_vector *work6; /* imag part of back-transformed eigenvector */
gsl_matrix *Q; /* pointer to left Schur vectors */
gsl_matrix *Z; /* pointer to right Schur vectors */
gsl_eigen_gen_workspace *gen_workspace_p;
} gsl_eigen_genv_workspace;
gsl_eigen_genv_workspace * gsl_eigen_genv_alloc (const size_t n);
void gsl_eigen_genv_free (gsl_eigen_genv_workspace * w);
int gsl_eigen_genv (gsl_matrix * A, gsl_matrix * B,
gsl_vector_complex * alpha, gsl_vector * beta,
gsl_matrix_complex * evec,
gsl_eigen_genv_workspace * w);
int gsl_eigen_genv_QZ (gsl_matrix * A, gsl_matrix * B,
gsl_vector_complex * alpha, gsl_vector * beta,
gsl_matrix_complex * evec,
gsl_matrix * Q, gsl_matrix * Z,
gsl_eigen_genv_workspace * w);
typedef enum {
GSL_EIGEN_SORT_VAL_ASC,
GSL_EIGEN_SORT_VAL_DESC,
GSL_EIGEN_SORT_ABS_ASC,
GSL_EIGEN_SORT_ABS_DESC
}
gsl_eigen_sort_t;
/* Sort eigensystem results based on eigenvalues.
* Sorts in order of increasing value or increasing
* absolute value.
*
* exceptions: GSL_EBADLEN
*/
int gsl_eigen_symmv_sort(gsl_vector * eval, gsl_matrix * evec,
gsl_eigen_sort_t sort_type);
int gsl_eigen_hermv_sort(gsl_vector * eval, gsl_matrix_complex * evec,
gsl_eigen_sort_t sort_type);
int gsl_eigen_nonsymmv_sort(gsl_vector_complex * eval,
gsl_matrix_complex * evec,
gsl_eigen_sort_t sort_type);
int gsl_eigen_gensymmv_sort (gsl_vector * eval, gsl_matrix * evec,
gsl_eigen_sort_t sort_type);
int gsl_eigen_genhermv_sort (gsl_vector * eval, gsl_matrix_complex * evec,
gsl_eigen_sort_t sort_type);
int gsl_eigen_genv_sort (gsl_vector_complex * alpha, gsl_vector * beta,
gsl_matrix_complex * evec,
gsl_eigen_sort_t sort_type);
/* Prototypes for the schur module */
int gsl_schur_gen_eigvals(const gsl_matrix *A, const gsl_matrix *B,
double *wr1, double *wr2, double *wi,
double *scale1, double *scale2);
int gsl_schur_solve_equation(double ca, const gsl_matrix *A, double z,
double d1, double d2, const gsl_vector *b,
gsl_vector *x, double *s, double *xnorm,
double smin);
int gsl_schur_solve_equation_z(double ca, const gsl_matrix *A,
gsl_complex *z, double d1, double d2,
const gsl_vector_complex *b,
gsl_vector_complex *x, double *s,
double *xnorm, double smin);
/* The following functions are obsolete: */
/* Eigensolve by Jacobi Method
*
* The data in the matrix input is destroyed.
*
* exceptions:
*/
int
gsl_eigen_jacobi(gsl_matrix * matrix,
gsl_vector * eval,
gsl_matrix * evec,
unsigned int max_rot,
unsigned int * nrot);
/* Invert by Jacobi Method
*
* exceptions:
*/
int
gsl_eigen_invert_jacobi(const gsl_matrix * matrix,
gsl_matrix * ainv,
unsigned int max_rot);
__END_DECLS
#endif /* __GSL_EIGEN_H__ */

View File

@ -0,0 +1,154 @@
/* err/gsl_errno.h
*
* Copyright (C) 1996, 1997, 1998, 1999, 2000, 2007 Gerard Jungman, Brian Gough
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or (at
* your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef __GSL_ERRNO_H__
#define __GSL_ERRNO_H__
#include <stdio.h>
#include <errno.h>
#include <gsl/gsl_types.h>
#undef __BEGIN_DECLS
#undef __END_DECLS
#ifdef __cplusplus
# define __BEGIN_DECLS extern "C" {
# define __END_DECLS }
#else
# define __BEGIN_DECLS /* empty */
# define __END_DECLS /* empty */
#endif
__BEGIN_DECLS
enum {
GSL_SUCCESS = 0,
GSL_FAILURE = -1,
GSL_CONTINUE = -2, /* iteration has not converged */
GSL_EDOM = 1, /* input domain error, e.g sqrt(-1) */
GSL_ERANGE = 2, /* output range error, e.g. exp(1e100) */
GSL_EFAULT = 3, /* invalid pointer */
GSL_EINVAL = 4, /* invalid argument supplied by user */
GSL_EFAILED = 5, /* generic failure */
GSL_EFACTOR = 6, /* factorization failed */
GSL_ESANITY = 7, /* sanity check failed - shouldn't happen */
GSL_ENOMEM = 8, /* malloc failed */
GSL_EBADFUNC = 9, /* problem with user-supplied function */
GSL_ERUNAWAY = 10, /* iterative process is out of control */
GSL_EMAXITER = 11, /* exceeded max number of iterations */
GSL_EZERODIV = 12, /* tried to divide by zero */
GSL_EBADTOL = 13, /* user specified an invalid tolerance */
GSL_ETOL = 14, /* failed to reach the specified tolerance */
GSL_EUNDRFLW = 15, /* underflow */
GSL_EOVRFLW = 16, /* overflow */
GSL_ELOSS = 17, /* loss of accuracy */
GSL_EROUND = 18, /* failed because of roundoff error */
GSL_EBADLEN = 19, /* matrix, vector lengths are not conformant */
GSL_ENOTSQR = 20, /* matrix not square */
GSL_ESING = 21, /* apparent singularity detected */
GSL_EDIVERGE = 22, /* integral or series is divergent */
GSL_EUNSUP = 23, /* requested feature is not supported by the hardware */
GSL_EUNIMPL = 24, /* requested feature not (yet) implemented */
GSL_ECACHE = 25, /* cache limit exceeded */
GSL_ETABLE = 26, /* table limit exceeded */
GSL_ENOPROG = 27, /* iteration is not making progress towards solution */
GSL_ENOPROGJ = 28, /* jacobian evaluations are not improving the solution */
GSL_ETOLF = 29, /* cannot reach the specified tolerance in F */
GSL_ETOLX = 30, /* cannot reach the specified tolerance in X */
GSL_ETOLG = 31, /* cannot reach the specified tolerance in gradient */
GSL_EOF = 32 /* end of file */
} ;
void gsl_error (const char * reason, const char * file, int line,
int gsl_errno);
void gsl_stream_printf (const char *label, const char *file,
int line, const char *reason);
const char * gsl_strerror (const int gsl_errno);
typedef void gsl_error_handler_t (const char * reason, const char * file,
int line, int gsl_errno);
typedef void gsl_stream_handler_t (const char * label, const char * file,
int line, const char * reason);
gsl_error_handler_t *
gsl_set_error_handler (gsl_error_handler_t * new_handler);
gsl_error_handler_t *
gsl_set_error_handler_off (void);
gsl_stream_handler_t *
gsl_set_stream_handler (gsl_stream_handler_t * new_handler);
FILE * gsl_set_stream (FILE * new_stream);
/* GSL_ERROR: call the error handler, and return the error code */
#define GSL_ERROR(reason, gsl_errno) \
do { \
gsl_error (reason, __FILE__, __LINE__, gsl_errno) ; \
return gsl_errno ; \
} while (0)
/* GSL_ERROR_VAL: call the error handler, and return the given value */
#define GSL_ERROR_VAL(reason, gsl_errno, value) \
do { \
gsl_error (reason, __FILE__, __LINE__, gsl_errno) ; \
return value ; \
} while (0)
/* GSL_ERROR_VOID: call the error handler, and then return
(for void functions which still need to generate an error) */
#define GSL_ERROR_VOID(reason, gsl_errno) \
do { \
gsl_error (reason, __FILE__, __LINE__, gsl_errno) ; \
return ; \
} while (0)
/* GSL_ERROR_NULL suitable for out-of-memory conditions */
#define GSL_ERROR_NULL(reason, gsl_errno) GSL_ERROR_VAL(reason, gsl_errno, 0)
/* Sometimes you have several status results returned from
* function calls and you want to combine them in some sensible
* way. You cannot produce a "total" status condition, but you can
* pick one from a set of conditions based on an implied hierarchy.
*
* In other words:
* you have: status_a, status_b, ...
* you want: status = (status_a if it is bad, or status_b if it is bad,...)
*
* In this example you consider status_a to be more important and
* it is checked first, followed by the others in the order specified.
*
* Here are some dumb macros to do this.
*/
#define GSL_ERROR_SELECT_2(a,b) ((a) != GSL_SUCCESS ? (a) : ((b) != GSL_SUCCESS ? (b) : GSL_SUCCESS))
#define GSL_ERROR_SELECT_3(a,b,c) ((a) != GSL_SUCCESS ? (a) : GSL_ERROR_SELECT_2(b,c))
#define GSL_ERROR_SELECT_4(a,b,c,d) ((a) != GSL_SUCCESS ? (a) : GSL_ERROR_SELECT_3(b,c,d))
#define GSL_ERROR_SELECT_5(a,b,c,d,e) ((a) != GSL_SUCCESS ? (a) : GSL_ERROR_SELECT_4(b,c,d,e))
#define GSL_STATUS_UPDATE(sp, s) do { if ((s) != GSL_SUCCESS) *(sp) = (s);} while(0)
__END_DECLS
#endif /* __GSL_ERRNO_H__ */

View File

@ -0,0 +1,51 @@
/* fft/gsl_fft.h
*
* Copyright (C) 1996, 1997, 1998, 1999, 2000, 2007 Brian Gough
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or (at
* your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef __GSL_FFT_H__
#define __GSL_FFT_H__
#include <gsl/gsl_complex.h>
#undef __BEGIN_DECLS
#undef __END_DECLS
#ifdef __cplusplus
# define __BEGIN_DECLS extern "C" {
# define __END_DECLS }
#else
# define __BEGIN_DECLS /* empty */
# define __END_DECLS /* empty */
#endif
__BEGIN_DECLS
typedef enum
{
gsl_fft_forward = -1, gsl_fft_backward = +1
}
gsl_fft_direction;
/* this gives the sign in the formula
h(f) = \sum x(t) exp(+/- 2 pi i f t)
where - is the forward transform direction and + the inverse direction */
__END_DECLS
#endif /* __GSL_FFT_H__ */

View File

@ -0,0 +1,136 @@
/* fft/gsl_fft_complex.h
*
* Copyright (C) 1996, 1997, 1998, 1999, 2000, 2007 Brian Gough
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or (at
* your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef __GSL_FFT_COMPLEX_H__
#define __GSL_FFT_COMPLEX_H__
#include <stddef.h>
#include <gsl/gsl_math.h>
#include <gsl/gsl_complex.h>
#include <gsl/gsl_fft.h>
#undef __BEGIN_DECLS
#undef __END_DECLS
#ifdef __cplusplus
# define __BEGIN_DECLS extern "C" {
# define __END_DECLS }
#else
# define __BEGIN_DECLS /* empty */
# define __END_DECLS /* empty */
#endif
__BEGIN_DECLS
/* Power of 2 routines */
int gsl_fft_complex_radix2_forward (gsl_complex_packed_array data,
const size_t stride,
const size_t n);
int gsl_fft_complex_radix2_backward (gsl_complex_packed_array data,
const size_t stride,
const size_t n);
int gsl_fft_complex_radix2_inverse (gsl_complex_packed_array data,
const size_t stride,
const size_t n);
int gsl_fft_complex_radix2_transform (gsl_complex_packed_array data,
const size_t stride,
const size_t n,
const gsl_fft_direction sign);
int gsl_fft_complex_radix2_dif_forward (gsl_complex_packed_array data,
const size_t stride,
const size_t n);
int gsl_fft_complex_radix2_dif_backward (gsl_complex_packed_array data,
const size_t stride,
const size_t n);
int gsl_fft_complex_radix2_dif_inverse (gsl_complex_packed_array data,
const size_t stride,
const size_t n);
int gsl_fft_complex_radix2_dif_transform (gsl_complex_packed_array data,
const size_t stride,
const size_t n,
const gsl_fft_direction sign);
/* Mixed Radix general-N routines */
typedef struct
{
size_t n;
size_t nf;
size_t factor[64];
gsl_complex *twiddle[64];
gsl_complex *trig;
}
gsl_fft_complex_wavetable;
typedef struct
{
size_t n;
double *scratch;
}
gsl_fft_complex_workspace;
gsl_fft_complex_wavetable *gsl_fft_complex_wavetable_alloc (size_t n);
void gsl_fft_complex_wavetable_free (gsl_fft_complex_wavetable * wavetable);
gsl_fft_complex_workspace *gsl_fft_complex_workspace_alloc (size_t n);
void gsl_fft_complex_workspace_free (gsl_fft_complex_workspace * workspace);
int gsl_fft_complex_memcpy (gsl_fft_complex_wavetable * dest,
gsl_fft_complex_wavetable * src);
int gsl_fft_complex_forward (gsl_complex_packed_array data,
const size_t stride,
const size_t n,
const gsl_fft_complex_wavetable * wavetable,
gsl_fft_complex_workspace * work);
int gsl_fft_complex_backward (gsl_complex_packed_array data,
const size_t stride,
const size_t n,
const gsl_fft_complex_wavetable * wavetable,
gsl_fft_complex_workspace * work);
int gsl_fft_complex_inverse (gsl_complex_packed_array data,
const size_t stride,
const size_t n,
const gsl_fft_complex_wavetable * wavetable,
gsl_fft_complex_workspace * work);
int gsl_fft_complex_transform (gsl_complex_packed_array data,
const size_t stride, const size_t n,
const gsl_fft_complex_wavetable * wavetable,
gsl_fft_complex_workspace * work,
const gsl_fft_direction sign);
__END_DECLS
#endif /* __GSL_FFT_COMPLEX_H__ */

View File

@ -0,0 +1,139 @@
/* fft/gsl_fft_complex_float.h
*
* Copyright (C) 1996, 1997, 1998, 1999, 2000, 2007 Brian Gough
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or (at
* your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef __GSL_FFT_COMPLEX_FLOAT_H__
#define __GSL_FFT_COMPLEX_FLOAT_H__
#include <stddef.h>
#include <gsl/gsl_math.h>
#include <gsl/gsl_complex.h>
#include <gsl/gsl_fft.h>
#undef __BEGIN_DECLS
#undef __END_DECLS
#ifdef __cplusplus
# define __BEGIN_DECLS extern "C" {
# define __END_DECLS }
#else
# define __BEGIN_DECLS /* empty */
# define __END_DECLS /* empty */
#endif
__BEGIN_DECLS
/* Power of 2 routines */
int gsl_fft_complex_float_radix2_forward (gsl_complex_packed_array_float data,
const size_t stride,
const size_t n);
int gsl_fft_complex_float_radix2_backward (gsl_complex_packed_array_float data,
const size_t stride,
const size_t n);
int gsl_fft_complex_float_radix2_inverse (gsl_complex_packed_array_float data,
const size_t stride,
const size_t n);
int gsl_fft_complex_float_radix2_transform (gsl_complex_packed_array_float data,
const size_t stride,
const size_t n,
const gsl_fft_direction sign);
int gsl_fft_complex_float_radix2_dif_forward (gsl_complex_packed_array_float data,
const size_t stride,
const size_t n);
int gsl_fft_complex_float_radix2_dif_backward (gsl_complex_packed_array_float data,
const size_t stride,
const size_t n);
int gsl_fft_complex_float_radix2_dif_inverse (gsl_complex_packed_array_float data,
const size_t stride,
const size_t n);
int gsl_fft_complex_float_radix2_dif_transform (gsl_complex_packed_array_float data,
const size_t stride,
const size_t n,
const gsl_fft_direction sign);
/* Mixed Radix general-N routines */
typedef struct
{
size_t n;
size_t nf;
size_t factor[64];
gsl_complex_float *twiddle[64];
gsl_complex_float *trig;
}
gsl_fft_complex_wavetable_float;
typedef struct
{
size_t n;
float *scratch;
}
gsl_fft_complex_workspace_float;
gsl_fft_complex_wavetable_float *gsl_fft_complex_wavetable_float_alloc (size_t n);
void gsl_fft_complex_wavetable_float_free (gsl_fft_complex_wavetable_float * wavetable);
gsl_fft_complex_workspace_float *gsl_fft_complex_workspace_float_alloc (size_t n);
void gsl_fft_complex_workspace_float_free (gsl_fft_complex_workspace_float * workspace);
int gsl_fft_complex_float_memcpy (gsl_fft_complex_wavetable_float * dest,
gsl_fft_complex_wavetable_float * src);
int gsl_fft_complex_float_forward (gsl_complex_packed_array_float data,
const size_t stride,
const size_t n,
const gsl_fft_complex_wavetable_float * wavetable,
gsl_fft_complex_workspace_float * work);
int gsl_fft_complex_float_backward (gsl_complex_packed_array_float data,
const size_t stride,
const size_t n,
const gsl_fft_complex_wavetable_float * wavetable,
gsl_fft_complex_workspace_float * work);
int gsl_fft_complex_float_inverse (gsl_complex_packed_array_float data,
const size_t stride,
const size_t n,
const gsl_fft_complex_wavetable_float * wavetable,
gsl_fft_complex_workspace_float * work);
int gsl_fft_complex_float_transform (gsl_complex_packed_array_float data,
const size_t stride, const size_t n,
const gsl_fft_complex_wavetable_float * wavetable,
gsl_fft_complex_workspace_float * work,
const gsl_fft_direction sign);
__END_DECLS
#endif /* __GSL_FFT_COMPLEX_FLOAT_H__ */

View File

@ -0,0 +1,86 @@
/* fft/gsl_fft_halfcomplex.h
*
* Copyright (C) 1996, 1997, 1998, 1999, 2000, 2007 Brian Gough
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or (at
* your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef __GSL_FFT_HALFCOMPLEX_H__
#define __GSL_FFT_HALFCOMPLEX_H__
#include <stddef.h>
#include <gsl/gsl_math.h>
#include <gsl/gsl_complex.h>
#include <gsl/gsl_fft.h>
#include <gsl/gsl_fft_real.h>
#undef __BEGIN_DECLS
#undef __END_DECLS
#ifdef __cplusplus
# define __BEGIN_DECLS extern "C" {
# define __END_DECLS }
#else
# define __BEGIN_DECLS /* empty */
# define __END_DECLS /* empty */
#endif
__BEGIN_DECLS
int gsl_fft_halfcomplex_radix2_backward (double data[], const size_t stride, const size_t n);
int gsl_fft_halfcomplex_radix2_inverse (double data[], const size_t stride, const size_t n);
int gsl_fft_halfcomplex_radix2_transform (double data[], const size_t stride, const size_t n);
typedef struct
{
size_t n;
size_t nf;
size_t factor[64];
gsl_complex *twiddle[64];
gsl_complex *trig;
}
gsl_fft_halfcomplex_wavetable;
gsl_fft_halfcomplex_wavetable * gsl_fft_halfcomplex_wavetable_alloc (size_t n);
void
gsl_fft_halfcomplex_wavetable_free (gsl_fft_halfcomplex_wavetable * wavetable);
int gsl_fft_halfcomplex_backward (double data[], const size_t stride, const size_t n,
const gsl_fft_halfcomplex_wavetable * wavetable,
gsl_fft_real_workspace * work);
int gsl_fft_halfcomplex_inverse (double data[], const size_t stride, const size_t n,
const gsl_fft_halfcomplex_wavetable * wavetable,
gsl_fft_real_workspace * work);
int gsl_fft_halfcomplex_transform (double data[], const size_t stride, const size_t n,
const gsl_fft_halfcomplex_wavetable * wavetable,
gsl_fft_real_workspace * work);
int
gsl_fft_halfcomplex_unpack (const double halfcomplex_coefficient[],
double complex_coefficient[],
const size_t stride, const size_t n);
int
gsl_fft_halfcomplex_radix2_unpack (const double halfcomplex_coefficient[],
double complex_coefficient[],
const size_t stride, const size_t n);
__END_DECLS
#endif /* __GSL_FFT_HALFCOMPLEX_H__ */

View File

@ -0,0 +1,86 @@
/* fft/gsl_fft_halfcomplex_float.h
*
* Copyright (C) 1996, 1997, 1998, 1999, 2000, 2007 Brian Gough
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or (at
* your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef __GSL_FFT_HALFCOMPLEX_FLOAT_H__
#define __GSL_FFT_HALFCOMPLEX_FLOAT_H__
#include <stddef.h>
#include <gsl/gsl_math.h>
#include <gsl/gsl_complex.h>
#include <gsl/gsl_fft.h>
#include <gsl/gsl_fft_real_float.h>
#undef __BEGIN_DECLS
#undef __END_DECLS
#ifdef __cplusplus
# define __BEGIN_DECLS extern "C" {
# define __END_DECLS }
#else
# define __BEGIN_DECLS /* empty */
# define __END_DECLS /* empty */
#endif
__BEGIN_DECLS
int gsl_fft_halfcomplex_float_radix2_backward (float data[], const size_t stride, const size_t n);
int gsl_fft_halfcomplex_float_radix2_inverse (float data[], const size_t stride, const size_t n);
int gsl_fft_halfcomplex_float_radix2_transform (float data[], const size_t stride, const size_t n);
typedef struct
{
size_t n;
size_t nf;
size_t factor[64];
gsl_complex_float *twiddle[64];
gsl_complex_float *trig;
}
gsl_fft_halfcomplex_wavetable_float;
gsl_fft_halfcomplex_wavetable_float * gsl_fft_halfcomplex_wavetable_float_alloc (size_t n);
void
gsl_fft_halfcomplex_wavetable_float_free (gsl_fft_halfcomplex_wavetable_float * wavetable);
int gsl_fft_halfcomplex_float_backward (float data[], const size_t stride, const size_t n,
const gsl_fft_halfcomplex_wavetable_float * wavetable,
gsl_fft_real_workspace_float * work);
int gsl_fft_halfcomplex_float_inverse (float data[], const size_t stride, const size_t n,
const gsl_fft_halfcomplex_wavetable_float * wavetable,
gsl_fft_real_workspace_float * work);
int gsl_fft_halfcomplex_float_transform (float data[], const size_t stride, const size_t n,
const gsl_fft_halfcomplex_wavetable_float * wavetable,
gsl_fft_real_workspace_float * work);
int
gsl_fft_halfcomplex_float_unpack (const float halfcomplex_coefficient[],
float complex_coefficient[],
const size_t stride, const size_t n);
int
gsl_fft_halfcomplex_float_radix2_unpack (const float halfcomplex_coefficient[],
float complex_coefficient[],
const size_t stride, const size_t n);
__END_DECLS
#endif /* __GSL_FFT_HALFCOMPLEX_FLOAT_H__ */

View File

@ -0,0 +1,80 @@
/* fft/gsl_fft_real.h
*
* Copyright (C) 1996, 1997, 1998, 1999, 2000, 2007 Brian Gough
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or (at
* your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef __GSL_FFT_REAL_H__
#define __GSL_FFT_REAL_H__
#include <stddef.h>
#include <gsl/gsl_math.h>
#include <gsl/gsl_complex.h>
#include <gsl/gsl_fft.h>
#undef __BEGIN_DECLS
#undef __END_DECLS
#ifdef __cplusplus
# define __BEGIN_DECLS extern "C" {
# define __END_DECLS }
#else
# define __BEGIN_DECLS /* empty */
# define __END_DECLS /* empty */
#endif
__BEGIN_DECLS
int gsl_fft_real_radix2_transform (double data[], const size_t stride, const size_t n) ;
typedef struct
{
size_t n;
size_t nf;
size_t factor[64];
gsl_complex *twiddle[64];
gsl_complex *trig;
}
gsl_fft_real_wavetable;
typedef struct
{
size_t n;
double *scratch;
}
gsl_fft_real_workspace;
gsl_fft_real_wavetable * gsl_fft_real_wavetable_alloc (size_t n);
void gsl_fft_real_wavetable_free (gsl_fft_real_wavetable * wavetable);
gsl_fft_real_workspace * gsl_fft_real_workspace_alloc (size_t n);
void gsl_fft_real_workspace_free (gsl_fft_real_workspace * workspace);
int gsl_fft_real_transform (double data[], const size_t stride, const size_t n,
const gsl_fft_real_wavetable * wavetable,
gsl_fft_real_workspace * work);
int gsl_fft_real_unpack (const double real_coefficient[],
double complex_coefficient[],
const size_t stride, const size_t n);
__END_DECLS
#endif /* __GSL_FFT_REAL_H__ */

View File

@ -0,0 +1,79 @@
/* fft/gsl_fft_real_float.h
*
* Copyright (C) 1996, 1997, 1998, 1999, 2000, 2007 Brian Gough
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or (at
* your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef __GSL_FFT_REAL_FLOAT_H__
#define __GSL_FFT_REAL_FLOAT_H__
#include <stddef.h>
#include <gsl/gsl_math.h>
#include <gsl/gsl_complex.h>
#include <gsl/gsl_fft.h>
#undef __BEGIN_DECLS
#undef __END_DECLS
#ifdef __cplusplus
# define __BEGIN_DECLS extern "C" {
# define __END_DECLS }
#else
# define __BEGIN_DECLS /* empty */
# define __END_DECLS /* empty */
#endif
__BEGIN_DECLS
int gsl_fft_real_float_radix2_transform (float data[], const size_t stride, const size_t n) ;
typedef struct
{
size_t n;
size_t nf;
size_t factor[64];
gsl_complex_float *twiddle[64];
gsl_complex_float *trig;
}
gsl_fft_real_wavetable_float;
typedef struct
{
size_t n;
float *scratch;
}
gsl_fft_real_workspace_float;
gsl_fft_real_wavetable_float * gsl_fft_real_wavetable_float_alloc (size_t n);
void gsl_fft_real_wavetable_float_free (gsl_fft_real_wavetable_float * wavetable);
gsl_fft_real_workspace_float * gsl_fft_real_workspace_float_alloc (size_t n);
void gsl_fft_real_workspace_float_free (gsl_fft_real_workspace_float * workspace);
int gsl_fft_real_float_transform (float data[], const size_t stride, const size_t n,
const gsl_fft_real_wavetable_float * wavetable,
gsl_fft_real_workspace_float * work);
int gsl_fft_real_float_unpack (const float real_float_coefficient[],
float complex_coefficient[],
const size_t stride, const size_t n);
__END_DECLS
#endif /* __GSL_FFT_REAL_FLOAT_H__ */

View File

@ -0,0 +1,108 @@
/* filter/gsl_filter.h
*
* Copyright (C) 2018 Patrick Alken
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or (at
* your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef __GSL_FILTER_H__
#define __GSL_FILTER_H__
#include <gsl/gsl_math.h>
#include <gsl/gsl_vector.h>
#include <gsl/gsl_movstat.h>
#undef __BEGIN_DECLS
#undef __END_DECLS
#ifdef __cplusplus
# define __BEGIN_DECLS extern "C" {
# define __END_DECLS }
#else
# define __BEGIN_DECLS /* empty */
# define __END_DECLS /* empty */
#endif
__BEGIN_DECLS
/* end point handling methods */
typedef enum
{
GSL_FILTER_END_PADZERO = GSL_MOVSTAT_END_PADZERO,
GSL_FILTER_END_PADVALUE = GSL_MOVSTAT_END_PADVALUE,
GSL_FILTER_END_TRUNCATE = GSL_MOVSTAT_END_TRUNCATE
} gsl_filter_end_t;
/* robust scale estimates */
typedef enum
{
GSL_FILTER_SCALE_MAD, /* median absolute deviation */
GSL_FILTER_SCALE_IQR, /* interquartile range */
GSL_FILTER_SCALE_SN, /* S_n scale statistic */
GSL_FILTER_SCALE_QN /* Q_n scale statistic */
} gsl_filter_scale_t;
/* workspace for Gaussian filter */
typedef struct
{
size_t K; /* window size */
double *kernel; /* Gaussian kernel, size K */
gsl_movstat_workspace *movstat_workspace_p;
} gsl_filter_gaussian_workspace;
gsl_filter_gaussian_workspace *gsl_filter_gaussian_alloc(const size_t K);
void gsl_filter_gaussian_free(gsl_filter_gaussian_workspace * w);
int gsl_filter_gaussian(const gsl_filter_end_t endtype, const double alpha, const size_t order, const gsl_vector * x,
gsl_vector * y, gsl_filter_gaussian_workspace * w);
int gsl_filter_gaussian_kernel(const double alpha, const size_t order, const int normalize, gsl_vector * kernel);
/* workspace for standard median filter */
typedef struct
{
gsl_movstat_workspace *movstat_workspace_p;
} gsl_filter_median_workspace;
gsl_filter_median_workspace *gsl_filter_median_alloc(const size_t K);
void gsl_filter_median_free(gsl_filter_median_workspace * w);
int gsl_filter_median(const gsl_filter_end_t endtype, const gsl_vector * x, gsl_vector * y, gsl_filter_median_workspace * w);
/* workspace for recursive median filter */
typedef struct
{
size_t H; /* window half-length (K / 2) */
size_t K; /* window size */
void *state; /* workspace for min/max accumulator */
double *window; /* array holding first window */
const gsl_movstat_accum * minmaxacc; /* minimum/maximum accumulator */
gsl_movstat_workspace *movstat_workspace_p;
} gsl_filter_rmedian_workspace;
gsl_filter_rmedian_workspace *gsl_filter_rmedian_alloc(const size_t K);
void gsl_filter_rmedian_free(gsl_filter_rmedian_workspace * w);
int gsl_filter_rmedian(const gsl_filter_end_t, const gsl_vector * x, gsl_vector * y, gsl_filter_rmedian_workspace * w);
typedef struct
{
gsl_movstat_workspace *movstat_workspace_p;
} gsl_filter_impulse_workspace;
gsl_filter_impulse_workspace *gsl_filter_impulse_alloc(const size_t K);
void gsl_filter_impulse_free(gsl_filter_impulse_workspace * w);
int gsl_filter_impulse(const gsl_filter_end_t endtype, const gsl_filter_scale_t scale_type, const double t,
const gsl_vector * x, gsl_vector * y, gsl_vector * xmedian, gsl_vector * xsigma, size_t * noutlier,
gsl_vector_int * ioutlier, gsl_filter_impulse_workspace * w);
__END_DECLS
#endif /* __GSL_FILTER_H__ */

View File

@ -0,0 +1,85 @@
/* fit/gsl_fit.h
*
* Copyright (C) 2000, 2007 Brian Gough
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or (at
* your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef __GSL_FIT_H__
#define __GSL_FIT_H__
#include <stdlib.h>
#include <gsl/gsl_math.h>
#undef __BEGIN_DECLS
#undef __END_DECLS
#ifdef __cplusplus
# define __BEGIN_DECLS extern "C" {
# define __END_DECLS }
#else
# define __BEGIN_DECLS /* empty */
# define __END_DECLS /* empty */
#endif
__BEGIN_DECLS
int gsl_fit_linear (const double * x, const size_t xstride,
const double * y, const size_t ystride,
const size_t n,
double * c0, double * c1,
double * cov00, double * cov01, double * cov11,
double * sumsq);
int gsl_fit_wlinear (const double * x, const size_t xstride,
const double * w, const size_t wstride,
const double * y, const size_t ystride,
const size_t n,
double * c0, double * c1,
double * cov00, double * cov01, double * cov11,
double * chisq);
int
gsl_fit_linear_est (const double x,
const double c0, const double c1,
const double cov00, const double cov01, const double cov11,
double *y, double *y_err);
int gsl_fit_mul (const double * x, const size_t xstride,
const double * y, const size_t ystride,
const size_t n,
double * c1,
double * cov11,
double * sumsq);
int gsl_fit_wmul (const double * x, const size_t xstride,
const double * w, const size_t wstride,
const double * y, const size_t ystride,
const size_t n,
double * c1,
double * cov11,
double * sumsq);
int
gsl_fit_mul_est (const double x,
const double c1,
const double cov11,
double *y, double *y_err);
__END_DECLS
#endif /* __GSL_FIT_H__ */

View File

@ -0,0 +1,44 @@
/* sort/gsl_heapsort.h
*
* Copyright (C) 1996, 1997, 1998, 1999, 2000, 2007 Thomas Walter, Brian Gough
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or (at
* your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef __GSL_HEAPSORT_H__
#define __GSL_HEAPSORT_H__
#include <gsl/gsl_permutation.h>
#undef __BEGIN_DECLS
#undef __END_DECLS
#ifdef __cplusplus
# define __BEGIN_DECLS extern "C" {
# define __END_DECLS }
#else
# define __BEGIN_DECLS /* empty */
# define __END_DECLS /* empty */
#endif
__BEGIN_DECLS
typedef int (*gsl_comparison_fn_t) (const void *, const void *);
void gsl_heapsort (void * array, size_t count, size_t size, gsl_comparison_fn_t compare);
int gsl_heapsort_index (size_t * p, const void * array, size_t count, size_t size, gsl_comparison_fn_t compare);
__END_DECLS
#endif /* __GSL_HEAPSORT_H__ */

View File

@ -0,0 +1,134 @@
/* histogram/gsl_histogram.h
*
* Copyright (C) 1996, 1997, 1998, 1999, 2000, 2007 Brian Gough
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or (at
* your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef __GSL_HISTOGRAM_H__
#define __GSL_HISTOGRAM_H__
#include <stdlib.h>
#include <stdio.h>
#undef __BEGIN_DECLS
#undef __END_DECLS
#ifdef __cplusplus
# define __BEGIN_DECLS extern "C" {
# define __END_DECLS }
#else
# define __BEGIN_DECLS /* empty */
# define __END_DECLS /* empty */
#endif
__BEGIN_DECLS
typedef struct {
size_t n ;
double * range ;
double * bin ;
} gsl_histogram ;
typedef struct {
size_t n ;
double * range ;
double * sum ;
} gsl_histogram_pdf ;
gsl_histogram * gsl_histogram_alloc (size_t n);
gsl_histogram * gsl_histogram_calloc (size_t n);
gsl_histogram * gsl_histogram_calloc_uniform (const size_t n, const double xmin, const double xmax);
void gsl_histogram_free (gsl_histogram * h);
int gsl_histogram_increment (gsl_histogram * h, double x);
int gsl_histogram_accumulate (gsl_histogram * h, double x, double weight);
int gsl_histogram_find (const gsl_histogram * h,
const double x, size_t * i);
double gsl_histogram_get (const gsl_histogram * h, size_t i);
int gsl_histogram_get_range (const gsl_histogram * h, size_t i,
double * lower, double * upper);
double gsl_histogram_max (const gsl_histogram * h);
double gsl_histogram_min (const gsl_histogram * h);
size_t gsl_histogram_bins (const gsl_histogram * h);
void gsl_histogram_reset (gsl_histogram * h);
gsl_histogram * gsl_histogram_calloc_range(size_t n, double * range);
int
gsl_histogram_set_ranges (gsl_histogram * h, const double range[], size_t size);
int
gsl_histogram_set_ranges_uniform (gsl_histogram * h, double xmin, double xmax);
int
gsl_histogram_memcpy(gsl_histogram * dest, const gsl_histogram * source);
gsl_histogram *
gsl_histogram_clone(const gsl_histogram * source);
double gsl_histogram_max_val (const gsl_histogram * h);
size_t gsl_histogram_max_bin (const gsl_histogram * h);
double gsl_histogram_min_val (const gsl_histogram * h);
size_t gsl_histogram_min_bin (const gsl_histogram * h);
int
gsl_histogram_equal_bins_p(const gsl_histogram *h1, const gsl_histogram *h2);
int
gsl_histogram_add(gsl_histogram *h1, const gsl_histogram *h2);
int
gsl_histogram_sub(gsl_histogram *h1, const gsl_histogram *h2);
int
gsl_histogram_mul(gsl_histogram *h1, const gsl_histogram *h2);
int
gsl_histogram_div(gsl_histogram *h1, const gsl_histogram *h2);
int
gsl_histogram_scale(gsl_histogram *h, double scale);
int
gsl_histogram_shift (gsl_histogram * h, double shift);
double gsl_histogram_sigma (const gsl_histogram * h);
double gsl_histogram_mean (const gsl_histogram * h);
double gsl_histogram_sum (const gsl_histogram * h);
int gsl_histogram_fwrite (FILE * stream, const gsl_histogram * h) ;
int gsl_histogram_fread (FILE * stream, gsl_histogram * h);
int gsl_histogram_fprintf (FILE * stream, const gsl_histogram * h,
const char * range_format, const char * bin_format);
int gsl_histogram_fscanf (FILE * stream, gsl_histogram * h);
gsl_histogram_pdf * gsl_histogram_pdf_alloc (const size_t n);
int gsl_histogram_pdf_init (gsl_histogram_pdf * p, const gsl_histogram * h);
void gsl_histogram_pdf_free (gsl_histogram_pdf * p);
double gsl_histogram_pdf_sample (const gsl_histogram_pdf * p, double r);
__END_DECLS
#endif /* __GSL_HISTOGRAM_H__ */

View File

@ -0,0 +1,172 @@
/* histogram/gsl_histogram2d.h
*
* Copyright (C) 1996, 1997, 1998, 1999, 2000, 2007 Brian Gough
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or (at
* your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef __GSL_HISTOGRAM2D_H__
#define __GSL_HISTOGRAM2D_H__
#include <stdlib.h>
#include <stdio.h>
#undef __BEGIN_DECLS
#undef __END_DECLS
#ifdef __cplusplus
# define __BEGIN_DECLS extern "C" {
# define __END_DECLS }
#else
# define __BEGIN_DECLS /* empty */
# define __END_DECLS /* empty */
#endif
__BEGIN_DECLS
typedef struct {
size_t nx, ny ;
double * xrange ;
double * yrange ;
double * bin ;
} gsl_histogram2d ;
typedef struct {
size_t nx, ny ;
double * xrange ;
double * yrange ;
double * sum ;
} gsl_histogram2d_pdf ;
gsl_histogram2d * gsl_histogram2d_alloc (const size_t nx, const size_t ny);
gsl_histogram2d * gsl_histogram2d_calloc (const size_t nx, const size_t ny);
gsl_histogram2d * gsl_histogram2d_calloc_uniform (const size_t nx, const size_t ny,
const double xmin, const double xmax,
const double ymin, const double ymax);
void gsl_histogram2d_free (gsl_histogram2d * h);
int gsl_histogram2d_increment (gsl_histogram2d * h, double x, double y);
int gsl_histogram2d_accumulate (gsl_histogram2d * h,
double x, double y, double weight);
int gsl_histogram2d_find (const gsl_histogram2d * h,
const double x, const double y, size_t * i, size_t * j);
double gsl_histogram2d_get (const gsl_histogram2d * h, const size_t i, const size_t j);
int gsl_histogram2d_get_xrange (const gsl_histogram2d * h, const size_t i,
double * xlower, double * xupper);
int gsl_histogram2d_get_yrange (const gsl_histogram2d * h, const size_t j,
double * ylower, double * yupper);
double gsl_histogram2d_xmax (const gsl_histogram2d * h);
double gsl_histogram2d_xmin (const gsl_histogram2d * h);
size_t gsl_histogram2d_nx (const gsl_histogram2d * h);
double gsl_histogram2d_ymax (const gsl_histogram2d * h);
double gsl_histogram2d_ymin (const gsl_histogram2d * h);
size_t gsl_histogram2d_ny (const gsl_histogram2d * h);
void gsl_histogram2d_reset (gsl_histogram2d * h);
gsl_histogram2d *
gsl_histogram2d_calloc_range(size_t nx, size_t ny,
double *xrange, double *yrange);
int
gsl_histogram2d_set_ranges_uniform (gsl_histogram2d * h,
double xmin, double xmax,
double ymin, double ymax);
int
gsl_histogram2d_set_ranges (gsl_histogram2d * h,
const double xrange[], size_t xsize,
const double yrange[], size_t ysize);
int
gsl_histogram2d_memcpy(gsl_histogram2d *dest, const gsl_histogram2d *source);
gsl_histogram2d *
gsl_histogram2d_clone(const gsl_histogram2d * source);
double
gsl_histogram2d_max_val(const gsl_histogram2d *h);
void
gsl_histogram2d_max_bin (const gsl_histogram2d *h, size_t *i, size_t *j);
double
gsl_histogram2d_min_val(const gsl_histogram2d *h);
void
gsl_histogram2d_min_bin (const gsl_histogram2d *h, size_t *i, size_t *j);
double
gsl_histogram2d_xmean (const gsl_histogram2d * h);
double
gsl_histogram2d_ymean (const gsl_histogram2d * h);
double
gsl_histogram2d_xsigma (const gsl_histogram2d * h);
double
gsl_histogram2d_ysigma (const gsl_histogram2d * h);
double
gsl_histogram2d_cov (const gsl_histogram2d * h);
double
gsl_histogram2d_sum (const gsl_histogram2d *h);
int
gsl_histogram2d_equal_bins_p(const gsl_histogram2d *h1,
const gsl_histogram2d *h2) ;
int
gsl_histogram2d_add(gsl_histogram2d *h1, const gsl_histogram2d *h2);
int
gsl_histogram2d_sub(gsl_histogram2d *h1, const gsl_histogram2d *h2);
int
gsl_histogram2d_mul(gsl_histogram2d *h1, const gsl_histogram2d *h2);
int
gsl_histogram2d_div(gsl_histogram2d *h1, const gsl_histogram2d *h2);
int
gsl_histogram2d_scale(gsl_histogram2d *h, double scale);
int
gsl_histogram2d_shift(gsl_histogram2d *h, double shift);
int gsl_histogram2d_fwrite (FILE * stream, const gsl_histogram2d * h) ;
int gsl_histogram2d_fread (FILE * stream, gsl_histogram2d * h);
int gsl_histogram2d_fprintf (FILE * stream, const gsl_histogram2d * h,
const char * range_format,
const char * bin_format);
int gsl_histogram2d_fscanf (FILE * stream, gsl_histogram2d * h);
gsl_histogram2d_pdf * gsl_histogram2d_pdf_alloc (const size_t nx, const size_t ny);
int gsl_histogram2d_pdf_init (gsl_histogram2d_pdf * p, const gsl_histogram2d * h);
void gsl_histogram2d_pdf_free (gsl_histogram2d_pdf * p);
int gsl_histogram2d_pdf_sample (const gsl_histogram2d_pdf * p,
double r1, double r2,
double * x, double * y);
__END_DECLS
#endif /* __GSL_HISTOGRAM2D_H__ */

View File

@ -0,0 +1,99 @@
/* ieee-utils/gsl_ieee_utils.h
*
* Copyright (C) 1996, 1997, 1998, 1999, 2000, 2007 Brian Gough
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or (at
* your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef __GSL_IEEE_UTILS_H__
#define __GSL_IEEE_UTILS_H__
#include <stdio.h>
#undef __BEGIN_DECLS
#undef __END_DECLS
#ifdef __cplusplus
# define __BEGIN_DECLS extern "C" {
# define __END_DECLS }
#else
# define __BEGIN_DECLS /* empty */
# define __END_DECLS /* empty */
#endif
__BEGIN_DECLS
enum {
GSL_IEEE_TYPE_NAN = 1,
GSL_IEEE_TYPE_INF = 2,
GSL_IEEE_TYPE_NORMAL = 3,
GSL_IEEE_TYPE_DENORMAL = 4,
GSL_IEEE_TYPE_ZERO = 5
} ;
typedef struct {
int sign ;
char mantissa[24] ; /* Actual bits are 0..22, element 23 is \0 */
int exponent ;
int type ;
} gsl_ieee_float_rep ;
typedef struct {
int sign ;
char mantissa[53] ; /* Actual bits are 0..51, element 52 is \0 */
int exponent ;
int type ;
} gsl_ieee_double_rep ;
void gsl_ieee_printf_float (const float * x) ;
void gsl_ieee_printf_double (const double * x) ;
void gsl_ieee_fprintf_float (FILE * stream, const float * x) ;
void gsl_ieee_fprintf_double (FILE * stream, const double * x) ;
void gsl_ieee_float_to_rep (const float * x, gsl_ieee_float_rep * r) ;
void gsl_ieee_double_to_rep (const double * x, gsl_ieee_double_rep * r) ;
enum {
GSL_IEEE_SINGLE_PRECISION = 1,
GSL_IEEE_DOUBLE_PRECISION = 2,
GSL_IEEE_EXTENDED_PRECISION = 3
} ;
enum {
GSL_IEEE_ROUND_TO_NEAREST = 1,
GSL_IEEE_ROUND_DOWN = 2,
GSL_IEEE_ROUND_UP = 3,
GSL_IEEE_ROUND_TO_ZERO = 4
} ;
enum {
GSL_IEEE_MASK_INVALID = 1,
GSL_IEEE_MASK_DENORMALIZED = 2,
GSL_IEEE_MASK_DIVISION_BY_ZERO = 4,
GSL_IEEE_MASK_OVERFLOW = 8,
GSL_IEEE_MASK_UNDERFLOW = 16,
GSL_IEEE_MASK_ALL = 31,
GSL_IEEE_TRAP_INEXACT = 32
} ;
void gsl_ieee_env_setup (void) ;
int gsl_ieee_read_mode_string (const char * description, int * precision,
int * rounding, int * exception_mask) ;
int gsl_ieee_set_mode (int precision, int rounding, int exception_mask) ;
__END_DECLS
#endif /* __GSL_IEEE_UTILS_H__ */

View File

@ -0,0 +1,67 @@
/* gsl_inline.h
*
* Copyright (C) 2008, 2009 Brian Gough
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or (at
* your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef __GSL_INLINE_H__
#define __GSL_INLINE_H__
/* In recent versiions of GCC, the inline keyword has two different
forms: GNU and C99.
In GNU mode we can use 'extern inline' to make inline functions
work like macros. The function is only inlined--it is never output
as a definition in an object file.
In the new C99 mode 'extern inline' has a different meaning--it
causes the definition of the function to be output in each object
file where it is used. This will result in multiple-definition
errors on linking. The 'inline' keyword on its own (without
extern) has the same behavior as the original GNU 'extern inline'.
The C99 style is the default with -std=c99 in GCC 4.3.
This header file allows either form of inline to be used by
redefining the macros INLINE_DECL and INLINE_FUN. These are used
in the public header files as
INLINE_DECL double gsl_foo (double x);
#ifdef HAVE_INLINE
INLINE_FUN double gsl_foo (double x) { return x+1.0; } ;
#endif
*/
#ifdef HAVE_INLINE
# if defined(__GNUC_STDC_INLINE__) || defined(GSL_C99_INLINE) || defined(HAVE_C99_INLINE)
# define INLINE_DECL inline /* use C99 inline */
# define INLINE_FUN inline
# else
# define INLINE_DECL /* use GNU extern inline */
# define INLINE_FUN extern inline
# endif
#else
# define INLINE_DECL /* */
#endif
/* Range checking conditions in headers do not require any run-time
tests of the global variable gsl_check_range. They are enabled or
disabled in user code at compile time with GSL_RANGE_CHECK macro.
See also build.h. */
#define GSL_RANGE_COND(x) (x)
#endif /* __GSL_INLINE_H__ */

Some files were not shown because too many files have changed in this diff Show More