2 #ifndef _BLOCK_DIAG_MATRIX_SAVE_H_ 3 #define _BLOCK_DIAG_MATRIX_SAVE_H_ 5 template <
class el_type>
8 std::ofstream out(filename.c_str(), std::ios::out | std::ios::binary);
12 out.flags(std::ios_base::scientific);
16 header=
"%%MatrixMarket matrix coordinate ";
17 header +=
"real symmetric";
19 out << header << std::endl;
20 out << n_rows() <<
" " << n_cols() <<
" " << nnz() <<
"\n";
22 for(
int i = 0; i < n_cols(); i++) {
23 out << i+1 <<
" " << i+1 <<
" " << main_diag[i] <<
"\n";
24 if (block_size(i) == 2) {
25 out << i+2 <<
" " << i+1 <<
" " << off_diag.find(i)->second <<
"\n";
26 out << i+2 <<
" " << i+2 <<
" " << main_diag[i+1] <<
"\n";
bool save(std::string filename) const
Definition: block_diag_matrix_save.h:6