cudaMain.cu 857 Bytes
#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"