Overload List
| # | Signature | Description |
|---|---|---|
| 1 | TVec FFTFromReal | The forward Fast Fourier Transformation (FFT) from real to complex. |
| 2 | TVec FFTFromReal(TVec Vec) | Calculate the FFT from all Vec elements (not-in-place). |
| 3 | TMtxVec FFTFromReal(TMtxVec Vec, Int32 VecIndex, Int32 Index, Int32 Len) | The forward Fast Fourier Transformation (FFT) from real to complex. |
Overload 1: TVec FFTFromReal
The forward Fast Fourier Transformation (FFT) from real to complex.
Result: stored in self (calling object), returns self for chaining
Calculates the forward Fast Fourier Transformation (FFT) from real to complex for the calling vector in-place. The transform should be used, when the conjugate symmetric part of the frequency spectrum is not desired. If the calling vector is complex an exception will be raised. The operation implicitly sets the calling vector Complex property to True. The highest performance will be achieved if the transform length will be a power of two. The transform length is equal to Dew.Math.TMtxVecBase.Length, when the Dew.Math.TDenseMtxVec.FFTStorageFormat is fsfPack or fsfPerm. The default storage format is fsfCCS.
In-place fsfCCS complication
The transform length in case of fsfCCS will be equal to Length-2, because the result is bigger than the source data by 2 real samples, if the source data is even. If the source data length is odd, then Dew.Math.TDenseMtxVec.FFTOddLength must be set to True and only Length-1 samples will be used, but Length must of course in that case be even, or Length-1 will not be odd. The last two (one) samples in the vector will be ignored and will be overwritten with the result.
TVec a;
TVec b;
MtxVec.CreateIt(out a, out b);
try //Even
a.SetIt(false,new double[] {1,2,3,4});
b.FFTFromReal(a); // b = [(10, 0),( -2,2), (-2, 0)]
a.SetIt(false,new double[] {1,2,3,4, 0, 0}); //result requires 3 complex (or 6 real values)
a.FFTFromReal; // b = [(10, 0),( -2,2), (-2, 0)]
//Odd length
a.SetIt(false,new double[] {1,2,3});
b.FFTOddLength = true; //use only Length-1 samples
b.FFTFromReal(a); // b = [(6,0),( -1.5,0.8660)] //result requires 2 complex (= 4 real numbers)
a.SetIt(false,new double[] {1,2,3,0});
a.FFTOddLength = true; //use only Length-1 samples
a.FFTFromReal; // b = [(6,0),( -1.5,0.8660)] //result requires 2 complex (= 4 real numbers)
}
finally
{
MtxVec.FreeIt(ref a, ref b);
Overload 2: TVec FFTFromReal(TVec Vec)
Calculate the FFT from all Vec elements (not-in-place).
| # | Name | Type | Description |
|---|---|---|---|
| 1 | Vec | TVec | source TVec |
Result: stored in self (calling object), returns self for chaining
The source is Vec and the result is stored in the (separate) calling vector. Dew.Math.TMtxVecBase.Length and Dew.Math.TMtxVec.Complex of the calling vector are set implicitly to match the size and type of the result.
Unlike the in-place Dew.Math.TVec.FFTFromReal overload, this not-in-place overload needs neither extra storage nor Dew.Math.TDenseMtxVec.FFTOddLength management: all Vec.Length samples are transformed (nothing is ignored), and the result vector is sized automatically, so the caller does NOT pre-pad it by the +2 (even source length) or +1 (odd source length) real samples that the in-place variant requires. Dew.Math.TDenseMtxVec.FFTOddLength is derived automatically from Odd(Vec.Length) and stored on the result, so a matching not-in-place Dew.Math.TVec.IFFTToReal round-trips both odd and even lengths without the caller ever touching FFTOddLength.
Overload 3: TMtxVec FFTFromReal(TMtxVec Vec, Int32 VecIndex, Int32 Index, Int32 Len)
The forward Fast Fourier Transformation (FFT) from real to complex.
| # | Name | Type | Description |
|---|---|---|---|
| 1 | Vec | TMtxVec | source TVec or TMtx |
| 2 | VecIndex | Int32 | |
| 3 | Index | Int32 | start index |
| 4 | Len | Int32 | element count |
Result: stored in self (calling object), returns self for chaining
Calculate the FFT from real Vec elements [VecIndex]..[VecIndex+Len-1] and store the results in the calling object elements [Index]..[Index+Len-1]. The Len parameter must not be a power of two. Size and Dew.Math.TMtxVec.Complex properties of the calling object must be set explicitly. An exception is raised if Dew.Math.TMtxVecBase.ConditionCheck is True and Vec is not complex or if array borders are overrun.
This is the indexed version of the FFT routine Dew.Math.TVec.FFTFromReal. Look there for more information on FFT parameters and storage requirements.