23 if (matrices_.contains(key))
return *matrices_[key];
29 metadata_[key] = value;
34 fields_[key] = QSharedPointer<field<mat> >(
new field<mat>(value));
46 else return fields_[key]->at(index);
51 return fields_.contains(key);
56 return matrices_.contains(key);
61 matrices_[key] = QSharedPointer<mat>(
new mat(value));
62 column_headings_[key] = column_headings;
69 uword count = (uword(keys.size()) < value.n_cols ? keys.size() : value.n_cols);
70 for (uword i = 0; i < count; ++i)
71 matrices_[keys[i]] = QSharedPointer<mat>(
new mat(value.col(i)));
76 return matrices_.keys();
101 if (column_headings_.contains(key) && column_headings_[key].size() < column)
102 return column_headings_[key][column];
103 else return QString();
108 if (row_headings_.contains(key) && row_headings_[key].size() < row)
109 return row_headings_[key][row];
110 else return QString();
125 QSharedPointer<AnalysisResults> results(
new AnalysisResults(name_ +
" (subset)", type_ +
" (subset)"));
126 for (
auto matrix_key: matrices){
127 mat submatrix = matrices_.value(matrix_key)->rows(start_row, end_row);
128 results->AddMatrix(matrix_key, submatrix);
135 parent_rows_[key] = uvec({start_row, end_row});
151 QSet<QString> intersection =
KeyList().toSet().intersect(other->KeyList().toSet());
154 QSet<QString> mergeable_matrices = intersection;
155 for (
auto key: intersection)
156 if (
GetMatrix(key).n_rows != other->GetMatrix(key).n_rows){
157 mergeable_matrices.remove(key);
160 if (mergeable_matrices.isEmpty())
return false;
161 for (
auto key: mergeable_matrices){
163 mat other_matrix = other->GetMatrix(key);
164 matrix = join_horiz(matrix, other_matrix);
177 QSharedPointer<AnalysisResults> new_result(
new AnalysisResults(name_, type_));
179 new_result->AddMatrix(key,
GetMatrix(key));
186 matrices_.remove(key);
void SetType(const QString &new_type)
void AddMetadata(QString key, QString value)
QSharedPointer< AnalysisResults > Subset(QStringList matrices, uword start_row, uword end_row)
const mat & EmptyMatrix()
bool Concatenate(QSharedPointer< AnalysisResults > other)
AnalysisResults::Concatenate.
QMap< QString, uvec > parent_rows()
const mat & GetMatrix(const QString &key)
void RemoveMatrix(const QString &key)
const QString GetColumnHeading(const QString &key, int column)
void AddParent(QString key, uword start_row, uword end_row)
const field< mat > & GetField(const QString &key)
const QString GetRowHeading(const QString &key, int row)
const QString name() const
void AddField(const QString &key, const field< mat > &value)
bool HasField(const QString &key) const
AnalysisResults(QString name, QString type)
AnalysisResults::AnalysisResults.
QSharedPointer< AnalysisResults > Replicate()
AnalysisResults::Replicate.
void SetName(const QString &new_name)
const QStringList KeyList() const
void AddMatrix(const QString &key, const mat &value, QStringList column_headings=QStringList())
void AddColumns(const QStringList &keys, const mat &value)
const QMap< QString, QString > GetMetadata() const
const mat & GetFieldElement(const QString &key, const uword &index)
bool HasMatrix(const QString &key) const
const QString type() const
virtual ~AnalysisResults()