123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132 |
- //
- // File: fun7_FFTImplementationCallback.cpp
- //
- // MATLAB Coder version : 5.2
- // C/C++ source code generated on : 04-Mar-2023 17:44:30
- //
- // Include Files
- #include "fun7_FFTImplementationCallback.h"
- #include "coder_array.h"
- // Function Definitions
- //
- // Arguments : const ::coder::array<creal_T, 1U> &x
- // int unsigned_nRows
- // const ::coder::array<double, 2U> &costab
- // const ::coder::array<double, 2U> &sintab
- // ::coder::array<creal_T, 1U> &y
- // Return Type : void
- //
- namespace coder {
- namespace internal {
- namespace fft {
- void fun7_FFTImplementationCallback::r2br_r2dit_trig_impl(
- const ::coder::array<creal_T, 1U> &x, int unsigned_nRows,
- const ::coder::array<double, 2U> &costab,
- const ::coder::array<double, 2U> &sintab, ::coder::array<creal_T, 1U> &y)
- {
- double temp_im;
- double temp_re;
- double twid_im;
- double twid_re;
- int i;
- int iDelta2;
- int iheight;
- int iy;
- int ju;
- int k;
- int nRowsD2;
- y.set_size(unsigned_nRows);
- if (unsigned_nRows > x.size(0)) {
- y.set_size(unsigned_nRows);
- for (iy = 0; iy < unsigned_nRows; iy++) {
- y[iy].re = 0.0;
- y[iy].im = 0.0;
- }
- }
- iDelta2 = x.size(0);
- if (iDelta2 >= unsigned_nRows) {
- iDelta2 = unsigned_nRows;
- }
- iheight = unsigned_nRows - 2;
- nRowsD2 = unsigned_nRows / 2;
- k = nRowsD2 / 2;
- iy = 0;
- ju = 0;
- for (i = 0; i <= iDelta2 - 2; i++) {
- boolean_T tst;
- y[iy] = x[i];
- iy = unsigned_nRows;
- tst = true;
- while (tst) {
- iy >>= 1;
- ju ^= iy;
- tst = ((ju & iy) == 0);
- }
- iy = ju;
- }
- y[iy] = x[iDelta2 - 1];
- if (unsigned_nRows > 1) {
- for (i = 0; i <= iheight; i += 2) {
- temp_re = y[i + 1].re;
- temp_im = y[i + 1].im;
- twid_re = y[i].re;
- twid_im = y[i].im;
- y[i + 1].re = y[i].re - y[i + 1].re;
- y[i + 1].im = y[i].im - y[i + 1].im;
- twid_re += temp_re;
- twid_im += temp_im;
- y[i].re = twid_re;
- y[i].im = twid_im;
- }
- }
- iy = 2;
- iDelta2 = 4;
- iheight = ((k - 1) << 2) + 1;
- while (k > 0) {
- int temp_re_tmp;
- for (i = 0; i < iheight; i += iDelta2) {
- temp_re_tmp = i + iy;
- temp_re = y[temp_re_tmp].re;
- temp_im = y[temp_re_tmp].im;
- y[temp_re_tmp].re = y[i].re - temp_re;
- y[temp_re_tmp].im = y[i].im - temp_im;
- y[i].re = y[i].re + temp_re;
- y[i].im = y[i].im + temp_im;
- }
- ju = 1;
- for (int j{k}; j < nRowsD2; j += k) {
- int ihi;
- twid_re = costab[j];
- twid_im = sintab[j];
- i = ju;
- ihi = ju + iheight;
- while (i < ihi) {
- temp_re_tmp = i + iy;
- temp_re = twid_re * y[temp_re_tmp].re - twid_im * y[temp_re_tmp].im;
- temp_im = twid_re * y[temp_re_tmp].im + twid_im * y[temp_re_tmp].re;
- y[temp_re_tmp].re = y[i].re - temp_re;
- y[temp_re_tmp].im = y[i].im - temp_im;
- y[i].re = y[i].re + temp_re;
- y[i].im = y[i].im + temp_im;
- i += iDelta2;
- }
- ju++;
- }
- k /= 2;
- iy = iDelta2;
- iDelta2 += iDelta2;
- iheight -= iy;
- }
- }
- } // namespace fft
- } // namespace internal
- } // namespace coder
- //
- // File trailer for fun7_FFTImplementationCallback.cpp
- //
- // [EOF]
- //
|