fun8_3_FFTImplementationCallback.cpp 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133
  1. //
  2. // File: fun8_3_FFTImplementationCallback.cpp
  3. //
  4. // MATLAB Coder version : 5.2
  5. // C/C++ source code generated on : 10-Mar-2023 15:16:29
  6. //
  7. // Include Files
  8. #include "fun8_3_FFTImplementationCallback.h"
  9. #include "rt_nonfinite.h"
  10. #include "coder_array.h"
  11. // Function Definitions
  12. //
  13. // Arguments : const ::coder::array<creal_T, 1U> &x
  14. // int unsigned_nRows
  15. // const ::coder::array<double, 2U> &costab
  16. // const ::coder::array<double, 2U> &sintab
  17. // ::coder::array<creal_T, 1U> &y
  18. // Return Type : void
  19. //
  20. namespace coder {
  21. namespace internal {
  22. namespace fft {
  23. void fun8_3_FFTImplementationCallback::r2br_r2dit_trig_impl(
  24. const ::coder::array<creal_T, 1U> &x, int unsigned_nRows,
  25. const ::coder::array<double, 2U> &costab,
  26. const ::coder::array<double, 2U> &sintab, ::coder::array<creal_T, 1U> &y)
  27. {
  28. double temp_im;
  29. double temp_re;
  30. double twid_im;
  31. double twid_re;
  32. int i;
  33. int iDelta2;
  34. int iheight;
  35. int iy;
  36. int ju;
  37. int k;
  38. int nRowsD2;
  39. y.set_size(unsigned_nRows);
  40. if (unsigned_nRows > x.size(0)) {
  41. y.set_size(unsigned_nRows);
  42. for (iy = 0; iy < unsigned_nRows; iy++) {
  43. y[iy].re = 0.0;
  44. y[iy].im = 0.0;
  45. }
  46. }
  47. iDelta2 = x.size(0);
  48. if (iDelta2 >= unsigned_nRows) {
  49. iDelta2 = unsigned_nRows;
  50. }
  51. iheight = unsigned_nRows - 2;
  52. nRowsD2 = unsigned_nRows / 2;
  53. k = nRowsD2 / 2;
  54. iy = 0;
  55. ju = 0;
  56. for (i = 0; i <= iDelta2 - 2; i++) {
  57. boolean_T tst;
  58. y[iy] = x[i];
  59. iy = unsigned_nRows;
  60. tst = true;
  61. while (tst) {
  62. iy >>= 1;
  63. ju ^= iy;
  64. tst = ((ju & iy) == 0);
  65. }
  66. iy = ju;
  67. }
  68. y[iy] = x[iDelta2 - 1];
  69. if (unsigned_nRows > 1) {
  70. for (i = 0; i <= iheight; i += 2) {
  71. temp_re = y[i + 1].re;
  72. temp_im = y[i + 1].im;
  73. twid_re = y[i].re;
  74. twid_im = y[i].im;
  75. y[i + 1].re = y[i].re - y[i + 1].re;
  76. y[i + 1].im = y[i].im - y[i + 1].im;
  77. twid_re += temp_re;
  78. twid_im += temp_im;
  79. y[i].re = twid_re;
  80. y[i].im = twid_im;
  81. }
  82. }
  83. iy = 2;
  84. iDelta2 = 4;
  85. iheight = ((k - 1) << 2) + 1;
  86. while (k > 0) {
  87. int temp_re_tmp;
  88. for (i = 0; i < iheight; i += iDelta2) {
  89. temp_re_tmp = i + iy;
  90. temp_re = y[temp_re_tmp].re;
  91. temp_im = y[temp_re_tmp].im;
  92. y[temp_re_tmp].re = y[i].re - temp_re;
  93. y[temp_re_tmp].im = y[i].im - temp_im;
  94. y[i].re = y[i].re + temp_re;
  95. y[i].im = y[i].im + temp_im;
  96. }
  97. ju = 1;
  98. for (int j{k}; j < nRowsD2; j += k) {
  99. int ihi;
  100. twid_re = costab[j];
  101. twid_im = sintab[j];
  102. i = ju;
  103. ihi = ju + iheight;
  104. while (i < ihi) {
  105. temp_re_tmp = i + iy;
  106. temp_re = twid_re * y[temp_re_tmp].re - twid_im * y[temp_re_tmp].im;
  107. temp_im = twid_re * y[temp_re_tmp].im + twid_im * y[temp_re_tmp].re;
  108. y[temp_re_tmp].re = y[i].re - temp_re;
  109. y[temp_re_tmp].im = y[i].im - temp_im;
  110. y[i].re = y[i].re + temp_re;
  111. y[i].im = y[i].im + temp_im;
  112. i += iDelta2;
  113. }
  114. ju++;
  115. }
  116. k /= 2;
  117. iy = iDelta2;
  118. iDelta2 += iDelta2;
  119. iheight -= iy;
  120. }
  121. }
  122. } // namespace fft
  123. } // namespace internal
  124. } // namespace coder
  125. //
  126. // File trailer for fun8_3_FFTImplementationCallback.cpp
  127. //
  128. // [EOF]
  129. //