Esempio n. 1
0
void warning(const emlrtStack *sp)
{
  int32_T i1;
  static const char_T cv1[7] = { 'w', 'a', 'r', 'n', 'i', 'n', 'g' };

  char_T u[7];
  const mxArray *y;
  static const int32_T iv0[2] = { 1, 7 };

  const mxArray *m0;
  static const char_T cv2[7] = { 'm', 'e', 's', 's', 'a', 'g', 'e' };

  char_T b_u[7];
  const mxArray *b_y;
  static const int32_T iv1[2] = { 1, 7 };

  static const char_T msgID[43] = { 's', 'd', 'r', 'u', ':', 'S', 'D', 'R', 'u',
    'T', 'r', 'a', 'n', 's', 'm', 'i', 't', 't', 'e', 'r', ':', 'O', 'u', 't',
    'O', 'f', 'R', 'a', 'n', 'g', 'e', 'I', 'n', 't', 'e', 'r', 'p', 'F', 'a',
    'c', 't', 'o', 'r' };

  char_T c_u[43];
  const mxArray *c_y;
  static const int32_T iv2[2] = { 1, 43 };

  emlrtStack st;
  st.prev = sp;
  st.tls = sp->tls;
  for (i1 = 0; i1 < 7; i1++) {
    u[i1] = cv1[i1];
  }

  y = NULL;
  m0 = emlrtCreateCharArray(2, iv0);
  emlrtInitCharArrayR2013a(sp, 7, m0, &u[0]);
  emlrtAssign(&y, m0);
  for (i1 = 0; i1 < 7; i1++) {
    b_u[i1] = cv2[i1];
  }

  b_y = NULL;
  m0 = emlrtCreateCharArray(2, iv1);
  emlrtInitCharArrayR2013a(sp, 7, m0, &b_u[0]);
  emlrtAssign(&b_y, m0);
  for (i1 = 0; i1 < 43; i1++) {
    c_u[i1] = msgID[i1];
  }

  c_y = NULL;
  m0 = emlrtCreateCharArray(2, iv2);
  emlrtInitCharArrayR2013a(sp, 43, m0, &c_u[0]);
  emlrtAssign(&c_y, m0);
  st.site = &fb_emlrtRSI;
  b_feval(&st, y, feval(&st, b_y, c_y, &emlrtMCI), &b_emlrtMCI);
}
Esempio n. 2
0
void b_warning(const emlrtStack *sp)
{
  int32_T i11;
  static const char_T cv7[7] = { 'w', 'a', 'r', 'n', 'i', 'n', 'g' };

  char_T u[7];
  const mxArray *y;
  static const int32_T iv5[2] = { 1, 7 };

  const mxArray *m1;
  static const char_T cv8[7] = { 'm', 'e', 's', 's', 'a', 'g', 'e' };

  char_T b_u[7];
  const mxArray *b_y;
  static const int32_T iv6[2] = { 1, 7 };

  static const char_T msgID[39] = { 's', 'd', 'r', 'u', ':', 'S', 'D', 'R', 'u',
    'R', 'e', 'c', 'e', 'i', 'v', 'e', 'r', ':', 'O', 'u', 't', 'O', 'f', 'R',
    'a', 'n', 'g', 'e', 'D', 'e', 'c', 'i', 'm', 'F', 'a', 'c', 't', 'o', 'r' };

  char_T c_u[39];
  const mxArray *c_y;
  static const int32_T iv7[2] = { 1, 39 };

  emlrtStack st;
  st.prev = sp;
  st.tls = sp->tls;
  for (i11 = 0; i11 < 7; i11++) {
    u[i11] = cv7[i11];
  }

  y = NULL;
  m1 = emlrtCreateCharArray(2, iv5);
  emlrtInitCharArrayR2013a(sp, 7, m1, &u[0]);
  emlrtAssign(&y, m1);
  for (i11 = 0; i11 < 7; i11++) {
    b_u[i11] = cv8[i11];
  }

  b_y = NULL;
  m1 = emlrtCreateCharArray(2, iv6);
  emlrtInitCharArrayR2013a(sp, 7, m1, &b_u[0]);
  emlrtAssign(&b_y, m1);
  for (i11 = 0; i11 < 39; i11++) {
    c_u[i11] = msgID[i11];
  }

  c_y = NULL;
  m1 = emlrtCreateCharArray(2, iv7);
  emlrtInitCharArrayR2013a(sp, 39, m1, &c_u[0]);
  emlrtAssign(&c_y, m1);
  st.site = &fb_emlrtRSI;
  b_feval(&st, y, feval(&st, b_y, c_y, &emlrtMCI), &b_emlrtMCI);
}
void check_forloop_overflow_error(const emlrtStack *sp)
{
  const mxArray *y;
  static const int32_T iv10[2] = { 1, 34 };

  const mxArray *m2;
  char_T cv15[34];
  int32_T i;
  static const char_T cv16[34] = { 'C', 'o', 'd', 'e', 'r', ':', 't', 'o', 'o',
    'l', 'b', 'o', 'x', ':', 'i', 'n', 't', '_', 'f', 'o', 'r', 'l', 'o', 'o',
    'p', '_', 'o', 'v', 'e', 'r', 'f', 'l', 'o', 'w' };

  const mxArray *b_y;
  static const int32_T iv11[2] = { 1, 23 };

  char_T cv17[23];
  static const char_T cv18[23] = { 'c', 'o', 'd', 'e', 'r', '.', 'i', 'n', 't',
    'e', 'r', 'n', 'a', 'l', '.', 'i', 'n', 'd', 'e', 'x', 'I', 'n', 't' };

  emlrtStack st;
  emlrtStack b_st;
  st.prev = sp;
  st.tls = sp->tls;
  b_st.prev = sp;
  b_st.tls = sp->tls;
  y = NULL;
  m2 = emlrtCreateCharArray(2, iv10);
  for (i = 0; i < 34; i++) {
    cv15[i] = cv16[i];
  }

  emlrtInitCharArrayR2013a(sp, 34, m2, cv15);
  emlrtAssign(&y, m2);
  b_y = NULL;
  m2 = emlrtCreateCharArray(2, iv11);
  for (i = 0; i < 23; i++) {
    cv17[i] = cv18[i];
  }

  emlrtInitCharArrayR2013a(sp, 23, m2, cv17);
  emlrtAssign(&b_y, m2);
  st.site = &fe_emlrtRSI;
  b_st.site = &me_emlrtRSI;
  error(&st, message(&b_st, y, b_y, &emlrtMCI), &b_emlrtMCI);
}
Esempio n. 4
0
void error(const emlrtStack *sp, const char_T varargin_2_data[], const int32_T
           varargin_2_size[2])
{
  int32_T i16;
  static const char_T varargin_1[41] = { 's', 'd', 'r', 'u', ':', 'S', 'D', 'R',
    'u', 'T', 'r', 'a', 'n', 's', 'm', 'i', 't', 't', 'e', 'r', ':', 'T', 'r',
    'a', 'n', 's', 'm', 'i', 't', 'U', 'n', 's', 'u', 'c', 'c', 'e', 's', 's',
    'f', 'u', 'l' };

  char_T u[41];
  const mxArray *y;
  static const int32_T iv12[2] = { 1, 41 };

  const mxArray *m5;
  int32_T u_size[2];
  int32_T loop_ub;
  char_T u_data[1024];
  const mxArray *b_y;
  emlrtStack st;
  st.prev = sp;
  st.tls = sp->tls;
  for (i16 = 0; i16 < 41; i16++) {
    u[i16] = varargin_1[i16];
  }

  y = NULL;
  m5 = emlrtCreateCharArray(2, iv12);
  emlrtInitCharArrayR2013a(sp, 41, m5, &u[0]);
  emlrtAssign(&y, m5);
  u_size[0] = 1;
  u_size[1] = varargin_2_size[1];
  loop_ub = varargin_2_size[0] * varargin_2_size[1];
  for (i16 = 0; i16 < loop_ub; i16++) {
    u_data[i16] = varargin_2_data[i16];
  }

  b_y = NULL;
  m5 = emlrtCreateCharArray(2, u_size);
  emlrtInitCharArrayR2013a(sp, u_size[1], m5, &u_data[0]);
  emlrtAssign(&b_y, m5);
  st.site = &db_emlrtRSI;
  c_error(&st, y, b_y, &e_emlrtMCI);
}
Esempio n. 5
0
void error(const emlrtStack *sp, const char_T varargin_2_data[], const int32_T
           varargin_2_size[2])
{
  const mxArray *y;
  static const int32_T iv29[2] = { 1, 41 };

  const mxArray *m9;
  char_T cv46[41];
  int32_T i;
  static const char_T cv47[41] = { 's', 'd', 'r', 'u', ':', 'S', 'D', 'R', 'u',
    'T', 'r', 'a', 'n', 's', 'm', 'i', 't', 't', 'e', 'r', ':', 'T', 'r', 'a',
    'n', 's', 'm', 'i', 't', 'U', 'n', 's', 'u', 'c', 'c', 'e', 's', 's', 'f',
    'u', 'l' };

  int32_T u_size[2];
  int32_T i11;
  char_T u_data[1024];
  const mxArray *b_y;
  emlrtStack st;
  st.prev = sp;
  st.tls = sp->tls;
  y = NULL;
  m9 = emlrtCreateCharArray(2, iv29);
  for (i = 0; i < 41; i++) {
    cv46[i] = cv47[i];
  }

  emlrtInitCharArrayR2013a(sp, 41, m9, cv46);
  emlrtAssign(&y, m9);
  u_size[0] = 1;
  u_size[1] = varargin_2_size[1];
  i = varargin_2_size[0] * varargin_2_size[1];
  for (i11 = 0; i11 < i; i11++) {
    u_data[i11] = varargin_2_data[i11];
  }

  b_y = NULL;
  m9 = emlrtCreateCharArray(2, u_size);
  emlrtInitCharArrayR2013a(sp, u_size[1], m9, (char_T *)u_data);
  emlrtAssign(&b_y, m9);
  st.site = &mb_emlrtRSI;
  d_error(&st, y, b_y, &i_emlrtMCI);
}
Esempio n. 6
0
void eml_warning(const emlrtStack *sp, const char_T varargin_2_data[], const
                 int32_T varargin_2_size[2])
{
  const mxArray *y;
  static const int32_T iv37[2] = { 1, 31 };

  const mxArray *m15;
  char_T cv62[31];
  int32_T i;
  static const char_T cv63[31] = { 's', 'd', 'r', 'u', ':', 'S', 'D', 'R', 'u',
    'B', 'a', 's', 'e', ':', 'D', 'i', 's', 'c', 'o', 'n', 'n', 'e', 'c', 't',
    'P', 'r', 'o', 'b', 'l', 'e', 'm' };

  int32_T u_size[2];
  int32_T i13;
  char_T u_data[1024];
  const mxArray *b_y;
  emlrtStack st;
  st.prev = sp;
  st.tls = sp->tls;
  y = NULL;
  m15 = emlrtCreateCharArray(2, iv37);
  for (i = 0; i < 31; i++) {
    cv62[i] = cv63[i];
  }

  emlrtInitCharArrayR2013a(sp, 31, m15, cv62);
  emlrtAssign(&y, m15);
  u_size[0] = 1;
  u_size[1] = varargin_2_size[1];
  i = varargin_2_size[0] * varargin_2_size[1];
  for (i13 = 0; i13 < i; i13++) {
    u_data[i13] = varargin_2_data[i13];
  }

  b_y = NULL;
  m15 = emlrtCreateCharArray(2, u_size);
  emlrtInitCharArrayR2013a(sp, u_size[1], m15, (char_T *)u_data);
  emlrtAssign(&b_y, m15);
  st.site = &rb_emlrtRSI;
  warning(&st, message(&st, y, b_y, &emlrtMCI), &b_emlrtMCI);
}
Esempio n. 7
0
void b_error(const emlrtStack *sp, const char_T varargin_2_data[], const int32_T
             varargin_2_size[2])
{
  int32_T i19;
  static const char_T varargin_1[37] = { 's', 'd', 'r', 'u', ':', 'S', 'D', 'R',
    'u', 'R', 'e', 'c', 'e', 'i', 'v', 'e', 'r', ':', 'R', 'e', 'c', 'e', 'i',
    'v', 'e', 'U', 'n', 's', 'u', 'c', 'c', 'e', 's', 's', 'f', 'u', 'l' };

  char_T u[37];
  const mxArray *y;
  static const int32_T iv13[2] = { 1, 37 };

  const mxArray *m6;
  int32_T u_size[2];
  int32_T loop_ub;
  char_T u_data[1024];
  const mxArray *b_y;
  emlrtStack st;
  st.prev = sp;
  st.tls = sp->tls;
  for (i19 = 0; i19 < 37; i19++) {
    u[i19] = varargin_1[i19];
  }

  y = NULL;
  m6 = emlrtCreateCharArray(2, iv13);
  emlrtInitCharArrayR2013a(sp, 37, m6, &u[0]);
  emlrtAssign(&y, m6);
  u_size[0] = 1;
  u_size[1] = varargin_2_size[1];
  loop_ub = varargin_2_size[0] * varargin_2_size[1];
  for (i19 = 0; i19 < loop_ub; i19++) {
    u_data[i19] = varargin_2_data[i19];
  }

  b_y = NULL;
  m6 = emlrtCreateCharArray(2, u_size);
  emlrtInitCharArrayR2013a(sp, u_size[1], m6, &u_data[0]);
  emlrtAssign(&b_y, m6);
  st.site = &db_emlrtRSI;
  c_error(&st, y, b_y, &e_emlrtMCI);
}
Esempio n. 8
0
void b_error(const emlrtStack *sp, const char_T varargin_2_data[], const int32_T
             varargin_2_size[2])
{
  const mxArray *y;
  static const int32_T iv35[2] = { 1, 37 };

  const mxArray *m13;
  char_T cv58[37];
  int32_T i;
  static const char_T cv59[37] = { 's', 'd', 'r', 'u', ':', 'S', 'D', 'R', 'u',
    'R', 'e', 'c', 'e', 'i', 'v', 'e', 'r', ':', 'R', 'e', 'c', 'e', 'i', 'v',
    'e', 'U', 'n', 's', 'u', 'c', 'c', 'e', 's', 's', 'f', 'u', 'l' };

  int32_T u_size[2];
  int32_T i12;
  char_T u_data[1024];
  const mxArray *b_y;
  emlrtStack st;
  st.prev = sp;
  st.tls = sp->tls;
  y = NULL;
  m13 = emlrtCreateCharArray(2, iv35);
  for (i = 0; i < 37; i++) {
    cv58[i] = cv59[i];
  }

  emlrtInitCharArrayR2013a(sp, 37, m13, cv58);
  emlrtAssign(&y, m13);
  u_size[0] = 1;
  u_size[1] = varargin_2_size[1];
  i = varargin_2_size[0] * varargin_2_size[1];
  for (i12 = 0; i12 < i; i12++) {
    u_data[i12] = varargin_2_data[i12];
  }

  b_y = NULL;
  m13 = emlrtCreateCharArray(2, u_size);
  emlrtInitCharArrayR2013a(sp, u_size[1], m13, (char_T *)u_data);
  emlrtAssign(&b_y, m13);
  st.site = &mb_emlrtRSI;
  d_error(&st, y, b_y, &i_emlrtMCI);
}
Esempio n. 9
0
/* Function Definitions */
static const mxArray *emlrt_marshallOut(const emlrtStack *sp, const char_T u[6])
{
  const mxArray *y;
  static const int32_T iv18[2] = { 1, 6 };

  const mxArray *m9;
  y = NULL;
  m9 = emlrtCreateCharArray(2, iv18);
  emlrtInitCharArrayR2013a(sp, 6, m9, &u[0]);
  emlrtAssign(&y, m9);
  return y;
}
static void cgxe_mdl_outputs(InstanceStruct_UXvEHHrxIcmXaLthmwvduD
  *moduleInstance)
{
  real_T varargin_6[6250];
  int32_T k;
  dsp_SampleRateConverter_2 *obj;
  dspcodegen_FIRDecimator *iobj_0;
  dspcodegen_FIRRateConverter *iobj_1;
  static char_T cv14[45] = { 'M', 'A', 'T', 'L', 'A', 'B', ':', 's', 'y', 's',
    't', 'e', 'm', ':', 'm', 'e', 't', 'h', 'o', 'd', 'C', 'a', 'l', 'l', 'e',
    'd', 'W', 'h', 'e', 'n', 'R', 'e', 'l', 'e', 'a', 's', 'e', 'd', 'C', 'o',
    'd', 'e', 'g', 'e', 'n' };

  char_T u[45];
  const mxArray *y;
  static const int32_T iv21[2] = { 1, 45 };

  const mxArray *m4;
  static char_T cv15[4] = { 's', 't', 'e', 'p' };

  char_T b_u[4];
  const mxArray *b_y;
  static const int32_T iv22[2] = { 1, 4 };

  static char_T cv16[51] = { 'M', 'A', 'T', 'L', 'A', 'B', ':', 's', 'y', 's',
    't', 'e', 'm', ':', 'm', 'e', 't', 'h', 'o', 'd', 'C', 'a', 'l', 'l', 'e',
    'd', 'W', 'h', 'e', 'n', 'L', 'o', 'c', 'k', 'e', 'd', 'R', 'e', 'l', 'e',
    'a', 's', 'e', 'd', 'C', 'o', 'd', 'e', 'g', 'e', 'n' };

  char_T c_u[51];
  const mxArray *c_y;
  static const int32_T iv23[2] = { 1, 51 };

  static char_T cv17[5] = { 's', 'e', 't', 'u', 'p' };

  char_T d_u[5];
  const mxArray *d_y;
  static const int32_T iv24[2] = { 1, 5 };

  static int16_T inputSize[8] = { 6250, 1, 1, 1, 1, 1, 1, 1 };

  static char_T cv18[29] = { 'd', 's', 'p', ':', 's', 'y', 's', 't', 'e', 'm',
    ':', 'S', 'h', 'a', 'r', 'e', 'd', ':', 'n', 'u', 'm', 'C', 'h', 'a', 'n',
    'n', 'e', 'l', 's' };

  char_T e_u[29];
  const mxArray *e_y;
  static const int32_T iv25[2] = { 1, 29 };

  static real_T dv2[65] = { -0.00042490390801053907, 0.001829921716933601,
    -0.0053922845058157441, 0.013158346550611766, -0.0306391449331187,
    0.097992165418816057, 0.1494061316020634, -0.036811645611123822,
    0.015554560498179271, -0.0065160634201840671, 0.002322039466476993,
    -0.00059679513327257766, 7.912220199299E-5, -0.00018023922410876497,
    0.00087868330763207075, -0.0027374434497387575, 0.0068640356860943941,
    -0.015898279697317719, 0.044393549657968379, 0.18648984591811768,
    -0.027710944293488637, 0.011353373510521791, -0.004835216511247617,
    0.0017985509582130208, -0.0005034779575003312, 7.1006774722819944E-5, 0.0,
    0.0, 0.0, 0.0, 0.0, 0.0, 0.2, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0,
    7.1006774722819944E-5, -0.0005034779575003312, 0.0017985509582130208,
    -0.004835216511247617, 0.011353373510521791, -0.027710944293488637,
    0.18648984591811768, 0.044393549657968379, -0.015898279697317719,
    0.0068640356860943941, -0.0027374434497387575, 0.00087868330763207075,
    -0.00018023922410876497, 7.912220199299E-5, -0.00059679513327257766,
    0.002322039466476993, -0.0065160634201840671, 0.015554560498179271,
    -0.036811645611123822, 0.1494061316020634, 0.097992165418816057,
    -0.0306391449331187, 0.013158346550611766, -0.0053922845058157441,
    0.001829921716933601, -0.00042490390801053907 };

  static real_T dv3[120] = { -2.7394100013652473E-5, 0.0, 0.00037894068534068619,
    -0.0013708823152694639, 0.00268257205568729, -0.0029618195399131889, 0.0,
    0.0078609652501006478, -0.019453248977701877, 0.028984307962212054,
    -0.026341800053436379, 0.0, 0.059586630047975528, -0.16398784004285519,
    0.39970920445885333, 0.74757835469466261, 0.0, -0.076109876780524763,
    0.077352679334485558, -0.051701756420330057, 0.021737647121907556, 0.0,
    -0.009760644763162624, 0.010147444378648696, -0.0062395788347920046,
    0.00223736435719863, 0.0, -0.000578393604977232, 0.00038049397375299542,
    -0.00011122314331323368, -7.3471653020902532E-5, 0.0001803558498977357, 0.0,
    -0.0010125268340104962, 0.00312437313653832, -0.0054788551201990889,
    0.0055792244712591183, 0.0, -0.013309431044135926, 0.031938446310848335,
    -0.04692872867557716, 0.043075982682944734, 0.0, -0.11993407734560091,
    0.60283398545426792, 0.60283398545426792, -0.11993407734560091, 0.0,
    0.043075982682944734, -0.04692872867557716, 0.031938446310848335,
    -0.013309431044135926, 0.0, 0.0055792244712591183, -0.0054788551201990889,
    0.00312437313653832, -0.0010125268340104962, 0.0, 0.0001803558498977357,
    -7.3471653020902532E-5, -0.00011122314331323368, 0.00038049397375299542,
    -0.000578393604977232, 0.0, 0.00223736435719863, -0.0062395788347920046,
    0.010147444378648696, -0.009760644763162624, 0.0, 0.021737647121907556,
    -0.051701756420330057, 0.077352679334485558, -0.076109876780524763, 0.0,
    0.74757835469466261, 0.39970920445885333, -0.16398784004285519,
    0.059586630047975528, 0.0, -0.026341800053436379, 0.028984307962212054,
    -0.019453248977701877, 0.0078609652501006478, 0.0, -0.0029618195399131889,
    0.00268257205568729, -0.0013708823152694639, 0.00037894068534068619, 0.0,
    -2.7394100013652473E-5, -9.8313238270332086E-5, 0.000486827925108784,
    -0.0011378244855056148, 0.001415513014019786, 0.0, -0.0043758948985123938,
    0.011375305454062892, -0.017543845054337627, 0.01624272325576193, 0.0,
    -0.035239058026866117, 0.086157558252096214, -0.14115130237644263,
    0.18386872695653758, 0.8, 0.18386872695653758, -0.14115130237644263,
    0.086157558252096214, -0.035239058026866117, 0.0, 0.01624272325576193,
    -0.017543845054337627, 0.011375305454062892, -0.0043758948985123938, 0.0,
    0.001415513014019786, -0.0011378244855056148, 0.000486827925108784,
    -9.8313238270332086E-5, 0.0 };

  static int8_T iv26[5] = { 1, 2, 3, 4, 4 };

  char_T f_u[45];
  const mxArray *f_y;
  static const int32_T iv27[2] = { 1, 45 };

  static char_T cv19[5] = { 'r', 'e', 's', 'e', 't' };

  char_T g_u[5];
  const mxArray *g_y;
  static const int32_T iv28[2] = { 1, 5 };

  char_T h_u[45];
  const mxArray *h_y;
  static const int32_T iv29[2] = { 1, 45 };

  char_T i_u[5];
  const mxArray *i_y;
  static const int32_T iv30[2] = { 1, 5 };

  boolean_T anyInputSizeChanged;
  boolean_T exitg1;
  char_T j_u[29];
  const mxArray *j_y;
  static const int32_T iv31[2] = { 1, 29 };

  real_T varargout_1[1000];
  for (k = 0; k < 6250; k++) {
    varargin_6[k] = (*moduleInstance->u0)[k];
  }

  if (!moduleInstance->sysobj_not_empty) {
    obj = &moduleInstance->sysobj;
    moduleInstance->sysobj.filt1 = NULL;
    moduleInstance->sysobj.filt2 = NULL;
    obj->isInitialized = 0;
    obj->NumChannels = -1.0;
    moduleInstance->sysobj_not_empty = true;
  }

  obj = &moduleInstance->sysobj;
  iobj_0 = &moduleInstance->gobj_1;
  iobj_1 = &moduleInstance->gobj_3;
  if (moduleInstance->sysobj.isInitialized == 2) {
    for (k = 0; k < 45; k++) {
      u[k] = cv14[k];
    }

    y = NULL;
    m4 = emlrtCreateCharArray(2, iv21);
    emlrtInitCharArrayR2013a(moduleInstance->emlrtRootTLSGlobal, 45, m4, &u[0]);
    emlrtAssign(&y, m4);
    for (k = 0; k < 4; k++) {
      b_u[k] = cv15[k];
    }

    b_y = NULL;
    m4 = emlrtCreateCharArray(2, iv22);
    emlrtInitCharArrayR2013a(moduleInstance->emlrtRootTLSGlobal, 4, m4, &b_u[0]);
    emlrtAssign(&b_y, m4);
    error(moduleInstance, message(moduleInstance, y, b_y, &c_emlrtMCI),
          &c_emlrtMCI);
  }

  if (obj->isInitialized != 1) {
    if (obj->isInitialized != 0) {
      for (k = 0; k < 51; k++) {
        c_u[k] = cv16[k];
      }

      c_y = NULL;
      m4 = emlrtCreateCharArray(2, iv23);
      emlrtInitCharArrayR2013a(moduleInstance->emlrtRootTLSGlobal, 51, m4, &c_u
        [0]);
      emlrtAssign(&c_y, m4);
      for (k = 0; k < 5; k++) {
        d_u[k] = cv17[k];
      }

      d_y = NULL;
      m4 = emlrtCreateCharArray(2, iv24);
      emlrtInitCharArrayR2013a(moduleInstance->emlrtRootTLSGlobal, 5, m4, &d_u[0]);
      emlrtAssign(&d_y, m4);
      error(moduleInstance, message(moduleInstance, c_y, d_y, &c_emlrtMCI),
            &c_emlrtMCI);
    }

    obj->isInitialized = 1;
    for (k = 0; k < 8; k++) {
      obj->inputVarSize1[k] = (uint32_T)inputSize[k];
    }

    if ((obj->NumChannels != -1.0) && (1.0 != obj->NumChannels)) {
      for (k = 0; k < 29; k++) {
        e_u[k] = cv18[k];
      }

      e_y = NULL;
      m4 = emlrtCreateCharArray(2, iv25);
      emlrtInitCharArrayR2013a(moduleInstance->emlrtRootTLSGlobal, 29, m4, &e_u
        [0]);
      emlrtAssign(&e_y, m4);
      error(moduleInstance, b_message(moduleInstance, e_y, &d_emlrtMCI),
            &d_emlrtMCI);
    }

    if (!(obj->filt1 == NULL)) {
      emlrtErrorWithMessageIdR2012b(moduleInstance->emlrtRootTLSGlobal,
        &b_emlrtRTEI, "EMLRT:runTime:NontunableHandleProp", 0);
    }

    iobj_0->isInitialized = 0;

    /* System object Constructor function: dsp.FIRDecimator */
    iobj_0->cSFunObject.P0_IC = 0.0;
    for (k = 0; k < 65; k++) {
      iobj_0->cSFunObject.P1_FILT[k] = dv2[k];
    }

    obj->filt1 = iobj_0;
    if (!(obj->filt2 == NULL)) {
      emlrtErrorWithMessageIdR2012b(moduleInstance->emlrtRootTLSGlobal,
        &emlrtRTEI, "EMLRT:runTime:NontunableHandleProp", 0);
    }

    iobj_1->isInitialized = 0;

    /* System object Constructor function: dsp.FIRRateConverter */
    for (k = 0; k < 120; k++) {
      iobj_1->cSFunObject.P0_FILTER[k] = dv3[k];
    }

    for (k = 0; k < 4; k++) {
      iobj_1->cSFunObject.P1_PolyphaseSelector[k] = k;
    }

    for (k = 0; k < 5; k++) {
      iobj_1->cSFunObject.P2_StartIdx[k] = k;
    }

    for (k = 0; k < 5; k++) {
      iobj_1->cSFunObject.P3_StopIdx[k] = iv26[k];
    }

    obj->filt2 = iobj_1;
    obj->NumChannels = 1.0;
    iobj_0 = obj->filt1;
    if (iobj_0->isInitialized == 2) {
      for (k = 0; k < 45; k++) {
        f_u[k] = cv14[k];
      }

      f_y = NULL;
      m4 = emlrtCreateCharArray(2, iv27);
      emlrtInitCharArrayR2013a(moduleInstance->emlrtRootTLSGlobal, 45, m4, &f_u
        [0]);
      emlrtAssign(&f_y, m4);
      for (k = 0; k < 5; k++) {
        g_u[k] = cv19[k];
      }

      g_y = NULL;
      m4 = emlrtCreateCharArray(2, iv28);
      emlrtInitCharArrayR2013a(moduleInstance->emlrtRootTLSGlobal, 5, m4, &g_u[0]);
      emlrtAssign(&g_y, m4);
      error(moduleInstance, message(moduleInstance, f_y, g_y, &c_emlrtMCI),
            &c_emlrtMCI);
    }

    if (iobj_0->isInitialized == 1) {
      /* System object Initialization function: dsp.FIRDecimator */
      iobj_0->cSFunObject.W2_CoeffIdx = 52;
      iobj_0->cSFunObject.W0_PhaseIdx = 4;
      iobj_0->cSFunObject.W4_TapDelayIndex = 48;
      iobj_0->cSFunObject.W1_Sums = 0.0;
      for (k = 0; k < 60; k++) {
        iobj_0->cSFunObject.W3_StatesBuff[k] = 0.0;
      }
    }

    iobj_1 = obj->filt2;
    if (iobj_1->isInitialized == 2) {
      for (k = 0; k < 45; k++) {
        h_u[k] = cv14[k];
      }

      h_y = NULL;
      m4 = emlrtCreateCharArray(2, iv29);
      emlrtInitCharArrayR2013a(moduleInstance->emlrtRootTLSGlobal, 45, m4, &h_u
        [0]);
      emlrtAssign(&h_y, m4);
      for (k = 0; k < 5; k++) {
        i_u[k] = cv19[k];
      }

      i_y = NULL;
      m4 = emlrtCreateCharArray(2, iv30);
      emlrtInitCharArrayR2013a(moduleInstance->emlrtRootTLSGlobal, 5, m4, &i_u[0]);
      emlrtAssign(&i_y, m4);
      error(moduleInstance, message(moduleInstance, h_y, i_y, &c_emlrtMCI),
            &c_emlrtMCI);
    }

    if (iobj_1->isInitialized == 1) {
      /* System object Initialization function: dsp.FIRRateConverter */
      iobj_1->cSFunObject.W1_InBufIdx = 0;
      for (k = 0; k < 30; k++) {
        iobj_1->cSFunObject.W0_InBuf[k] = 0.0;
      }
    }
  }

  anyInputSizeChanged = false;
  k = 0;
  exitg1 = false;
  while ((exitg1 == false) && (k < 8)) {
    if (obj->inputVarSize1[k] != (uint32_T)inputSize[k]) {
      anyInputSizeChanged = true;
      for (k = 0; k < 8; k++) {
        obj->inputVarSize1[k] = (uint32_T)inputSize[k];
      }

      exitg1 = true;
    } else {
      k++;
    }
  }

  if (anyInputSizeChanged && (obj->NumChannels != -1.0) && (1.0 !=
       obj->NumChannels)) {
    for (k = 0; k < 29; k++) {
      j_u[k] = cv18[k];
    }

    j_y = NULL;
    m4 = emlrtCreateCharArray(2, iv31);
    emlrtInitCharArrayR2013a(moduleInstance->emlrtRootTLSGlobal, 29, m4, &j_u[0]);
    emlrtAssign(&j_y, m4);
    error(moduleInstance, b_message(moduleInstance, j_y, &d_emlrtMCI),
          &d_emlrtMCI);
  }

  SampleRateConverter_stepImpl(moduleInstance, obj, varargin_6, varargout_1);
  for (k = 0; k < 1000; k++) {
    (*moduleInstance->b_y0)[k] = varargout_1[k];
  }
}
/* Function Definitions */
static void SampleRateConverter_stepImpl(InstanceStruct_UXvEHHrxIcmXaLthmwvduD
  *moduleInstance, dsp_SampleRateConverter_2 *obj, real_T u[6250], real_T y[1000])
{
  real_T b_y1[1250];
  dspcodegen_FIRRateConverter *b_obj;
  int32_T nModDFactor;
  static char_T cv0[45] = { 'M', 'A', 'T', 'L', 'A', 'B', ':', 's', 'y', 's',
    't', 'e', 'm', ':', 'm', 'e', 't', 'h', 'o', 'd', 'C', 'a', 'l', 'l', 'e',
    'd', 'W', 'h', 'e', 'n', 'R', 'e', 'l', 'e', 'a', 's', 'e', 'd', 'C', 'o',
    'd', 'e', 'g', 'e', 'n' };

  char_T b_u[45];
  const mxArray *b_y;
  static const int32_T iv0[2] = { 1, 45 };

  const mxArray *m0;
  static char_T cv1[4] = { 's', 't', 'e', 'p' };

  char_T c_u[4];
  const mxArray *c_y;
  static const int32_T iv1[2] = { 1, 4 };

  static char_T cv2[51] = { 'M', 'A', 'T', 'L', 'A', 'B', ':', 's', 'y', 's',
    't', 'e', 'm', ':', 'm', 'e', 't', 'h', 'o', 'd', 'C', 'a', 'l', 'l', 'e',
    'd', 'W', 'h', 'e', 'n', 'L', 'o', 'c', 'k', 'e', 'd', 'R', 'e', 'l', 'e',
    'a', 's', 'e', 'd', 'C', 'o', 'd', 'e', 'g', 'e', 'n' };

  char_T d_u[51];
  const mxArray *d_y;
  static const int32_T iv2[2] = { 1, 51 };

  static char_T cv3[5] = { 's', 'e', 't', 'u', 'p' };

  char_T e_u[5];
  const mxArray *e_y;
  static const int32_T iv3[2] = { 1, 5 };

  dsp_FIRRateConverter_1 *c_obj;
  int32_T outIdx;
  int32_T inIdx;
  int32_T inBufIdx;
  int32_T n;
  int32_T outputStartIdx;
  real_T acc;
  int32_T coefPolyphaseOffset;
  int32_T i;
  real_T prod;
  SystemCore_step(moduleInstance, obj->filt1, u, b_y1);
  b_obj = obj->filt2;
  if (b_obj->isInitialized == 2) {
    for (nModDFactor = 0; nModDFactor < 45; nModDFactor++) {
      b_u[nModDFactor] = cv0[nModDFactor];
    }

    b_y = NULL;
    m0 = emlrtCreateCharArray(2, iv0);
    emlrtInitCharArrayR2013a(moduleInstance->emlrtRootTLSGlobal, 45, m0, &b_u[0]);
    emlrtAssign(&b_y, m0);
    for (nModDFactor = 0; nModDFactor < 4; nModDFactor++) {
      c_u[nModDFactor] = cv1[nModDFactor];
    }

    c_y = NULL;
    m0 = emlrtCreateCharArray(2, iv1);
    emlrtInitCharArrayR2013a(moduleInstance->emlrtRootTLSGlobal, 4, m0, &c_u[0]);
    emlrtAssign(&c_y, m0);
    error(moduleInstance, message(moduleInstance, b_y, c_y, &c_emlrtMCI),
          &c_emlrtMCI);
  }

  if (b_obj->isInitialized != 1) {
    if (b_obj->isInitialized != 0) {
      for (nModDFactor = 0; nModDFactor < 51; nModDFactor++) {
        d_u[nModDFactor] = cv2[nModDFactor];
      }

      d_y = NULL;
      m0 = emlrtCreateCharArray(2, iv2);
      emlrtInitCharArrayR2013a(moduleInstance->emlrtRootTLSGlobal, 51, m0, &d_u
        [0]);
      emlrtAssign(&d_y, m0);
      for (nModDFactor = 0; nModDFactor < 5; nModDFactor++) {
        e_u[nModDFactor] = cv3[nModDFactor];
      }

      e_y = NULL;
      m0 = emlrtCreateCharArray(2, iv3);
      emlrtInitCharArrayR2013a(moduleInstance->emlrtRootTLSGlobal, 5, m0, &e_u[0]);
      emlrtAssign(&e_y, m0);
      error(moduleInstance, message(moduleInstance, d_y, e_y, &c_emlrtMCI),
            &c_emlrtMCI);
    }

    b_obj->isInitialized = 1;

    /* System object Initialization function: dsp.FIRRateConverter */
    b_obj->cSFunObject.W1_InBufIdx = 0;
    for (nModDFactor = 0; nModDFactor < 30; nModDFactor++) {
      b_obj->cSFunObject.W0_InBuf[nModDFactor] = 0.0;
    }
  }

  c_obj = &b_obj->cSFunObject;

  /* System object Outputs function: dsp.FIRRateConverter */
  outIdx = 0;
  inIdx = 0;

  /* Update inBufIdx and inputChannelOffset for current channel */
  inBufIdx = b_obj->cSFunObject.W1_InBufIdx;
  for (n = 0; n < 1250; n++) {
    nModDFactor = n % 5;
    outputStartIdx = c_obj->P2_StartIdx[nModDFactor];
    nModDFactor = c_obj->P3_StopIdx[nModDFactor];

    /* Read input into inBufArray */
    c_obj->W0_InBuf[inBufIdx] = b_y1[inIdx];
    inIdx++;

    /* Generate outputs (if any) for current input n */
    while (outputStartIdx < nModDFactor) {
      acc = 0.0;
      coefPolyphaseOffset = c_obj->P1_PolyphaseSelector[outputStartIdx] * 30;
      for (i = inBufIdx; i < 30; i++) {
        prod = c_obj->P0_FILTER[(coefPolyphaseOffset + i) - inBufIdx] *
          c_obj->W0_InBuf[i];
        acc += prod;
      }

      for (i = 0; i < inBufIdx; i++) {
        prod = c_obj->P0_FILTER[((coefPolyphaseOffset - inBufIdx) + i) + 30] *
          c_obj->W0_InBuf[i];
        acc += prod;
      }

      y[outIdx] = acc;
      outIdx++;
      outputStartIdx++;
    }

    /* Decrement inBufIdx, wrap if necessary */
    if (inBufIdx == 0) {
      inBufIdx = 29;
    } else {
      inBufIdx--;
    }
  }

  /* Update inBufIdx */
  b_obj->cSFunObject.W1_InBufIdx = inBufIdx;
}
Esempio n. 12
0
/* Function Definitions */
void b_mapiPrivate(const emlrtStack *sp, int32_T varargin_1, UsrpErrorCapiEnumT *
                   varargout_1, char_T varargout_2_data[], int32_T
                   varargout_2_size[2])
{
  int32_T i14;
  static const char_T cv14[6] = { 's', 'i', 'l', 'e', 'n', 't' };

  char_T u[6];
  const mxArray *y;
  static const int32_T iv10[2] = { 1, 6 };

  const mxArray *m3;
  UsrpErrorCapiEnumT errStat_i;
  int32_T errStrSize;
  emlrtStack st;
  st.prev = sp;
  st.tls = sp->tls;

  /*  */
  /*  This function unifies handling of interp vs. codegen call as well as */
  /*  errStat / errStr assignment. */
  /*  */
  /*    Copyright 2011-2015 The MathWorks, Inc. */
  if (!isSetupsdruCalled) {
    for (i14 = 0; i14 < 6; i14++) {
      u[i14] = cv14[i14];
    }

    y = NULL;
    m3 = emlrtCreateCharArray(2, iv10);
    emlrtInitCharArrayR2013a(sp, 6, m3, &u[0]);
    emlrtAssign(&y, m3);
    st.site = &eb_emlrtRSI;
    setupsdru(&st, sdruroot(&st, &c_emlrtMCI), y, &d_emlrtMCI);
    isSetupsdruCalled = true;
  }

  /*  These sizes must match those in C code. */
  /*  Arbitrary max imposed on ML/SL side */
  /*  function is being called in interpreted mode */
  /*  not being found:  */
  /*  eml_allow_enum_inputs; */
  /* errStat_i = int32(0); */
  varargout_2_size[0] = 1;
  memset(&varargout_2_data[0], 0, sizeof(char_T) << 10);
  closeDataConnection_c(varargin_1, &errStat_i, &varargout_2_data[0]);

  /* errStat = UsrpErrorCapiEnumT(errStat_i); */
  errStrSize = strlen(&varargout_2_data[0]);
  if (errStrSize <= 1024) {
  } else {
    emlrtErrorWithMessageIdR2012b(sp, &d_emlrtRTEI,
      "Coder:builtins:AssertionFailed", 0);
  }

  if (1 > errStrSize) {
    varargout_2_size[1] = 0;
  } else {
    varargout_2_size[1] = errStrSize;
  }

  *varargout_1 = errStat_i;
}
Esempio n. 13
0
void mapiPrivate(const emlrtStack *sp, const uint8_T varargin_1[12],
                 BoardIdCapiEnumT varargin_2, const uint8_T varargin_3[15],
                 DataPortDataTypeCapiEnumT varargin_5, int32_T *varargout_1,
                 UsrpErrorCapiEnumT *varargout_2, char_T varargout_3_data[],
                 int32_T varargout_3_size[2])
{
  int32_T i13;
  static const char_T cv13[6] = { 's', 'i', 'l', 'e', 'n', 't' };

  char_T u[6];
  const mxArray *y;
  static const int32_T iv9[2] = { 1, 6 };

  const mxArray *m2;
  uint8_T addr_null[13];
  char * addr_c;
  uint8_T req_null[16];
  char * req_c;
  int32_T driverApiH;
  UsrpErrorCapiEnumT errStat_i;
  int32_T errStrSize;
  emlrtStack st;
  st.prev = sp;
  st.tls = sp->tls;

  /*  */
  /*  This function unifies handling of interp vs. codegen call as well as */
  /*  errStat / errStr assignment. */
  /*  */
  /*    Copyright 2011-2015 The MathWorks, Inc. */
  if (!isSetupsdruCalled) {
    for (i13 = 0; i13 < 6; i13++) {
      u[i13] = cv13[i13];
    }

    y = NULL;
    m2 = emlrtCreateCharArray(2, iv9);
    emlrtInitCharArrayR2013a(sp, 6, m2, &u[0]);
    emlrtAssign(&y, m2);
    st.site = &eb_emlrtRSI;
    setupsdru(&st, sdruroot(&st, &c_emlrtMCI), y, &d_emlrtMCI);
    isSetupsdruCalled = true;
  }

  /*  These sizes must match those in C code. */
  /*  Arbitrary max imposed on ML/SL side */
  /*  function is being called in interpreted mode */
  /*  not being found:  */
  /*  eml_allow_enum_inputs; */
  /* errStat_i = int32(0); */
  varargout_3_size[0] = 1;
  memset(&varargout_3_data[0], 0, sizeof(char_T) << 10);

  /*  varargin   1      2         3          4              5       6         7             8              9 */
  /*            addr, boardId, requester, frameLength, dportType, buffMode, buffSize, masterClockRate, channelMapping */
  /*  varargout  1         2         3 */
  /*            driverH, errStat, errMsg */
  for (i13 = 0; i13 < 12; i13++) {
    addr_null[i13] = varargin_1[i13];
  }

  addr_null[12] = 0;
  addr_c = (char *)(addr_null);
  for (i13 = 0; i13 < 15; i13++) {
    req_null[i13] = varargin_3[i13];
  }

  req_null[15] = 0;
  req_c = (char *)(req_null);
  openDataConnection_c(addr_c, varargin_2, req_c, 1408U, varargin_5, false, 0U,
                       1.0E+8, 1.0, &driverApiH, &errStat_i, &varargout_3_data[0]);
  *varargout_1 = driverApiH;

  /*  Tell coder that addr_null & req_null must be alive and separate throughout the call to cmd_c. */
  (void)(addr_null);
  (void)(req_null);

  /* errStat = UsrpErrorCapiEnumT(errStat_i); */
  errStrSize = strlen(&varargout_3_data[0]);
  if (errStrSize <= 1024) {
  } else {
    emlrtErrorWithMessageIdR2012b(sp, &d_emlrtRTEI,
      "Coder:builtins:AssertionFailed", 0);
  }

  if (1 > errStrSize) {
    varargout_3_size[1] = 0;
  } else {
    varargout_3_size[1] = errStrSize;
  }

  *varargout_2 = errStat_i;
}
Esempio n. 14
0
void c_warning(const emlrtStack *sp, const char_T varargin_1_data[], const
               int32_T varargin_1_size[2])
{
  int32_T i21;
  static const char_T cv22[7] = { 'w', 'a', 'r', 'n', 'i', 'n', 'g' };

  char_T u[7];
  const mxArray *y;
  static const int32_T iv15[2] = { 1, 7 };

  const mxArray *m8;
  static const char_T cv23[7] = { 'm', 'e', 's', 's', 'a', 'g', 'e' };

  char_T b_u[7];
  const mxArray *b_y;
  static const int32_T iv16[2] = { 1, 7 };

  static const char_T msgID[31] = { 's', 'd', 'r', 'u', ':', 'S', 'D', 'R', 'u',
    'B', 'a', 's', 'e', ':', 'D', 'i', 's', 'c', 'o', 'n', 'n', 'e', 'c', 't',
    'P', 'r', 'o', 'b', 'l', 'e', 'm' };

  char_T c_u[31];
  const mxArray *c_y;
  static const int32_T iv17[2] = { 1, 31 };

  int32_T u_size[2];
  int32_T loop_ub;
  char_T u_data[1024];
  const mxArray *d_y;
  emlrtStack st;
  st.prev = sp;
  st.tls = sp->tls;
  for (i21 = 0; i21 < 7; i21++) {
    u[i21] = cv22[i21];
  }

  y = NULL;
  m8 = emlrtCreateCharArray(2, iv15);
  emlrtInitCharArrayR2013a(sp, 7, m8, &u[0]);
  emlrtAssign(&y, m8);
  for (i21 = 0; i21 < 7; i21++) {
    b_u[i21] = cv23[i21];
  }

  b_y = NULL;
  m8 = emlrtCreateCharArray(2, iv16);
  emlrtInitCharArrayR2013a(sp, 7, m8, &b_u[0]);
  emlrtAssign(&b_y, m8);
  for (i21 = 0; i21 < 31; i21++) {
    c_u[i21] = msgID[i21];
  }

  c_y = NULL;
  m8 = emlrtCreateCharArray(2, iv17);
  emlrtInitCharArrayR2013a(sp, 31, m8, &c_u[0]);
  emlrtAssign(&c_y, m8);
  u_size[0] = 1;
  u_size[1] = varargin_1_size[1];
  loop_ub = varargin_1_size[0] * varargin_1_size[1];
  for (i21 = 0; i21 < loop_ub; i21++) {
    u_data[i21] = varargin_1_data[i21];
  }

  d_y = NULL;
  m8 = emlrtCreateCharArray(2, u_size);
  emlrtInitCharArrayR2013a(sp, u_size[1], m8, &u_data[0]);
  emlrtAssign(&d_y, m8);
  st.site = &fb_emlrtRSI;
  b_feval(&st, y, c_feval(&st, b_y, c_y, d_y, &emlrtMCI), &b_emlrtMCI);
}
/* Function Definitions */
void sendComplexDoubleData(const emlrtStack *sp, int32_T driverApiH, const
  creal_T data[1408], const real_T freq[2], const real_T loOffset[2], const
  real_T gain[2], real_T interp, uint32_T *underflow, UsrpErrorCapiEnumT
  *errStat, char_T errStr_data[], int32_T errStr_size[2])
{
  int32_T i15;
  static const char_T cv17[6] = { 's', 'i', 'l', 'e', 'n', 't' };

  char_T u[6];
  const mxArray *y;
  static const int32_T iv11[2] = { 1, 6 };

  const mxArray *m4;
  UsrpErrorCapiEnumT errStat_i;
  creal_T b_data[1408];
  real_T b_freq[2];
  real_T b_loOffset[2];
  real_T b_gain[2];
  int32_T errStrSize;
  emlrtStack st;
  emlrtStack b_st;
  st.prev = sp;
  st.tls = sp->tls;
  b_st.prev = &st;
  b_st.tls = st.tls;

  /*  bug: must pass as top-level arg */
  /*  dportDtype = DataPortDataTypeCapiEnumT.DPortDTypeCDouble; */
  /*    Copyright 2011-2012 The MathWorks, Inc. */
  st.site = &ab_emlrtRSI;

  /*  */
  /*  This function unifies handling of interp vs. codegen call as well as */
  /*  errStat / errStr assignment. */
  /*  */
  /*    Copyright 2011-2015 The MathWorks, Inc. */
  if (!isSetupsdruCalled) {
    for (i15 = 0; i15 < 6; i15++) {
      u[i15] = cv17[i15];
    }

    y = NULL;
    m4 = emlrtCreateCharArray(2, iv11);
    emlrtInitCharArrayR2013a(&st, 6, m4, &u[0]);
    emlrtAssign(&y, m4);
    b_st.site = &eb_emlrtRSI;
    setupsdru(&b_st, sdruroot(&b_st, &c_emlrtMCI), y, &d_emlrtMCI);
    isSetupsdruCalled = true;
  }

  /*  These sizes must match those in C code. */
  /*  Arbitrary max imposed on ML/SL side */
  /*  function is being called in interpreted mode */
  /*  not being found:  */
  /*  eml_allow_enum_inputs; */
  /* errStat_i = int32(0); */
  errStr_size[0] = 1;
  memset(&errStr_data[0], 0, sizeof(char_T) << 10);
  memcpy(&b_data[0], &data[0], 1408U * sizeof(creal_T));
  for (i15 = 0; i15 < 2; i15++) {
    b_freq[i15] = freq[i15];
    b_loOffset[i15] = loOffset[i15];
    b_gain[i15] = gain[i15];
  }

  sendData_c(driverApiH, b_data, b_freq, b_loOffset, b_gain, interp, underflow,
             &errStat_i, &errStr_data[0]);

  /* errStat = UsrpErrorCapiEnumT(errStat_i); */
  errStrSize = strlen(&errStr_data[0]);
  if (errStrSize <= 1024) {
  } else {
    emlrtErrorWithMessageIdR2012b(&st, &d_emlrtRTEI,
      "Coder:builtins:AssertionFailed", 0);
  }

  if (1 > errStrSize) {
    errStr_size[1] = 0;
  } else {
    errStr_size[1] = errStrSize;
  }

  *errStat = errStat_i;
}
Esempio n. 16
0
static void c_eml_qrsolve(const emlrtStack *sp, const emxArray_real_T *A,
  emxArray_real_T *B, emxArray_real_T *Y)
{
  emxArray_real_T *b_A;
  emxArray_real_T *work;
  int32_T mn;
  int32_T i51;
  int32_T ix;
  emxArray_real_T *tau;
  emxArray_int32_T *jpvt;
  int32_T m;
  int32_T n;
  int32_T b_mn;
  emxArray_real_T *vn1;
  emxArray_real_T *vn2;
  int32_T k;
  boolean_T overflow;
  boolean_T b12;
  int32_T i;
  int32_T i_i;
  int32_T nmi;
  int32_T mmi;
  int32_T pvt;
  int32_T iy;
  boolean_T b13;
  real_T xnorm;
  int32_T i52;
  real_T atmp;
  real_T d16;
  boolean_T b14;
  boolean_T b_i;
  ptrdiff_t n_t;
  ptrdiff_t incx_t;
  double * xix0_t;
  boolean_T exitg1;
  const mxArray *y;
  static const int32_T iv78[2] = { 1, 8 };

  const mxArray *m14;
  char_T cv76[8];
  static const char_T cv77[8] = { '%', '%', '%', 'd', '.', '%', 'd', 'e' };

  char_T cv78[14];
  uint32_T unnamed_idx_0;
  emlrtStack st;
  emlrtStack b_st;
  emlrtStack c_st;
  emlrtStack d_st;
  emlrtStack e_st;
  emlrtStack f_st;
  emlrtStack g_st;
  emlrtStack h_st;
  st.prev = sp;
  st.tls = sp->tls;
  b_st.prev = &st;
  b_st.tls = st.tls;
  c_st.prev = &b_st;
  c_st.tls = b_st.tls;
  d_st.prev = &c_st;
  d_st.tls = c_st.tls;
  e_st.prev = &d_st;
  e_st.tls = d_st.tls;
  f_st.prev = &e_st;
  f_st.tls = e_st.tls;
  g_st.prev = &f_st;
  g_st.tls = f_st.tls;
  h_st.prev = &g_st;
  h_st.tls = g_st.tls;
  emlrtHeapReferenceStackEnterFcnR2012b(sp);
  emxInit_real_T(sp, &b_A, 2, &m_emlrtRTEI, true);
  b_emxInit_real_T(sp, &work, 1, &rb_emlrtRTEI, true);
  mn = (int32_T)muDoubleScalarMin(A->size[0], A->size[1]);
  st.site = &mc_emlrtRSI;
  b_st.site = &nc_emlrtRSI;
  c_st.site = &oc_emlrtRSI;
  i51 = b_A->size[0] * b_A->size[1];
  b_A->size[0] = A->size[0];
  b_A->size[1] = A->size[1];
  emxEnsureCapacity(&c_st, (emxArray__common *)b_A, i51, (int32_T)sizeof(real_T),
                    &m_emlrtRTEI);
  ix = A->size[0] * A->size[1];
  for (i51 = 0; i51 < ix; i51++) {
    b_A->data[i51] = A->data[i51];
  }

  b_emxInit_real_T(&c_st, &tau, 1, &m_emlrtRTEI, true);
  b_emxInit_int32_T(&c_st, &jpvt, 2, &m_emlrtRTEI, true);
  m = b_A->size[0];
  n = b_A->size[1];
  b_mn = muIntScalarMin_sint32(b_A->size[0], b_A->size[1]);
  i51 = tau->size[0];
  tau->size[0] = b_mn;
  emxEnsureCapacity(&c_st, (emxArray__common *)tau, i51, (int32_T)sizeof(real_T),
                    &n_emlrtRTEI);
  d_st.site = &mf_emlrtRSI;
  e_st.site = &rb_emlrtRSI;
  f_st.site = &sb_emlrtRSI;
  g_st.site = &tb_emlrtRSI;
  eml_signed_integer_colon(&g_st, b_A->size[1], jpvt);
  if ((b_A->size[0] == 0) || (b_A->size[1] == 0)) {
  } else {
    ix = b_A->size[1];
    i51 = work->size[0];
    work->size[0] = ix;
    emxEnsureCapacity(&c_st, (emxArray__common *)work, i51, (int32_T)sizeof
                      (real_T), &m_emlrtRTEI);
    for (i51 = 0; i51 < ix; i51++) {
      work->data[i51] = 0.0;
    }

    b_emxInit_real_T(&c_st, &vn1, 1, &pb_emlrtRTEI, true);
    b_emxInit_real_T(&c_st, &vn2, 1, &qb_emlrtRTEI, true);
    d_st.site = &tc_emlrtRSI;
    ix = b_A->size[1];
    i51 = vn1->size[0];
    vn1->size[0] = ix;
    emxEnsureCapacity(&c_st, (emxArray__common *)vn1, i51, (int32_T)sizeof
                      (real_T), &pb_emlrtRTEI);
    i51 = vn2->size[0];
    vn2->size[0] = ix;
    emxEnsureCapacity(&c_st, (emxArray__common *)vn2, i51, (int32_T)sizeof
                      (real_T), &qb_emlrtRTEI);
    k = 1;
    d_st.site = &nf_emlrtRSI;
    overflow = (b_A->size[1] > 2147483646);
    if (overflow) {
      e_st.site = &db_emlrtRSI;
      check_forloop_overflow_error(&e_st);
    }

    for (ix = 0; ix + 1 <= b_A->size[1]; ix++) {
      d_st.site = &sc_emlrtRSI;
      vn1->data[ix] = b_eml_xnrm2(&d_st, b_A->size[0], b_A, k);
      vn2->data[ix] = vn1->data[ix];
      k += b_A->size[0];
    }

    d_st.site = &rc_emlrtRSI;
    if (1 > b_mn) {
      b12 = false;
    } else {
      b12 = (b_mn > 2147483646);
    }

    if (b12) {
      e_st.site = &db_emlrtRSI;
      check_forloop_overflow_error(&e_st);
    }

    for (i = 1; i <= b_mn; i++) {
      i_i = (i + (i - 1) * m) - 1;
      nmi = n - i;
      mmi = m - i;
      d_st.site = &of_emlrtRSI;
      ix = eml_ixamax(&d_st, 1 + nmi, vn1, i);
      pvt = (i + ix) - 2;
      if (pvt + 1 != i) {
        d_st.site = &pf_emlrtRSI;
        e_st.site = &bc_emlrtRSI;
        f_st.site = &cc_emlrtRSI;
        ix = 1 + m * pvt;
        iy = 1 + m * (i - 1);
        g_st.site = &dc_emlrtRSI;
        if (1 > m) {
          b13 = false;
        } else {
          b13 = (m > 2147483646);
        }

        if (b13) {
          h_st.site = &db_emlrtRSI;
          check_forloop_overflow_error(&h_st);
        }

        for (k = 1; k <= m; k++) {
          i51 = b_A->size[0] * b_A->size[1];
          xnorm = b_A->data[emlrtDynamicBoundsCheckFastR2012b(ix, 1, i51,
            &le_emlrtBCI, &f_st) - 1];
          i51 = b_A->size[0] * b_A->size[1];
          i52 = b_A->size[0] * b_A->size[1];
          b_A->data[emlrtDynamicBoundsCheckFastR2012b(ix, 1, i51, &le_emlrtBCI,
            &f_st) - 1] = b_A->data[emlrtDynamicBoundsCheckFastR2012b(iy, 1, i52,
            &le_emlrtBCI, &f_st) - 1];
          i51 = b_A->size[0] * b_A->size[1];
          b_A->data[emlrtDynamicBoundsCheckFastR2012b(iy, 1, i51, &le_emlrtBCI,
            &f_st) - 1] = xnorm;
          ix++;
          iy++;
        }

        ix = jpvt->data[pvt];
        jpvt->data[pvt] = jpvt->data[i - 1];
        jpvt->data[i - 1] = ix;
        vn1->data[pvt] = vn1->data[i - 1];
        vn2->data[pvt] = vn2->data[i - 1];
      }

      if (i < m) {
        d_st.site = &qc_emlrtRSI;
        atmp = b_A->data[i_i];
        d16 = 0.0;
        if (1 + mmi <= 0) {
        } else {
          e_st.site = &wc_emlrtRSI;
          xnorm = b_eml_xnrm2(&e_st, mmi, b_A, i_i + 2);
          if (xnorm != 0.0) {
            xnorm = muDoubleScalarHypot(b_A->data[i_i], xnorm);
            if (b_A->data[i_i] >= 0.0) {
              xnorm = -xnorm;
            }

            if (muDoubleScalarAbs(xnorm) < 1.0020841800044864E-292) {
              ix = 0;
              do {
                ix++;
                e_st.site = &xc_emlrtRSI;
                b_eml_xscal(&e_st, mmi, 9.9792015476736E+291, b_A, i_i + 2);
                xnorm *= 9.9792015476736E+291;
                atmp *= 9.9792015476736E+291;
              } while (!(muDoubleScalarAbs(xnorm) >= 1.0020841800044864E-292));

              e_st.site = &yc_emlrtRSI;
              xnorm = b_eml_xnrm2(&e_st, mmi, b_A, i_i + 2);
              xnorm = muDoubleScalarHypot(atmp, xnorm);
              if (atmp >= 0.0) {
                xnorm = -xnorm;
              }

              d16 = (xnorm - atmp) / xnorm;
              e_st.site = &ad_emlrtRSI;
              b_eml_xscal(&e_st, mmi, 1.0 / (atmp - xnorm), b_A, i_i + 2);
              e_st.site = &bd_emlrtRSI;
              if (1 > ix) {
                b14 = false;
              } else {
                b14 = (ix > 2147483646);
              }

              if (b14) {
                f_st.site = &db_emlrtRSI;
                check_forloop_overflow_error(&f_st);
              }

              for (k = 1; k <= ix; k++) {
                xnorm *= 1.0020841800044864E-292;
              }

              atmp = xnorm;
            } else {
              d16 = (xnorm - b_A->data[i_i]) / xnorm;
              atmp = 1.0 / (b_A->data[i_i] - xnorm);
              e_st.site = &cd_emlrtRSI;
              b_eml_xscal(&e_st, mmi, atmp, b_A, i_i + 2);
              atmp = xnorm;
            }
          }
        }

        tau->data[i - 1] = d16;
      } else {
        atmp = b_A->data[i_i];
        d_st.site = &pc_emlrtRSI;
        tau->data[i - 1] = eml_matlab_zlarfg();
      }

      b_A->data[i_i] = atmp;
      if (i < n) {
        atmp = b_A->data[i_i];
        b_A->data[i_i] = 1.0;
        d_st.site = &qf_emlrtRSI;
        eml_matlab_zlarf(&d_st, mmi + 1, nmi, i_i + 1, tau->data[i - 1], b_A, i
                         + i * m, m, work);
        b_A->data[i_i] = atmp;
      }

      d_st.site = &rf_emlrtRSI;
      if (i + 1 > n) {
        b_i = false;
      } else {
        b_i = (n > 2147483646);
      }

      if (b_i) {
        e_st.site = &db_emlrtRSI;
        check_forloop_overflow_error(&e_st);
      }

      for (ix = i; ix + 1 <= n; ix++) {
        if (vn1->data[ix] != 0.0) {
          xnorm = muDoubleScalarAbs(b_A->data[(i + b_A->size[0] * ix) - 1]) /
            vn1->data[ix];
          xnorm = 1.0 - xnorm * xnorm;
          if (xnorm < 0.0) {
            xnorm = 0.0;
          }

          atmp = vn1->data[ix] / vn2->data[ix];
          atmp = xnorm * (atmp * atmp);
          if (atmp <= 1.4901161193847656E-8) {
            if (i < m) {
              d_st.site = &sf_emlrtRSI;
              e_st.site = &uc_emlrtRSI;
              if (mmi < 1) {
                xnorm = 0.0;
              } else {
                f_st.site = &vc_emlrtRSI;
                g_st.site = &vc_emlrtRSI;
                n_t = (ptrdiff_t)(mmi);
                g_st.site = &vc_emlrtRSI;
                incx_t = (ptrdiff_t)(1);
                i51 = b_A->size[0] * b_A->size[1];
                i52 = (i + m * ix) + 1;
                xix0_t = (double *)(&b_A->data[emlrtDynamicBoundsCheckFastR2012b
                                    (i52, 1, i51, &vb_emlrtBCI, &f_st) - 1]);
                xnorm = dnrm2(&n_t, xix0_t, &incx_t);
              }

              vn1->data[ix] = xnorm;
              vn2->data[ix] = vn1->data[ix];
            } else {
              vn1->data[ix] = 0.0;
              vn2->data[ix] = 0.0;
            }
          } else {
            d_st.site = &tf_emlrtRSI;
            vn1->data[ix] *= muDoubleScalarSqrt(xnorm);
          }
        }
      }
    }

    emxFree_real_T(&vn2);
    emxFree_real_T(&vn1);
  }

  atmp = 0.0;
  if (mn > 0) {
    xnorm = muDoubleScalarMax(A->size[0], A->size[1]) * muDoubleScalarAbs
      (b_A->data[0]) * 2.2204460492503131E-16;
    k = 0;
    exitg1 = false;
    while ((!exitg1) && (k <= mn - 1)) {
      if (muDoubleScalarAbs(b_A->data[k + b_A->size[0] * k]) <= xnorm) {
        st.site = &lc_emlrtRSI;
        y = NULL;
        m14 = emlrtCreateCharArray(2, iv78);
        for (i = 0; i < 8; i++) {
          cv76[i] = cv77[i];
        }

        emlrtInitCharArrayR2013a(&st, 8, m14, cv76);
        emlrtAssign(&y, m14);
        b_st.site = &tg_emlrtRSI;
        emlrt_marshallIn(&b_st, c_sprintf(&b_st, b_sprintf(&b_st, y,
          emlrt_marshallOut(14.0), emlrt_marshallOut(6.0), &o_emlrtMCI),
          emlrt_marshallOut(xnorm), &p_emlrtMCI), "sprintf", cv78);
        st.site = &kc_emlrtRSI;
        b_eml_warning(&st, atmp, cv78);
        exitg1 = true;
      } else {
        atmp++;
        k++;
      }
    }
  }

  unnamed_idx_0 = (uint32_T)A->size[1];
  i51 = Y->size[0];
  Y->size[0] = (int32_T)unnamed_idx_0;
  emxEnsureCapacity(sp, (emxArray__common *)Y, i51, (int32_T)sizeof(real_T),
                    &m_emlrtRTEI);
  ix = (int32_T)unnamed_idx_0;
  for (i51 = 0; i51 < ix; i51++) {
    Y->data[i51] = 0.0;
  }

  for (ix = 0; ix < mn; ix++) {
    if (tau->data[ix] != 0.0) {
      xnorm = B->data[ix];
      i51 = A->size[0] + (int32_T)(1.0 - ((1.0 + (real_T)ix) + 1.0));
      emlrtForLoopVectorCheckR2012b((1.0 + (real_T)ix) + 1.0, 1.0, A->size[0],
        mxDOUBLE_CLASS, i51, &ac_emlrtRTEI, sp);
      for (i = 0; i < i51; i++) {
        unnamed_idx_0 = ((uint32_T)ix + i) + 2U;
        xnorm += b_A->data[((int32_T)unnamed_idx_0 + b_A->size[0] * ix) - 1] *
          B->data[(int32_T)unnamed_idx_0 - 1];
      }

      xnorm *= tau->data[ix];
      if (xnorm != 0.0) {
        B->data[ix] -= xnorm;
        i51 = A->size[0] + (int32_T)(1.0 - ((1.0 + (real_T)ix) + 1.0));
        emlrtForLoopVectorCheckR2012b((1.0 + (real_T)ix) + 1.0, 1.0, A->size[0],
          mxDOUBLE_CLASS, i51, &yb_emlrtRTEI, sp);
        for (i = 0; i < i51; i++) {
          unnamed_idx_0 = ((uint32_T)ix + i) + 2U;
          B->data[(int32_T)unnamed_idx_0 - 1] -= b_A->data[((int32_T)
            unnamed_idx_0 + b_A->size[0] * ix) - 1] * xnorm;
        }
      }
    }
  }

  emxFree_real_T(&tau);
  emlrtForLoopVectorCheckR2012b(1.0, 1.0, atmp, mxDOUBLE_CLASS, (int32_T)atmp,
    &xb_emlrtRTEI, sp);
  for (i = 0; i < (int32_T)atmp; i++) {
    Y->data[jpvt->data[i] - 1] = B->data[i];
  }

  emlrtForLoopVectorCheckR2012b(atmp, -1.0, 1.0, mxDOUBLE_CLASS, (int32_T)-(1.0
    + (-1.0 - atmp)), &wb_emlrtRTEI, sp);
  for (ix = 0; ix < (int32_T)-(1.0 + (-1.0 - atmp)); ix++) {
    xnorm = atmp + -(real_T)ix;
    Y->data[jpvt->data[(int32_T)xnorm - 1] - 1] = eml_div(Y->data[jpvt->data
      [(int32_T)xnorm - 1] - 1], b_A->data[((int32_T)xnorm + b_A->size[0] *
      ((int32_T)xnorm - 1)) - 1]);
    for (i = 0; i < (int32_T)(xnorm - 1.0); i++) {
      Y->data[jpvt->data[i] - 1] -= Y->data[jpvt->data[(int32_T)xnorm - 1] - 1] *
        b_A->data[i + b_A->size[0] * ((int32_T)xnorm - 1)];
    }
  }

  emxFree_int32_T(&jpvt);
  emxFree_real_T(&work);
  emxFree_real_T(&b_A);
  emlrtHeapReferenceStackLeaveFcnR2012b(sp);
}
Esempio n. 17
0
void reportSDRuStatus(const emlrtStack *sp, UsrpErrorCapiEnumT errStatus, const
                      char_T errMsg_data[], const int32_T errMsg_size[2])
{
  const mxArray *y;
  static const int32_T iv16[2] = { 1, 35 };

  const mxArray *m7;
  char_T cv31[35];
  int32_T i;
  static const char_T cv32[35] = { 's', 'd', 'r', 'u', ':', 'r', 'e', 'p', 'o',
    'r', 't', 'S', 'D', 'R', 'u', 'S', 't', 'a', 't', 'u', 's', ':', 'N', 'o',
    't', 'C', 'o', 'm', 'p', 'a', 't', 'i', 'b', 'l', 'e' };

  const mxArray *b_y;
  static const int32_T iv17[2] = { 1, 12 };

  char_T cv33[12];
  static const char_T cv34[12] = { '1', '9', '2', '.', '1', '6', '8', '.', '1',
    '0', '.', '2' };

  const mxArray *c_y;
  static const int32_T iv18[2] = { 1, 43 };

  char_T cv35[43];
  static const char_T cv36[43] = { 'r', 'e', 't', 'u', 'r', 'n', 'e', 'd', ' ',
    'b', 'y', ' ', '\'', 'g', 'e', 't', 'S', 'D', 'R', 'u', 'D', 'r', 'i', 'v',
    'e', 'r', 'V', 'e', 'r', 's', 'i', 'o', 'n', '\'', ' ', 'f', 'u', 'n', 'c',
    't', 'i', 'o', 'n' };

  const mxArray *d_y;
  static const int32_T iv19[2] = { 1, 35 };

  static const char_T cv37[35] = { 's', 'd', 'r', 'u', ':', 'r', 'e', 'p', 'o',
    'r', 't', 'S', 'D', 'R', 'u', 'S', 't', 'a', 't', 'u', 's', ':', 'N', 'o',
    't', 'R', 'e', 's', 'p', 'o', 'n', 'd', 'i', 'n', 'g' };

  const mxArray *e_y;
  static const int32_T iv20[2] = { 1, 12 };

  const mxArray *f_y;
  static const int32_T iv21[2] = { 1, 28 };

  char_T cv38[28];
  static const char_T cv39[28] = { 's', 'd', 'r', 'u', ':', 'r', 'e', 'p', 'o',
    'r', 't', 'S', 'D', 'R', 'u', 'S', 't', 'a', 't', 'u', 's', ':', 'R', 'x',
    'B', 'u', 's', 'y' };

  const mxArray *g_y;
  static const int32_T iv22[2] = { 1, 12 };

  const mxArray *h_y;
  static const int32_T iv23[2] = { 1, 28 };

  static const char_T cv40[28] = { 's', 'd', 'r', 'u', ':', 'r', 'e', 'p', 'o',
    'r', 't', 'S', 'D', 'R', 'u', 'S', 't', 'a', 't', 'u', 's', ':', 'T', 'x',
    'B', 'u', 's', 'y' };

  const mxArray *i_y;
  static const int32_T iv24[2] = { 1, 12 };

  const mxArray *j_y;
  static const int32_T iv25[2] = { 1, 26 };

  char_T cv41[26];
  static const char_T cv42[26] = { 's', 'd', 'r', 'u', ':', 'r', 'e', 'p', 'o',
    'r', 't', 'S', 'D', 'R', 'u', 'S', 't', 'a', 't', 'u', 's', ':', 'B', 'u',
    's', 'y' };

  const mxArray *k_y;
  static const int32_T iv26[2] = { 1, 12 };

  const mxArray *l_y;
  static const int32_T iv27[2] = { 1, 35 };

  static const char_T cv43[35] = { 's', 'd', 'r', 'u', ':', 'r', 'e', 'p', 'o',
    'r', 't', 'S', 'D', 'R', 'u', 'S', 't', 'a', 't', 'u', 's', ':', 'U', 'n',
    'k', 'n', 'o', 'w', 'n', 'S', 't', 'a', 't', 'u', 's' };

  int32_T u_size[2];
  int32_T i10;
  char_T u_data[1024];
  const mxArray *m_y;
  emlrtStack st;
  emlrtStack b_st;
  st.prev = sp;
  st.tls = sp->tls;
  b_st.prev = &st;
  b_st.tls = st.tls;

  /* reportSDRuStatus SDRu status reporter */
  /*    reportSDRuStatus(STATUS,MSG,IP,METHOD) reports the SDRu status based on */
  /*    the STATUS input. STATUS is a UsrpErrorCapiEnumT type. IP is the IP */
  /*    address of the USRP(R) radio. METHOD is a UsrpReportMethodEnumT type and */
  /*    can be Warning, Error , or None. */
  /*  */
  /*    USRP(R) is a trademark of National Instruments Corp. */
  /*    Copyright 2012-2014 The MathWorks, Inc. */
  switch (errStatus) {
   case UsrpDriverNotCompatible:
    st.site = &ib_emlrtRSI;
    if (!(errStatus == UsrpDriverNotCompatible)) {
    } else {
      y = NULL;
      m7 = emlrtCreateCharArray(2, iv16);
      for (i = 0; i < 35; i++) {
        cv31[i] = cv32[i];
      }

      emlrtInitCharArrayR2013a(&st, 35, m7, cv31);
      emlrtAssign(&y, m7);
      b_y = NULL;
      m7 = emlrtCreateCharArray(2, iv17);
      for (i = 0; i < 12; i++) {
        cv33[i] = cv34[i];
      }

      emlrtInitCharArrayR2013a(&st, 12, m7, cv33);
      emlrtAssign(&b_y, m7);
      c_y = NULL;
      m7 = emlrtCreateCharArray(2, iv18);
      for (i = 0; i < 43; i++) {
        cv35[i] = cv36[i];
      }

      emlrtInitCharArrayR2013a(&st, 43, m7, cv35);
      emlrtAssign(&c_y, m7);
      b_st.site = &pb_emlrtRSI;
      c_error(&b_st, b_message(&b_st, y, b_y, c_y, &c_emlrtMCI), &c_emlrtMCI);
    }
    break;

   case UsrpDriverNotResponding:
    st.site = &hb_emlrtRSI;
    if (!(errStatus == UsrpDriverNotResponding)) {
    } else {
      d_y = NULL;
      m7 = emlrtCreateCharArray(2, iv19);
      for (i = 0; i < 35; i++) {
        cv31[i] = cv37[i];
      }

      emlrtInitCharArrayR2013a(&st, 35, m7, cv31);
      emlrtAssign(&d_y, m7);
      e_y = NULL;
      m7 = emlrtCreateCharArray(2, iv20);
      for (i = 0; i < 12; i++) {
        cv33[i] = cv34[i];
      }

      emlrtInitCharArrayR2013a(&st, 12, m7, cv33);
      emlrtAssign(&e_y, m7);
      b_st.site = &pb_emlrtRSI;
      c_error(&b_st, message(&b_st, d_y, e_y, &c_emlrtMCI), &c_emlrtMCI);
    }
    break;

   case UsrpDriverRxBusy:
    st.site = &gb_emlrtRSI;
    if (!(errStatus == UsrpDriverRxBusy)) {
    } else {
      f_y = NULL;
      m7 = emlrtCreateCharArray(2, iv21);
      for (i = 0; i < 28; i++) {
        cv38[i] = cv39[i];
      }

      emlrtInitCharArrayR2013a(&st, 28, m7, cv38);
      emlrtAssign(&f_y, m7);
      g_y = NULL;
      m7 = emlrtCreateCharArray(2, iv22);
      for (i = 0; i < 12; i++) {
        cv33[i] = cv34[i];
      }

      emlrtInitCharArrayR2013a(&st, 12, m7, cv33);
      emlrtAssign(&g_y, m7);
      b_st.site = &pb_emlrtRSI;
      c_error(&b_st, message(&b_st, f_y, g_y, &c_emlrtMCI), &c_emlrtMCI);
    }
    break;

   case UsrpDriverTxBusy:
    st.site = &fb_emlrtRSI;
    if (!(errStatus == UsrpDriverTxBusy)) {
    } else {
      h_y = NULL;
      m7 = emlrtCreateCharArray(2, iv23);
      for (i = 0; i < 28; i++) {
        cv38[i] = cv40[i];
      }

      emlrtInitCharArrayR2013a(&st, 28, m7, cv38);
      emlrtAssign(&h_y, m7);
      i_y = NULL;
      m7 = emlrtCreateCharArray(2, iv24);
      for (i = 0; i < 12; i++) {
        cv33[i] = cv34[i];
      }

      emlrtInitCharArrayR2013a(&st, 12, m7, cv33);
      emlrtAssign(&i_y, m7);
      b_st.site = &pb_emlrtRSI;
      c_error(&b_st, message(&b_st, h_y, i_y, &c_emlrtMCI), &c_emlrtMCI);
    }
    break;

   case UsrpDriverBusy:
    st.site = &eb_emlrtRSI;
    if (!(errStatus == UsrpDriverBusy)) {
    } else {
      j_y = NULL;
      m7 = emlrtCreateCharArray(2, iv25);
      for (i = 0; i < 26; i++) {
        cv41[i] = cv42[i];
      }

      emlrtInitCharArrayR2013a(&st, 26, m7, cv41);
      emlrtAssign(&j_y, m7);
      k_y = NULL;
      m7 = emlrtCreateCharArray(2, iv26);
      for (i = 0; i < 12; i++) {
        cv33[i] = cv34[i];
      }

      emlrtInitCharArrayR2013a(&st, 12, m7, cv33);
      emlrtAssign(&k_y, m7);
      b_st.site = &pb_emlrtRSI;
      c_error(&b_st, message(&b_st, j_y, k_y, &c_emlrtMCI), &c_emlrtMCI);
    }
    break;

   case UsrpDriverError:
    st.site = &db_emlrtRSI;
    if (!(errStatus == UsrpDriverError)) {
    } else {
      l_y = NULL;
      m7 = emlrtCreateCharArray(2, iv27);
      for (i = 0; i < 35; i++) {
        cv31[i] = cv43[i];
      }

      emlrtInitCharArrayR2013a(&st, 35, m7, cv31);
      emlrtAssign(&l_y, m7);
      u_size[0] = 1;
      u_size[1] = errMsg_size[1];
      i = errMsg_size[0] * errMsg_size[1];
      for (i10 = 0; i10 < i; i10++) {
        u_data[i10] = errMsg_data[i10];
      }

      m_y = NULL;
      m7 = emlrtCreateCharArray(2, u_size);
      emlrtInitCharArrayR2013a(&st, u_size[1], m7, (char_T *)u_data);
      emlrtAssign(&m_y, m7);
      b_st.site = &pb_emlrtRSI;
      c_error(&b_st, message(&b_st, l_y, m_y, &c_emlrtMCI), &c_emlrtMCI);
    }
    break;
  }
}
Esempio n. 18
0
File: all.c Progetto: ofirENS/Utils
/* Function Definitions */
boolean_T all(const emlrtStack *sp, const emxArray_boolean_T *x)
{
  boolean_T y;
  boolean_T overflow;
  const mxArray *b_y;
  static const int32_T iv20[2] = { 1, 51 };

  const mxArray *m7;
  char_T cv22[51];
  int32_T i;
  static const char_T cv23[51] = { 'C', 'o', 'd', 'e', 'r', ':', 't', 'o', 'o',
    'l', 'b', 'o', 'x', ':', 'e', 'm', 'l', '_', 'a', 'l', 'l', '_', 'o', 'r',
    '_', 'a', 'n', 'y', '_', 'a', 'u', 't', 'o', 'D', 'i', 'm', 'I', 'n', 'c',
    'o', 'm', 'p', 'a', 't', 'i', 'b', 'i', 'l', 'i', 't', 'y' };

  boolean_T exitg1;
  int32_T i66;
  emlrtStack st;
  emlrtStack b_st;
  emlrtStack c_st;
  st.prev = sp;
  st.tls = sp->tls;
  st.site = &ve_emlrtRSI;
  b_st.prev = &st;
  b_st.tls = st.tls;
  c_st.prev = &b_st;
  c_st.tls = b_st.tls;
  b_st.site = &we_emlrtRSI;
  if ((x->size[1] == 1) || (x->size[1] != 1)) {
    overflow = true;
  } else {
    overflow = false;
  }

  b_st.site = &xe_emlrtRSI;
  if (overflow) {
  } else {
    b_y = NULL;
    m7 = emlrtCreateCharArray(2, iv20);
    for (i = 0; i < 51; i++) {
      cv22[i] = cv23[i];
    }

    emlrtInitCharArrayR2013a(&b_st, 51, m7, cv22);
    emlrtAssign(&b_y, m7);
    c_st.site = &dh_emlrtRSI;
    b_error(&c_st, message(&c_st, b_y, &n_emlrtMCI), &n_emlrtMCI);
  }

  y = true;
  b_st.site = &ye_emlrtRSI;
  if (1 > x->size[1]) {
    overflow = false;
  } else {
    overflow = (x->size[1] > 2147483646);
  }

  if (overflow) {
    c_st.site = &ic_emlrtRSI;
    check_forloop_overflow_error(&c_st);
  }

  i = 1;
  exitg1 = false;
  while ((!exitg1) && (i <= x->size[1])) {
    i66 = x->size[1];
    if (x->data[emlrtDynamicBoundsCheckFastR2012b(i, 1, i66, &re_emlrtBCI, &st)
        - 1] == 0) {
      y = false;
      exitg1 = true;
    } else {
      i++;
    }
  }

  return y;
}
Esempio n. 19
0
void b_mpower(const emlrtStack *sp, const real_T a[36], real_T c[36])
{
  real_T x[36];
  int32_T jBcol;
  int32_T ipiv[6];
  int8_T p[6];
  int32_T k;
  int32_T j;
  int32_T i;
  int32_T kAcol;
  real_T n1x;
  real_T n1xinv;
  real_T rc;
  static const char_T rfmt[6] = { '%', '1', '4', '.', '6', 'e' };

  char_T u[6];
  const mxArray *y;
  static const int32_T iv4[2] = { 1, 6 };

  const mxArray *m0;
  const mxArray *b_y;
  char_T cv0[14];
  emlrtStack st;
  emlrtStack b_st;
  emlrtStack c_st;
  emlrtStack d_st;
  emlrtStack e_st;
  emlrtStack f_st;
  st.prev = sp;
  st.tls = sp->tls;
  st.site = &l_emlrtRSI;
  b_st.prev = &st;
  b_st.tls = st.tls;
  c_st.prev = &b_st;
  c_st.tls = b_st.tls;
  d_st.prev = &c_st;
  d_st.tls = c_st.tls;
  e_st.prev = &d_st;
  e_st.tls = d_st.tls;
  f_st.prev = &e_st;
  f_st.tls = e_st.tls;
  b_st.site = &m_emlrtRSI;
  c_st.site = &n_emlrtRSI;
  c_st.site = &o_emlrtRSI;
  d_st.site = &p_emlrtRSI;
  for (jBcol = 0; jBcol < 36; jBcol++) {
    c[jBcol] = 0.0;
    x[jBcol] = a[jBcol];
  }

  e_st.site = &r_emlrtRSI;
  xgetrf(&e_st, x, ipiv);
  for (jBcol = 0; jBcol < 6; jBcol++) {
    p[jBcol] = (int8_T)(1 + jBcol);
  }

  for (k = 0; k < 5; k++) {
    if (ipiv[k] > 1 + k) {
      jBcol = p[ipiv[k] - 1];
      p[ipiv[k] - 1] = p[k];
      p[k] = (int8_T)jBcol;
    }
  }

  for (k = 0; k < 6; k++) {
    jBcol = p[k] - 1;
    c[k + 6 * (p[k] - 1)] = 1.0;
    e_st.site = &s_emlrtRSI;
    for (j = k; j + 1 < 7; j++) {
      if (c[j + 6 * jBcol] != 0.0) {
        e_st.site = &t_emlrtRSI;
        for (i = j + 1; i + 1 < 7; i++) {
          c[i + 6 * jBcol] -= c[j + 6 * jBcol] * x[i + 6 * j];
        }
      }
    }
  }

  e_st.site = &u_emlrtRSI;
  f_st.site = &ib_emlrtRSI;
  for (j = 0; j < 6; j++) {
    jBcol = 6 * j;
    for (k = 5; k >= 0; k += -1) {
      kAcol = 6 * k;
      if (c[k + jBcol] != 0.0) {
        c[k + jBcol] /= x[k + kAcol];
        for (i = 0; i + 1 <= k; i++) {
          c[i + jBcol] -= c[k + jBcol] * x[i + kAcol];
        }
      }
    }
  }

  d_st.site = &q_emlrtRSI;
  n1x = norm(a);
  n1xinv = norm(c);
  rc = 1.0 / (n1x * n1xinv);
  if ((n1x == 0.0) || (n1xinv == 0.0) || (rc == 0.0)) {
    e_st.site = &kb_emlrtRSI;
    warning(&e_st);
  } else {
    if (muDoubleScalarIsNaN(rc) || (rc < 2.2204460492503131E-16)) {
      e_st.site = &lb_emlrtRSI;
      for (jBcol = 0; jBcol < 6; jBcol++) {
        u[jBcol] = rfmt[jBcol];
      }

      y = NULL;
      m0 = emlrtCreateCharArray(2, iv4);
      emlrtInitCharArrayR2013a(&e_st, 6, m0, &u[0]);
      emlrtAssign(&y, m0);
      b_y = NULL;
      m0 = emlrtCreateDoubleScalar(rc);
      emlrtAssign(&b_y, m0);
      f_st.site = &pb_emlrtRSI;
      emlrt_marshallIn(&f_st, b_sprintf(&f_st, y, b_y, &c_emlrtMCI), "sprintf",
                       cv0);
      e_st.site = &lb_emlrtRSI;
      b_warning(&e_st, cv0);
    }
  }
}
void drr_151213_XRayInParam(const emlrtStack *sp, const emxArray_boolean_T
  *voxel_data, const real_T voxel_size_mm[3], const real_T detector_dimensions[2],
  const real_T XRayIntrinsicParam[12], const real_T voxel_corner_min[3], const
  real_T T_carm[16], emxArray_real_T *projection)
{
  const mxArray *y;
  static const int32_T iv0[2] = { 1, 32 };

  const mxArray *m0;
  char_T cv0[32];
  int32_T i;
  static const char_T cv1[32] = { 'v', 'o', 'x', 'e', 'l', '_', 'd', 'a', 't',
    'a', ' ', 'm', 'u', 's', 't', ' ', 'b', 'e', ' ', '3', '-', 'd', 'i', 'm',
    'e', 'n', 's', 'i', 'o', 'n', 'a', 'l' };

  int32_T i0;
  real_T pixel_size_mm_h;
  real_T pixel_size_mm_w;
  uint32_T voxDim[3];
  real_T voxPlanes__max[3];
  real_T source[3];
  real_T pixel_size_mmel_wn[3];
  real_T pixel_size_mmel_hn[3];
  real_T corner[3];
  int32_T ih;
  int32_T iw;
  real_T tstep[3];
  real_T tnext[3];
  real_T pixel_point_mm[3];
  real_T ray_source2pixel[3];
  real_T b_voxPlanes__max[3];
  real_T b_ray_source2pixel[3];
  real_T t_plane_min[3];
  real_T t_plane_max[3];
  real_T tmax;
  int32_T pixel_size_mmIntensity;
  boolean_T exitg8;
  boolean_T exitg7;
  boolean_T exitg6;
  real_T t_larger[4];
  real_T temp;
  boolean_T exitg5;
  boolean_T exitg4;
  boolean_T exitg3;
  real_T t_smaller[4];
  int32_T itmp;
  boolean_T exitg2;
  boolean_T exitg1;
  real_T iz;
  real_T tx;
  real_T ty;
  real_T tz;
  int32_T i1;
  int32_T i2;
  int32_T i3;
  emlrtStack st;
  emlrtStack b_st;
  st.prev = sp;
  st.tls = sp->tls;
  b_st.prev = &st;
  b_st.tls = st.tls;

  /* % Modificiation Notes */
  /*  15.12.04 */
  /*           - Release 기존의 파일을 참고로 하여 고성영이 수정하였음.  */
  /*           - DRR을 완벽하게 하지 않고, voxel에 한점이라도 만나면 on으로 계산함 */
  /*           - 계산속도가 향상되었음 */
  /*           - 젬스에 있는 X-ray와 테스트하여 검증하였음 */
  /*  15 12 13 : The function input has been changed to utilize the x-ray */
  /*             intrinsic parameter provided by GEMSS  % 151213 kosy */
  /* %function [projection] = drr (voxel_data, voxel_size_mm, detector_dimensions, pixel_size_mm, isocenter_mm, cbct_angles_deg) */
  /* Creates a 2D projection at each cbct_angle of voxel_data. the projection */
  /* axis is defined by the isocenter to which the source and center of */
  /* the detector are aligned. This simulation assumes standard Cone Beam CT */
  /* geometry (source to isocenter distance is 100 cm and source to detector */
  /* distance is 150cm). */
  /*  */
  /* voxel_data: must be a 3 dimensional matrix (typically of CT data) */
  /* voxel_size_mm: a 3 element vector listing the size (in mm) of the voxels */
  /*                along each dimension */
  /* detector_dimension: a 2 element vector listing the dimensions (number of */
  /*                     pixels) in each dimension (u,v) */
  /* pixel_size_mm: a number defining the height and width of each pixel */
  /*                (assumes square pixel) */
  /* isocenter_mm: a 3 element vector pointing from the origin (corner) of the */
  /*               matrix element(1,1,1) to the isocenter */
  /* cbct_angles_deg: a list of angles to generate projections */
  /*  */
  /* Retrun Variable */
  /* projection: a 3D matrix with the 3rd dimension representing the angle of */
  /* roatation */
  /*  */
  /* { */
  /*  Author: Michael M. Folkerts [email protected] */
  /*  Institution: UCSD Physics, UTSW Radiation Oncology */
  /*  Updated: 2014-July. */
  /*  Notes: Siddon's Incremental algorithm | modified to read in 3D matlab matrix | Simplified Input | No guarantees!! */
  /*  */
  /*  References:  */
  /*  R.L. Siddon, */
  /*  "Fast calculation of the exact radiological path for a three-dimensional CT */
  /*  array," Medical Physics 12, 252-255 (1985). */
  /*  */
  /*  F. Jacobs, E. Sundermann, B. De Sutter, M. Christiaens and I. Lemahieu, */
  /*  "A fast algorithm to calculate the exact radiological path through a pixel_size_mmel or voxel space," */
  /*  Journal of Computing and Information Technology 6, 89-94 (1998). */
  /*   */
  /*  G. Han, Z. Liang and J. You, */
  /*  "A fast ray tracing technique for TCT and ECT studies," */
  /*  IEEE Medical Imaging Conference 1999. */
  /* } */
  /* function [projection] = drr_good_151204 (voxel_data, voxel_size_mm, detector_dimensions, pixel_size_mm, voxel_corner_min, T_carm)  */
  /*  if(0) */
  /*      voxel_data = OUTPUTgrid; */
  /*      voxel_size_mm = voxel_size; */
  /*      detector_dimensions = detector_dimension; */
  /*      pixel_size_mm = pixel_size; */
  /*      isocenter_mm = isocenter; */
  /*      T_carm: Transformation matrix of C-arm (that is set at the middle of */
  /*              detector & source) with respect to Voxel coordinates */
  /* tic; */
  /* this will verify the size: */
  if (eml_ndims_varsized(*(int32_T (*)[3])voxel_data->size) != 3) {
    st.site = &emlrtRSI;
    y = NULL;
    m0 = emlrtCreateCharArray(2, iv0);
    for (i = 0; i < 32; i++) {
      cv0[i] = cv1[i];
    }

    emlrtInitCharArrayR2013a(&st, 32, m0, cv0);
    emlrtAssign(&y, m0);
    b_st.site = &b_emlrtRSI;
    error(&b_st, y, &emlrtMCI);
  }

  /* constants: */
  /* .0001; */
  /* .0001; */
  /* sounce to imager(detector) distance */
  /* source to axis distance %% RRI set the coordinate at the middle between source and the detector */
  /* initialize memory for speed: */
  i0 = projection->size[0] * projection->size[1];
  pixel_size_mm_h = emlrtNonNegativeCheckFastR2012b(detector_dimensions[0],
    &b_emlrtDCI, sp);
  projection->size[0] = (int32_T)emlrtIntegerCheckFastR2012b(pixel_size_mm_h,
    &emlrtDCI, sp);
  pixel_size_mm_h = emlrtNonNegativeCheckFastR2012b(detector_dimensions[1],
    &d_emlrtDCI, sp);
  projection->size[1] = (int32_T)emlrtIntegerCheckFastR2012b(pixel_size_mm_h,
    &c_emlrtDCI, sp);
  emxEnsureCapacity(sp, (emxArray__common *)projection, i0, (int32_T)sizeof
                    (real_T), &emlrtRTEI);
  pixel_size_mm_h = emlrtNonNegativeCheckFastR2012b(detector_dimensions[0],
    &b_emlrtDCI, sp);
  pixel_size_mm_w = emlrtNonNegativeCheckFastR2012b(detector_dimensions[1],
    &d_emlrtDCI, sp);
  i = (int32_T)emlrtIntegerCheckFastR2012b(pixel_size_mm_h, &emlrtDCI, sp) *
    (int32_T)emlrtIntegerCheckFastR2012b(pixel_size_mm_w, &c_emlrtDCI, sp);
  for (i0 = 0; i0 < i; i0++) {
    projection->data[i0] = 0.0;
  }

  for (i0 = 0; i0 < 3; i0++) {
    voxDim[i0] = (uint32_T)voxel_data->size[i0];
  }

  /* [size(voxel_data,1), size(voxel_data,2), size(voxel_data,3)]; */
  /* voxDim_x = voxDim(1); */
  /* voxDim_y = voxDim(2); */
  /* voxDim_z = voxDim(3); */
  /* difine voxel boundaries: */
  /* vector from origin to source */
  /* vector from origin to CENTER of detector */
  /* extract the key information from the intrinsic parameters   % 151213 kosy modi */
  pixel_size_mm_h = 1105.0 / XRayIntrinsicParam[0];
  pixel_size_mm_w = 1105.0 / XRayIntrinsicParam[4];

  /* vector pointing left, parallel to detector */
  /* define incremental vectors: */
  /* define upper lefthand corner of detector: */
  /* corner = detector + ( center_pixel_w*pixel_size_mmel.wn + center_pixel_h*pixel_size_mmel.hn ); */
  for (i = 0; i < 3; i++) {
    voxPlanes__max[i] = voxel_corner_min[i] + voxel_size_mm[i] * (real_T)
      voxDim[i];

    /* define up: */
    /* up = [0,0,1]; */
    /*  width of projection image */
    /*  height of projection image */
    /*  direction from the detector to the source */
    /* end initialization timer: */
    /* init_time = toc */
    /* start tracing timer: */
    /* tic; */
    source[i] = 552.5 * T_carm[4 + i] + T_carm[12 + i];

    /* define pixel_size_mmel vectors: */
    /*  length of pixel_size_mmel */
    pixel_size_mmel_wn[i] = -pixel_size_mm_w * T_carm[i];
    pixel_size_mmel_hn[i] = -pixel_size_mm_h * T_carm[8 + i];
    corner[i] = (-552.5 * T_carm[4 + i] + T_carm[12 + i]) +
      (detector_dimensions[0] * (pixel_size_mm_w * T_carm[i]) +
       detector_dimensions[1] * (pixel_size_mm_h * T_carm[8 + i])) / 2.0;
  }

  emlrtForLoopVectorCheckR2012b(1.0, 1.0, detector_dimensions[0], mxDOUBLE_CLASS,
                                (int32_T)detector_dimensions[0], &d_emlrtRTEI,
    sp);
  ih = 1;
  while (ih - 1 <= (int32_T)detector_dimensions[0] - 1) {
    /* if(mod(ih,100)==0),fprintf('height:\t%i...\n',ih);end */
    emlrtForLoopVectorCheckR2012b(1.0, 1.0, detector_dimensions[1],
      mxDOUBLE_CLASS, (int32_T)detector_dimensions[1], &c_emlrtRTEI, sp);
    iw = 1;
    while (iw - 1 <= (int32_T)detector_dimensions[1] - 1) {
      /* pixel_point_mm = corner + (ih-1)*pixel_size_mmel.hp + (iw-1)*pixel_size_mmel.wp; %ray end point */
      /* ray to be traced */
      /*  find parametrized (t) voxel plane (min or max) intersections: */
      /*  PLANE = P1 + t(P2-P1) */
      /*  SK added */
      /*  t_x = (i-x1) / (x2-x1), t_y = (j-y1) / (y2-y1), t_z = (k-z1) / (z2-z1) */
      for (i = 0; i < 3; i++) {
        pixel_size_mm_h = (corner[i] + ((1.0 + (real_T)(ih - 1)) - 1.0) *
                           pixel_size_mmel_hn[i]) + ((1.0 + (real_T)(iw - 1)) -
          1.0) * pixel_size_mmel_wn[i];

        /* ray end point */
        pixel_size_mm_w = pixel_size_mm_h - source[i];
        tstep[i] = voxel_corner_min[i] - source[i];
        tnext[i] = pixel_size_mm_w + 2.2250738585072014E-308;
        b_voxPlanes__max[i] = voxPlanes__max[i] - source[i];
        b_ray_source2pixel[i] = pixel_size_mm_w + 2.2250738585072014E-308;
        pixel_point_mm[i] = pixel_size_mm_h;
        ray_source2pixel[i] = pixel_size_mm_w;
      }

      rdivide(tstep, tnext, t_plane_min);
      rdivide(b_voxPlanes__max, b_ray_source2pixel, t_plane_max);

      /*  compute (parametric) intersection values */
      /*  tmin = max { min{tx(0), tx(Nx)}, min{ty(0), ty(Ny)], min{tz(0), tz(Nz)}, 0.0 } */
      /*  tmax = min { max{tx(0), tx(Nx)}, max{ty(0), ty(Ny)], max{tz(0), tz(Nz)}, 1.0 } */
      /* t_larger = [ max([t_plane_min(1), t_plane_max(1)]), max([t_plane_min(2), t_plane_max(2)]), max([t_plane_min(3), t_plane_max(3)]), 1.0 ]; */
      /* t_smaller = [ min([t_plane_min(1), t_plane_max(1)]), min([t_plane_min(2), t_plane_max(2)]), min([t_plane_min(3), t_plane_max(3)]), 0.0 ]; */
      i = 1;
      tmax = t_plane_min[0];
      if (muDoubleScalarIsNaN(t_plane_min[0])) {
        pixel_size_mmIntensity = 2;
        exitg8 = false;
        while ((!exitg8) && (pixel_size_mmIntensity < 3)) {
          i = 2;
          if (!muDoubleScalarIsNaN(t_plane_max[0])) {
            tmax = t_plane_max[0];
            exitg8 = true;
          } else {
            pixel_size_mmIntensity = 3;
          }
        }
      }

      if ((i < 2) && (t_plane_max[0] > tmax)) {
        tmax = t_plane_max[0];
      }

      i = 1;
      pixel_size_mm_h = t_plane_min[1];
      if (muDoubleScalarIsNaN(t_plane_min[1])) {
        pixel_size_mmIntensity = 2;
        exitg7 = false;
        while ((!exitg7) && (pixel_size_mmIntensity < 3)) {
          i = 2;
          if (!muDoubleScalarIsNaN(t_plane_max[1])) {
            pixel_size_mm_h = t_plane_max[1];
            exitg7 = true;
          } else {
            pixel_size_mmIntensity = 3;
          }
        }
      }

      if ((i < 2) && (t_plane_max[1] > pixel_size_mm_h)) {
        pixel_size_mm_h = t_plane_max[1];
      }

      i = 1;
      pixel_size_mm_w = t_plane_min[2];
      if (muDoubleScalarIsNaN(t_plane_min[2])) {
        pixel_size_mmIntensity = 2;
        exitg6 = false;
        while ((!exitg6) && (pixel_size_mmIntensity < 3)) {
          i = 2;
          if (!muDoubleScalarIsNaN(t_plane_max[2])) {
            pixel_size_mm_w = t_plane_max[2];
            exitg6 = true;
          } else {
            pixel_size_mmIntensity = 3;
          }
        }
      }

      if ((i < 2) && (t_plane_max[2] > pixel_size_mm_w)) {
        pixel_size_mm_w = t_plane_max[2];
      }

      t_larger[0] = tmax;
      t_larger[1] = pixel_size_mm_h;
      t_larger[2] = pixel_size_mm_w;
      t_larger[3] = 1.0;
      i = 1;
      temp = t_plane_min[0];
      if (muDoubleScalarIsNaN(t_plane_min[0])) {
        pixel_size_mmIntensity = 2;
        exitg5 = false;
        while ((!exitg5) && (pixel_size_mmIntensity < 3)) {
          i = 2;
          if (!muDoubleScalarIsNaN(t_plane_max[0])) {
            temp = t_plane_max[0];
            exitg5 = true;
          } else {
            pixel_size_mmIntensity = 3;
          }
        }
      }

      if ((i < 2) && (t_plane_max[0] < temp)) {
        temp = t_plane_max[0];
      }

      i = 1;
      pixel_size_mm_h = t_plane_min[1];
      if (muDoubleScalarIsNaN(t_plane_min[1])) {
        pixel_size_mmIntensity = 2;
        exitg4 = false;
        while ((!exitg4) && (pixel_size_mmIntensity < 3)) {
          i = 2;
          if (!muDoubleScalarIsNaN(t_plane_max[1])) {
            pixel_size_mm_h = t_plane_max[1];
            exitg4 = true;
          } else {
            pixel_size_mmIntensity = 3;
          }
        }
      }

      if ((i < 2) && (t_plane_max[1] < pixel_size_mm_h)) {
        pixel_size_mm_h = t_plane_max[1];
      }

      i = 1;
      pixel_size_mm_w = t_plane_min[2];
      if (muDoubleScalarIsNaN(t_plane_min[2])) {
        pixel_size_mmIntensity = 2;
        exitg3 = false;
        while ((!exitg3) && (pixel_size_mmIntensity < 3)) {
          i = 2;
          if (!muDoubleScalarIsNaN(t_plane_max[2])) {
            pixel_size_mm_w = t_plane_max[2];
            exitg3 = true;
          } else {
            pixel_size_mmIntensity = 3;
          }
        }
      }

      if ((i < 2) && (t_plane_max[2] < pixel_size_mm_w)) {
        pixel_size_mm_w = t_plane_max[2];
      }

      t_smaller[0] = temp;
      t_smaller[1] = pixel_size_mm_h;
      t_smaller[2] = pixel_size_mm_w;
      t_smaller[3] = 0.0;
      i = 1;
      itmp = 0;
      if (muDoubleScalarIsNaN(temp)) {
        pixel_size_mmIntensity = 1;
        exitg2 = false;
        while ((!exitg2) && (pixel_size_mmIntensity + 1 < 5)) {
          i = pixel_size_mmIntensity + 1;
          if (!muDoubleScalarIsNaN(t_smaller[pixel_size_mmIntensity])) {
            temp = t_smaller[pixel_size_mmIntensity];
            itmp = pixel_size_mmIntensity;
            exitg2 = true;
          } else {
            pixel_size_mmIntensity++;
          }
        }
      }

      if (i < 4) {
        while (i + 1 < 5) {
          if (t_smaller[i] > temp) {
            temp = t_smaller[i];
            itmp = i;
          }

          i++;
        }
      }

      i = 1;
      if (muDoubleScalarIsNaN(tmax)) {
        pixel_size_mmIntensity = 2;
        exitg1 = false;
        while ((!exitg1) && (pixel_size_mmIntensity < 5)) {
          i = pixel_size_mmIntensity;
          if (!muDoubleScalarIsNaN(t_larger[pixel_size_mmIntensity - 1])) {
            tmax = t_larger[pixel_size_mmIntensity - 1];
            exitg1 = true;
          } else {
            pixel_size_mmIntensity++;
          }
        }
      }

      if (i < 4) {
        while (i + 1 < 5) {
          if (t_larger[i] < tmax) {
            tmax = t_larger[i];
          }

          i++;
        }
      }

      for (i0 = 0; i0 < 3; i0++) {
        pixel_point_mm[i0] = (real_T)(pixel_point_mm[i0] < source[i0]) * -2.0 +
          1.0;
      }

      if (temp < tmax) {
        /*  if ray intersects volume */
        /* find index for each dimension: */
        for (i = 0; i < 3; i++) {
          pixel_size_mm_h = muDoubleScalarFloor((((ray_source2pixel[i] * temp +
            source[i]) - voxel_corner_min[i]) + 2.2250738585072014E-308) /
            voxel_size_mm[i]);

          /* (parametric) intersection values... */
          /* makes 0 or 1 */
          tnext[i] = (voxel_corner_min[i] + ((pixel_size_mm_h +
            (pixel_point_mm[i] + 1.0) / 2.0) * voxel_size_mm[i] - source[i])) /
            (ray_source2pixel[i] + 2.2250738585072014E-308);

          /*  parametric value for next plane intersection */
          tstep[i] = muDoubleScalarAbs(voxel_size_mm[i] / (ray_source2pixel[i] +
            2.2250738585072014E-308));
          t_plane_min[i] = pixel_size_mm_h;
        }

        /*  parametric step size */
        /* address special cases... */
        if (temp == t_plane_max[emlrtDynamicBoundsCheckFastR2012b(itmp + 1, 1, 3,
             &c_emlrtBCI, sp) - 1]) {
          /* if intersection is a "max" plane */
          t_plane_min[itmp] = (real_T)voxDim[itmp] - 1.0;
          tnext[itmp] = temp + tstep[itmp];

          /* next plane crossing */
        } else {
          t_plane_min[itmp] = 0.0;
          tnext[itmp] = temp + tstep[itmp];

          /* next plane crossing */
        }

        /*  voxel index values(add one for matlab): */
        pixel_size_mm_h = t_plane_min[0] + 1.0;
        pixel_size_mm_w = t_plane_min[1] + 1.0;
        iz = t_plane_min[2] + 1.0;
        tx = tnext[0];
        ty = tnext[1];
        tz = tnext[2];
        pixel_size_mmIntensity = 0;

        /* uncomment to generate P-matrix: */
        /* pixel_size_mmNum = 1; */
        /* len = norm(ray_source2pixel); % ray length */
        while ((temp + 0.0001 < tmax) && (!(pixel_size_mm_h * pixel_size_mm_w *
                 iz == 0.0))) {
          if ((tx < ty) && (tx < tz)) {
            /*  실제 DRR을 그리지 않고, 한점이라도 지나면 해당 점에 포함시킴 */
            i0 = voxel_data->size[0];
            i = (int32_T)emlrtIntegerCheckFastR2012b(pixel_size_mm_h,
              &k_emlrtDCI, sp);
            itmp = voxel_data->size[1];
            i1 = (int32_T)emlrtIntegerCheckFastR2012b(pixel_size_mm_w,
              &l_emlrtDCI, sp);
            i2 = voxel_data->size[2];
            i3 = (int32_T)emlrtIntegerCheckFastR2012b(iz, &m_emlrtDCI, sp);
            if (voxel_data->data[((emlrtDynamicBoundsCheckFastR2012b(i, 1, i0,
                   &j_emlrtBCI, sp) + voxel_data->size[0] *
                                   (emlrtDynamicBoundsCheckFastR2012b(i1, 1,
                    itmp, &k_emlrtBCI, sp) - 1)) + voxel_data->size[0] *
                                  voxel_data->size[1] *
                                  (emlrtDynamicBoundsCheckFastR2012b(i3, 1, i2,
                   &l_emlrtBCI, sp) - 1)) - 1]) {
              pixel_size_mmIntensity = 255;
              tmax = rtMinusInf;
            }

            temp = tx;
            tx += tstep[0];
            pixel_size_mm_h += pixel_point_mm[0];
          } else if (ty < tz) {
            /*  실제 DRR을 그리지 않고, 한점이라도 지나면 해당 점에 포함시킴 */
            i0 = voxel_data->size[0];
            i = (int32_T)emlrtIntegerCheckFastR2012b(pixel_size_mm_h,
              &h_emlrtDCI, sp);
            itmp = voxel_data->size[1];
            i1 = (int32_T)emlrtIntegerCheckFastR2012b(pixel_size_mm_w,
              &i_emlrtDCI, sp);
            i2 = voxel_data->size[2];
            i3 = (int32_T)emlrtIntegerCheckFastR2012b(iz, &j_emlrtDCI, sp);
            if (voxel_data->data[((emlrtDynamicBoundsCheckFastR2012b(i, 1, i0,
                   &g_emlrtBCI, sp) + voxel_data->size[0] *
                                   (emlrtDynamicBoundsCheckFastR2012b(i1, 1,
                    itmp, &h_emlrtBCI, sp) - 1)) + voxel_data->size[0] *
                                  voxel_data->size[1] *
                                  (emlrtDynamicBoundsCheckFastR2012b(i3, 1, i2,
                   &i_emlrtBCI, sp) - 1)) - 1]) {
              pixel_size_mmIntensity = 255;
              tmax = rtMinusInf;
            }

            temp = ty;
            ty += tstep[1];
            pixel_size_mm_w += pixel_point_mm[1];
          } else {
            /*  실제 DRR을 그리지 않고, 한점이라도 지나면 해당 점에 포함시킴 */
            i0 = voxel_data->size[0];
            i = (int32_T)emlrtIntegerCheckFastR2012b(pixel_size_mm_h,
              &e_emlrtDCI, sp);
            itmp = voxel_data->size[1];
            i1 = (int32_T)emlrtIntegerCheckFastR2012b(pixel_size_mm_w,
              &f_emlrtDCI, sp);
            i2 = voxel_data->size[2];
            i3 = (int32_T)emlrtIntegerCheckFastR2012b(iz, &g_emlrtDCI, sp);
            if (voxel_data->data[((emlrtDynamicBoundsCheckFastR2012b(i, 1, i0,
                   &d_emlrtBCI, sp) + voxel_data->size[0] *
                                   (emlrtDynamicBoundsCheckFastR2012b(i1, 1,
                    itmp, &e_emlrtBCI, sp) - 1)) + voxel_data->size[0] *
                                  voxel_data->size[1] *
                                  (emlrtDynamicBoundsCheckFastR2012b(i3, 1, i2,
                   &f_emlrtBCI, sp) - 1)) - 1]) {
              pixel_size_mmIntensity = 255;
              tmax = rtMinusInf;
            }

            temp = tz;
            tz += tstep[2];
            iz += pixel_point_mm[2];
          }

          emlrtBreakCheckFastR2012b(emlrtBreakCheckR2012bFlagVar, sp);
        }

        /* end while */
        i0 = projection->size[0];
        i = projection->size[1];
        projection->data[(emlrtDynamicBoundsCheckFastR2012b(ih, 1, i0,
          &m_emlrtBCI, sp) + projection->size[0] *
                          (emlrtDynamicBoundsCheckFastR2012b(iw, 1, i,
          &n_emlrtBCI, sp) - 1)) - 1] = pixel_size_mmIntensity;
      } else {
        /* if no intersections */
        i0 = projection->size[0];
        i = projection->size[1];
        projection->data[(emlrtDynamicBoundsCheckFastR2012b(ih, 1, i0, &emlrtBCI,
          sp) + projection->size[0] * (emlrtDynamicBoundsCheckFastR2012b(iw, 1,
          i, &b_emlrtBCI, sp) - 1)) - 1] = 0.0;
      }

      /* if intersections */
      /* uncomment to generate P-matrix: */
      /* rayCount = rayCount + 1; */
      iw++;
      emlrtBreakCheckFastR2012b(emlrtBreakCheckR2012bFlagVar, sp);
    }

    /* width */
    /* fprintf('\n'); */
    ih++;
    emlrtBreakCheckFastR2012b(emlrtBreakCheckR2012bFlagVar, sp);
  }

  /* height */
  /* uncomment to generate P-matrix: */
  /* matrix = matrix(1:mtxCount-1,:); */
  /* stop trace timer: */
  /* trace_time = toc */
  /* fprintf('\n') */
  /* function */
  /* } */
}
Esempio n. 21
0
/* Function Definitions */
void reportDrivers(const emlrtStack *sp, char_T flatAddrList_data[], int32_T
                   flatAddrList_size[2])
{
  int32_T i20;
  static const char_T cv21[6] = { 's', 'i', 'l', 'e', 'n', 't' };

  char_T u[6];
  const mxArray *y;
  static const int32_T iv14[2] = { 1, 6 };

  const mxArray *m7;
  char_T errStr_data[1024];
  UsrpErrorCapiEnumT errStat_i;
  int32_T flatAddrListSize;
  int32_T errStrSize;
  emlrtStack st;
  emlrtStack b_st;
  st.prev = sp;
  st.tls = sp->tls;
  b_st.prev = &st;
  b_st.tls = st.tls;

  /*    Copyright 2011-2012 The MathWorks, Inc. */
  st.site = &cb_emlrtRSI;

  /*  */
  /*  This function unifies handling of interp vs. codegen call as well as */
  /*  errStat / errStr assignment. */
  /*  */
  /*    Copyright 2011-2015 The MathWorks, Inc. */
  if (!isSetupsdruCalled) {
    for (i20 = 0; i20 < 6; i20++) {
      u[i20] = cv21[i20];
    }

    y = NULL;
    m7 = emlrtCreateCharArray(2, iv14);
    emlrtInitCharArrayR2013a(&st, 6, m7, &u[0]);
    emlrtAssign(&y, m7);
    b_st.site = &eb_emlrtRSI;
    setupsdru(&b_st, sdruroot(&b_st, &c_emlrtMCI), y, &d_emlrtMCI);
    isSetupsdruCalled = true;
  }

  /*  These sizes must match those in C code. */
  /*  Arbitrary max imposed on ML/SL side */
  /*  function is being called in interpreted mode */
  /*  not being found:  */
  /*  eml_allow_enum_inputs; */
  /* errStat_i = int32(0); */
  memset(&errStr_data[0], 0, sizeof(char_T) << 10);
  flatAddrList_size[0] = 1;
  memset(&flatAddrList_data[0], 0, sizeof(char_T) << 7);
  reportDrivers_c(&flatAddrList_data[0], &errStat_i, &errStr_data[0]);
  flatAddrListSize = strlen(&flatAddrList_data[0]);
  if (flatAddrListSize <= 128) {
  } else {
    emlrtErrorWithMessageIdR2012b(&st, &k_emlrtRTEI,
      "Coder:builtins:AssertionFailed", 0);
  }

  if (1 > flatAddrListSize) {
    flatAddrList_size[1] = 0;
  } else {
    flatAddrList_size[1] = flatAddrListSize;
  }

  /* errStat = UsrpErrorCapiEnumT(errStat_i); */
  errStrSize = strlen(&errStr_data[0]);
  if (errStrSize <= 1024) {
  } else {
    emlrtErrorWithMessageIdR2012b(&st, &d_emlrtRTEI,
      "Coder:builtins:AssertionFailed", 0);
  }
}
Esempio n. 22
0
void mldivide(const emlrtStack *sp, const emxArray_real_T *A, const
              emxArray_real_T *B, emxArray_real_T *Y)
{
  const mxArray *y;
  static const int32_T iv77[2] = { 1, 21 };

  const mxArray *m13;
  char_T cv74[21];
  int32_T i;
  static const char_T cv75[21] = { 'C', 'o', 'd', 'e', 'r', ':', 'M', 'A', 'T',
    'L', 'A', 'B', ':', 'd', 'i', 'm', 'a', 'g', 'r', 'e', 'e' };

  emxArray_real_T *b_B;
  emxArray_real_T *r17;
  uint32_T unnamed_idx_0;
  int32_T loop_ub;
  emlrtStack st;
  st.prev = sp;
  st.tls = sp->tls;
  emlrtHeapReferenceStackEnterFcnR2012b(sp);
  if (B->size[0] == A->size[0]) {
  } else {
    y = NULL;
    m13 = emlrtCreateCharArray(2, iv77);
    for (i = 0; i < 21; i++) {
      cv74[i] = cv75[i];
    }

    emlrtInitCharArrayR2013a(sp, 21, m13, cv74);
    emlrtAssign(&y, m13);
    st.site = &xf_emlrtRSI;
    error(&st, message(&st, y, &bb_emlrtMCI), &bb_emlrtMCI);
  }

  b_emxInit_real_T(sp, &b_B, 1, &tb_emlrtRTEI, true);
  b_emxInit_real_T(sp, &r17, 1, &tb_emlrtRTEI, true);
  if ((A->size[0] == 0) || (A->size[1] == 0) || (B->size[0] == 0)) {
    unnamed_idx_0 = (uint32_T)A->size[1];
    i = Y->size[0];
    Y->size[0] = (int32_T)unnamed_idx_0;
    emxEnsureCapacity(sp, (emxArray__common *)Y, i, (int32_T)sizeof(real_T),
                      &tb_emlrtRTEI);
    loop_ub = (int32_T)unnamed_idx_0;
    for (i = 0; i < loop_ub; i++) {
      Y->data[i] = 0.0;
    }
  } else if (A->size[0] == A->size[1]) {
    i = Y->size[0];
    Y->size[0] = B->size[0];
    emxEnsureCapacity(sp, (emxArray__common *)Y, i, (int32_T)sizeof(real_T),
                      &tb_emlrtRTEI);
    loop_ub = B->size[0];
    for (i = 0; i < loop_ub; i++) {
      Y->data[i] = B->data[i];
    }

    st.site = &xf_emlrtRSI;
    b_eml_lusolve(&st, A, Y);
  } else {
    i = b_B->size[0];
    b_B->size[0] = B->size[0];
    emxEnsureCapacity(sp, (emxArray__common *)b_B, i, (int32_T)sizeof(real_T),
                      &tb_emlrtRTEI);
    loop_ub = B->size[0];
    for (i = 0; i < loop_ub; i++) {
      b_B->data[i] = B->data[i];
    }

    st.site = &xf_emlrtRSI;
    c_eml_qrsolve(&st, A, b_B, r17);
    i = Y->size[0];
    Y->size[0] = r17->size[0];
    emxEnsureCapacity(sp, (emxArray__common *)Y, i, (int32_T)sizeof(real_T),
                      &tb_emlrtRTEI);
    loop_ub = r17->size[0];
    for (i = 0; i < loop_ub; i++) {
      Y->data[i] = r17->data[i];
    }
  }

  emxFree_real_T(&r17);
  emxFree_real_T(&b_B);
  emlrtHeapReferenceStackLeaveFcnR2012b(sp);
}
static void cgxe_mdl_terminate(InstanceStruct_UXvEHHrxIcmXaLthmwvduD
  *moduleInstance)
{
  dsp_SampleRateConverter_2 *obj;
  int32_T i2;
  static char_T cv20[45] = { 'M', 'A', 'T', 'L', 'A', 'B', ':', 's', 'y', 's',
    't', 'e', 'm', ':', 'm', 'e', 't', 'h', 'o', 'd', 'C', 'a', 'l', 'l', 'e',
    'd', 'W', 'h', 'e', 'n', 'R', 'e', 'l', 'e', 'a', 's', 'e', 'd', 'C', 'o',
    'd', 'e', 'g', 'e', 'n' };

  char_T u[45];
  const mxArray *y;
  static const int32_T iv32[2] = { 1, 45 };

  const mxArray *m5;
  static char_T cv21[8] = { 'i', 's', 'L', 'o', 'c', 'k', 'e', 'd' };

  char_T b_u[8];
  const mxArray *b_y;
  static const int32_T iv33[2] = { 1, 8 };

  boolean_T flag;
  char_T c_u[45];
  const mxArray *c_y;
  static const int32_T iv34[2] = { 1, 45 };

  static char_T cv22[7] = { 'r', 'e', 'l', 'e', 'a', 's', 'e' };

  char_T d_u[7];
  const mxArray *d_y;
  static const int32_T iv35[2] = { 1, 7 };

  dspcodegen_FIRDecimator *b_obj;
  char_T e_u[45];
  const mxArray *e_y;
  static const int32_T iv36[2] = { 1, 45 };

  char_T f_u[7];
  const mxArray *f_y;
  static const int32_T iv37[2] = { 1, 7 };

  dspcodegen_FIRRateConverter *c_obj;
  char_T g_u[45];
  const mxArray *g_y;
  static const int32_T iv38[2] = { 1, 45 };

  char_T h_u[7];
  const mxArray *h_y;
  static const int32_T iv39[2] = { 1, 7 };

  if (!moduleInstance->sysobj_not_empty) {
    obj = &moduleInstance->sysobj;
    moduleInstance->sysobj.filt1 = NULL;
    moduleInstance->sysobj.filt2 = NULL;
    obj->isInitialized = 0;
    obj->NumChannels = -1.0;
    moduleInstance->sysobj_not_empty = true;
  }

  obj = &moduleInstance->sysobj;
  if (moduleInstance->sysobj.isInitialized == 2) {
    for (i2 = 0; i2 < 45; i2++) {
      u[i2] = cv20[i2];
    }

    y = NULL;
    m5 = emlrtCreateCharArray(2, iv32);
    emlrtInitCharArrayR2013a(moduleInstance->emlrtRootTLSGlobal, 45, m5, &u[0]);
    emlrtAssign(&y, m5);
    for (i2 = 0; i2 < 8; i2++) {
      b_u[i2] = cv21[i2];
    }

    b_y = NULL;
    m5 = emlrtCreateCharArray(2, iv33);
    emlrtInitCharArrayR2013a(moduleInstance->emlrtRootTLSGlobal, 8, m5, &b_u[0]);
    emlrtAssign(&b_y, m5);
    error(moduleInstance, message(moduleInstance, y, b_y, &c_emlrtMCI),
          &c_emlrtMCI);
  }

  flag = (obj->isInitialized == 1);
  if (flag) {
    obj = &moduleInstance->sysobj;
    if (moduleInstance->sysobj.isInitialized == 2) {
      for (i2 = 0; i2 < 45; i2++) {
        c_u[i2] = cv20[i2];
      }

      c_y = NULL;
      m5 = emlrtCreateCharArray(2, iv34);
      emlrtInitCharArrayR2013a(moduleInstance->emlrtRootTLSGlobal, 45, m5, &c_u
        [0]);
      emlrtAssign(&c_y, m5);
      for (i2 = 0; i2 < 7; i2++) {
        d_u[i2] = cv22[i2];
      }

      d_y = NULL;
      m5 = emlrtCreateCharArray(2, iv35);
      emlrtInitCharArrayR2013a(moduleInstance->emlrtRootTLSGlobal, 7, m5, &d_u[0]);
      emlrtAssign(&d_y, m5);
      error(moduleInstance, message(moduleInstance, c_y, d_y, &c_emlrtMCI),
            &c_emlrtMCI);
    }

    if (obj->isInitialized == 1) {
      obj->isInitialized = 2;
      b_obj = obj->filt1;
      if (b_obj->isInitialized == 2) {
        for (i2 = 0; i2 < 45; i2++) {
          e_u[i2] = cv20[i2];
        }

        e_y = NULL;
        m5 = emlrtCreateCharArray(2, iv36);
        emlrtInitCharArrayR2013a(moduleInstance->emlrtRootTLSGlobal, 45, m5,
          &e_u[0]);
        emlrtAssign(&e_y, m5);
        for (i2 = 0; i2 < 7; i2++) {
          f_u[i2] = cv22[i2];
        }

        f_y = NULL;
        m5 = emlrtCreateCharArray(2, iv37);
        emlrtInitCharArrayR2013a(moduleInstance->emlrtRootTLSGlobal, 7, m5,
          &f_u[0]);
        emlrtAssign(&f_y, m5);
        error(moduleInstance, message(moduleInstance, e_y, f_y, &c_emlrtMCI),
              &c_emlrtMCI);
      }

      if (b_obj->isInitialized == 1) {
        b_obj->isInitialized = 2;

        /* System object Destructor function: dsp.FIRDecimator */
      }

      c_obj = obj->filt2;
      if (c_obj->isInitialized == 2) {
        for (i2 = 0; i2 < 45; i2++) {
          g_u[i2] = cv20[i2];
        }

        g_y = NULL;
        m5 = emlrtCreateCharArray(2, iv38);
        emlrtInitCharArrayR2013a(moduleInstance->emlrtRootTLSGlobal, 45, m5,
          &g_u[0]);
        emlrtAssign(&g_y, m5);
        for (i2 = 0; i2 < 7; i2++) {
          h_u[i2] = cv22[i2];
        }

        h_y = NULL;
        m5 = emlrtCreateCharArray(2, iv39);
        emlrtInitCharArrayR2013a(moduleInstance->emlrtRootTLSGlobal, 7, m5,
          &h_u[0]);
        emlrtAssign(&h_y, m5);
        error(moduleInstance, message(moduleInstance, g_y, h_y, &c_emlrtMCI),
              &c_emlrtMCI);
      }

      if (c_obj->isInitialized == 1) {
        c_obj->isInitialized = 2;

        /* System object Destructor function: dsp.FIRRateConverter */
      }

      obj->NumChannels = -1.0;
    }
  }

  /* System object Destructor function: dsp.FIRDecimator */
  /* System object Destructor function: dsp.FIRDecimator */
  /* System object Destructor function: dsp.FIRRateConverter */
  /* System object Destructor function: dsp.FIRRateConverter */
}
Esempio n. 24
0
/* Function Definitions */
void reportDrivers(const emlrtStack *sp, char_T flatAddrList_data[], int32_T
                   flatAddrList_size[2])
{
  const mxArray *y;
  static const int32_T iv36[2] = { 1, 6 };

  const mxArray *m14;
  char_T cv60[6];
  int32_T i;
  static const char_T cv61[6] = { 's', 'i', 'l', 'e', 'n', 't' };

  char_T errStr_data[1024];
  UsrpErrorCapiEnumT errStat_i;
  const mxArray *b_y;
  const mxArray *c_y;
  emlrtStack st;
  emlrtStack b_st;
  st.prev = sp;
  st.tls = sp->tls;
  b_st.prev = &st;
  b_st.tls = st.tls;

  /*    Copyright 2011-2012 The MathWorks, Inc. */
  st.site = &lb_emlrtRSI;

  /*  */
  /*  This function unifies handling of interp vs. codegen call as well as */
  /*  errStat / errStr assignment. */
  /*  */
  /*    Copyright 2011-2014 The MathWorks, Inc. */
  if (!isSetupsdruCalled) {
    y = NULL;
    m14 = emlrtCreateCharArray(2, iv36);
    for (i = 0; i < 6; i++) {
      cv60[i] = cv61[i];
    }

    emlrtInitCharArrayR2013a(&st, 6, m14, cv60);
    emlrtAssign(&y, m14);
    b_st.site = &qb_emlrtRSI;
    setupsdru(&b_st, sdruroot(&b_st, &f_emlrtMCI), y, &g_emlrtMCI);
    isSetupsdruCalled = true;
  }

  /*  These sizes must match those in C code. */
  /*  Arbitrary max imposed on ML/SL side */
  /*  function is being called in interpreted mode */
  /*  not being found:  */
  /*  eml_allow_enum_inputs; */
  /* errStat_i = int32(0); */
  memset(&errStr_data[0], 0, sizeof(char_T) << 10);
  flatAddrList_size[0] = 1;
  memset(&flatAddrList_data[0], 0, sizeof(char_T) << 7);
  reportDrivers_c(&flatAddrList_data[0], &errStat_i, &errStr_data[0]);
  i = strlen(&flatAddrList_data[0]);
  if (i <= 128) {
  } else {
    b_y = NULL;
    m14 = emlrtCreateString("Assertion failed.");
    emlrtAssign(&b_y, m14);
    b_st.site = &ob_emlrtRSI;
    c_error(&b_st, b_y, &h_emlrtMCI);
  }

  if (1 > i) {
    i = 0;
  } else {
    i = emlrtDynamicBoundsCheckFastR2012b(i, 1, 128, &m_emlrtBCI, &st);
  }

  flatAddrList_size[1] = i;

  /* errStat = UsrpErrorCapiEnumT(errStat_i); */
  i = strlen(&errStr_data[0]);
  if (i <= 1024) {
  } else {
    c_y = NULL;
    m14 = emlrtCreateString("Assertion failed.");
    emlrtAssign(&c_y, m14);
    b_st.site = &nb_emlrtRSI;
    c_error(&b_st, c_y, &e_emlrtMCI);
  }

  if (1 > i) {
  } else {
    emlrtDynamicBoundsCheckFastR2012b(i, 1, 1024, &l_emlrtBCI, &st);
  }
}
static void SystemCore_step(InstanceStruct_UXvEHHrxIcmXaLthmwvduD
  *moduleInstance, dspcodegen_FIRDecimator *obj, real_T varargin_1[6250], real_T
  varargout_1[1250])
{
  int32_T inputIdx;
  static char_T cv4[45] = { 'M', 'A', 'T', 'L', 'A', 'B', ':', 's', 'y', 's',
    't', 'e', 'm', ':', 'm', 'e', 't', 'h', 'o', 'd', 'C', 'a', 'l', 'l', 'e',
    'd', 'W', 'h', 'e', 'n', 'R', 'e', 'l', 'e', 'a', 's', 'e', 'd', 'C', 'o',
    'd', 'e', 'g', 'e', 'n' };

  char_T u[45];
  const mxArray *y;
  static const int32_T iv4[2] = { 1, 45 };

  const mxArray *m1;
  static char_T cv5[4] = { 's', 't', 'e', 'p' };

  char_T b_u[4];
  const mxArray *b_y;
  static const int32_T iv5[2] = { 1, 4 };

  dspcodegen_FIRDecimator *b_obj;
  static char_T cv6[51] = { 'M', 'A', 'T', 'L', 'A', 'B', ':', 's', 'y', 's',
    't', 'e', 'm', ':', 'm', 'e', 't', 'h', 'o', 'd', 'C', 'a', 'l', 'l', 'e',
    'd', 'W', 'h', 'e', 'n', 'L', 'o', 'c', 'k', 'e', 'd', 'R', 'e', 'l', 'e',
    'a', 's', 'e', 'd', 'C', 'o', 'd', 'e', 'g', 'e', 'n' };

  char_T c_u[51];
  const mxArray *c_y;
  static const int32_T iv6[2] = { 1, 51 };

  static char_T cv7[5] = { 's', 'e', 't', 'u', 'p' };

  char_T d_u[5];
  const mxArray *d_y;
  static const int32_T iv7[2] = { 1, 5 };

  dsp_FIRDecimator_0 *c_obj;
  int32_T curTapIdx;
  int32_T phaseIdx;
  int32_T cffIdx;
  int32_T outBufIdx;
  int32_T maxWindow;
  int32_T iIdx;
  int32_T jIdx;
  if (obj->isInitialized == 2) {
    for (inputIdx = 0; inputIdx < 45; inputIdx++) {
      u[inputIdx] = cv4[inputIdx];
    }

    y = NULL;
    m1 = emlrtCreateCharArray(2, iv4);
    emlrtInitCharArrayR2013a(moduleInstance->emlrtRootTLSGlobal, 45, m1, &u[0]);
    emlrtAssign(&y, m1);
    for (inputIdx = 0; inputIdx < 4; inputIdx++) {
      b_u[inputIdx] = cv5[inputIdx];
    }

    b_y = NULL;
    m1 = emlrtCreateCharArray(2, iv5);
    emlrtInitCharArrayR2013a(moduleInstance->emlrtRootTLSGlobal, 4, m1, &b_u[0]);
    emlrtAssign(&b_y, m1);
    error(moduleInstance, message(moduleInstance, y, b_y, &c_emlrtMCI),
          &c_emlrtMCI);
  }

  if (obj->isInitialized != 1) {
    b_obj = obj;
    if (b_obj->isInitialized != 0) {
      for (inputIdx = 0; inputIdx < 51; inputIdx++) {
        c_u[inputIdx] = cv6[inputIdx];
      }

      c_y = NULL;
      m1 = emlrtCreateCharArray(2, iv6);
      emlrtInitCharArrayR2013a(moduleInstance->emlrtRootTLSGlobal, 51, m1, &c_u
        [0]);
      emlrtAssign(&c_y, m1);
      for (inputIdx = 0; inputIdx < 5; inputIdx++) {
        d_u[inputIdx] = cv7[inputIdx];
      }

      d_y = NULL;
      m1 = emlrtCreateCharArray(2, iv7);
      emlrtInitCharArrayR2013a(moduleInstance->emlrtRootTLSGlobal, 5, m1, &d_u[0]);
      emlrtAssign(&d_y, m1);
      error(moduleInstance, message(moduleInstance, c_y, d_y, &c_emlrtMCI),
            &c_emlrtMCI);
    }

    b_obj->isInitialized = 1;

    /* System object Initialization function: dsp.FIRDecimator */
    b_obj->cSFunObject.W2_CoeffIdx = 52;
    b_obj->cSFunObject.W0_PhaseIdx = 4;
    b_obj->cSFunObject.W4_TapDelayIndex = 48;
    b_obj->cSFunObject.W1_Sums = 0.0;
    for (inputIdx = 0; inputIdx < 60; inputIdx++) {
      b_obj->cSFunObject.W3_StatesBuff[inputIdx] = 0.0;
    }
  }

  b_obj = obj;
  c_obj = &b_obj->cSFunObject;

  /* System object Outputs function: dsp.FIRDecimator */
  inputIdx = 0;
  curTapIdx = b_obj->cSFunObject.W4_TapDelayIndex;
  phaseIdx = b_obj->cSFunObject.W0_PhaseIdx;
  cffIdx = b_obj->cSFunObject.W2_CoeffIdx;
  outBufIdx = 0;
  maxWindow = (phaseIdx + 1) * 12;
  for (iIdx = 0; iIdx < 6250; iIdx++) {
    c_obj->W1_Sums += varargin_1[inputIdx] * c_obj->P1_FILT[cffIdx];
    cffIdx++;
    for (jIdx = curTapIdx + 1; jIdx < maxWindow; jIdx++) {
      c_obj->W1_Sums += c_obj->W3_StatesBuff[jIdx] * c_obj->P1_FILT[cffIdx];
      cffIdx++;
    }

    for (jIdx = maxWindow - 12; jIdx <= curTapIdx; jIdx++) {
      c_obj->W1_Sums += c_obj->W3_StatesBuff[jIdx] * c_obj->P1_FILT[cffIdx];
      cffIdx++;
    }

    c_obj->W3_StatesBuff[curTapIdx] = varargin_1[inputIdx];
    inputIdx++;
    curTapIdx += 12;
    if (curTapIdx >= 60) {
      curTapIdx -= 60;
    }

    phaseIdx++;
    if (phaseIdx < 5) {
      maxWindow += 12;
    } else {
      c_obj->O0_Y0[outBufIdx] = c_obj->W1_Sums;
      outBufIdx++;
      c_obj->W1_Sums = 0.0;
      phaseIdx = 0;
      cffIdx = 0;
      curTapIdx--;
      if (curTapIdx < 0) {
        curTapIdx += 12;
      }

      maxWindow = 12;
    }
  }

  b_obj->cSFunObject.W4_TapDelayIndex = curTapIdx;
  b_obj->cSFunObject.W2_CoeffIdx = cffIdx;
  b_obj->cSFunObject.W0_PhaseIdx = phaseIdx;
  for (inputIdx = 0; inputIdx < 1250; inputIdx++) {
    varargout_1[inputIdx] = b_obj->cSFunObject.O0_Y0[inputIdx];
  }
}
static void cgxe_mdl_start(InstanceStruct_UXvEHHrxIcmXaLthmwvduD *moduleInstance)
{
  dsp_SampleRateConverter_2 *obj;
  dspcodegen_FIRDecimator *iobj_0;
  dspcodegen_FIRRateConverter *iobj_1;
  int32_T i0;
  static char_T cv8[51] = { 'M', 'A', 'T', 'L', 'A', 'B', ':', 's', 'y', 's',
    't', 'e', 'm', ':', 'm', 'e', 't', 'h', 'o', 'd', 'C', 'a', 'l', 'l', 'e',
    'd', 'W', 'h', 'e', 'n', 'L', 'o', 'c', 'k', 'e', 'd', 'R', 'e', 'l', 'e',
    'a', 's', 'e', 'd', 'C', 'o', 'd', 'e', 'g', 'e', 'n' };

  char_T u[51];
  const mxArray *y;
  static const int32_T iv8[2] = { 1, 51 };

  const mxArray *m2;
  static char_T cv9[5] = { 's', 'e', 't', 'u', 'p' };

  char_T b_u[5];
  const mxArray *b_y;
  static const int32_T iv9[2] = { 1, 5 };

  static int16_T iv10[8] = { 6250, 1, 1, 1, 1, 1, 1, 1 };

  static char_T cv10[29] = { 'd', 's', 'p', ':', 's', 'y', 's', 't', 'e', 'm',
    ':', 'S', 'h', 'a', 'r', 'e', 'd', ':', 'n', 'u', 'm', 'C', 'h', 'a', 'n',
    'n', 'e', 'l', 's' };

  char_T c_u[29];
  const mxArray *c_y;
  static const int32_T iv11[2] = { 1, 29 };

  static real_T dv0[65] = { -0.00042490390801053907, 0.001829921716933601,
    -0.0053922845058157441, 0.013158346550611766, -0.0306391449331187,
    0.097992165418816057, 0.1494061316020634, -0.036811645611123822,
    0.015554560498179271, -0.0065160634201840671, 0.002322039466476993,
    -0.00059679513327257766, 7.912220199299E-5, -0.00018023922410876497,
    0.00087868330763207075, -0.0027374434497387575, 0.0068640356860943941,
    -0.015898279697317719, 0.044393549657968379, 0.18648984591811768,
    -0.027710944293488637, 0.011353373510521791, -0.004835216511247617,
    0.0017985509582130208, -0.0005034779575003312, 7.1006774722819944E-5, 0.0,
    0.0, 0.0, 0.0, 0.0, 0.0, 0.2, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0,
    7.1006774722819944E-5, -0.0005034779575003312, 0.0017985509582130208,
    -0.004835216511247617, 0.011353373510521791, -0.027710944293488637,
    0.18648984591811768, 0.044393549657968379, -0.015898279697317719,
    0.0068640356860943941, -0.0027374434497387575, 0.00087868330763207075,
    -0.00018023922410876497, 7.912220199299E-5, -0.00059679513327257766,
    0.002322039466476993, -0.0065160634201840671, 0.015554560498179271,
    -0.036811645611123822, 0.1494061316020634, 0.097992165418816057,
    -0.0306391449331187, 0.013158346550611766, -0.0053922845058157441,
    0.001829921716933601, -0.00042490390801053907 };

  static real_T dv1[120] = { -2.7394100013652473E-5, 0.0, 0.00037894068534068619,
    -0.0013708823152694639, 0.00268257205568729, -0.0029618195399131889, 0.0,
    0.0078609652501006478, -0.019453248977701877, 0.028984307962212054,
    -0.026341800053436379, 0.0, 0.059586630047975528, -0.16398784004285519,
    0.39970920445885333, 0.74757835469466261, 0.0, -0.076109876780524763,
    0.077352679334485558, -0.051701756420330057, 0.021737647121907556, 0.0,
    -0.009760644763162624, 0.010147444378648696, -0.0062395788347920046,
    0.00223736435719863, 0.0, -0.000578393604977232, 0.00038049397375299542,
    -0.00011122314331323368, -7.3471653020902532E-5, 0.0001803558498977357, 0.0,
    -0.0010125268340104962, 0.00312437313653832, -0.0054788551201990889,
    0.0055792244712591183, 0.0, -0.013309431044135926, 0.031938446310848335,
    -0.04692872867557716, 0.043075982682944734, 0.0, -0.11993407734560091,
    0.60283398545426792, 0.60283398545426792, -0.11993407734560091, 0.0,
    0.043075982682944734, -0.04692872867557716, 0.031938446310848335,
    -0.013309431044135926, 0.0, 0.0055792244712591183, -0.0054788551201990889,
    0.00312437313653832, -0.0010125268340104962, 0.0, 0.0001803558498977357,
    -7.3471653020902532E-5, -0.00011122314331323368, 0.00038049397375299542,
    -0.000578393604977232, 0.0, 0.00223736435719863, -0.0062395788347920046,
    0.010147444378648696, -0.009760644763162624, 0.0, 0.021737647121907556,
    -0.051701756420330057, 0.077352679334485558, -0.076109876780524763, 0.0,
    0.74757835469466261, 0.39970920445885333, -0.16398784004285519,
    0.059586630047975528, 0.0, -0.026341800053436379, 0.028984307962212054,
    -0.019453248977701877, 0.0078609652501006478, 0.0, -0.0029618195399131889,
    0.00268257205568729, -0.0013708823152694639, 0.00037894068534068619, 0.0,
    -2.7394100013652473E-5, -9.8313238270332086E-5, 0.000486827925108784,
    -0.0011378244855056148, 0.001415513014019786, 0.0, -0.0043758948985123938,
    0.011375305454062892, -0.017543845054337627, 0.01624272325576193, 0.0,
    -0.035239058026866117, 0.086157558252096214, -0.14115130237644263,
    0.18386872695653758, 0.8, 0.18386872695653758, -0.14115130237644263,
    0.086157558252096214, -0.035239058026866117, 0.0, 0.01624272325576193,
    -0.017543845054337627, 0.011375305454062892, -0.0043758948985123938, 0.0,
    0.001415513014019786, -0.0011378244855056148, 0.000486827925108784,
    -9.8313238270332086E-5, 0.0 };

  static int8_T iv12[5] = { 1, 2, 3, 4, 4 };

  init_simulink_io_address(moduleInstance);
  if (!moduleInstance->sysobj_not_empty) {
    obj = &moduleInstance->sysobj;
    moduleInstance->sysobj.filt1 = NULL;
    moduleInstance->sysobj.filt2 = NULL;
    obj->isInitialized = 0;
    obj->NumChannels = -1.0;
    moduleInstance->sysobj_not_empty = true;
  }

  obj = &moduleInstance->sysobj;
  iobj_0 = &moduleInstance->gobj_0;
  iobj_1 = &moduleInstance->gobj_2;
  if (moduleInstance->sysobj.isInitialized != 0) {
    for (i0 = 0; i0 < 51; i0++) {
      u[i0] = cv8[i0];
    }

    y = NULL;
    m2 = emlrtCreateCharArray(2, iv8);
    emlrtInitCharArrayR2013a(moduleInstance->emlrtRootTLSGlobal, 51, m2, &u[0]);
    emlrtAssign(&y, m2);
    for (i0 = 0; i0 < 5; i0++) {
      b_u[i0] = cv9[i0];
    }

    b_y = NULL;
    m2 = emlrtCreateCharArray(2, iv9);
    emlrtInitCharArrayR2013a(moduleInstance->emlrtRootTLSGlobal, 5, m2, &b_u[0]);
    emlrtAssign(&b_y, m2);
    error(moduleInstance, message(moduleInstance, y, b_y, &c_emlrtMCI),
          &c_emlrtMCI);
  }

  obj->isInitialized = 1;
  for (i0 = 0; i0 < 8; i0++) {
    obj->inputVarSize1[i0] = (uint32_T)iv10[i0];
  }

  if ((obj->NumChannels != -1.0) && (1.0 != obj->NumChannels)) {
    for (i0 = 0; i0 < 29; i0++) {
      c_u[i0] = cv10[i0];
    }

    c_y = NULL;
    m2 = emlrtCreateCharArray(2, iv11);
    emlrtInitCharArrayR2013a(moduleInstance->emlrtRootTLSGlobal, 29, m2, &c_u[0]);
    emlrtAssign(&c_y, m2);
    error(moduleInstance, b_message(moduleInstance, c_y, &d_emlrtMCI),
          &d_emlrtMCI);
  }

  if (!(obj->filt1 == NULL)) {
    emlrtErrorWithMessageIdR2012b(moduleInstance->emlrtRootTLSGlobal,
      &b_emlrtRTEI, "EMLRT:runTime:NontunableHandleProp", 0);
  }

  iobj_0->isInitialized = 0;

  /* System object Constructor function: dsp.FIRDecimator */
  iobj_0->cSFunObject.P0_IC = 0.0;
  for (i0 = 0; i0 < 65; i0++) {
    iobj_0->cSFunObject.P1_FILT[i0] = dv0[i0];
  }

  obj->filt1 = iobj_0;
  if (!(obj->filt2 == NULL)) {
    emlrtErrorWithMessageIdR2012b(moduleInstance->emlrtRootTLSGlobal, &emlrtRTEI,
      "EMLRT:runTime:NontunableHandleProp", 0);
  }

  iobj_1->isInitialized = 0;

  /* System object Constructor function: dsp.FIRRateConverter */
  for (i0 = 0; i0 < 120; i0++) {
    iobj_1->cSFunObject.P0_FILTER[i0] = dv1[i0];
  }

  for (i0 = 0; i0 < 4; i0++) {
    iobj_1->cSFunObject.P1_PolyphaseSelector[i0] = i0;
  }

  for (i0 = 0; i0 < 5; i0++) {
    iobj_1->cSFunObject.P2_StartIdx[i0] = i0;
  }

  for (i0 = 0; i0 < 5; i0++) {
    iobj_1->cSFunObject.P3_StopIdx[i0] = iv12[i0];
  }

  obj->filt2 = iobj_1;
  obj->NumChannels = 1.0;
}
static void cgxe_mdl_initialize(InstanceStruct_UXvEHHrxIcmXaLthmwvduD
  *moduleInstance)
{
  dsp_SampleRateConverter_2 *obj;
  int32_T i1;
  static char_T cv11[45] = { 'M', 'A', 'T', 'L', 'A', 'B', ':', 's', 'y', 's',
    't', 'e', 'm', ':', 'm', 'e', 't', 'h', 'o', 'd', 'C', 'a', 'l', 'l', 'e',
    'd', 'W', 'h', 'e', 'n', 'R', 'e', 'l', 'e', 'a', 's', 'e', 'd', 'C', 'o',
    'd', 'e', 'g', 'e', 'n' };

  char_T u[45];
  const mxArray *y;
  static const int32_T iv13[2] = { 1, 45 };

  const mxArray *m3;
  static char_T cv12[8] = { 'i', 's', 'L', 'o', 'c', 'k', 'e', 'd' };

  char_T b_u[8];
  const mxArray *b_y;
  static const int32_T iv14[2] = { 1, 8 };

  boolean_T flag;
  char_T c_u[45];
  const mxArray *c_y;
  static const int32_T iv15[2] = { 1, 45 };

  static char_T cv13[5] = { 'r', 'e', 's', 'e', 't' };

  char_T d_u[5];
  const mxArray *d_y;
  static const int32_T iv16[2] = { 1, 5 };

  dspcodegen_FIRDecimator *b_obj;
  char_T e_u[45];
  const mxArray *e_y;
  static const int32_T iv17[2] = { 1, 45 };

  char_T f_u[5];
  const mxArray *f_y;
  static const int32_T iv18[2] = { 1, 5 };

  dspcodegen_FIRRateConverter *c_obj;
  char_T g_u[45];
  const mxArray *g_y;
  static const int32_T iv19[2] = { 1, 45 };

  char_T h_u[5];
  const mxArray *h_y;
  static const int32_T iv20[2] = { 1, 5 };

  if (!moduleInstance->sysobj_not_empty) {
    obj = &moduleInstance->sysobj;
    moduleInstance->sysobj.filt1 = NULL;
    moduleInstance->sysobj.filt2 = NULL;
    obj->isInitialized = 0;
    obj->NumChannels = -1.0;
    moduleInstance->sysobj_not_empty = true;
  }

  obj = &moduleInstance->sysobj;
  if (moduleInstance->sysobj.isInitialized == 2) {
    for (i1 = 0; i1 < 45; i1++) {
      u[i1] = cv11[i1];
    }

    y = NULL;
    m3 = emlrtCreateCharArray(2, iv13);
    emlrtInitCharArrayR2013a(moduleInstance->emlrtRootTLSGlobal, 45, m3, &u[0]);
    emlrtAssign(&y, m3);
    for (i1 = 0; i1 < 8; i1++) {
      b_u[i1] = cv12[i1];
    }

    b_y = NULL;
    m3 = emlrtCreateCharArray(2, iv14);
    emlrtInitCharArrayR2013a(moduleInstance->emlrtRootTLSGlobal, 8, m3, &b_u[0]);
    emlrtAssign(&b_y, m3);
    error(moduleInstance, message(moduleInstance, y, b_y, &c_emlrtMCI),
          &c_emlrtMCI);
  }

  flag = (obj->isInitialized == 1);
  if (flag) {
    obj = &moduleInstance->sysobj;
    if (moduleInstance->sysobj.isInitialized == 2) {
      for (i1 = 0; i1 < 45; i1++) {
        c_u[i1] = cv11[i1];
      }

      c_y = NULL;
      m3 = emlrtCreateCharArray(2, iv15);
      emlrtInitCharArrayR2013a(moduleInstance->emlrtRootTLSGlobal, 45, m3, &c_u
        [0]);
      emlrtAssign(&c_y, m3);
      for (i1 = 0; i1 < 5; i1++) {
        d_u[i1] = cv13[i1];
      }

      d_y = NULL;
      m3 = emlrtCreateCharArray(2, iv16);
      emlrtInitCharArrayR2013a(moduleInstance->emlrtRootTLSGlobal, 5, m3, &d_u[0]);
      emlrtAssign(&d_y, m3);
      error(moduleInstance, message(moduleInstance, c_y, d_y, &c_emlrtMCI),
            &c_emlrtMCI);
    }

    if (obj->isInitialized == 1) {
      b_obj = obj->filt1;
      if (b_obj->isInitialized == 2) {
        for (i1 = 0; i1 < 45; i1++) {
          e_u[i1] = cv11[i1];
        }

        e_y = NULL;
        m3 = emlrtCreateCharArray(2, iv17);
        emlrtInitCharArrayR2013a(moduleInstance->emlrtRootTLSGlobal, 45, m3,
          &e_u[0]);
        emlrtAssign(&e_y, m3);
        for (i1 = 0; i1 < 5; i1++) {
          f_u[i1] = cv13[i1];
        }

        f_y = NULL;
        m3 = emlrtCreateCharArray(2, iv18);
        emlrtInitCharArrayR2013a(moduleInstance->emlrtRootTLSGlobal, 5, m3,
          &f_u[0]);
        emlrtAssign(&f_y, m3);
        error(moduleInstance, message(moduleInstance, e_y, f_y, &c_emlrtMCI),
              &c_emlrtMCI);
      }

      if (b_obj->isInitialized == 1) {
        /* System object Initialization function: dsp.FIRDecimator */
        b_obj->cSFunObject.W2_CoeffIdx = 52;
        b_obj->cSFunObject.W0_PhaseIdx = 4;
        b_obj->cSFunObject.W4_TapDelayIndex = 48;
        b_obj->cSFunObject.W1_Sums = 0.0;
        for (i1 = 0; i1 < 60; i1++) {
          b_obj->cSFunObject.W3_StatesBuff[i1] = 0.0;
        }
      }

      c_obj = obj->filt2;
      if (c_obj->isInitialized == 2) {
        for (i1 = 0; i1 < 45; i1++) {
          g_u[i1] = cv11[i1];
        }

        g_y = NULL;
        m3 = emlrtCreateCharArray(2, iv19);
        emlrtInitCharArrayR2013a(moduleInstance->emlrtRootTLSGlobal, 45, m3,
          &g_u[0]);
        emlrtAssign(&g_y, m3);
        for (i1 = 0; i1 < 5; i1++) {
          h_u[i1] = cv13[i1];
        }

        h_y = NULL;
        m3 = emlrtCreateCharArray(2, iv20);
        emlrtInitCharArrayR2013a(moduleInstance->emlrtRootTLSGlobal, 5, m3,
          &h_u[0]);
        emlrtAssign(&h_y, m3);
        error(moduleInstance, message(moduleInstance, g_y, h_y, &c_emlrtMCI),
              &c_emlrtMCI);
      }

      if (c_obj->isInitialized == 1) {
        /* System object Initialization function: dsp.FIRRateConverter */
        c_obj->cSFunObject.W1_InBufIdx = 0;
        for (i1 = 0; i1 < 30; i1++) {
          c_obj->cSFunObject.W0_InBuf[i1] = 0.0;
        }
      }
    }
  }
}
Esempio n. 28
0
/* Function Definitions */
void mpower(const emlrtStack *sp, const emxArray_real_T *a, emxArray_real_T *c)
{
  boolean_T b0;
  const mxArray *y;
  static const int32_T iv11[2] = { 1, 19 };

  const mxArray *m3;
  char_T cv11[19];
  int32_T i;
  static const char_T cv12[19] = { 'C', 'o', 'd', 'e', 'r', ':', 'M', 'A', 'T',
    'L', 'A', 'B', ':', 's', 'q', 'u', 'a', 'r', 'e' };

  const mxArray *b_y;
  static const int32_T iv12[2] = { 1, 45 };

  char_T cv13[45];
  static const char_T cv14[45] = { 'C', 'o', 'd', 'e', 'r', ':', 't', 'o', 'o',
    'l', 'b', 'o', 'x', ':', 'm', 't', 'i', 'm', 'e', 's', '_', 'n', 'o', 'D',
    'y', 'n', 'a', 'm', 'i', 'c', 'S', 'c', 'a', 'l', 'a', 'r', 'E', 'x', 'p',
    'a', 'n', 's', 'i', 'o', 'n' };

  const mxArray *c_y;
  static const int32_T iv13[2] = { 1, 21 };

  char_T cv15[21];
  static const char_T cv16[21] = { 'C', 'o', 'd', 'e', 'r', ':', 'M', 'A', 'T',
    'L', 'A', 'B', ':', 'i', 'n', 'n', 'e', 'r', 'd', 'i', 'm' };

  real_T b_a;
  int32_T loop_ub;
  emlrtStack st;
  emlrtStack b_st;
  emlrtStack c_st;
  emlrtStack d_st;
  emlrtStack e_st;
  emlrtStack f_st;
  st.prev = sp;
  st.tls = sp->tls;
  b_st.prev = sp;
  b_st.tls = sp->tls;
  c_st.prev = &st;
  c_st.tls = st.tls;
  d_st.prev = &c_st;
  d_st.tls = c_st.tls;
  e_st.prev = &d_st;
  e_st.tls = d_st.tls;
  f_st.prev = &d_st;
  f_st.tls = d_st.tls;
  b0 = (1 == a->size[1]);
  if (b0) {
  } else {
    y = NULL;
    m3 = emlrtCreateCharArray(2, iv11);
    for (i = 0; i < 19; i++) {
      cv11[i] = cv12[i];
    }

    emlrtInitCharArrayR2013a(sp, 19, m3, cv11);
    emlrtAssign(&y, m3);
    st.site = &ig_emlrtRSI;
    b_st.site = &qg_emlrtRSI;
    error(&st, message(&b_st, y, &d_emlrtMCI), &e_emlrtMCI);
  }

  st.site = &eb_emlrtRSI;
  c_st.site = &fb_emlrtRSI;
  d_st.site = &gb_emlrtRSI;
  if (!(a->size[1] == 1)) {
    if (a->size[1] == 1) {
      b_y = NULL;
      m3 = emlrtCreateCharArray(2, iv12);
      for (i = 0; i < 45; i++) {
        cv13[i] = cv14[i];
      }

      emlrtInitCharArrayR2013a(&d_st, 45, m3, cv13);
      emlrtAssign(&b_y, m3);
      e_st.site = &cg_emlrtRSI;
      f_st.site = &lg_emlrtRSI;
      error(&e_st, message(&f_st, b_y, &f_emlrtMCI), &g_emlrtMCI);
    } else {
      c_y = NULL;
      m3 = emlrtCreateCharArray(2, iv13);
      for (i = 0; i < 21; i++) {
        cv15[i] = cv16[i];
      }

      emlrtInitCharArrayR2013a(&d_st, 21, m3, cv15);
      emlrtAssign(&c_y, m3);
      e_st.site = &dg_emlrtRSI;
      f_st.site = &mg_emlrtRSI;
      error(&e_st, message(&f_st, c_y, &h_emlrtMCI), &i_emlrtMCI);
    }
  }

  i = c->size[0] * c->size[1];
  c->size[0] = 1;
  c->size[1] = a->size[1];
  emxEnsureCapacity(&c_st, (emxArray__common *)c, i, (int32_T)sizeof(real_T),
                    &j_emlrtRTEI);
  b_a = a->data[0];
  loop_ub = a->size[0] * a->size[1];
  for (i = 0; i < loop_ub; i++) {
    c->data[i] = b_a * a->data[i];
  }
}
Esempio n. 29
0
void b_Acoeff(const emlrtStack *sp, real_T ksi, real_T j, const emxArray_real_T *
              x, real_T t, const emxArray_real_T *gridT, emxArray_real_T *vals)
{
  emxArray_real_T *b;
  emxArray_real_T *r8;
  int32_T b_x;
  int32_T i;
  emxArray_boolean_T *b_t;
  real_T c_x;
  emxArray_boolean_T *c_t;
  emxArray_real_T *z0;
  emxArray_real_T *d_x;
  emxArray_real_T *e_x;
  emxArray_real_T *r9;
  int32_T b_b[2];
  int32_T f_x[2];
  emxArray_real_T *g_x;
  emxArray_real_T *r10;
  const mxArray *y;
  static const int32_T iv16[2] = { 1, 45 };

  const mxArray *m6;
  char_T cv18[45];
  static const char_T cv19[45] = { 'C', 'o', 'd', 'e', 'r', ':', 't', 'o', 'o',
    'l', 'b', 'o', 'x', ':', 'm', 't', 'i', 'm', 'e', 's', '_', 'n', 'o', 'D',
    'y', 'n', 'a', 'm', 'i', 'c', 'S', 'c', 'a', 'l', 'a', 'r', 'E', 'x', 'p',
    'a', 'n', 's', 'i', 'o', 'n' };

  const mxArray *b_y;
  static const int32_T iv17[2] = { 1, 21 };

  char_T cv20[21];
  static const char_T cv21[21] = { 'C', 'o', 'd', 'e', 'r', ':', 'M', 'A', 'T',
    'L', 'A', 'B', ':', 'i', 'n', 'n', 'e', 'r', 'd', 'i', 'm' };

  emxArray_boolean_T *d_t;
  real_T h_x;
  emxArray_boolean_T *e_t;
  emxArray_real_T *i_x;
  emxArray_real_T *r11;
  emxArray_real_T *j_x;
  emxArray_real_T *r12;
  emxArray_real_T *z1;
  int32_T b_z0[2];
  emxArray_real_T *c_z0;
  emxArray_real_T *k_x;
  const mxArray *c_y;
  static const int32_T iv18[2] = { 1, 45 };

  const mxArray *d_y;
  static const int32_T iv19[2] = { 1, 21 };

  emlrtStack st;
  emlrtStack b_st;
  emlrtStack c_st;
  emlrtStack d_st;
  st.prev = sp;
  st.tls = sp->tls;
  b_st.prev = &st;
  b_st.tls = st.tls;
  c_st.prev = &b_st;
  c_st.tls = b_st.tls;
  d_st.prev = &b_st;
  d_st.tls = b_st.tls;
  emlrtHeapReferenceStackEnterFcnR2012b(sp);
  emxInit_real_T(sp, &b, 2, &bb_emlrtRTEI, true);
  emxInit_real_T(sp, &r8, 2, &bb_emlrtRTEI, true);

  /*  evaluate the coefficient A at the  boundary ksi=0 or ksi=1; */
  /*  for the index j which describes the time steps timePoints_j, at time t and space */
  /*  point x */
  /*  timePoints is a vector describing the time descritized domain */
  b_x = gridT->size[1];
  i = (int32_T)emlrtIntegerCheckFastR2012b(j, &emlrtDCI, sp);
  if (t <= gridT->data[emlrtDynamicBoundsCheckFastR2012b(i, 1, b_x, &d_emlrtBCI,
       sp) - 1]) {
    b_x = vals->size[0] * vals->size[1];
    vals->size[0] = 1;
    vals->size[1] = 1;
    emxEnsureCapacity(sp, (emxArray__common *)vals, b_x, (int32_T)sizeof(real_T),
                      &bb_emlrtRTEI);
    vals->data[0] = 0.0;
  } else {
    emxInit_boolean_T(sp, &b_t, 2, &bb_emlrtRTEI, true);
    b_x = b_t->size[0] * b_t->size[1];
    b_t->size[0] = 1;
    b_t->size[1] = 2 + x->size[1];
    emxEnsureCapacity(sp, (emxArray__common *)b_t, b_x, (int32_T)sizeof
                      (boolean_T), &bb_emlrtRTEI);
    b_x = gridT->size[1];
    i = (int32_T)j;
    b_t->data[0] = (t > gridT->data[emlrtDynamicBoundsCheckFastR2012b(i, 1, b_x,
      &e_emlrtBCI, sp) - 1]);
    b_x = gridT->size[1];
    i = (int32_T)((uint32_T)j + 1U);
    b_t->data[b_t->size[0]] = (t <= gridT->
      data[emlrtDynamicBoundsCheckFastR2012b(i, 1, b_x, &f_emlrtBCI, sp) - 1]);
    i = x->size[1];
    for (b_x = 0; b_x < i; b_x++) {
      b_t->data[b_t->size[0] * (b_x + 2)] = (x->data[x->size[0] * b_x] == ksi);
    }

    st.site = &pe_emlrtRSI;
    if (all(&st, b_t)) {
      b_x = gridT->size[1];
      i = (int32_T)j;
      emlrtDynamicBoundsCheckFastR2012b(i, 1, b_x, &c_emlrtBCI, sp);
      c_x = (t - gridT->data[(int32_T)j - 1]) / 3.1415926535897931;
      st.site = &emlrtRSI;
      if (c_x < 0.0) {
        b_st.site = &f_emlrtRSI;
        eml_error(&b_st);
      }

      b_x = vals->size[0] * vals->size[1];
      vals->size[0] = 1;
      vals->size[1] = 1;
      emxEnsureCapacity(sp, (emxArray__common *)vals, b_x, (int32_T)sizeof
                        (real_T), &bb_emlrtRTEI);
      vals->data[0] = muDoubleScalarSqrt(c_x);
    } else {
      emxInit_boolean_T(sp, &c_t, 2, &bb_emlrtRTEI, true);
      b_x = c_t->size[0] * c_t->size[1];
      c_t->size[0] = 1;
      c_t->size[1] = 2 + x->size[1];
      emxEnsureCapacity(sp, (emxArray__common *)c_t, b_x, (int32_T)sizeof
                        (boolean_T), &bb_emlrtRTEI);
      b_x = gridT->size[1];
      i = (int32_T)j;
      c_t->data[0] = (t > gridT->data[emlrtDynamicBoundsCheckFastR2012b(i, 1,
        b_x, &g_emlrtBCI, sp) - 1]);
      b_x = gridT->size[1];
      i = (int32_T)((uint32_T)j + 1U);
      c_t->data[c_t->size[0]] = (t <= gridT->
        data[emlrtDynamicBoundsCheckFastR2012b(i, 1, b_x, &h_emlrtBCI, sp) - 1]);
      i = x->size[1];
      for (b_x = 0; b_x < i; b_x++) {
        c_t->data[c_t->size[0] * (b_x + 2)] = (x->data[x->size[0] * b_x] != ksi);
      }

      emxInit_real_T(sp, &z0, 2, &cb_emlrtRTEI, true);
      emxInit_real_T(sp, &d_x, 2, &bb_emlrtRTEI, true);
      st.site = &qe_emlrtRSI;
      if (all(&st, c_t)) {
        st.site = &b_emlrtRSI;
        b_x = gridT->size[1];
        i = (int32_T)j;
        c_x = t - gridT->data[emlrtDynamicBoundsCheckFastR2012b(i, 1, b_x,
          &m_emlrtBCI, &st) - 1];
        if (c_x < 0.0) {
          b_st.site = &f_emlrtRSI;
          eml_error(&b_st);
        }

        emxInit_real_T(&st, &e_x, 2, &bb_emlrtRTEI, true);
        b_x = e_x->size[0] * e_x->size[1];
        e_x->size[0] = 1;
        e_x->size[1] = x->size[1];
        emxEnsureCapacity(sp, (emxArray__common *)e_x, b_x, (int32_T)sizeof
                          (real_T), &bb_emlrtRTEI);
        i = x->size[0] * x->size[1];
        for (b_x = 0; b_x < i; b_x++) {
          e_x->data[b_x] = x->data[b_x] - ksi;
        }

        emxInit_real_T(sp, &r9, 2, &bb_emlrtRTEI, true);
        b_abs(sp, e_x, r9);
        b_x = r8->size[0] * r8->size[1];
        r8->size[0] = 1;
        r8->size[1] = r9->size[1];
        emxEnsureCapacity(sp, (emxArray__common *)r8, b_x, (int32_T)sizeof
                          (real_T), &bb_emlrtRTEI);
        i = r9->size[0] * r9->size[1];
        emxFree_real_T(&e_x);
        for (b_x = 0; b_x < i; b_x++) {
          r8->data[b_x] = r9->data[b_x];
        }

        emxFree_real_T(&r9);
        rdivide(sp, r8, 2.0 * muDoubleScalarSqrt(c_x), z0);
        st.site = &re_emlrtRSI;
        mpower(&st, z0, d_x);
        b_x = d_x->size[0] * d_x->size[1];
        d_x->size[0] = 1;
        emxEnsureCapacity(sp, (emxArray__common *)d_x, b_x, (int32_T)sizeof
                          (real_T), &bb_emlrtRTEI);
        i = d_x->size[0];
        b_x = d_x->size[1];
        i *= b_x;
        for (b_x = 0; b_x < i; b_x++) {
          d_x->data[b_x] = -d_x->data[b_x];
        }

        b_x = b->size[0] * b->size[1];
        b->size[0] = 1;
        b->size[1] = d_x->size[1];
        emxEnsureCapacity(sp, (emxArray__common *)b, b_x, (int32_T)sizeof(real_T),
                          &bb_emlrtRTEI);
        i = d_x->size[0] * d_x->size[1];
        for (b_x = 0; b_x < i; b_x++) {
          b->data[b_x] = d_x->data[b_x];
        }

        for (i = 0; i < d_x->size[1]; i++) {
          b->data[i] = muDoubleScalarExp(b->data[i]);
        }

        st.site = &re_emlrtRSI;
        b_mrdivide(&st, b, z0);
        for (b_x = 0; b_x < 2; b_x++) {
          i = d_x->size[0] * d_x->size[1];
          d_x->size[b_x] = z0->size[b_x];
          emxEnsureCapacity(sp, (emxArray__common *)d_x, i, (int32_T)sizeof
                            (real_T), &ab_emlrtRTEI);
        }

        for (i = 0; i < z0->size[1]; i++) {
          d_x->data[i] = scalar_erf(z0->data[i]);
        }

        b_x = d_x->size[0] * d_x->size[1];
        d_x->size[0] = 1;
        emxEnsureCapacity(sp, (emxArray__common *)d_x, b_x, (int32_T)sizeof
                          (real_T), &bb_emlrtRTEI);
        i = d_x->size[0];
        b_x = d_x->size[1];
        i *= b_x;
        for (b_x = 0; b_x < i; b_x++) {
          d_x->data[b_x] *= 1.7724538509055159;
        }

        for (b_x = 0; b_x < 2; b_x++) {
          b_b[b_x] = b->size[b_x];
        }

        for (b_x = 0; b_x < 2; b_x++) {
          f_x[b_x] = d_x->size[b_x];
        }

        emxInit_real_T(sp, &g_x, 2, &bb_emlrtRTEI, true);
        emlrtSizeEqCheck2DFastR2012b(b_b, f_x, &o_emlrtECI, sp);
        b_x = g_x->size[0] * g_x->size[1];
        g_x->size[0] = 1;
        g_x->size[1] = x->size[1];
        emxEnsureCapacity(sp, (emxArray__common *)g_x, b_x, (int32_T)sizeof
                          (real_T), &bb_emlrtRTEI);
        i = x->size[0] * x->size[1];
        for (b_x = 0; b_x < i; b_x++) {
          g_x->data[b_x] = x->data[b_x] - ksi;
        }

        emxInit_real_T(sp, &r10, 2, &bb_emlrtRTEI, true);
        b_abs(sp, g_x, r10);
        b_x = r8->size[0] * r8->size[1];
        r8->size[0] = 1;
        r8->size[1] = r10->size[1];
        emxEnsureCapacity(sp, (emxArray__common *)r8, b_x, (int32_T)sizeof
                          (real_T), &bb_emlrtRTEI);
        i = r10->size[0] * r10->size[1];
        emxFree_real_T(&g_x);
        for (b_x = 0; b_x < i; b_x++) {
          r8->data[b_x] = r10->data[b_x];
        }

        emxFree_real_T(&r10);
        rdivide(sp, r8, 3.5449077018110318, vals);
        st.site = &re_emlrtRSI;
        b_x = b->size[0] * b->size[1];
        b->size[0] = 1;
        emxEnsureCapacity(&st, (emxArray__common *)b, b_x, (int32_T)sizeof
                          (real_T), &bb_emlrtRTEI);
        i = b->size[0];
        b_x = b->size[1];
        i *= b_x;
        for (b_x = 0; b_x < i; b_x++) {
          b->data[b_x] -= d_x->data[b_x];
        }

        b_st.site = &he_emlrtRSI;
        if (!(vals->size[1] == 1)) {
          if ((vals->size[1] == 1) || (b->size[1] == 1)) {
            y = NULL;
            m6 = emlrtCreateCharArray(2, iv16);
            for (i = 0; i < 45; i++) {
              cv18[i] = cv19[i];
            }

            emlrtInitCharArrayR2013a(&b_st, 45, m6, cv18);
            emlrtAssign(&y, m6);
            c_st.site = &fh_emlrtRSI;
            d_st.site = &vg_emlrtRSI;
            b_error(&c_st, message(&d_st, y, &j_emlrtMCI), &k_emlrtMCI);
          } else {
            b_y = NULL;
            m6 = emlrtCreateCharArray(2, iv17);
            for (i = 0; i < 21; i++) {
              cv20[i] = cv21[i];
            }

            emlrtInitCharArrayR2013a(&b_st, 21, m6, cv20);
            emlrtAssign(&b_y, m6);
            c_st.site = &gh_emlrtRSI;
            d_st.site = &wg_emlrtRSI;
            b_error(&c_st, message(&d_st, b_y, &l_emlrtMCI), &m_emlrtMCI);
          }
        }

        c_x = vals->data[0];
        b_x = vals->size[0] * vals->size[1];
        vals->size[0] = 1;
        vals->size[1] = b->size[1];
        emxEnsureCapacity(&st, (emxArray__common *)vals, b_x, (int32_T)sizeof
                          (real_T), &bb_emlrtRTEI);
        i = b->size[1];
        for (b_x = 0; b_x < i; b_x++) {
          vals->data[vals->size[0] * b_x] = c_x * b->data[b->size[0] * b_x];
        }
      } else {
        emxInit_boolean_T(sp, &d_t, 2, &bb_emlrtRTEI, true);
        b_x = d_t->size[0] * d_t->size[1];
        d_t->size[0] = 1;
        d_t->size[1] = 1 + x->size[1];
        emxEnsureCapacity(sp, (emxArray__common *)d_t, b_x, (int32_T)sizeof
                          (boolean_T), &bb_emlrtRTEI);
        b_x = gridT->size[1];
        i = (int32_T)((uint32_T)j + 1U);
        d_t->data[0] = (t > gridT->data[emlrtDynamicBoundsCheckFastR2012b(i, 1,
          b_x, &i_emlrtBCI, sp) - 1]);
        i = x->size[1];
        for (b_x = 0; b_x < i; b_x++) {
          d_t->data[d_t->size[0] * (b_x + 1)] = (x->data[x->size[0] * b_x] ==
            ksi);
        }

        st.site = &se_emlrtRSI;
        if (all(&st, d_t)) {
          b_x = gridT->size[1];
          i = (int32_T)j;
          emlrtDynamicBoundsCheckFastR2012b(i, 1, b_x, &b_emlrtBCI, sp);
          c_x = (t - gridT->data[(int32_T)j - 1]) / 3.1415926535897931;
          b_x = gridT->size[1];
          i = (int32_T)(j + 1.0);
          emlrtDynamicBoundsCheckFastR2012b(i, 1, b_x, &emlrtBCI, sp);
          h_x = (t - gridT->data[(int32_T)(j + 1.0) - 1]) / 3.1415926535897931;
          st.site = &c_emlrtRSI;
          if (c_x < 0.0) {
            b_st.site = &f_emlrtRSI;
            eml_error(&b_st);
          }

          st.site = &c_emlrtRSI;
          if (h_x < 0.0) {
            b_st.site = &f_emlrtRSI;
            eml_error(&b_st);
          }

          b_x = vals->size[0] * vals->size[1];
          vals->size[0] = 1;
          vals->size[1] = 1;
          emxEnsureCapacity(sp, (emxArray__common *)vals, b_x, (int32_T)sizeof
                            (real_T), &bb_emlrtRTEI);
          vals->data[0] = muDoubleScalarSqrt(c_x) - muDoubleScalarSqrt(h_x);
        } else {
          emxInit_boolean_T(sp, &e_t, 2, &bb_emlrtRTEI, true);
          b_x = e_t->size[0] * e_t->size[1];
          e_t->size[0] = 1;
          e_t->size[1] = 1 + x->size[1];
          emxEnsureCapacity(sp, (emxArray__common *)e_t, b_x, (int32_T)sizeof
                            (boolean_T), &bb_emlrtRTEI);
          b_x = gridT->size[1];
          i = (int32_T)((uint32_T)j + 1U);
          e_t->data[0] = (t > gridT->data[emlrtDynamicBoundsCheckFastR2012b(i, 1,
            b_x, &j_emlrtBCI, sp) - 1]);
          i = x->size[1];
          for (b_x = 0; b_x < i; b_x++) {
            e_t->data[e_t->size[0] * (b_x + 1)] = (x->data[x->size[0] * b_x] !=
              ksi);
          }

          st.site = &te_emlrtRSI;
          if (all(&st, e_t)) {
            st.site = &d_emlrtRSI;
            b_x = gridT->size[1];
            i = (int32_T)j;
            c_x = t - gridT->data[emlrtDynamicBoundsCheckFastR2012b(i, 1, b_x,
              &k_emlrtBCI, &st) - 1];
            if (c_x < 0.0) {
              b_st.site = &f_emlrtRSI;
              eml_error(&b_st);
            }

            emxInit_real_T(&st, &i_x, 2, &bb_emlrtRTEI, true);
            b_x = i_x->size[0] * i_x->size[1];
            i_x->size[0] = 1;
            i_x->size[1] = x->size[1];
            emxEnsureCapacity(sp, (emxArray__common *)i_x, b_x, (int32_T)sizeof
                              (real_T), &bb_emlrtRTEI);
            i = x->size[0] * x->size[1];
            for (b_x = 0; b_x < i; b_x++) {
              i_x->data[b_x] = x->data[b_x] - ksi;
            }

            emxInit_real_T(sp, &r11, 2, &bb_emlrtRTEI, true);
            b_abs(sp, i_x, r11);
            b_x = r8->size[0] * r8->size[1];
            r8->size[0] = 1;
            r8->size[1] = r11->size[1];
            emxEnsureCapacity(sp, (emxArray__common *)r8, b_x, (int32_T)sizeof
                              (real_T), &bb_emlrtRTEI);
            i = r11->size[0] * r11->size[1];
            emxFree_real_T(&i_x);
            for (b_x = 0; b_x < i; b_x++) {
              r8->data[b_x] = r11->data[b_x];
            }

            emxFree_real_T(&r11);
            rdivide(sp, r8, 2.0 * muDoubleScalarSqrt(c_x), z0);
            st.site = &e_emlrtRSI;
            b_x = gridT->size[1];
            i = (int32_T)((uint32_T)j + 1U);
            c_x = t - gridT->data[emlrtDynamicBoundsCheckFastR2012b(i, 1, b_x,
              &l_emlrtBCI, &st) - 1];
            if (c_x < 0.0) {
              b_st.site = &f_emlrtRSI;
              eml_error(&b_st);
            }

            emxInit_real_T(&st, &j_x, 2, &bb_emlrtRTEI, true);
            b_x = j_x->size[0] * j_x->size[1];
            j_x->size[0] = 1;
            j_x->size[1] = x->size[1];
            emxEnsureCapacity(sp, (emxArray__common *)j_x, b_x, (int32_T)sizeof
                              (real_T), &bb_emlrtRTEI);
            i = x->size[0] * x->size[1];
            for (b_x = 0; b_x < i; b_x++) {
              j_x->data[b_x] = x->data[b_x] - ksi;
            }

            emxInit_real_T(sp, &r12, 2, &bb_emlrtRTEI, true);
            b_abs(sp, j_x, r12);
            b_x = r8->size[0] * r8->size[1];
            r8->size[0] = 1;
            r8->size[1] = r12->size[1];
            emxEnsureCapacity(sp, (emxArray__common *)r8, b_x, (int32_T)sizeof
                              (real_T), &bb_emlrtRTEI);
            i = r12->size[0] * r12->size[1];
            emxFree_real_T(&j_x);
            for (b_x = 0; b_x < i; b_x++) {
              r8->data[b_x] = r12->data[b_x];
            }

            emxFree_real_T(&r12);
            emxInit_real_T(sp, &z1, 2, &db_emlrtRTEI, true);
            rdivide(sp, r8, 2.0 * muDoubleScalarSqrt(c_x), z1);
            st.site = &ue_emlrtRSI;
            mpower(&st, z0, d_x);
            b_x = d_x->size[0] * d_x->size[1];
            d_x->size[0] = 1;
            emxEnsureCapacity(sp, (emxArray__common *)d_x, b_x, (int32_T)sizeof
                              (real_T), &bb_emlrtRTEI);
            i = d_x->size[0];
            b_x = d_x->size[1];
            i *= b_x;
            for (b_x = 0; b_x < i; b_x++) {
              d_x->data[b_x] = -d_x->data[b_x];
            }

            b_x = b->size[0] * b->size[1];
            b->size[0] = 1;
            b->size[1] = d_x->size[1];
            emxEnsureCapacity(sp, (emxArray__common *)b, b_x, (int32_T)sizeof
                              (real_T), &bb_emlrtRTEI);
            i = d_x->size[0] * d_x->size[1];
            for (b_x = 0; b_x < i; b_x++) {
              b->data[b_x] = d_x->data[b_x];
            }

            for (i = 0; i < d_x->size[1]; i++) {
              b->data[i] = muDoubleScalarExp(b->data[i]);
            }

            st.site = &ue_emlrtRSI;
            b_mrdivide(&st, b, z0);
            st.site = &ue_emlrtRSI;
            mpower(&st, z1, d_x);
            b_x = d_x->size[0] * d_x->size[1];
            d_x->size[0] = 1;
            emxEnsureCapacity(sp, (emxArray__common *)d_x, b_x, (int32_T)sizeof
                              (real_T), &bb_emlrtRTEI);
            i = d_x->size[0];
            b_x = d_x->size[1];
            i *= b_x;
            for (b_x = 0; b_x < i; b_x++) {
              d_x->data[b_x] = -d_x->data[b_x];
            }

            b_x = r8->size[0] * r8->size[1];
            r8->size[0] = 1;
            r8->size[1] = d_x->size[1];
            emxEnsureCapacity(sp, (emxArray__common *)r8, b_x, (int32_T)sizeof
                              (real_T), &bb_emlrtRTEI);
            i = d_x->size[0] * d_x->size[1];
            for (b_x = 0; b_x < i; b_x++) {
              r8->data[b_x] = d_x->data[b_x];
            }

            for (i = 0; i < d_x->size[1]; i++) {
              r8->data[i] = muDoubleScalarExp(r8->data[i]);
            }

            st.site = &ue_emlrtRSI;
            b_mrdivide(&st, r8, z1);
            for (b_x = 0; b_x < 2; b_x++) {
              b_b[b_x] = b->size[b_x];
            }

            for (b_x = 0; b_x < 2; b_x++) {
              b_z0[b_x] = r8->size[b_x];
            }

            emxInit_real_T(sp, &c_z0, 2, &bb_emlrtRTEI, true);
            emlrtSizeEqCheck2DFastR2012b(b_b, b_z0, &m_emlrtECI, sp);
            b_x = c_z0->size[0] * c_z0->size[1];
            c_z0->size[0] = 1;
            c_z0->size[1] = z0->size[1];
            emxEnsureCapacity(sp, (emxArray__common *)c_z0, b_x, (int32_T)sizeof
                              (real_T), &bb_emlrtRTEI);
            i = z0->size[0] * z0->size[1];
            for (b_x = 0; b_x < i; b_x++) {
              c_z0->data[b_x] = z0->data[b_x];
            }

            b_erf(sp, c_z0, z0);
            b_erf(sp, z1, d_x);
            emxFree_real_T(&c_z0);
            emxFree_real_T(&z1);
            for (b_x = 0; b_x < 2; b_x++) {
              b_z0[b_x] = z0->size[b_x];
            }

            for (b_x = 0; b_x < 2; b_x++) {
              f_x[b_x] = d_x->size[b_x];
            }

            emlrtSizeEqCheck2DFastR2012b(b_z0, f_x, &n_emlrtECI, sp);
            b_x = z0->size[0] * z0->size[1];
            z0->size[0] = 1;
            emxEnsureCapacity(sp, (emxArray__common *)z0, b_x, (int32_T)sizeof
                              (real_T), &bb_emlrtRTEI);
            i = z0->size[0];
            b_x = z0->size[1];
            i *= b_x;
            for (b_x = 0; b_x < i; b_x++) {
              z0->data[b_x] = 1.7724538509055159 * (z0->data[b_x] - d_x->
                data[b_x]);
            }

            for (b_x = 0; b_x < 2; b_x++) {
              b_b[b_x] = b->size[b_x];
            }

            for (b_x = 0; b_x < 2; b_x++) {
              b_z0[b_x] = z0->size[b_x];
            }

            emxInit_real_T(sp, &k_x, 2, &bb_emlrtRTEI, true);
            emlrtSizeEqCheck2DFastR2012b(b_b, b_z0, &m_emlrtECI, sp);
            b_x = k_x->size[0] * k_x->size[1];
            k_x->size[0] = 1;
            k_x->size[1] = x->size[1];
            emxEnsureCapacity(sp, (emxArray__common *)k_x, b_x, (int32_T)sizeof
                              (real_T), &bb_emlrtRTEI);
            i = x->size[0] * x->size[1];
            for (b_x = 0; b_x < i; b_x++) {
              k_x->data[b_x] = x->data[b_x] - ksi;
            }

            b_abs(sp, k_x, d_x);
            rdivide(sp, d_x, 3.5449077018110318, vals);
            st.site = &ue_emlrtRSI;
            b_x = b->size[0] * b->size[1];
            b->size[0] = 1;
            emxEnsureCapacity(&st, (emxArray__common *)b, b_x, (int32_T)sizeof
                              (real_T), &bb_emlrtRTEI);
            i = b->size[0];
            b_x = b->size[1];
            i *= b_x;
            emxFree_real_T(&k_x);
            for (b_x = 0; b_x < i; b_x++) {
              b->data[b_x] = (b->data[b_x] - r8->data[b_x]) + z0->data[b_x];
            }

            b_st.site = &he_emlrtRSI;
            if (!(vals->size[1] == 1)) {
              if ((vals->size[1] == 1) || (b->size[1] == 1)) {
                c_y = NULL;
                m6 = emlrtCreateCharArray(2, iv18);
                for (i = 0; i < 45; i++) {
                  cv18[i] = cv19[i];
                }

                emlrtInitCharArrayR2013a(&b_st, 45, m6, cv18);
                emlrtAssign(&c_y, m6);
                c_st.site = &fh_emlrtRSI;
                d_st.site = &vg_emlrtRSI;
                b_error(&c_st, message(&d_st, c_y, &j_emlrtMCI), &k_emlrtMCI);
              } else {
                d_y = NULL;
                m6 = emlrtCreateCharArray(2, iv19);
                for (i = 0; i < 21; i++) {
                  cv20[i] = cv21[i];
                }

                emlrtInitCharArrayR2013a(&b_st, 21, m6, cv20);
                emlrtAssign(&d_y, m6);
                c_st.site = &gh_emlrtRSI;
                d_st.site = &wg_emlrtRSI;
                b_error(&c_st, message(&d_st, d_y, &l_emlrtMCI), &m_emlrtMCI);
              }
            }

            c_x = vals->data[0];
            b_x = vals->size[0] * vals->size[1];
            vals->size[0] = 1;
            vals->size[1] = b->size[1];
            emxEnsureCapacity(&st, (emxArray__common *)vals, b_x, (int32_T)
                              sizeof(real_T), &bb_emlrtRTEI);
            i = b->size[1];
            for (b_x = 0; b_x < i; b_x++) {
              vals->data[vals->size[0] * b_x] = c_x * b->data[b->size[0] * b_x];
            }
          } else {
            b_x = vals->size[0] * vals->size[1];
            vals->size[0] = 1;
            vals->size[1] = 1;
            emxEnsureCapacity(sp, (emxArray__common *)vals, b_x, (int32_T)sizeof
                              (real_T), &bb_emlrtRTEI);
            vals->data[0] = 0.0;
          }

          emxFree_boolean_T(&e_t);
        }

        emxFree_boolean_T(&d_t);
      }

      emxFree_boolean_T(&c_t);
      emxFree_real_T(&d_x);
      emxFree_real_T(&z0);
    }

    emxFree_boolean_T(&b_t);
  }

  emxFree_real_T(&r8);
  emxFree_real_T(&b);
  emlrtHeapReferenceStackLeaveFcnR2012b(sp);
}