做好矩阵乘法和转置之后本来开心得不行的!
准备上手做个最基本的波束形成了!
突然发现希尔伯特变换完以后需要进行各种复数的运算…所以临时补写了一个复数乘法…
学着学着好像有点感觉了~!还是蛮有意思的。当然前提是能调试成功。
用一句傅小姐的名言鼓励一下“只要心甘情愿任何事情都会变得简单!”。
代码
__device__ float GetReal(const Matrix A, int row, int col) {
return A.real[row * A.stride + col];
}
__device__ float GetImag(const Matrix A, int row, int col) {
return A.imag[row * A.stride + col];
}
__device__ void SetElement(Matrix A, int row, int col, float valueR, float valueI) {
A.real[row * A.stride + col] = valueR;
A.imag[row * A.stride + col] = valueI;
}
__device__ Matrix GetSubMatrix(Matrix A, int row, int col) {
Matrix Asub;
Asub.width = BLOCK_SIZE;
Asub.height = BLOCK_SIZE;
Asub.stride = A.stride;
Asub.real = &A.real[A.stride * BLOCK_SIZE * row+ BLOCK_SIZE * col];
Asub.im