TRIQS/TRIQS 4.0.0
Researching Interacting Quantum Systems
Loading...
Searching...
No Matches
targets.hpp
Go to the documentation of this file.
1// Copyright (c) 2016-2018 Commissariat à l'énergie atomique et aux énergies alternatives (CEA)
2// Copyright (c) 2016-2018 Centre national de la recherche scientifique (CNRS)
3// Copyright (c) 2018-2023 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
29#include <nda/stdutil/complex.hpp>
30
31#include <type_traits>
32
33namespace triqs::gfs {
34
39
40 // Forward declarations.
41 template <int R> struct tensor_valued;
42 struct matrix_valued;
43 struct scalar_valued;
44
53 template <int R> struct tensor_real_valued {
54 static_assert(R > 0, "tensor_real_valued : R must be > 0");
55
57 static constexpr int rank = R;
58
60 static constexpr int is_real = true;
61
63 static constexpr bool is_matrix = false;
64
66 using scalar_t = double;
67
70
73 };
74
83 template <int R> struct tensor_valued {
84 static_assert(R > 0, "tensor_valued : R must be > 0");
85
87 static constexpr int rank = R;
88
90 static constexpr int is_real = false;
91
93 static constexpr bool is_matrix = false;
94
96 using scalar_t = dcomplex;
97
100
103 };
104
113 static constexpr int rank = 2;
114
116 static constexpr int is_real = true;
117
119 static constexpr bool is_matrix = true;
120
122 using scalar_t = double;
123
126
129 };
130
139 static constexpr int rank = 2;
140
142 static constexpr int is_real = false;
143
145 static constexpr bool is_matrix = true;
146
148 using scalar_t = dcomplex;
149
152
155 };
156
165 static constexpr int rank = 0;
166
168 static constexpr int is_real = true;
169
171 static constexpr bool is_matrix = false;
172
174 using scalar_t = double;
175
178
181 };
182
190 static constexpr int rank = 0;
191
193 static constexpr int is_real = false;
194
196 static constexpr bool is_matrix = false;
197
199 using scalar_t = dcomplex;
200
203
206 };
207
216 template <typename T, int R> struct _target_from_type_rank;
217
218 // Specialization mapping a complex scalar type and rank \f$ R \f$ to triqs::gfs::tensor_valued.
219 template <int R> struct _target_from_type_rank<dcomplex, R> {
220 using type = tensor_valued<R>;
221 };
222
223 // Specialization mapping a complex scalar type and rank 2 to triqs::gfs::matrix_valued.
224 template <> struct _target_from_type_rank<dcomplex, 2> {
225 using type = matrix_valued;
226 };
227
228 // Specialization mapping a complex scalar type and rank 0 to triqs::gfs::scalar_valued.
229 template <> struct _target_from_type_rank<dcomplex, 0> {
230 using type = scalar_valued;
231 };
232
233 // Specialization mapping a real scalar type and rank \f$ R \f$ to triqs::gfs::tensor_real_valued.
234 template <int R> struct _target_from_type_rank<double, R> {
235 using type = tensor_real_valued<R>;
236 };
237
238 // Specialization mapping a real scalar type and rank 2 to triqs::gfs::matrix_real_valued.
239 template <> struct _target_from_type_rank<double, 2> {
240 using type = matrix_real_valued;
241 };
242
243 // Specialization mapping a real scalar type and rank 0 to triqs::gfs::scalar_real_valued.
244 template <> struct _target_from_type_rank<double, 0> {
245 using type = scalar_real_valued;
246 };
247
258 template <typename A, int nvar>
261
263
264} // namespace triqs::gfs
Backward-compatibility umbrella header pulling in the nda array library.
typename _target_from_type_rank< typename std::decay_t< typename std::decay_t< A >::value_type >, std::decay_t< A >::rank - nvar >::type target_from_array
Deduce the target type of a Green's function from its data array type and arity.
Definition targets.hpp:259
Trait to invert the relation (scalar type, rank) target type.
Definition targets.hpp:216
Target type for a real matrix-valued Green's function.
Definition targets.hpp:111
static constexpr int rank
Rank of the target, i.e. the number of indices of the value stored at each mesh point.
Definition targets.hpp:113
static constexpr bool is_matrix
Whether the target is matrix valued.
Definition targets.hpp:119
matrix_real_valued real_t
Associated real-valued target type.
Definition targets.hpp:125
matrix_valued complex_t
Associated complex-valued target type.
Definition targets.hpp:128
static constexpr int is_real
Whether the target is real valued.
Definition targets.hpp:116
double scalar_t
Type of the scalar value, i.e. the value type of the stored nda array.
Definition targets.hpp:122
Target type for a complex matrix-valued Green's function.
Definition targets.hpp:137
static constexpr int rank
Rank of the target, i.e. the number of indices of the value stored at each mesh point.
Definition targets.hpp:139
dcomplex scalar_t
Type of the scalar value, i.e. the value type of the stored nda array.
Definition targets.hpp:148
static constexpr bool is_matrix
Whether the target is matrix valued.
Definition targets.hpp:145
matrix_real_valued real_t
Associated real-valued target type.
Definition targets.hpp:151
matrix_valued complex_t
Associated complex-valued target type.
Definition targets.hpp:154
static constexpr int is_real
Whether the target is real valued.
Definition targets.hpp:142
Target type for a real scalar-valued Green's function.
Definition targets.hpp:163
static constexpr int rank
Rank of the target, i.e. the number of indices of the value stored at each mesh point.
Definition targets.hpp:165
double scalar_t
Type of the scalar value, i.e. the value type of the stored nda array.
Definition targets.hpp:174
static constexpr bool is_matrix
Whether the target is matrix valued.
Definition targets.hpp:171
scalar_real_valued real_t
Associated real-valued target type.
Definition targets.hpp:177
scalar_valued complex_t
Associated complex-valued target type.
Definition targets.hpp:180
static constexpr int is_real
Whether the target is real valued.
Definition targets.hpp:168
Target type for a complex scalar-valued Green's function.
Definition targets.hpp:188
scalar_real_valued real_t
Associated real-valued target type.
Definition targets.hpp:202
scalar_valued complex_t
Associated complex-valued target type.
Definition targets.hpp:205
static constexpr int rank
Rank of the target, i.e. the number of indices of the value stored at each mesh point.
Definition targets.hpp:190
dcomplex scalar_t
Type of the scalar value, i.e. the value type of the stored nda array.
Definition targets.hpp:199
static constexpr int is_real
Whether the target is real valued.
Definition targets.hpp:193
static constexpr bool is_matrix
Whether the target is matrix valued.
Definition targets.hpp:196
Target type for a real tensor-valued Green's function.
Definition targets.hpp:53
static constexpr int rank
Rank of the target, i.e. the number of indices of the value stored at each mesh point.
Definition targets.hpp:57
tensor_real_valued real_t
Associated real-valued target type.
Definition targets.hpp:69
static constexpr int is_real
Whether the target is real valued.
Definition targets.hpp:60
tensor_valued< R > complex_t
Associated complex-valued target type.
Definition targets.hpp:72
double scalar_t
Type of the scalar value, i.e. the value type of the stored nda array.
Definition targets.hpp:66
static constexpr bool is_matrix
Whether the target is matrix valued.
Definition targets.hpp:63
Target type for a complex tensor-valued Green's function.
Definition targets.hpp:83
static constexpr int rank
Rank of the target, i.e. the number of indices of the value stored at each mesh point.
Definition targets.hpp:87
tensor_valued complex_t
Associated complex-valued target type.
Definition targets.hpp:102
static constexpr int is_real
Whether the target is real valued.
Definition targets.hpp:90
static constexpr bool is_matrix
Whether the target is matrix valued.
Definition targets.hpp:93
dcomplex scalar_t
Type of the scalar value, i.e. the value type of the stored nda array.
Definition targets.hpp:96
tensor_real_valued< R > real_t
Associated real-valued target type.
Definition targets.hpp:99