Exemplo n.º 1
0
/* Function Definitions */
void b_sum(const emxArray_real_T *x, emxArray_real_T *y)
{
  uint32_T sz[2];
  int32_T iy;
  int32_T ixstart;
  int32_T j;
  real_T s;
  for (iy = 0; iy < 2; iy++) {
    sz[iy] = (uint32_T)x->size[iy];
  }

  iy = y->size[0];
  y->size[0] = (int32_T)sz[0];
  emxEnsureCapacity((emxArray__common *)y, iy, (int32_T)sizeof(real_T));
  if (x->size[0] == 0) {
    iy = y->size[0];
    y->size[0] = (int32_T)sz[0];
    emxEnsureCapacity((emxArray__common *)y, iy, (int32_T)sizeof(real_T));
    ixstart = (int32_T)sz[0];
    for (iy = 0; iy < ixstart; iy++) {
      y->data[iy] = 0.0;
    }
  } else {
    iy = -1;
    ixstart = -1;
    for (j = 1; j <= x->size[0]; j++) {
      ixstart++;
      s = x->data[ixstart] + x->data[ixstart + x->size[0]];
      iy++;
      y->data[iy] = s;
    }
  }
}
Exemplo n.º 2
0
 void Assign_otherMakers_1(emxArray_struct1_T *otherMakers, double
	visual_k, double frequency, double time, const emxArray_real_T *Position, int
	otherMakersN)
{
	struct1_T b_otherMakers;
	struct1_T c_otherMakers;
	int i1;
	int loop_ub;
	emxInitStruct_struct1_T(&b_otherMakers);
	emxInitStruct_struct1_T(&c_otherMakers);

	// % 给 otherMakers 赋值函数 1
	otherMakers->data[(int)visual_k - 1].frequency = frequency;
	otherMakers->data[(int)visual_k - 1].time = time;
	i1 = otherMakers->data[(int)visual_k - 1].Position->size[0] *
		otherMakers->data[(int)visual_k - 1].Position->size[1];
	otherMakers->data[(int)visual_k - 1].Position->size[0] = 3;
	emxEnsureCapacity((emxArray__common *)otherMakers->data[(int)visual_k - 1].
		Position, i1, (int)sizeof(double));
	i1 = otherMakers->data[(int)visual_k - 1].Position->size[0] *
		otherMakers->data[(int)visual_k - 1].Position->size[1];
	otherMakers->data[(int)visual_k - 1].Position->size[1] = Position->size[1];
	emxEnsureCapacity((emxArray__common *)otherMakers->data[(int)visual_k - 1].
		Position, i1, (int)sizeof(double));
	emxCopyStruct_struct1_T(&b_otherMakers, &otherMakers->data[(int)visual_k - 1]);
	emxCopyStruct_struct1_T(&c_otherMakers, &otherMakers->data[(int)visual_k - 1]);
	loop_ub = Position->size[0] * Position->size[1];
	emxFreeStruct_struct1_T(&c_otherMakers);
	emxFreeStruct_struct1_T(&b_otherMakers);
	for (i1 = 0; i1 < loop_ub; i1++) {
		otherMakers->data[(int)visual_k - 1].Position->data[i1] = Position->data[i1];
	}

	otherMakers->data[(int)visual_k - 1].otherMakersN = otherMakersN;
}
Exemplo n.º 3
0
/* Function Definitions */
void Cone(const emlrtStack *sp, real_T k, const emxArray_real_T *x, const
          emxArray_real_T *gridX, const emxArray_real_T *t, emxArray_real_T
          *vals)
{
    int32_T t_idx_0;
    int32_T i49;
    int32_T l;
    int32_T i50;
    int32_T i51;
    int32_T i52;
    int32_T i53;
    int32_T i54;
    emlrtStack st;
    st.prev = sp;
    st.tls = sp->tls;

    /*  calculate the matrix Cone for a specific space point x_k, for all times */
    /*  t_i in A */
    /*  points x_k=1:numel(spacePoints) */
    t_idx_0 = t->size[1];
    i49 = vals->size[0] * vals->size[1];
    vals->size[0] = t_idx_0;
    emxEnsureCapacity(sp, (emxArray__common *)vals, i49, (int32_T)sizeof(real_T),
                      &v_emlrtRTEI);
    t_idx_0 = x->size[1];
    i49 = vals->size[0] * vals->size[1];
    vals->size[1] = t_idx_0;
    emxEnsureCapacity(sp, (emxArray__common *)vals, i49, (int32_T)sizeof(real_T),
                      &v_emlrtRTEI);
    t_idx_0 = t->size[1] * x->size[1];
    for (i49 = 0; i49 < t_idx_0; i49++) {
        vals->data[i49] = 0.0;
    }

    t_idx_0 = 1;
    while (t_idx_0 - 1 <= t->size[1] - 1) {
        l = 0;
        while (l <= x->size[1] - 1) {
            i49 = vals->size[0];
            i50 = vals->size[1];
            i51 = 1 + l;
            i52 = x->size[1];
            i53 = (int32_T)emlrtIntegerCheckFastR2012b(k, &nb_emlrtDCI, sp);
            i54 = t->size[1];
            st.site = &le_emlrtRSI;
            vals->data[(emlrtDynamicBoundsCheckFastR2012b(t_idx_0, 1, i49,
                        &je_emlrtBCI, sp) + vals->size[0] * (emlrtDynamicBoundsCheckFastR2012b
                                (i51, 1, i50, &ke_emlrtBCI, sp) - 1)) - 1] = b_Ccoeff(&st, 1.0 + (real_T)
                                        l, x->data[emlrtDynamicBoundsCheckFastR2012b(i53, 1, i52, &le_emlrtBCI,
                                                   sp) - 1], t->data[emlrtDynamicBoundsCheckFastR2012b(t_idx_0, 1, i54,
                                                           &me_emlrtBCI, sp) - 1], gridX);
            l++;
            emlrtBreakCheckFastR2012b(emlrtBreakCheckR2012bFlagVar, sp);
        }

        t_idx_0++;
        emlrtBreakCheckFastR2012b(emlrtBreakCheckR2012bFlagVar, sp);
    }
}
Exemplo n.º 4
0
/* Function Definitions */
void b_sum(const emlrtStack *sp, const emxArray_real_T *x, emxArray_real_T *y)
{
  uint32_T sz[2];
  int32_T iy;
  int32_T ixstart;
  boolean_T overflow;
  int32_T j;
  int32_T ix;
  real_T s;
  int32_T k;
  emlrtStack st;
  emlrtStack b_st;
  st.prev = sp;
  st.tls = sp->tls;
  b_st.prev = &st;
  b_st.tls = st.tls;
  for (iy = 0; iy < 2; iy++) {
    sz[iy] = (uint32_T)x->size[iy];
  }

  iy = y->size[0];
  y->size[0] = (int32_T)sz[0];
  emxEnsureCapacity(sp, (emxArray__common *)y, iy, (int32_T)sizeof(real_T),
                    &q_emlrtRTEI);
  if (x->size[0] == 0) {
    iy = y->size[0];
    y->size[0] = (int32_T)sz[0];
    emxEnsureCapacity(sp, (emxArray__common *)y, iy, (int32_T)sizeof(real_T),
                      &sb_emlrtRTEI);
    ixstart = (int32_T)sz[0];
    for (iy = 0; iy < ixstart; iy++) {
      y->data[iy] = 0.0;
    }
  } else {
    iy = -1;
    ixstart = -1;
    st.site = &be_emlrtRSI;
    overflow = (x->size[0] > 2147483646);
    if (overflow) {
      b_st.site = &db_emlrtRSI;
      check_forloop_overflow_error(&b_st);
    }

    for (j = 1; j <= x->size[0]; j++) {
      ixstart++;
      ix = ixstart;
      s = x->data[ixstart];
      for (k = 0; k < 2; k++) {
        ix += x->size[0];
        s += x->data[ix];
      }

      iy++;
      y->data[iy] = s;
    }
  }
}
Exemplo n.º 5
0
Arquivo: diag.c Projeto: ofirENS/Utils
void diag(const emlrtStack *sp, const emxArray_real_T *v, emxArray_real_T *d)
{
  int32_T m;
  int32_T n;
  int32_T stride;
  boolean_T b1;
  emlrtStack st;
  emlrtStack b_st;
  st.prev = sp;
  st.tls = sp->tls;
  b_st.prev = &st;
  b_st.tls = st.tls;
  if ((v->size[0] == 1) && (v->size[1] == 1)) {
    m = d->size[0];
    d->size[0] = 1;
    emxEnsureCapacity(sp, (emxArray__common *)d, m, (int32_T)sizeof(real_T),
                      &g_emlrtRTEI);
    d->data[0] = v->data[0];
  } else {
    if (!((v->size[0] == 1) || (v->size[1] == 1))) {
    } else {
      emlrtErrorWithMessageIdR2012b(sp, &j_emlrtRTEI,
        "Coder:toolbox:diag_varsizedMatrixVector", 0);
    }

    m = v->size[0];
    n = v->size[1];
    if (0 < v->size[1]) {
      n = muIntScalarMin_sint32(m, n);
      stride = v->size[0] + 1;
    } else {
      n = 0;
      stride = 0;
    }

    m = d->size[0];
    d->size[0] = n;
    emxEnsureCapacity(sp, (emxArray__common *)d, m, (int32_T)sizeof(real_T),
                      &g_emlrtRTEI);
    st.site = &j_emlrtRSI;
    if (1 > n) {
      b1 = false;
    } else {
      b1 = (n > 2147483646);
    }

    if (b1) {
      b_st.site = &k_emlrtRSI;
      check_forloop_overflow_error(&b_st);
    }

    for (m = 0; m + 1 <= n; m++) {
      d->data[m] = v->data[m * stride];
    }
  }
}
Exemplo n.º 6
0
/*
 * 十进制数x转化为二进制数,二进制数至少表示为t位
 * Arguments    : double x
 *                double t
 *                emxArray_real_T *y
 * Return Type  : void
 */
