37 #ifndef FIFF_NAMED_MATRIX_H
38 #define FIFF_NAMED_MATRIX_H
58 #include <QStringList>
59 #include <QSharedData>
60 #include <QSharedDataPointer>
61 #include <QSharedPointer>
79 typedef QSharedPointer<FiffNamedMatrix>
SPtr;
80 typedef QSharedPointer<const FiffNamedMatrix>
ConstSPtr;
81 typedef QSharedDataPointer<FiffNamedMatrix>
SDPtr;
101 const QStringList& p_row_names,
102 const QStringList& p_col_names,
103 const Eigen::MatrixXd& p_data);
131 inline bool isEmpty()
const;
140 void transpose_named_matrix();
208 return !(this->
data.size() > 0);
215 bool t_bIsShort =
true;
216 out <<
"#### Fiff Named Matrix ####\n";
217 out <<
"\tnrow: " << p_FiffNamedMatrix.
nrow << std::endl;
218 out <<
"\tncol: " << p_FiffNamedMatrix.
ncol << std::endl;
220 Eigen::MatrixXd data;
222 out <<
"\trow_names " << p_FiffNamedMatrix.
row_names.size() <<
":\n\t";
225 qint32 nchan = p_FiffNamedMatrix.
row_names.size() > 6 ? 6 : p_FiffNamedMatrix.
row_names.size();
226 for(qint32 i = 0; i < nchan/2; ++i)
227 out << p_FiffNamedMatrix.
row_names[i].toUtf8().constData() <<
" ";
229 for(qint32 i = p_FiffNamedMatrix.
row_names.size() - nchan/2; i < p_FiffNamedMatrix.
row_names.size(); ++i)
230 out << p_FiffNamedMatrix.
row_names[i].toUtf8().constData() <<
" ";
234 out <<
"\tcol_names " << p_FiffNamedMatrix.
col_names.size() <<
":\n\t";
237 qint32 nchan = p_FiffNamedMatrix.
col_names.size() > 6 ? 6 : p_FiffNamedMatrix.
col_names.size();
238 for(qint32 i = 0; i < nchan/2; ++i)
239 out << p_FiffNamedMatrix.
col_names[i].toUtf8().constData() <<
" ";
241 for(qint32 i = p_FiffNamedMatrix.
col_names.size() - nchan/2; i < p_FiffNamedMatrix.
col_names.size(); ++i)
242 out << p_FiffNamedMatrix.
col_names[i].toUtf8().constData() <<
" ";
246 out <<
"\tdata " << p_FiffNamedMatrix.
data.rows() <<
" x " << p_FiffNamedMatrix.
data.cols() <<
":\n\t";
249 qint32 nrows = p_FiffNamedMatrix.
data.rows() > 6 ? 6 : p_FiffNamedMatrix.
data.rows();
250 qint32 ncols = p_FiffNamedMatrix.
data.cols() > 6 ? 6 : p_FiffNamedMatrix.
data.cols();
253 for(qint32 i = 0; i < nrows; ++i)
255 for(qint32 j = 0; j < ncols/2; ++j)
256 out << p_FiffNamedMatrix.
data(i,j) <<
" ";
258 for(qint32 j = p_FiffNamedMatrix.
data.cols() - ncols/2; j < p_FiffNamedMatrix.
data.cols(); ++j)
259 out << p_FiffNamedMatrix.
data(i,j) <<
" ";
265 for(qint32 i = 0; i < nrows/2; ++i)
267 for(qint32 j = 0; j < ncols/2; ++j)
268 out << p_FiffNamedMatrix.
data(i,j) <<
" ";
270 for(qint32 j = p_FiffNamedMatrix.
data.cols() - ncols/2; j < p_FiffNamedMatrix.
data.cols(); ++j)
271 out << p_FiffNamedMatrix.
data(i,j) <<
" ";
275 for(qint32 i = p_FiffNamedMatrix.
data.rows()-nrows/2; i < p_FiffNamedMatrix.
data.rows(); ++i)
277 for(qint32 j = 0; j < ncols/2; ++j)
278 out << p_FiffNamedMatrix.
data(i,j) <<
" ";
280 for(qint32 j = p_FiffNamedMatrix.
data.cols() - ncols/2; j < p_FiffNamedMatrix.
data.cols(); ++j)
281 out << p_FiffNamedMatrix.
data(i,j) <<
" ";
303 #endif // FIFF_SOLUTION_H