view example/fft/ppe/spinFact.cc @ 1643:6c0b6947c231 draft

fix fft
author Shohei KOKUBO <e105744@ie.u-ryukyu.ac.jp>
date Sat, 22 Jun 2013 18:10:55 +0900
parents 6ff0c34c8a3c
children 32bc4ea3557f
line wrap: on
line source

#include <math.h>
#include "spinFact.h"
#ifdef __APPLE__
#include <OpenCL/opencl.h>
#else
#include <CL/cl.h>
#endif
#include "Func.h"

#define PI 3.14159265358979323846
#define PI_2 1.57079632679489661923

SchedDefineTask1(spinFact,spinFact);

static int
spinFact(SchedTask* s,void* rbuf,void* wbuf)
{
    cl_float2* w = (cl_float2*)s->get_outputAddr(0);

    unsigned long i = (unsigned long)s->get_param(0);
    
    long n = (long)s->get_param(3);

    cl_float2 angle;
    angle.x = (float)(2*i*PI/(float)n);
    angle.y = (float)((2*i*PI/(float)n) + PI_2);

    w[i].x = cos(angle.x);
    w[i].y = cos(angle.y);

    return 0;
}