Blame view

cudaMain.cu 857 Bytes
da3d4e0e   dmayerich   Initial commit.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
  #include "cuComplex.h"
  #include "cudaHandleError.h"
  
  
  #define PI 3.14159
  #define BLOCK_SIZE 16
  
  __device__ cuComplex cMult(cuComplex a, cuComplex b)
  {
  	cuComplex result;
  	result.x = a.x * b.x - a.y * b.y;
  	result.y = a.x * b.y + a.y * b.x;
  
  	return result;
  }
  
  __device__ cuComplex cMult(cuComplex a, float b)
  {
  	cuComplex result;
  	result.x = a.x * b;
  	result.y = a.y * b;
  
  	return result;
  }
  
  __device__ cuComplex cAdd(cuComplex a, cuComplex b)
  {
  	cuComplex r;
  	r.x = a.x + b.x;
  	r.y = a.y + b.y;
  
  	return r;
  }
  
  __device__ cuComplex cAdd(cuComplex a, float b)
  {
  	cuComplex r;
  	r.x = a.x + b;
  	r.y = a.y;
  
  	return r;
  }
  
  __device__ cuComplex cExp(cuComplex a)
  {
  	cuComplex r;
  
  	r.x = exp(a.x) * cos(a.y);
  	r.y = exp(a.x) * sin(a.y);
  
  	return r;
  }
  
  __device__ float cMag(cuComplex a)
  {
  	float r = sqrt(a.x * a.x + a.y * a.y);
  	return r;
  }
  
  #include "cudaKK.h"