NESSi  v1.0.2
The NonEquilibrium Systems Simulation Library

◆ print_to_file()

template<typename T >
void cntr::herm_matrix< T >::print_to_file ( const char *  file,
int  precision = 16 
) const

Saves the herm_matrix to file in text format.

Purpose

Saves the herm_matrix to file in plain text format, which can be read by the Python tools or by the corresponding read_from_file routine. Warning: this output format generates very large files.

Parameters
file

The output file name.

precision

The number of digits to be stored.

Definition at line 1308 of file cntr_herm_matrix_impl.hpp.

1308  {
1309  int i, j, l, sg = element_size_;
1310  std::ofstream out;
1311  out.open(file, std::ios::out);
1312  out.precision(precision);
1313  out << "# " << nt_ << " " << ntau_ << " " << size1_ << " "
1314  << " " << sig_ << std::endl;
1315  for (j = 0; j <= ntau_; j++) {
1316  out << "mat: " << j;
1317  for (l = 0; l < sg; l++)
1318  out << " " << matptr(j)[l].real() << " " << matptr(j)[l].imag();
1319  out << std::endl;
1320  }
1321  out << std::endl;
1322  if (nt_ >= 0) {
1323  for (i = 0; i <= nt_; i++) {
1324  for (j = 0; j <= i; j++) {
1325  out << "ret: " << i << " " << j;
1326  for (l = 0; l < sg; l++)
1327  out << " " << retptr(i, j)[l].real() << " "
1328  << retptr(i, j)[l].imag();
1329  out << std::endl;
1330  }
1331  out << std::endl;
1332  }
1333  out << std::endl;
1334  for (i = 0; i <= nt_; i++) {
1335  for (j = 0; j <= ntau_; j++) {
1336  out << "tv: " << i << " " << j;
1337  for (l = 0; l < sg; l++)
1338  out << " " << tvptr(i, j)[l].real() << " "
1339  << tvptr(i, j)[l].imag();
1340  out << std::endl;
1341  }
1342  out << std::endl;
1343  }
1344  out << std::endl;
1345  for (j = 0; j <= nt_; j++) {
1346  for (i = 0; i <= j; i++) {
1347  out << "les: " << i << " " << j;
1348  for (l = 0; l < sg; l++)
1349  out << " " << lesptr(i, j)[l].real() << " "
1350  << lesptr(i, j)[l].imag();
1351  out << std::endl;
1352  }
1353  out << std::endl;
1354  }
1355  out << std::endl;
1356  }
1357  out.close();
1358 }