Repository navigation
Expand file tree
/
Copy pathworkerprocessing.h
More file actions
58 lines (41 loc) · 2.21 KB
/
Copy pathworkerprocessing.h
File metadata and controls
58 lines (41 loc) · 2.21 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
#ifndef GRAPHICAL_WORKERPROCESSING_H
#define GRAPHICAL_WORKERPROCESSING_H
#include "matrix.h"
#include "result.h"
#include "plottypes.h"
#include <QMutex>
class workerprocessing : public QObject {
Q_OBJECT
public:
explicit workerprocessing(QObject* parent = nullptr);
void requestCancellation();
public slots:
void run(const QList<QPointF>& points, PlotTypes::PlotType plotType, bool useFractions);
signals:
void finished(const Result& result);
void canceled();
void error(QString err);
private:
[[nodiscard]] bool isCanceled() const;
void fitLinear(const QList<QPointF>& points, Result& result, bool& ok, bool useFractions);
void fitQuadratic(const QList<QPointF>& points, Result& result, bool& ok, bool useFractions);
void fitExponential(const QList<QPointF>& points, Result& result, bool& ok, bool useFractions);
void fitAutomatic(const QList<QPointF>& points, Result& result, bool& ok, bool useFractions);
[[nodiscard]] static long gcd(long a, long b);
static void compute(const QList<QPointF>& points, Result& result, const QList<double>& beta,
PlotTypes::PlotType plotType, bool useFractions);
[[nodiscard]] static QList<double> solve(const g_matrix<double>& X, const QList<double>& Y);
[[nodiscard]] static QString calculateEuclideanFraction(double input);
static void fillMatrices(Result& res, const g_matrix<double>& X, const QList<double>& Y, const QList<double>& beta,
bool useFractions);
[[nodiscard]] static QString prettyPrint(double number, bool useFractions);
[[nodiscard]] static QList<QList<QString>> vecToColMat(const QList<double>& input, bool useFractions);
[[nodiscard]] static QList<QList<QString>> matToStrings(const g_matrix<double>& input, bool useFractions);
[[nodiscard]] static QList<QString> sliceRow(const QList<QString>& row, qint64 resolution,
const QString& sentinel);
[[nodiscard]] static QList<QList<QString>> sliceMatrix(const QList<QList<QString>>& mat,
qint64 rowRes, qint64 colRes,
const QString& sentinel);
QAtomicInt _canceled{0};
};
#endif //GRAPHICAL_WORKERPROCESSING_H