Changeset 2988 in Sophya for trunk/SophyaLib/NTools
- Timestamp:
- Jun 23, 2006, 12:30:29 PM (19 years ago)
- Location:
- trunk/SophyaLib/NTools
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/SophyaLib/NTools/fftpserver.cc
r2615 r2988 114 114 { 115 115 ckR4.CheckResize(in, out, usoutsz); 116 ReShapetoReal(in, out );116 ReShapetoReal(in, out, usoutsz); 117 117 fftb(out.Size(), out.Data()); 118 118 } … … 132 132 { 133 133 ckR8.CheckResize(in, out, usoutsz); 134 ReShapetoReal(in, out );134 ReShapetoReal(in, out, usoutsz); 135 135 fftb(out.Size(), out.Data()); 136 136 } … … 138 138 139 139 template <class T> 140 void FFTPack_ReShapetoReal(TArray< complex<T> > const & ina, TArray< T > & outa )140 void FFTPack_ReShapetoReal(TArray< complex<T> > const & ina, TArray< T > & outa, bool usz) 141 141 { 142 142 TVector< complex<T> > in(ina); 143 143 TVector< T > out(outa); 144 144 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 } 153 160 } 154 161 … … 187 194 } 188 195 189 void FFTPackServer::ReShapetoReal(TArray< complex<r_8> > const & in, TArray< r_8 > & out) 190 { 191 FFTPack_ReShapetoReal<r_8>(in, out); 196 void FFTPackServer::ReShapetoReal(TArray< complex<r_8> > const & in, TArray< r_8 > & out, 197 bool usz) 198 { 199 FFTPack_ReShapetoReal<r_8>(in, out, usz); 192 200 } 193 201 … … 197 205 } 198 206 199 void FFTPackServer::ReShapetoReal(TArray< complex<r_4> > const & in, TArray< r_4 > & out) 200 { 201 FFTPack_ReShapetoReal<r_4>(in, out); 207 void FFTPackServer::ReShapetoReal(TArray< complex<r_4> > const & in, TArray< r_4 > & out, 208 bool usz) 209 { 210 FFTPack_ReShapetoReal<r_4>(in, out, usz); 202 211 } 203 212 -
trunk/SophyaLib/NTools/fftpserver.h
r1402 r2988 37 37 38 38 // 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); 40 40 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); 42 42 static void ReShapetoCompl(TArray< r_4 > const & in, TArray< complex<r_4> > & out); 43 43 -
trunk/SophyaLib/NTools/fftservintf.cc
r2870 r2988 104 104 \param out : Output real array 105 105 \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) 106 111 */ 107 112 void FFTServerInterface::FFTBackward(TArray< complex<r_8> > const &, TArray< r_8 > &, bool) … … 152 157 \param out : Output real array 153 158 \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 */ 155 165 void FFTServerInterface::FFTBackward(TArray< complex<r_4> > const &, TArray< r_4 > &, bool) 156 166 {
Note:
See TracChangeset
for help on using the changeset viewer.