123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596 |
- //
- // File: fftshift.cpp
- //
- // MATLAB Coder version : 5.2
- // C/C++ source code generated on : 11-Mar-2023 10:38:07
- //
- // Include Files
- #include "fun1_fftshift.h"
- #include "rt_nonfinite.h"
- #include "coder_array.h"
- // Function Definitions
- //
- // Arguments : ::coder::array<creal_T, 2U> &x
- // Return Type : void
- //
- namespace coder {
- void fftshift(::coder::array<creal_T, 2U> &x)
- {
- for (int dim{0}; dim < 2; dim++) {
- int a;
- a = x.size(dim) - 1;
- if (x.size(dim) > 1) {
- int i;
- int k;
- int npages;
- int vlend2;
- vlend2 = x.size(dim) / 2 - 1;
- npages = 1;
- i = dim + 2;
- for (k = i; k < 3; k++) {
- npages *= x.size(1);
- }
- if ((vlend2 + 1) << 1 == x.size(dim)) {
- int i2;
- i2 = 0;
- for (int b_i{0}; b_i < npages; b_i++) {
- int i1;
- int ib;
- i1 = i2;
- i2 += a;
- i1++;
- i2++;
- ib = i1 + vlend2;
- for (k = 0; k <= vlend2; k++) {
- double xtmp_im;
- double xtmp_re;
- int xtmp_re_tmp;
- xtmp_re_tmp = (i1 + k) - 1;
- xtmp_re = x[xtmp_re_tmp].re;
- xtmp_im = x[xtmp_re_tmp].im;
- i = ib + k;
- x[xtmp_re_tmp] = x[i];
- x[i].re = xtmp_re;
- x[i].im = xtmp_im;
- }
- }
- } else {
- int i2;
- i2 = 0;
- for (int b_i{0}; b_i < npages; b_i++) {
- double xtmp_im;
- double xtmp_re;
- int i1;
- int ib;
- i1 = i2;
- i2 += a;
- i1++;
- i2++;
- ib = i1 + vlend2;
- xtmp_re = x[ib].re;
- xtmp_im = x[ib].im;
- for (k = 0; k <= vlend2; k++) {
- int xtmp_re_tmp;
- i = ib + k;
- xtmp_re_tmp = (i1 + k) - 1;
- x[i] = x[xtmp_re_tmp];
- x[xtmp_re_tmp] = x[i + 1];
- }
- ib = (ib + vlend2) + 1;
- x[ib].re = xtmp_re;
- x[ib].im = xtmp_im;
- }
- }
- }
- }
- }
- } // namespace coder
- //
- // File trailer for fftshift.cpp
- //
- // [EOF]
- //
|