Changeset 467 in Sophya for trunk/SophyaLib/NTools/fftserver.cc


Ignore:
Timestamp:
Oct 15, 1999, 2:05:15 PM (26 years ago)
Author:
ansari
Message:

Fixing of bugs, output formats, inverse transforms.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/SophyaLib/NTools/fftserver.cc

    r459 r467  
    2323sz_cfft = 0;
    2424ws_cfft = NULL;
     25sz_cdfft = 0;
     26ws_cdfft = NULL;
    2527}
    2628
     
    2931if (ws_rfft) delete[] ws_rfft;
    3032if (ws_cfft) delete[] ws_cfft;
     33if (ws_cdfft) delete[] ws_cdfft;
    3134}
    3235
     
    7578  checkint_rfft(l);
    7679  rfftf_(&l, inout, ws_rfft);
     80  for (int k= 2;k<=(l+1)/2;k++) inout[2*k-2]=-inout[2*k-2];
    7781}
    7882
     
    8185  checkint_dfft(l);
    8286  dfftf_(&l, inout, ws_dfft);
     87  for (int k= 2;k<=(l+1)/2;k++) inout[2*k-2]=-inout[2*k-2];
    8388}
    8489
     
    9297  }
    9398  cfftf_(&l, foo, ws_cfft);
    94   for (int i=0;i<l;i++) inout[i]= complex<float> (foo[2*i], foo[2*i+1]);
     99  inout[0]=complex<float> (foo[0],foo[1]);
     100  for (int i=1;i<l;i++) inout[l-i]= complex<float> (foo[2*i], foo[2*i+1]);
    95101  delete[] foo;
    96102}
     
    99105{
    100106  checkint_cdfft(l);
    101   double* foo = new double[2*l];
     107  double* foo=new double[2*l];
    102108  for (int i=0;i<l;i++){
    103109    foo[2*i]=inout[i].real();
     
    105111  }
    106112  cdfftf_(&l, foo, ws_cdfft);
    107   for (int i=0;i<l;i++) inout[i]= complex<double> (foo[2*i],foo[2*i+1]);
     113  inout[0]=complex<double> (foo[0],foo[1]);
     114  for (int i=1;i<l;i++) {
     115    inout[l-i]= complex<double> (foo[2*i],foo[2*i+1]);
     116  }
    108117  delete[] foo;
    109118}
     
    112121{
    113122  checkint_rfft(l);
    114   rfftb_(&l, inout, ws_rfft);
     123  rfftf_(&l, inout, ws_rfft);
    115124}
    116125
     
    118127{
    119128  checkint_dfft(l);
    120   dfftb_(&l, inout, ws_dfft);
     129  dfftf_(&l, inout, ws_dfft);
    121130}
    122131
     
    129138    foo[2*i+1]=inout[i].imag();
    130139  }
    131   cfftb_(&l, foo, ws_cfft);
     140  cfftf_(&l, foo, ws_cfft);
    132141  for (int i=0;i<l;i++) inout[i]=complex<float> (foo[2*i],foo[2*i+1]);
    133142  delete[] foo;
     
    142151    foo[2*i+1]=inout[i].imag();
    143152  }
    144   cdfftb_(&l, foo, ws_cdfft);
     153  cdfftf_(&l, foo, ws_cdfft);
    145154  for (int i=0;i<l;i++) inout[i]=complex<double> (foo[2*i],foo[2*i+1]);
    146155  delete[] foo;
Note: See TracChangeset for help on using the changeset viewer.