Esempio n. 1
0
/* Function Definitions */
real_T signalPower(const emxArray_creal_T *input)
{
  real_T out;
  emxArray_real_T *a;
  emxArray_real_T *b;
  int32_T i2;
  int32_T i;
  const mxArray *y;
  static const int32_T iv11[2] = { 1, 45 };

  const mxArray *m1;
  char_T cv17[45];
  static const char_T cv18[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 iv12[2] = { 1, 21 };

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

  real_T c_y;
  ptrdiff_t n_t;
  ptrdiff_t incx_t;
  ptrdiff_t incy_t;
  double * xix0_t;
  double * yiy0_t;
  emlrtHeapReferenceStackEnterFcnR2012b(emlrtRootTLSGlobal);
  b_emxInit_real_T(&a, 2, &f_emlrtRTEI, TRUE);
  emxInit_real_T(&b, 1, &f_emlrtRTEI, TRUE);

  /* out=input'*input/sentBitsSize; */
  /* out=abs(out); */
  emlrtPushRtStackR2012b(&l_emlrtRSI, emlrtRootTLSGlobal);
  b_abs(input, b);
  i2 = a->size[0] * a->size[1];
  a->size[0] = 1;
  emxEnsureCapacity((emxArray__common *)a, i2, (int32_T)sizeof(real_T),
                    &f_emlrtRTEI);
  i = b->size[0];
  i2 = a->size[0] * a->size[1];
  a->size[1] = i;
  emxEnsureCapacity((emxArray__common *)a, i2, (int32_T)sizeof(real_T),
                    &f_emlrtRTEI);
  i = b->size[0];
  for (i2 = 0; i2 < i; i2++) {
    a->data[i2] = b->data[i2];
  }

  b_abs(input, b);
  emlrtPushRtStackR2012b(&n_emlrtRSI, emlrtRootTLSGlobal);
  if (!(a->size[1] == b->size[0])) {
    if ((a->size[1] == 1) || (b->size[0] == 1)) {
      emlrtPushRtStackR2012b(&p_emlrtRSI, emlrtRootTLSGlobal);
      emlrt_synchGlobalsToML();
      y = NULL;
      m1 = mxCreateCharArray(2, iv11);
      for (i = 0; i < 45; i++) {
        cv17[i] = cv18[i];
      }

      emlrtInitCharArrayR2013a(emlrtRootTLSGlobal, 45, m1, cv17);
      emlrtAssign(&y, m1);
      error(message(y, &i_emlrtMCI), &j_emlrtMCI);
      emlrt_synchGlobalsFromML();
      emlrtPopRtStackR2012b(&p_emlrtRSI, emlrtRootTLSGlobal);
    } else {
      emlrtPushRtStackR2012b(&o_emlrtRSI, emlrtRootTLSGlobal);
      emlrt_synchGlobalsToML();
      b_y = NULL;
      m1 = mxCreateCharArray(2, iv12);
      for (i = 0; i < 21; i++) {
        cv19[i] = cv20[i];
      }

      emlrtInitCharArrayR2013a(emlrtRootTLSGlobal, 21, m1, cv19);
      emlrtAssign(&b_y, m1);
      error(message(b_y, &k_emlrtMCI), &l_emlrtMCI);
      emlrt_synchGlobalsFromML();
      emlrtPopRtStackR2012b(&o_emlrtRSI, emlrtRootTLSGlobal);
    }
  }

  emlrtPopRtStackR2012b(&n_emlrtRSI, emlrtRootTLSGlobal);
  if ((a->size[1] == 1) || (b->size[0] == 1)) {
    c_y = 0.0;
    for (i2 = 0; i2 < a->size[1]; i2++) {
      c_y += a->data[a->size[0] * i2] * b->data[i2];
    }
  } else {
    emlrtPushRtStackR2012b(&m_emlrtRSI, emlrtRootTLSGlobal);
    emlrtPushRtStackR2012b(&q_emlrtRSI, emlrtRootTLSGlobal);
    emlrtPushRtStackR2012b(&r_emlrtRSI, emlrtRootTLSGlobal);
    if (a->size[1] < 1) {
      c_y = 0.0;
    } else {
      emlrtPushRtStackR2012b(&t_emlrtRSI, emlrtRootTLSGlobal);
      emlrtPushRtStackR2012b(&y_emlrtRSI, emlrtRootTLSGlobal);
      emlrtPushRtStackR2012b(&eb_emlrtRSI, emlrtRootTLSGlobal);
      emlrt_checkEscapedGlobals();
      n_t = (ptrdiff_t)(a->size[1]);
      emlrtPopRtStackR2012b(&eb_emlrtRSI, emlrtRootTLSGlobal);
      emlrtPopRtStackR2012b(&y_emlrtRSI, emlrtRootTLSGlobal);
      emlrtPushRtStackR2012b(&ab_emlrtRSI, emlrtRootTLSGlobal);
      emlrtPushRtStackR2012b(&eb_emlrtRSI, emlrtRootTLSGlobal);
      emlrt_checkEscapedGlobals();
      incx_t = (ptrdiff_t)(1);
      emlrtPopRtStackR2012b(&eb_emlrtRSI, emlrtRootTLSGlobal);
      emlrtPopRtStackR2012b(&ab_emlrtRSI, emlrtRootTLSGlobal);
      emlrtPushRtStackR2012b(&bb_emlrtRSI, emlrtRootTLSGlobal);
      emlrtPushRtStackR2012b(&eb_emlrtRSI, emlrtRootTLSGlobal);
      emlrt_checkEscapedGlobals();
      incy_t = (ptrdiff_t)(1);
      emlrtPopRtStackR2012b(&eb_emlrtRSI, emlrtRootTLSGlobal);
      emlrtPopRtStackR2012b(&bb_emlrtRSI, emlrtRootTLSGlobal);
      emlrtPushRtStackR2012b(&cb_emlrtRSI, emlrtRootTLSGlobal);
      emlrt_checkEscapedGlobals();
      xix0_t = (double *)(&a->data[0]);
      emlrtPopRtStackR2012b(&cb_emlrtRSI, emlrtRootTLSGlobal);
      emlrtPushRtStackR2012b(&db_emlrtRSI, emlrtRootTLSGlobal);
      emlrt_checkEscapedGlobals();
      yiy0_t = (double *)(&b->data[0]);
      emlrtPopRtStackR2012b(&db_emlrtRSI, emlrtRootTLSGlobal);
      emlrt_checkEscapedGlobals();
      c_y = ddot(&n_t, xix0_t, &incx_t, yiy0_t, &incy_t);
      emlrtPopRtStackR2012b(&t_emlrtRSI, emlrtRootTLSGlobal);
    }

    emlrtPopRtStackR2012b(&r_emlrtRSI, emlrtRootTLSGlobal);
    emlrtPopRtStackR2012b(&q_emlrtRSI, emlrtRootTLSGlobal);
    emlrtPopRtStackR2012b(&m_emlrtRSI, emlrtRootTLSGlobal);
  }

  emxFree_real_T(&b);
  emxFree_real_T(&a);
  out = c_y / (real_T)input->size[0];
  emlrtPopRtStackR2012b(&l_emlrtRSI, emlrtRootTLSGlobal);
  emlrtHeapReferenceStackLeaveFcnR2012b(emlrtRootTLSGlobal);
  return out;
}
Esempio n. 2
0
void mldivide(const real_T A[289], real_T B[289])
{
  real_T b_A[289];
  int8_T ipiv[17];
  int32_T jA;
  int32_T info;
  int32_T j;
  int32_T c;
  int32_T ix;
  real_T temp;
  int32_T jy;
  real_T s;
  int32_T b;
  int32_T b_j;
  boolean_T b_jA;
  int32_T ijA;
  char_T DIAGA;
  char_T TRANSA;
  char_T UPLO;
  char_T SIDE;
  ptrdiff_t m_t;
  ptrdiff_t n_t;
  ptrdiff_t lda_t;
  ptrdiff_t ldb_t;
  double * Aia0_t;
  double * Bib0_t;
  double * alpha1_t;
  emlrtPushRtStackR2012b(&pb_emlrtRSI, emlrtRootTLSGlobal);
  emlrtPushRtStackR2012b(&qb_emlrtRSI, emlrtRootTLSGlobal);
  emlrtPushRtStackR2012b(&sb_emlrtRSI, emlrtRootTLSGlobal);
  emlrtPushRtStackR2012b(&vb_emlrtRSI, emlrtRootTLSGlobal);
  emlrtPushRtStackR2012b(&wb_emlrtRSI, emlrtRootTLSGlobal);
  memcpy(&b_A[0], &A[0], 289U * sizeof(real_T));
  for (jA = 0; jA < 17; jA++) {
    ipiv[jA] = (int8_T)(1 + jA);
  }

  info = 0;
  for (j = 0; j < 16; j++) {
    c = j * 18;
    emlrtPushRtStackR2012b(&xb_emlrtRSI, emlrtRootTLSGlobal);
    emlrtPushRtStackR2012b(&bc_emlrtRSI, emlrtRootTLSGlobal);
    emlrtPushRtStackR2012b(&cc_emlrtRSI, emlrtRootTLSGlobal);
    jA = 1;
    ix = c;
    temp = muDoubleScalarAbs(b_A[c]);
    emlrtPushRtStackR2012b(&dc_emlrtRSI, emlrtRootTLSGlobal);
    emlrtPopRtStackR2012b(&dc_emlrtRSI, emlrtRootTLSGlobal);
    for (jy = 2; jy <= 17 - j; jy++) {
      ix++;
      s = muDoubleScalarAbs(b_A[ix]);
      if (s > temp) {
        jA = jy;
        temp = s;
      }
    }

    emlrtPopRtStackR2012b(&cc_emlrtRSI, emlrtRootTLSGlobal);
    emlrtPopRtStackR2012b(&bc_emlrtRSI, emlrtRootTLSGlobal);
    emlrtPopRtStackR2012b(&xb_emlrtRSI, emlrtRootTLSGlobal);
    if (b_A[(c + jA) - 1] != 0.0) {
      if (jA - 1 != 0) {
        ipiv[j] = (int8_T)(j + jA);
        eml_xswap(b_A, j + 1, j + jA);
      }

      b = (c - j) + 17;
      emlrtPushRtStackR2012b(&yb_emlrtRSI, emlrtRootTLSGlobal);
      emlrtPopRtStackR2012b(&yb_emlrtRSI, emlrtRootTLSGlobal);
      for (jA = c + 1; jA + 1 <= b; jA++) {
        b_A[jA] /= b_A[c];
      }
    } else {
      info = j + 1;
    }

    emlrtPushRtStackR2012b(&ac_emlrtRSI, emlrtRootTLSGlobal);
    emlrtPushRtStackR2012b(&ec_emlrtRSI, emlrtRootTLSGlobal);
    emlrtPushRtStackR2012b(&fc_emlrtRSI, emlrtRootTLSGlobal);
    emlrtPushRtStackR2012b(&gc_emlrtRSI, emlrtRootTLSGlobal);
    emlrtPushRtStackR2012b(&hc_emlrtRSI, emlrtRootTLSGlobal);
    jA = c;
    jy = c + 17;
    emlrtPushRtStackR2012b(&jc_emlrtRSI, emlrtRootTLSGlobal);
    emlrtPopRtStackR2012b(&jc_emlrtRSI, emlrtRootTLSGlobal);
    for (b_j = 1; b_j <= 16 - j; b_j++) {
      temp = b_A[jy];
      if (b_A[jy] != 0.0) {
        ix = c + 1;
        b = (jA - j) + 34;
        emlrtPushRtStackR2012b(&ic_emlrtRSI, emlrtRootTLSGlobal);
        if (jA + 19 > b) {
          b_jA = FALSE;
        } else {
          b_jA = (b > 2147483646);
        }

        if (b_jA) {
          emlrtPushRtStackR2012b(&g_emlrtRSI, emlrtRootTLSGlobal);
          check_forloop_overflow_error();
          emlrtPopRtStackR2012b(&g_emlrtRSI, emlrtRootTLSGlobal);
        }

        emlrtPopRtStackR2012b(&ic_emlrtRSI, emlrtRootTLSGlobal);
        for (ijA = jA + 18; ijA + 1 <= b; ijA++) {
          b_A[ijA] += b_A[ix] * -temp;
          ix++;
        }
      }

      jy += 17;
      jA += 17;
    }

    emlrtPopRtStackR2012b(&hc_emlrtRSI, emlrtRootTLSGlobal);
    emlrtPopRtStackR2012b(&gc_emlrtRSI, emlrtRootTLSGlobal);
    emlrtPopRtStackR2012b(&fc_emlrtRSI, emlrtRootTLSGlobal);
    emlrtPopRtStackR2012b(&ec_emlrtRSI, emlrtRootTLSGlobal);
    emlrtPopRtStackR2012b(&ac_emlrtRSI, emlrtRootTLSGlobal);
  }

  if ((info == 0) && (!(b_A[288] != 0.0))) {
    info = 17;
  }

  emlrtPopRtStackR2012b(&wb_emlrtRSI, emlrtRootTLSGlobal);
  emlrtPopRtStackR2012b(&vb_emlrtRSI, emlrtRootTLSGlobal);
  emlrtPopRtStackR2012b(&sb_emlrtRSI, emlrtRootTLSGlobal);
  if (info > 0) {
    emlrtPushRtStackR2012b(&rb_emlrtRSI, emlrtRootTLSGlobal);
    emlrtPushRtStackR2012b(&kc_emlrtRSI, emlrtRootTLSGlobal);
    eml_warning();
    emlrtPopRtStackR2012b(&kc_emlrtRSI, emlrtRootTLSGlobal);
    emlrtPopRtStackR2012b(&rb_emlrtRSI, emlrtRootTLSGlobal);
  }

  for (jA = 0; jA < 17; jA++) {
    if (ipiv[jA] != jA + 1) {
      for (j = 0; j < 17; j++) {
        temp = B[jA + 17 * j];
        B[jA + 17 * j] = B[(ipiv[jA] + 17 * j) - 1];
        B[(ipiv[jA] + 17 * j) - 1] = temp;
      }
    }
  }

  emlrtPushRtStackR2012b(&tb_emlrtRSI, emlrtRootTLSGlobal);
  emlrtPushRtStackR2012b(&mc_emlrtRSI, emlrtRootTLSGlobal);
  emlrtPushRtStackR2012b(&nc_emlrtRSI, emlrtRootTLSGlobal);
  temp = 1.0;
  DIAGA = 'U';
  TRANSA = 'N';
  UPLO = 'L';
  SIDE = 'L';
  emlrtPushRtStackR2012b(&oc_emlrtRSI, emlrtRootTLSGlobal);
  emlrtPushRtStackR2012b(&ob_emlrtRSI, emlrtRootTLSGlobal);
  emlrt_checkEscapedGlobals();
  m_t = (ptrdiff_t)(17);
  emlrtPopRtStackR2012b(&ob_emlrtRSI, emlrtRootTLSGlobal);
  emlrtPopRtStackR2012b(&oc_emlrtRSI, emlrtRootTLSGlobal);
  emlrtPushRtStackR2012b(&pc_emlrtRSI, emlrtRootTLSGlobal);
  emlrtPushRtStackR2012b(&ob_emlrtRSI, emlrtRootTLSGlobal);
  emlrt_checkEscapedGlobals();
  n_t = (ptrdiff_t)(17);
  emlrtPopRtStackR2012b(&ob_emlrtRSI, emlrtRootTLSGlobal);
  emlrtPopRtStackR2012b(&pc_emlrtRSI, emlrtRootTLSGlobal);
  emlrtPushRtStackR2012b(&qc_emlrtRSI, emlrtRootTLSGlobal);
  emlrtPushRtStackR2012b(&ob_emlrtRSI, emlrtRootTLSGlobal);
  emlrt_checkEscapedGlobals();
  lda_t = (ptrdiff_t)(17);
  emlrtPopRtStackR2012b(&ob_emlrtRSI, emlrtRootTLSGlobal);
  emlrtPopRtStackR2012b(&qc_emlrtRSI, emlrtRootTLSGlobal);
  emlrtPushRtStackR2012b(&rc_emlrtRSI, emlrtRootTLSGlobal);
  emlrtPushRtStackR2012b(&ob_emlrtRSI, emlrtRootTLSGlobal);
  emlrt_checkEscapedGlobals();
  ldb_t = (ptrdiff_t)(17);
  emlrtPopRtStackR2012b(&ob_emlrtRSI, emlrtRootTLSGlobal);
  emlrtPopRtStackR2012b(&rc_emlrtRSI, emlrtRootTLSGlobal);
  emlrtPushRtStackR2012b(&sc_emlrtRSI, emlrtRootTLSGlobal);
  emlrt_checkEscapedGlobals();
  Aia0_t = (double *)(&b_A[0]);
  emlrtPopRtStackR2012b(&sc_emlrtRSI, emlrtRootTLSGlobal);
  emlrtPushRtStackR2012b(&tc_emlrtRSI, emlrtRootTLSGlobal);
  emlrt_checkEscapedGlobals();
  Bib0_t = (double *)(&B[0]);
  emlrtPopRtStackR2012b(&tc_emlrtRSI, emlrtRootTLSGlobal);
  emlrtPushRtStackR2012b(&uc_emlrtRSI, emlrtRootTLSGlobal);
  emlrt_checkEscapedGlobals();
  alpha1_t = (double *)(&temp);
  emlrtPopRtStackR2012b(&uc_emlrtRSI, emlrtRootTLSGlobal);
  emlrtPushRtStackR2012b(&vc_emlrtRSI, emlrtRootTLSGlobal);
  emlrt_checkEscapedGlobals();
  dtrsm(&SIDE, &UPLO, &TRANSA, &DIAGA, &m_t, &n_t, alpha1_t, Aia0_t, &lda_t,
        Bib0_t, &ldb_t);
  emlrtPopRtStackR2012b(&vc_emlrtRSI, emlrtRootTLSGlobal);
  emlrtPopRtStackR2012b(&nc_emlrtRSI, emlrtRootTLSGlobal);
  emlrtPopRtStackR2012b(&mc_emlrtRSI, emlrtRootTLSGlobal);
  emlrtPopRtStackR2012b(&tb_emlrtRSI, emlrtRootTLSGlobal);
  emlrtPushRtStackR2012b(&ub_emlrtRSI, emlrtRootTLSGlobal);
  emlrtPushRtStackR2012b(&mc_emlrtRSI, emlrtRootTLSGlobal);
  emlrtPushRtStackR2012b(&nc_emlrtRSI, emlrtRootTLSGlobal);
  temp = 1.0;
  DIAGA = 'N';
  TRANSA = 'N';
  UPLO = 'U';
  SIDE = 'L';
  emlrtPushRtStackR2012b(&oc_emlrtRSI, emlrtRootTLSGlobal);
  emlrtPushRtStackR2012b(&ob_emlrtRSI, emlrtRootTLSGlobal);
  emlrt_checkEscapedGlobals();
  m_t = (ptrdiff_t)(17);
  emlrtPopRtStackR2012b(&ob_emlrtRSI, emlrtRootTLSGlobal);
  emlrtPopRtStackR2012b(&oc_emlrtRSI, emlrtRootTLSGlobal);
  emlrtPushRtStackR2012b(&pc_emlrtRSI, emlrtRootTLSGlobal);
  emlrtPushRtStackR2012b(&ob_emlrtRSI, emlrtRootTLSGlobal);
  emlrt_checkEscapedGlobals();
  n_t = (ptrdiff_t)(17);
  emlrtPopRtStackR2012b(&ob_emlrtRSI, emlrtRootTLSGlobal);
  emlrtPopRtStackR2012b(&pc_emlrtRSI, emlrtRootTLSGlobal);
  emlrtPushRtStackR2012b(&qc_emlrtRSI, emlrtRootTLSGlobal);
  emlrtPushRtStackR2012b(&ob_emlrtRSI, emlrtRootTLSGlobal);
  emlrt_checkEscapedGlobals();
  lda_t = (ptrdiff_t)(17);
  emlrtPopRtStackR2012b(&ob_emlrtRSI, emlrtRootTLSGlobal);
  emlrtPopRtStackR2012b(&qc_emlrtRSI, emlrtRootTLSGlobal);
  emlrtPushRtStackR2012b(&rc_emlrtRSI, emlrtRootTLSGlobal);
  emlrtPushRtStackR2012b(&ob_emlrtRSI, emlrtRootTLSGlobal);
  emlrt_checkEscapedGlobals();
  ldb_t = (ptrdiff_t)(17);
  emlrtPopRtStackR2012b(&ob_emlrtRSI, emlrtRootTLSGlobal);
  emlrtPopRtStackR2012b(&rc_emlrtRSI, emlrtRootTLSGlobal);
  emlrtPushRtStackR2012b(&sc_emlrtRSI, emlrtRootTLSGlobal);
  emlrt_checkEscapedGlobals();
  Aia0_t = (double *)(&b_A[0]);
  emlrtPopRtStackR2012b(&sc_emlrtRSI, emlrtRootTLSGlobal);
  emlrtPushRtStackR2012b(&tc_emlrtRSI, emlrtRootTLSGlobal);
  emlrt_checkEscapedGlobals();
  Bib0_t = (double *)(&B[0]);
  emlrtPopRtStackR2012b(&tc_emlrtRSI, emlrtRootTLSGlobal);
  emlrtPushRtStackR2012b(&uc_emlrtRSI, emlrtRootTLSGlobal);
  emlrt_checkEscapedGlobals();
  alpha1_t = (double *)(&temp);
  emlrtPopRtStackR2012b(&uc_emlrtRSI, emlrtRootTLSGlobal);
  emlrtPushRtStackR2012b(&vc_emlrtRSI, emlrtRootTLSGlobal);
  emlrt_checkEscapedGlobals();
  dtrsm(&SIDE, &UPLO, &TRANSA, &DIAGA, &m_t, &n_t, alpha1_t, Aia0_t, &lda_t,
        Bib0_t, &ldb_t);
  emlrtPopRtStackR2012b(&vc_emlrtRSI, emlrtRootTLSGlobal);
  emlrtPopRtStackR2012b(&nc_emlrtRSI, emlrtRootTLSGlobal);
  emlrtPopRtStackR2012b(&mc_emlrtRSI, emlrtRootTLSGlobal);
  emlrtPopRtStackR2012b(&ub_emlrtRSI, emlrtRootTLSGlobal);
  emlrtPopRtStackR2012b(&qb_emlrtRSI, emlrtRootTLSGlobal);
  emlrtPopRtStackR2012b(&pb_emlrtRSI, emlrtRootTLSGlobal);
}
Esempio n. 3
0
/* Function Definitions */
void linearODESSEP2X4(const emxArray_real_T *T, const emxArray_real_T *I)
{
  int32_T i;
  real_T hoistedGlobal[9];
  int32_T j;
  int32_T b_i;
  real_T normA;
  real_T y[81];
  real_T F[81];
  boolean_T exitg2;
  real_T s;
  boolean_T exitg1;
  static const real_T theta[5] = { 0.01495585217958292, 0.253939833006323,
    0.95041789961629319, 2.097847961257068, 5.3719203511481517 };

  static const int8_T iv2[5] = { 3, 5, 7, 9, 13 };

  int32_T eint;
  real_T b_y[81];
  real_T beta1;
  char_T TRANSB;
  char_T TRANSA;
  ptrdiff_t m_t;
  ptrdiff_t n_t;
  ptrdiff_t k_t;
  ptrdiff_t lda_t;
  ptrdiff_t ldb_t;
  ptrdiff_t ldc_t;
  double * alpha1_t;
  double * Aia0_t;
  double * Bib0_t;
  double * beta1_t;
  double * Cic0_t;
  emlrtPushRtStackR2012b(&l_emlrtRSI, emlrtRootTLSGlobal);

  /* global k1 k2 k3 k4 k5 k6 k7 k8 k9 k10 k11 k12 L1 L2 L3 L4 H1 H2 H3 H4 g1 g2 E1 E2 alpha A J Q; */
  /* Right */
  /* [C1,C2,C3,Q1,Q2,Q3,D1,D2,Z] */
  Q[0] = -k2 * A - L2 * J;
  Q[9] = L2 * J;
  Q[18] = 0.0;
  Q[27] = k2 * A;
  Q[36] = 0.0;
  Q[45] = 0.0;
  Q[54] = 0.0;
  Q[63] = 0.0;
  Q[72] = 0.0;
  Q[1] = L1;
  Q[10] = (-k4 * A - L1) - L4 * J;
  Q[19] = L4 * J;
  Q[28] = 0.0;
  Q[37] = k4 * A;
  Q[46] = 0.0;
  Q[55] = 0.0;
  Q[64] = 0.0;
  Q[73] = 0.0;
  Q[2] = 0.0;
  Q[11] = L3;
  Q[20] = -k6 * A - L3;
  Q[29] = 0.0;
  Q[38] = 0.0;
  Q[47] = k6 * A;
  Q[56] = 0.0;
  Q[65] = 0.0;
  Q[74] = 0.0;
  Q[3] = k1;
  Q[12] = 0.0;
  Q[21] = 0.0;
  Q[30] = (-k1 - L2 * J) - H2;
  Q[39] = L2 * J;
  Q[48] = 0.0;
  Q[57] = 0.0;
  Q[66] = H2;
  Q[75] = 0.0;
  Q[4] = 0.0;
  Q[13] = k3;
  Q[22] = 0.0;
  Q[31] = L1;
  Q[40] = (-k3 - L1) - L4 * J;
  Q[49] = L4 * J;
  Q[58] = 0.0;
  Q[67] = 0.0;
  Q[76] = 0.0;
  Q[5] = 0.0;
  Q[14] = 0.0;
  Q[23] = k5;
  Q[32] = 0.0;
  Q[41] = L3;
  Q[50] = -k5 - L3;
  Q[59] = 0.0;
  Q[68] = 0.0;
  Q[77] = 0.0;
  Q[6] = H1;
  Q[15] = 0.0;
  Q[24] = 0.0;
  Q[33] = 0.0;
  Q[42] = 0.0;
  Q[51] = 0.0;
  Q[60] = -k2 * A - H1;
  Q[69] = k2 * A;
  Q[78] = 0.0;
  Q[7] = 0.0;
  Q[16] = 0.0;
  Q[25] = 0.0;
  Q[34] = 0.0;
  Q[43] = 0.0;
  Q[52] = 0.0;
  Q[61] = k1;
  Q[70] = -k1 - H3;
  Q[79] = H3;
  Q[8] = H4;
  Q[17] = 0.0;
  Q[26] = 0.0;
  Q[35] = 0.0;
  Q[44] = 0.0;
  Q[53] = 0.0;
  Q[62] = 0.0;
  Q[71] = 0.0;
  Q[80] = -H4;
  Q_dirty |= 1U;
  emlrtPopRtStackR2012b(&l_emlrtRSI, emlrtRootTLSGlobal);
  i = 0;
  while (i <= T->size[0] - 1) {
    emlrtPushRtStackR2012b(&m_emlrtRSI, emlrtRootTLSGlobal);
    memcpy(&hoistedGlobal[0], &p0[0], 9U * sizeof(real_T));
    j = T->size[0];
    b_i = (int32_T)(1.0 + (real_T)i);
    emlrtDynamicBoundsCheckFastR2012b(b_i, 1, j, &t_emlrtBCI, emlrtRootTLSGlobal);
    normA = T->data[i];
    for (j = 0; j < 81; j++) {
      y[j] = Q[j] * normA;
    }

    normA = 0.0;
    j = 0;
    exitg2 = FALSE;
    while ((exitg2 == FALSE) && (j < 9)) {
      s = 0.0;
      for (b_i = 0; b_i < 9; b_i++) {
        s += muDoubleScalarAbs(y[b_i + 9 * j]);
      }

      if (muDoubleScalarIsNaN(s)) {
        normA = rtNaN;
        exitg2 = TRUE;
      } else {
        if (s > normA) {
          normA = s;
        }

        j++;
      }
    }

    if (normA <= 5.3719203511481517) {
      b_i = 0;
      exitg1 = FALSE;
      while ((exitg1 == FALSE) && (b_i < 5)) {
        if (normA <= theta[b_i]) {
          emlrtPushRtStackR2012b(&n_emlrtRSI, emlrtRootTLSGlobal);
          PadeApproximantOfDegree(y, iv2[b_i], F);
          emlrtPopRtStackR2012b(&n_emlrtRSI, emlrtRootTLSGlobal);
          exitg1 = TRUE;
        } else {
          b_i++;
        }
      }
    } else {
      normA /= 5.3719203511481517;
      if ((!muDoubleScalarIsInf(normA)) && (!muDoubleScalarIsNaN(normA))) {
        normA = frexp(normA, &eint);
        j = eint;
      } else {
        j = 0;
      }

      s = j;
      if (normA == 0.5) {
        s = (real_T)j - 1.0;
      }

      normA = muDoubleScalarPower(2.0, s);
      emlrtPushRtStackR2012b(&o_emlrtRSI, emlrtRootTLSGlobal);
      for (j = 0; j < 81; j++) {
        b_y[j] = y[j] / normA;
      }

      PadeApproximantOfDegree(b_y, 13.0, F);
      emlrtPopRtStackR2012b(&o_emlrtRSI, emlrtRootTLSGlobal);
      emlrtForLoopVectorCheckR2012b(1.0, 1.0, s, mxDOUBLE_CLASS, (int32_T)s,
        &g_emlrtRTEI, emlrtRootTLSGlobal);
      for (j = 0; j < (int32_T)s; j++) {
        emlrtPushRtStackR2012b(&p_emlrtRSI, emlrtRootTLSGlobal);
        emlrtPushRtStackR2012b(&cb_emlrtRSI, emlrtRootTLSGlobal);
        memcpy(&y[0], &F[0], 81U * sizeof(real_T));
        emlrtPushRtStackR2012b(&db_emlrtRSI, emlrtRootTLSGlobal);
        emlrtPushRtStackR2012b(&eb_emlrtRSI, emlrtRootTLSGlobal);
        normA = 1.0;
        beta1 = 0.0;
        TRANSB = 'N';
        TRANSA = 'N';
        memset(&F[0], 0, 81U * sizeof(real_T));
        emlrtPushRtStackR2012b(&fb_emlrtRSI, emlrtRootTLSGlobal);
        emlrtPushRtStackR2012b(&rb_emlrtRSI, emlrtRootTLSGlobal);
        emlrt_checkEscapedGlobals();
        m_t = (ptrdiff_t)(9);
        emlrtPopRtStackR2012b(&rb_emlrtRSI, emlrtRootTLSGlobal);
        emlrtPopRtStackR2012b(&fb_emlrtRSI, emlrtRootTLSGlobal);
        emlrtPushRtStackR2012b(&gb_emlrtRSI, emlrtRootTLSGlobal);
        emlrtPushRtStackR2012b(&rb_emlrtRSI, emlrtRootTLSGlobal);
        emlrt_checkEscapedGlobals();
        n_t = (ptrdiff_t)(9);
        emlrtPopRtStackR2012b(&rb_emlrtRSI, emlrtRootTLSGlobal);
        emlrtPopRtStackR2012b(&gb_emlrtRSI, emlrtRootTLSGlobal);
        emlrtPushRtStackR2012b(&hb_emlrtRSI, emlrtRootTLSGlobal);
        emlrtPushRtStackR2012b(&rb_emlrtRSI, emlrtRootTLSGlobal);
        emlrt_checkEscapedGlobals();
        k_t = (ptrdiff_t)(9);
        emlrtPopRtStackR2012b(&rb_emlrtRSI, emlrtRootTLSGlobal);
        emlrtPopRtStackR2012b(&hb_emlrtRSI, emlrtRootTLSGlobal);
        emlrtPushRtStackR2012b(&ib_emlrtRSI, emlrtRootTLSGlobal);
        emlrtPushRtStackR2012b(&rb_emlrtRSI, emlrtRootTLSGlobal);
        emlrt_checkEscapedGlobals();
        lda_t = (ptrdiff_t)(9);
        emlrtPopRtStackR2012b(&rb_emlrtRSI, emlrtRootTLSGlobal);
        emlrtPopRtStackR2012b(&ib_emlrtRSI, emlrtRootTLSGlobal);
        emlrtPushRtStackR2012b(&jb_emlrtRSI, emlrtRootTLSGlobal);
        emlrtPushRtStackR2012b(&rb_emlrtRSI, emlrtRootTLSGlobal);
        emlrt_checkEscapedGlobals();
        ldb_t = (ptrdiff_t)(9);
        emlrtPopRtStackR2012b(&rb_emlrtRSI, emlrtRootTLSGlobal);
        emlrtPopRtStackR2012b(&jb_emlrtRSI, emlrtRootTLSGlobal);
        emlrtPushRtStackR2012b(&kb_emlrtRSI, emlrtRootTLSGlobal);
        emlrtPushRtStackR2012b(&rb_emlrtRSI, emlrtRootTLSGlobal);
        emlrt_checkEscapedGlobals();
        ldc_t = (ptrdiff_t)(9);
        emlrtPopRtStackR2012b(&rb_emlrtRSI, emlrtRootTLSGlobal);
        emlrtPopRtStackR2012b(&kb_emlrtRSI, emlrtRootTLSGlobal);
        emlrtPushRtStackR2012b(&lb_emlrtRSI, emlrtRootTLSGlobal);
        emlrt_checkEscapedGlobals();
        alpha1_t = (double *)(&normA);
        emlrtPopRtStackR2012b(&lb_emlrtRSI, emlrtRootTLSGlobal);
        emlrtPushRtStackR2012b(&mb_emlrtRSI, emlrtRootTLSGlobal);
        emlrt_checkEscapedGlobals();
        Aia0_t = (double *)(&y[0]);
        emlrtPopRtStackR2012b(&mb_emlrtRSI, emlrtRootTLSGlobal);
        emlrtPushRtStackR2012b(&nb_emlrtRSI, emlrtRootTLSGlobal);
        emlrt_checkEscapedGlobals();
        Bib0_t = (double *)(&y[0]);
        emlrtPopRtStackR2012b(&nb_emlrtRSI, emlrtRootTLSGlobal);
        emlrtPushRtStackR2012b(&ob_emlrtRSI, emlrtRootTLSGlobal);
        emlrt_checkEscapedGlobals();
        beta1_t = (double *)(&beta1);
        emlrtPopRtStackR2012b(&ob_emlrtRSI, emlrtRootTLSGlobal);
        emlrtPushRtStackR2012b(&pb_emlrtRSI, emlrtRootTLSGlobal);
        emlrt_checkEscapedGlobals();
        Cic0_t = (double *)(&F[0]);
        emlrtPopRtStackR2012b(&pb_emlrtRSI, emlrtRootTLSGlobal);
        emlrtPushRtStackR2012b(&qb_emlrtRSI, emlrtRootTLSGlobal);
        emlrt_checkEscapedGlobals();
        dgemm(&TRANSA, &TRANSB, &m_t, &n_t, &k_t, alpha1_t, Aia0_t, &lda_t,
              Bib0_t, &ldb_t, beta1_t, Cic0_t, &ldc_t);
        emlrtPopRtStackR2012b(&qb_emlrtRSI, emlrtRootTLSGlobal);
        emlrtPopRtStackR2012b(&eb_emlrtRSI, emlrtRootTLSGlobal);
        emlrtPopRtStackR2012b(&db_emlrtRSI, emlrtRootTLSGlobal);
        emlrtPopRtStackR2012b(&cb_emlrtRSI, emlrtRootTLSGlobal);
        emlrtPopRtStackR2012b(&p_emlrtRSI, emlrtRootTLSGlobal);
      }
    }

    for (j = 0; j < 9; j++) {
      p0[j] = 0.0;
      for (b_i = 0; b_i < 9; b_i++) {
        p0[j] += hoistedGlobal[b_i] * F[b_i + 9 * j];
      }
    }

    p0_dirty |= 1U;
    emlrtPopRtStackR2012b(&m_emlrtRSI, emlrtRootTLSGlobal);
    j = I->size[0];
    b_i = 1 + i;
    normA = Acell * 1.0E+12 * (g1 * p0[3] * (V - E1) + g2 * (p0[4] + p0[5]) * (V
      - E2)) - I->data[emlrtDynamicBoundsCheckFastR2012b(b_i, 1, j, &u_emlrtBCI,
      emlrtRootTLSGlobal) - 1];
    normA = muDoubleScalarAbs(normA);
    err += normA * normA;
    err_dirty |= 1U;
    i++;
    emlrtBreakCheckFastR2012b(emlrtBreakCheckR2012bFlagVar, emlrtRootTLSGlobal);
  }
}
Esempio n. 4
0
/* Function Definitions */
void linearODESSEP2X4(const emxArray_real_T *T, const emxArray_real_T *I)
{
  int32_T i;
  real_T hoistedGlobal[17];
  int32_T j;
  int32_T b_i;
  real_T normA;
  real_T y[289];
  real_T F[289];
  boolean_T exitg2;
  real_T s;
  boolean_T exitg1;
  static const real_T theta[5] = { 0.01495585217958292, 0.253939833006323,
    0.95041789961629319, 2.097847961257068, 5.3719203511481517 };

  static const int8_T iv2[5] = { 3, 5, 7, 9, 13 };

  int32_T eint;
  real_T b_y[289];
  real_T beta1;
  char_T TRANSB;
  char_T TRANSA;
  ptrdiff_t m_t;
  ptrdiff_t n_t;
  ptrdiff_t k_t;
  ptrdiff_t lda_t;
  ptrdiff_t ldb_t;
  ptrdiff_t ldc_t;
  double * alpha1_t;
  double * Aia0_t;
  double * Bib0_t;
  double * beta1_t;
  double * Cic0_t;
  emlrtPushRtStackR2012b(&db_emlrtRSI, emlrtRootTLSGlobal);
  Q[0] = -k2 * A - L2 * J;
  Q[17] = k2 * A;
  Q[34] = L2 * J;
  Q[51] = 0.0;
  Q[68] = 0.0;
  Q[85] = 0.0;
  Q[102] = 0.0;
  Q[119] = 0.0;
  Q[136] = 0.0;
  Q[153] = 0.0;
  Q[170] = 0.0;
  Q[187] = 0.0;
  Q[204] = 0.0;
  Q[221] = 0.0;
  Q[238] = 0.0;
  Q[255] = 0.0;
  Q[272] = 0.0;
  Q[1] = k1;
  Q[18] = ((-k1 - k4 * A) - H2) - L2 * J;
  Q[35] = 0.0;
  Q[52] = L2 * J;
  Q[69] = 0.0;
  Q[86] = 0.0;
  Q[103] = k4 * A;
  Q[120] = 0.0;
  Q[137] = 0.0;
  Q[154] = 0.0;
  Q[171] = 0.0;
  Q[188] = 0.0;
  Q[205] = 0.0;
  Q[222] = H2;
  Q[239] = 0.0;
  Q[256] = 0.0;
  Q[273] = 0.0;
  Q[2] = L1;
  Q[19] = 0.0;
  Q[36] = (-k8 * A - L1) - L4 * J;
  Q[53] = k8 * A;
  Q[70] = L4 * J;
  Q[87] = 0.0;
  Q[104] = 0.0;
  Q[121] = 0.0;
  Q[138] = 0.0;
  Q[155] = 0.0;
  Q[172] = 0.0;
  Q[189] = 0.0;
  Q[206] = 0.0;
  Q[223] = 0.0;
  Q[240] = 0.0;
  Q[257] = 0.0;
  Q[274] = 0.0;
  Q[3] = 0.0;
  Q[20] = L1;
  Q[37] = k7;
  Q[54] = ((-k7 - k10 * A) - L1) - L4 * J;
  Q[71] = 0.0;
  Q[88] = L4 * J;
  Q[105] = 0.0;
  Q[122] = 0.0;
  Q[139] = k10 * A;
  Q[156] = 0.0;
  Q[173] = 0.0;
  Q[190] = 0.0;
  Q[207] = 0.0;
  Q[224] = 0.0;
  Q[241] = 0.0;
  Q[258] = 0.0;
  Q[275] = 0.0;
  Q[4] = 0.0;
  Q[21] = 0.0;
  Q[38] = L3;
  Q[55] = 0.0;
  Q[72] = -k8 * alpha * A - L3;
  Q[89] = k8 * alpha * A;
  Q[106] = 0.0;
  Q[123] = 0.0;
  Q[140] = 0.0;
  Q[157] = 0.0;
  Q[174] = 0.0;
  Q[191] = 0.0;
  Q[208] = 0.0;
  Q[225] = 0.0;
  Q[242] = 0.0;
  Q[259] = 0.0;
  Q[276] = 0.0;
  Q[5] = 0.0;
  Q[22] = 0.0;
  Q[39] = 0.0;
  Q[56] = L3;
  Q[73] = k7;
  Q[90] = (-k7 - k10 * alpha * A) - L3;
  Q[107] = 0.0;
  Q[124] = 0.0;
  Q[141] = 0.0;
  Q[158] = 0.0;
  Q[175] = k10 * alpha * A;
  Q[192] = 0.0;
  Q[209] = 0.0;
  Q[226] = 0.0;
  Q[243] = 0.0;
  Q[260] = 0.0;
  Q[277] = 0.0;
  Q[6] = 0.0;
  Q[23] = k3;
  Q[40] = 0.0;
  Q[57] = 0.0;
  Q[74] = 0.0;
  Q[91] = 0.0;
  Q[108] = ((-k3 - k6 * A) - H2) - L2 * J;
  Q[125] = k6 * A;
  Q[142] = L2 * J;
  Q[159] = 0.0;
  Q[176] = 0.0;
  Q[193] = 0.0;
  Q[210] = 0.0;
  Q[227] = 0.0;
  Q[244] = H2;
  Q[261] = 0.0;
  Q[278] = 0.0;
  Q[7] = 0.0;
  Q[24] = 0.0;
  Q[41] = 0.0;
  Q[58] = 0.0;
  Q[75] = 0.0;
  Q[92] = 0.0;
  Q[109] = k5;
  Q[126] = (-k5 - H2) - L2 * J;
  Q[143] = 0.0;
  Q[160] = L2 * J;
  Q[177] = 0.0;
  Q[194] = 0.0;
  Q[211] = 0.0;
  Q[228] = 0.0;
  Q[245] = 0.0;
  Q[262] = H2;
  Q[279] = 0.0;
  Q[8] = 0.0;
  Q[25] = 0.0;
  Q[42] = 0.0;
  Q[59] = k9;
  Q[76] = 0.0;
  Q[93] = 0.0;
  Q[110] = L1;
  Q[127] = 0.0;
  Q[144] = ((-k9 - k12 * A) - L1) - L4 * J;
  Q[161] = k12 * A;
  Q[178] = L4 * J;
  Q[195] = 0.0;
  Q[212] = 0.0;
  Q[229] = 0.0;
  Q[246] = 0.0;
  Q[263] = 0.0;
  Q[280] = 0.0;
  Q[9] = 0.0;
  Q[26] = 0.0;
  Q[43] = 0.0;
  Q[60] = 0.0;
  Q[77] = 0.0;
  Q[94] = 0.0;
  Q[111] = 0.0;
  Q[128] = L1;
  Q[145] = k11;
  Q[162] = (-k11 - L1) - L4 * J;
  Q[179] = 0.0;
  Q[196] = L4 * J;
  Q[213] = 0.0;
  Q[230] = 0.0;
  Q[247] = 0.0;
  Q[264] = 0.0;
  Q[281] = 0.0;
  Q[10] = 0.0;
  Q[27] = 0.0;
  Q[44] = 0.0;
  Q[61] = 0.0;
  Q[78] = 0.0;
  Q[95] = k9;
  Q[112] = 0.0;
  Q[129] = 0.0;
  Q[146] = L3;
  Q[163] = 0.0;
  Q[180] = (-k9 - k12 * alpha * A) - L3;
  Q[197] = k12 * alpha * A;
  Q[214] = 0.0;
  Q[231] = 0.0;
  Q[248] = 0.0;
  Q[265] = 0.0;
  Q[282] = 0.0;
  Q[11] = 0.0;
  Q[28] = 0.0;
  Q[45] = 0.0;
  Q[62] = 0.0;
  Q[79] = 0.0;
  Q[96] = 0.0;
  Q[113] = 0.0;
  Q[130] = 0.0;
  Q[147] = 0.0;
  Q[164] = L3;
  Q[181] = k11;
  Q[198] = -k11 - L3;
  Q[215] = 0.0;
  Q[232] = 0.0;
  Q[249] = 0.0;
  Q[266] = 0.0;
  Q[283] = 0.0;
  Q[12] = H1;
  Q[29] = 0.0;
  Q[46] = 0.0;
  Q[63] = 0.0;
  Q[80] = 0.0;
  Q[97] = 0.0;
  Q[114] = 0.0;
  Q[131] = 0.0;
  Q[148] = 0.0;
  Q[165] = 0.0;
  Q[182] = 0.0;
  Q[199] = 0.0;
  Q[216] = -k2 * A - H1;
  Q[233] = k2 * A;
  Q[250] = 0.0;
  Q[267] = 0.0;
  Q[284] = 0.0;
  Q[13] = 0.0;
  Q[30] = 0.0;
  Q[47] = 0.0;
  Q[64] = 0.0;
  Q[81] = 0.0;
  Q[98] = 0.0;
  Q[115] = 0.0;
  Q[132] = 0.0;
  Q[149] = 0.0;
  Q[166] = 0.0;
  Q[183] = 0.0;
  Q[200] = 0.0;
  Q[217] = k1;
  Q[234] = -k1 - k4 * A;
  Q[251] = k4 * A;
  Q[268] = 0.0;
  Q[285] = 0.0;
  Q[14] = 0.0;
  Q[31] = 0.0;
  Q[48] = 0.0;
  Q[65] = 0.0;
  Q[82] = 0.0;
  Q[99] = 0.0;
  Q[116] = 0.0;
  Q[133] = 0.0;
  Q[150] = 0.0;
  Q[167] = 0.0;
  Q[184] = 0.0;
  Q[201] = 0.0;
  Q[218] = 0.0;
  Q[235] = k3;
  Q[252] = -k3 - k6 * A;
  Q[269] = k6 * A;
  Q[286] = 0.0;
  Q[15] = 0.0;
  Q[32] = 0.0;
  Q[49] = 0.0;
  Q[66] = 0.0;
  Q[83] = 0.0;
  Q[100] = 0.0;
  Q[117] = 0.0;
  Q[134] = 0.0;
  Q[151] = 0.0;
  Q[168] = 0.0;
  Q[185] = 0.0;
  Q[202] = 0.0;
  Q[219] = 0.0;
  Q[236] = 0.0;
  Q[253] = k5;
  Q[270] = -k5 - H3;
  Q[287] = H3;
  Q[16] = H4;
  Q[33] = 0.0;
  Q[50] = 0.0;
  Q[67] = 0.0;
  Q[84] = 0.0;
  Q[101] = 0.0;
  Q[118] = 0.0;
  Q[135] = 0.0;
  Q[152] = 0.0;
  Q[169] = 0.0;
  Q[186] = 0.0;
  Q[203] = 0.0;
  Q[220] = 0.0;
  Q[237] = 0.0;
  Q[254] = 0.0;
  Q[271] = 0.0;
  Q[288] = -H4;
  Q_dirty |= 1U;
  emlrtPopRtStackR2012b(&db_emlrtRSI, emlrtRootTLSGlobal);
  i = 0;
  while (i <= T->size[0] - 1) {
    emlrtPushRtStackR2012b(&eb_emlrtRSI, emlrtRootTLSGlobal);
    memcpy(&hoistedGlobal[0], &p0[0], 17U * sizeof(real_T));
    j = T->size[0];
    b_i = (int32_T)(1.0 + (real_T)i);
    emlrtDynamicBoundsCheckFastR2012b(b_i, 1, j, &bd_emlrtBCI,
      emlrtRootTLSGlobal);
    normA = T->data[i];
    for (j = 0; j < 289; j++) {
      y[j] = Q[j] * normA;
    }

    normA = 0.0;
    j = 0;
    exitg2 = FALSE;
    while ((exitg2 == FALSE) && (j < 17)) {
      s = 0.0;
      for (b_i = 0; b_i < 17; b_i++) {
        s += muDoubleScalarAbs(y[b_i + 17 * j]);
      }

      if (muDoubleScalarIsNaN(s)) {
        normA = rtNaN;
        exitg2 = TRUE;
      } else {
        if (s > normA) {
          normA = s;
        }

        j++;
      }
    }

    if (normA <= 5.3719203511481517) {
      b_i = 0;
      exitg1 = FALSE;
      while ((exitg1 == FALSE) && (b_i < 5)) {
        if (normA <= theta[b_i]) {
          emlrtPushRtStackR2012b(&fb_emlrtRSI, emlrtRootTLSGlobal);
          PadeApproximantOfDegree(y, iv2[b_i], F);
          emlrtPopRtStackR2012b(&fb_emlrtRSI, emlrtRootTLSGlobal);
          exitg1 = TRUE;
        } else {
          b_i++;
        }
      }
    } else {
      normA /= 5.3719203511481517;
      if ((!muDoubleScalarIsInf(normA)) && (!muDoubleScalarIsNaN(normA))) {
        normA = frexp(normA, &eint);
        j = eint;
      } else {
        j = 0;
      }

      s = j;
      if (normA == 0.5) {
        s = (real_T)j - 1.0;
      }

      normA = muDoubleScalarPower(2.0, s);
      emlrtPushRtStackR2012b(&gb_emlrtRSI, emlrtRootTLSGlobal);
      for (j = 0; j < 289; j++) {
        b_y[j] = y[j] / normA;
      }

      PadeApproximantOfDegree(b_y, 13.0, F);
      emlrtPopRtStackR2012b(&gb_emlrtRSI, emlrtRootTLSGlobal);
      emlrtForLoopVectorCheckR2012b(1.0, 1.0, s, mxDOUBLE_CLASS, (int32_T)s,
        &l_emlrtRTEI, emlrtRootTLSGlobal);
      for (j = 0; j < (int32_T)s; j++) {
        emlrtPushRtStackR2012b(&hb_emlrtRSI, emlrtRootTLSGlobal);
        emlrtPushRtStackR2012b(&tb_emlrtRSI, emlrtRootTLSGlobal);
        memcpy(&y[0], &F[0], 289U * sizeof(real_T));
        emlrtPushRtStackR2012b(&ub_emlrtRSI, emlrtRootTLSGlobal);
        emlrtPushRtStackR2012b(&vb_emlrtRSI, emlrtRootTLSGlobal);
        normA = 1.0;
        beta1 = 0.0;
        TRANSB = 'N';
        TRANSA = 'N';
        memset(&F[0], 0, 289U * sizeof(real_T));
        emlrtPushRtStackR2012b(&wb_emlrtRSI, emlrtRootTLSGlobal);
        emlrtPushRtStackR2012b(&jc_emlrtRSI, emlrtRootTLSGlobal);
        emlrt_checkEscapedGlobals();
        m_t = (ptrdiff_t)(17);
        emlrtPopRtStackR2012b(&jc_emlrtRSI, emlrtRootTLSGlobal);
        emlrtPopRtStackR2012b(&wb_emlrtRSI, emlrtRootTLSGlobal);
        emlrtPushRtStackR2012b(&xb_emlrtRSI, emlrtRootTLSGlobal);
        emlrtPushRtStackR2012b(&jc_emlrtRSI, emlrtRootTLSGlobal);
        emlrt_checkEscapedGlobals();
        n_t = (ptrdiff_t)(17);
        emlrtPopRtStackR2012b(&jc_emlrtRSI, emlrtRootTLSGlobal);
        emlrtPopRtStackR2012b(&xb_emlrtRSI, emlrtRootTLSGlobal);
        emlrtPushRtStackR2012b(&yb_emlrtRSI, emlrtRootTLSGlobal);
        emlrtPushRtStackR2012b(&jc_emlrtRSI, emlrtRootTLSGlobal);
        emlrt_checkEscapedGlobals();
        k_t = (ptrdiff_t)(17);
        emlrtPopRtStackR2012b(&jc_emlrtRSI, emlrtRootTLSGlobal);
        emlrtPopRtStackR2012b(&yb_emlrtRSI, emlrtRootTLSGlobal);
        emlrtPushRtStackR2012b(&ac_emlrtRSI, emlrtRootTLSGlobal);
        emlrtPushRtStackR2012b(&jc_emlrtRSI, emlrtRootTLSGlobal);
        emlrt_checkEscapedGlobals();
        lda_t = (ptrdiff_t)(17);
        emlrtPopRtStackR2012b(&jc_emlrtRSI, emlrtRootTLSGlobal);
        emlrtPopRtStackR2012b(&ac_emlrtRSI, emlrtRootTLSGlobal);
        emlrtPushRtStackR2012b(&bc_emlrtRSI, emlrtRootTLSGlobal);
        emlrtPushRtStackR2012b(&jc_emlrtRSI, emlrtRootTLSGlobal);
        emlrt_checkEscapedGlobals();
        ldb_t = (ptrdiff_t)(17);
        emlrtPopRtStackR2012b(&jc_emlrtRSI, emlrtRootTLSGlobal);
        emlrtPopRtStackR2012b(&bc_emlrtRSI, emlrtRootTLSGlobal);
        emlrtPushRtStackR2012b(&cc_emlrtRSI, emlrtRootTLSGlobal);
        emlrtPushRtStackR2012b(&jc_emlrtRSI, emlrtRootTLSGlobal);
        emlrt_checkEscapedGlobals();
        ldc_t = (ptrdiff_t)(17);
        emlrtPopRtStackR2012b(&jc_emlrtRSI, emlrtRootTLSGlobal);
        emlrtPopRtStackR2012b(&cc_emlrtRSI, emlrtRootTLSGlobal);
        emlrtPushRtStackR2012b(&dc_emlrtRSI, emlrtRootTLSGlobal);
        emlrt_checkEscapedGlobals();
        alpha1_t = (double *)(&normA);
        emlrtPopRtStackR2012b(&dc_emlrtRSI, emlrtRootTLSGlobal);
        emlrtPushRtStackR2012b(&ec_emlrtRSI, emlrtRootTLSGlobal);
        emlrt_checkEscapedGlobals();
        Aia0_t = (double *)(&y[0]);
        emlrtPopRtStackR2012b(&ec_emlrtRSI, emlrtRootTLSGlobal);
        emlrtPushRtStackR2012b(&fc_emlrtRSI, emlrtRootTLSGlobal);
        emlrt_checkEscapedGlobals();
        Bib0_t = (double *)(&y[0]);
        emlrtPopRtStackR2012b(&fc_emlrtRSI, emlrtRootTLSGlobal);
        emlrtPushRtStackR2012b(&gc_emlrtRSI, emlrtRootTLSGlobal);
        emlrt_checkEscapedGlobals();
        beta1_t = (double *)(&beta1);
        emlrtPopRtStackR2012b(&gc_emlrtRSI, emlrtRootTLSGlobal);
        emlrtPushRtStackR2012b(&hc_emlrtRSI, emlrtRootTLSGlobal);
        emlrt_checkEscapedGlobals();
        Cic0_t = (double *)(&F[0]);
        emlrtPopRtStackR2012b(&hc_emlrtRSI, emlrtRootTLSGlobal);
        emlrtPushRtStackR2012b(&ic_emlrtRSI, emlrtRootTLSGlobal);
        emlrt_checkEscapedGlobals();
        dgemm(&TRANSA, &TRANSB, &m_t, &n_t, &k_t, alpha1_t, Aia0_t, &lda_t,
              Bib0_t, &ldb_t, beta1_t, Cic0_t, &ldc_t);
        emlrtPopRtStackR2012b(&ic_emlrtRSI, emlrtRootTLSGlobal);
        emlrtPopRtStackR2012b(&vb_emlrtRSI, emlrtRootTLSGlobal);
        emlrtPopRtStackR2012b(&ub_emlrtRSI, emlrtRootTLSGlobal);
        emlrtPopRtStackR2012b(&tb_emlrtRSI, emlrtRootTLSGlobal);
        emlrtPopRtStackR2012b(&hb_emlrtRSI, emlrtRootTLSGlobal);
      }
    }

    for (j = 0; j < 17; j++) {
      p0[j] = 0.0;
      for (b_i = 0; b_i < 17; b_i++) {
        p0[j] += hoistedGlobal[b_i] * F[b_i + 17 * j];
      }
    }

    p0_dirty |= 1U;
    emlrtPopRtStackR2012b(&eb_emlrtRSI, emlrtRootTLSGlobal);
    j = I->size[0];
    b_i = 1 + i;
    normA = Acell * 1.0E+12 * (g1 * (p0[6] + p0[7]) * (V - E1) + g2 * (((p0[8] +
      p0[9]) + p0[10]) + p0[11]) * (V - E2)) - I->
      data[emlrtDynamicBoundsCheckFastR2012b(b_i, 1, j, &cd_emlrtBCI,
      emlrtRootTLSGlobal) - 1];
    normA = muDoubleScalarAbs(normA);
    err += normA * normA;
    err_dirty |= 1U;
    i++;
    emlrtBreakCheckFastR2012b(emlrtBreakCheckR2012bFlagVar, emlrtRootTLSGlobal);
  }
}
Esempio n. 5
0
/* Function Definitions */
static void eml_xgemm(int32_T m, int32_T n, int32_T k, const emxArray_creal_T *A,
                      int32_T lda, const emxArray_creal_T *B, int32_T ldb,
                      emxArray_creal_T *C, int32_T ldc)
{
  char_T TRANSB;
  char_T TRANSA;
  ptrdiff_t m_t;
  ptrdiff_t n_t;
  ptrdiff_t k_t;
  ptrdiff_t lda_t;
  ptrdiff_t ldb_t;
  ptrdiff_t ldc_t;
  static const creal_T alpha1 = { 1.0, 0.0 };

  double * alpha1_t;
  double * Aia0_t;
  double * Bib0_t;
  static const creal_T beta1 = { 0.0, 0.0 };

  double * beta1_t;
  double * Cic0_t;
  emlrtPushRtStackR2012b(&nh_emlrtRSI, emlrtRootTLSGlobal);
  if ((m < 1) || (n < 1) || (k < 1)) {
  } else {
    emlrtPushRtStackR2012b(&ph_emlrtRSI, emlrtRootTLSGlobal);
    TRANSB = 'N';
    TRANSA = 'N';
    emlrtPushRtStackR2012b(&vh_emlrtRSI, emlrtRootTLSGlobal);
    emlrtPushRtStackR2012b(&rc_emlrtRSI, emlrtRootTLSGlobal);
    emlrt_checkEscapedGlobals();
    m_t = (ptrdiff_t)(m);
    emlrtPopRtStackR2012b(&rc_emlrtRSI, emlrtRootTLSGlobal);
    emlrtPopRtStackR2012b(&vh_emlrtRSI, emlrtRootTLSGlobal);
    emlrtPushRtStackR2012b(&wh_emlrtRSI, emlrtRootTLSGlobal);
    emlrtPushRtStackR2012b(&rc_emlrtRSI, emlrtRootTLSGlobal);
    emlrt_checkEscapedGlobals();
    n_t = (ptrdiff_t)(n);
    emlrtPopRtStackR2012b(&rc_emlrtRSI, emlrtRootTLSGlobal);
    emlrtPopRtStackR2012b(&wh_emlrtRSI, emlrtRootTLSGlobal);
    emlrtPushRtStackR2012b(&xh_emlrtRSI, emlrtRootTLSGlobal);
    emlrtPushRtStackR2012b(&rc_emlrtRSI, emlrtRootTLSGlobal);
    emlrt_checkEscapedGlobals();
    k_t = (ptrdiff_t)(k);
    emlrtPopRtStackR2012b(&rc_emlrtRSI, emlrtRootTLSGlobal);
    emlrtPopRtStackR2012b(&xh_emlrtRSI, emlrtRootTLSGlobal);
    emlrtPushRtStackR2012b(&yh_emlrtRSI, emlrtRootTLSGlobal);
    emlrtPushRtStackR2012b(&rc_emlrtRSI, emlrtRootTLSGlobal);
    emlrt_checkEscapedGlobals();
    lda_t = (ptrdiff_t)(lda);
    emlrtPopRtStackR2012b(&rc_emlrtRSI, emlrtRootTLSGlobal);
    emlrtPopRtStackR2012b(&yh_emlrtRSI, emlrtRootTLSGlobal);
    emlrtPushRtStackR2012b(&ai_emlrtRSI, emlrtRootTLSGlobal);
    emlrtPushRtStackR2012b(&rc_emlrtRSI, emlrtRootTLSGlobal);
    emlrt_checkEscapedGlobals();
    ldb_t = (ptrdiff_t)(ldb);
    emlrtPopRtStackR2012b(&rc_emlrtRSI, emlrtRootTLSGlobal);
    emlrtPopRtStackR2012b(&ai_emlrtRSI, emlrtRootTLSGlobal);
    emlrtPushRtStackR2012b(&bi_emlrtRSI, emlrtRootTLSGlobal);
    emlrtPushRtStackR2012b(&rc_emlrtRSI, emlrtRootTLSGlobal);
    emlrt_checkEscapedGlobals();
    ldc_t = (ptrdiff_t)(ldc);
    emlrtPopRtStackR2012b(&rc_emlrtRSI, emlrtRootTLSGlobal);
    emlrtPopRtStackR2012b(&bi_emlrtRSI, emlrtRootTLSGlobal);
    emlrtPushRtStackR2012b(&ci_emlrtRSI, emlrtRootTLSGlobal);
    emlrt_checkEscapedGlobals();
    alpha1_t = (double *)(&alpha1);
    emlrtPopRtStackR2012b(&ci_emlrtRSI, emlrtRootTLSGlobal);
    emlrtPushRtStackR2012b(&di_emlrtRSI, emlrtRootTLSGlobal);
    emlrt_checkEscapedGlobals();
    Aia0_t = (double *)(&A->data[0]);
    emlrtPopRtStackR2012b(&di_emlrtRSI, emlrtRootTLSGlobal);
    emlrtPushRtStackR2012b(&ei_emlrtRSI, emlrtRootTLSGlobal);
    emlrt_checkEscapedGlobals();
    Bib0_t = (double *)(&B->data[0]);
    emlrtPopRtStackR2012b(&ei_emlrtRSI, emlrtRootTLSGlobal);
    emlrtPushRtStackR2012b(&fi_emlrtRSI, emlrtRootTLSGlobal);
    emlrt_checkEscapedGlobals();
    beta1_t = (double *)(&beta1);
    emlrtPopRtStackR2012b(&fi_emlrtRSI, emlrtRootTLSGlobal);
    emlrtPushRtStackR2012b(&gi_emlrtRSI, emlrtRootTLSGlobal);
    emlrt_checkEscapedGlobals();
    Cic0_t = (double *)(&C->data[0]);
    emlrtPopRtStackR2012b(&gi_emlrtRSI, emlrtRootTLSGlobal);
    emlrtPushRtStackR2012b(&hi_emlrtRSI, emlrtRootTLSGlobal);
    emlrt_checkEscapedGlobals();
    zgemm(&TRANSA, &TRANSB, &m_t, &n_t, &k_t, alpha1_t, Aia0_t, &lda_t, Bib0_t,
          &ldb_t, beta1_t, Cic0_t, &ldc_t);
    emlrtPopRtStackR2012b(&hi_emlrtRSI, emlrtRootTLSGlobal);
    emlrtPopRtStackR2012b(&ph_emlrtRSI, emlrtRootTLSGlobal);
  }

  emlrtPopRtStackR2012b(&nh_emlrtRSI, emlrtRootTLSGlobal);
}
Esempio n. 6
0
/* Function Definitions */
real_T b_norm(const emxArray_real_T *x)
{
    real_T y;
    int32_T n;
    ptrdiff_t n_t;
    ptrdiff_t incx_t;
    double * xix0_t;
    if ((x->size[0] == 1) || (x->size[1] == 1)) {
        emlrtPushRtStackR2012b(&ei_emlrtRSI, emlrtRootTLSGlobal);
        emlrtPushRtStackR2012b(&gi_emlrtRSI, emlrtRootTLSGlobal);
        n = x->size[0] * x->size[1];
        emlrtPushRtStackR2012b(&gc_emlrtRSI, emlrtRootTLSGlobal);
        if (1 > n) {
            y = 0.0;
        } else {
            emlrtPushRtStackR2012b(&ic_emlrtRSI, emlrtRootTLSGlobal);
            emlrtPushRtStackR2012b(&kc_emlrtRSI, emlrtRootTLSGlobal);
            emlrtPushRtStackR2012b(&nc_emlrtRSI, emlrtRootTLSGlobal);
            emlrt_checkEscapedGlobals();
            n_t = (ptrdiff_t)(n);
            emlrtPopRtStackR2012b(&nc_emlrtRSI, emlrtRootTLSGlobal);
            emlrtPopRtStackR2012b(&kc_emlrtRSI, emlrtRootTLSGlobal);
            emlrtPushRtStackR2012b(&lc_emlrtRSI, emlrtRootTLSGlobal);
            emlrtPushRtStackR2012b(&nc_emlrtRSI, emlrtRootTLSGlobal);
            emlrt_checkEscapedGlobals();
            incx_t = (ptrdiff_t)(1);
            emlrtPopRtStackR2012b(&nc_emlrtRSI, emlrtRootTLSGlobal);
            emlrtPopRtStackR2012b(&lc_emlrtRSI, emlrtRootTLSGlobal);
            emlrtPushRtStackR2012b(&mc_emlrtRSI, emlrtRootTLSGlobal);
            emlrt_checkEscapedGlobals();
            xix0_t = (double *)(&x->data[0]);
            emlrtPopRtStackR2012b(&mc_emlrtRSI, emlrtRootTLSGlobal);
            emlrt_checkEscapedGlobals();
            y = dnrm2(&n_t, xix0_t, &incx_t);
            emlrtPopRtStackR2012b(&ic_emlrtRSI, emlrtRootTLSGlobal);
        }

        emlrtPopRtStackR2012b(&gc_emlrtRSI, emlrtRootTLSGlobal);
        emlrtPopRtStackR2012b(&gi_emlrtRSI, emlrtRootTLSGlobal);
        emlrtPopRtStackR2012b(&ei_emlrtRSI, emlrtRootTLSGlobal);
    } else {
        emlrtPushRtStackR2012b(&fi_emlrtRSI, emlrtRootTLSGlobal);
        n = x->size[0] * x->size[1];
        emlrtPushRtStackR2012b(&gc_emlrtRSI, emlrtRootTLSGlobal);
        if (1 > n) {
            y = 0.0;
        } else {
            emlrtPushRtStackR2012b(&ic_emlrtRSI, emlrtRootTLSGlobal);
            emlrtPushRtStackR2012b(&kc_emlrtRSI, emlrtRootTLSGlobal);
            emlrtPushRtStackR2012b(&nc_emlrtRSI, emlrtRootTLSGlobal);
            emlrt_checkEscapedGlobals();
            n_t = (ptrdiff_t)(n);
            emlrtPopRtStackR2012b(&nc_emlrtRSI, emlrtRootTLSGlobal);
            emlrtPopRtStackR2012b(&kc_emlrtRSI, emlrtRootTLSGlobal);
            emlrtPushRtStackR2012b(&lc_emlrtRSI, emlrtRootTLSGlobal);
            emlrtPushRtStackR2012b(&nc_emlrtRSI, emlrtRootTLSGlobal);
            emlrt_checkEscapedGlobals();
            incx_t = (ptrdiff_t)(1);
            emlrtPopRtStackR2012b(&nc_emlrtRSI, emlrtRootTLSGlobal);
            emlrtPopRtStackR2012b(&lc_emlrtRSI, emlrtRootTLSGlobal);
            emlrtPushRtStackR2012b(&mc_emlrtRSI, emlrtRootTLSGlobal);
            emlrt_checkEscapedGlobals();
            xix0_t = (double *)(&x->data[0]);
            emlrtPopRtStackR2012b(&mc_emlrtRSI, emlrtRootTLSGlobal);
            emlrt_checkEscapedGlobals();
            y = dnrm2(&n_t, xix0_t, &incx_t);
            emlrtPopRtStackR2012b(&ic_emlrtRSI, emlrtRootTLSGlobal);
        }

        emlrtPopRtStackR2012b(&gc_emlrtRSI, emlrtRootTLSGlobal);
        emlrtPopRtStackR2012b(&fi_emlrtRSI, emlrtRootTLSGlobal);
    }

    return y;
}