Dear all,

I have 2 questions :

1)When I see /$(MY_CUDA_INSTALL_PATH)/include/math_constants.h I find most of what we normally use - PI in various precisions and forms, various roots etc. but I don’t see ``e" i.e Euler’s number anywhere, where e=2.718281828. I can always define e in my program, but it seems just convenient to have it in math_constants.h, pretty strange that its not there. Am I missing something? Is it located in another place? If yes, where?

2)My problem requires me to compute a lot of expressions of the form e^{i foo} where i is sqrt(-1) and foo can be various real or complex values or functions. I wanted to ask what would be the best way to go about it from both a performance and accuracy point of view. Currently I am doing the following :

#include <cuComplex.h>

.

.

.

double phase_diff = 9.4456*3.14;

cuDoubleComplex my_result, my_theta;

my_result = make_cuDoubleComplex(1.0, 0.0);

// e^{i phase_diff}

my_theta = make_cuDoubleComplex(cos(phase_diff), sin(phase_diff));

my_result = cuCmul(my_result,my_theta);

.

.

.

Is this the best way to do this calculation from both a performance and accuracy point of view? I am essentially using the property :

e^{i \theta} = cos \theta + i sin \theta

Is there a way I could do :

my_result = exp(my_theta);

That would be really convenient but I can’t seem to pass complex numbers to the exp() and expf(). Is there some other way to do it?

I am using CUDA 6.5, on a K20, and :

Distributor ID: Ubuntu

Description: Ubuntu 14.04.2 LTS

Release: 14.04

Codename: trusty

Linux mymachine 3.13.0-53-generic #89-Ubuntu SMP Wed May 20 10:34:39 UTC 2015 x86_64 x86_64 x86_64 GNU/Linux

Thanks!

- vihan