cudaMain.cu 1 KB
#include "cuComplex.h"
#include "cudaHandleError.h"


#define PI 3.14159
#define BLOCK_SIZE 16

__device__ cuDoubleComplex cMult(cuDoubleComplex a, cuDoubleComplex b)
{
	cuDoubleComplex result;
	result.x = a.x * b.x - a.y * b.y;
	result.y = a.x * b.y + a.y * b.x;

	return result;
}

__device__ cuDoubleComplex cMult(cuDoubleComplex a, float b)
{
	cuDoubleComplex result;
	result.x = a.x * b;
	result.y = a.y * b;

	return result;
}

__device__ cuDoubleComplex cAdd(cuDoubleComplex a, cuDoubleComplex b)
{
	cuDoubleComplex r;
	r.x = a.x + b.x;
	r.y = a.y + b.y;

	return r;
}

__device__ cuDoubleComplex cAdd(cuDoubleComplex a, float b)
{
	cuDoubleComplex r;
	r.x = a.x + b;
	r.y = a.y;

	return r;
}

__device__ cuDoubleComplex cExp(cuDoubleComplex a)
{
	cuDoubleComplex r;

	r.x = exp(a.x) * cos(a.y);
	r.y = exp(a.x) * sin(a.y);

	return r;
}

__device__ double cMag(cuDoubleComplex a)
{
	double r = sqrt(a.x * a.x + a.y * a.y);
	return r;
}

#include "cudaKK.h"