From b6ba3cfadfb7cd7e775c14a88ef7541f7510d37a Mon Sep 17 00:00:00 2001 From: Giovanni La Mura <giovanni.lamura@inaf.it> Date: Fri, 8 Mar 2024 15:56:45 +0100 Subject: [PATCH] Create a header of fundamental files --- src/include/types.h | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 src/include/types.h diff --git a/src/include/types.h b/src/include/types.h new file mode 100644 index 00000000..148cf2e2 --- /dev/null +++ b/src/include/types.h @@ -0,0 +1,28 @@ +/* Distributed under the terms of GPLv3 or later. See COPYING for details. */ + +/*! \file types.h + * + * \brief Definition of fundamental types in use. + */ + +#ifndef INCLUDE_TYPES_H_ +#define INCLUDE_TYPES_H_ + +#include <complex.h> + +typedef __complex__ double dcomplex; + +/*! \brief Get the real part of a complex number. + * + * \param z: `complex double` The argument of the function. + * \return rz: `double` The real part of the argument. + */ +double real(dcomplex z) { return __real__ z; } + +/*! \brief Get the imaginary part of a complex number. + * + * \param z: `complex double` The argument of the function. + * \return iz: `double` The imaginary part of the argument. + */ +double imag(dcomplex z) { return __imag__ z; } +#endif -- GitLab