Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
N
NP_TMcode
Manage
Activity
Members
Plan
Wiki
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Container registry
Analyze
Contributor analytics
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Giacomo Mulas
NP_TMcode
Commits
91265ea8
Commit
91265ea8
authored
9 months ago
by
Giovanni La Mura
Browse files
Options
Downloads
Patches
Plain Diff
Define real() and imag() as functions to allow for overloading
parent
07136b8b
No related branches found
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/include/types.h
+16
-2
16 additions, 2 deletions
src/include/types.h
with
16 additions
and
2 deletions
src/include/types.h
+
16
−
2
View file @
91265ea8
...
...
@@ -62,7 +62,21 @@ typedef __complex__ double dcomplex;
#endif // lapack_int
#endif // np_int
#define imag(z) ( __imag__ (z) )
#define real(z) ( __real__ (z) )
#define dconjg(z) ( (__real__ (z) - I * (__imag__ (z))) )
/*! \brief Get the imaginary part of double precision complex number.
*
* \param z: `const dcomplex &` Reference to the complex number from
* which to extract the imaginary part.
* \return Im(z): `double` Imaginary part of z.
*/
double
inline
imag
(
const
dcomplex
&
z
)
{
return
__imag__
z
;
}
/*! \brief Get the imaginary part of double precision complex number.
*
* \param z: `const dcomplex &` Reference to the complex number from
* which to extract the real part.
* \return Re(z): `double` Real part of z.
*/
double
inline
real
(
const
dcomplex
&
z
)
{
return
__real__
z
;
}
#endif
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment