Skip to content

Commit d6407cd

Browse files
committed
Make PPCG tests C++11 compatible
1 parent 79607ca commit d6407cd

2 files changed

Lines changed: 7 additions & 2 deletions

File tree

source/source_hsolver/diago_ppcg.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
#include <stdexcept>
1212
#include <numeric>
1313
#include <complex>
14+
#include <type_traits>
1415

1516
namespace hsolver {
1617

source/source_hsolver/test/diago_ppcg_test.cpp

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2322,7 +2322,9 @@ TEST_F(DiagoPPCGBenchmarkTest, DISABLED_FullBenchmark)
23222322
std::vector<T> H;
23232323
std::vector<Real> prec;
23242324
make_random_hamilt(c.n, c.sparsity, H, prec);
2325-
auto [avg_iter, wall] = run_ppcg(c.n, c.nband, H, prec);
2325+
const std::pair<double, double> result = run_ppcg(c.n, c.nband, H, prec);
2326+
const double avg_iter = result.first;
2327+
const double wall = result.second;
23262328
printf(" %5d %3d %2d%% %6.1f %7.4f\n",
23272329
c.n, c.nband, c.sparsity, avg_iter, wall);
23282330
}
@@ -2336,7 +2338,9 @@ TEST_F(DiagoPPCGBenchmarkTest, QuickBenchmark)
23362338
std::vector<T> H;
23372339
std::vector<Real> prec;
23382340
make_random_hamilt(80, 60, H, prec);
2339-
auto [avg_iter, wall] = run_ppcg(80, 8, H, prec);
2341+
const std::pair<double, double> result = run_ppcg(80, 8, H, prec);
2342+
const double avg_iter = result.first;
2343+
const double wall = result.second;
23402344
std::cout << "[PPCG QuickBench] n=80 nband=8 sparsity=60%"
23412345
<< " avg_iter=" << avg_iter << " wall=" << wall << "s\n";
23422346
EXPECT_LE(avg_iter, 500.0) << "PPCG did not converge within 500 iters";

0 commit comments

Comments
 (0)