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