/* * inv.c * * Code generation for function 'inv' * * C source code generated on: Wed Aug 26 14:59:33 2015 * */ /* Include files */ #include "rt_nonfinite.h" #include "Select_Ground_Motions.h" #include "inv.h" #include "norm.h" #include "Select_Ground_Motions_emxutil.h" #include "Select_Ground_Motions_mexutil.h" #include "Select_Ground_Motions_data.h" /* Variable Definitions */ static emlrtRSInfo xd_emlrtRSI = { 14, "inv", "/usr/local/MATLAB/R2013a/toolbox/eml/lib/matlab/matfun/inv.m" }; static emlrtRSInfo yd_emlrtRSI = { 18, "inv", "/usr/local/MATLAB/R2013a/toolbox/eml/lib/matlab/matfun/inv.m" }; static emlrtRSInfo ce_emlrtRSI = { 40, "inv", "/usr/local/MATLAB/R2013a/toolbox/eml/lib/matlab/matfun/inv.m" }; static emlrtRSInfo de_emlrtRSI = { 44, "inv", "/usr/local/MATLAB/R2013a/toolbox/eml/lib/matlab/matfun/inv.m" }; static emlrtMCInfo v_emlrtMCI = { 15, 5, "inv", "/usr/local/MATLAB/R2013a/toolbox/eml/lib/matlab/matfun/inv.m" }; static emlrtMCInfo w_emlrtMCI = { 14, 15, "inv", "/usr/local/MATLAB/R2013a/toolbox/eml/lib/matlab/matfun/inv.m" }; static emlrtRTEInfo eb_emlrtRTEI = { 1, 14, "inv", "/usr/local/MATLAB/R2013a/toolbox/eml/lib/matlab/matfun/inv.m" }; /* Function Declarations */ static void b_eml_warning(const char_T varargin_2[14]); /* Function Definitions */ static void b_eml_warning(const char_T varargin_2[14]) { const mxArray *y; static const int32_T iv30[2] = { 1, 33 }; const mxArray *m7; char_T cv32[33]; int32_T i; static const char_T cv33[33] = { 'C', 'o', 'd', 'e', 'r', ':', 'M', 'A', 'T', 'L', 'A', 'B', ':', 'i', 'l', 'l', 'C', 'o', 'n', 'd', 'i', 't', 'i', 'o', 'n', 'e', 'd', 'M', 'a', 't', 'r', 'i', 'x' }; const mxArray *b_y; static const int32_T iv31[2] = { 1, 14 }; char_T b_varargin_2[14]; emlrtPushRtStackR2012b(&ee_emlrtRSI, emlrtRootTLSGlobal); y = NULL; m7 = mxCreateCharArray(2, iv30); for (i = 0; i < 33; i++) { cv32[i] = cv33[i]; } emlrtInitCharArrayR2013a(emlrtRootTLSGlobal, 33, m7, cv32); emlrtAssign(&y, m7); b_y = NULL; m7 = mxCreateCharArray(2, iv31); for (i = 0; i < 14; i++) { b_varargin_2[i] = varargin_2[i]; } emlrtInitCharArrayR2013a(emlrtRootTLSGlobal, 14, m7, b_varargin_2); emlrtAssign(&b_y, m7); warning(b_message(y, b_y, &x_emlrtMCI), &y_emlrtMCI); emlrtPopRtStackR2012b(&ee_emlrtRSI, emlrtRootTLSGlobal); } void eml_warning(void) { const mxArray *y; static const int32_T iv29[2] = { 1, 27 }; const mxArray *m6; char_T cv30[27]; int32_T i; static const char_T cv31[27] = { 'C', 'o', 'd', 'e', 'r', ':', 'M', 'A', 'T', 'L', 'A', 'B', ':', 's', 'i', 'n', 'g', 'u', 'l', 'a', 'r', 'M', 'a', 't', 'r', 'i', 'x' }; emlrtPushRtStackR2012b(&ee_emlrtRSI, emlrtRootTLSGlobal); y = NULL; m6 = mxCreateCharArray(2, iv29); for (i = 0; i < 27; i++) { cv30[i] = cv31[i]; } emlrtInitCharArrayR2013a(emlrtRootTLSGlobal, 27, m6, cv30); emlrtAssign(&y, m6); warning(message(y, &x_emlrtMCI), &y_emlrtMCI); emlrtPopRtStackR2012b(&ee_emlrtRSI, emlrtRootTLSGlobal); } void inv(const emxArray_real_T *x, emxArray_real_T *y) { boolean_T b0; const mxArray *b_y; static const int32_T iv27[2] = { 1, 19 }; const mxArray *m5; char_T cv26[19]; int32_T i; static const char_T cv27[19] = { 'C', 'o', 'd', 'e', 'r', ':', 'M', 'A', 'T', 'L', 'A', 'B', ':', 's', 'q', 'u', 'a', 'r', 'e' }; int32_T loop_ub; real_T n1x; real_T n1xinv; real_T rc; const mxArray *c_y; static const int32_T iv28[2] = { 1, 8 }; char_T cv28[8]; static const char_T cv29[8] = { '%', '%', '%', 'd', '.', '%', 'd', 'e' }; char_T str[14]; b0 = (1 == x->size[1]); if (b0) { } else { emlrtPushRtStackR2012b(&xd_emlrtRSI, emlrtRootTLSGlobal); b_y = NULL; m5 = mxCreateCharArray(2, iv27); for (i = 0; i < 19; i++) { cv26[i] = cv27[i]; } emlrtInitCharArrayR2013a(emlrtRootTLSGlobal, 19, m5, cv26); emlrtAssign(&b_y, m5); error(message(b_y, &v_emlrtMCI), &w_emlrtMCI); emlrtPopRtStackR2012b(&xd_emlrtRSI, emlrtRootTLSGlobal); } i = y->size[0] * y->size[1]; y->size[0] = 1; y->size[1] = x->size[1]; emxEnsureCapacity((emxArray__common *)y, i, (int32_T)sizeof(real_T), &eb_emlrtRTEI); loop_ub = x->size[0] * x->size[1]; for (i = 0; i < loop_ub; i++) { y->data[i] = 0.0; } y->data[0] = 1.0; if ((y->size[1] == 0) || (!(y->data[0] != 0.0))) { } else { y->data[0] /= x->data[0]; } emlrtPushRtStackR2012b(&yd_emlrtRSI, emlrtRootTLSGlobal); n1x = norm(x); n1xinv = norm(y); rc = 1.0 / (n1x * n1xinv); if ((n1x == 0.0) || (n1xinv == 0.0) || (rc == 0.0)) { emlrtPushRtStackR2012b(&ce_emlrtRSI, emlrtRootTLSGlobal); eml_warning(); emlrtPopRtStackR2012b(&ce_emlrtRSI, emlrtRootTLSGlobal); } else { if (muDoubleScalarIsNaN(rc) || (rc < 2.2204460492503131E-16)) { emlrtPushRtStackR2012b(&de_emlrtRSI, emlrtRootTLSGlobal); emlrtPushRtStackR2012b(&fe_emlrtRSI, emlrtRootTLSGlobal); c_y = NULL; m5 = mxCreateCharArray(2, iv28); for (i = 0; i < 8; i++) { cv28[i] = cv29[i]; } emlrtInitCharArrayR2013a(emlrtRootTLSGlobal, 8, m5, cv28); emlrtAssign(&c_y, m5); emlrt_marshallIn(c_sprintf(b_sprintf(c_y, emlrt_marshallOut(14.0), emlrt_marshallOut(6.0), &ab_emlrtMCI), emlrt_marshallOut(rc), &bb_emlrtMCI), "sprintf", str); emlrtPopRtStackR2012b(&fe_emlrtRSI, emlrtRootTLSGlobal); b_eml_warning(str); emlrtPopRtStackR2012b(&de_emlrtRSI, emlrtRootTLSGlobal); } } emlrtPopRtStackR2012b(&yd_emlrtRSI, emlrtRootTLSGlobal); } /* End of code generation (inv.c) */