TRIQS/TRIQS 4.0.0
Researching Interacting Quantum Systems
Loading...
Searching...
No Matches
gfs.hpp
Go to the documentation of this file.
1// Copyright (c) 2014-2018 Commissariat à l'énergie atomique et aux énergies alternatives (CEA)
2// Copyright (c) 2014-2018 Centre national de la recherche scientifique (CNRS)
3// Copyright (c) 2018-2022 Simons Foundation
4//
5// This program is free software: you can redistribute it and/or modify
6// it under the terms of the GNU General Public License as published by
7// the Free Software Foundation, either version 3 of the License, or
8// (at your option) any later version.
9//
10// This program is distributed in the hope that it will be useful,
11// but WITHOUT ANY WARRANTY; without even the implied warranty of
12// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13// GNU General Public License for more details.
14//
15// You may obtain a copy of the License at
16// https://www.gnu.org/licenses/gpl-3.0.txt
17//
18// Authors: Michel Ferrero, Olivier Parcollet, Nils Wentzell
19
24
25#pragma once
26
27#include "./arrays.hpp"
28#include "../gfs/gf_tests.hpp"
29#include "../gfs.hpp"
31
32using namespace triqs::gfs;
33using namespace triqs;
34using namespace triqs::arrays;
35using namespace triqs::mesh;
36
41
55template <typename X, typename Y>::testing::AssertionResult test_gfs_are_close(X const &x, Y const &y, double precision = 1.e-6) {
56 try {
57 assert_gfs_are_close(x, y, precision);
58 return ::testing::AssertionSuccess();
59 } catch (triqs::exception const &msg) { return ::testing::AssertionFailure() << msg.what(); }
60}
61
63#define EXPECT_GF_NEAR(X, ...) EXPECT_TRUE(test_gfs_are_close(X, __VA_ARGS__))
64
78template <typename X, typename Y>::testing::AssertionResult test_tails_are_close(X const &x, Y const &y, double precision = 1.e-6) {
79 try {
80 assert_tails_are_close(x, y, precision);
81 return ::testing::AssertionSuccess();
82 } catch (triqs::exception const &msg) { return ::testing::AssertionFailure() << msg.what(); }
83}
84
86#define EXPECT_TAIL_NEAR(X, ...) EXPECT_TRUE(test_tails_are_close(X, __VA_ARGS__))
87
101template <typename X, typename Y>::testing::AssertionResult test_block_gfs_are_close(X const &x, Y const &y, double precision = 1.e-6) {
102 try {
103 assert_block_gfs_are_close(x, y, precision);
104 return ::testing::AssertionSuccess();
105 } catch (triqs::exception const &msg) { return ::testing::AssertionFailure() << msg.what(); }
106}
107
109#define EXPECT_BLOCK_GF_NEAR(X, ...) EXPECT_TRUE(test_block_gfs_are_close(X, __VA_ARGS__))
110
124template <typename X, typename Y>::testing::AssertionResult test_block2_gfs_are_close(X const &x, Y const &y, double precision = 1.e-6) {
125 try {
126 assert_block2_gfs_are_close(x, y, precision);
127 return ::testing::AssertionSuccess();
128 } catch (triqs::exception const &msg) { return ::testing::AssertionFailure() << msg.what(); }
129}
130
132#define EXPECT_BLOCK2_GF_NEAR(X, ...) EXPECT_TRUE(test_block2_gfs_are_close(X, __VA_ARGS__))
133
Base class for exceptions thrown in TRIQS.
virtual const char * what() const noexcept
Build and return the full diagnostic message.
TRIQS exception hierarchy and related macros.
Provides test helpers that assert two (block) Green's functions are numerically close.
Umbrella header for the Green's function library.
void assert_block2_gfs_are_close(X const &x, Y const &y, double precision)
Assert that two doubly-indexed block Green's functions are numerically close.
Definition gf_tests.hpp:87
::testing::AssertionResult test_block2_gfs_are_close(X const &x, Y const &y, double precision=1.e-6)
Check that two block-of-block (Block2) Green's functions are element-wise close.
Definition gfs.hpp:124
::testing::AssertionResult test_tails_are_close(X const &x, Y const &y, double precision=1.e-6)
Check that the high-frequency tails of two Green's functions are element-wise close.
Definition gfs.hpp:78
void assert_gfs_are_close(X const &x, Y const &y, double precision)
Assert that two Green's functions are numerically close.
Definition gf_tests.hpp:48
::testing::AssertionResult test_block_gfs_are_close(X const &x, Y const &y, double precision=1.e-6)
Check that two block Green's functions are element-wise close.
Definition gfs.hpp:101
void assert_block_gfs_are_close(X const &x, Y const &y, double precision)
Assert that two block Green's functions are numerically close.
Definition gf_tests.hpp:68
::testing::AssertionResult test_gfs_are_close(X const &x, Y const &y, double precision=1.e-6)
Check that two Green's functions are element-wise close.
Definition gfs.hpp:55
GoogleTest helper macros and an HDF5 round-trip utility shared by the TRIQS C++ test suite.