mirror of
https://github.com/gnss-sdr/gnss-sdr
synced 2024-11-04 17:16:26 +00:00
025a24bb20
Added OpenCL Acquisition blocks and tests. git-svn-id: https://svn.code.sf.net/p/gnss-sdr/code/trunk@420 64b25241-fba3-4117-9849-534c7e92360d
30 lines
941 B
Common Lisp
30 lines
941 B
Common Lisp
#define MUL_RE(a,b) (a.x*b.x - a.y*b.y)
|
|
#define MUL_IM(a,b) (a.x*b.y + a.y*b.x)
|
|
#define SUM_RE(a,b) (a.x + b.x)
|
|
#define SUM_IM(a,b) (a.y + b.y)
|
|
|
|
__kernel void add_vectors(__global const float2* src1, __global const float2* src2, __global float2* dest)
|
|
{
|
|
int gid = get_global_id(0);
|
|
dest[gid] = (float2)(SUM_RE(src1[gid],src2[gid]),SUM_IM(src1[gid],src2[gid]));
|
|
}
|
|
|
|
__kernel void mult_vectors(__global const float2* src1, __global const float2* src2, __global float2* dest)
|
|
{
|
|
int gid = get_global_id(0);
|
|
dest[gid] = (float2)(MUL_RE(src1[gid],src2[gid]),MUL_IM(src1[gid],src2[gid]));
|
|
}
|
|
|
|
__kernel void conj_vector(__global const float2* src, __global float2* dest)
|
|
{
|
|
int gid = get_global_id(0);
|
|
dest[gid] = ((float2)(1,-1)) * src[gid];
|
|
}
|
|
|
|
__kernel void magnitude_squared(__global const float2* src, __global float* dest)
|
|
{
|
|
int gid = get_global_id(0);
|
|
dest[gid] = src[gid].x*src[gid].x + src[gid].y*src[gid].y;
|
|
}
|
|
|