43 <<
" Time: " << std::right << std::setw(6) << std::setfill(
' ') << std::fixed << std::setprecision(2) <<
double(
data.back().elapsedTime)*1e-6
44 <<
"s Residual: " << std::setw(11) << std::setfill(
' ') << std::scientific << std::setprecision(6) <<
data.back().residual
45 <<
" Flags: " << _flags <<
" Ranks: " << _ranks);
63 <<
" Time: " << std::right << std::setw(6) << std::setfill(
' ') << std::fixed << std::setprecision(2) <<
double(
data.back().elapsedTime)*1e-6
64 <<
"s Residual: " << std::setw(11) << std::setfill(
' ') << std::scientific << std::setprecision(6) <<
data.back().residual
65 <<
" Error: " << std::setw(11) << std::setfill(
' ') << std::scientific << std::setprecision(6) <<
data.back().error
66 <<
" Flags: " << _flags <<
" Ranks: " << _x.
ranks());
75 add(0, _residual, _ranks, _flags);
77 add(
data.back().iterationCount+1, _residual, _ranks, _flags);
85 add(0, _residual, _x, _flags);
87 add(
data.back().iterationCount+1, _residual, _x, _flags);
97 header +=
"\n# \n#itr \ttime[us] \tresidual \terror \tflags \tranks...\n";
98 std::ofstream out(_fileName);
101 out << d.iterationCount <<
'\t' << d.elapsedTime <<
'\t' << d.residual <<
'\t' << d.error <<
'\t' << d.flags;
102 for (
size_t r : d.ranks) {
112 std::vector<PerformanceData::DataPoint> convergenceData(
data);
113 if (_assumeConvergence) {
115 convergenceData.pop_back();
116 for (
auto &p : convergenceData) {
117 p.residual -= finalResidual;
121 for (
size_t i = 1; i<convergenceData.size(); ++i) {
122 if (convergenceData[i].residual <= 0 || convergenceData[i-1].residual <= 0
123 || convergenceData[i].residual >= convergenceData[i-1].residual) {
128 value_t relativeChange = convergenceData[i].residual/convergenceData[i-1].residual;
129 value_t exponent = log(relativeChange) / log(2);
130 size_t delta_t = convergenceData[i].elapsedTime - convergenceData[i-1].elapsedTime;
132 LOG(warning,
"approximated 0us by 1us");
136 REQUIRE(std::isfinite(rate),
"infinite rate? " << relativeChange <<
" " << exponent <<
" " << delta_t <<
" " << rate);
137 hist.
add(rate, delta_t);
Header file for the TTNetwork class (and thus TTTensor and TTOperator).
The main namespace of xerus.
std::vector< size_t > ranks() const
Gets the ranks of the TTNetwork.
Header file for comfort functions and macros that should not be exported in the library.
PerformanceData NoPerfData
double value_t
The type of values to be used by xerus.
std::vector< size_t > RankTuple
: Represention of the ranks of a TensorNetwork.
A logarithmic histogram, i.e. the size of all buckets is given by a constant factor [x - x*base) ...
void add(double _value, size_t _count=1)
void replace(std::string &_string, const std::string &_search, const std::string &_replace)
: Replaces all occurences of _search in _string by _replace.