void deci2bin(double x, double t, emxArray_real_T *y)
{
  int i2;
  int loop_ub;
  unsigned int i;
  int i3;
  int i4;
  emxArray_real_T *b_y;
  i2 = y->size[0] * y->size[1];
  y->size[0] = 1;
  y->size[1] = (int)t;
  emxEnsureCapacity((emxArray__common *)y, i2, (int)sizeof(double));
  loop_ub = (int)t;
  for (i2 = 0; i2 < loop_ub; i2++) {
    y->data[i2] = 0.0;
  }

  i = 1U;
  while ((x >= 0.0) && (i <= t)) {
    y->data[(int)i - 1] = rt_remd_snf(x, 2.0);
    x = (x - y->data[(int)i - 1]) / 2.0;
    i++;
  }

  if (1.0 > t) {
    i2 = 1;
    i3 = 1;
    i4 = 0;
  } else {
    i2 = (int)t;
    i3 = -1;
    i4 = 1;
  }

  emxInit_real_T(&b_y, 2);
  loop_ub = b_y->size[0] * b_y->size[1];
  b_y->size[0] = 1;
  b_y->size[1] = div_s32_floor(i4 - i2, i3) + 1;
  emxEnsureCapacity((emxArray__common *)b_y, loop_ub, (int)sizeof(double));
  loop_ub = div_s32_floor(i4 - i2, i3);
  for (i4 = 0; i4 <= loop_ub; i4++) {
    b_y->data[b_y->size[0] * i4] = y->data[(i2 + i3 * i4) - 1];
  }

  i2 = y->size[0] * y->size[1];
  y->size[0] = 1;
  y->size[1] = b_y->size[1];
  emxEnsureCapacity((emxArray__common *)y, i2, (int)sizeof(double));
  loop_ub = b_y->size[1];
  for (i2 = 0; i2 < loop_ub; i2++) {
    y->data[y->size[0] * i2] = b_y->data[b_y->size[0] * i2];
  }

  emxFree_real_T(&b_y);
}
Exemplo n.º 7
0
//
// Arguments    : const int varargin_1[2]
//                emxArray_uint8_T *b
// Return Type  : void
//
void b_repmat(const int varargin_1[2], emxArray_uint8_T *b)
{
  int i38;
  int loop_ub;
  i38 = b->size[0] * b->size[1];
  b->size[0] = varargin_1[0];
  emxEnsureCapacity((emxArray__common *)b, i38, (int)sizeof(unsigned char));
  i38 = b->size[0] * b->size[1];
  b->size[1] = varargin_1[1];
  emxEnsureCapacity((emxArray__common *)b, i38, (int)sizeof(unsigned char));
  loop_ub = varargin_1[0] * varargin_1[1];
  for (i38 = 0; i38 < loop_ub; i38++) {
    b->data[i38] = 0;
  }
}
Exemplo n.º 8
0
//
// Arguments    : const int varargin_1[2]
//                emxArray_real_T *b
// Return Type  : void
//
void repmat(const int varargin_1[2], emxArray_real_T *b)
{
  int i11;
  int loop_ub;
  i11 = b->size[0] * b->size[1];
  b->size[0] = varargin_1[0];
  emxEnsureCapacity((emxArray__common *)b, i11, (int)sizeof(double));
  i11 = b->size[0] * b->size[1];
  b->size[1] = varargin_1[1];
  emxEnsureCapacity((emxArray__common *)b, i11, (int)sizeof(double));
  loop_ub = varargin_1[0] * varargin_1[1];
  for (i11 = 0; i11 < loop_ub; i11++) {
    b->data[i11] = rtMinusInf;
  }
}
Exemplo n.º 9
0
void b_polyfit(const emxArray_real_T *x, const emxArray_real_T *y, double p[3])
{
  emxArray_real_T *V;
  int n;
  unsigned int unnamed_idx_0;
  int i22;
  int k;
  emxArray_real_T *b_y;
  double rr;
  double p1[3];
  emxInit_real_T(&V, 2);
  n = x->size[0] - 1;
  unnamed_idx_0 = (unsigned int)x->size[0];
  i22 = V->size[0] * V->size[1];
  V->size[0] = (int)unnamed_idx_0;
  V->size[1] = 3;
  emxEnsureCapacity((emxArray__common *)V, i22, (int)sizeof(double));
  if ((int)unnamed_idx_0 == 0) {
  } else {
    for (k = 0; k <= n; k++) {
      V->data[k + (V->size[0] << 1)] = 1.0;
    }

    for (k = 0; k <= n; k++) {
      V->data[k + V->size[0]] = x->data[k];
    }

    for (k = 0; k <= n; k++) {
      V->data[k] = x->data[k] * V->data[k + V->size[0]];
    }
  }

  b_emxInit_real_T(&b_y, 1);
  i22 = b_y->size[0];
  b_y->size[0] = y->size[0];
  emxEnsureCapacity((emxArray__common *)b_y, i22, (int)sizeof(double));
  k = y->size[0];
  for (i22 = 0; i22 < k; i22++) {
    b_y->data[i22] = y->data[i22];
  }

  b_eml_qrsolve(V, b_y, p1, &rr);
  emxFree_real_T(&b_y);
  emxFree_real_T(&V);
  for (i22 = 0; i22 < 3; i22++) {
    p[i22] = p1[i22];
  }
}
Exemplo n.º 10
0
/*
 * Arguments    : emxArray_real_T *A
 *                const emxArray_real_T *B
 * Return Type  : void
 */
void b_mrdivide(emxArray_real_T *A, const emxArray_real_T *B)
{
  emxArray_real_T *b_B;
  emxArray_real_T *b_A;
  int i8;
  int loop_ub;
  double d2;
  emxInit_real_T1(&b_B, 1);
  emxInit_real_T1(&b_A, 1);
  if ((A->size[1] == 0) || (B->size[1] == 0)) {
    i8 = A->size[0] * A->size[1];
    A->size[0] = 1;
    A->size[1] = 1;
    emxEnsureCapacity((emxArray__common *)A, i8, (int)sizeof(double));
    A->data[0] = 0.0;
  } else if (1 == B->size[1]) {
    if (A->size[1] == 0) {
    } else {
      A->data[0] *= 1.0 / B->data[0];
    }
  } else {
    i8 = b_B->size[0];
    b_B->size[0] = B->size[1];
    emxEnsureCapacity((emxArray__common *)b_B, i8, (int)sizeof(double));
    loop_ub = B->size[1];
    for (i8 = 0; i8 < loop_ub; i8++) {
      b_B->data[i8] = B->data[B->size[0] * i8];
    }

    i8 = b_A->size[0];
    b_A->size[0] = A->size[1];
    emxEnsureCapacity((emxArray__common *)b_A, i8, (int)sizeof(double));
    loop_ub = A->size[1];
    for (i8 = 0; i8 < loop_ub; i8++) {
      b_A->data[i8] = A->data[A->size[0] * i8];
    }

    d2 = qrsolve(b_B, b_A);
    i8 = A->size[0] * A->size[1];
    A->size[0] = 1;
    A->size[1] = 1;
    emxEnsureCapacity((emxArray__common *)A, i8, (int)sizeof(double));
    A->data[0] = d2;
  }

  emxFree_real_T(&b_A);
  emxFree_real_T(&b_B);
}
Exemplo n.º 11
0
/*
 * Arguments    : emxArray_real_T *x
 * Return Type  : void
 */
void d_sort(emxArray_real_T *x)
{
  emxArray_real_T *vwork;
  int i9;
  int k;
  int i10;
  emxArray_int32_T *b_vwork;
  emxInit_real_T2(&vwork, 1);
  i9 = x->size[1];
  k = x->size[1];
  i10 = vwork->size[0];
  vwork->size[0] = k;
  emxEnsureCapacity((emxArray__common *)vwork, i10, (int)sizeof(double));
  for (k = 0; k + 1 <= i9; k++) {
    vwork->data[k] = x->data[k];
  }

  emxInit_int32_T(&b_vwork, 1);
  sortIdx(vwork, b_vwork);
  k = 0;
  emxFree_int32_T(&b_vwork);
  while (k + 1 <= i9) {
    x->data[k] = vwork->data[k];
    k++;
  }

  emxFree_real_T(&vwork);
}
Exemplo n.º 12
0
void eye(real_T n, emxArray_real_T *I)
{
  int32_T q;
  int32_T loop_ub;
  real_T d0;
  q = I->size[0] * I->size[1];
  I->size[0] = (int32_T)n;
  I->size[1] = (int32_T)n;
  emxEnsureCapacity((emxArray__common *)I, q, (int32_T)sizeof(real_T));
  loop_ub = (int32_T)n * (int32_T)n - 1;
  for (q = 0; q <= loop_ub; q++) {
    I->data[q] = 0.0;
  }

  d0 = rt_roundd_snf(n);
  if (d0 < 2.147483648E+9) {
    if (d0 >= -2.147483648E+9) {
      q = (int32_T)d0;
    } else {
      q = MIN_int32_T;
    }
  } else if (d0 >= 2.147483648E+9) {
    q = MAX_int32_T;
  } else {
    q = 0;
  }

  if (q > 0) {
    for (loop_ub = 0; loop_ub + 1 <= q; loop_ub++) {
      I->data[loop_ub + I->size[0] * loop_ub] = 1.0;
    }
  }
}
Exemplo n.º 13
0
/*
 * Arguments    : double x_data[]
 *                int x_size[1]
 * Return Type  : void
 */
