Changeset 2988 in Sophya for trunk/SophyaLib/NTools


Ignore:
Timestamp:
Jun 23, 2006, 12:30:29 PM (19 years ago)
Author:
ansari
Message:

1/ MAJ documentation/commentaire dans FFTServerInterface (fftservintf.cc)
2/ Ajout flag use_out_size d'utilisation de la taille du tableau reel de
sortie pour FFTBack(complex->real) dans ReShapetoReal() pour FFTPackServer
(fichiers fftpserver.h .cc)

Reza 23 Juin 2006

Location:
trunk/SophyaLib/NTools
Files:
3 edited

Legend:

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

    r2615 r2988  
    114114{
    115115  ckR4.CheckResize(in, out, usoutsz);   
    116   ReShapetoReal(in, out);
     116  ReShapetoReal(in, out, usoutsz);
    117117  fftb(out.Size(), out.Data());
    118118}
     
    132132{
    133133  ckR8.CheckResize(in, out, usoutsz); 
    134   ReShapetoReal(in, out);
     134  ReShapetoReal(in, out, usoutsz);
    135135  fftb(out.Size(), out.Data());
    136136}
     
    138138
    139139template <class T>
    140 void FFTPack_ReShapetoReal(TArray< complex<T> > const & ina, TArray< T >  & outa)
     140void FFTPack_ReShapetoReal(TArray< complex<T> > const & ina, TArray< T >  & outa, bool usz)
    141141{
    142142  TVector< complex<T> > in(ina);
    143143  TVector< T > out(outa);
    144144  sa_size_t n = in.NElts();
    145   T thr = FFTArrayChecker<T>::ZeroThreshold();
    146   sa_size_t ncs = ( (in(n-1).imag() < -thr) || (in(n-1).imag() > thr) )
    147                   ? 2*n-1 : 2*n-2;
    148 
    149   if (out.NElts() != ncs) {
    150      cerr << "DEBUG-FFTPack_ReShapetoReal() ncs = " << ncs
    151           << " out.NElts()= " << out.NElts() << endl;
    152     throw SzMismatchError("FFTPack_ReShapetoReal() - Wrong output array size !");
     145  sa_size_t ncs;
     146  if (usz) {
     147    if ( (out.NElts() != 2*n-1) && (out.NElts() != 2*n-2) )
     148      throw SzMismatchError("FFTPack_ReShapetoReal(..., true) - Wrong output array size ");
     149    ncs = out.NElts();
     150  }
     151  else {
     152    T thr = FFTArrayChecker<T>::ZeroThreshold();
     153    ncs = ( (in(n-1).imag() < -thr) || (in(n-1).imag() > thr) ) ? 2*n-1 : 2*n-2;
     154   
     155    if (out.NElts() != ncs) {
     156      cerr << "DEBUG-FFTPack_ReShapetoReal() ncs = " << ncs
     157           << " out.NElts()= " << out.NElts() << endl;
     158      throw SzMismatchError("FFTPack_ReShapetoReal() - Wrong output array size !");
     159    }
    153160  }
    154161
     
    187194}
    188195
    189 void FFTPackServer::ReShapetoReal(TArray< complex<r_8> > const & in, TArray< r_8 >  & out)
    190 {
    191   FFTPack_ReShapetoReal<r_8>(in, out);
     196void FFTPackServer::ReShapetoReal(TArray< complex<r_8> > const & in, TArray< r_8 >  & out,
     197                                  bool usz)
     198{
     199  FFTPack_ReShapetoReal<r_8>(in, out, usz);
    192200}
    193201
     
    197205}
    198206
    199 void FFTPackServer::ReShapetoReal(TArray< complex<r_4> > const & in, TArray< r_4 >  & out)
    200 {
    201   FFTPack_ReShapetoReal<r_4>(in, out);
     207void FFTPackServer::ReShapetoReal(TArray< complex<r_4> > const & in, TArray< r_4 >  & out,
     208                                  bool usz)
     209{
     210  FFTPack_ReShapetoReal<r_4>(in, out, usz);
    202211}
    203212
  • trunk/SophyaLib/NTools/fftpserver.h

    r1402 r2988  
    3737
    3838// Methodes statiques pour reordonner les donnees
    39   static void ReShapetoReal(TArray< complex<r_8> > const & in, TArray< r_8 >  & out);
     39  static void ReShapetoReal(TArray< complex<r_8> > const & in, TArray< r_8 >  & out, bool usz);
    4040  static void ReShapetoCompl(TArray< r_8 > const & in, TArray< complex<r_8> > & out);
    41   static void ReShapetoReal(TArray< complex<r_4> > const & in, TArray< r_4 >  & out);
     41  static void ReShapetoReal(TArray< complex<r_4> > const & in, TArray< r_4 >  & out, bool usz);
    4242  static void ReShapetoCompl(TArray< r_4 > const & in, TArray< complex<r_4> > & out);
    4343
  • trunk/SophyaLib/NTools/fftservintf.cc

    r2870 r2988  
    104104  \param out : Output real array
    105105  \param usoutsz : if true, use the output array size for computing the inverse FFT.
     106
     107  In all cases, the input/output array sizes compatibility is checked.
     108  if usoutsz == false, the size of the real array is selected based on the
     109  the imaginary part of the input complex array at the nyquist frequency.
     110  size_out_real = 2*size_in_complex - ( 1 or 2)   
    106111 */
    107112void FFTServerInterface::FFTBackward(TArray< complex<r_8> > const &, TArray< r_8 > &, bool)
     
    152157  \param out : Output real array
    153158  \param usoutsz : if true, use the output array size for computing the inverse FFT.
    154  */
     159
     160  In all cases, the input/output array sizes compatibility is checked.
     161  if usoutsz == false, the size of the real array is selected based on the
     162  the imaginary part of the input complex array at the nyquist frequency.
     163  size_out_real = 2*size_in_complex - ( 1 or 2)   
     164*/
    155165void FFTServerInterface::FFTBackward(TArray< complex<r_4> > const &, TArray< r_4 > &, bool)
    156166{
Note: See TracChangeset for help on using the changeset viewer.