9#include <fei_macros.hpp>
10#include <fei_ostream_ops.hpp>
12#include <fei_Vector.hpp>
13#include <fei_Matrix.hpp>
14#include <fei_FillableMat.hpp>
15#include <fei_CSRMat.hpp>
16#include <fei_CSVec.hpp>
19FEI_OSTREAM& operator<<(FEI_OSTREAM& os,
fei::Vector& vec)
25FEI_OSTREAM& operator<<(FEI_OSTREAM& os,
fei::Matrix& mat)
31FEI_OSTREAM& operator<<(FEI_OSTREAM& os, fei::FillableMat& mat)
33 os <<
"num rows: " << mat.getNumRows() << FEI_ENDL;
34 fei::FillableMat::iterator
35 iter = mat.begin(), iter_end = mat.end();
37 for(; iter!=iter_end; ++iter) {
38 int row = iter->first;
40 const std::vector<int>& v_ind = v->indices();
41 const std::vector<double>& v_coef = v->coefs();
43 for(
size_t i=0; i<v_ind.size(); ++i) {
44 os <<
"("<<v_ind[i]<<
","<<v_coef[i]<<
") ";
52FEI_OSTREAM& operator<<(FEI_OSTREAM& os,
fei::CSVec& vec)
54 size_t len = vec.size();
56 os <<
" numEntries: " << len << FEI_ENDL;
58 for(
size_t i=0; i<len; ++i) {
59 os <<
" " << vec.indices()[i]<<
": "<<vec.coefs()[i] << FEI_ENDL;
65FEI_OSTREAM& operator<<(FEI_OSTREAM& os,
fei::CSRMat& mat)
67 os <<
"num rows: " << mat.getNumRows() << FEI_ENDL;
69 const std::vector<int>& rows = mat.getGraph().
rowNumbers;
70 const int* rowoffs = &(mat.getGraph().
rowOffsets[0]);
72 const double* coefs = &(mat.getPackedCoefs()[0]);
74 for(
size_t i=0; i<rows.size(); ++i) {
78 for(
int j=rowoffs[i]; j<rowoffs[i+1]; ++j) {
79 os <<
"("<<cols[j]<<
","<<coefs[j]<<
") ";
virtual int writeToStream(FEI_OSTREAM &ostrm, bool matrixMarketFormat=true)=0
std::vector< int > rowNumbers
std::vector< int > packedColumnIndices
std::vector< int > rowOffsets
virtual int writeToStream(FEI_OSTREAM &ostrm, bool matrixMarketFormat=true)=0