TRIQS/TRIQS 4.0.0
Researching Interacting Quantum Systems
Loading...
Searching...
No Matches
many_body_operator.hpp
Go to the documentation of this file.
1// Copyright (c) 2017-2018 Commissariat à l'énergie atomique et aux énergies alternatives (CEA)
2// Copyright (c) 2017-2018 Centre national de la recherche scientifique (CNRS)
3// Copyright (c) 2018 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: Nils Wentzell
19
24
25#pragma once
26
27#include "./arrays.hpp"
29
34
48template <typename X, typename Y>::testing::AssertionResult test_operators_are_close(X const &x, Y const &y, double precision = 1e-6) {
49 try {
51 return ::testing::AssertionSuccess();
52 } catch (triqs::exception const &msg) { return ::testing::AssertionFailure() << msg.what(); }
53}
54
56#define EXPECT_OPERATOR_NEAR(X, ...) EXPECT_TRUE(test_operators_are_close(X, __VA_ARGS__))
57
Base class for exceptions thrown in TRIQS.
virtual const char * what() const noexcept
Build and return the full diagnostic message.
void assert_operators_are_close(many_body_operator_generic< T1 > const &op1, many_body_operator_generic< T2 > const &op2, double precision)
Assert that two many-body operators are close to each other within a given precision.
::testing::AssertionResult test_operators_are_close(X const &x, Y const &y, double precision=1e-6)
Check that two many-body operators are term-wise equal up to a given precision.
Provides generic many-body operators.
GoogleTest helper macros and an HDF5 round-trip utility shared by the TRIQS C++ test suite.