Add cuda complex real + imag and unittest.

This commit is contained in:
sunwen
2023-12-19 13:31:05 +08:00
parent 81078bd69f
commit 3b8dbe0f31
3 changed files with 37 additions and 0 deletions

View File

@@ -36,6 +36,15 @@ TEST_F(Function1D_Cuda_Test, complex)
{
EXPECT_EQ(result1[i], result2[i]);
}
Aurora::Matrix hostMatrix2 = Aurora::Matrix::fromRawData(new float[8]{1,2,3,4,5,6,7,8}, 2,2,2);
Aurora::CudaMatrix deviceMatrix2 = hostMatrix.toDeviceMatrix();
result2 = Aurora::complex(deviceMatrix, deviceMatrix2).toHostMatrix();
for(size_t i=0; i<result2.getDataSize(); ++i)
{
EXPECT_EQ(hostMatrix[i], result2[2 * i]);
EXPECT_EQ(hostMatrix2[i], result2[2 * i + 1]);
}
}
TEST_F(Function1D_Cuda_Test, real)