BornAgain  1.18.0
Simulate and fit neutron and x-ray scattering at grazing incidence
Complex.h
Go to the documentation of this file.
1 // ************************************************************************** //
2 //
3 // BornAgain: simulate and fit scattering at grazing incidence
4 //
5 //! @file Base/Types/Complex.h
6 //! @brief Defines complex_t, and a few elementary functions
7 //!
8 //! @homepage http://www.bornagainproject.org
9 //! @license GNU General Public License v3 or higher (see COPYING)
10 //! @copyright Forschungszentrum Jülich GmbH 2018
11 //! @authors Scientific Computing Group at MLZ (see CITATION, AUTHORS)
12 //
13 // ************************************************************************** //
14 
15 #ifndef BORNAGAIN_BASE_TYPES_COMPLEX_H
16 #define BORNAGAIN_BASE_TYPES_COMPLEX_H
17 
18 #include <complex>
19 
20 using complex_t = std::complex<double>;
21 constexpr complex_t I = complex_t(0.0, 1.0);
22 
23 //! Returns product I*z, where I is the imaginary unit.
25 {
26  return complex_t(-z.imag(), z.real());
27 }
28 
29 //! Returns exp(I*z), where I is the imaginary unit.
31 {
32  return std::exp(complex_t(-z.imag(), z.real()));
33 }
34 
35 #endif // BORNAGAIN_BASE_TYPES_COMPLEX_H
constexpr complex_t I
Definition: Complex.h:21
complex_t mul_I(complex_t z)
Returns product I*z, where I is the imaginary unit.
Definition: Complex.h:24
std::complex< double > complex_t
Definition: Complex.h:20
complex_t exp_I(complex_t z)
Returns exp(I*z), where I is the imaginary unit.
Definition: Complex.h:30