void sort(double x_data[], int x_size[1])
{
  int dim;
  int i6;
  double vwork_data[252];
  int vwork_size_idx_0;
  int vstride;
  int k;
  int j;
  emxArray_real_T *vwork;
  emxArray_int32_T *b_vwork;
  dim = nonSingletonDim(x_size);
  if (dim <= 1) {
    i6 = x_size[0];
  } else {
    i6 = 1;
  }

  vwork_size_idx_0 = (unsigned char)i6;
  vstride = 1;
  k = 1;
  while (k <= dim - 1) {
    vstride *= x_size[0];
    k = 2;
  }

  j = 0;
  emxInit_real_T2(&vwork, 1);
  emxInit_int32_T(&b_vwork, 1);
  while (j + 1 <= vstride) {
    for (k = 0; k + 1 <= i6; k++) {
      vwork_data[k] = x_data[j + k * vstride];
    }

    dim = vwork->size[0];
    vwork->size[0] = vwork_size_idx_0;
    emxEnsureCapacity((emxArray__common *)vwork, dim, (int)sizeof(double));
    for (dim = 0; dim < vwork_size_idx_0; dim++) {
      vwork->data[dim] = vwork_data[dim];
    }

    sortIdx(vwork, b_vwork);
    vwork_size_idx_0 = vwork->size[0];
    k = vwork->size[0];
    for (dim = 0; dim < k; dim++) {
      vwork_data[dim] = vwork->data[dim];
    }

    for (k = 0; k + 1 <= i6; k++) {
      x_data[j + k * vstride] = vwork->data[k];
    }

    j++;
  }

  emxFree_int32_T(&b_vwork);
  emxFree_real_T(&vwork);
}
Exemplo n.º 14
0
void c_sum(const emxArray_real_T *x, emxArray_real_T *y)
{
  uint32_T sz[2];
  int32_T ixstart;
  int32_T k;
  int32_T ix;
  int32_T iy;
  int32_T i;
  real_T s;
  for (ixstart = 0; ixstart < 2; ixstart++) {
    sz[ixstart] = (uint32_T)x->size[ixstart];
  }

  ixstart = y->size[0] * y->size[1];
  y->size[0] = 1;
  y->size[1] = (int32_T)sz[1];
  emxEnsureCapacity((emxArray__common *)y, ixstart, (int32_T)sizeof(real_T));
  if ((x->size[0] == 0) || (x->size[1] == 0)) {
    ixstart = y->size[0] * y->size[1];
    y->size[0] = 1;
    emxEnsureCapacity((emxArray__common *)y, ixstart, (int32_T)sizeof(real_T));
    ixstart = y->size[0] * y->size[1];
    y->size[1] = (int32_T)sz[1];
    emxEnsureCapacity((emxArray__common *)y, ixstart, (int32_T)sizeof(real_T));
    k = (int32_T)sz[1];
    for (ixstart = 0; ixstart < k; ixstart++) {
      y->data[ixstart] = 0.0;
    }
  } else {
    ix = -1;
    iy = -1;
    for (i = 1; i <= x->size[1]; i++) {
      ixstart = ix + 1;
      ix++;
      s = x->data[ixstart];
      for (k = 2; k <= x->size[0]; k++) {
        ix++;
        s += x->data[ix];
      }

      iy++;
      y->data[iy] = s;
    }
  }
}
Exemplo n.º 15
0
Arquivo: diag.c Projeto: ofirENS/Utils
/* Function Definitions */
void b_diag(const emlrtStack *sp, const emxArray_real_T *v, emxArray_real_T *d)
{
  int32_T j;
  int32_T unnamed_idx_1;
  int32_T i3;
  boolean_T overflow;
  emlrtStack st;
  emlrtStack b_st;
  st.prev = sp;
  st.tls = sp->tls;
  b_st.prev = &st;
  b_st.tls = st.tls;
  j = v->size[0];
  unnamed_idx_1 = v->size[0];
  i3 = d->size[0] * d->size[1];
  d->size[0] = j;
  emxEnsureCapacity(sp, (emxArray__common *)d, i3, (int32_T)sizeof(real_T),
                    &g_emlrtRTEI);
  i3 = d->size[0] * d->size[1];
  d->size[1] = unnamed_idx_1;
  emxEnsureCapacity(sp, (emxArray__common *)d, i3, (int32_T)sizeof(real_T),
                    &g_emlrtRTEI);
  j *= unnamed_idx_1;
  for (i3 = 0; i3 < j; i3++) {
    d->data[i3] = 0.0;
  }

  st.site = &l_emlrtRSI;
  if (1 > v->size[0]) {
    overflow = false;
  } else {
    overflow = (v->size[0] > 2147483646);
  }

  if (overflow) {
    b_st.site = &k_emlrtRSI;
    check_forloop_overflow_error(&b_st);
  }

  for (j = 0; j + 1 <= v->size[0]; j++) {
    d->data[j + d->size[0] * j] = v->data[j];
  }
}
Exemplo n.º 16
0
void diag(const emlrtStack *sp, const emxArray_real_T *v, emxArray_real_T *d)
{
  int32_T unnamed_idx_0;
  int32_T unnamed_idx_1;
  int32_T i76;
  boolean_T overflow;
  emlrtStack st;
  emlrtStack b_st;
  st.prev = sp;
  st.tls = sp->tls;
  b_st.prev = &st;
  b_st.tls = st.tls;
  unnamed_idx_0 = v->size[1] + 1;
  unnamed_idx_1 = v->size[1] + 1;
  i76 = d->size[0] * d->size[1];
  d->size[0] = unnamed_idx_0;
  emxEnsureCapacity(sp, (emxArray__common *)d, i76, (int32_T)sizeof(real_T),
                    &ib_emlrtRTEI);
  i76 = d->size[0] * d->size[1];
  d->size[1] = unnamed_idx_1;
  emxEnsureCapacity(sp, (emxArray__common *)d, i76, (int32_T)sizeof(real_T),
                    &ib_emlrtRTEI);
  unnamed_idx_0 *= unnamed_idx_1;
  for (i76 = 0; i76 < unnamed_idx_0; i76++) {
    d->data[i76] = 0.0;
  }

  st.site = &lf_emlrtRSI;
  if (1 > v->size[1]) {
    overflow = false;
  } else {
    overflow = (v->size[1] > 2147483646);
  }

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

  for (unnamed_idx_0 = 1; unnamed_idx_0 <= v->size[1]; unnamed_idx_0++) {
    d->data[unnamed_idx_0 + d->size[0] * (unnamed_idx_0 - 1)] = 1.0;
  }
}
Exemplo n.º 17
0
void e_power(const emxArray_real_T *a, emxArray_real_T *y)
{
  int k;
  k = y->size[0] * y->size[1];
  y->size[0] = 1;
  y->size[1] = a->size[1];
  emxEnsureCapacity((emxArray__common *)y, k, sizeof(double));
  for (k = 0; k + 1 <= a->size[1]; k++) {
    y->data[k] = a->data[k] * a->data[k];
  }
}
Exemplo n.º 18
0
void sum(const emxArray_real_T *x, emxArray_real_T *y)
{
  uint32_T sz[2];
  int32_T iy;
  int32_T ixstart;
  int32_T j;
  int32_T ix;
  real_T s;
  int32_T k;
  for (iy = 0; iy < 2; iy++) {
    sz[iy] = (uint32_T)x->size[iy];
  }

  iy = y->size[0];
  y->size[0] = (int32_T)sz[0];
  emxEnsureCapacity((emxArray__common *)y, iy, (int32_T)sizeof(real_T));
  if ((x->size[0] == 0) || (x->size[1] == 0)) {
    iy = y->size[0];
    y->size[0] = (int32_T)sz[0];
    emxEnsureCapacity((emxArray__common *)y, iy, (int32_T)sizeof(real_T));
    ixstart = (int32_T)sz[0];
    for (iy = 0; iy < ixstart; iy++) {
      y->data[iy] = 0.0;
    }
  } else {
    iy = -1;
    ixstart = -1;
    for (j = 1; j <= x->size[0]; j++) {
      ixstart++;
      ix = ixstart;
      s = x->data[ixstart];
      for (k = 2; k <= x->size[1]; k++) {
        ix += x->size[0];
        s += x->data[ix];
      }

      iy++;
      y->data[iy] = s;
    }
  }
}
Exemplo n.º 19
0
void rdivide(const emxArray_real_T *x, double y, emxArray_real_T *z)
{
  int i3;
  int loop_ub;
  i3 = z->size[0];
  z->size[0] = x->size[0];
  emxEnsureCapacity((emxArray__common *)z, i3, (int)sizeof(double));
  loop_ub = x->size[0];
  for (i3 = 0; i3 < loop_ub; i3++) {
    z->data[i3] = x->data[i3] / y;
  }
}
Exemplo n.º 20
0
/* Function Definitions */
void rdivide(const emxArray_real_T *x, real_T y, emxArray_real_T *z)
{
  int32_T i1;
  int32_T loop_ub;
  i1 = z->size[0];
  z->size[0] = x->size[0];
  emxEnsureCapacity((emxArray__common *)z, i1, (int32_T)sizeof(real_T));
  loop_ub = x->size[0] - 1;
  for (i1 = 0; i1 <= loop_ub; i1++) {
    z->data[i1] = x->data[i1] / y;
  }
}
Exemplo n.º 21
0
void g_rdivide(const emxArray_real_T *y, emxArray_real_T *z)
{
  int i18;
  int loop_ub;
  i18 = z->size[0];
  z->size[0] = y->size[0];
  emxEnsureCapacity((emxArray__common *)z, i18, (int)sizeof(double));
  loop_ub = y->size[0];
  for (i18 = 0; i18 < loop_ub; i18++) {
    z->data[i18] = 1.0 / y->data[i18];
  }
}
Exemplo n.º 22
0
/*
 * Arguments    : const emxArray_real_T *a
 *                emxArray_real_T *y
 * Return Type  : void
 */
