Skip to content
Snippets Groups Projects
Commit 9e8bd94e authored by Jan Thorbecke's avatar Jan Thorbecke
Browse files

complex-real FFT adjusment for MKL

parent 2c7661c9
No related branches found
No related tags found
No related merge requests found
...@@ -113,8 +113,6 @@ void cr1fft(complex *cdata, REAL *rdata, int n, int sign) ...@@ -113,8 +113,6 @@ void cr1fft(complex *cdata, REAL *rdata, int n, int sign)
} }
Status = DftiSetValue(handle, DFTI_CONJUGATE_EVEN_STORAGE, DFTI_COMPLEX_COMPLEX); Status = DftiSetValue(handle, DFTI_CONJUGATE_EVEN_STORAGE, DFTI_COMPLEX_COMPLEX);
//This options is what we would like, but is depreciated in the future
//Status = DftiSetValue(handle, DFTI_CONJUGATE_EVEN_STORAGE, DFTI_COMPLEX_REAL);
if (! DftiErrorClass(Status, DFTI_NO_ERROR)) { if (! DftiErrorClass(Status, DFTI_NO_ERROR)) {
dfti_status_print(Status); dfti_status_print(Status);
printf(" DftiSetValue FAIL\n"); printf(" DftiSetValue FAIL\n");
...@@ -133,9 +131,12 @@ void cr1fft(complex *cdata, REAL *rdata, int n, int sign) ...@@ -133,9 +131,12 @@ void cr1fft(complex *cdata, REAL *rdata, int n, int sign)
printf(" DftiComputeBackward FAIL\n"); printf(" DftiComputeBackward FAIL\n");
} }
rdata[0] = tmp[0]; rdata[0] = tmp[0];
for (i=1; i<n; i++) { if (sign < 0) {
rdata[i] = -sign*tmp[n-i]; for (i=1; i<n; i++) rdata[i] = -sign*tmp[n-i];
} }
else {
for (i=1; i<n; i++) rdata[i] = tmp[i];
}
free(tmp); free(tmp);
#else #else
cr1_fft(cdata, rdata, n, sign); cr1_fft(cdata, rdata, n, sign);
......
...@@ -170,9 +170,12 @@ void crmfft(complex *cdata, REAL *rdata, int n1, int n2, int ldc, int ldr, int s ...@@ -170,9 +170,12 @@ void crmfft(complex *cdata, REAL *rdata, int n1, int n2, int ldc, int ldr, int s
for (j=0; j<n2; j++) { for (j=0; j<n2; j++) {
Status = DftiComputeBackward(handle, (MKL_Complex8 *)&cdata[j*ldc], tmp); Status = DftiComputeBackward(handle, (MKL_Complex8 *)&cdata[j*ldc], tmp);
rdata[j*ldr] = tmp[0]; rdata[j*ldr] = tmp[0];
for (i=1; i<n1; i++) { if (sign < 0) {
rdata[j*ldr+i] = -sign*tmp[n1-i]; for (i=1; i<n1; i++) rdata[j*ldr+i] = -sign*tmp[n1-i];
} }
else {
for (i=1; i<n1; i++) rdata[j*ldr+i] = tmp[i];
}
} }
free(tmp); free(tmp);
if(! DftiErrorClass(Status, DFTI_NO_ERROR)){ if(! DftiErrorClass(Status, DFTI_NO_ERROR)){
......
...@@ -115,6 +115,13 @@ void rc1fft(REAL *rdata, complex *cdata, int n, int sign) ...@@ -115,6 +115,13 @@ void rc1fft(REAL *rdata, complex *cdata, int n, int sign)
dfti_status_print(Status); dfti_status_print(Status);
printf(" DftiSetValue FAIL\n"); printf(" DftiSetValue FAIL\n");
} }
/*
Status = DftiSetValue(handle, DFTI_FORWARD_DOMAIN, DFTI_REAL);
if(! DftiErrorClass(Status, DFTI_NO_ERROR)){
dfti_status_print(Status);
printf(" DftiSetValue FAIL\n");
}
*/
Status = DftiSetValue(handle, DFTI_CONJUGATE_EVEN_STORAGE, DFTI_COMPLEX_COMPLEX); Status = DftiSetValue(handle, DFTI_CONJUGATE_EVEN_STORAGE, DFTI_COMPLEX_COMPLEX);
if (! DftiErrorClass(Status, DFTI_NO_ERROR)) { if (! DftiErrorClass(Status, DFTI_NO_ERROR)) {
......
...@@ -24,14 +24,14 @@ int main () { ...@@ -24,14 +24,14 @@ int main () {
N = 16; N = 16;
k = 5.0; k = 5.0;
sign = 1; sign = -1;
isign = -1; isign = 1;
while (N <= Nmax) { while (N <= Nmax) {
/* Initialize the data */ /* Initialize the data */
for (i=0;i<N;i++) { for (i=0;i<N;i++) {
c_data[i] = (float)-0.1+0.5*(N/2-i); c_data[i] = (float)-0.1+0.5*(N/3-i)*sin(i*M_PI/N);
// c_data[i] = 0.0; // c_data[i] = 0.0;
} }
// c_data[0] = 1.0; // c_data[0] = 1.0;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment