TRIQS/h5 1.3.0
C++ interface to HDF5
Loading...
Searching...
No Matches
complex.hpp
Go to the documentation of this file.
1// Copyright (c) 2024 Simons Foundation
2//
3// Licensed under the Apache License, Version 2.0 (the "License");
4// you may not use this file except in compliance with the License.
5// You may obtain a copy of the License at
6//
7// http://www.apache.org/licenses/LICENSE-2.0.txt
8//
9// Unless required by applicable law or agreed to in writing, software
10// distributed under the License is distributed on an "AS IS" BASIS,
11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12// See the License for the specific language governing permissions and
13// limitations under the License.
14//
15// Authors: Thomas Hahn, Olivier Parcollet, Nils Wentzell
16
22#ifndef LIBH5_COMPLEX_HPP
23#define LIBH5_COMPLEX_HPP
24
25#include <complex>
26#include <type_traits>
27
28namespace h5 {
29
38 struct dcplx_t {
40 double r;
41
43 double i;
44 };
45
46 namespace detail {
47
48 // Type trait to check if a type is std::complex.
49 template <typename T>
50 struct _is_complex : std::false_type {};
51
52 // Specialization of h5::_is_complex for std::complex.
53 template <typename T>
54 struct _is_complex<std::complex<T>> : std::true_type {};
55
56 } // namespace detail
57
63 template <typename T>
64 constexpr bool is_complex_v = detail::_is_complex<T>::value;
65
66} // namespace h5
67
68#endif // LIBH5_COMPLEX_HPP
constexpr bool is_complex_v
Boolean type trait set to true for std::complex types.
Definition complex.hpp:64
A complex compound type consisting of two doubles to represent a complex number.
Definition complex.hpp:38
double r
Real part.
Definition complex.hpp:40
double i
Imaginary part.
Definition complex.hpp:43