void b_power(const emxArray_real_T *a, emxArray_real_T *y)
{
  unsigned int unnamed_idx_0;
  int k;
  unnamed_idx_0 = (unsigned int)a->size[0];
  k = y->size[0];
  y->size[0] = (int)unnamed_idx_0;
  emxEnsureCapacity((emxArray__common *)y, k, (int)sizeof(double));
  for (k = 0; k < (int)unnamed_idx_0; k++) {
    y->data[k] = a->data[k] * a->data[k];
  }
}
Exemplo n.º 23
0
void l_power(const emxArray_real_T *a, emxArray_real_T *y)
{
  unsigned int a_idx_0;
  int k;
  a_idx_0 = (unsigned int)a->size[0];
  k = y->size[0];
  y->size[0] = (int)a_idx_0;
  emxEnsureCapacity((emxArray__common *)y, k, sizeof(double));
  for (k = 0; k + 1 <= a->size[0]; k++) {
    y->data[k] = sqrt(a->data[k]);
  }
}
Exemplo n.º 24
0
/* Function Definitions */
void b_abs(const emxArray_real_T *x, emxArray_real_T *y)
{
  unsigned int unnamed_idx_0;
  int k;
  unnamed_idx_0 = (unsigned int)x->size[0];
  k = y->size[0];
  y->size[0] = (int)unnamed_idx_0;
  emxEnsureCapacity((emxArray__common *)y, k, (int)sizeof(double));
  for (k = 0; k < x->size[0]; k++) {
    y->data[k] = fabs(x->data[k]);
  }
}
Exemplo n.º 25
0
void f_rdivide(double x, const emxArray_real_T *y, emxArray_real_T *z)
{
  int i15;
  int loop_ub;
  i15 = z->size[0] * z->size[1];
  z->size[0] = 1;
  z->size[1] = y->size[1];
  emxEnsureCapacity((emxArray__common *)z, i15, (int)sizeof(double));
  loop_ub = y->size[0] * y->size[1];
  for (i15 = 0; i15 < loop_ub; i15++) {
    z->data[i15] = x / y->data[i15];
  }
}
Exemplo n.º 26
0
void d_rdivide(const emxArray_real_T *x, const emxArray_real_T *y,
               emxArray_real_T *z)
{
  int i10;
  int loop_ub;
  i10 = z->size[0];
  z->size[0] = x->size[0];
  emxEnsureCapacity((emxArray__common *)z, i10, (int)sizeof(double));
  loop_ub = x->size[0];
  for (i10 = 0; i10 < loop_ub; i10++) {
    z->data[i10] = x->data[i10] / y->data[i10];
  }
}
Exemplo n.º 27
0
void c_rdivide(const emxArray_real_T *x, double y, emxArray_real_T *z)
{
  int i4;
  int loop_ub;
  i4 = z->size[0] * z->size[1];
  z->size[0] = 1;
  z->size[1] = x->size[1];
  emxEnsureCapacity((emxArray__common *)z, i4, (int)sizeof(double));
  loop_ub = x->size[0] * x->size[1];
  for (i4 = 0; i4 < loop_ub; i4++) {
    z->data[i4] = x->data[i4] / y;
  }
}
Exemplo n.º 28
0
void b_mldivide(const real32_T A[16], const emxArray_real32_T *B,
                emxArray_real32_T *Y)
{
  int32_T i4;
  if (B->size[1] == 0) {
    i4 = Y->size[0] * Y->size[1];
    Y->size[0] = 4;
    Y->size[1] = 0;
    emxEnsureCapacity((emxArray__common *)Y, i4, (int32_T)sizeof(real32_T));
  } else {
    b_eml_lusolve(A, B, Y);
  }
}
Exemplo n.º 29
0
/* Function Definitions */
void b_abs(const emxArray_real_T *x, emxArray_real_T *y)
{
  uint32_T unnamed_idx_0;
  int32_T k;
  unnamed_idx_0 = (uint32_T)x->size[0];
  k = y->size[0];
  y->size[0] = (int32_T)unnamed_idx_0;
  emxEnsureCapacity((emxArray__common *)y, k, (int32_T)sizeof(real_T),
                    &gb_emlrtRTEI);
  for (k = 0; k < x->size[0]; k++) {
    y->data[k] = muDoubleScalarAbs(x->data[k]);
  }
}
Exemplo n.º 30
0
void mldivide(const real32_T A[9], const emxArray_real32_T *B, emxArray_real32_T
              *Y)
{
  int32_T i1;
  if (B->size[1] == 0) {
    i1 = Y->size[0] * Y->size[1];
    Y->size[0] = 3;
    Y->size[1] = 0;
    emxEnsureCapacity((emxArray__common *)Y, i1, (int32_T)sizeof(real32_T));
  } else {
    eml_lusolve(A, B, Y);
  }
}