Add mkl_free_buffers to ifft and fft

This commit is contained in:
kradchen
2023-05-06 14:13:16 +08:00
parent 19947a5d42
commit f3339e58eb

View File

@@ -580,6 +580,7 @@ Matrix Aurora::median(const Matrix &aMatrix) {
Matrix Aurora::fft(const Matrix &aMatrix) {
double *output = nullptr;
mkl_free_buffers();
output = malloc(aMatrix.getDataSize(), true);
if (!aMatrix.isComplex()) {
cblas_dcopy(aMatrix.getDataSize(), aMatrix.getData(), 1, output, 2);
@@ -624,7 +625,7 @@ Matrix Aurora::fft(const Matrix &aMatrix) {
//释放资源
status = DftiFreeDescriptor(&my_desc_handle);
if (status != DFTI_NO_ERROR) goto error;
mkl_free_buffers();
return Matrix::New(output, aMatrix.getDimSize(0), aMatrix.getDimSize(1), aMatrix.getDimSize(2), Complex);
error:
std::cerr<<"FFT fail, error message:"<<DftiErrorMessage(status)<<std::endl;
@@ -637,6 +638,7 @@ Matrix Aurora::ifft(const Matrix &aMatrix) {
return Matrix();
}
DFTI_DESCRIPTOR_HANDLE my_desc_handle = NULL;
mkl_free_buffers();
auto output = malloc(aMatrix.getDataSize(),true);
MKL_LONG status;
@@ -676,6 +678,7 @@ Matrix Aurora::ifft(const Matrix &aMatrix) {
if (status != DFTI_NO_ERROR) goto error;
//释放资源
status = DftiFreeDescriptor(&my_desc_handle);
mkl_free_buffers();
if (status != DFTI_NO_ERROR) goto error;
{
return Matrix::New(output, aMatrix.getDimSize(0), aMatrix.getDimSize(1), aMatrix.getDimSize(2), Complex);