Changeset 2988 in Sophya for trunk/SophyaLib/NTools/fftpserver.cc
- Timestamp:
- Jun 23, 2006, 12:30:29 PM (19 years ago)
- File:
-
- 1 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
Note:
See TracChangeset
for help on using the changeset viewer.