Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
pystencils
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
pycodegen
pystencils
Commits
3c53a568
Commit
3c53a568
authored
5 years ago
by
Stephan Seitz
Browse files
Options
Downloads
Patches
Plain Diff
Add csqrt, cpow to cuda_complex.hpp
parent
e512cf88
No related branches found
No related tags found
1 merge request
!101
WIP: Add csqrt, cpow to cuda_complex.hpp
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
pystencils/include/cuda_complex.hpp
+15
-0
15 additions, 0 deletions
pystencils/include/cuda_complex.hpp
with
15 additions
and
0 deletions
pystencils/include/cuda_complex.hpp
+
15
−
0
View file @
3c53a568
...
...
@@ -866,6 +866,14 @@ CUDA_CALLABLE_MEMBER complex<_Tp> sqrt(const complex<_Tp> &__x) {
return
polar
(
sqrt
(
abs
(
__x
)),
arg
(
__x
)
/
_Tp
(
2
));
}
template
<
class
T
>
CUDA_CALLABLE_MEMBER
complex
<
T
>
csqrt
(
complex
<
T
>
z
)
{
return
sqrt
<
T
>
(
z
);
};
template
<
class
T
>
CUDA_CALLABLE_MEMBER
complex
<
T
>
csqrt
(
T
z
)
{
return
csqrt
<
T
>
({
z
,
0
});
};
// exp
template
<
class
_Tp
>
...
...
@@ -1224,5 +1232,12 @@ CUDA_CALLABLE_MEMBER auto operator/(const V scalar,
using
ComplexDouble
=
complex
<
double
>
;
using
ComplexFloat
=
complex
<
float
>
;
CUDA_CALLABLE_MEMBER
template
<
class
T
,
class
U
>
complex
<
T
>
cpow
(
const
complex
<
T
>
&
z
,
const
U
&
n
)
{
return
{(
pow
(
abs
(
z
),
n
)
*
cos
(
n
*
arg
(
z
))),
(
pow
(
abs
(
z
),
n
)
*
sin
(
n
*
arg
(
z
)))};
}
#endif // CUDA_COMPLEX_HPP
}
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