SedSat3 1.1.6
Sediment Source Apportionment Tool - Advanced statistical methods for environmental pollution research
Loading...
Searching...
No Matches
cmbmatrix.h
Go to the documentation of this file.
1#ifndef CMBMATRIX_H
2#define CMBMATRIX_H
3
4#include "Matrix.h"
5#include "interface.h"
6#include "range.h"
7#include "cmbvector.h"
8
18class CMBMatrix : public CMatrix, public Interface
19{
20public:
24 CMBMatrix();
25
30 CMBMatrix(int n);
31
37 CMBMatrix(int n, int m);
38
43 CMBMatrix(const CMBMatrix& mp);
44
49 CMatrix toMatrix() const;
50
56 CMBMatrix& operator=(const CMBMatrix& mp);
57
62 QJsonObject toJsonObject() const override;
63
69 bool ReadFromJsonObject(const QJsonObject& jsonobject) override;
70
75 string ToString() const override;
76
82 bool writetofile(QFile* file) override;
83
90 double valueAt(int i, int j) const;
91
97 string ColumnLabel(int i) { return columnlabels[i]; }
98
104 string RowLabel(int i) { return rowlabels[i]; }
105
111 void SetColumnLabel(int i, const string& label) { columnlabels[i] = label; }
112
118 void SetRowLabel(int i, const string& label) { rowlabels[i] = label; }
119
124 void SetColumnLabels(const vector<string>& label) { columnlabels = label; }
125
130 void SetRowLabels(const vector<string>& label) { rowlabels = label; }
131
141 QTableWidget* ToTable() override;
142
147 vector<string> RowLabels() const { return rowlabels; }
148
153 vector<string> ColumnLabels() const { return columnlabels; }
154
160 CMBVector GetRow(const string& rowlabel);
161
167 CMBVector GetColumn(const string& columnlabel);
168
173 QStringList RowLabelCategories();
174
183 void SetBooleanValue(bool val) { boolean_values = val; }
184
185private:
186 vector<string> columnlabels;
187 vector<string> rowlabels;
188 bool boolean_values = false;
189};
190
200CMBVector operator*(const CMBMatrix& M, const CMBVector& V);
201
202#endif // CMBMATRIX_H
Matrix class with labeled rows and columns for Chemical Mass Balance analysis.
Definition cmbmatrix.h:19
CMBMatrix()
Default constructor - creates an empty matrix.
Definition cmbmatrix.cpp:6
string ColumnLabel(int i)
Gets column label at specified index.
Definition cmbmatrix.h:97
void SetRowLabel(int i, const string &label)
Sets row label at specified index.
Definition cmbmatrix.h:118
vector< string > ColumnLabels() const
Gets all column labels.
Definition cmbmatrix.h:153
CMatrix toMatrix() const
Converts to base CMatrix type (without labels)
bool boolean_values
Display values as Pass/Fail instead of numbers.
Definition cmbmatrix.h:188
string ToString() const override
Converts matrix to CSV-formatted string.
bool ReadFromJsonObject(const QJsonObject &jsonobject) override
Deserializes matrix from JSON format.
Definition cmbmatrix.cpp:67
QJsonObject toJsonObject() const override
Serializes matrix to JSON format.
Definition cmbmatrix.cpp:41
void SetColumnLabel(int i, const string &label)
Sets column label at specified index.
Definition cmbmatrix.h:111
QTableWidget * ToTable() override
Creates a QTableWidget for displaying matrix data.
string RowLabel(int i)
Gets row label at specified index.
Definition cmbmatrix.h:104
void SetBooleanValue(bool val)
Sets boolean display mode for table widget.
Definition cmbmatrix.h:183
QStringList RowLabelCategories()
Gets unique row label categories.
void SetColumnLabels(const vector< string > &label)
Sets all column labels at once.
Definition cmbmatrix.h:124
CMBMatrix & operator=(const CMBMatrix &mp)
Assignment operator.
Definition cmbmatrix.cpp:31
vector< string > columnlabels
Labels for each column.
Definition cmbmatrix.h:186
double valueAt(int i, int j) const
Gets value at specified matrix position.
CMBVector GetColumn(const string &columnlabel)
Extracts a column by its label.
void SetRowLabels(const vector< string > &label)
Sets all row labels at once.
Definition cmbmatrix.h:130
CMBVector GetRow(const string &rowlabel)
Extracts a row by its label.
vector< string > RowLabels() const
Gets all row labels.
Definition cmbmatrix.h:147
bool writetofile(QFile *file) override
Writes matrix to file in CSV format.
Definition cmbmatrix.cpp:96
vector< string > rowlabels
Labels for each row.
Definition cmbmatrix.h:187
Vector class with string labels for Chemical Mass Balance analysis.
Definition cmbvector.h:17
Abstract base class providing common serialization and visualization interface.
Definition interface.h:65
CMBVector operator*(const CMBMatrix &M, const CMBVector &V)
Matrix-vector multiplication operator.