/* * mpower.c * * Code generation for function 'mpower' * * C source code generated on: Wed Aug 26 14:59:33 2015 * */ /* Include files */ #include "rt_nonfinite.h" #include "Select_Ground_Motions.h" #include "mpower.h" #include "Select_Ground_Motions_emxutil.h" #include "skew.h" #include "Select_Ground_Motions_mexutil.h" #include "Select_Ground_Motions_data.h" /* Variable Definitions */ static emlrtRSInfo qd_emlrtRSI = { 33, "mpower", "/usr/local/MATLAB/R2013a/toolbox/eml/lib/matlab/ops/mpower.m" }; static emlrtRSInfo rd_emlrtRSI = { 41, "mpower", "/usr/local/MATLAB/R2013a/toolbox/eml/lib/matlab/ops/mpower.m" }; static emlrtRSInfo sd_emlrtRSI = { 64, "mpower", "/usr/local/MATLAB/R2013a/toolbox/eml/lib/matlab/ops/mpower.m" }; static emlrtRSInfo td_emlrtRSI = { 71, "mpower", "/usr/local/MATLAB/R2013a/toolbox/eml/lib/matlab/ops/mpower.m" }; static emlrtMCInfo p_emlrtMCI = { 34, 5, "mpower", "/usr/local/MATLAB/R2013a/toolbox/eml/lib/matlab/ops/mpower.m" }; static emlrtMCInfo q_emlrtMCI = { 33, 15, "mpower", "/usr/local/MATLAB/R2013a/toolbox/eml/lib/matlab/ops/mpower.m" }; static emlrtRTEInfo bb_emlrtRTEI = { 1, 14, "mpower", "/usr/local/MATLAB/R2013a/toolbox/eml/lib/matlab/ops/mpower.m" }; static emlrtRTEInfo cb_emlrtRTEI = { 52, 1, "mpower", "/usr/local/MATLAB/R2013a/toolbox/eml/lib/matlab/ops/mpower.m" }; /* Function Definitions */ real_T b_mpower(real_T a) { real_T c; emlrtPushRtStackR2012b(&wq_emlrtRSI, emlrtRootTLSGlobal); emlrtPushRtStackR2012b(&hd_emlrtRSI, emlrtRootTLSGlobal); if (a < 0.0) { emlrtPushRtStackR2012b(&id_emlrtRSI, emlrtRootTLSGlobal); eml_error(); emlrtPopRtStackR2012b(&id_emlrtRSI, emlrtRootTLSGlobal); } c = muDoubleScalarPower(a, 1.18); emlrtPopRtStackR2012b(&hd_emlrtRSI, emlrtRootTLSGlobal); emlrtPopRtStackR2012b(&wq_emlrtRSI, emlrtRootTLSGlobal); return c; } real_T c_mpower(real_T a) { return 1.0 / a; } void mpower(const emxArray_real_T *a, emxArray_real_T *c) { boolean_T firstmult; const mxArray *y; static const int32_T iv22[2] = { 1, 19 }; const mxArray *m4; char_T cv20[19]; int32_T i; static const char_T cv21[19] = { 'C', 'o', 'd', 'e', 'r', ':', 'M', 'A', 'T', 'L', 'A', 'B', ':', 's', 'q', 'u', 'a', 'r', 'e' }; emxArray_real_T *b_a; int32_T i4; uint32_T uv0[2]; real_T e; emxArray_real_T *c_a; int32_T exitg1; real_T ed2; int32_T b_c[2]; int32_T loop_ub; int32_T i5; const mxArray *b_y; static const int32_T iv23[2] = { 1, 45 }; char_T cv22[45]; static const char_T cv23[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 iv24[2] = { 1, 21 }; char_T cv24[21]; static const char_T cv25[21] = { 'C', 'o', 'd', 'e', 'r', ':', 'M', 'A', 'T', 'L', 'A', 'B', ':', 'i', 'n', 'n', 'e', 'r', 'd', 'i', 'm' }; real_T c_c; const mxArray *d_y; static const int32_T iv25[2] = { 1, 45 }; const mxArray *e_y; static const int32_T iv26[2] = { 1, 21 }; emlrtHeapReferenceStackEnterFcnR2012b(emlrtRootTLSGlobal); firstmult = (1 == a->size[1]); if (firstmult) { } else { emlrtPushRtStackR2012b(&qd_emlrtRSI, emlrtRootTLSGlobal); y = NULL; m4 = mxCreateCharArray(2, iv22); for (i = 0; i < 19; i++) { cv20[i] = cv21[i]; } emlrtInitCharArrayR2013a(emlrtRootTLSGlobal, 19, m4, cv20); emlrtAssign(&y, m4); error(message(y, &p_emlrtMCI), &q_emlrtMCI); emlrtPopRtStackR2012b(&qd_emlrtRSI, emlrtRootTLSGlobal); } b_emxInit_real_T(&b_a, 2, &bb_emlrtRTEI, TRUE); emlrtPushRtStackR2012b(&rd_emlrtRSI, emlrtRootTLSGlobal); i4 = b_a->size[0] * b_a->size[1]; b_a->size[0] = 1; b_a->size[1] = a->size[1]; emxEnsureCapacity((emxArray__common *)b_a, i4, (int32_T)sizeof(real_T), &bb_emlrtRTEI); i = a->size[0] * a->size[1]; for (i4 = 0; i4 < i; i4++) { b_a->data[i4] = a->data[i4]; } for (i4 = 0; i4 < 2; i4++) { uv0[i4] = (uint32_T)a->size[i4]; } i4 = c->size[0] * c->size[1]; c->size[0] = 1; c->size[1] = (int32_T)uv0[1]; emxEnsureCapacity((emxArray__common *)c, i4, (int32_T)sizeof(real_T), &cb_emlrtRTEI); e = 2.0; firstmult = TRUE; emxInit_real_T(&c_a, 1, &bb_emlrtRTEI, TRUE); do { exitg1 = 0; ed2 = muDoubleScalarFloor(e / 2.0); if (2.0 * ed2 != e) { if (firstmult) { i = b_a->size[1]; i4 = c_a->size[0]; c_a->size[0] = i; emxEnsureCapacity((emxArray__common *)c_a, i4, (int32_T)sizeof(real_T), &bb_emlrtRTEI); for (i4 = 0; i4 < i; i4++) { c_a->data[i4] = b_a->data[i4]; } for (i4 = 0; i4 < 2; i4++) { b_c[i4] = c->size[i4]; } i4 = c->size[0] * c->size[1]; c->size[0] = b_c[0]; c->size[1] = b_c[1]; emxEnsureCapacity((emxArray__common *)c, i4, (int32_T)sizeof(real_T), &bb_emlrtRTEI); i = b_c[1]; for (i4 = 0; i4 < i; i4++) { loop_ub = b_c[0]; for (i5 = 0; i5 < loop_ub; i5++) { c->data[i5 + c->size[0] * i4] = c_a->data[i5 + b_c[0] * i4]; } } firstmult = FALSE; } else { emlrtPushRtStackR2012b(&sd_emlrtRSI, emlrtRootTLSGlobal); emlrtPushRtStackR2012b(&ud_emlrtRSI, emlrtRootTLSGlobal); if (!(c->size[1] == 1)) { if ((c->size[1] == 1) || (b_a->size[1] == 1)) { emlrtPushRtStackR2012b(&wd_emlrtRSI, emlrtRootTLSGlobal); b_y = NULL; m4 = mxCreateCharArray(2, iv23); for (i = 0; i < 45; i++) { cv22[i] = cv23[i]; } emlrtInitCharArrayR2013a(emlrtRootTLSGlobal, 45, m4, cv22); emlrtAssign(&b_y, m4); error(message(b_y, &r_emlrtMCI), &s_emlrtMCI); emlrtPopRtStackR2012b(&wd_emlrtRSI, emlrtRootTLSGlobal); } else { emlrtPushRtStackR2012b(&vd_emlrtRSI, emlrtRootTLSGlobal); c_y = NULL; m4 = mxCreateCharArray(2, iv24); for (i = 0; i < 21; i++) { cv24[i] = cv25[i]; } emlrtInitCharArrayR2013a(emlrtRootTLSGlobal, 21, m4, cv24); emlrtAssign(&c_y, m4); error(message(c_y, &t_emlrtMCI), &u_emlrtMCI); emlrtPopRtStackR2012b(&vd_emlrtRSI, emlrtRootTLSGlobal); } } emlrtPopRtStackR2012b(&ud_emlrtRSI, emlrtRootTLSGlobal); c_c = c->data[0]; i4 = c->size[0] * c->size[1]; c->size[0] = 1; c->size[1] = b_a->size[1]; emxEnsureCapacity((emxArray__common *)c, i4, (int32_T)sizeof(real_T), &bb_emlrtRTEI); i = b_a->size[1]; for (i4 = 0; i4 < i; i4++) { c->data[c->size[0] * i4] = c_c * b_a->data[b_a->size[0] * i4]; } emlrtPopRtStackR2012b(&sd_emlrtRSI, emlrtRootTLSGlobal); } } if (ed2 == 0.0) { exitg1 = 1; } else { e = ed2; emlrtPushRtStackR2012b(&td_emlrtRSI, emlrtRootTLSGlobal); emlrtPushRtStackR2012b(&ud_emlrtRSI, emlrtRootTLSGlobal); if (!(b_a->size[1] == 1)) { if ((b_a->size[1] == 1) || (b_a->size[1] == 1)) { emlrtPushRtStackR2012b(&wd_emlrtRSI, emlrtRootTLSGlobal); d_y = NULL; m4 = mxCreateCharArray(2, iv25); for (i = 0; i < 45; i++) { cv22[i] = cv23[i]; } emlrtInitCharArrayR2013a(emlrtRootTLSGlobal, 45, m4, cv22); emlrtAssign(&d_y, m4); error(message(d_y, &r_emlrtMCI), &s_emlrtMCI); emlrtPopRtStackR2012b(&wd_emlrtRSI, emlrtRootTLSGlobal); } else { emlrtPushRtStackR2012b(&vd_emlrtRSI, emlrtRootTLSGlobal); e_y = NULL; m4 = mxCreateCharArray(2, iv26); for (i = 0; i < 21; i++) { cv24[i] = cv25[i]; } emlrtInitCharArrayR2013a(emlrtRootTLSGlobal, 21, m4, cv24); emlrtAssign(&e_y, m4); error(message(e_y, &t_emlrtMCI), &u_emlrtMCI); emlrtPopRtStackR2012b(&vd_emlrtRSI, emlrtRootTLSGlobal); } } emlrtPopRtStackR2012b(&ud_emlrtRSI, emlrtRootTLSGlobal); c_c = b_a->data[0]; i4 = b_a->size[0] * b_a->size[1]; b_a->size[0] = 1; emxEnsureCapacity((emxArray__common *)b_a, i4, (int32_T)sizeof(real_T), &bb_emlrtRTEI); i = b_a->size[1]; for (i4 = 0; i4 < i; i4++) { b_a->data[b_a->size[0] * i4] *= c_c; } emlrtPopRtStackR2012b(&td_emlrtRSI, emlrtRootTLSGlobal); } } while (exitg1 == 0); emxFree_real_T(&c_a); emxFree_real_T(&b_a); emlrtPopRtStackR2012b(&rd_emlrtRSI, emlrtRootTLSGlobal); emlrtHeapReferenceStackLeaveFcnR2012b(emlrtRootTLSGlobal); } /* End of code generation (mpower.c) */