/* * Select_Ground_Motions.c * * Code generation for function 'Select_Ground_Motions' * * C source code generated on: Wed Aug 26 14:59:32 2015 * */ /* Include files */ #include "rt_nonfinite.h" #include "Select_Ground_Motions.h" #include "SP_1996.h" #include "baker_jayaram_correlation.h" #include "Select_Ground_Motions_emxutil.h" #include "inv.h" #include "sqrt.h" #include "mpower.h" #include "exp.h" #include "mvnrnd_.h" #include "sum.h" #include "power.h" #include "diag.h" #include "std.h" #include "log.h" #include "skew.h" #include "mean.h" #include "abs.h" #include "any.h" #include "mrdivide.h" #include "cholcov_.h" #include "all.h" #include "conditionalCovariance.h" #include "repmat.h" #include "linspace.h" #include "Select_Ground_Motions_mexutil.h" #include "Select_Ground_Motions_data.h" /* Variable Definitions */ static emlrtRSInfo emlrtRSI = { 292, "Select_Ground_Motions", "/home/sebenik/Projects/Ground_Motion_Selection/GMS_con_cms_1gmc_dynamicInput_501_jure/Select_Ground_Motions.m" }; static emlrtRSInfo b_emlrtRSI = { 118, "Select_Ground_Motions", "/home/sebenik/Projects/Ground_Motion_Selection/GMS_con_cms_1gmc_dynamicInput_501_jure/Select_Ground_Motions.m" }; static emlrtRSInfo c_emlrtRSI = { 213, "Select_Ground_Motions", "/home/sebenik/Projects/Ground_Motion_Selection/GMS_con_cms_1gmc_dynamicInput_501_jure/Select_Ground_Motions.m" }; static emlrtRSInfo d_emlrtRSI = { 215, "Select_Ground_Motions", "/home/sebenik/Projects/Ground_Motion_Selection/GMS_con_cms_1gmc_dynamicInput_501_jure/Select_Ground_Motions.m" }; static emlrtRSInfo e_emlrtRSI = { 220, "Select_Ground_Motions", "/home/sebenik/Projects/Ground_Motion_Selection/GMS_con_cms_1gmc_dynamicInput_501_jure/Select_Ground_Motions.m" }; static emlrtRSInfo f_emlrtRSI = { 228, "Select_Ground_Motions", "/home/sebenik/Projects/Ground_Motion_Selection/GMS_con_cms_1gmc_dynamicInput_501_jure/Select_Ground_Motions.m" }; static emlrtRSInfo g_emlrtRSI = { 241, "Select_Ground_Motions", "/home/sebenik/Projects/Ground_Motion_Selection/GMS_con_cms_1gmc_dynamicInput_501_jure/Select_Ground_Motions.m" }; static emlrtRSInfo h_emlrtRSI = { 243, "Select_Ground_Motions", "/home/sebenik/Projects/Ground_Motion_Selection/GMS_con_cms_1gmc_dynamicInput_501_jure/Select_Ground_Motions.m" }; static emlrtRSInfo i_emlrtRSI = { 244, "Select_Ground_Motions", "/home/sebenik/Projects/Ground_Motion_Selection/GMS_con_cms_1gmc_dynamicInput_501_jure/Select_Ground_Motions.m" }; static emlrtRSInfo j_emlrtRSI = { 256, "Select_Ground_Motions", "/home/sebenik/Projects/Ground_Motion_Selection/GMS_con_cms_1gmc_dynamicInput_501_jure/Select_Ground_Motions.m" }; static emlrtRSInfo k_emlrtRSI = { 257, "Select_Ground_Motions", "/home/sebenik/Projects/Ground_Motion_Selection/GMS_con_cms_1gmc_dynamicInput_501_jure/Select_Ground_Motions.m" }; static emlrtRSInfo l_emlrtRSI = { 258, "Select_Ground_Motions", "/home/sebenik/Projects/Ground_Motion_Selection/GMS_con_cms_1gmc_dynamicInput_501_jure/Select_Ground_Motions.m" }; static emlrtRSInfo m_emlrtRSI = { 259, "Select_Ground_Motions", "/home/sebenik/Projects/Ground_Motion_Selection/GMS_con_cms_1gmc_dynamicInput_501_jure/Select_Ground_Motions.m" }; static emlrtRSInfo n_emlrtRSI = { 261, "Select_Ground_Motions", "/home/sebenik/Projects/Ground_Motion_Selection/GMS_con_cms_1gmc_dynamicInput_501_jure/Select_Ground_Motions.m" }; static emlrtRSInfo o_emlrtRSI = { 262, "Select_Ground_Motions", "/home/sebenik/Projects/Ground_Motion_Selection/GMS_con_cms_1gmc_dynamicInput_501_jure/Select_Ground_Motions.m" }; static emlrtRSInfo p_emlrtRSI = { 264, "Select_Ground_Motions", "/home/sebenik/Projects/Ground_Motion_Selection/GMS_con_cms_1gmc_dynamicInput_501_jure/Select_Ground_Motions.m" }; static emlrtRSInfo q_emlrtRSI = { 266, "Select_Ground_Motions", "/home/sebenik/Projects/Ground_Motion_Selection/GMS_con_cms_1gmc_dynamicInput_501_jure/Select_Ground_Motions.m" }; static emlrtRSInfo r_emlrtRSI = { 268, "Select_Ground_Motions", "/home/sebenik/Projects/Ground_Motion_Selection/GMS_con_cms_1gmc_dynamicInput_501_jure/Select_Ground_Motions.m" }; static emlrtRSInfo s_emlrtRSI = { 290, "Select_Ground_Motions", "/home/sebenik/Projects/Ground_Motion_Selection/GMS_con_cms_1gmc_dynamicInput_501_jure/Select_Ground_Motions.m" }; static emlrtRSInfo t_emlrtRSI = { 300, "Select_Ground_Motions", "/home/sebenik/Projects/Ground_Motion_Selection/GMS_con_cms_1gmc_dynamicInput_501_jure/Select_Ground_Motions.m" }; static emlrtRSInfo u_emlrtRSI = { 302, "Select_Ground_Motions", "/home/sebenik/Projects/Ground_Motion_Selection/GMS_con_cms_1gmc_dynamicInput_501_jure/Select_Ground_Motions.m" }; static emlrtRSInfo v_emlrtRSI = { 303, "Select_Ground_Motions", "/home/sebenik/Projects/Ground_Motion_Selection/GMS_con_cms_1gmc_dynamicInput_501_jure/Select_Ground_Motions.m" }; static emlrtRSInfo w_emlrtRSI = { 304, "Select_Ground_Motions", "/home/sebenik/Projects/Ground_Motion_Selection/GMS_con_cms_1gmc_dynamicInput_501_jure/Select_Ground_Motions.m" }; static emlrtRSInfo x_emlrtRSI = { 305, "Select_Ground_Motions", "/home/sebenik/Projects/Ground_Motion_Selection/GMS_con_cms_1gmc_dynamicInput_501_jure/Select_Ground_Motions.m" }; static emlrtRSInfo y_emlrtRSI = { 313, "Select_Ground_Motions", "/home/sebenik/Projects/Ground_Motion_Selection/GMS_con_cms_1gmc_dynamicInput_501_jure/Select_Ground_Motions.m" }; static emlrtRSInfo ab_emlrtRSI = { 315, "Select_Ground_Motions", "/home/sebenik/Projects/Ground_Motion_Selection/GMS_con_cms_1gmc_dynamicInput_501_jure/Select_Ground_Motions.m" }; static emlrtRSInfo bb_emlrtRSI = { 316, "Select_Ground_Motions", "/home/sebenik/Projects/Ground_Motion_Selection/GMS_con_cms_1gmc_dynamicInput_501_jure/Select_Ground_Motions.m" }; static emlrtRSInfo cb_emlrtRSI = { 317, "Select_Ground_Motions", "/home/sebenik/Projects/Ground_Motion_Selection/GMS_con_cms_1gmc_dynamicInput_501_jure/Select_Ground_Motions.m" }; static emlrtRSInfo db_emlrtRSI = { 318, "Select_Ground_Motions", "/home/sebenik/Projects/Ground_Motion_Selection/GMS_con_cms_1gmc_dynamicInput_501_jure/Select_Ground_Motions.m" }; static emlrtRSInfo eb_emlrtRSI = { 370, "Select_Ground_Motions", "/home/sebenik/Projects/Ground_Motion_Selection/GMS_con_cms_1gmc_dynamicInput_501_jure/Select_Ground_Motions.m" }; static emlrtRSInfo fb_emlrtRSI = { 391, "Select_Ground_Motions", "/home/sebenik/Projects/Ground_Motion_Selection/GMS_con_cms_1gmc_dynamicInput_501_jure/Select_Ground_Motions.m" }; static emlrtRSInfo gb_emlrtRSI = { 405, "Select_Ground_Motions", "/home/sebenik/Projects/Ground_Motion_Selection/GMS_con_cms_1gmc_dynamicInput_501_jure/Select_Ground_Motions.m" }; static emlrtRSInfo hb_emlrtRSI = { 409, "Select_Ground_Motions", "/home/sebenik/Projects/Ground_Motion_Selection/GMS_con_cms_1gmc_dynamicInput_501_jure/Select_Ground_Motions.m" }; static emlrtRSInfo ib_emlrtRSI = { 413, "Select_Ground_Motions", "/home/sebenik/Projects/Ground_Motion_Selection/GMS_con_cms_1gmc_dynamicInput_501_jure/Select_Ground_Motions.m" }; static emlrtRSInfo jb_emlrtRSI = { 420, "Select_Ground_Motions", "/home/sebenik/Projects/Ground_Motion_Selection/GMS_con_cms_1gmc_dynamicInput_501_jure/Select_Ground_Motions.m" }; static emlrtRSInfo kb_emlrtRSI = { 426, "Select_Ground_Motions", "/home/sebenik/Projects/Ground_Motion_Selection/GMS_con_cms_1gmc_dynamicInput_501_jure/Select_Ground_Motions.m" }; static emlrtRSInfo lb_emlrtRSI = { 430, "Select_Ground_Motions", "/home/sebenik/Projects/Ground_Motion_Selection/GMS_con_cms_1gmc_dynamicInput_501_jure/Select_Ground_Motions.m" }; static emlrtRSInfo mb_emlrtRSI = { 439, "Select_Ground_Motions", "/home/sebenik/Projects/Ground_Motion_Selection/GMS_con_cms_1gmc_dynamicInput_501_jure/Select_Ground_Motions.m" }; static emlrtRSInfo nb_emlrtRSI = { 443, "Select_Ground_Motions", "/home/sebenik/Projects/Ground_Motion_Selection/GMS_con_cms_1gmc_dynamicInput_501_jure/Select_Ground_Motions.m" }; static emlrtRSInfo ob_emlrtRSI = { 476, "Select_Ground_Motions", "/home/sebenik/Projects/Ground_Motion_Selection/GMS_con_cms_1gmc_dynamicInput_501_jure/Select_Ground_Motions.m" }; static emlrtRSInfo pb_emlrtRSI = { 482, "Select_Ground_Motions", "/home/sebenik/Projects/Ground_Motion_Selection/GMS_con_cms_1gmc_dynamicInput_501_jure/Select_Ground_Motions.m" }; static emlrtRSInfo qb_emlrtRSI = { 485, "Select_Ground_Motions", "/home/sebenik/Projects/Ground_Motion_Selection/GMS_con_cms_1gmc_dynamicInput_501_jure/Select_Ground_Motions.m" }; static emlrtRSInfo rb_emlrtRSI = { 475, "Select_Ground_Motions", "/home/sebenik/Projects/Ground_Motion_Selection/GMS_con_cms_1gmc_dynamicInput_501_jure/Select_Ground_Motions.m" }; static emlrtRSInfo sb_emlrtRSI = { 487, "Select_Ground_Motions", "/home/sebenik/Projects/Ground_Motion_Selection/GMS_con_cms_1gmc_dynamicInput_501_jure/Select_Ground_Motions.m" }; static emlrtRSInfo tb_emlrtRSI = { 493, "Select_Ground_Motions", "/home/sebenik/Projects/Ground_Motion_Selection/GMS_con_cms_1gmc_dynamicInput_501_jure/Select_Ground_Motions.m" }; static emlrtRSInfo ub_emlrtRSI = { 494, "Select_Ground_Motions", "/home/sebenik/Projects/Ground_Motion_Selection/GMS_con_cms_1gmc_dynamicInput_501_jure/Select_Ground_Motions.m" }; static emlrtRSInfo vb_emlrtRSI = { 495, "Select_Ground_Motions", "/home/sebenik/Projects/Ground_Motion_Selection/GMS_con_cms_1gmc_dynamicInput_501_jure/Select_Ground_Motions.m" }; static emlrtRSInfo wb_emlrtRSI = { 497, "Select_Ground_Motions", "/home/sebenik/Projects/Ground_Motion_Selection/GMS_con_cms_1gmc_dynamicInput_501_jure/Select_Ground_Motions.m" }; static emlrtRSInfo xb_emlrtRSI = { 501, "Select_Ground_Motions", "/home/sebenik/Projects/Ground_Motion_Selection/GMS_con_cms_1gmc_dynamicInput_501_jure/Select_Ground_Motions.m" }; static emlrtRSInfo yb_emlrtRSI = { 509, "Select_Ground_Motions", "/home/sebenik/Projects/Ground_Motion_Selection/GMS_con_cms_1gmc_dynamicInput_501_jure/Select_Ground_Motions.m" }; static emlrtRSInfo ac_emlrtRSI = { 523, "Select_Ground_Motions", "/home/sebenik/Projects/Ground_Motion_Selection/GMS_con_cms_1gmc_dynamicInput_501_jure/Select_Ground_Motions.m" }; static emlrtRSInfo bc_emlrtRSI = { 569, "Select_Ground_Motions", "/home/sebenik/Projects/Ground_Motion_Selection/GMS_con_cms_1gmc_dynamicInput_501_jure/Select_Ground_Motions.m" }; static emlrtRSInfo cc_emlrtRSI = { 570, "Select_Ground_Motions", "/home/sebenik/Projects/Ground_Motion_Selection/GMS_con_cms_1gmc_dynamicInput_501_jure/Select_Ground_Motions.m" }; static emlrtRSInfo dc_emlrtRSI = { 571, "Select_Ground_Motions", "/home/sebenik/Projects/Ground_Motion_Selection/GMS_con_cms_1gmc_dynamicInput_501_jure/Select_Ground_Motions.m" }; static emlrtRSInfo ec_emlrtRSI = { 572, "Select_Ground_Motions", "/home/sebenik/Projects/Ground_Motion_Selection/GMS_con_cms_1gmc_dynamicInput_501_jure/Select_Ground_Motions.m" }; static emlrtRSInfo fc_emlrtRSI = { 641, "Select_Ground_Motions", "/home/sebenik/Projects/Ground_Motion_Selection/GMS_con_cms_1gmc_dynamicInput_501_jure/Select_Ground_Motions.m" }; static emlrtRSInfo gc_emlrtRSI = { 21, "colon", "/usr/local/MATLAB/R2013a/toolbox/eml/lib/matlab/ops/colon.m" }; static emlrtRSInfo mc_emlrtRSI = { 51, "eml_int_forloop_overflow_check", "/usr/local/MATLAB/R2013a/toolbox/eml/lib/matlab/eml/eml_int_forloop_overflow_check.m" }; static emlrtRSInfo bf_emlrtRSI = { 38, "rng", "/usr/local/MATLAB/R2013a/toolbox/eml/lib/matlab/randfun/rng.m" }; static emlrtRSInfo uo_emlrtRSI = { 18, "min", "/usr/local/MATLAB/R2013a/toolbox/eml/lib/matlab/datafun/min.m" }; static emlrtRSInfo wo_emlrtRSI = { 15, "eml_null_assignment", "/usr/local/MATLAB/R2013a/toolbox/eml/lib/matlab/eml/eml_null_assignment.m" }; static emlrtRSInfo xo_emlrtRSI = { 16, "eml_null_assignment", "/usr/local/MATLAB/R2013a/toolbox/eml/lib/matlab/eml/eml_null_assignment.m" }; static emlrtRSInfo yo_emlrtRSI = { 52, "eml_null_assignment", "/usr/local/MATLAB/R2013a/toolbox/eml/lib/matlab/eml/eml_null_assignment.m" }; static emlrtRSInfo ap_emlrtRSI = { 174, "eml_null_assignment", "/usr/local/MATLAB/R2013a/toolbox/eml/lib/matlab/eml/eml_null_assignment.m" }; static emlrtRSInfo bp_emlrtRSI = { 196, "eml_null_assignment", "/usr/local/MATLAB/R2013a/toolbox/eml/lib/matlab/eml/eml_null_assignment.m" }; static emlrtRSInfo cp_emlrtRSI = { 173, "eml_null_assignment", "/usr/local/MATLAB/R2013a/toolbox/eml/lib/matlab/eml/eml_null_assignment.m" }; static emlrtMCInfo emlrtMCI = { 292, 17, "Select_Ground_Motions", "/home/sebenik/Projects/Ground_Motion_Selection/GMS_con_cms_1gmc_dynamicInput_501_jure/Select_Ground_Motions.m" }; static emlrtMCInfo b_emlrtMCI = { 292, 13, "Select_Ground_Motions", "/home/sebenik/Projects/Ground_Motion_Selection/GMS_con_cms_1gmc_dynamicInput_501_jure/Select_Ground_Motions.m" }; static emlrtMCInfo c_emlrtMCI = { 292, 9, "Select_Ground_Motions", "/home/sebenik/Projects/Ground_Motion_Selection/GMS_con_cms_1gmc_dynamicInput_501_jure/Select_Ground_Motions.m" }; static emlrtMCInfo d_emlrtMCI = { 292, 5, "Select_Ground_Motions", "/home/sebenik/Projects/Ground_Motion_Selection/GMS_con_cms_1gmc_dynamicInput_501_jure/Select_Ground_Motions.m" }; static emlrtMCInfo g_emlrtMCI = { 52, 9, "eml_int_forloop_overflow_check", "/usr/local/MATLAB/R2013a/toolbox/eml/lib/matlab/eml/eml_int_forloop_overflow_check.m" }; static emlrtMCInfo h_emlrtMCI = { 51, 15, "eml_int_forloop_overflow_check", "/usr/local/MATLAB/R2013a/toolbox/eml/lib/matlab/eml/eml_int_forloop_overflow_check.m" }; static emlrtMCInfo cb_emlrtMCI = { 38, 13, "rng", "/usr/local/MATLAB/R2013a/toolbox/eml/lib/matlab/randfun/rng.m" }; static emlrtMCInfo sc_emlrtMCI = { 53, 9, "eml_null_assignment", "/usr/local/MATLAB/R2013a/toolbox/eml/lib/matlab/eml/eml_null_assignment.m" }; static emlrtMCInfo tc_emlrtMCI = { 52, 19, "eml_null_assignment", "/usr/local/MATLAB/R2013a/toolbox/eml/lib/matlab/eml/eml_null_assignment.m" }; static emlrtMCInfo uc_emlrtMCI = { 196, 1, "eml_null_assignment", "/usr/local/MATLAB/R2013a/toolbox/eml/lib/matlab/eml/eml_null_assignment.m" }; static emlrtRTEInfo emlrtRTEI = { 2, 51, "Select_Ground_Motions", "/home/sebenik/Projects/Ground_Motion_Selection/GMS_con_cms_1gmc_dynamicInput_501_jure/Select_Ground_Motions.m" }; static emlrtRTEInfo d_emlrtRTEI = { 13, 1, "Select_Ground_Motions", "/home/sebenik/Projects/Ground_Motion_Selection/GMS_con_cms_1gmc_dynamicInput_501_jure/Select_Ground_Motions.m" }; static emlrtRTEInfo e_emlrtRTEI = { 116, 1, "Select_Ground_Motions", "/home/sebenik/Projects/Ground_Motion_Selection/GMS_con_cms_1gmc_dynamicInput_501_jure/Select_Ground_Motions.m" }; static emlrtRTEInfo f_emlrtRTEI = { 118, 1, "Select_Ground_Motions", "/home/sebenik/Projects/Ground_Motion_Selection/GMS_con_cms_1gmc_dynamicInput_501_jure/Select_Ground_Motions.m" }; static emlrtRTEInfo g_emlrtRTEI = { 120, 1, "Select_Ground_Motions", "/home/sebenik/Projects/Ground_Motion_Selection/GMS_con_cms_1gmc_dynamicInput_501_jure/Select_Ground_Motions.m" }; static emlrtRTEInfo h_emlrtRTEI = { 205, 1, "Select_Ground_Motions", "/home/sebenik/Projects/Ground_Motion_Selection/GMS_con_cms_1gmc_dynamicInput_501_jure/Select_Ground_Motions.m" }; static emlrtRTEInfo i_emlrtRTEI = { 220, 1, "Select_Ground_Motions", "/home/sebenik/Projects/Ground_Motion_Selection/GMS_con_cms_1gmc_dynamicInput_501_jure/Select_Ground_Motions.m" }; static emlrtRTEInfo j_emlrtRTEI = { 225, 1, "Select_Ground_Motions", "/home/sebenik/Projects/Ground_Motion_Selection/GMS_con_cms_1gmc_dynamicInput_501_jure/Select_Ground_Motions.m" }; static emlrtRTEInfo k_emlrtRTEI = { 226, 1, "Select_Ground_Motions", "/home/sebenik/Projects/Ground_Motion_Selection/GMS_con_cms_1gmc_dynamicInput_501_jure/Select_Ground_Motions.m" }; static emlrtRTEInfo l_emlrtRTEI = { 239, 1, "Select_Ground_Motions", "/home/sebenik/Projects/Ground_Motion_Selection/GMS_con_cms_1gmc_dynamicInput_501_jure/Select_Ground_Motions.m" }; static emlrtRTEInfo m_emlrtRTEI = { 244, 1, "Select_Ground_Motions", "/home/sebenik/Projects/Ground_Motion_Selection/GMS_con_cms_1gmc_dynamicInput_501_jure/Select_Ground_Motions.m" }; static emlrtRTEInfo n_emlrtRTEI = { 247, 1, "Select_Ground_Motions", "/home/sebenik/Projects/Ground_Motion_Selection/GMS_con_cms_1gmc_dynamicInput_501_jure/Select_Ground_Motions.m" }; static emlrtRTEInfo o_emlrtRTEI = { 262, 9, "Select_Ground_Motions", "/home/sebenik/Projects/Ground_Motion_Selection/GMS_con_cms_1gmc_dynamicInput_501_jure/Select_Ground_Motions.m" }; static emlrtRTEInfo p_emlrtRTEI = { 264, 9, "Select_Ground_Motions", "/home/sebenik/Projects/Ground_Motion_Selection/GMS_con_cms_1gmc_dynamicInput_501_jure/Select_Ground_Motions.m" }; static emlrtRTEInfo q_emlrtRTEI = { 266, 9, "Select_Ground_Motions", "/home/sebenik/Projects/Ground_Motion_Selection/GMS_con_cms_1gmc_dynamicInput_501_jure/Select_Ground_Motions.m" }; static emlrtRTEInfo r_emlrtRTEI = { 296, 1, "Select_Ground_Motions", "/home/sebenik/Projects/Ground_Motion_Selection/GMS_con_cms_1gmc_dynamicInput_501_jure/Select_Ground_Motions.m" }; static emlrtRTEInfo s_emlrtRTEI = { 363, 1, "Select_Ground_Motions", "/home/sebenik/Projects/Ground_Motion_Selection/GMS_con_cms_1gmc_dynamicInput_501_jure/Select_Ground_Motions.m" }; static emlrtRTEInfo t_emlrtRTEI = { 369, 1, "Select_Ground_Motions", "/home/sebenik/Projects/Ground_Motion_Selection/GMS_con_cms_1gmc_dynamicInput_501_jure/Select_Ground_Motions.m" }; static emlrtRTEInfo u_emlrtRTEI = { 396, 1, "Select_Ground_Motions", "/home/sebenik/Projects/Ground_Motion_Selection/GMS_con_cms_1gmc_dynamicInput_501_jure/Select_Ground_Motions.m" }; static emlrtRTEInfo v_emlrtRTEI = { 401, 5, "Select_Ground_Motions", "/home/sebenik/Projects/Ground_Motion_Selection/GMS_con_cms_1gmc_dynamicInput_501_jure/Select_Ground_Motions.m" }; static emlrtRTEInfo fd_emlrtRTEI = { 1, 14, "eml_null_assignment", "/usr/local/MATLAB/R2013a/toolbox/eml/lib/matlab/eml/eml_null_assignment.m" }; static emlrtECInfo emlrtECI = { 2, 570, 9, "Select_Ground_Motions", "/home/sebenik/Projects/Ground_Motion_Selection/GMS_con_cms_1gmc_dynamicInput_501_jure/Select_Ground_Motions.m" }; static emlrtECInfo b_emlrtECI = { 2, 569, 9, "Select_Ground_Motions", "/home/sebenik/Projects/Ground_Motion_Selection/GMS_con_cms_1gmc_dynamicInput_501_jure/Select_Ground_Motions.m" }; static emlrtECInfo c_emlrtECI = { -1, 524, 41, "Select_Ground_Motions", "/home/sebenik/Projects/Ground_Motion_Selection/GMS_con_cms_1gmc_dynamicInput_501_jure/Select_Ground_Motions.m" }; static emlrtBCInfo emlrtBCI = { -1, -1, 524, 41, "recID", "Select_Ground_Motions", "/home/sebenik/Projects/Ground_Motion_Selection/GMS_con_cms_1gmc_dynamicInput_501_jure/Select_Ground_Motions.m", 0 }; static emlrtECInfo d_emlrtECI = { -1, 524, 22, "Select_Ground_Motions", "/home/sebenik/Projects/Ground_Motion_Selection/GMS_con_cms_1gmc_dynamicInput_501_jure/Select_Ground_Motions.m" }; static emlrtBCInfo b_emlrtBCI = { -1, -1, 524, 22, "recID", "Select_Ground_Motions", "/home/sebenik/Projects/Ground_Motion_Selection/GMS_con_cms_1gmc_dynamicInput_501_jure/Select_Ground_Motions.m", 0 }; static emlrtECInfo e_emlrtECI = { 2, 523, 27, "Select_Ground_Motions", "/home/sebenik/Projects/Ground_Motion_Selection/GMS_con_cms_1gmc_dynamicInput_501_jure/Select_Ground_Motions.m" }; static emlrtBCInfo c_emlrtBCI = { -1, -1, 523, 101, "sampleSmall", "Select_Ground_Motions", "/home/sebenik/Projects/Ground_Motion_Selection/GMS_con_cms_1gmc_dynamicInput_501_jure/Select_Ground_Motions.m", 0 }; static emlrtBCInfo d_emlrtBCI = { -1, -1, 523, 59, "sampleBig", "Select_Ground_Motions", "/home/sebenik/Projects/Ground_Motion_Selection/GMS_con_cms_1gmc_dynamicInput_501_jure/Select_Ground_Motions.m", 0 }; static emlrtDCInfo emlrtDCI = { 523, 59, "Select_Ground_Motions", "/home/sebenik/Projects/Ground_Motion_Selection/GMS_con_cms_1gmc_dynamicInput_501_jure/Select_Ground_Motions.m", 1 }; static emlrtBCInfo e_emlrtBCI = { -1, -1, 523, 40, "sampleSmall", "Select_Ground_Motions", "/home/sebenik/Projects/Ground_Motion_Selection/GMS_con_cms_1gmc_dynamicInput_501_jure/Select_Ground_Motions.m", 0 }; static emlrtBCInfo f_emlrtBCI = { -1, -1, 513, 39, "sampleSmall", "Select_Ground_Motions", "/home/sebenik/Projects/Ground_Motion_Selection/GMS_con_cms_1gmc_dynamicInput_501_jure/Select_Ground_Motions.m", 0 }; static emlrtECInfo f_emlrtECI = { 2, 501, 47, "Select_Ground_Motions", "/home/sebenik/Projects/Ground_Motion_Selection/GMS_con_cms_1gmc_dynamicInput_501_jure/Select_Ground_Motions.m" }; static emlrtECInfo g_emlrtECI = { 2, 501, 73, "Select_Ground_Motions", "/home/sebenik/Projects/Ground_Motion_Selection/GMS_con_cms_1gmc_dynamicInput_501_jure/Select_Ground_Motions.m" }; static emlrtBCInfo g_emlrtBCI = { -1, -1, 501, 63, "sampleSmall", "Select_Ground_Motions", "/home/sebenik/Projects/Ground_Motion_Selection/GMS_con_cms_1gmc_dynamicInput_501_jure/Select_Ground_Motions.m", 0 }; static emlrtECInfo h_emlrtECI = { 2, 495, 22, "Select_Ground_Motions", "/home/sebenik/Projects/Ground_Motion_Selection/GMS_con_cms_1gmc_dynamicInput_501_jure/Select_Ground_Motions.m" }; static emlrtECInfo i_emlrtECI = { 2, 493, 23, "Select_Ground_Motions", "/home/sebenik/Projects/Ground_Motion_Selection/GMS_con_cms_1gmc_dynamicInput_501_jure/Select_Ground_Motions.m" }; static emlrtECInfo j_emlrtECI = { 2, 489, 31, "Select_Ground_Motions", "/home/sebenik/Projects/Ground_Motion_Selection/GMS_con_cms_1gmc_dynamicInput_501_jure/Select_Ground_Motions.m" }; static emlrtBCInfo h_emlrtBCI = { -1, -1, 489, 54, "sampleBig", "Select_Ground_Motions", "/home/sebenik/Projects/Ground_Motion_Selection/GMS_con_cms_1gmc_dynamicInput_501_jure/Select_Ground_Motions.m", 0 }; static emlrtECInfo k_emlrtECI = { 2, 487, 31, "Select_Ground_Motions", "/home/sebenik/Projects/Ground_Motion_Selection/GMS_con_cms_1gmc_dynamicInput_501_jure/Select_Ground_Motions.m" }; static emlrtECInfo l_emlrtECI = { -1, 485, 21, "Select_Ground_Motions", "/home/sebenik/Projects/Ground_Motion_Selection/GMS_con_cms_1gmc_dynamicInput_501_jure/Select_Ground_Motions.m" }; static emlrtBCInfo i_emlrtBCI = { -1, -1, 487, 54, "sampleBig", "Select_Ground_Motions", "/home/sebenik/Projects/Ground_Motion_Selection/GMS_con_cms_1gmc_dynamicInput_501_jure/Select_Ground_Motions.m", 0 }; static emlrtECInfo m_emlrtECI = { -1, 439, 5, "Select_Ground_Motions", "/home/sebenik/Projects/Ground_Motion_Selection/GMS_con_cms_1gmc_dynamicInput_501_jure/Select_Ground_Motions.m" }; static emlrtBCInfo j_emlrtBCI = { -1, -1, 439, 17, "sampleSmall", "Select_Ground_Motions", "/home/sebenik/Projects/Ground_Motion_Selection/GMS_con_cms_1gmc_dynamicInput_501_jure/Select_Ground_Motions.m", 0 }; static emlrtBCInfo k_emlrtBCI = { -1, -1, 485, 60, "sampleBig", "Select_Ground_Motions", "/home/sebenik/Projects/Ground_Motion_Selection/GMS_con_cms_1gmc_dynamicInput_501_jure/Select_Ground_Motions.m", 0 }; static emlrtBCInfo l_emlrtBCI = { -1, -1, 482, 38, "sampleBig", "Select_Ground_Motions", "/home/sebenik/Projects/Ground_Motion_Selection/GMS_con_cms_1gmc_dynamicInput_501_jure/Select_Ground_Motions.m", 0 }; static emlrtRTEInfo ae_emlrtRTEI = { 469, 5, "Select_Ground_Motions", "/home/sebenik/Projects/Ground_Motion_Selection/GMS_con_cms_1gmc_dynamicInput_501_jure/Select_Ground_Motions.m" }; static emlrtRTEInfo be_emlrtRTEI = { 467, 1, "Select_Ground_Motions", "/home/sebenik/Projects/Ground_Motion_Selection/GMS_con_cms_1gmc_dynamicInput_501_jure/Select_Ground_Motions.m" }; static emlrtBCInfo m_emlrtBCI = { -1, -1, 439, 55, "scaleFac", "Select_Ground_Motions", "/home/sebenik/Projects/Ground_Motion_Selection/GMS_con_cms_1gmc_dynamicInput_501_jure/Select_Ground_Motions.m", 0 }; static emlrtBCInfo n_emlrtBCI = { -1, -1, 439, 42, "sampleBig", "Select_Ground_Motions", "/home/sebenik/Projects/Ground_Motion_Selection/GMS_con_cms_1gmc_dynamicInput_501_jure/Select_Ground_Motions.m", 0 }; static emlrtECInfo n_emlrtECI = { 2, 420, 31, "Select_Ground_Motions", "/home/sebenik/Projects/Ground_Motion_Selection/GMS_con_cms_1gmc_dynamicInput_501_jure/Select_Ground_Motions.m" }; static emlrtBCInfo o_emlrtBCI = { -1, -1, 420, 55, "gm", "Select_Ground_Motions", "/home/sebenik/Projects/Ground_Motion_Selection/GMS_con_cms_1gmc_dynamicInput_501_jure/Select_Ground_Motions.m", 0 }; static emlrtBCInfo p_emlrtBCI = { -1, -1, 420, 41, "sampleBig", "Select_Ground_Motions", "/home/sebenik/Projects/Ground_Motion_Selection/GMS_con_cms_1gmc_dynamicInput_501_jure/Select_Ground_Motions.m", 0 }; static emlrtECInfo o_emlrtECI = { 2, 413, 35, "Select_Ground_Motions", "/home/sebenik/Projects/Ground_Motion_Selection/GMS_con_cms_1gmc_dynamicInput_501_jure/Select_Ground_Motions.m" }; static emlrtBCInfo q_emlrtBCI = { -1, -1, 413, 81, "gm", "Select_Ground_Motions", "/home/sebenik/Projects/Ground_Motion_Selection/GMS_con_cms_1gmc_dynamicInput_501_jure/Select_Ground_Motions.m", 0 }; static emlrtBCInfo r_emlrtBCI = { -1, -1, 413, 59, "scaleFac", "Select_Ground_Motions", "/home/sebenik/Projects/Ground_Motion_Selection/GMS_con_cms_1gmc_dynamicInput_501_jure/Select_Ground_Motions.m", 0 }; static emlrtBCInfo s_emlrtBCI = { -1, -1, 413, 53, "sampleBig", "Select_Ground_Motions", "/home/sebenik/Projects/Ground_Motion_Selection/GMS_con_cms_1gmc_dynamicInput_501_jure/Select_Ground_Motions.m", 0 }; static emlrtECInfo p_emlrtECI = { -1, 409, 17, "Select_Ground_Motions", "/home/sebenik/Projects/Ground_Motion_Selection/GMS_con_cms_1gmc_dynamicInput_501_jure/Select_Ground_Motions.m" }; static emlrtBCInfo t_emlrtBCI = { -1, -1, 409, 56, "sampleBig", "Select_Ground_Motions", "/home/sebenik/Projects/Ground_Motion_Selection/GMS_con_cms_1gmc_dynamicInput_501_jure/Select_Ground_Motions.m", 0 }; static emlrtBCInfo u_emlrtBCI = { -1, -1, 405, 34, "sampleBig", "Select_Ground_Motions", "/home/sebenik/Projects/Ground_Motion_Selection/GMS_con_cms_1gmc_dynamicInput_501_jure/Select_Ground_Motions.m", 0 }; static emlrtRTEInfo ce_emlrtRTEI = { 398, 1, "Select_Ground_Motions", "/home/sebenik/Projects/Ground_Motion_Selection/GMS_con_cms_1gmc_dynamicInput_501_jure/Select_Ground_Motions.m" }; static emlrtECInfo q_emlrtECI = { 2, 315, 13, "Select_Ground_Motions", "/home/sebenik/Projects/Ground_Motion_Selection/GMS_con_cms_1gmc_dynamicInput_501_jure/Select_Ground_Motions.m" }; static emlrtECInfo r_emlrtECI = { 2, 313, 13, "Select_Ground_Motions", "/home/sebenik/Projects/Ground_Motion_Selection/GMS_con_cms_1gmc_dynamicInput_501_jure/Select_Ground_Motions.m" }; static emlrtECInfo s_emlrtECI = { 2, 304, 17, "Select_Ground_Motions", "/home/sebenik/Projects/Ground_Motion_Selection/GMS_con_cms_1gmc_dynamicInput_501_jure/Select_Ground_Motions.m" }; static emlrtECInfo t_emlrtECI = { 2, 302, 18, "Select_Ground_Motions", "/home/sebenik/Projects/Ground_Motion_Selection/GMS_con_cms_1gmc_dynamicInput_501_jure/Select_Ground_Motions.m" }; static emlrtECInfo u_emlrtECI = { -1, 300, 9, "Select_Ground_Motions", "/home/sebenik/Projects/Ground_Motion_Selection/GMS_con_cms_1gmc_dynamicInput_501_jure/Select_Ground_Motions.m" }; static emlrtBCInfo v_emlrtBCI = { -1, -1, 300, 15, "tempf", "Select_Ground_Motions", "/home/sebenik/Projects/Ground_Motion_Selection/GMS_con_cms_1gmc_dynamicInput_501_jure/Select_Ground_Motions.m", 0 }; static emlrtRTEInfo de_emlrtRTEI = { 299, 5, "Select_Ground_Motions", "/home/sebenik/Projects/Ground_Motion_Selection/GMS_con_cms_1gmc_dynamicInput_501_jure/Select_Ground_Motions.m" }; static emlrtECInfo v_emlrtECI = { 2, 268, 21, "Select_Ground_Motions", "/home/sebenik/Projects/Ground_Motion_Selection/GMS_con_cms_1gmc_dynamicInput_501_jure/Select_Ground_Motions.m" }; static emlrtECInfo w_emlrtECI = { 2, 266, 19, "Select_Ground_Motions", "/home/sebenik/Projects/Ground_Motion_Selection/GMS_con_cms_1gmc_dynamicInput_501_jure/Select_Ground_Motions.m" }; static emlrtECInfo x_emlrtECI = { 2, 264, 19, "Select_Ground_Motions", "/home/sebenik/Projects/Ground_Motion_Selection/GMS_con_cms_1gmc_dynamicInput_501_jure/Select_Ground_Motions.m" }; static emlrtBCInfo w_emlrtBCI = { -1, -1, 253, 14, "PerTgt", "Select_Ground_Motions", "/home/sebenik/Projects/Ground_Motion_Selection/GMS_con_cms_1gmc_dynamicInput_501_jure/Select_Ground_Motions.m", 0 }; static emlrtBCInfo x_emlrtBCI = { -1, -1, 252, 14, "PerTgt", "Select_Ground_Motions", "/home/sebenik/Projects/Ground_Motion_Selection/GMS_con_cms_1gmc_dynamicInput_501_jure/Select_Ground_Motions.m", 0 }; static emlrtECInfo y_emlrtECI = { 2, 243, 11, "Select_Ground_Motions", "/home/sebenik/Projects/Ground_Motion_Selection/GMS_con_cms_1gmc_dynamicInput_501_jure/Select_Ground_Motions.m" }; static emlrtECInfo ab_emlrtECI = { 2, 243, 21, "Select_Ground_Motions", "/home/sebenik/Projects/Ground_Motion_Selection/GMS_con_cms_1gmc_dynamicInput_501_jure/Select_Ground_Motions.m" }; static emlrtECInfo bb_emlrtECI = { 2, 116, 11, "Select_Ground_Motions", "/home/sebenik/Projects/Ground_Motion_Selection/GMS_con_cms_1gmc_dynamicInput_501_jure/Select_Ground_Motions.m" }; static emlrtDCInfo b_emlrtDCI = { 13, 15, "Select_Ground_Motions", "/home/sebenik/Projects/Ground_Motion_Selection/GMS_con_cms_1gmc_dynamicInput_501_jure/Select_Ground_Motions.m", 1 }; static emlrtDCInfo c_emlrtDCI = { 13, 15, "Select_Ground_Motions", "/home/sebenik/Projects/Ground_Motion_Selection/GMS_con_cms_1gmc_dynamicInput_501_jure/Select_Ground_Motions.m", 4 }; static emlrtBCInfo y_emlrtBCI = { -1, -1, 215, 15, "PerTgt_tmp", "Select_Ground_Motions", "/home/sebenik/Projects/Ground_Motion_Selection/GMS_con_cms_1gmc_dynamicInput_501_jure/Select_Ground_Motions.m", 0 }; static emlrtBCInfo ab_emlrtBCI = { -1, -1, 215, 44, "PerTgt_tmp", "Select_Ground_Motions", "/home/sebenik/Projects/Ground_Motion_Selection/GMS_con_cms_1gmc_dynamicInput_501_jure/Select_Ground_Motions.m", 0 }; static emlrtBCInfo bb_emlrtBCI = { -1, -1, 244, 9, "meanReq", "Select_Ground_Motions", "/home/sebenik/Projects/Ground_Motion_Selection/GMS_con_cms_1gmc_dynamicInput_501_jure/Select_Ground_Motions.m", 0 }; static emlrtDCInfo d_emlrtDCI = { 296, 13, "Select_Ground_Motions", "/home/sebenik/Projects/Ground_Motion_Selection/GMS_con_cms_1gmc_dynamicInput_501_jure/Select_Ground_Motions.m", 1 }; static emlrtDCInfo e_emlrtDCI = { 296, 13, "Select_Ground_Motions", "/home/sebenik/Projects/Ground_Motion_Selection/GMS_con_cms_1gmc_dynamicInput_501_jure/Select_Ground_Motions.m", 4 }; static emlrtBCInfo cb_emlrtBCI = { -1, -1, 369, 23, "SaKnown", "Select_Ground_Motions", "/home/sebenik/Projects/Ground_Motion_Selection/GMS_con_cms_1gmc_dynamicInput_501_jure/Select_Ground_Motions.m", 0 }; static emlrtBCInfo db_emlrtBCI = { -1, -1, 552, 20, "RSN", "Select_Ground_Motions", "/home/sebenik/Projects/Ground_Motion_Selection/GMS_con_cms_1gmc_dynamicInput_501_jure/Select_Ground_Motions.m", 0 }; static emlrtBCInfo eb_emlrtBCI = { -1, -1, 553, 20, "idRef", "Select_Ground_Motions", "/home/sebenik/Projects/Ground_Motion_Selection/GMS_con_cms_1gmc_dynamicInput_501_jure/Select_Ground_Motions.m", 0 }; static emlrtDCInfo f_emlrtDCI = { 553, 20, "Select_Ground_Motions", "/home/sebenik/Projects/Ground_Motion_Selection/GMS_con_cms_1gmc_dynamicInput_501_jure/Select_Ground_Motions.m", 1 }; static emlrtBCInfo fb_emlrtBCI = { -1, -1, 569, 17, "SaKnown", "Select_Ground_Motions", "/home/sebenik/Projects/Ground_Motion_Selection/GMS_con_cms_1gmc_dynamicInput_501_jure/Select_Ground_Motions.m", 0 }; static emlrtBCInfo gb_emlrtBCI = { -1, -1, 570, 23, "sampleBig", "Select_Ground_Motions", "/home/sebenik/Projects/Ground_Motion_Selection/GMS_con_cms_1gmc_dynamicInput_501_jure/Select_Ground_Motions.m", 0 }; static emlrtBCInfo hb_emlrtBCI = { -1, -1, 557, 8, "recID", "Select_Ground_Motions", "/home/sebenik/Projects/Ground_Motion_Selection/GMS_con_cms_1gmc_dynamicInput_501_jure/Select_Ground_Motions.m", 0 }; static emlrtBCInfo ib_emlrtBCI = { -1, -1, 558, 8, "finalDirections_tmp", "Select_Ground_Motions", "/home/sebenik/Projects/Ground_Motion_Selection/GMS_con_cms_1gmc_dynamicInput_501_jure/Select_Ground_Motions.m", 0 }; static emlrtBCInfo jb_emlrtBCI = { -1, -1, 521, 17, "finalScaleFac", "Select_Ground_Motions", "/home/sebenik/Projects/Ground_Motion_Selection/GMS_con_cms_1gmc_dynamicInput_501_jure/Select_Ground_Motions.m", 0 }; static emlrtBCInfo kb_emlrtBCI = { -1, -1, 519, 17, "finalScaleFac", "Select_Ground_Motions", "/home/sebenik/Projects/Ground_Motion_Selection/GMS_con_cms_1gmc_dynamicInput_501_jure/Select_Ground_Motions.m", 0 }; static emlrtBCInfo lb_emlrtBCI = { -1, -1, 519, 36, "scaleFac", "Select_Ground_Motions", "/home/sebenik/Projects/Ground_Motion_Selection/GMS_con_cms_1gmc_dynamicInput_501_jure/Select_Ground_Motions.m", 0 }; static emlrtDCInfo g_emlrtDCI = { 519, 36, "Select_Ground_Motions", "/home/sebenik/Projects/Ground_Motion_Selection/GMS_con_cms_1gmc_dynamicInput_501_jure/Select_Ground_Motions.m", 1 }; static emlrtBCInfo mb_emlrtBCI = { -1, -1, 523, 72, "scaleFac", "Select_Ground_Motions", "/home/sebenik/Projects/Ground_Motion_Selection/GMS_con_cms_1gmc_dynamicInput_501_jure/Select_Ground_Motions.m", 0 }; static emlrtBCInfo nb_emlrtBCI = { -1, -1, 490, 17, "scaleFac", "Select_Ground_Motions", "/home/sebenik/Projects/Ground_Motion_Selection/GMS_con_cms_1gmc_dynamicInput_501_jure/Select_Ground_Motions.m", 0 }; static emlrtBCInfo ob_emlrtBCI = { -1, -1, 482, 40, "sampleBig", "Select_Ground_Motions", "/home/sebenik/Projects/Ground_Motion_Selection/GMS_con_cms_1gmc_dynamicInput_501_jure/Select_Ground_Motions.m", 0 }; static emlrtBCInfo pb_emlrtBCI = { -1, -1, 485, 62, "sampleBig", "Select_Ground_Motions", "/home/sebenik/Projects/Ground_Motion_Selection/GMS_con_cms_1gmc_dynamicInput_501_jure/Select_Ground_Motions.m", 0 }; static emlrtBCInfo qb_emlrtBCI = { -1, -1, 485, 21, "scaleFac", "Select_Ground_Motions", "/home/sebenik/Projects/Ground_Motion_Selection/GMS_con_cms_1gmc_dynamicInput_501_jure/Select_Ground_Motions.m", 0 }; static emlrtBCInfo rb_emlrtBCI = { -1, -1, 483, 21, "scaleFac", "Select_Ground_Motions", "/home/sebenik/Projects/Ground_Motion_Selection/GMS_con_cms_1gmc_dynamicInput_501_jure/Select_Ground_Motions.m", 0 }; static emlrtBCInfo sb_emlrtBCI = { -1, -1, 487, 63, "scaleFac", "Select_Ground_Motions", "/home/sebenik/Projects/Ground_Motion_Selection/GMS_con_cms_1gmc_dynamicInput_501_jure/Select_Ground_Motions.m", 0 }; static emlrtBCInfo tb_emlrtBCI = { -1, -1, 504, 17, "scaleFac", "Select_Ground_Motions", "/home/sebenik/Projects/Ground_Motion_Selection/GMS_con_cms_1gmc_dynamicInput_501_jure/Select_Ground_Motions.m", 0 }; static emlrtBCInfo ub_emlrtBCI = { -1, -1, 504, 43, "soil_Vs30", "Select_Ground_Motions", "/home/sebenik/Projects/Ground_Motion_Selection/GMS_con_cms_1gmc_dynamicInput_501_jure/Select_Ground_Motions.m", 0 }; static emlrtBCInfo vb_emlrtBCI = { -1, -1, 430, 11, "recID", "Select_Ground_Motions", "/home/sebenik/Projects/Ground_Motion_Selection/GMS_con_cms_1gmc_dynamicInput_501_jure/Select_Ground_Motions.m", 0 }; static emlrtBCInfo wb_emlrtBCI = { -1, -1, 437, 9, "finalScaleFac", "Select_Ground_Motions", "/home/sebenik/Projects/Ground_Motion_Selection/GMS_con_cms_1gmc_dynamicInput_501_jure/Select_Ground_Motions.m", 0 }; static emlrtBCInfo xb_emlrtBCI = { -1, -1, 435, 9, "finalScaleFac", "Select_Ground_Motions", "/home/sebenik/Projects/Ground_Motion_Selection/GMS_con_cms_1gmc_dynamicInput_501_jure/Select_Ground_Motions.m", 0 }; static emlrtBCInfo yb_emlrtBCI = { -1, -1, 435, 28, "scaleFac", "Select_Ground_Motions", "/home/sebenik/Projects/Ground_Motion_Selection/GMS_con_cms_1gmc_dynamicInput_501_jure/Select_Ground_Motions.m", 0 }; static emlrtBCInfo ac_emlrtBCI = { -1, -1, 435, 37, "recID", "Select_Ground_Motions", "/home/sebenik/Projects/Ground_Motion_Selection/GMS_con_cms_1gmc_dynamicInput_501_jure/Select_Ground_Motions.m", 0 }; static emlrtBCInfo bc_emlrtBCI = { -1, -1, 439, 42, "recID", "Select_Ground_Motions", "/home/sebenik/Projects/Ground_Motion_Selection/GMS_con_cms_1gmc_dynamicInput_501_jure/Select_Ground_Motions.m", 0 }; static emlrtBCInfo cc_emlrtBCI = { -1, -1, 439, 64, "recID", "Select_Ground_Motions", "/home/sebenik/Projects/Ground_Motion_Selection/GMS_con_cms_1gmc_dynamicInput_501_jure/Select_Ground_Motions.m", 0 }; static emlrtBCInfo dc_emlrtBCI = { -1, -1, 417, 17, "soil_Vs30", "Select_Ground_Motions", "/home/sebenik/Projects/Ground_Motion_Selection/GMS_con_cms_1gmc_dynamicInput_501_jure/Select_Ground_Motions.m", 0 }; static emlrtBCInfo ec_emlrtBCI = { -1, -1, 420, 17, "err", "Select_Ground_Motions", "/home/sebenik/Projects/Ground_Motion_Selection/GMS_con_cms_1gmc_dynamicInput_501_jure/Select_Ground_Motions.m", 0 }; static emlrtBCInfo fc_emlrtBCI = { -1, -1, 421, 20, "err", "Select_Ground_Motions", "/home/sebenik/Projects/Ground_Motion_Selection/GMS_con_cms_1gmc_dynamicInput_501_jure/Select_Ground_Motions.m", 0 }; static emlrtBCInfo gc_emlrtBCI = { -1, -1, 422, 21, "err", "Select_Ground_Motions", "/home/sebenik/Projects/Ground_Motion_Selection/GMS_con_cms_1gmc_dynamicInput_501_jure/Select_Ground_Motions.m", 0 }; static emlrtBCInfo hc_emlrtBCI = { -1, -1, 418, 17, "err", "Select_Ground_Motions", "/home/sebenik/Projects/Ground_Motion_Selection/GMS_con_cms_1gmc_dynamicInput_501_jure/Select_Ground_Motions.m", 0 }; static emlrtBCInfo ic_emlrtBCI = { -1, -1, 405, 36, "sampleBig", "Select_Ground_Motions", "/home/sebenik/Projects/Ground_Motion_Selection/GMS_con_cms_1gmc_dynamicInput_501_jure/Select_Ground_Motions.m", 0 }; static emlrtBCInfo jc_emlrtBCI = { -1, -1, 409, 58, "sampleBig", "Select_Ground_Motions", "/home/sebenik/Projects/Ground_Motion_Selection/GMS_con_cms_1gmc_dynamicInput_501_jure/Select_Ground_Motions.m", 0 }; static emlrtBCInfo kc_emlrtBCI = { -1, -1, 409, 17, "scaleFac", "Select_Ground_Motions", "/home/sebenik/Projects/Ground_Motion_Selection/GMS_con_cms_1gmc_dynamicInput_501_jure/Select_Ground_Motions.m", 0 }; static emlrtBCInfo lc_emlrtBCI = { -1, -1, 410, 21, "scaleFac", "Select_Ground_Motions", "/home/sebenik/Projects/Ground_Motion_Selection/GMS_con_cms_1gmc_dynamicInput_501_jure/Select_Ground_Motions.m", 0 }; static emlrtBCInfo mc_emlrtBCI = { -1, -1, 410, 47, "soil_Vs30", "Select_Ground_Motions", "/home/sebenik/Projects/Ground_Motion_Selection/GMS_con_cms_1gmc_dynamicInput_501_jure/Select_Ground_Motions.m", 0 }; static emlrtBCInfo nc_emlrtBCI = { -1, -1, 413, 21, "err", "Select_Ground_Motions", "/home/sebenik/Projects/Ground_Motion_Selection/GMS_con_cms_1gmc_dynamicInput_501_jure/Select_Ground_Motions.m", 0 }; static emlrtBCInfo oc_emlrtBCI = { -1, -1, 411, 21, "err", "Select_Ground_Motions", "/home/sebenik/Projects/Ground_Motion_Selection/GMS_con_cms_1gmc_dynamicInput_501_jure/Select_Ground_Motions.m", 0 }; static emlrtBCInfo pc_emlrtBCI = { -1, -1, 406, 17, "scaleFac", "Select_Ground_Motions", "/home/sebenik/Projects/Ground_Motion_Selection/GMS_con_cms_1gmc_dynamicInput_501_jure/Select_Ground_Motions.m", 0 }; static emlrtBCInfo qc_emlrtBCI = { -1, -1, 407, 17, "err", "Select_Ground_Motions", "/home/sebenik/Projects/Ground_Motion_Selection/GMS_con_cms_1gmc_dynamicInput_501_jure/Select_Ground_Motions.m", 0 }; static emlrtBCInfo rc_emlrtBCI = { -1, -1, 427, 13, "err", "Select_Ground_Motions", "/home/sebenik/Projects/Ground_Motion_Selection/GMS_con_cms_1gmc_dynamicInput_501_jure/Select_Ground_Motions.m", 0 }; static emlrtBCInfo sc_emlrtBCI = { -1, -1, 365, 43, "PerTgt", "Select_Ground_Motions", "/home/sebenik/Projects/Ground_Motion_Selection/GMS_con_cms_1gmc_dynamicInput_501_jure/Select_Ground_Motions.m", 0 }; static emlrtBCInfo tc_emlrtBCI = { -1, -1, 365, 11, "recPer", "Select_Ground_Motions", "/home/sebenik/Projects/Ground_Motion_Selection/GMS_con_cms_1gmc_dynamicInput_501_jure/Select_Ground_Motions.m", 0 }; static emlrtBCInfo uc_emlrtBCI = { -1, -1, 258, 16, "sigma", "Select_Ground_Motions", "/home/sebenik/Projects/Ground_Motion_Selection/GMS_con_cms_1gmc_dynamicInput_501_jure/Select_Ground_Motions.m", 0 }; static emlrtBCInfo vc_emlrtBCI = { -1, -1, 259, 16, "sigma", "Select_Ground_Motions", "/home/sebenik/Projects/Ground_Motion_Selection/GMS_con_cms_1gmc_dynamicInput_501_jure/Select_Ground_Motions.m", 0 }; static emlrtBCInfo wc_emlrtBCI = { -1, -1, 262, 16, "sigma", "Select_Ground_Motions", "/home/sebenik/Projects/Ground_Motion_Selection/GMS_con_cms_1gmc_dynamicInput_501_jure/Select_Ground_Motions.m", 0 }; static emlrtBCInfo xc_emlrtBCI = { -1, -1, 270, 16, "covReq", "Select_Ground_Motions", "/home/sebenik/Projects/Ground_Motion_Selection/GMS_con_cms_1gmc_dynamicInput_501_jure/Select_Ground_Motions.m", 0 }; static emlrtBCInfo yc_emlrtBCI = { -1, -1, 270, 18, "covReq", "Select_Ground_Motions", "/home/sebenik/Projects/Ground_Motion_Selection/GMS_con_cms_1gmc_dynamicInput_501_jure/Select_Ground_Motions.m", 0 }; static emlrtBCInfo ad_emlrtBCI = { -1, -1, 273, 20, "covReq", "Select_Ground_Motions", "/home/sebenik/Projects/Ground_Motion_Selection/GMS_con_cms_1gmc_dynamicInput_501_jure/Select_Ground_Motions.m", 0 }; static emlrtBCInfo bd_emlrtBCI = { -1, -1, 273, 22, "covReq", "Select_Ground_Motions", "/home/sebenik/Projects/Ground_Motion_Selection/GMS_con_cms_1gmc_dynamicInput_501_jure/Select_Ground_Motions.m", 0 }; static emlrtBCInfo cd_emlrtBCI = { -1, -1, 241, 5, "rho", "Select_Ground_Motions", "/home/sebenik/Projects/Ground_Motion_Selection/GMS_con_cms_1gmc_dynamicInput_501_jure/Select_Ground_Motions.m", 0 }; static emlrtBCInfo dd_emlrtBCI = { -1, -1, 241, 40, "PerTgt", "Select_Ground_Motions", "/home/sebenik/Projects/Ground_Motion_Selection/GMS_con_cms_1gmc_dynamicInput_501_jure/Select_Ground_Motions.m", 0 }; static emlrtBCInfo ed_emlrtBCI = { -1, -1, 228, 30, "PerTgt", "Select_Ground_Motions", "/home/sebenik/Projects/Ground_Motion_Selection/GMS_con_cms_1gmc_dynamicInput_501_jure/Select_Ground_Motions.m", 0 }; static emlrtBCInfo fd_emlrtBCI = { -1, -1, 229, 10, "sa", "Select_Ground_Motions", "/home/sebenik/Projects/Ground_Motion_Selection/GMS_con_cms_1gmc_dynamicInput_501_jure/Select_Ground_Motions.m", 0 }; static emlrtBCInfo gd_emlrtBCI = { -1, -1, 230, 13, "sigma", "Select_Ground_Motions", "/home/sebenik/Projects/Ground_Motion_Selection/GMS_con_cms_1gmc_dynamicInput_501_jure/Select_Ground_Motions.m", 0 }; /* Function Declarations */ static void b_eml_null_assignment(emxArray_real_T *x, real_T idx); static const mxArray *clock(emlrtMCInfo *location); static const mxArray *e_sum(const mxArray *b, emlrtMCInfo *location); static void eml_null_assignment(emxArray_real_T *x, real_T idx); static const mxArray *mtimes(const mxArray *b, const mxArray *c, emlrtMCInfo *location); static void rng(const mxArray *b, const mxArray *c, emlrtMCInfo *location); /* Function Definitions */ static void b_eml_null_assignment(emxArray_real_T *x, real_T idx) { boolean_T overflow; const mxArray *y; static const int32_T iv142[2] = { 1, 31 }; const mxArray *m58; char_T cv152[31]; int32_T i; static const char_T cv153[31] = { 'C', 'o', 'd', 'e', 'r', ':', 'M', 'A', 'T', 'L', 'A', 'B', ':', 's', 'u', 'b', 's', 'd', 'e', 'l', 'd', 'i', 'm', 'm', 'i', 's', 'm', 'a', 't', 'c', 'h' }; int32_T a; int32_T b; int32_T j; boolean_T b_idx; const mxArray *b_y; emxArray_real_T *b_x; emlrtHeapReferenceStackEnterFcnR2012b(emlrtRootTLSGlobal); emlrtPushRtStackR2012b(&wo_emlrtRSI, emlrtRootTLSGlobal); overflow = TRUE; if (((int32_T)idx > x->size[0]) || (idx != muDoubleScalarFloor(idx))) { overflow = FALSE; } if (overflow) { } else { emlrtPushRtStackR2012b(&yo_emlrtRSI, emlrtRootTLSGlobal); y = NULL; m58 = mxCreateCharArray(2, iv142); for (i = 0; i < 31; i++) { cv152[i] = cv153[i]; } emlrtInitCharArrayR2013a(emlrtRootTLSGlobal, 31, m58, cv152); emlrtAssign(&y, m58); error(message(y, &sc_emlrtMCI), &tc_emlrtMCI); emlrtPopRtStackR2012b(&yo_emlrtRSI, emlrtRootTLSGlobal); } emlrtPopRtStackR2012b(&wo_emlrtRSI, emlrtRootTLSGlobal); emlrtPushRtStackR2012b(&xo_emlrtRSI, emlrtRootTLSGlobal); a = x->size[0] - 1; b = x->size[1]; emlrtPushRtStackR2012b(&cp_emlrtRSI, emlrtRootTLSGlobal); if (1 > x->size[1]) { overflow = FALSE; } else { overflow = (x->size[1] > 2147483646); } if (overflow) { emlrtPushRtStackR2012b(&lc_emlrtRSI, emlrtRootTLSGlobal); check_forloop_overflow_error(); emlrtPopRtStackR2012b(&lc_emlrtRSI, emlrtRootTLSGlobal); } emlrtPopRtStackR2012b(&cp_emlrtRSI, emlrtRootTLSGlobal); for (j = 0; j + 1 <= b; j++) { emlrtPushRtStackR2012b(&ap_emlrtRSI, emlrtRootTLSGlobal); if ((int32_T)idx > a) { b_idx = FALSE; } else { b_idx = (a > 2147483646); } if (b_idx) { emlrtPushRtStackR2012b(&lc_emlrtRSI, emlrtRootTLSGlobal); check_forloop_overflow_error(); emlrtPopRtStackR2012b(&lc_emlrtRSI, emlrtRootTLSGlobal); } emlrtPopRtStackR2012b(&ap_emlrtRSI, emlrtRootTLSGlobal); for (i = (int32_T)idx; i <= a; i++) { x->data[(i + x->size[0] * j) - 1] = x->data[i + x->size[0] * j]; } } if (a <= x->size[0]) { } else { emlrtPushRtStackR2012b(&bp_emlrtRSI, emlrtRootTLSGlobal); b_y = NULL; m58 = mxCreateString("Assertion failed."); emlrtAssign(&b_y, m58); error(b_y, &uc_emlrtMCI); emlrtPopRtStackR2012b(&bp_emlrtRSI, emlrtRootTLSGlobal); } if (1 > a) { a = 0; } b_emxInit_real_T(&b_x, 2, &fd_emlrtRTEI, TRUE); i = x->size[1]; b = b_x->size[0] * b_x->size[1]; b_x->size[0] = a; b_x->size[1] = i; emxEnsureCapacity((emxArray__common *)b_x, b, (int32_T)sizeof(real_T), &fd_emlrtRTEI); for (b = 0; b < i; b++) { for (j = 0; j < a; j++) { b_x->data[j + b_x->size[0] * b] = x->data[j + x->size[0] * b]; } } b = x->size[0] * x->size[1]; x->size[0] = b_x->size[0]; x->size[1] = b_x->size[1]; emxEnsureCapacity((emxArray__common *)x, b, (int32_T)sizeof(real_T), &fd_emlrtRTEI); a = b_x->size[1]; for (b = 0; b < a; b++) { i = b_x->size[0]; for (j = 0; j < i; j++) { x->data[j + x->size[0] * b] = b_x->data[j + b_x->size[0] * b]; } } emxFree_real_T(&b_x); emlrtPopRtStackR2012b(&xo_emlrtRSI, emlrtRootTLSGlobal); emlrtHeapReferenceStackLeaveFcnR2012b(emlrtRootTLSGlobal); } static const mxArray *clock(emlrtMCInfo *location) { const mxArray *m48; return emlrtCallMATLABR2012b(emlrtRootTLSGlobal, 1, &m48, 0, NULL, "clock", TRUE, location); } static const mxArray *e_sum(const mxArray *b, emlrtMCInfo *location) { const mxArray *pArray; const mxArray *m50; pArray = b; return emlrtCallMATLABR2012b(emlrtRootTLSGlobal, 1, &m50, 1, &pArray, "sum", TRUE, location); } static void eml_null_assignment(emxArray_real_T *x, real_T idx) { boolean_T overflow; const mxArray *y; static const int32_T iv141[2] = { 1, 31 }; const mxArray *m57; char_T cv150[31]; int32_T i; static const char_T cv151[31] = { 'C', 'o', 'd', 'e', 'r', ':', 'M', 'A', 'T', 'L', 'A', 'B', ':', 's', 'u', 'b', 's', 'd', 'e', 'l', 'd', 'i', 'm', 'm', 'i', 's', 'm', 'a', 't', 'c', 'h' }; int32_T a; const mxArray *b_y; emxArray_real_T *b_x; emlrtHeapReferenceStackEnterFcnR2012b(emlrtRootTLSGlobal); emlrtPushRtStackR2012b(&wo_emlrtRSI, emlrtRootTLSGlobal); overflow = TRUE; if (((int32_T)idx > x->size[0]) || (idx != muDoubleScalarFloor(idx))) { overflow = FALSE; } if (overflow) { } else { emlrtPushRtStackR2012b(&yo_emlrtRSI, emlrtRootTLSGlobal); y = NULL; m57 = mxCreateCharArray(2, iv141); for (i = 0; i < 31; i++) { cv150[i] = cv151[i]; } emlrtInitCharArrayR2013a(emlrtRootTLSGlobal, 31, m57, cv150); emlrtAssign(&y, m57); error(message(y, &sc_emlrtMCI), &tc_emlrtMCI); emlrtPopRtStackR2012b(&yo_emlrtRSI, emlrtRootTLSGlobal); } emlrtPopRtStackR2012b(&wo_emlrtRSI, emlrtRootTLSGlobal); emlrtPushRtStackR2012b(&xo_emlrtRSI, emlrtRootTLSGlobal); a = x->size[0] - 1; emlrtPushRtStackR2012b(&ap_emlrtRSI, emlrtRootTLSGlobal); if ((int32_T)idx > x->size[0] - 1) { overflow = FALSE; } else { overflow = (x->size[0] - 1 > 2147483646); } if (overflow) { emlrtPushRtStackR2012b(&lc_emlrtRSI, emlrtRootTLSGlobal); check_forloop_overflow_error(); emlrtPopRtStackR2012b(&lc_emlrtRSI, emlrtRootTLSGlobal); } emlrtPopRtStackR2012b(&ap_emlrtRSI, emlrtRootTLSGlobal); for (i = (int32_T)idx; i <= a; i++) { x->data[i - 1] = x->data[i]; } if (a <= x->size[0]) { } else { emlrtPushRtStackR2012b(&bp_emlrtRSI, emlrtRootTLSGlobal); b_y = NULL; m57 = mxCreateString("Assertion failed."); emlrtAssign(&b_y, m57); error(b_y, &uc_emlrtMCI); emlrtPopRtStackR2012b(&bp_emlrtRSI, emlrtRootTLSGlobal); } if (1 > a) { i = 0; } else { i = a; } emxInit_real_T(&b_x, 1, &fd_emlrtRTEI, TRUE); a = b_x->size[0]; b_x->size[0] = i; emxEnsureCapacity((emxArray__common *)b_x, a, (int32_T)sizeof(real_T), &fd_emlrtRTEI); for (a = 0; a < i; a++) { b_x->data[a] = x->data[a]; } a = x->size[0]; x->size[0] = b_x->size[0]; emxEnsureCapacity((emxArray__common *)x, a, (int32_T)sizeof(real_T), &fd_emlrtRTEI); i = b_x->size[0]; for (a = 0; a < i; a++) { x->data[a] = b_x->data[a]; } emxFree_real_T(&b_x); emlrtPopRtStackR2012b(&xo_emlrtRSI, emlrtRootTLSGlobal); emlrtHeapReferenceStackLeaveFcnR2012b(emlrtRootTLSGlobal); } static const mxArray *mtimes(const mxArray *b, const mxArray *c, emlrtMCInfo *location) { const mxArray *pArrays[2]; const mxArray *m49; pArrays[0] = b; pArrays[1] = c; return emlrtCallMATLABR2012b(emlrtRootTLSGlobal, 1, &m49, 2, pArrays, "mtimes", TRUE, location); } static void rng(const mxArray *b, const mxArray *c, emlrtMCInfo *location) { const mxArray *pArrays[2]; pArrays[0] = b; pArrays[1] = c; emlrtCallMATLABR2012b(emlrtRootTLSGlobal, 0, NULL, 2, pArrays, "rng", TRUE, location); } void Select_Ground_Motions(const emxArray_real_T *idRef, const emxArray_real_T *Sa_1, const emxArray_real_T *Sa_2, const emxArray_real_T *sVs30, real_T nGM, real_T T1, real_T isScaled, real_T maxScale, real_T weight_mean, real_T weight_sd, real_T nLoop, real_T penalty, real_T checkCorr, real_T seedValue, real_T M_bar, real_T R_bar, real_T eps_bar, real_T Vs30, real_T Ztor, real_T delta, real_T lambda, real_T Zvs, real_T arb, real_T nX, real_T useVar, emxArray_real_T *finalRecords, emxArray_real_T *finalDirectios, emxArray_real_T *finalScaleFactors, emxArray_real_T *F_x, emxArray_real_T *F1_y1, emxArray_real_T *F1_y2, emxArray_real_T *F1_y3, emxArray_real_T *F1_yn, emxArray_real_T *F2_y1, emxArray_real_T *F3_y1, emxArray_real_T *F3_y2, real_T F4_x1[501], emxArray_real_T *F4_y1, emxArray_real_T *F5_y1, emxArray_real_T *F6_y1, emxArray_real_T *F7_y1, real_T *errCode) { int32_T i0; static const real_T dv0[501] = { 0.0, 0.01, 0.02, 0.03, 0.04, 0.05, 0.06, 0.07, 0.08, 0.09, 0.1, 0.11, 0.12, 0.13, 0.14, 0.15, 0.16, 0.17, 0.18, 0.19, 0.2, 0.21, 0.22, 0.23, 0.24, 0.25, 0.26, 0.27, 0.28, 0.29, 0.3, 0.31, 0.32, 0.33, 0.34, 0.35, 0.36, 0.37, 0.38, 0.39, 0.4, 0.41, 0.42, 0.43, 0.44, 0.45, 0.46, 0.47, 0.48, 0.49, 0.5, 0.51, 0.52, 0.53, 0.54, 0.55, 0.56, 0.57, 0.58, 0.59, 0.6, 0.61, 0.62, 0.63, 0.64, 0.65, 0.66, 0.67, 0.68, 0.69, 0.7, 0.71, 0.72, 0.73, 0.74, 0.75, 0.76, 0.77, 0.78, 0.79, 0.8, 0.81, 0.82, 0.83, 0.84, 0.85, 0.86, 0.87, 0.88, 0.89, 0.9, 0.91, 0.92, 0.93, 0.94, 0.95, 0.96, 0.97, 0.98, 0.99, 1.0, 1.01, 1.02, 1.03, 1.04, 1.05, 1.06, 1.07, 1.08, 1.09, 1.1, 1.11, 1.12, 1.13, 1.14, 1.15, 1.16, 1.17, 1.18, 1.19, 1.2, 1.21, 1.22, 1.23, 1.24, 1.25, 1.26, 1.27, 1.28, 1.29, 1.3, 1.31, 1.32, 1.33, 1.34, 1.35, 1.36, 1.37, 1.38, 1.39, 1.4, 1.41, 1.42, 1.43, 1.44, 1.45, 1.46, 1.47, 1.48, 1.49, 1.5, 1.51, 1.52, 1.53, 1.54, 1.55, 1.56, 1.57, 1.58, 1.59, 1.6, 1.61, 1.62, 1.63, 1.64, 1.65, 1.66, 1.67, 1.68, 1.69, 1.7, 1.71, 1.72, 1.73, 1.74, 1.75, 1.76, 1.77, 1.78, 1.79, 1.8, 1.81, 1.82, 1.83, 1.84, 1.85, 1.86, 1.87, 1.88, 1.89, 1.9, 1.91, 1.92, 1.93, 1.94, 1.95, 1.96, 1.97, 1.98, 1.99, 2.0, 2.01, 2.02, 2.03, 2.04, 2.05, 2.06, 2.07, 2.08, 2.09, 2.1, 2.11, 2.12, 2.13, 2.14, 2.15, 2.16, 2.17, 2.18, 2.19, 2.2, 2.21, 2.22, 2.23, 2.24, 2.25, 2.26, 2.27, 2.28, 2.29, 2.3, 2.31, 2.32, 2.33, 2.34, 2.35, 2.36, 2.37, 2.38, 2.39, 2.4, 2.41, 2.42, 2.43, 2.44, 2.45, 2.46, 2.47, 2.48, 2.49, 2.5, 2.51, 2.52, 2.53, 2.54, 2.55, 2.56, 2.57, 2.58, 2.59, 2.6, 2.61, 2.62, 2.63, 2.64, 2.65, 2.66, 2.67, 2.68, 2.69, 2.7, 2.71, 2.72, 2.73, 2.74, 2.75, 2.76, 2.77, 2.78, 2.79, 2.8, 2.81, 2.82, 2.83, 2.84, 2.85, 2.86, 2.87, 2.88, 2.89, 2.9, 2.91, 2.92, 2.93, 2.94, 2.95, 2.96, 2.97, 2.98, 2.99, 3.0, 3.02, 3.04, 3.06, 3.08, 3.1, 3.12, 3.14, 3.16, 3.18, 3.2, 3.22, 3.24, 3.26, 3.28, 3.3, 3.32, 3.34, 3.36, 3.38, 3.4, 3.42, 3.44, 3.46, 3.48, 3.5, 3.52, 3.54, 3.56, 3.58, 3.6, 3.62, 3.64, 3.66, 3.68, 3.7, 3.72, 3.74, 3.76, 3.78, 3.8, 3.82, 3.84, 3.86, 3.88, 3.9, 3.92, 3.94, 3.96, 3.98, 4.0, 4.02, 4.04, 4.06, 4.08, 4.1, 4.12, 4.14, 4.16, 4.18, 4.2, 4.22, 4.24, 4.26, 4.28, 4.3, 4.32, 4.34, 4.36, 4.38, 4.4, 4.42, 4.44, 4.46, 4.48, 4.5, 4.52, 4.54, 4.56, 4.58, 4.6, 4.62, 4.64, 4.66, 4.68, 4.7, 4.72, 4.74, 4.76, 4.78, 4.8, 4.82, 4.84, 4.86, 4.88, 4.9, 4.92, 4.94, 4.96, 4.98, 5.0, 5.05, 5.1, 5.15, 5.2, 5.25, 5.3, 5.35, 5.4, 5.45, 5.5, 5.55, 5.6, 5.65, 5.7, 5.75, 5.8, 5.85, 5.9, 5.95, 6.0, 6.05, 6.1, 6.15, 6.2, 6.25, 6.3, 6.35, 6.4, 6.45, 6.5, 6.55, 6.6, 6.65, 6.7, 6.75, 6.8, 6.85, 6.9, 6.95, 7.0, 7.05, 7.1, 7.15, 7.2, 7.25, 7.3, 7.35, 7.4, 7.45, 7.5, 7.55, 7.6, 7.65, 7.7, 7.75, 7.8, 7.85, 7.9, 7.95, 8.0, 8.05, 8.1, 8.15, 8.2, 8.25, 8.3, 8.35, 8.4, 8.45, 8.5, 8.55, 8.6, 8.65, 8.7, 8.75, 8.8, 8.85, 8.9, 8.95, 9.0, 9.05, 9.1, 9.15, 9.2, 9.25, 9.3, 9.35, 9.4, 9.45, 9.5, 9.55, 9.6, 9.65, 9.7, 9.75, 9.8, 9.85, 9.9, 9.95, 10.0 }; emxArray_real_T *recID; real_T minID; real_T b; int32_T loop_ub; emxArray_real_T *SaKnown; int32_T i1; int32_T b_loop_ub; int32_T cdiff; int32_T apnd; int32_T ndbl; int32_T absb; emxArray_real_T *PerTgt_tmp; int32_T k; emxArray_real_T *rho; emxArray_real_T *RSN; emxArray_real_T *soil_Vs30; emxArray_boolean_T *b_PerTgt_tmp; boolean_T overflow; emxArray_int32_T *ii; emxArray_int32_T *b_ii; emxArray_boolean_T *c_PerTgt_tmp; emxArray_boolean_T *d_PerTgt_tmp; emxArray_boolean_T *x; boolean_T exitg7; boolean_T guard4 = FALSE; const mxArray *y; const mxArray *m0; emxArray_int32_T *r0; emxArray_int32_T *c_ii; emxArray_real_T *posT1; emxArray_real_T *sa; emxArray_real_T *sigma; int32_T i; emxArray_real_T *r1; int32_T iv0[2]; int32_T b_rho[2]; emxArray_boolean_T *b_F_x; emxArray_real_T *lnSa1; emxArray_real_T *covReq; emxArray_real_T *varT; emxArray_real_T *sigma11; emxArray_real_T *sigma12; emxArray_real_T *b_b; emxArray_real_T *b_y; emxArray_real_T *c_b; emxArray_real_T *r2; emxArray_real_T *b_sigma; emxArray_real_T *c_sigma; emxArray_real_T *d_sigma; emxArray_int32_T *r3; emxArray_int32_T *r4; emxArray_int32_T *r5; emxArray_int32_T *d_ii; emxArray_int32_T *e_ii; emxArray_int32_T *f_ii; int32_T j; boolean_T exitg6; boolean_T guard3 = FALSE; const mxArray *c_y; boolean_T exitg5; boolean_T guard2 = FALSE; const mxArray *d_y; boolean_T exitg4; boolean_T guard1 = FALSE; const mxArray *e_y; const mxArray *f_y; static const int32_T iv1[2] = { 1, 45 }; char_T cv0[45]; static const char_T cv1[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 *g_y; static const int32_T iv2[2] = { 1, 21 }; char_T cv2[21]; static const char_T cv3[21] = { 'C', 'o', 'd', 'e', 'r', ':', 'M', 'A', 'T', 'L', 'A', 'B', ':', 'i', 'n', 'n', 'e', 'r', 'd', 'i', 'm' }; const mxArray *h_y; static const int32_T iv3[2] = { 1, 45 }; const mxArray *i_y; static const int32_T iv4[2] = { 1, 21 }; const mxArray *j_y; static const int32_T iv5[2] = { 1, 45 }; const mxArray *k_y; static const int32_T iv6[2] = { 1, 21 }; const mxArray *l_y; static const int32_T iv7[2] = { 1, 45 }; const mxArray *m_y; static const int32_T iv8[2] = { 1, 21 }; const mxArray *n_y; static const int32_T iv9[2] = { 1, 45 }; const mxArray *o_y; static const int32_T iv10[2] = { 1, 21 }; const mxArray *p_y; static const int32_T iv11[2] = { 1, 21 }; real_T q_y[4]; 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; const mxArray *r_y; static const int32_T iv12[2] = { 1, 2 }; char_T cv4[2]; static const char_T cv5[2] = { 'v', '4' }; const mxArray *s_y; static const int32_T iv13[2] = { 1, 2 }; real_T devTotalSim[20]; emxArray_real_T *tempf; emxArray_int32_T *r6; emxArray_real_T *d_b; emxArray_real_T *r7; emxArray_real_T *r8; emxArray_real_T *r9; int32_T iv14[2]; int32_T e_b[2]; int32_T devTotal_size[1]; real_T devTotal_data[1]; real_T b_devTotalSim[20]; boolean_T exitg3; emxArray_real_T *recPer; real_T b_F4_x1[501]; real_T varargin_1[501]; boolean_T exitg2; emxArray_boolean_T *r10; emxArray_real_T *sampleBig; emxArray_real_T *sampleSmall; emxArray_real_T *scaleFac; emxArray_boolean_T *b_recID; emxArray_real_T *b_sampleBig; emxArray_real_T *e_PerTgt_tmp; emxArray_real_T *r11; emxArray_boolean_T *c_F_x; emxArray_boolean_T *r12; emxArray_real_T *r13; emxArray_int32_T *r14; emxArray_real_T *b_tempf; emxArray_real_T *c_sampleBig; emxArray_real_T *c_tempf; boolean_T b_guard3 = FALSE; const mxArray *t_y; static const int32_T iv15[2] = { 1, 36 }; char_T cv6[36]; static const char_T cv7[36] = { 'C', 'o', 'd', 'e', 'r', ':', 't', 'o', 'o', 'l', 'b', 'o', 'x', ':', 'a', 'u', 't', 'o', 'D', 'i', 'm', 'I', 'n', 'c', 'o', 'm', 'p', 'a', 't', 'i', 'b', 'i', 'l', 'i', 't', 'y' }; const mxArray *u_y; static const int32_T iv16[2] = { 1, 39 }; char_T cv8[39]; static const char_T cv9[39] = { 'C', 'o', 'd', 'e', 'r', ':', 't', 'o', 'o', 'l', 'b', 'o', 'x', ':', 'e', 'm', 'l', '_', 'm', 'i', 'n', '_', 'o', 'r', '_', 'm', 'a', 'x', '_', 'v', 'a', 'r', 'D', 'i', 'm', 'Z', 'e', 'r', 'o' }; boolean_T exitg1; int32_T iv17[2]; emxArray_boolean_T *c_recID; emxArray_real_T *b_idRef; emxArray_boolean_T *d_recID; emxArray_real_T *r15; emxArray_real_T *r16; emxArray_real_T *r17; emxArray_boolean_T *d_F_x; emxArray_boolean_T *r18; emxArray_boolean_T *r19; emxArray_boolean_T *b_recPer; emxArray_real_T *r20; emxArray_int32_T *r21; emxArray_real_T *b_SaKnown; emxArray_real_T *b_sampleSmall; emxArray_real_T *e_recID; emxArray_real_T *c_sampleSmall; emxArray_real_T *d_sampleSmall; emxArray_real_T *e_sampleSmall; emxArray_real_T *f_sampleSmall; boolean_T b_guard1 = FALSE; real_T minDev; real_T a_data[1]; boolean_T b_guard2 = FALSE; boolean_T b_devTotal_data[1]; int32_T b_devTotal_size[1]; emxArray_boolean_T c_devTotal_data; emlrtHeapReferenceStackEnterFcnR2012b(emlrtRootTLSGlobal); for (i0 = 0; i0 < 501; i0++) { F4_x1[i0] = dv0[i0]; } emxInit_real_T(&recID, 1, &d_emlrtRTEI, TRUE); /* compileReplaceIncludes */ *errCode = 0.0; /* finalRecords_tmp=0; */ i0 = finalDirectios->size[0]; finalDirectios->size[0] = 1; emxEnsureCapacity((emxArray__common *)finalDirectios, i0, (int32_T)sizeof (real_T), &emlrtRTEI); finalDirectios->data[0] = 0.0; /* coder.varsize('notAllowed'); */ minID = muDoubleScalarRound(nGM); i0 = recID->size[0]; b = emlrtNonNegativeCheckFastR2012b(minID, &c_emlrtDCI, emlrtRootTLSGlobal); recID->size[0] = (int32_T)emlrtIntegerCheckFastR2012b(b, &b_emlrtDCI, emlrtRootTLSGlobal); emxEnsureCapacity((emxArray__common *)recID, i0, (int32_T)sizeof(real_T), &emlrtRTEI); b = emlrtNonNegativeCheckFastR2012b(minID, &c_emlrtDCI, emlrtRootTLSGlobal); loop_ub = (int32_T)emlrtIntegerCheckFastR2012b(b, &b_emlrtDCI, emlrtRootTLSGlobal); for (i0 = 0; i0 < loop_ub; i0++) { recID->data[i0] = 0.0; } b_emxInit_real_T(&SaKnown, 2, &e_emlrtRTEI, TRUE); /* This code is used to select conditional (structure- and site- specific) */ /* ground motions. The target means and covariances are obtained */ /* corresponding to a pre-defined target scenario earthquake, and are */ /* obtained based on the CMS method. The target means and variances can be */ /* modified by the user. The ground motion selection algorithm used here is */ /* based on a single arbitrary ground motion component (for two-dimensional */ /* structural models), instead of the geometric mean of two ground motion */ /* components (for three-dimensional structural models), as described in */ /* Jayaram et al. (2010). This is used to select ground motions for */ /* two-dimensional structural models, where a single ground motion component */ /* is required as an input for every time history analysis. */ /* */ /* Nirmal Jayaram, Ting Lin, Jack W. Baker */ /* Department of Civil and Environmental Engineering */ /* Stanford University */ /* Last Updated: 7 June 2010 */ /* */ /* Referenced manuscripts: */ /* */ /* N. Jayaram, T. Lin and and Baker, J. W. (2010). A computationally */ /* efficient ground-motion selection algorithm for matching a target */ /* response spectrum mean and variance, Earthquake Spectra, (in press). */ /* */ /* N. Jayaram and Baker, J. W. (2010). Ground-motion selection for PEER */ /* Transportation Systems Research Program, 7th CUEE and 5th ICEE Joint */ /* Conference, Tokyo, Japan. */ /* */ /* J. W. Baker and Jayaram, N. (2008). Correlation of spectral acceleration */ /* values from NGA ground motion models, Earthquake Spectra, 24 (1), 299-317 */ /* */ /* Baker, J.W. (2010). The Conditional Mean Spectrum: A tool for ground */ /* motion selection, ASCE Journal of Structural Engineering, (in press). */ /* */ /* % */ /* */ /* %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% */ /* */ /* OUTPUT VARIABLES */ /* finalRecords : Record numbers of selected records */ /* finalScaleFactors : Scale factors */ /* */ /* The final cell in this m file shows how to plot the selected spectra */ /* using this information. */ /* */ /* %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% */ /* % Load workspace containing ground-motion information. Here, the NGA */ /* database is used. Documentation of the NGA database workspace */ /* 'rec_selection_meta_data.mat' can be found at 'WorkspaceDocumentation.m'. */ /* For an alternate database, the minimum information to be provided */ /* includes the pseudo-acceleration spectra of the available, ground */ /* motions, periods at which the spectra are defined, and other information */ /* required to compute means and variances using ground-motion models. */ /* This cell can be modified by the user if desired. */ /* */ /* Variable definitions */ /* saKnown : (N*P matrix) */ /* This is a matrix of Sa values at different periods (P) for */ /* available ground-motion time histories (N). */ /* perKnown : The set of P periods. */ /* nGM : Number of ground motions to be selected */ /* T1 : Period at which spectra should be scaled and matched. */ /* Usually, the structure's fundamental period. */ /* isScaled : Should spectra be scaled before matching (1 -YES, 0-NO). */ /* maxScale : Maximum allowable scale factor. */ /* weights : [Weight for error in mean, Weight for error in standard */ /* deviation] e.g., [1.0,1.0] - equal weight for both errors. */ /* nLoop : This is a meta-variable of the algorithm. The greedy */ /* improvement technique does several passes over the available */ /* data set and tries to improve the selected records. This */ /* variable denotes the number of passes. Recommended value: 2. */ /* penalty : If a penalty needs to be applied to avoid selecting spectra */ /* that have spectral acceleration values beyond 3 sigma at any */ /* of the periods, set a value here. Use 0 otherwise. */ /* notAllowed: List of record numbers that should not be considered for */ /* selection. Use [] to consider all available records. This can */ /* be used to prevent certain magnitude-distance-Vs30 records */ /* from being selected, if desired. (see example below) */ /* checkCorr : If 1, this runs a code that compares the correlation */ /* structure of the selected ground motions to the correlations */ /* published by Baker and Jayaram (2008). */ /* seedValue : For repeatability. For a particular seedValue not equal to */ /* zero, the code will output the same set of ground motions. */ /* The set will change when the seedValue changes. If set to */ /* zero, the code randomizes the algorithm and different sets of */ /* ground motions (satisfying the target mean and variance) are */ /* generated each time. */ /* outputFile: File name of the output file */ /* */ /* If a database other than the NGA database is used, also define the */ /* following variables: */ /* */ /* magnitude : Magnitude of all the records */ /* distance_closest : Closest distance for all the records */ /* soil_Vs30 : Soil Vs30 values corresponding to all the records */ /* */ /* %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% */ /* User inputs begin here */ /* Information from the NGA database */ /* Each horizontal component of a recording from the same station in the NGA */ /* database is treated separately as an individual ground motion. */ i0 = Sa_1->size[1]; i1 = Sa_2->size[1]; emlrtDimSizeEqCheckFastR2012b(i0, i1, &bb_emlrtECI, emlrtRootTLSGlobal); i0 = SaKnown->size[0] * SaKnown->size[1]; SaKnown->size[0] = Sa_1->size[0] + Sa_2->size[0]; SaKnown->size[1] = Sa_1->size[1]; emxEnsureCapacity((emxArray__common *)SaKnown, i0, (int32_T)sizeof(real_T), &emlrtRTEI); loop_ub = Sa_1->size[1]; for (i0 = 0; i0 < loop_ub; i0++) { b_loop_ub = Sa_1->size[0]; for (i1 = 0; i1 < b_loop_ub; i1++) { SaKnown->data[i1 + SaKnown->size[0] * i0] = Sa_1->data[i1 + Sa_1->size[0] * i0]; } } loop_ub = Sa_2->size[1]; for (i0 = 0; i0 < loop_ub; i0++) { b_loop_ub = Sa_2->size[0]; for (i1 = 0; i1 < b_loop_ub; i1++) { SaKnown->data[(i1 + Sa_1->size[0]) + SaKnown->size[0] * i0] = Sa_2-> data[i1 + Sa_2->size[0] * i0]; } } /* %% */ emlrtPushRtStackR2012b(&b_emlrtRSI, emlrtRootTLSGlobal); emlrtPushRtStackR2012b(&gc_emlrtRSI, emlrtRootTLSGlobal); emlrtPushRtStackR2012b(&hc_emlrtRSI, emlrtRootTLSGlobal); if (Sa_1->size[0] < 1) { cdiff = -1; apnd = 0; } else { ndbl = (int32_T)muDoubleScalarFloor(((real_T)Sa_1->size[0] - 1.0) + 0.5); apnd = ndbl + 1; cdiff = (ndbl - Sa_1->size[0]) + 1; absb = Sa_1->size[0]; if (muDoubleScalarAbs(cdiff) < 4.4408920985006262E-16 * (real_T)absb) { ndbl++; apnd = Sa_1->size[0]; } else if (cdiff > 0) { apnd = ndbl; } else { ndbl++; } cdiff = ndbl - 1; } b_emxInit_real_T(&PerTgt_tmp, 2, &h_emlrtRTEI, TRUE); emlrtPushRtStackR2012b(&ic_emlrtRSI, emlrtRootTLSGlobal); emlrtPopRtStackR2012b(&ic_emlrtRSI, emlrtRootTLSGlobal); i0 = PerTgt_tmp->size[0] * PerTgt_tmp->size[1]; PerTgt_tmp->size[0] = 1; PerTgt_tmp->size[1] = cdiff + 1; emxEnsureCapacity((emxArray__common *)PerTgt_tmp, i0, (int32_T)sizeof(real_T), &b_emlrtRTEI); if (cdiff + 1 > 0) { PerTgt_tmp->data[0] = 1.0; if (cdiff + 1 > 1) { PerTgt_tmp->data[cdiff] = apnd; i0 = cdiff + (cdiff < 0); if (i0 >= 0) { ndbl = (int32_T)((uint32_T)i0 >> 1); } else { ndbl = ~(int32_T)((uint32_T)~i0 >> 1); } emlrtPushRtStackR2012b(&jc_emlrtRSI, emlrtRootTLSGlobal); emlrtPopRtStackR2012b(&jc_emlrtRSI, emlrtRootTLSGlobal); for (k = 1; k < ndbl; k++) { PerTgt_tmp->data[k] = 1.0 + (real_T)k; PerTgt_tmp->data[cdiff - k] = apnd - k; } if (ndbl << 1 == cdiff) { PerTgt_tmp->data[ndbl] = (1.0 + (real_T)apnd) / 2.0; } else { PerTgt_tmp->data[ndbl] = 1.0 + (real_T)ndbl; PerTgt_tmp->data[ndbl + 1] = apnd - ndbl; } } } emlrtPopRtStackR2012b(&hc_emlrtRSI, emlrtRootTLSGlobal); emlrtPopRtStackR2012b(&gc_emlrtRSI, emlrtRootTLSGlobal); emlrtPushRtStackR2012b(&gc_emlrtRSI, emlrtRootTLSGlobal); emlrtPushRtStackR2012b(&hc_emlrtRSI, emlrtRootTLSGlobal); if (Sa_1->size[0] < 1) { cdiff = -1; apnd = 0; } else { ndbl = (int32_T)muDoubleScalarFloor(((real_T)Sa_1->size[0] - 1.0) + 0.5); apnd = ndbl + 1; cdiff = (ndbl - Sa_1->size[0]) + 1; absb = Sa_1->size[0]; if (muDoubleScalarAbs(cdiff) < 4.4408920985006262E-16 * (real_T)absb) { ndbl++; apnd = Sa_1->size[0]; } else if (cdiff > 0) { apnd = ndbl; } else { ndbl++; } cdiff = ndbl - 1; } b_emxInit_real_T(&rho, 2, &l_emlrtRTEI, TRUE); emlrtPushRtStackR2012b(&ic_emlrtRSI, emlrtRootTLSGlobal); emlrtPopRtStackR2012b(&ic_emlrtRSI, emlrtRootTLSGlobal); i0 = rho->size[0] * rho->size[1]; rho->size[0] = 1; rho->size[1] = cdiff + 1; emxEnsureCapacity((emxArray__common *)rho, i0, (int32_T)sizeof(real_T), &b_emlrtRTEI); if (cdiff + 1 > 0) { rho->data[0] = 1.0; if (cdiff + 1 > 1) { rho->data[cdiff] = apnd; i0 = cdiff + (cdiff < 0); if (i0 >= 0) { ndbl = (int32_T)((uint32_T)i0 >> 1); } else { ndbl = ~(int32_T)((uint32_T)~i0 >> 1); } emlrtPushRtStackR2012b(&jc_emlrtRSI, emlrtRootTLSGlobal); emlrtPopRtStackR2012b(&jc_emlrtRSI, emlrtRootTLSGlobal); for (k = 1; k < ndbl; k++) { rho->data[k] = 1.0 + (real_T)k; rho->data[cdiff - k] = apnd - k; } if (ndbl << 1 == cdiff) { rho->data[ndbl] = (1.0 + (real_T)apnd) / 2.0; } else { rho->data[ndbl] = 1.0 + (real_T)ndbl; rho->data[ndbl + 1] = apnd - ndbl; } } } emxInit_real_T(&RSN, 1, &f_emlrtRTEI, TRUE); emlrtPopRtStackR2012b(&hc_emlrtRSI, emlrtRootTLSGlobal); emlrtPopRtStackR2012b(&gc_emlrtRSI, emlrtRootTLSGlobal); i0 = RSN->size[0]; RSN->size[0] = PerTgt_tmp->size[1] + rho->size[1]; emxEnsureCapacity((emxArray__common *)RSN, i0, (int32_T)sizeof(real_T), &emlrtRTEI); loop_ub = PerTgt_tmp->size[1]; for (i0 = 0; i0 < loop_ub; i0++) { RSN->data[i0] = PerTgt_tmp->data[i0]; } loop_ub = rho->size[1]; for (i0 = 0; i0 < loop_ub; i0++) { RSN->data[i0 + PerTgt_tmp->size[1]] = rho->data[i0]; } emxInit_real_T(&soil_Vs30, 1, &g_emlrtRTEI, TRUE); emlrtPopRtStackR2012b(&b_emlrtRSI, emlrtRootTLSGlobal); /* Filename = [Filename_1; Filename_2]; */ i0 = soil_Vs30->size[0]; soil_Vs30->size[0] = sVs30->size[0] + sVs30->size[0]; emxEnsureCapacity((emxArray__common *)soil_Vs30, i0, (int32_T)sizeof(real_T), &emlrtRTEI); loop_ub = sVs30->size[0]; for (i0 = 0; i0 < loop_ub; i0++) { soil_Vs30->data[i0] = sVs30->data[i0]; } loop_ub = sVs30->size[0]; for (i0 = 0; i0 < loop_ub; i0++) { soil_Vs30->data[i0 + sVs30->size[0]] = sVs30->data[i0]; } emxInit_boolean_T(&b_PerTgt_tmp, 2, &emlrtRTEI, TRUE); /* mechanism = [mechanism; mechanism]; */ /* magnitude = [magnitude_; magnitude_]; */ /* lowest_usable_freq = [lowest_usable_freq; lowest_usable_freq]; */ /* distance_jb = [distance_jb; distance_jb]; */ /* distance_hyp = [distance_hyp; distance_hyp]; */ /* distance_epi = [distance_epi; distance_epi]; */ /* distance_closest = [distance_closest_; distance_closest_]; */ /* distance_campbell = [distance_campbell; distance_campbell]; */ /* %% */ /* nGM = 10; */ /* T1 = 2.63; */ /* isScaled = 1; */ /* maxScale = 4; */ /* nLoop = 2; */ /* penalty = 0; */ /* checkCorr = 1; */ /* seedValue = 1; */ /* outputFile = 'Output_File.dat'; */ /* NOTE: MORE user input required in the next cell */ /* Limit records without acc. data. */ /* List of missing records: Usability testing of application programming */ /* interface for SAP2000, appendix B; Žiga Šebenik 2013 */ /* notAllowed = [notAllowed; 260; 930; 1171; 1298; 2136]; */ /* notAllowed = [notAllowed; 29; 168; 177; 267; 361; 365; 378; 473; 474; 475; 500; 599; 660; 805; 1635; 1753; 1774;]; */ /* notAllowed = [notAllowed; 43; 61; 78; 98; 104; 105; 106; 256; 275; 361; 390; 425; 436; 437; 438; 439; 442; 443; 444; 446; 496; 517; 530; 532; 651; 719; 720; 722; 723; 724; 725; 726; 727; 803; 822; 973; 1048; 1122; 1132; 1134; 1299; 1591; 1628; 1629; 1694; 1696; 1701; 1720; 1732; 3549; 3550; 3551]; */ /* Limiting the records to be considered using the `notAllowed' variable */ /* Using a different ground-motion database: */ /* MORE user input in the next cell */ /* %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% */ /* % Determination of target mean and covariances */ /* The Campbell and Bozorgnia (2008) ground-motion model is used in this */ /* code. The input variables defined below are the inputs required for this */ /* model. The user can change the ground-motion model as long as any */ /* additional information that may be required by the new model is provided. */ /* Please refer to Baker (2010) for details on the conditional mean spectrum */ /* method which is used for obtaining the target means and covariances in */ /* this example. Alternately, the details are summarized in Jayaram et al. */ /* (2010). */ /* The code provides the user an option to not match the target variance. */ /* This is done by setting the target variance to zero so that each selected */ /* response spectrum matches the target mean response spectrum. */ /* Variable definitions */ /* M_bar : Magnitude of the target scenario earthquake */ /* R_bar : Distance corresponding to the target scenario earthquake */ /* eps_bar : Epsilon value for the target scenario */ /* Vs30 : Average shear wave velocity in the top 30m of the soil, used */ /* to model local site effects (m/s) */ /* Ztor : Depth to the top of coseismic rupture (km) */ /* delta : Average dip of the rupture place (degree) */ /* lambda : Rake angle (degree) */ /* Zvs : Depth to the 2.5 km/s shear-wave velocity horizon (km) */ /* arb : 1 for arbitrary component sigma */ /* 0 for average component sigma */ /* PerTgt : Periods at which the target spectrum needs to be computed */ /* showPlots : 1 to display plots, 0 otherwise */ /* useVar : 0 to set target variance to zero, 1 to compute target */ /* variance using ground-motion model */ /* %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% */ /* User inputs begin here */ /* M_bar = 7; */ /* R_bar = 10; */ /* eps_bar = 2; */ /* Vs30 = 400; */ /* Ztor = 0; */ /* delta = 90; */ /* lambda = 180; */ /* Zvs = 2; */ /* arb = 1; % Arbitrary component */ linspace(nX, PerTgt_tmp); /* useVar = 1; */ /* Can be modified by the user */ /* Can be modified by the user */ /* Modify perTgt to include T1 */ emlrtPushRtStackR2012b(&c_emlrtRSI, emlrtRootTLSGlobal); i0 = b_PerTgt_tmp->size[0] * b_PerTgt_tmp->size[1]; b_PerTgt_tmp->size[0] = 1; b_PerTgt_tmp->size[1] = PerTgt_tmp->size[1]; emxEnsureCapacity((emxArray__common *)b_PerTgt_tmp, i0, (int32_T)sizeof (boolean_T), &emlrtRTEI); loop_ub = PerTgt_tmp->size[0] * PerTgt_tmp->size[1]; for (i0 = 0; i0 < loop_ub; i0++) { b_PerTgt_tmp->data[i0] = (PerTgt_tmp->data[i0] == T1); } overflow = !any(b_PerTgt_tmp); emlrtPopRtStackR2012b(&c_emlrtRSI, emlrtRootTLSGlobal); emxFree_boolean_T(&b_PerTgt_tmp); b_emxInit_int32_T(&ii, 2, &w_emlrtRTEI, TRUE); b_emxInit_int32_T(&b_ii, 2, &w_emlrtRTEI, TRUE); if (overflow) { emxInit_boolean_T(&c_PerTgt_tmp, 2, &emlrtRTEI, TRUE); emlrtPushRtStackR2012b(&d_emlrtRSI, emlrtRootTLSGlobal); i0 = c_PerTgt_tmp->size[0] * c_PerTgt_tmp->size[1]; c_PerTgt_tmp->size[0] = 1; c_PerTgt_tmp->size[1] = PerTgt_tmp->size[1]; emxEnsureCapacity((emxArray__common *)c_PerTgt_tmp, i0, (int32_T)sizeof (boolean_T), &emlrtRTEI); loop_ub = PerTgt_tmp->size[0] * PerTgt_tmp->size[1]; for (i0 = 0; i0 < loop_ub; i0++) { c_PerTgt_tmp->data[i0] = (PerTgt_tmp->data[i0] < T1); } emxInit_boolean_T(&d_PerTgt_tmp, 2, &emlrtRTEI, TRUE); eml_li_find(c_PerTgt_tmp, ii); i0 = d_PerTgt_tmp->size[0] * d_PerTgt_tmp->size[1]; d_PerTgt_tmp->size[0] = 1; d_PerTgt_tmp->size[1] = PerTgt_tmp->size[1]; emxEnsureCapacity((emxArray__common *)d_PerTgt_tmp, i0, (int32_T)sizeof (boolean_T), &emlrtRTEI); loop_ub = PerTgt_tmp->size[0] * PerTgt_tmp->size[1]; emxFree_boolean_T(&c_PerTgt_tmp); for (i0 = 0; i0 < loop_ub; i0++) { d_PerTgt_tmp->data[i0] = (PerTgt_tmp->data[i0] > T1); } eml_li_find(d_PerTgt_tmp, b_ii); i0 = F_x->size[0] * F_x->size[1]; F_x->size[0] = 1; F_x->size[1] = (ii->size[1] + b_ii->size[1]) + 1; emxEnsureCapacity((emxArray__common *)F_x, i0, (int32_T)sizeof(real_T), &emlrtRTEI); loop_ub = ii->size[1]; emxFree_boolean_T(&d_PerTgt_tmp); for (i0 = 0; i0 < loop_ub; i0++) { i1 = PerTgt_tmp->size[1]; absb = ii->data[ii->size[0] * i0]; F_x->data[F_x->size[0] * i0] = PerTgt_tmp-> data[emlrtDynamicBoundsCheckFastR2012b(absb, 1, i1, &y_emlrtBCI, emlrtRootTLSGlobal) - 1]; } F_x->data[F_x->size[0] * ii->size[1]] = T1; loop_ub = b_ii->size[1]; for (i0 = 0; i0 < loop_ub; i0++) { i1 = PerTgt_tmp->size[1]; absb = b_ii->data[b_ii->size[0] * i0]; F_x->data[F_x->size[0] * ((i0 + ii->size[1]) + 1)] = PerTgt_tmp-> data[emlrtDynamicBoundsCheckFastR2012b(absb, 1, i1, &ab_emlrtBCI, emlrtRootTLSGlobal) - 1]; } emlrtPopRtStackR2012b(&d_emlrtRSI, emlrtRootTLSGlobal); } else { i0 = F_x->size[0] * F_x->size[1]; F_x->size[0] = 1; F_x->size[1] = PerTgt_tmp->size[1]; emxEnsureCapacity((emxArray__common *)F_x, i0, (int32_T)sizeof(real_T), &emlrtRTEI); loop_ub = PerTgt_tmp->size[0] * PerTgt_tmp->size[1]; for (i0 = 0; i0 < loop_ub; i0++) { F_x->data[i0] = PerTgt_tmp->data[i0]; } } emxInit_boolean_T(&x, 2, &emlrtRTEI, TRUE); /* Find position of T1 in PerTgt */ emlrtPushRtStackR2012b(&e_emlrtRSI, emlrtRootTLSGlobal); i0 = x->size[0] * x->size[1]; x->size[0] = 1; x->size[1] = F_x->size[1]; emxEnsureCapacity((emxArray__common *)x, i0, (int32_T)sizeof(boolean_T), &emlrtRTEI); loop_ub = F_x->size[0] * F_x->size[1]; for (i0 = 0; i0 < loop_ub; i0++) { x->data[i0] = (F_x->data[i0] == T1); } emlrtPushRtStackR2012b(&vc_emlrtRSI, emlrtRootTLSGlobal); cdiff = 0; i0 = ii->size[0] * ii->size[1]; ii->size[0] = 1; ii->size[1] = x->size[1]; emxEnsureCapacity((emxArray__common *)ii, i0, (int32_T)sizeof(int32_T), &c_emlrtRTEI); emlrtPushRtStackR2012b(&xc_emlrtRSI, emlrtRootTLSGlobal); if (1 > x->size[1]) { overflow = FALSE; } else { overflow = (x->size[1] > 2147483646); } if (overflow) { emlrtPushRtStackR2012b(&lc_emlrtRSI, emlrtRootTLSGlobal); check_forloop_overflow_error(); emlrtPopRtStackR2012b(&lc_emlrtRSI, emlrtRootTLSGlobal); } emlrtPopRtStackR2012b(&xc_emlrtRSI, emlrtRootTLSGlobal); ndbl = 1; exitg7 = FALSE; while ((exitg7 == FALSE) && (ndbl <= x->size[1])) { guard4 = FALSE; if (x->data[ndbl - 1]) { cdiff++; ii->data[cdiff - 1] = ndbl; if (cdiff >= x->size[1]) { exitg7 = TRUE; } else { guard4 = TRUE; } } else { guard4 = TRUE; } if (guard4 == TRUE) { ndbl++; } } if (cdiff <= x->size[1]) { } else { emlrtPushRtStackR2012b(&yc_emlrtRSI, emlrtRootTLSGlobal); y = NULL; m0 = mxCreateString("Assertion failed."); emlrtAssign(&y, m0); error(y, &o_emlrtMCI); emlrtPopRtStackR2012b(&yc_emlrtRSI, emlrtRootTLSGlobal); } if (x->size[1] == 1) { if (cdiff == 0) { i0 = ii->size[0] * ii->size[1]; ii->size[0] = 1; ii->size[1] = 0; emxEnsureCapacity((emxArray__common *)ii, i0, (int32_T)sizeof(int32_T), &emlrtRTEI); } } else { if (1 > cdiff) { loop_ub = 0; } else { loop_ub = cdiff; } emxInit_int32_T(&r0, 1, &emlrtRTEI, TRUE); i0 = r0->size[0]; r0->size[0] = loop_ub; emxEnsureCapacity((emxArray__common *)r0, i0, (int32_T)sizeof(int32_T), &emlrtRTEI); for (i0 = 0; i0 < loop_ub; i0++) { r0->data[i0] = 1 + i0; } b_emxInit_int32_T(&c_ii, 2, &emlrtRTEI, TRUE); ndbl = r0->size[0]; i0 = c_ii->size[0] * c_ii->size[1]; c_ii->size[0] = 1; c_ii->size[1] = ndbl; emxEnsureCapacity((emxArray__common *)c_ii, i0, (int32_T)sizeof(int32_T), &emlrtRTEI); for (i0 = 0; i0 < ndbl; i0++) { i1 = 0; while (i1 <= 0) { c_ii->data[c_ii->size[0] * i0] = ii->data[r0->data[i0] - 1]; i1 = 1; } } emxFree_int32_T(&r0); i0 = ii->size[0] * ii->size[1]; ii->size[0] = 1; ii->size[1] = c_ii->size[1]; emxEnsureCapacity((emxArray__common *)ii, i0, (int32_T)sizeof(int32_T), &emlrtRTEI); loop_ub = c_ii->size[1]; for (i0 = 0; i0 < loop_ub; i0++) { ii->data[ii->size[0] * i0] = c_ii->data[c_ii->size[0] * i0]; } emxFree_int32_T(&c_ii); } b_emxInit_real_T(&posT1, 2, &i_emlrtRTEI, TRUE); emlrtPopRtStackR2012b(&vc_emlrtRSI, emlrtRootTLSGlobal); i0 = posT1->size[0] * posT1->size[1]; posT1->size[0] = 1; posT1->size[1] = ii->size[1]; emxEnsureCapacity((emxArray__common *)posT1, i0, (int32_T)sizeof(real_T), &emlrtRTEI); loop_ub = ii->size[0] * ii->size[1]; for (i0 = 0; i0 < loop_ub; i0++) { posT1->data[i0] = ii->data[i0]; } b_emxInit_real_T(&sa, 2, &j_emlrtRTEI, TRUE); emlrtPopRtStackR2012b(&e_emlrtRSI, emlrtRootTLSGlobal); /* Determine target spectra using ground-motion model (replace ground-motion */ /* model code if desired) */ i0 = sa->size[0] * sa->size[1]; sa->size[0] = 1; emxEnsureCapacity((emxArray__common *)sa, i0, (int32_T)sizeof(real_T), &emlrtRTEI); ndbl = F_x->size[1]; i0 = sa->size[0] * sa->size[1]; sa->size[1] = ndbl; emxEnsureCapacity((emxArray__common *)sa, i0, (int32_T)sizeof(real_T), &emlrtRTEI); loop_ub = F_x->size[1]; for (i0 = 0; i0 < loop_ub; i0++) { sa->data[i0] = 0.0; } b_emxInit_real_T(&sigma, 2, &k_emlrtRTEI, TRUE); i0 = sigma->size[0] * sigma->size[1]; sigma->size[0] = 1; emxEnsureCapacity((emxArray__common *)sigma, i0, (int32_T)sizeof(real_T), &emlrtRTEI); ndbl = F_x->size[1]; i0 = sigma->size[0] * sigma->size[1]; sigma->size[1] = ndbl; emxEnsureCapacity((emxArray__common *)sigma, i0, (int32_T)sizeof(real_T), &emlrtRTEI); loop_ub = F_x->size[1]; for (i0 = 0; i0 < loop_ub; i0++) { sigma->data[i0] = 0.0; } i = 0; while (i <= F_x->size[1] - 1) { emlrtPushRtStackR2012b(&f_emlrtRSI, emlrtRootTLSGlobal); i0 = F_x->size[1]; i1 = (int32_T)(1.0 + (real_T)i); SP_1996(F_x->data[emlrtDynamicBoundsCheckFastR2012b(i1, 1, i0, &ed_emlrtBCI, emlrtRootTLSGlobal) - 1], M_bar, R_bar, &minID, &b); emlrtPopRtStackR2012b(&f_emlrtRSI, emlrtRootTLSGlobal); i0 = sa->size[1]; i1 = (int32_T)(1.0 + (real_T)i); sa->data[sa->size[0] * (emlrtDynamicBoundsCheckFastR2012b(i1, 1, i0, &fd_emlrtBCI, emlrtRootTLSGlobal) - 1)] = minID; i0 = sigma->size[1]; i1 = (int32_T)(1.0 + (real_T)i); sigma->data[sigma->size[0] * (emlrtDynamicBoundsCheckFastR2012b(i1, 1, i0, &gd_emlrtBCI, emlrtRootTLSGlobal) - 1)] = b; i++; emlrtBreakCheckFastR2012b(emlrtBreakCheckR2012bFlagVar, emlrtRootTLSGlobal); } /* User inputs end here */ /* %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% */ /* Use the CMS method to estimate target means and covariances */ /* (Log) Response Spectrum Mean: meanReq */ i0 = rho->size[0] * rho->size[1]; rho->size[0] = 1; emxEnsureCapacity((emxArray__common *)rho, i0, (int32_T)sizeof(real_T), &emlrtRTEI); ndbl = F_x->size[1]; i0 = rho->size[0] * rho->size[1]; rho->size[1] = ndbl; emxEnsureCapacity((emxArray__common *)rho, i0, (int32_T)sizeof(real_T), &emlrtRTEI); loop_ub = F_x->size[1]; for (i0 = 0; i0 < loop_ub; i0++) { rho->data[i0] = 0.0; } i = 0; while (i <= F_x->size[1] - 1) { emlrtPushRtStackR2012b(&g_emlrtRSI, emlrtRootTLSGlobal); i0 = rho->size[1]; i1 = (int32_T)(1.0 + (real_T)i); absb = F_x->size[1]; apnd = (int32_T)(1.0 + (real_T)i); rho->data[emlrtDynamicBoundsCheckFastR2012b(i1, 1, i0, &cd_emlrtBCI, emlrtRootTLSGlobal) - 1] = baker_jayaram_correlation(F_x-> data[emlrtDynamicBoundsCheckFastR2012b(apnd, 1, absb, &dd_emlrtBCI, emlrtRootTLSGlobal) - 1], T1); emlrtPopRtStackR2012b(&g_emlrtRSI, emlrtRootTLSGlobal); i++; emlrtBreakCheckFastR2012b(emlrtBreakCheckR2012bFlagVar, emlrtRootTLSGlobal); } b_emxInit_real_T(&r1, 2, &emlrtRTEI, TRUE); i0 = r1->size[0] * r1->size[1]; r1->size[0] = 1; r1->size[1] = sigma->size[1]; emxEnsureCapacity((emxArray__common *)r1, i0, (int32_T)sizeof(real_T), &emlrtRTEI); loop_ub = sigma->size[0] * sigma->size[1]; for (i0 = 0; i0 < loop_ub; i0++) { r1->data[i0] = sigma->data[i0] * eps_bar; } for (i0 = 0; i0 < 2; i0++) { iv0[i0] = r1->size[i0]; } for (i0 = 0; i0 < 2; i0++) { b_rho[i0] = rho->size[i0]; } emlrtSizeEqCheck2DFastR2012b(iv0, b_rho, &ab_emlrtECI, emlrtRootTLSGlobal); emlrtPushRtStackR2012b(&h_emlrtRSI, emlrtRootTLSGlobal); c_log(sa); emlrtPopRtStackR2012b(&h_emlrtRSI, emlrtRootTLSGlobal); i0 = r1->size[0] * r1->size[1]; r1->size[0] = 1; emxEnsureCapacity((emxArray__common *)r1, i0, (int32_T)sizeof(real_T), &emlrtRTEI); i0 = r1->size[0]; i1 = r1->size[1]; loop_ub = i0 * i1; for (i0 = 0; i0 < loop_ub; i0++) { r1->data[i0] *= rho->data[i0]; } for (i0 = 0; i0 < 2; i0++) { b_rho[i0] = sa->size[i0]; } for (i0 = 0; i0 < 2; i0++) { iv0[i0] = r1->size[i0]; } emlrtSizeEqCheck2DFastR2012b(b_rho, iv0, &y_emlrtECI, emlrtRootTLSGlobal); i0 = sa->size[0] * sa->size[1]; sa->size[0] = 1; emxEnsureCapacity((emxArray__common *)sa, i0, (int32_T)sizeof(real_T), &emlrtRTEI); ndbl = sa->size[0]; cdiff = sa->size[1]; loop_ub = ndbl * cdiff; for (i0 = 0; i0 < loop_ub; i0++) { sa->data[i0] += r1->data[i0]; } emxInit_boolean_T(&b_F_x, 2, &emlrtRTEI, TRUE); emlrtPushRtStackR2012b(&i_emlrtRSI, emlrtRootTLSGlobal); i0 = b_F_x->size[0] * b_F_x->size[1]; b_F_x->size[0] = 1; b_F_x->size[1] = F_x->size[1]; emxEnsureCapacity((emxArray__common *)b_F_x, i0, (int32_T)sizeof(boolean_T), &emlrtRTEI); loop_ub = F_x->size[0] * F_x->size[1]; for (i0 = 0; i0 < loop_ub; i0++) { b_F_x->data[i0] = (F_x->data[i0] == T1); } b_emxInit_real_T(&lnSa1, 2, &m_emlrtRTEI, TRUE); eml_li_find(b_F_x, ii); i0 = lnSa1->size[0] * lnSa1->size[1]; lnSa1->size[0] = 1; lnSa1->size[1] = ii->size[1]; emxEnsureCapacity((emxArray__common *)lnSa1, i0, (int32_T)sizeof(real_T), &emlrtRTEI); loop_ub = ii->size[0] * ii->size[1]; emxFree_boolean_T(&b_F_x); for (i0 = 0; i0 < loop_ub; i0++) { i1 = sa->size[1]; absb = ii->data[i0]; lnSa1->data[i0] = sa->data[emlrtDynamicBoundsCheckFastR2012b(absb, 1, i1, &bb_emlrtBCI, emlrtRootTLSGlobal) - 1]; } b_emxInit_real_T(&covReq, 2, &n_emlrtRTEI, TRUE); emlrtPopRtStackR2012b(&i_emlrtRSI, emlrtRootTLSGlobal); /* (Log) Response Spectrum Covariance: covReq */ ndbl = F_x->size[1]; i0 = covReq->size[0] * covReq->size[1]; covReq->size[0] = ndbl; emxEnsureCapacity((emxArray__common *)covReq, i0, (int32_T)sizeof(real_T), &emlrtRTEI); ndbl = F_x->size[1]; i0 = covReq->size[0] * covReq->size[1]; covReq->size[1] = ndbl; emxEnsureCapacity((emxArray__common *)covReq, i0, (int32_T)sizeof(real_T), &emlrtRTEI); loop_ub = F_x->size[1] * F_x->size[1]; for (i0 = 0; i0 < loop_ub; i0++) { covReq->data[i0] = 0.0; } i = 0; b_emxInit_real_T(&varT, 2, &o_emlrtRTEI, TRUE); b_emxInit_real_T(&sigma11, 2, &p_emlrtRTEI, TRUE); b_emxInit_real_T(&sigma12, 2, &q_emlrtRTEI, TRUE); b_emxInit_real_T(&b_b, 2, &emlrtRTEI, TRUE); b_emxInit_real_T(&b_y, 2, &emlrtRTEI, TRUE); b_emxInit_real_T(&c_b, 2, &emlrtRTEI, TRUE); b_emxInit_real_T(&r2, 2, &emlrtRTEI, TRUE); b_emxInit_real_T(&b_sigma, 2, &emlrtRTEI, TRUE); b_emxInit_real_T(&c_sigma, 2, &emlrtRTEI, TRUE); b_emxInit_real_T(&d_sigma, 2, &emlrtRTEI, TRUE); emxInit_int32_T(&r3, 1, &emlrtRTEI, TRUE); emxInit_int32_T(&r4, 1, &emlrtRTEI, TRUE); emxInit_int32_T(&r5, 1, &emlrtRTEI, TRUE); b_emxInit_int32_T(&d_ii, 2, &emlrtRTEI, TRUE); b_emxInit_int32_T(&e_ii, 2, &emlrtRTEI, TRUE); b_emxInit_int32_T(&f_ii, 2, &emlrtRTEI, TRUE); while (i <= F_x->size[1] - 1) { j = 0; while (j <= F_x->size[1] - 1) { /* Periods */ i0 = F_x->size[1]; i1 = (int32_T)(1.0 + (real_T)i); emlrtDynamicBoundsCheckFastR2012b(i1, 1, i0, &x_emlrtBCI, emlrtRootTLSGlobal); i0 = F_x->size[1]; i1 = (int32_T)(1.0 + (real_T)j); emlrtDynamicBoundsCheckFastR2012b(i1, 1, i0, &w_emlrtBCI, emlrtRootTLSGlobal); /* Means and variances */ emlrtPushRtStackR2012b(&j_emlrtRSI, emlrtRootTLSGlobal); i0 = x->size[0] * x->size[1]; x->size[0] = 1; x->size[1] = F_x->size[1]; emxEnsureCapacity((emxArray__common *)x, i0, (int32_T)sizeof(boolean_T), &emlrtRTEI); minID = F_x->data[(int32_T)(1.0 + (real_T)i) - 1]; loop_ub = F_x->size[0] * F_x->size[1]; for (i0 = 0; i0 < loop_ub; i0++) { x->data[i0] = (F_x->data[i0] == minID); } emlrtPushRtStackR2012b(&vc_emlrtRSI, emlrtRootTLSGlobal); cdiff = 0; i0 = ii->size[0] * ii->size[1]; ii->size[0] = 1; ii->size[1] = x->size[1]; emxEnsureCapacity((emxArray__common *)ii, i0, (int32_T)sizeof(int32_T), &c_emlrtRTEI); emlrtPushRtStackR2012b(&xc_emlrtRSI, emlrtRootTLSGlobal); if (1 > x->size[1]) { overflow = FALSE; } else { overflow = (x->size[1] > 2147483646); } if (overflow) { emlrtPushRtStackR2012b(&lc_emlrtRSI, emlrtRootTLSGlobal); check_forloop_overflow_error(); emlrtPopRtStackR2012b(&lc_emlrtRSI, emlrtRootTLSGlobal); } emlrtPopRtStackR2012b(&xc_emlrtRSI, emlrtRootTLSGlobal); ndbl = 1; exitg6 = FALSE; while ((exitg6 == FALSE) && (ndbl <= x->size[1])) { guard3 = FALSE; if (x->data[ndbl - 1]) { cdiff++; ii->data[cdiff - 1] = ndbl; if (cdiff >= x->size[1]) { exitg6 = TRUE; } else { guard3 = TRUE; } } else { guard3 = TRUE; } if (guard3 == TRUE) { ndbl++; } } if (cdiff <= x->size[1]) { } else { emlrtPushRtStackR2012b(&yc_emlrtRSI, emlrtRootTLSGlobal); c_y = NULL; m0 = mxCreateString("Assertion failed."); emlrtAssign(&c_y, m0); error(c_y, &o_emlrtMCI); emlrtPopRtStackR2012b(&yc_emlrtRSI, emlrtRootTLSGlobal); } if (x->size[1] == 1) { if (cdiff == 0) { i0 = ii->size[0] * ii->size[1]; ii->size[0] = 1; ii->size[1] = 0; emxEnsureCapacity((emxArray__common *)ii, i0, (int32_T)sizeof(int32_T), &emlrtRTEI); } } else { if (1 > cdiff) { loop_ub = 0; } else { loop_ub = cdiff; } i0 = r3->size[0]; r3->size[0] = loop_ub; emxEnsureCapacity((emxArray__common *)r3, i0, (int32_T)sizeof(int32_T), &emlrtRTEI); for (i0 = 0; i0 < loop_ub; i0++) { r3->data[i0] = 1 + i0; } ndbl = r3->size[0]; i0 = d_ii->size[0] * d_ii->size[1]; d_ii->size[0] = 1; d_ii->size[1] = ndbl; emxEnsureCapacity((emxArray__common *)d_ii, i0, (int32_T)sizeof(int32_T), &emlrtRTEI); for (i0 = 0; i0 < ndbl; i0++) { i1 = 0; while (i1 <= 0) { d_ii->data[d_ii->size[0] * i0] = ii->data[r3->data[i0] - 1]; i1 = 1; } } i0 = ii->size[0] * ii->size[1]; ii->size[0] = 1; ii->size[1] = d_ii->size[1]; emxEnsureCapacity((emxArray__common *)ii, i0, (int32_T)sizeof(int32_T), &emlrtRTEI); loop_ub = d_ii->size[1]; for (i0 = 0; i0 < loop_ub; i0++) { ii->data[ii->size[0] * i0] = d_ii->data[d_ii->size[0] * i0]; } } emlrtPopRtStackR2012b(&vc_emlrtRSI, emlrtRootTLSGlobal); emlrtPopRtStackR2012b(&j_emlrtRSI, emlrtRootTLSGlobal); emlrtPushRtStackR2012b(&k_emlrtRSI, emlrtRootTLSGlobal); i0 = x->size[0] * x->size[1]; x->size[0] = 1; x->size[1] = F_x->size[1]; emxEnsureCapacity((emxArray__common *)x, i0, (int32_T)sizeof(boolean_T), &emlrtRTEI); minID = F_x->data[(int32_T)(1.0 + (real_T)j) - 1]; loop_ub = F_x->size[0] * F_x->size[1]; for (i0 = 0; i0 < loop_ub; i0++) { x->data[i0] = (F_x->data[i0] == minID); } emlrtPushRtStackR2012b(&vc_emlrtRSI, emlrtRootTLSGlobal); cdiff = 0; i0 = b_ii->size[0] * b_ii->size[1]; b_ii->size[0] = 1; b_ii->size[1] = x->size[1]; emxEnsureCapacity((emxArray__common *)b_ii, i0, (int32_T)sizeof(int32_T), &c_emlrtRTEI); emlrtPushRtStackR2012b(&xc_emlrtRSI, emlrtRootTLSGlobal); if (1 > x->size[1]) { overflow = FALSE; } else { overflow = (x->size[1] > 2147483646); } if (overflow) { emlrtPushRtStackR2012b(&lc_emlrtRSI, emlrtRootTLSGlobal); check_forloop_overflow_error(); emlrtPopRtStackR2012b(&lc_emlrtRSI, emlrtRootTLSGlobal); } emlrtPopRtStackR2012b(&xc_emlrtRSI, emlrtRootTLSGlobal); ndbl = 1; exitg5 = FALSE; while ((exitg5 == FALSE) && (ndbl <= x->size[1])) { guard2 = FALSE; if (x->data[ndbl - 1]) { cdiff++; b_ii->data[cdiff - 1] = ndbl; if (cdiff >= x->size[1]) { exitg5 = TRUE; } else { guard2 = TRUE; } } else { guard2 = TRUE; } if (guard2 == TRUE) { ndbl++; } } if (cdiff <= x->size[1]) { } else { emlrtPushRtStackR2012b(&yc_emlrtRSI, emlrtRootTLSGlobal); d_y = NULL; m0 = mxCreateString("Assertion failed."); emlrtAssign(&d_y, m0); error(d_y, &o_emlrtMCI); emlrtPopRtStackR2012b(&yc_emlrtRSI, emlrtRootTLSGlobal); } if (x->size[1] == 1) { if (cdiff == 0) { i0 = b_ii->size[0] * b_ii->size[1]; b_ii->size[0] = 1; b_ii->size[1] = 0; emxEnsureCapacity((emxArray__common *)b_ii, i0, (int32_T)sizeof (int32_T), &emlrtRTEI); } } else { if (1 > cdiff) { loop_ub = 0; } else { loop_ub = cdiff; } i0 = r4->size[0]; r4->size[0] = loop_ub; emxEnsureCapacity((emxArray__common *)r4, i0, (int32_T)sizeof(int32_T), &emlrtRTEI); for (i0 = 0; i0 < loop_ub; i0++) { r4->data[i0] = 1 + i0; } ndbl = r4->size[0]; i0 = e_ii->size[0] * e_ii->size[1]; e_ii->size[0] = 1; e_ii->size[1] = ndbl; emxEnsureCapacity((emxArray__common *)e_ii, i0, (int32_T)sizeof(int32_T), &emlrtRTEI); for (i0 = 0; i0 < ndbl; i0++) { i1 = 0; while (i1 <= 0) { e_ii->data[e_ii->size[0] * i0] = b_ii->data[r4->data[i0] - 1]; i1 = 1; } } i0 = b_ii->size[0] * b_ii->size[1]; b_ii->size[0] = 1; b_ii->size[1] = e_ii->size[1]; emxEnsureCapacity((emxArray__common *)b_ii, i0, (int32_T)sizeof(int32_T), &emlrtRTEI); loop_ub = e_ii->size[1]; for (i0 = 0; i0 < loop_ub; i0++) { b_ii->data[b_ii->size[0] * i0] = e_ii->data[e_ii->size[0] * i0]; } } emlrtPopRtStackR2012b(&vc_emlrtRSI, emlrtRootTLSGlobal); emlrtPopRtStackR2012b(&k_emlrtRSI, emlrtRootTLSGlobal); emlrtPushRtStackR2012b(&l_emlrtRSI, emlrtRootTLSGlobal); i0 = d_sigma->size[0] * d_sigma->size[1]; d_sigma->size[0] = 1; d_sigma->size[1] = ii->size[1]; emxEnsureCapacity((emxArray__common *)d_sigma, i0, (int32_T)sizeof(real_T), &emlrtRTEI); loop_ub = ii->size[0] * ii->size[1]; for (i0 = 0; i0 < loop_ub; i0++) { i1 = sigma->size[1]; absb = ii->data[i0]; d_sigma->data[i0] = sigma->data[emlrtDynamicBoundsCheckFastR2012b(absb, 1, i1, &uc_emlrtBCI, emlrtRootTLSGlobal) - 1]; } mpower(d_sigma, PerTgt_tmp); emlrtPopRtStackR2012b(&l_emlrtRSI, emlrtRootTLSGlobal); emlrtPushRtStackR2012b(&m_emlrtRSI, emlrtRootTLSGlobal); i0 = c_sigma->size[0] * c_sigma->size[1]; c_sigma->size[0] = 1; c_sigma->size[1] = b_ii->size[1]; emxEnsureCapacity((emxArray__common *)c_sigma, i0, (int32_T)sizeof(real_T), &emlrtRTEI); loop_ub = b_ii->size[0] * b_ii->size[1]; for (i0 = 0; i0 < loop_ub; i0++) { i1 = sigma->size[1]; absb = b_ii->data[i0]; c_sigma->data[i0] = sigma->data[emlrtDynamicBoundsCheckFastR2012b(absb, 1, i1, &vc_emlrtBCI, emlrtRootTLSGlobal) - 1]; } mpower(c_sigma, rho); emlrtPopRtStackR2012b(&m_emlrtRSI, emlrtRootTLSGlobal); emlrtPushRtStackR2012b(&n_emlrtRSI, emlrtRootTLSGlobal); i0 = x->size[0] * x->size[1]; x->size[0] = 1; x->size[1] = F_x->size[1]; emxEnsureCapacity((emxArray__common *)x, i0, (int32_T)sizeof(boolean_T), &emlrtRTEI); loop_ub = F_x->size[0] * F_x->size[1]; for (i0 = 0; i0 < loop_ub; i0++) { x->data[i0] = (F_x->data[i0] == T1); } emlrtPushRtStackR2012b(&vc_emlrtRSI, emlrtRootTLSGlobal); cdiff = 0; i0 = ii->size[0] * ii->size[1]; ii->size[0] = 1; ii->size[1] = x->size[1]; emxEnsureCapacity((emxArray__common *)ii, i0, (int32_T)sizeof(int32_T), &c_emlrtRTEI); emlrtPushRtStackR2012b(&xc_emlrtRSI, emlrtRootTLSGlobal); if (1 > x->size[1]) { overflow = FALSE; } else { overflow = (x->size[1] > 2147483646); } if (overflow) { emlrtPushRtStackR2012b(&lc_emlrtRSI, emlrtRootTLSGlobal); check_forloop_overflow_error(); emlrtPopRtStackR2012b(&lc_emlrtRSI, emlrtRootTLSGlobal); } emlrtPopRtStackR2012b(&xc_emlrtRSI, emlrtRootTLSGlobal); ndbl = 1; exitg4 = FALSE; while ((exitg4 == FALSE) && (ndbl <= x->size[1])) { guard1 = FALSE; if (x->data[ndbl - 1]) { cdiff++; ii->data[cdiff - 1] = ndbl; if (cdiff >= x->size[1]) { exitg4 = TRUE; } else { guard1 = TRUE; } } else { guard1 = TRUE; } if (guard1 == TRUE) { ndbl++; } } if (cdiff <= x->size[1]) { } else { emlrtPushRtStackR2012b(&yc_emlrtRSI, emlrtRootTLSGlobal); e_y = NULL; m0 = mxCreateString("Assertion failed."); emlrtAssign(&e_y, m0); error(e_y, &o_emlrtMCI); emlrtPopRtStackR2012b(&yc_emlrtRSI, emlrtRootTLSGlobal); } if (x->size[1] == 1) { if (cdiff == 0) { i0 = ii->size[0] * ii->size[1]; ii->size[0] = 1; ii->size[1] = 0; emxEnsureCapacity((emxArray__common *)ii, i0, (int32_T)sizeof(int32_T), &emlrtRTEI); } } else { if (1 > cdiff) { loop_ub = 0; } else { loop_ub = cdiff; } i0 = r5->size[0]; r5->size[0] = loop_ub; emxEnsureCapacity((emxArray__common *)r5, i0, (int32_T)sizeof(int32_T), &emlrtRTEI); for (i0 = 0; i0 < loop_ub; i0++) { r5->data[i0] = 1 + i0; } ndbl = r5->size[0]; i0 = f_ii->size[0] * f_ii->size[1]; f_ii->size[0] = 1; f_ii->size[1] = ndbl; emxEnsureCapacity((emxArray__common *)f_ii, i0, (int32_T)sizeof(int32_T), &emlrtRTEI); for (i0 = 0; i0 < ndbl; i0++) { i1 = 0; while (i1 <= 0) { f_ii->data[f_ii->size[0] * i0] = ii->data[r5->data[i0] - 1]; i1 = 1; } } i0 = ii->size[0] * ii->size[1]; ii->size[0] = 1; ii->size[1] = f_ii->size[1]; emxEnsureCapacity((emxArray__common *)ii, i0, (int32_T)sizeof(int32_T), &emlrtRTEI); loop_ub = f_ii->size[1]; for (i0 = 0; i0 < loop_ub; i0++) { ii->data[ii->size[0] * i0] = f_ii->data[f_ii->size[0] * i0]; } } emlrtPopRtStackR2012b(&vc_emlrtRSI, emlrtRootTLSGlobal); emlrtPopRtStackR2012b(&n_emlrtRSI, emlrtRootTLSGlobal); emlrtPushRtStackR2012b(&o_emlrtRSI, emlrtRootTLSGlobal); i0 = b_sigma->size[0] * b_sigma->size[1]; b_sigma->size[0] = 1; b_sigma->size[1] = ii->size[1]; emxEnsureCapacity((emxArray__common *)b_sigma, i0, (int32_T)sizeof(real_T), &emlrtRTEI); loop_ub = ii->size[0] * ii->size[1]; for (i0 = 0; i0 < loop_ub; i0++) { i1 = sigma->size[1]; absb = ii->data[i0]; b_sigma->data[i0] = sigma->data[emlrtDynamicBoundsCheckFastR2012b(absb, 1, i1, &wc_emlrtBCI, emlrtRootTLSGlobal) - 1]; } mpower(b_sigma, varT); emlrtPopRtStackR2012b(&o_emlrtRSI, emlrtRootTLSGlobal); emlrtPushRtStackR2012b(&p_emlrtRSI, emlrtRootTLSGlobal); emlrtPushRtStackR2012b(&ud_emlrtRSI, emlrtRootTLSGlobal); if (!(PerTgt_tmp->size[1] == 1)) { if ((PerTgt_tmp->size[1] == 1) || (rho->size[1] == 1)) { emlrtPushRtStackR2012b(&wd_emlrtRSI, emlrtRootTLSGlobal); f_y = NULL; m0 = mxCreateCharArray(2, iv1); for (ndbl = 0; ndbl < 45; ndbl++) { cv0[ndbl] = cv1[ndbl]; } emlrtInitCharArrayR2013a(emlrtRootTLSGlobal, 45, m0, cv0); emlrtAssign(&f_y, m0); error(message(f_y, &r_emlrtMCI), &s_emlrtMCI); emlrtPopRtStackR2012b(&wd_emlrtRSI, emlrtRootTLSGlobal); } else { emlrtPushRtStackR2012b(&vd_emlrtRSI, emlrtRootTLSGlobal); g_y = NULL; m0 = mxCreateCharArray(2, iv2); for (ndbl = 0; ndbl < 21; ndbl++) { cv2[ndbl] = cv3[ndbl]; } emlrtInitCharArrayR2013a(emlrtRootTLSGlobal, 21, m0, cv2); emlrtAssign(&g_y, m0); error(message(g_y, &t_emlrtMCI), &u_emlrtMCI); emlrtPopRtStackR2012b(&vd_emlrtRSI, emlrtRootTLSGlobal); } } emlrtPopRtStackR2012b(&ud_emlrtRSI, emlrtRootTLSGlobal); b = baker_jayaram_correlation(F_x->data[(int32_T)(1.0 + (real_T)i) - 1], F_x->data[(int32_T)(1.0 + (real_T)j) - 1]); i0 = b_b->size[0] * b_b->size[1]; b_b->size[0] = 1; b_b->size[1] = rho->size[1]; emxEnsureCapacity((emxArray__common *)b_b, i0, (int32_T)sizeof(real_T), &emlrtRTEI); minID = PerTgt_tmp->data[0]; loop_ub = rho->size[0] * rho->size[1]; for (i0 = 0; i0 < loop_ub; i0++) { b_b->data[i0] = minID * rho->data[i0]; } c_sqrt(b_b); i0 = r1->size[0] * r1->size[1]; r1->size[0] = 1; r1->size[1] = PerTgt_tmp->size[1] + b_b->size[1]; emxEnsureCapacity((emxArray__common *)r1, i0, (int32_T)sizeof(real_T), &emlrtRTEI); loop_ub = PerTgt_tmp->size[1]; for (i0 = 0; i0 < loop_ub; i0++) { r1->data[r1->size[0] * i0] = PerTgt_tmp->data[PerTgt_tmp->size[0] * i0]; } loop_ub = b_b->size[1]; for (i0 = 0; i0 < loop_ub; i0++) { r1->data[r1->size[0] * (i0 + PerTgt_tmp->size[1])] = b * b_b->data [b_b->size[0] * i0]; } emlrtPopRtStackR2012b(&p_emlrtRSI, emlrtRootTLSGlobal); emlrtPushRtStackR2012b(&p_emlrtRSI, emlrtRootTLSGlobal); emlrtPushRtStackR2012b(&ud_emlrtRSI, emlrtRootTLSGlobal); if (!(PerTgt_tmp->size[1] == 1)) { if ((PerTgt_tmp->size[1] == 1) || (rho->size[1] == 1)) { emlrtPushRtStackR2012b(&wd_emlrtRSI, emlrtRootTLSGlobal); h_y = NULL; m0 = mxCreateCharArray(2, iv3); for (ndbl = 0; ndbl < 45; ndbl++) { cv0[ndbl] = cv1[ndbl]; } emlrtInitCharArrayR2013a(emlrtRootTLSGlobal, 45, m0, cv0); emlrtAssign(&h_y, m0); error(message(h_y, &r_emlrtMCI), &s_emlrtMCI); emlrtPopRtStackR2012b(&wd_emlrtRSI, emlrtRootTLSGlobal); } else { emlrtPushRtStackR2012b(&vd_emlrtRSI, emlrtRootTLSGlobal); i_y = NULL; m0 = mxCreateCharArray(2, iv4); for (ndbl = 0; ndbl < 21; ndbl++) { cv2[ndbl] = cv3[ndbl]; } emlrtInitCharArrayR2013a(emlrtRootTLSGlobal, 21, m0, cv2); emlrtAssign(&i_y, m0); error(message(i_y, &t_emlrtMCI), &u_emlrtMCI); emlrtPopRtStackR2012b(&vd_emlrtRSI, emlrtRootTLSGlobal); } } emlrtPopRtStackR2012b(&ud_emlrtRSI, emlrtRootTLSGlobal); b = baker_jayaram_correlation(F_x->data[(int32_T)(1.0 + (real_T)i) - 1], F_x->data[(int32_T)(1.0 + (real_T)j) - 1]); i0 = b_b->size[0] * b_b->size[1]; b_b->size[0] = 1; b_b->size[1] = rho->size[1]; emxEnsureCapacity((emxArray__common *)b_b, i0, (int32_T)sizeof(real_T), &emlrtRTEI); minID = PerTgt_tmp->data[0]; loop_ub = rho->size[0] * rho->size[1]; for (i0 = 0; i0 < loop_ub; i0++) { b_b->data[i0] = minID * rho->data[i0]; } c_sqrt(b_b); i0 = r2->size[0] * r2->size[1]; r2->size[0] = 1; r2->size[1] = b_b->size[1] + rho->size[1]; emxEnsureCapacity((emxArray__common *)r2, i0, (int32_T)sizeof(real_T), &emlrtRTEI); loop_ub = b_b->size[1]; for (i0 = 0; i0 < loop_ub; i0++) { r2->data[r2->size[0] * i0] = b * b_b->data[b_b->size[0] * i0]; } loop_ub = rho->size[1]; for (i0 = 0; i0 < loop_ub; i0++) { r2->data[r2->size[0] * (i0 + b_b->size[1])] = rho->data[rho->size[0] * i0]; } emlrtPopRtStackR2012b(&p_emlrtRSI, emlrtRootTLSGlobal); i0 = r1->size[1]; i1 = r2->size[1]; emlrtDimSizeEqCheckFastR2012b(i0, i1, &x_emlrtECI, emlrtRootTLSGlobal); i0 = sigma11->size[0] * sigma11->size[1]; sigma11->size[0] = 2; sigma11->size[1] = r1->size[1]; emxEnsureCapacity((emxArray__common *)sigma11, i0, (int32_T)sizeof(real_T), &emlrtRTEI); loop_ub = r1->size[1]; for (i0 = 0; i0 < loop_ub; i0++) { sigma11->data[sigma11->size[0] * i0] = r1->data[r1->size[0] * i0]; } loop_ub = r2->size[1]; for (i0 = 0; i0 < loop_ub; i0++) { sigma11->data[1 + sigma11->size[0] * i0] = r2->data[r2->size[0] * i0]; } emlrtPushRtStackR2012b(&q_emlrtRSI, emlrtRootTLSGlobal); emlrtPushRtStackR2012b(&ud_emlrtRSI, emlrtRootTLSGlobal); if (!(PerTgt_tmp->size[1] == 1)) { if ((PerTgt_tmp->size[1] == 1) || (varT->size[1] == 1)) { emlrtPushRtStackR2012b(&wd_emlrtRSI, emlrtRootTLSGlobal); j_y = NULL; m0 = mxCreateCharArray(2, iv5); for (ndbl = 0; ndbl < 45; ndbl++) { cv0[ndbl] = cv1[ndbl]; } emlrtInitCharArrayR2013a(emlrtRootTLSGlobal, 45, m0, cv0); emlrtAssign(&j_y, m0); error(message(j_y, &r_emlrtMCI), &s_emlrtMCI); emlrtPopRtStackR2012b(&wd_emlrtRSI, emlrtRootTLSGlobal); } else { emlrtPushRtStackR2012b(&vd_emlrtRSI, emlrtRootTLSGlobal); k_y = NULL; m0 = mxCreateCharArray(2, iv6); for (ndbl = 0; ndbl < 21; ndbl++) { cv2[ndbl] = cv3[ndbl]; } emlrtInitCharArrayR2013a(emlrtRootTLSGlobal, 21, m0, cv2); emlrtAssign(&k_y, m0); error(message(k_y, &t_emlrtMCI), &u_emlrtMCI); emlrtPopRtStackR2012b(&vd_emlrtRSI, emlrtRootTLSGlobal); } } emlrtPopRtStackR2012b(&ud_emlrtRSI, emlrtRootTLSGlobal); b = baker_jayaram_correlation(F_x->data[(int32_T)(1.0 + (real_T)i) - 1], T1); minID = PerTgt_tmp->data[0]; i0 = PerTgt_tmp->size[0] * PerTgt_tmp->size[1]; PerTgt_tmp->size[0] = 1; PerTgt_tmp->size[1] = varT->size[1]; emxEnsureCapacity((emxArray__common *)PerTgt_tmp, i0, (int32_T)sizeof (real_T), &emlrtRTEI); loop_ub = varT->size[1]; for (i0 = 0; i0 < loop_ub; i0++) { PerTgt_tmp->data[PerTgt_tmp->size[0] * i0] = minID * varT->data [varT->size[0] * i0]; } c_sqrt(PerTgt_tmp); i0 = PerTgt_tmp->size[0] * PerTgt_tmp->size[1]; PerTgt_tmp->size[0] = 1; emxEnsureCapacity((emxArray__common *)PerTgt_tmp, i0, (int32_T)sizeof (real_T), &emlrtRTEI); ndbl = PerTgt_tmp->size[0]; cdiff = PerTgt_tmp->size[1]; loop_ub = ndbl * cdiff; for (i0 = 0; i0 < loop_ub; i0++) { PerTgt_tmp->data[i0] *= b; } emlrtPopRtStackR2012b(&q_emlrtRSI, emlrtRootTLSGlobal); emlrtPushRtStackR2012b(&q_emlrtRSI, emlrtRootTLSGlobal); emlrtPushRtStackR2012b(&ud_emlrtRSI, emlrtRootTLSGlobal); if (!(rho->size[1] == 1)) { if ((rho->size[1] == 1) || (varT->size[1] == 1)) { emlrtPushRtStackR2012b(&wd_emlrtRSI, emlrtRootTLSGlobal); l_y = NULL; m0 = mxCreateCharArray(2, iv7); for (ndbl = 0; ndbl < 45; ndbl++) { cv0[ndbl] = cv1[ndbl]; } emlrtInitCharArrayR2013a(emlrtRootTLSGlobal, 45, m0, cv0); emlrtAssign(&l_y, m0); error(message(l_y, &r_emlrtMCI), &s_emlrtMCI); emlrtPopRtStackR2012b(&wd_emlrtRSI, emlrtRootTLSGlobal); } else { emlrtPushRtStackR2012b(&vd_emlrtRSI, emlrtRootTLSGlobal); m_y = NULL; m0 = mxCreateCharArray(2, iv8); for (ndbl = 0; ndbl < 21; ndbl++) { cv2[ndbl] = cv3[ndbl]; } emlrtInitCharArrayR2013a(emlrtRootTLSGlobal, 21, m0, cv2); emlrtAssign(&m_y, m0); error(message(m_y, &t_emlrtMCI), &u_emlrtMCI); emlrtPopRtStackR2012b(&vd_emlrtRSI, emlrtRootTLSGlobal); } } emlrtPopRtStackR2012b(&ud_emlrtRSI, emlrtRootTLSGlobal); b = baker_jayaram_correlation(T1, F_x->data[(int32_T)(1.0 + (real_T)j) - 1]); minID = rho->data[0]; i0 = rho->size[0] * rho->size[1]; rho->size[0] = 1; rho->size[1] = varT->size[1]; emxEnsureCapacity((emxArray__common *)rho, i0, (int32_T)sizeof(real_T), &emlrtRTEI); loop_ub = varT->size[1]; for (i0 = 0; i0 < loop_ub; i0++) { rho->data[rho->size[0] * i0] = minID * varT->data[varT->size[0] * i0]; } c_sqrt(rho); i0 = rho->size[0] * rho->size[1]; rho->size[0] = 1; emxEnsureCapacity((emxArray__common *)rho, i0, (int32_T)sizeof(real_T), &emlrtRTEI); ndbl = rho->size[0]; cdiff = rho->size[1]; loop_ub = ndbl * cdiff; for (i0 = 0; i0 < loop_ub; i0++) { rho->data[i0] *= b; } emlrtPopRtStackR2012b(&q_emlrtRSI, emlrtRootTLSGlobal); i0 = PerTgt_tmp->size[1]; i1 = rho->size[1]; emlrtDimSizeEqCheckFastR2012b(i0, i1, &w_emlrtECI, emlrtRootTLSGlobal); i0 = sigma12->size[0] * sigma12->size[1]; sigma12->size[0] = 2; sigma12->size[1] = PerTgt_tmp->size[1]; emxEnsureCapacity((emxArray__common *)sigma12, i0, (int32_T)sizeof(real_T), &emlrtRTEI); loop_ub = PerTgt_tmp->size[1]; for (i0 = 0; i0 < loop_ub; i0++) { sigma12->data[sigma12->size[0] * i0] = PerTgt_tmp->data[PerTgt_tmp-> size[0] * i0]; } loop_ub = rho->size[1]; for (i0 = 0; i0 < loop_ub; i0++) { sigma12->data[1 + sigma12->size[0] * i0] = rho->data[rho->size[0] * i0]; } for (i0 = 0; i0 < 2; i0++) { b_rho[i0] = sigma11->size[i0]; } for (ndbl = 0; ndbl < 2; ndbl++) { iv0[ndbl] = 2; } emlrtSizeEqCheck2DFastR2012b(b_rho, iv0, &v_emlrtECI, emlrtRootTLSGlobal); emlrtPushRtStackR2012b(&r_emlrtRSI, emlrtRootTLSGlobal); inv(varT, b_b); emlrtPushRtStackR2012b(&ud_emlrtRSI, emlrtRootTLSGlobal); if (!(sigma12->size[1] == 1)) { if (b_b->size[1] == 1) { emlrtPushRtStackR2012b(&wd_emlrtRSI, emlrtRootTLSGlobal); n_y = NULL; m0 = mxCreateCharArray(2, iv9); for (ndbl = 0; ndbl < 45; ndbl++) { cv0[ndbl] = cv1[ndbl]; } emlrtInitCharArrayR2013a(emlrtRootTLSGlobal, 45, m0, cv0); emlrtAssign(&n_y, m0); error(message(n_y, &r_emlrtMCI), &s_emlrtMCI); emlrtPopRtStackR2012b(&wd_emlrtRSI, emlrtRootTLSGlobal); } else { emlrtPushRtStackR2012b(&vd_emlrtRSI, emlrtRootTLSGlobal); o_y = NULL; m0 = mxCreateCharArray(2, iv10); for (ndbl = 0; ndbl < 21; ndbl++) { cv2[ndbl] = cv3[ndbl]; } emlrtInitCharArrayR2013a(emlrtRootTLSGlobal, 21, m0, cv2); emlrtAssign(&o_y, m0); error(message(o_y, &t_emlrtMCI), &u_emlrtMCI); emlrtPopRtStackR2012b(&vd_emlrtRSI, emlrtRootTLSGlobal); } } emlrtPopRtStackR2012b(&ud_emlrtRSI, emlrtRootTLSGlobal); i0 = b_y->size[0] * b_y->size[1]; b_y->size[0] = 2; b_y->size[1] = b_b->size[1]; emxEnsureCapacity((emxArray__common *)b_y, i0, (int32_T)sizeof(real_T), &emlrtRTEI); for (i0 = 0; i0 < 2; i0++) { loop_ub = b_b->size[1]; for (i1 = 0; i1 < loop_ub; i1++) { b_y->data[i0 + b_y->size[0] * i1] = sigma12->data[i0] * b_b->data [b_b->size[0] * i1]; } } i0 = c_b->size[0] * c_b->size[1]; c_b->size[0] = sigma12->size[1]; c_b->size[1] = 2; emxEnsureCapacity((emxArray__common *)c_b, i0, (int32_T)sizeof(real_T), &emlrtRTEI); for (i0 = 0; i0 < 2; i0++) { loop_ub = sigma12->size[1]; for (i1 = 0; i1 < loop_ub; i1++) { c_b->data[i1 + c_b->size[0] * i0] = sigma12->data[i0 + sigma12->size[0] * i1]; } } emlrtPushRtStackR2012b(&ud_emlrtRSI, emlrtRootTLSGlobal); if (!(b_y->size[1] == c_b->size[0])) { emlrtPushRtStackR2012b(&vd_emlrtRSI, emlrtRootTLSGlobal); p_y = NULL; m0 = mxCreateCharArray(2, iv11); for (ndbl = 0; ndbl < 21; ndbl++) { cv2[ndbl] = cv3[ndbl]; } emlrtInitCharArrayR2013a(emlrtRootTLSGlobal, 21, m0, cv2); emlrtAssign(&p_y, m0); error(message(p_y, &t_emlrtMCI), &u_emlrtMCI); emlrtPopRtStackR2012b(&vd_emlrtRSI, emlrtRootTLSGlobal); } emlrtPopRtStackR2012b(&ud_emlrtRSI, emlrtRootTLSGlobal); if ((b_y->size[1] == 1) || (c_b->size[0] == 1)) { for (i0 = 0; i0 < 2; i0++) { for (i1 = 0; i1 < 2; i1++) { q_y[i0 + (i1 << 1)] = 0.0; loop_ub = b_y->size[1]; for (absb = 0; absb < loop_ub; absb++) { q_y[i0 + (i1 << 1)] += b_y->data[i0 + b_y->size[0] * absb] * c_b->data[absb + c_b->size[0] * i1]; } } } } else { emlrtPushRtStackR2012b(&ge_emlrtRSI, emlrtRootTLSGlobal); emlrtPushRtStackR2012b(&he_emlrtRSI, emlrtRootTLSGlobal); for (i0 = 0; i0 < 4; i0++) { q_y[i0] = 0.0; } if (b_y->size[1] < 1) { } else { emlrtPushRtStackR2012b(&je_emlrtRSI, emlrtRootTLSGlobal); minID = 1.0; b = 0.0; TRANSB = 'N'; TRANSA = 'N'; emlrtPushRtStackR2012b(&ne_emlrtRSI, emlrtRootTLSGlobal); emlrtPushRtStackR2012b(&af_emlrtRSI, emlrtRootTLSGlobal); m_t = (ptrdiff_t)(2); emlrtPopRtStackR2012b(&af_emlrtRSI, emlrtRootTLSGlobal); emlrtPopRtStackR2012b(&ne_emlrtRSI, emlrtRootTLSGlobal); emlrtPushRtStackR2012b(&oe_emlrtRSI, emlrtRootTLSGlobal); emlrtPushRtStackR2012b(&af_emlrtRSI, emlrtRootTLSGlobal); n_t = (ptrdiff_t)(2); emlrtPopRtStackR2012b(&af_emlrtRSI, emlrtRootTLSGlobal); emlrtPopRtStackR2012b(&oe_emlrtRSI, emlrtRootTLSGlobal); emlrtPushRtStackR2012b(&pe_emlrtRSI, emlrtRootTLSGlobal); emlrtPushRtStackR2012b(&af_emlrtRSI, emlrtRootTLSGlobal); k_t = (ptrdiff_t)(b_y->size[1]); emlrtPopRtStackR2012b(&af_emlrtRSI, emlrtRootTLSGlobal); emlrtPopRtStackR2012b(&pe_emlrtRSI, emlrtRootTLSGlobal); emlrtPushRtStackR2012b(&qe_emlrtRSI, emlrtRootTLSGlobal); emlrtPushRtStackR2012b(&af_emlrtRSI, emlrtRootTLSGlobal); lda_t = (ptrdiff_t)(2); emlrtPopRtStackR2012b(&af_emlrtRSI, emlrtRootTLSGlobal); emlrtPopRtStackR2012b(&qe_emlrtRSI, emlrtRootTLSGlobal); emlrtPushRtStackR2012b(&re_emlrtRSI, emlrtRootTLSGlobal); emlrtPushRtStackR2012b(&af_emlrtRSI, emlrtRootTLSGlobal); ldb_t = (ptrdiff_t)(b_y->size[1]); emlrtPopRtStackR2012b(&af_emlrtRSI, emlrtRootTLSGlobal); emlrtPopRtStackR2012b(&re_emlrtRSI, emlrtRootTLSGlobal); emlrtPushRtStackR2012b(&se_emlrtRSI, emlrtRootTLSGlobal); emlrtPushRtStackR2012b(&af_emlrtRSI, emlrtRootTLSGlobal); ldc_t = (ptrdiff_t)(2); emlrtPopRtStackR2012b(&af_emlrtRSI, emlrtRootTLSGlobal); emlrtPopRtStackR2012b(&se_emlrtRSI, emlrtRootTLSGlobal); emlrtPushRtStackR2012b(&te_emlrtRSI, emlrtRootTLSGlobal); alpha1_t = (double *)(&minID); emlrtPopRtStackR2012b(&te_emlrtRSI, emlrtRootTLSGlobal); emlrtPushRtStackR2012b(&ue_emlrtRSI, emlrtRootTLSGlobal); Aia0_t = (double *)(&b_y->data[0]); emlrtPopRtStackR2012b(&ue_emlrtRSI, emlrtRootTLSGlobal); emlrtPushRtStackR2012b(&ve_emlrtRSI, emlrtRootTLSGlobal); Bib0_t = (double *)(&c_b->data[0]); emlrtPopRtStackR2012b(&ve_emlrtRSI, emlrtRootTLSGlobal); emlrtPushRtStackR2012b(&we_emlrtRSI, emlrtRootTLSGlobal); beta1_t = (double *)(&b); emlrtPopRtStackR2012b(&we_emlrtRSI, emlrtRootTLSGlobal); emlrtPushRtStackR2012b(&xe_emlrtRSI, emlrtRootTLSGlobal); Cic0_t = (double *)(&q_y[0]); emlrtPopRtStackR2012b(&xe_emlrtRSI, emlrtRootTLSGlobal); emlrtPushRtStackR2012b(&ye_emlrtRSI, emlrtRootTLSGlobal); 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(&ye_emlrtRSI, emlrtRootTLSGlobal); emlrtPopRtStackR2012b(&je_emlrtRSI, emlrtRootTLSGlobal); } emlrtPopRtStackR2012b(&he_emlrtRSI, emlrtRootTLSGlobal); emlrtPopRtStackR2012b(&ge_emlrtRSI, emlrtRootTLSGlobal); } emlrtPopRtStackR2012b(&r_emlrtRSI, emlrtRootTLSGlobal); i0 = covReq->size[0]; i1 = (int32_T)(1.0 + (real_T)i); absb = covReq->size[1]; apnd = (int32_T)(1.0 + (real_T)j); covReq->data[(emlrtDynamicBoundsCheckFastR2012b(i1, 1, i0, &xc_emlrtBCI, emlrtRootTLSGlobal) + covReq->size[0] * (emlrtDynamicBoundsCheckFastR2012b(apnd, 1, absb, &yc_emlrtBCI, emlrtRootTLSGlobal) - 1)) - 1] = sigma11->data[2] - q_y[2]; if (useVar == 0.0) { i0 = covReq->size[0]; i1 = (int32_T)(1.0 + (real_T)i); absb = covReq->size[1]; apnd = (int32_T)(1.0 + (real_T)j); covReq->data[(emlrtDynamicBoundsCheckFastR2012b(i1, 1, i0, &ad_emlrtBCI, emlrtRootTLSGlobal) + covReq->size[0] * (emlrtDynamicBoundsCheckFastR2012b(apnd, 1, absb, &bd_emlrtBCI, emlrtRootTLSGlobal) - 1)) - 1] = 0.0; } j++; emlrtBreakCheckFastR2012b(emlrtBreakCheckR2012bFlagVar, emlrtRootTLSGlobal); } i++; emlrtBreakCheckFastR2012b(emlrtBreakCheckR2012bFlagVar, emlrtRootTLSGlobal); } emxFree_int32_T(&f_ii); emxFree_int32_T(&e_ii); emxFree_int32_T(&d_ii); emxFree_int32_T(&r5); emxFree_int32_T(&r4); emxFree_int32_T(&r3); emxFree_real_T(&d_sigma); emxFree_real_T(&c_sigma); emxFree_real_T(&b_sigma); emxFree_int32_T(&b_ii); emxFree_real_T(&c_b); emxFree_real_T(&b_y); emxFree_real_T(&b_b); emxFree_real_T(&sigma12); emxFree_real_T(&sigma11); emxFree_real_T(&varT); emxFree_real_T(&rho); emxFree_real_T(&sigma); /* % Simulate response spectra using Monte Carlo Simulation */ /* 20 sets of response spectra are simulated and the best set (in terms of */ /* matching means, variances and skewness is chosen as the seed). The user */ /* can also optionally rerun this segment multiple times before deciding to */ /* proceed with the rest of the algorithm. It is to be noted, however, that */ /* the greedy improvement technique significantly improves the match between */ /* the means and the variances subsequently. */ /* Setting initial seed for simulation */ if (seedValue != 0.0) { emlrtPushRtStackR2012b(&s_emlrtRSI, emlrtRootTLSGlobal); emlrtPushRtStackR2012b(&bf_emlrtRSI, emlrtRootTLSGlobal); r_y = NULL; m0 = mxCreateCharArray(2, iv12); for (i = 0; i < 2; i++) { cv4[i] = cv5[i]; } emlrtInitCharArrayR2013a(emlrtRootTLSGlobal, 2, m0, cv4); emlrtAssign(&r_y, m0); rng(emlrt_marshallOut(seedValue), r_y, &cb_emlrtMCI); emlrtPopRtStackR2012b(&bf_emlrtRSI, emlrtRootTLSGlobal); emlrtPopRtStackR2012b(&s_emlrtRSI, emlrtRootTLSGlobal); } else { emlrtPushRtStackR2012b(&emlrtRSI, emlrtRootTLSGlobal); s_y = NULL; m0 = mxCreateCharArray(2, iv13); for (i = 0; i < 2; i++) { cv4[i] = cv5[i]; } emlrtInitCharArrayR2013a(emlrtRootTLSGlobal, 2, m0, cv4); emlrtAssign(&s_y, m0); rng(e_sum(mtimes(emlrt_marshallOut(100.0), clock(&emlrtMCI), &b_emlrtMCI), &c_emlrtMCI), s_y, &d_emlrtMCI); emlrtPopRtStackR2012b(&emlrtRSI, emlrtRootTLSGlobal); } /* compileReplaceClock */ memset(&devTotalSim[0], 0, 20U * sizeof(real_T)); c_emxInit_real_T(&tempf, 3, &r_emlrtRTEI, TRUE); b = emlrtNonNegativeCheckFastR2012b(nGM, &e_emlrtDCI, emlrtRootTLSGlobal); emlrtIntegerCheckFastR2012b(b, &d_emlrtDCI, emlrtRootTLSGlobal); i0 = tempf->size[0] * tempf->size[1] * tempf->size[2]; tempf->size[0] = (int32_T)nGM; emxEnsureCapacity((emxArray__common *)tempf, i0, (int32_T)sizeof(real_T), &emlrtRTEI); b = emlrtNonNegativeCheckFastR2012b(nGM, &e_emlrtDCI, emlrtRootTLSGlobal); emlrtIntegerCheckFastR2012b(b, &d_emlrtDCI, emlrtRootTLSGlobal); ndbl = F_x->size[1]; i0 = tempf->size[0] * tempf->size[1] * tempf->size[2]; tempf->size[1] = ndbl; tempf->size[2] = 20; emxEnsureCapacity((emxArray__common *)tempf, i0, (int32_T)sizeof(real_T), &emlrtRTEI); b = emlrtNonNegativeCheckFastR2012b(nGM, &e_emlrtDCI, emlrtRootTLSGlobal); loop_ub = (int32_T)emlrtIntegerCheckFastR2012b(b, &d_emlrtDCI, emlrtRootTLSGlobal) * F_x->size[1] * 20; for (i0 = 0; i0 < loop_ub; i0++) { tempf->data[i0] = 0.0; } emxInit_int32_T(&r6, 1, &emlrtRTEI, TRUE); b_emxInit_real_T(&d_b, 2, &emlrtRTEI, TRUE); b_emxInit_real_T(&r7, 2, &emlrtRTEI, TRUE); b_emxInit_real_T(&r8, 2, &emlrtRTEI, TRUE); b_emxInit_real_T(&r9, 2, &emlrtRTEI, TRUE); for (j = 0; j < 20; j++) { emlrtForLoopVectorCheckR2012b(1.0, 1.0, nGM, mxDOUBLE_CLASS, (int32_T)nGM, &de_emlrtRTEI, emlrtRootTLSGlobal); i = 0; while (i <= (int32_T)nGM - 1) { i0 = tempf->size[0]; i1 = (int32_T)(1.0 + (real_T)i); emlrtDynamicBoundsCheckFastR2012b(i1, 1, i0, &v_emlrtBCI, emlrtRootTLSGlobal); loop_ub = tempf->size[1]; i0 = r6->size[0]; r6->size[0] = loop_ub; emxEnsureCapacity((emxArray__common *)r6, i0, (int32_T)sizeof(int32_T), &emlrtRTEI); for (i0 = 0; i0 < loop_ub; i0++) { r6->data[i0] = i0; } emlrtPushRtStackR2012b(&t_emlrtRSI, emlrtRootTLSGlobal); mvnrnd_(sa, covReq, r1); b_exp(r1); emlrtPopRtStackR2012b(&t_emlrtRSI, emlrtRootTLSGlobal); iv14[0] = 1; iv14[1] = r6->size[0]; emlrtSubAssignSizeCheckR2012b(iv14, 2, *(int32_T (*)[2])r1->size, 2, &u_emlrtECI, emlrtRootTLSGlobal); loop_ub = r1->size[1]; for (i0 = 0; i0 < loop_ub; i0++) { tempf->data[(((int32_T)(1.0 + (real_T)i) + tempf->size[0] * r6->data[i0]) + tempf->size[0] * tempf->size[1] * j) - 1] = r1->data [r1->size[0] * i0]; } i++; emlrtBreakCheckFastR2012b(emlrtBreakCheckR2012bFlagVar, emlrtRootTLSGlobal); } emlrtPushRtStackR2012b(&u_emlrtRSI, emlrtRootTLSGlobal); loop_ub = tempf->size[0]; b_loop_ub = tempf->size[1]; i0 = r7->size[0] * r7->size[1]; r7->size[0] = loop_ub; r7->size[1] = b_loop_ub; emxEnsureCapacity((emxArray__common *)r7, i0, (int32_T)sizeof(real_T), &emlrtRTEI); for (i0 = 0; i0 < b_loop_ub; i0++) { for (i1 = 0; i1 < loop_ub; i1++) { r7->data[i1 + r7->size[0] * i0] = tempf->data[(i1 + tempf->size[0] * i0) + tempf->size[0] * tempf->size[1] * j]; } } d_log(r7); mean(r7, r1); emlrtPopRtStackR2012b(&u_emlrtRSI, emlrtRootTLSGlobal); for (i0 = 0; i0 < 2; i0++) { iv0[i0] = r1->size[i0]; } for (i0 = 0; i0 < 2; i0++) { b_rho[i0] = sa->size[i0]; } emlrtSizeEqCheck2DFastR2012b(iv0, b_rho, &t_emlrtECI, emlrtRootTLSGlobal); emlrtPushRtStackR2012b(&v_emlrtRSI, emlrtRootTLSGlobal); loop_ub = tempf->size[0]; b_loop_ub = tempf->size[1]; i0 = r7->size[0] * r7->size[1]; r7->size[0] = loop_ub; r7->size[1] = b_loop_ub; emxEnsureCapacity((emxArray__common *)r7, i0, (int32_T)sizeof(real_T), &emlrtRTEI); for (i0 = 0; i0 < b_loop_ub; i0++) { for (i1 = 0; i1 < loop_ub; i1++) { r7->data[i1 + r7->size[0] * i0] = tempf->data[(i1 + tempf->size[0] * i0) + tempf->size[0] * tempf->size[1] * j]; } } d_log(r7); skew(r7, PerTgt_tmp); emlrtPopRtStackR2012b(&v_emlrtRSI, emlrtRootTLSGlobal); emlrtPushRtStackR2012b(&w_emlrtRSI, emlrtRootTLSGlobal); loop_ub = tempf->size[0]; b_loop_ub = tempf->size[1]; i0 = r7->size[0] * r7->size[1]; r7->size[0] = loop_ub; r7->size[1] = b_loop_ub; emxEnsureCapacity((emxArray__common *)r7, i0, (int32_T)sizeof(real_T), &emlrtRTEI); for (i0 = 0; i0 < b_loop_ub; i0++) { for (i1 = 0; i1 < loop_ub; i1++) { r7->data[i1 + r7->size[0] * i0] = tempf->data[(i1 + tempf->size[0] * i0) + tempf->size[0] * tempf->size[1] * j]; } } d_log(r7); b_std(r7, r2); emlrtPopRtStackR2012b(&w_emlrtRSI, emlrtRootTLSGlobal); emlrtPushRtStackR2012b(&w_emlrtRSI, emlrtRootTLSGlobal); diag(covReq, r7); d_sqrt(r7); i0 = d_b->size[0] * d_b->size[1]; d_b->size[0] = r7->size[1]; d_b->size[1] = r7->size[0]; emxEnsureCapacity((emxArray__common *)d_b, i0, (int32_T)sizeof(real_T), &emlrtRTEI); loop_ub = r7->size[0]; for (i0 = 0; i0 < loop_ub; i0++) { b_loop_ub = r7->size[1]; for (i1 = 0; i1 < b_loop_ub; i1++) { d_b->data[i1 + d_b->size[0] * i0] = r7->data[i0 + r7->size[0] * i1]; } } emlrtPopRtStackR2012b(&w_emlrtRSI, emlrtRootTLSGlobal); for (i0 = 0; i0 < 2; i0++) { iv0[i0] = r2->size[i0]; } for (i0 = 0; i0 < 2; i0++) { e_b[i0] = d_b->size[i0]; } emlrtSizeEqCheck2DFastR2012b(iv0, e_b, &s_emlrtECI, emlrtRootTLSGlobal); emlrtPushRtStackR2012b(&x_emlrtRSI, emlrtRootTLSGlobal); i0 = r9->size[0] * r9->size[1]; r9->size[0] = 1; r9->size[1] = r2->size[1]; emxEnsureCapacity((emxArray__common *)r9, i0, (int32_T)sizeof(real_T), &emlrtRTEI); loop_ub = r2->size[0] * r2->size[1]; for (i0 = 0; i0 < loop_ub; i0++) { r9->data[i0] = r2->data[i0] - d_b->data[i0]; } power(r9, r7); c_sum(r7, devTotal_data, devTotal_size); emlrtPopRtStackR2012b(&x_emlrtRSI, emlrtRootTLSGlobal); emlrtPushRtStackR2012b(&x_emlrtRSI, emlrtRootTLSGlobal); i0 = r8->size[0] * r8->size[1]; r8->size[0] = 1; r8->size[1] = r1->size[1]; emxEnsureCapacity((emxArray__common *)r8, i0, (int32_T)sizeof(real_T), &emlrtRTEI); loop_ub = r1->size[0] * r1->size[1]; for (i0 = 0; i0 < loop_ub; i0++) { r8->data[i0] = r1->data[i0] - sa->data[i0]; } b_power(r8, r1); b = b_sum(r1); b_power(PerTgt_tmp, r1); minID = b_sum(r1); devTotalSim[j] = (weight_mean * b + weight_sd * devTotal_data[0]) + 0.1 * (weight_mean + weight_sd) * minID; emlrtPopRtStackR2012b(&x_emlrtRSI, emlrtRootTLSGlobal); emlrtBreakCheckFastR2012b(emlrtBreakCheckR2012bFlagVar, emlrtRootTLSGlobal); } emxFree_real_T(&r9); emxFree_real_T(&r8); memcpy(&b_devTotalSim[0], &devTotalSim[0], 20U * sizeof(real_T)); c_abs(b_devTotalSim, devTotalSim); ndbl = 1; minID = devTotalSim[0]; k = 0; if (muDoubleScalarIsNaN(devTotalSim[0])) { cdiff = 1; exitg3 = FALSE; while ((exitg3 == FALSE) && (cdiff + 1 < 21)) { ndbl = cdiff + 1; if (!muDoubleScalarIsNaN(devTotalSim[cdiff])) { minID = devTotalSim[cdiff]; k = cdiff; exitg3 = TRUE; } else { cdiff++; } } } if (ndbl < 20) { while (ndbl + 1 < 21) { if (devTotalSim[ndbl] < minID) { minID = devTotalSim[ndbl]; k = ndbl; } ndbl++; } } /* if showPlots == 1 */ i0 = F1_y1->size[0] * F1_y1->size[1]; F1_y1->size[0] = 1; F1_y1->size[1] = sa->size[1]; emxEnsureCapacity((emxArray__common *)F1_y1, i0, (int32_T)sizeof(real_T), &emlrtRTEI); loop_ub = sa->size[0] * sa->size[1]; for (i0 = 0; i0 < loop_ub; i0++) { F1_y1->data[i0] = sa->data[i0]; } b_exp(F1_y1); emlrtPushRtStackR2012b(&y_emlrtRSI, emlrtRootTLSGlobal); diag(covReq, r7); d_sqrt(r7); i0 = d_b->size[0] * d_b->size[1]; d_b->size[0] = r7->size[1]; d_b->size[1] = r7->size[0]; emxEnsureCapacity((emxArray__common *)d_b, i0, (int32_T)sizeof(real_T), &emlrtRTEI); loop_ub = r7->size[0]; for (i0 = 0; i0 < loop_ub; i0++) { b_loop_ub = r7->size[1]; for (i1 = 0; i1 < b_loop_ub; i1++) { d_b->data[i1 + d_b->size[0] * i0] = r7->data[i0 + r7->size[0] * i1]; } } i0 = d_b->size[0] * d_b->size[1]; emxEnsureCapacity((emxArray__common *)d_b, i0, (int32_T)sizeof(real_T), &emlrtRTEI); ndbl = d_b->size[0]; cdiff = d_b->size[1]; loop_ub = ndbl * cdiff; for (i0 = 0; i0 < loop_ub; i0++) { d_b->data[i0] *= 1.96; } emlrtPopRtStackR2012b(&y_emlrtRSI, emlrtRootTLSGlobal); for (i0 = 0; i0 < 2; i0++) { b_rho[i0] = sa->size[i0]; } for (i0 = 0; i0 < 2; i0++) { e_b[i0] = d_b->size[i0]; } emlrtSizeEqCheck2DFastR2012b(b_rho, e_b, &r_emlrtECI, emlrtRootTLSGlobal); i0 = d_b->size[0] * d_b->size[1]; d_b->size[0] = 1; d_b->size[1] = sa->size[1]; emxEnsureCapacity((emxArray__common *)d_b, i0, (int32_T)sizeof(real_T), &emlrtRTEI); loop_ub = sa->size[0] * sa->size[1]; for (i0 = 0; i0 < loop_ub; i0++) { d_b->data[i0] += sa->data[i0]; } c_exp(d_b); i0 = F1_y2->size[0] * F1_y2->size[1]; F1_y2->size[0] = d_b->size[0]; F1_y2->size[1] = d_b->size[1]; emxEnsureCapacity((emxArray__common *)F1_y2, i0, (int32_T)sizeof(real_T), &emlrtRTEI); loop_ub = d_b->size[0] * d_b->size[1]; for (i0 = 0; i0 < loop_ub; i0++) { F1_y2->data[i0] = d_b->data[i0]; } loop_ub = tempf->size[0]; b_loop_ub = tempf->size[1]; i0 = F1_yn->size[0] * F1_yn->size[1]; F1_yn->size[0] = loop_ub; F1_yn->size[1] = b_loop_ub; emxEnsureCapacity((emxArray__common *)F1_yn, i0, (int32_T)sizeof(real_T), &emlrtRTEI); for (i0 = 0; i0 < b_loop_ub; i0++) { for (i1 = 0; i1 < loop_ub; i1++) { F1_yn->data[i1 + F1_yn->size[0] * i0] = tempf->data[(i1 + tempf->size[0] * i0) + tempf->size[0] * tempf->size[1] * k]; } } emlrtPushRtStackR2012b(&ab_emlrtRSI, emlrtRootTLSGlobal); diag(covReq, r7); d_sqrt(r7); i0 = d_b->size[0] * d_b->size[1]; d_b->size[0] = r7->size[1]; d_b->size[1] = r7->size[0]; emxEnsureCapacity((emxArray__common *)d_b, i0, (int32_T)sizeof(real_T), &emlrtRTEI); loop_ub = r7->size[0]; for (i0 = 0; i0 < loop_ub; i0++) { b_loop_ub = r7->size[1]; for (i1 = 0; i1 < b_loop_ub; i1++) { d_b->data[i1 + d_b->size[0] * i0] = r7->data[i0 + r7->size[0] * i1]; } } i0 = d_b->size[0] * d_b->size[1]; emxEnsureCapacity((emxArray__common *)d_b, i0, (int32_T)sizeof(real_T), &emlrtRTEI); ndbl = d_b->size[0]; cdiff = d_b->size[1]; loop_ub = ndbl * cdiff; for (i0 = 0; i0 < loop_ub; i0++) { d_b->data[i0] *= 1.96; } emlrtPopRtStackR2012b(&ab_emlrtRSI, emlrtRootTLSGlobal); for (i0 = 0; i0 < 2; i0++) { b_rho[i0] = sa->size[i0]; } for (i0 = 0; i0 < 2; i0++) { e_b[i0] = d_b->size[i0]; } emlrtSizeEqCheck2DFastR2012b(b_rho, e_b, &q_emlrtECI, emlrtRootTLSGlobal); i0 = d_b->size[0] * d_b->size[1]; d_b->size[0] = 1; d_b->size[1] = sa->size[1]; emxEnsureCapacity((emxArray__common *)d_b, i0, (int32_T)sizeof(real_T), &emlrtRTEI); loop_ub = sa->size[0] * sa->size[1]; for (i0 = 0; i0 < loop_ub; i0++) { d_b->data[i0] = sa->data[i0] - d_b->data[i0]; } c_exp(d_b); i0 = F1_y3->size[0] * F1_y3->size[1]; F1_y3->size[0] = d_b->size[0]; F1_y3->size[1] = d_b->size[1]; emxEnsureCapacity((emxArray__common *)F1_y3, i0, (int32_T)sizeof(real_T), &emlrtRTEI); loop_ub = d_b->size[0] * d_b->size[1]; for (i0 = 0; i0 < loop_ub; i0++) { F1_y3->data[i0] = d_b->data[i0]; } emlrtPushRtStackR2012b(&bb_emlrtRSI, emlrtRootTLSGlobal); loop_ub = tempf->size[0]; b_loop_ub = tempf->size[1]; i0 = r7->size[0] * r7->size[1]; r7->size[0] = loop_ub; r7->size[1] = b_loop_ub; emxEnsureCapacity((emxArray__common *)r7, i0, (int32_T)sizeof(real_T), &emlrtRTEI); for (i0 = 0; i0 < b_loop_ub; i0++) { for (i1 = 0; i1 < loop_ub; i1++) { r7->data[i1 + r7->size[0] * i0] = tempf->data[(i1 + tempf->size[0] * i0) + tempf->size[0] * tempf->size[1] * k]; } } d_log(r7); mean(r7, F2_y1); b_exp(F2_y1); emlrtPopRtStackR2012b(&bb_emlrtRSI, emlrtRootTLSGlobal); emlrtPushRtStackR2012b(&cb_emlrtRSI, emlrtRootTLSGlobal); diag(covReq, r7); d_sqrt(r7); i0 = F3_y1->size[0] * F3_y1->size[1]; F3_y1->size[0] = r7->size[1]; F3_y1->size[1] = r7->size[0]; emxEnsureCapacity((emxArray__common *)F3_y1, i0, (int32_T)sizeof(real_T), &emlrtRTEI); loop_ub = r7->size[0]; for (i0 = 0; i0 < loop_ub; i0++) { b_loop_ub = r7->size[1]; for (i1 = 0; i1 < b_loop_ub; i1++) { F3_y1->data[i1 + F3_y1->size[0] * i0] = r7->data[i0 + r7->size[0] * i1]; } } emlrtPopRtStackR2012b(&cb_emlrtRSI, emlrtRootTLSGlobal); emlrtPushRtStackR2012b(&db_emlrtRSI, emlrtRootTLSGlobal); loop_ub = tempf->size[0]; b_loop_ub = tempf->size[1]; i0 = r7->size[0] * r7->size[1]; r7->size[0] = loop_ub; r7->size[1] = b_loop_ub; emxEnsureCapacity((emxArray__common *)r7, i0, (int32_T)sizeof(real_T), &emlrtRTEI); for (i0 = 0; i0 < b_loop_ub; i0++) { for (i1 = 0; i1 < loop_ub; i1++) { r7->data[i1 + r7->size[0] * i0] = tempf->data[(i1 + tempf->size[0] * i0) + tempf->size[0] * tempf->size[1] * k]; } } emxInit_real_T(&recPer, 1, &s_emlrtRTEI, TRUE); d_log(r7); b_std(r7, F3_y2); emlrtPopRtStackR2012b(&db_emlrtRSI, emlrtRootTLSGlobal); /* */ /* % Plot simulated response spectra */ /* figure */ /* loglog(PerTgt, exp(meanReq), '-r', 'linewidth', 3) */ /* hold on */ /* loglog(PerTgt, exp(meanReq + 1.96*sqrt(diag(covReq))'), '--r', 'linewidth', 3) */ /* for i=1:nGM */ /* loglog(PerTgt,gm,'k'); */ /* end */ /* loglog(PerTgt, exp(meanReq - 1.96*sqrt(diag(covReq))'), '--r', 'linewidth', 3) */ /* axis([min(PerTgt) max(PerTgt) 1e-2 5]) */ /* xlabel('T (s)') */ /* ylabel('S_a (g)') */ /* legend('Median response spectrum','2.5 and 97.5 percentile response spectra','Response spectra of simulated ground motions') */ /* title('Response spectra of simulated ground motions') */ /* */ /* % Plot target and simulated means */ /* figure */ /* loglog(PerTgt,exp(meanReq)) */ /* hold on */ /* loglog(PerTgt,exp(mean(log(gm))),'--') */ /* axis([min(PerTgt) max(PerTgt) 1e-2 5]) */ /* xlabel('T (s)') */ /* ylabel('Median S_a (g)') */ /* legend('exp(Target mean lnS_a)','exp(Mean of simulated lnS_a)') */ /* title('Target and sample exponential logarithmic means (i.e., medians)') */ /* */ /* % Plot target and simulated standard deviations */ /* figure */ /* semilogx(PerTgt,sqrt(diag(covReq))') */ /* hold on */ /* semilogx(PerTgt,std(log(gm)),'--') */ /* axis([min(PerTgt) max(PerTgt) 0 1]) */ /* xlabel('T (s)') */ /* ylabel('Standard deviation of lnS_a') */ /* legend('Target standard deviation of lnS_a','Standard deviation of simulated lnS_a') */ /* title('Target and sample logarithmic standard deviations') */ /* */ /* end */ /* % Arrange the available spectra in a usable format and check for invalid */ /* input */ /* Match periods (known periods and periods for error computations) */ i0 = recPer->size[0]; recPer->size[0] = F_x->size[1]; emxEnsureCapacity((emxArray__common *)recPer, i0, (int32_T)sizeof(real_T), &emlrtRTEI); loop_ub = F_x->size[1]; for (i0 = 0; i0 < loop_ub; i0++) { recPer->data[i0] = 0.0; } i = 0; while (i <= F_x->size[1] - 1) { i0 = F_x->size[1]; i1 = (int32_T)(1.0 + (real_T)i); minID = F_x->data[emlrtDynamicBoundsCheckFastR2012b(i1, 1, i0, &sc_emlrtBCI, emlrtRootTLSGlobal) - 1]; for (i0 = 0; i0 < 501; i0++) { b_F4_x1[i0] = F4_x1[i0] - minID; } d_abs(b_F4_x1, varargin_1); ndbl = 1; minID = varargin_1[0]; absb = 1; if (muDoubleScalarIsNaN(varargin_1[0])) { cdiff = 2; exitg2 = FALSE; while ((exitg2 == FALSE) && (cdiff < 502)) { ndbl = cdiff; if (!muDoubleScalarIsNaN(varargin_1[cdiff - 1])) { minID = varargin_1[cdiff - 1]; absb = cdiff; exitg2 = TRUE; } else { cdiff++; } } } if (ndbl < 501) { while (ndbl + 1 < 502) { if (varargin_1[ndbl] < minID) { minID = varargin_1[ndbl]; absb = ndbl + 1; } ndbl++; } } i0 = recPer->size[0]; i1 = (int32_T)(1.0 + (real_T)i); recPer->data[emlrtDynamicBoundsCheckFastR2012b(i1, 1, i0, &tc_emlrtBCI, emlrtRootTLSGlobal) - 1] = absb; i++; emlrtBreakCheckFastR2012b(emlrtBreakCheckR2012bFlagVar, emlrtRootTLSGlobal); } /* Check for invalid input */ loop_ub = recPer->size[0]; for (i0 = 0; i0 < loop_ub; i0++) { i1 = SaKnown->size[1]; absb = (int32_T)recPer->data[i0]; emlrtDynamicBoundsCheckFastR2012b(absb, 1, i1, &cb_emlrtBCI, emlrtRootTLSGlobal); } emxInit_boolean_T(&r10, 2, &emlrtRTEI, TRUE); emlrtPushRtStackR2012b(&eb_emlrtRSI, emlrtRootTLSGlobal); loop_ub = SaKnown->size[0]; i0 = r10->size[0] * r10->size[1]; r10->size[0] = loop_ub; r10->size[1] = recPer->size[0]; emxEnsureCapacity((emxArray__common *)r10, i0, (int32_T)sizeof(boolean_T), &emlrtRTEI); b_loop_ub = recPer->size[0]; for (i0 = 0; i0 < b_loop_ub; i0++) { for (i1 = 0; i1 < loop_ub; i1++) { r10->data[i1 + r10->size[0] * i0] = muDoubleScalarIsNaN(SaKnown->data[i1 + SaKnown->size[0] * ((int32_T)recPer->data[i0] - 1)]); } } b_any(r10, x); overflow = any(x); emlrtPopRtStackR2012b(&eb_emlrtRSI, emlrtRootTLSGlobal); emxFree_boolean_T(&r10); emxFree_boolean_T(&x); if (overflow) { *errCode = 3390.0; /* 'NaNs found in input response spectra' */ i0 = finalRecords->size[0]; finalRecords->size[0] = 1; emxEnsureCapacity((emxArray__common *)finalRecords, i0, (int32_T)sizeof (real_T), &emlrtRTEI); finalRecords->data[0] = 0.0; i0 = finalScaleFactors->size[0]; finalScaleFactors->size[0] = 1; emxEnsureCapacity((emxArray__common *)finalScaleFactors, i0, (int32_T)sizeof (real_T), &emlrtRTEI); finalScaleFactors->data[0] = 0.0; i0 = F_x->size[0] * F_x->size[1]; F_x->size[0] = 1; F_x->size[1] = 1; emxEnsureCapacity((emxArray__common *)F_x, i0, (int32_T)sizeof(real_T), &emlrtRTEI); F_x->data[0] = 0.0; i0 = F1_y1->size[0] * F1_y1->size[1]; F1_y1->size[0] = 1; F1_y1->size[1] = 1; emxEnsureCapacity((emxArray__common *)F1_y1, i0, (int32_T)sizeof(real_T), &emlrtRTEI); F1_y1->data[0] = 0.0; i0 = F1_y2->size[0] * F1_y2->size[1]; F1_y2->size[0] = 1; F1_y2->size[1] = 1; emxEnsureCapacity((emxArray__common *)F1_y2, i0, (int32_T)sizeof(real_T), &emlrtRTEI); F1_y2->data[0] = 0.0; i0 = F1_y3->size[0] * F1_y3->size[1]; F1_y3->size[0] = 1; F1_y3->size[1] = 1; emxEnsureCapacity((emxArray__common *)F1_y3, i0, (int32_T)sizeof(real_T), &emlrtRTEI); F1_y3->data[0] = 0.0; i0 = F1_yn->size[0] * F1_yn->size[1]; F1_yn->size[0] = 1; F1_yn->size[1] = 1; emxEnsureCapacity((emxArray__common *)F1_yn, i0, (int32_T)sizeof(real_T), &emlrtRTEI); F1_yn->data[0] = 0.0; i0 = F2_y1->size[0] * F2_y1->size[1]; F2_y1->size[0] = 1; F2_y1->size[1] = 1; emxEnsureCapacity((emxArray__common *)F2_y1, i0, (int32_T)sizeof(real_T), &emlrtRTEI); F2_y1->data[0] = 0.0; i0 = F3_y1->size[0] * F3_y1->size[1]; F3_y1->size[0] = 1; F3_y1->size[1] = 1; emxEnsureCapacity((emxArray__common *)F3_y1, i0, (int32_T)sizeof(real_T), &emlrtRTEI); F3_y1->data[0] = 0.0; i0 = F3_y2->size[0] * F3_y2->size[1]; F3_y2->size[0] = 1; F3_y2->size[1] = 1; emxEnsureCapacity((emxArray__common *)F3_y2, i0, (int32_T)sizeof(real_T), &emlrtRTEI); F3_y2->data[0] = 0.0; i0 = F4_y1->size[0] * F4_y1->size[1]; F4_y1->size[0] = 1; F4_y1->size[1] = 1; emxEnsureCapacity((emxArray__common *)F4_y1, i0, (int32_T)sizeof(real_T), &emlrtRTEI); F4_y1->data[0] = 0.0; i0 = F5_y1->size[0] * F5_y1->size[1]; F5_y1->size[0] = 1; F5_y1->size[1] = 1; emxEnsureCapacity((emxArray__common *)F5_y1, i0, (int32_T)sizeof(real_T), &emlrtRTEI); F5_y1->data[0] = 0.0; i0 = F6_y1->size[0] * F6_y1->size[1]; F6_y1->size[0] = 1; F6_y1->size[1] = 1; emxEnsureCapacity((emxArray__common *)F6_y1, i0, (int32_T)sizeof(real_T), &emlrtRTEI); F6_y1->data[0] = 0.0; i0 = F7_y1->size[0] * F7_y1->size[1]; F7_y1->size[0] = 1; F7_y1->size[1] = 1; emxEnsureCapacity((emxArray__common *)F7_y1, i0, (int32_T)sizeof(real_T), &emlrtRTEI); F7_y1->data[0] = 0.0; } else { b_emxInit_real_T(&sampleBig, 2, &t_emlrtRTEI, TRUE); /* Processing available spectra */ emlrtPushRtStackR2012b(&fb_emlrtRSI, emlrtRootTLSGlobal); loop_ub = SaKnown->size[0]; i0 = sampleBig->size[0] * sampleBig->size[1]; sampleBig->size[0] = loop_ub; sampleBig->size[1] = recPer->size[0]; emxEnsureCapacity((emxArray__common *)sampleBig, i0, (int32_T)sizeof(real_T), &emlrtRTEI); b_loop_ub = recPer->size[0]; for (i0 = 0; i0 < b_loop_ub; i0++) { for (i1 = 0; i1 < loop_ub; i1++) { sampleBig->data[i1 + sampleBig->size[0] * i0] = SaKnown->data[i1 + SaKnown->size[0] * ((int32_T)recPer->data[i0] - 1)]; } } d_log(sampleBig); emlrtPopRtStackR2012b(&fb_emlrtRSI, emlrtRootTLSGlobal); /* % Find best matches to the simulated spectra from ground-motion database */ i0 = recPer->size[0]; recPer->size[0] = sampleBig->size[0]; emxEnsureCapacity((emxArray__common *)recPer, i0, (int32_T)sizeof(real_T), &emlrtRTEI); loop_ub = sampleBig->size[0]; for (i0 = 0; i0 < loop_ub; i0++) { recPer->data[i0] = 0.0; } b_emxInit_real_T(&sampleSmall, 2, &u_emlrtRTEI, TRUE); i0 = sampleSmall->size[0] * sampleSmall->size[1]; sampleSmall->size[0] = (int32_T)nGM; emxEnsureCapacity((emxArray__common *)sampleSmall, i0, (int32_T)sizeof (real_T), &emlrtRTEI); ndbl = F_x->size[1]; i0 = sampleSmall->size[0] * sampleSmall->size[1]; sampleSmall->size[1] = ndbl; emxEnsureCapacity((emxArray__common *)sampleSmall, i0, (int32_T)sizeof (real_T), &emlrtRTEI); loop_ub = (int32_T)nGM * F_x->size[1]; for (i0 = 0; i0 < loop_ub; i0++) { sampleSmall->data[i0] = 0.0; } i0 = finalScaleFactors->size[0]; finalScaleFactors->size[0] = (int32_T)nGM; emxEnsureCapacity((emxArray__common *)finalScaleFactors, i0, (int32_T)sizeof (real_T), &emlrtRTEI); loop_ub = (int32_T)nGM; for (i0 = 0; i0 < loop_ub; i0++) { finalScaleFactors->data[i0] = 1.0; } emlrtForLoopVectorCheckR2012b(1.0, 1.0, nGM, mxDOUBLE_CLASS, (int32_T)nGM, &ce_emlrtRTEI, emlrtRootTLSGlobal); i = 0; emxInit_real_T(&scaleFac, 1, &v_emlrtRTEI, TRUE); b_emxInit_boolean_T(&b_recID, 1, &emlrtRTEI, TRUE); b_emxInit_real_T(&b_sampleBig, 2, &emlrtRTEI, TRUE); b_emxInit_real_T(&e_PerTgt_tmp, 2, &emlrtRTEI, TRUE); b_emxInit_real_T(&r11, 2, &emlrtRTEI, TRUE); emxInit_boolean_T(&c_F_x, 2, &emlrtRTEI, TRUE); emxInit_boolean_T(&r12, 2, &emlrtRTEI, TRUE); b_emxInit_real_T(&r13, 2, &emlrtRTEI, TRUE); b_emxInit_int32_T(&r14, 2, &emlrtRTEI, TRUE); b_emxInit_real_T(&b_tempf, 2, &emlrtRTEI, TRUE); b_emxInit_real_T(&c_sampleBig, 2, &emlrtRTEI, TRUE); b_emxInit_real_T(&c_tempf, 2, &emlrtRTEI, TRUE); while (i <= (int32_T)nGM - 1) { i0 = recPer->size[0]; recPer->size[0] = sampleBig->size[0]; emxEnsureCapacity((emxArray__common *)recPer, i0, (int32_T)sizeof(real_T), &emlrtRTEI); loop_ub = sampleBig->size[0]; for (i0 = 0; i0 < loop_ub; i0++) { recPer->data[i0] = 0.0; } i0 = scaleFac->size[0]; scaleFac->size[0] = sampleBig->size[0]; emxEnsureCapacity((emxArray__common *)scaleFac, i0, (int32_T)sizeof(real_T), &emlrtRTEI); loop_ub = sampleBig->size[0]; for (i0 = 0; i0 < loop_ub; i0++) { scaleFac->data[i0] = 1.0; } j = 0; while (j <= sampleBig->size[0] - 1) { if (isScaled == 1.0) { emlrtPushRtStackR2012b(&gb_emlrtRSI, emlrtRootTLSGlobal); i0 = r13->size[0] * r13->size[1]; r13->size[0] = 1; r13->size[1] = posT1->size[1]; emxEnsureCapacity((emxArray__common *)r13, i0, (int32_T)sizeof(real_T), &emlrtRTEI); loop_ub = posT1->size[0] * posT1->size[1]; for (i0 = 0; i0 < loop_ub; i0++) { i1 = sampleBig->size[1]; absb = (int32_T)posT1->data[i0]; r13->data[i0] = emlrtDynamicBoundsCheckFastR2012b(absb, 1, i1, &ic_emlrtBCI, emlrtRootTLSGlobal); } ndbl = r13->size[1]; i0 = sampleBig->size[0]; i1 = (int32_T)(1.0 + (real_T)j); i0 = emlrtDynamicBoundsCheckFastR2012b(i1, 1, i0, &u_emlrtBCI, emlrtRootTLSGlobal); i1 = r1->size[0] * r1->size[1]; r1->size[0] = 1; r1->size[1] = ndbl; emxEnsureCapacity((emxArray__common *)r1, i1, (int32_T)sizeof(real_T), &emlrtRTEI); for (i1 = 0; i1 < ndbl; i1++) { r1->data[r1->size[0] * i1] = sampleBig->data[(i0 + sampleBig->size[0] * ((int32_T)r13->data[i1] - 1)) - 1]; } b_exp(r1); i0 = r12->size[0] * r12->size[1]; r12->size[0] = 1; r12->size[1] = r1->size[1]; emxEnsureCapacity((emxArray__common *)r12, i0, (int32_T)sizeof (boolean_T), &emlrtRTEI); loop_ub = r1->size[0] * r1->size[1]; for (i0 = 0; i0 < loop_ub; i0++) { r12->data[i0] = (r1->data[i0] == 0.0); } overflow = b_all(r12); emlrtPopRtStackR2012b(&gb_emlrtRSI, emlrtRootTLSGlobal); if (overflow) { i0 = scaleFac->size[0]; i1 = (int32_T)(1.0 + (real_T)j); scaleFac->data[emlrtDynamicBoundsCheckFastR2012b(i1, 1, i0, &pc_emlrtBCI, emlrtRootTLSGlobal) - 1] = -1.0; i0 = recPer->size[0]; i1 = (int32_T)(1.0 + (real_T)j); recPer->data[emlrtDynamicBoundsCheckFastR2012b(i1, 1, i0, &qc_emlrtBCI, emlrtRootTLSGlobal) - 1] = 1.0E+6; } else { emlrtPushRtStackR2012b(&hb_emlrtRSI, emlrtRootTLSGlobal); i0 = r1->size[0] * r1->size[1]; r1->size[0] = 1; r1->size[1] = lnSa1->size[1]; emxEnsureCapacity((emxArray__common *)r1, i0, (int32_T)sizeof(real_T), &emlrtRTEI); loop_ub = lnSa1->size[0] * lnSa1->size[1]; for (i0 = 0; i0 < loop_ub; i0++) { r1->data[i0] = lnSa1->data[i0]; } b_exp(r1); i0 = c_F_x->size[0] * c_F_x->size[1]; c_F_x->size[0] = 1; c_F_x->size[1] = F_x->size[1]; emxEnsureCapacity((emxArray__common *)c_F_x, i0, (int32_T)sizeof (boolean_T), &emlrtRTEI); loop_ub = F_x->size[0] * F_x->size[1]; for (i0 = 0; i0 < loop_ub; i0++) { c_F_x->data[i0] = (F_x->data[i0] == T1); } eml_li_find(c_F_x, ii); i0 = r14->size[0] * r14->size[1]; r14->size[0] = 1; r14->size[1] = ii->size[1]; emxEnsureCapacity((emxArray__common *)r14, i0, (int32_T)sizeof (int32_T), &emlrtRTEI); loop_ub = ii->size[0] * ii->size[1]; for (i0 = 0; i0 < loop_ub; i0++) { i1 = sampleBig->size[1]; absb = ii->data[i0]; r14->data[i0] = emlrtDynamicBoundsCheckFastR2012b(absb, 1, i1, &jc_emlrtBCI, emlrtRootTLSGlobal); } ndbl = r14->size[1]; i0 = sampleBig->size[0]; i1 = (int32_T)(1.0 + (real_T)j); i0 = emlrtDynamicBoundsCheckFastR2012b(i1, 1, i0, &t_emlrtBCI, emlrtRootTLSGlobal); i1 = r2->size[0] * r2->size[1]; r2->size[0] = 1; r2->size[1] = ndbl; emxEnsureCapacity((emxArray__common *)r2, i1, (int32_T)sizeof(real_T), &emlrtRTEI); for (i1 = 0; i1 < ndbl; i1++) { r2->data[r2->size[0] * i1] = sampleBig->data[(i0 + sampleBig-> size[0] * (r14->data[i1] - 1)) - 1]; } b_exp(r2); i0 = r11->size[0] * r11->size[1]; r11->size[0] = 1; r11->size[1] = r1->size[1]; emxEnsureCapacity((emxArray__common *)r11, i0, (int32_T)sizeof (real_T), &emlrtRTEI); loop_ub = r1->size[0] * r1->size[1]; for (i0 = 0; i0 < loop_ub; i0++) { r11->data[i0] = r1->data[i0]; } mrdivide(r11, r2, r1); emlrtPopRtStackR2012b(&hb_emlrtRSI, emlrtRootTLSGlobal); i0 = r1->size[1]; emlrtSizeEqCheck1DFastR2012b(1, i0, &p_emlrtECI, emlrtRootTLSGlobal); i0 = scaleFac->size[0]; i1 = (int32_T)(1.0 + (real_T)j); scaleFac->data[emlrtDynamicBoundsCheckFastR2012b(i1, 1, i0, &kc_emlrtBCI, emlrtRootTLSGlobal) - 1] = r1->data[0]; i0 = scaleFac->size[0]; i1 = (int32_T)(1.0 + (real_T)j); b_guard3 = FALSE; if (scaleFac->data[emlrtDynamicBoundsCheckFastR2012b(i1, 1, i0, &lc_emlrtBCI, emlrtRootTLSGlobal) - 1] > maxScale) { b_guard3 = TRUE; } else { i0 = soil_Vs30->size[0]; i1 = (int32_T)(1.0 + (real_T)j); if (soil_Vs30->data[emlrtDynamicBoundsCheckFastR2012b(i1, 1, i0, &mc_emlrtBCI, emlrtRootTLSGlobal) - 1] == -1.0) { b_guard3 = TRUE; } else { emlrtPushRtStackR2012b(&ib_emlrtRSI, emlrtRootTLSGlobal); loop_ub = sampleBig->size[1]; i0 = sampleBig->size[0]; i1 = (int32_T)(1.0 + (real_T)j); i0 = emlrtDynamicBoundsCheckFastR2012b(i1, 1, i0, &s_emlrtBCI, emlrtRootTLSGlobal); i1 = PerTgt_tmp->size[0] * PerTgt_tmp->size[1]; PerTgt_tmp->size[0] = 1; PerTgt_tmp->size[1] = loop_ub; emxEnsureCapacity((emxArray__common *)PerTgt_tmp, i1, (int32_T) sizeof(real_T), &emlrtRTEI); for (i1 = 0; i1 < loop_ub; i1++) { PerTgt_tmp->data[PerTgt_tmp->size[0] * i1] = sampleBig->data [(i0 + sampleBig->size[0] * i1) - 1]; } b_exp(PerTgt_tmp); i0 = scaleFac->size[0]; i1 = (int32_T)(1.0 + (real_T)j); emlrtDynamicBoundsCheckFastR2012b(i1, 1, i0, &r_emlrtBCI, emlrtRootTLSGlobal); i0 = PerTgt_tmp->size[0] * PerTgt_tmp->size[1]; PerTgt_tmp->size[0] = 1; emxEnsureCapacity((emxArray__common *)PerTgt_tmp, i0, (int32_T) sizeof(real_T), &emlrtRTEI); ndbl = PerTgt_tmp->size[0]; cdiff = PerTgt_tmp->size[1]; minID = scaleFac->data[(int32_T)(1.0 + (real_T)j) - 1]; loop_ub = ndbl * cdiff; for (i0 = 0; i0 < loop_ub; i0++) { PerTgt_tmp->data[i0] *= minID; } c_log(PerTgt_tmp); emlrtPopRtStackR2012b(&ib_emlrtRSI, emlrtRootTLSGlobal); emlrtPushRtStackR2012b(&ib_emlrtRSI, emlrtRootTLSGlobal); i0 = tempf->size[0]; loop_ub = tempf->size[1]; b_loop_ub = tempf->size[0]; ndbl = tempf->size[1]; i1 = (int32_T)(1.0 + (real_T)i); emlrtDynamicBoundsCheckFastR2012b(i1, 1, i0, &q_emlrtBCI, emlrtRootTLSGlobal); i0 = c_tempf->size[0] * c_tempf->size[1]; c_tempf->size[0] = b_loop_ub; c_tempf->size[1] = ndbl; emxEnsureCapacity((emxArray__common *)c_tempf, i0, (int32_T) sizeof(real_T), &emlrtRTEI); for (i0 = 0; i0 < ndbl; i0++) { for (i1 = 0; i1 < b_loop_ub; i1++) { c_tempf->data[i1 + c_tempf->size[0] * i0] = tempf->data[(i1 + tempf->size[0] * i0) + tempf->size[0] * tempf->size[1] * k]; } } i0 = r1->size[0] * r1->size[1]; r1->size[0] = 1; r1->size[1] = loop_ub; emxEnsureCapacity((emxArray__common *)r1, i0, (int32_T)sizeof (real_T), &emlrtRTEI); for (i0 = 0; i0 < loop_ub; i0++) { r1->data[r1->size[0] * i0] = c_tempf->data[((int32_T)(1.0 + (real_T)i) + c_tempf->size[0] * i0) - 1]; } c_log(r1); emlrtPopRtStackR2012b(&ib_emlrtRSI, emlrtRootTLSGlobal); for (i0 = 0; i0 < 2; i0++) { b_rho[i0] = PerTgt_tmp->size[i0]; } for (i0 = 0; i0 < 2; i0++) { iv0[i0] = r1->size[i0]; } emlrtSizeEqCheck2DFastR2012b(b_rho, iv0, &o_emlrtECI, emlrtRootTLSGlobal); emlrtPushRtStackR2012b(&ib_emlrtRSI, emlrtRootTLSGlobal); i0 = e_PerTgt_tmp->size[0] * e_PerTgt_tmp->size[1]; e_PerTgt_tmp->size[0] = 1; e_PerTgt_tmp->size[1] = PerTgt_tmp->size[1]; emxEnsureCapacity((emxArray__common *)e_PerTgt_tmp, i0, (int32_T) sizeof(real_T), &emlrtRTEI); loop_ub = PerTgt_tmp->size[0] * PerTgt_tmp->size[1]; for (i0 = 0; i0 < loop_ub; i0++) { e_PerTgt_tmp->data[i0] = PerTgt_tmp->data[i0] - r1->data[i0]; } b_power(e_PerTgt_tmp, r1); i0 = recPer->size[0]; i1 = (int32_T)(1.0 + (real_T)j); recPer->data[emlrtDynamicBoundsCheckFastR2012b(i1, 1, i0, &nc_emlrtBCI, emlrtRootTLSGlobal) - 1] = d_sum(r1); emlrtPopRtStackR2012b(&ib_emlrtRSI, emlrtRootTLSGlobal); } } if (b_guard3 == TRUE) { i0 = recPer->size[0]; i1 = (int32_T)(1.0 + (real_T)j); recPer->data[emlrtDynamicBoundsCheckFastR2012b(i1, 1, i0, &oc_emlrtBCI, emlrtRootTLSGlobal) - 1] = 1.0E+6; } } } else { i0 = soil_Vs30->size[0]; i1 = (int32_T)(1.0 + (real_T)j); if (soil_Vs30->data[emlrtDynamicBoundsCheckFastR2012b(i1, 1, i0, &dc_emlrtBCI, emlrtRootTLSGlobal) - 1] == -1.0) { i0 = recPer->size[0]; i1 = (int32_T)(1.0 + (real_T)j); recPer->data[emlrtDynamicBoundsCheckFastR2012b(i1, 1, i0, &hc_emlrtBCI, emlrtRootTLSGlobal) - 1] = 1.0E+6; } else { i0 = sampleBig->size[0]; i1 = (int32_T)(1.0 + (real_T)j); emlrtDynamicBoundsCheckFastR2012b(i1, 1, i0, &p_emlrtBCI, emlrtRootTLSGlobal); emlrtPushRtStackR2012b(&jb_emlrtRSI, emlrtRootTLSGlobal); i0 = tempf->size[0]; loop_ub = tempf->size[1]; b_loop_ub = tempf->size[0]; ndbl = tempf->size[1]; i1 = (int32_T)(1.0 + (real_T)i); emlrtDynamicBoundsCheckFastR2012b(i1, 1, i0, &o_emlrtBCI, emlrtRootTLSGlobal); i0 = b_tempf->size[0] * b_tempf->size[1]; b_tempf->size[0] = b_loop_ub; b_tempf->size[1] = ndbl; emxEnsureCapacity((emxArray__common *)b_tempf, i0, (int32_T)sizeof (real_T), &emlrtRTEI); for (i0 = 0; i0 < ndbl; i0++) { for (i1 = 0; i1 < b_loop_ub; i1++) { b_tempf->data[i1 + b_tempf->size[0] * i0] = tempf->data[(i1 + tempf->size[0] * i0) + tempf->size[0] * tempf->size[1] * k]; } } i0 = r1->size[0] * r1->size[1]; r1->size[0] = 1; r1->size[1] = loop_ub; emxEnsureCapacity((emxArray__common *)r1, i0, (int32_T)sizeof(real_T), &emlrtRTEI); for (i0 = 0; i0 < loop_ub; i0++) { r1->data[r1->size[0] * i0] = b_tempf->data[((int32_T)(1.0 + (real_T)i) + b_tempf->size[0] * i0) - 1]; } c_log(r1); emlrtPopRtStackR2012b(&jb_emlrtRSI, emlrtRootTLSGlobal); loop_ub = sampleBig->size[1]; i0 = c_sampleBig->size[0] * c_sampleBig->size[1]; c_sampleBig->size[0] = 1; c_sampleBig->size[1] = loop_ub; emxEnsureCapacity((emxArray__common *)c_sampleBig, i0, (int32_T) sizeof(real_T), &emlrtRTEI); for (i0 = 0; i0 < loop_ub; i0++) { c_sampleBig->data[c_sampleBig->size[0] * i0] = sampleBig->data [((int32_T)(1.0 + (real_T)j) + sampleBig->size[0] * i0) - 1]; } for (i0 = 0; i0 < 2; i0++) { b_rho[i0] = c_sampleBig->size[i0]; } for (i0 = 0; i0 < 2; i0++) { iv0[i0] = r1->size[i0]; } emlrtSizeEqCheck2DFastR2012b(b_rho, iv0, &n_emlrtECI, emlrtRootTLSGlobal); emlrtPushRtStackR2012b(&jb_emlrtRSI, emlrtRootTLSGlobal); loop_ub = sampleBig->size[1]; i0 = b_sampleBig->size[0] * b_sampleBig->size[1]; b_sampleBig->size[0] = 1; b_sampleBig->size[1] = loop_ub; emxEnsureCapacity((emxArray__common *)b_sampleBig, i0, (int32_T) sizeof(real_T), &emlrtRTEI); for (i0 = 0; i0 < loop_ub; i0++) { b_sampleBig->data[b_sampleBig->size[0] * i0] = sampleBig->data [((int32_T)(1.0 + (real_T)j) + sampleBig->size[0] * i0) - 1] - r1->data[r1->size[0] * i0]; } b_power(b_sampleBig, r1); i0 = recPer->size[0]; i1 = (int32_T)(1.0 + (real_T)j); recPer->data[emlrtDynamicBoundsCheckFastR2012b(i1, 1, i0, &ec_emlrtBCI, emlrtRootTLSGlobal) - 1] = d_sum(r1); emlrtPopRtStackR2012b(&jb_emlrtRSI, emlrtRootTLSGlobal); i0 = recPer->size[0]; i1 = (int32_T)(1.0 + (real_T)j); if (recPer->data[emlrtDynamicBoundsCheckFastR2012b(i1, 1, i0, &fc_emlrtBCI, emlrtRootTLSGlobal) - 1] == rtInf) { i0 = recPer->size[0]; i1 = (int32_T)(1.0 + (real_T)j); recPer->data[emlrtDynamicBoundsCheckFastR2012b(i1, 1, i0, &gc_emlrtBCI, emlrtRootTLSGlobal) - 1] = 1.0E+6; } } } emlrtPushRtStackR2012b(&kb_emlrtRSI, emlrtRootTLSGlobal); i0 = b_recID->size[0]; b_recID->size[0] = recID->size[0]; emxEnsureCapacity((emxArray__common *)b_recID, i0, (int32_T)sizeof (boolean_T), &emlrtRTEI); loop_ub = recID->size[0]; for (i0 = 0; i0 < loop_ub; i0++) { b_recID->data[i0] = (recID->data[i0] == 1.0 + (real_T)j); } overflow = c_any(b_recID); emlrtPopRtStackR2012b(&kb_emlrtRSI, emlrtRootTLSGlobal); if (overflow) { i0 = recPer->size[0]; i1 = (int32_T)(1.0 + (real_T)j); recPer->data[emlrtDynamicBoundsCheckFastR2012b(i1, 1, i0, &rc_emlrtBCI, emlrtRootTLSGlobal) - 1] = 1.0E+6; } j++; emlrtBreakCheckFastR2012b(emlrtBreakCheckR2012bFlagVar, emlrtRootTLSGlobal); } emlrtPushRtStackR2012b(&lb_emlrtRSI, emlrtRootTLSGlobal); emlrtPushRtStackR2012b(&uo_emlrtRSI, emlrtRootTLSGlobal); emlrtPushRtStackR2012b(&rl_emlrtRSI, emlrtRootTLSGlobal); if ((recPer->size[0] == 1) || (recPer->size[0] != 1)) { overflow = TRUE; } else { overflow = FALSE; } if (overflow) { } else { emlrtPushRtStackR2012b(&gg_emlrtRSI, emlrtRootTLSGlobal); t_y = NULL; m0 = mxCreateCharArray(2, iv15); for (ndbl = 0; ndbl < 36; ndbl++) { cv6[ndbl] = cv7[ndbl]; } emlrtInitCharArrayR2013a(emlrtRootTLSGlobal, 36, m0, cv6); emlrtAssign(&t_y, m0); error(message(t_y, &kb_emlrtMCI), &lb_emlrtMCI); emlrtPopRtStackR2012b(&gg_emlrtRSI, emlrtRootTLSGlobal); } if (recPer->size[0] > 0) { } else { emlrtPushRtStackR2012b(&hg_emlrtRSI, emlrtRootTLSGlobal); u_y = NULL; m0 = mxCreateCharArray(2, iv16); for (ndbl = 0; ndbl < 39; ndbl++) { cv8[ndbl] = cv9[ndbl]; } emlrtInitCharArrayR2013a(emlrtRootTLSGlobal, 39, m0, cv8); emlrtAssign(&u_y, m0); error(message(u_y, &mb_emlrtMCI), &nb_emlrtMCI); emlrtPopRtStackR2012b(&hg_emlrtRSI, emlrtRootTLSGlobal); } emlrtPushRtStackR2012b(&vo_emlrtRSI, emlrtRootTLSGlobal); ndbl = 1; minID = recPer->data[0]; absb = 1; if (recPer->size[0] > 1) { if (muDoubleScalarIsNaN(recPer->data[0])) { emlrtPushRtStackR2012b(&lg_emlrtRSI, emlrtRootTLSGlobal); if (2 > recPer->size[0]) { overflow = FALSE; } else { overflow = (recPer->size[0] > 2147483646); } if (overflow) { emlrtPushRtStackR2012b(&lc_emlrtRSI, emlrtRootTLSGlobal); check_forloop_overflow_error(); emlrtPopRtStackR2012b(&lc_emlrtRSI, emlrtRootTLSGlobal); } emlrtPopRtStackR2012b(&lg_emlrtRSI, emlrtRootTLSGlobal); cdiff = 2; exitg1 = FALSE; while ((exitg1 == FALSE) && (cdiff <= recPer->size[0])) { ndbl = cdiff; if (!muDoubleScalarIsNaN(recPer->data[cdiff - 1])) { minID = recPer->data[cdiff - 1]; absb = cdiff; exitg1 = TRUE; } else { cdiff++; } } } if (ndbl < recPer->size[0]) { emlrtPushRtStackR2012b(&kg_emlrtRSI, emlrtRootTLSGlobal); if (ndbl + 1 > recPer->size[0]) { overflow = FALSE; } else { overflow = (recPer->size[0] > 2147483646); } if (overflow) { emlrtPushRtStackR2012b(&lc_emlrtRSI, emlrtRootTLSGlobal); check_forloop_overflow_error(); emlrtPopRtStackR2012b(&lc_emlrtRSI, emlrtRootTLSGlobal); } emlrtPopRtStackR2012b(&kg_emlrtRSI, emlrtRootTLSGlobal); while (ndbl + 1 <= recPer->size[0]) { if (recPer->data[ndbl] < minID) { minID = recPer->data[ndbl]; absb = ndbl + 1; } ndbl++; } } } emlrtPopRtStackR2012b(&vo_emlrtRSI, emlrtRootTLSGlobal); emlrtPopRtStackR2012b(&rl_emlrtRSI, emlrtRootTLSGlobal); emlrtPopRtStackR2012b(&uo_emlrtRSI, emlrtRootTLSGlobal); emlrtPopRtStackR2012b(&lb_emlrtRSI, emlrtRootTLSGlobal); i0 = recID->size[0]; i1 = (int32_T)(1.0 + (real_T)i); recID->data[emlrtDynamicBoundsCheckFastR2012b(i1, 1, i0, &vb_emlrtBCI, emlrtRootTLSGlobal) - 1] = absb; if (minID >= 1.0E+6) { *errCode = 3389.0; /* d'Warning: Possible problem with simulated spectrum. No good matches found' */ } if (isScaled == 1.0) { i0 = finalScaleFactors->size[0]; i1 = (int32_T)(1.0 + (real_T)i); absb = scaleFac->size[0]; apnd = recID->size[0]; ndbl = (int32_T)(1.0 + (real_T)i); apnd = (int32_T)recID->data[emlrtDynamicBoundsCheckFastR2012b(ndbl, 1, apnd, &ac_emlrtBCI, emlrtRootTLSGlobal) - 1]; finalScaleFactors->data[emlrtDynamicBoundsCheckFastR2012b(i1, 1, i0, &xb_emlrtBCI, emlrtRootTLSGlobal) - 1] = scaleFac-> data[emlrtDynamicBoundsCheckFastR2012b(apnd, 1, absb, &yb_emlrtBCI, emlrtRootTLSGlobal) - 1]; } else { i0 = finalScaleFactors->size[0]; i1 = (int32_T)(1.0 + (real_T)i); finalScaleFactors->data[emlrtDynamicBoundsCheckFastR2012b(i1, 1, i0, &wb_emlrtBCI, emlrtRootTLSGlobal) - 1] = 1.0; } i0 = sampleSmall->size[0]; i1 = (int32_T)(1.0 + (real_T)i); emlrtDynamicBoundsCheckFastR2012b(i1, 1, i0, &j_emlrtBCI, emlrtRootTLSGlobal); loop_ub = sampleSmall->size[1]; i0 = r6->size[0]; r6->size[0] = loop_ub; emxEnsureCapacity((emxArray__common *)r6, i0, (int32_T)sizeof(int32_T), &emlrtRTEI); for (i0 = 0; i0 < loop_ub; i0++) { r6->data[i0] = i0; } emlrtPushRtStackR2012b(&mb_emlrtRSI, emlrtRootTLSGlobal); loop_ub = sampleBig->size[1]; i0 = sampleBig->size[0]; i1 = recID->size[0]; absb = (int32_T)(1.0 + (real_T)i); i1 = (int32_T)recID->data[emlrtDynamicBoundsCheckFastR2012b(absb, 1, i1, &bc_emlrtBCI, emlrtRootTLSGlobal) - 1]; ndbl = emlrtDynamicBoundsCheckFastR2012b(i1, 1, i0, &n_emlrtBCI, emlrtRootTLSGlobal); i0 = PerTgt_tmp->size[0] * PerTgt_tmp->size[1]; PerTgt_tmp->size[0] = 1; PerTgt_tmp->size[1] = loop_ub; emxEnsureCapacity((emxArray__common *)PerTgt_tmp, i0, (int32_T)sizeof (real_T), &emlrtRTEI); for (i0 = 0; i0 < loop_ub; i0++) { PerTgt_tmp->data[PerTgt_tmp->size[0] * i0] = sampleBig->data[(ndbl + sampleBig->size[0] * i0) - 1]; } b_exp(PerTgt_tmp); i0 = scaleFac->size[0]; i1 = recID->size[0]; absb = (int32_T)(1.0 + (real_T)i); i1 = (int32_T)recID->data[emlrtDynamicBoundsCheckFastR2012b(absb, 1, i1, &cc_emlrtBCI, emlrtRootTLSGlobal) - 1]; emlrtDynamicBoundsCheckFastR2012b(i1, 1, i0, &m_emlrtBCI, emlrtRootTLSGlobal); i0 = PerTgt_tmp->size[0] * PerTgt_tmp->size[1]; PerTgt_tmp->size[0] = 1; emxEnsureCapacity((emxArray__common *)PerTgt_tmp, i0, (int32_T)sizeof (real_T), &emlrtRTEI); ndbl = PerTgt_tmp->size[0]; cdiff = PerTgt_tmp->size[1]; minID = scaleFac->data[(int32_T)recID->data[(int32_T)(1.0 + (real_T)i) - 1] - 1]; loop_ub = ndbl * cdiff; for (i0 = 0; i0 < loop_ub; i0++) { PerTgt_tmp->data[i0] *= minID; } c_log(PerTgt_tmp); emlrtPopRtStackR2012b(&mb_emlrtRSI, emlrtRootTLSGlobal); iv17[0] = 1; iv17[1] = r6->size[0]; emlrtSubAssignSizeCheckR2012b(iv17, 2, *(int32_T (*)[2])PerTgt_tmp->size, 2, &m_emlrtECI, emlrtRootTLSGlobal); loop_ub = PerTgt_tmp->size[1]; for (i0 = 0; i0 < loop_ub; i0++) { sampleSmall->data[((int32_T)(1.0 + (real_T)i) + sampleSmall->size[0] * r6->data[i0]) - 1] = PerTgt_tmp->data [PerTgt_tmp->size[0] * i0]; } i++; emlrtBreakCheckFastR2012b(emlrtBreakCheckR2012bFlagVar, emlrtRootTLSGlobal); } emxFree_real_T(&c_tempf); emxFree_real_T(&c_sampleBig); emxFree_real_T(&b_tempf); emxFree_int32_T(&r14); emxFree_real_T(&r13); emxFree_boolean_T(&r12); emxFree_boolean_T(&c_F_x); emxFree_real_T(&r11); emxFree_real_T(&e_PerTgt_tmp); emxFree_real_T(&b_sampleBig); emxFree_boolean_T(&b_recID); b_emxInit_boolean_T(&c_recID, 1, &emlrtRTEI, TRUE); emlrtPushRtStackR2012b(&nb_emlrtRSI, emlrtRootTLSGlobal); i0 = c_recID->size[0]; c_recID->size[0] = recID->size[0]; emxEnsureCapacity((emxArray__common *)c_recID, i0, (int32_T)sizeof(boolean_T), &emlrtRTEI); loop_ub = recID->size[0]; for (i0 = 0; i0 < loop_ub; i0++) { c_recID->data[i0] = (recID->data[i0] == 1.0); } overflow = c_all(c_recID); emlrtPopRtStackR2012b(&nb_emlrtRSI, emlrtRootTLSGlobal); emxFree_boolean_T(&c_recID); emxInit_real_T(&b_idRef, 1, &emlrtRTEI, TRUE); b_emxInit_boolean_T(&d_recID, 1, &emlrtRTEI, TRUE); b_emxInit_real_T(&r15, 2, &emlrtRTEI, TRUE); b_emxInit_real_T(&r16, 2, &emlrtRTEI, TRUE); b_emxInit_real_T(&r17, 2, &emlrtRTEI, TRUE); emxInit_boolean_T(&d_F_x, 2, &emlrtRTEI, TRUE); emxInit_boolean_T(&r18, 2, &emlrtRTEI, TRUE); emxInit_boolean_T(&r19, 2, &emlrtRTEI, TRUE); b_emxInit_boolean_T(&b_recPer, 1, &emlrtRTEI, TRUE); b_emxInit_real_T(&r20, 2, &emlrtRTEI, TRUE); b_emxInit_int32_T(&r21, 2, &emlrtRTEI, TRUE); b_emxInit_real_T(&b_SaKnown, 2, &emlrtRTEI, TRUE); b_emxInit_real_T(&b_sampleSmall, 2, &emlrtRTEI, TRUE); emxInit_real_T(&e_recID, 1, &emlrtRTEI, TRUE); b_emxInit_real_T(&c_sampleSmall, 2, &emlrtRTEI, TRUE); b_emxInit_real_T(&d_sampleSmall, 2, &emlrtRTEI, TRUE); b_emxInit_real_T(&e_sampleSmall, 2, &emlrtRTEI, TRUE); b_emxInit_real_T(&f_sampleSmall, 2, &emlrtRTEI, TRUE); b_guard1 = FALSE; if (overflow) { emlrtPushRtStackR2012b(&nb_emlrtRSI, emlrtRootTLSGlobal); i0 = b_recPer->size[0]; b_recPer->size[0] = recPer->size[0]; emxEnsureCapacity((emxArray__common *)b_recPer, i0, (int32_T)sizeof (boolean_T), &emlrtRTEI); loop_ub = recPer->size[0]; for (i0 = 0; i0 < loop_ub; i0++) { b_recPer->data[i0] = (recPer->data[i0] == 1.0E+6); } overflow = c_all(b_recPer); emlrtPopRtStackR2012b(&nb_emlrtRSI, emlrtRootTLSGlobal); if (overflow) { *errCode = 3391.0; /* 'Error: no match spectra found' */ i0 = finalRecords->size[0]; finalRecords->size[0] = 1; emxEnsureCapacity((emxArray__common *)finalRecords, i0, (int32_T)sizeof (real_T), &emlrtRTEI); finalRecords->data[0] = 0.0; i0 = finalScaleFactors->size[0]; finalScaleFactors->size[0] = 1; emxEnsureCapacity((emxArray__common *)finalScaleFactors, i0, (int32_T) sizeof(real_T), &emlrtRTEI); finalScaleFactors->data[0] = 0.0; i0 = F_x->size[0] * F_x->size[1]; F_x->size[0] = 1; F_x->size[1] = 1; emxEnsureCapacity((emxArray__common *)F_x, i0, (int32_T)sizeof(real_T), &emlrtRTEI); F_x->data[0] = 0.0; i0 = F1_y1->size[0] * F1_y1->size[1]; F1_y1->size[0] = 1; F1_y1->size[1] = 1; emxEnsureCapacity((emxArray__common *)F1_y1, i0, (int32_T)sizeof(real_T), &emlrtRTEI); F1_y1->data[0] = 0.0; i0 = F1_y2->size[0] * F1_y2->size[1]; F1_y2->size[0] = 1; F1_y2->size[1] = 1; emxEnsureCapacity((emxArray__common *)F1_y2, i0, (int32_T)sizeof(real_T), &emlrtRTEI); F1_y2->data[0] = 0.0; i0 = F1_y3->size[0] * F1_y3->size[1]; F1_y3->size[0] = 1; F1_y3->size[1] = 1; emxEnsureCapacity((emxArray__common *)F1_y3, i0, (int32_T)sizeof(real_T), &emlrtRTEI); F1_y3->data[0] = 0.0; i0 = F1_yn->size[0] * F1_yn->size[1]; F1_yn->size[0] = 1; F1_yn->size[1] = 1; emxEnsureCapacity((emxArray__common *)F1_yn, i0, (int32_T)sizeof(real_T), &emlrtRTEI); F1_yn->data[0] = 0.0; i0 = F2_y1->size[0] * F2_y1->size[1]; F2_y1->size[0] = 1; F2_y1->size[1] = 1; emxEnsureCapacity((emxArray__common *)F2_y1, i0, (int32_T)sizeof(real_T), &emlrtRTEI); F2_y1->data[0] = 0.0; i0 = F3_y1->size[0] * F3_y1->size[1]; F3_y1->size[0] = 1; F3_y1->size[1] = 1; emxEnsureCapacity((emxArray__common *)F3_y1, i0, (int32_T)sizeof(real_T), &emlrtRTEI); F3_y1->data[0] = 0.0; i0 = F3_y2->size[0] * F3_y2->size[1]; F3_y2->size[0] = 1; F3_y2->size[1] = 1; emxEnsureCapacity((emxArray__common *)F3_y2, i0, (int32_T)sizeof(real_T), &emlrtRTEI); F3_y2->data[0] = 0.0; i0 = F4_y1->size[0] * F4_y1->size[1]; F4_y1->size[0] = 1; F4_y1->size[1] = 1; emxEnsureCapacity((emxArray__common *)F4_y1, i0, (int32_T)sizeof(real_T), &emlrtRTEI); F4_y1->data[0] = 0.0; i0 = F5_y1->size[0] * F5_y1->size[1]; F5_y1->size[0] = 1; F5_y1->size[1] = 1; emxEnsureCapacity((emxArray__common *)F5_y1, i0, (int32_T)sizeof(real_T), &emlrtRTEI); F5_y1->data[0] = 0.0; i0 = F6_y1->size[0] * F6_y1->size[1]; F6_y1->size[0] = 1; F6_y1->size[1] = 1; emxEnsureCapacity((emxArray__common *)F6_y1, i0, (int32_T)sizeof(real_T), &emlrtRTEI); F6_y1->data[0] = 0.0; i0 = F7_y1->size[0] * F7_y1->size[1]; F7_y1->size[0] = 1; F7_y1->size[1] = 1; emxEnsureCapacity((emxArray__common *)F7_y1, i0, (int32_T)sizeof(real_T), &emlrtRTEI); F7_y1->data[0] = 0.0; } else { b_guard1 = TRUE; } } else { b_guard1 = TRUE; } if (b_guard1 == TRUE) { /* % Greedy subset modification procedure */ /* display('Please wait...This algorithm takes a few minutes depending on the number of records to be selected'); */ minID = rtNaN; emlrtForLoopVectorCheckR2012b(1.0, 1.0, nLoop, mxDOUBLE_CLASS, (int32_T) nLoop, &be_emlrtRTEI, emlrtRootTLSGlobal); k = 0; while (k <= (int32_T)nLoop - 1) { /* Number of passes */ emlrtForLoopVectorCheckR2012b(1.0, 1.0, nGM, mxDOUBLE_CLASS, (int32_T) nGM, &ae_emlrtRTEI, emlrtRootTLSGlobal); i = 0; while (i <= (int32_T)nGM - 1) { /* Selects nSelect ground motions */ /* compileReplacePercent */ /* display([num2str(round(((k-1)*nGM + i-1)/(nLoop*nGM)*100)) '% done']); */ minDev = 100000.0; emlrtPushRtStackR2012b(&rb_emlrtRSI, emlrtRootTLSGlobal); b_eml_null_assignment(sampleSmall, 1.0 + (real_T)i); emlrtPopRtStackR2012b(&rb_emlrtRSI, emlrtRootTLSGlobal); emlrtPushRtStackR2012b(&ob_emlrtRSI, emlrtRootTLSGlobal); eml_null_assignment(recID, 1.0 + (real_T)i); emlrtPopRtStackR2012b(&ob_emlrtRSI, emlrtRootTLSGlobal); /* Try to add a new spectra to the subset list */ i0 = scaleFac->size[0]; scaleFac->size[0] = sampleBig->size[0]; emxEnsureCapacity((emxArray__common *)scaleFac, i0, (int32_T)sizeof (real_T), &emlrtRTEI); loop_ub = sampleBig->size[0]; for (i0 = 0; i0 < loop_ub; i0++) { scaleFac->data[i0] = 0.0; } j = 0; while (j <= sampleBig->size[0] - 1) { if (isScaled == 1.0) { emlrtPushRtStackR2012b(&pb_emlrtRSI, emlrtRootTLSGlobal); i0 = r20->size[0] * r20->size[1]; r20->size[0] = 1; r20->size[1] = posT1->size[1]; emxEnsureCapacity((emxArray__common *)r20, i0, (int32_T)sizeof (real_T), &emlrtRTEI); loop_ub = posT1->size[0] * posT1->size[1]; for (i0 = 0; i0 < loop_ub; i0++) { i1 = sampleBig->size[1]; absb = (int32_T)posT1->data[i0]; r20->data[i0] = emlrtDynamicBoundsCheckFastR2012b(absb, 1, i1, &ob_emlrtBCI, emlrtRootTLSGlobal); } ndbl = r20->size[1]; i0 = sampleBig->size[0]; i1 = (int32_T)(1.0 + (real_T)j); i0 = emlrtDynamicBoundsCheckFastR2012b(i1, 1, i0, &l_emlrtBCI, emlrtRootTLSGlobal); i1 = r1->size[0] * r1->size[1]; r1->size[0] = 1; r1->size[1] = ndbl; emxEnsureCapacity((emxArray__common *)r1, i1, (int32_T)sizeof (real_T), &emlrtRTEI); for (i1 = 0; i1 < ndbl; i1++) { r1->data[r1->size[0] * i1] = sampleBig->data[(i0 + sampleBig->size[0] * ((int32_T)r20->data[i1] - 1)) - 1]; } b_exp(r1); i0 = r18->size[0] * r18->size[1]; r18->size[0] = 1; r18->size[1] = r1->size[1]; emxEnsureCapacity((emxArray__common *)r18, i0, (int32_T)sizeof (boolean_T), &emlrtRTEI); loop_ub = r1->size[0] * r1->size[1]; for (i0 = 0; i0 < loop_ub; i0++) { r18->data[i0] = (r1->data[i0] == 0.0); } overflow = b_all(r18); emlrtPopRtStackR2012b(&pb_emlrtRSI, emlrtRootTLSGlobal); if (overflow) { i0 = scaleFac->size[0]; i1 = (int32_T)(1.0 + (real_T)j); scaleFac->data[emlrtDynamicBoundsCheckFastR2012b(i1, 1, i0, &rb_emlrtBCI, emlrtRootTLSGlobal) - 1] = 1.0E+6; } else { emlrtPushRtStackR2012b(&qb_emlrtRSI, emlrtRootTLSGlobal); i0 = r1->size[0] * r1->size[1]; r1->size[0] = 1; r1->size[1] = lnSa1->size[1]; emxEnsureCapacity((emxArray__common *)r1, i0, (int32_T)sizeof (real_T), &emlrtRTEI); loop_ub = lnSa1->size[0] * lnSa1->size[1]; for (i0 = 0; i0 < loop_ub; i0++) { r1->data[i0] = lnSa1->data[i0]; } b_exp(r1); i0 = d_F_x->size[0] * d_F_x->size[1]; d_F_x->size[0] = 1; d_F_x->size[1] = F_x->size[1]; emxEnsureCapacity((emxArray__common *)d_F_x, i0, (int32_T)sizeof (boolean_T), &emlrtRTEI); loop_ub = F_x->size[0] * F_x->size[1]; for (i0 = 0; i0 < loop_ub; i0++) { d_F_x->data[i0] = (F_x->data[i0] == T1); } eml_li_find(d_F_x, ii); i0 = r21->size[0] * r21->size[1]; r21->size[0] = 1; r21->size[1] = ii->size[1]; emxEnsureCapacity((emxArray__common *)r21, i0, (int32_T)sizeof (int32_T), &emlrtRTEI); loop_ub = ii->size[0] * ii->size[1]; for (i0 = 0; i0 < loop_ub; i0++) { i1 = sampleBig->size[1]; absb = ii->data[i0]; r21->data[i0] = emlrtDynamicBoundsCheckFastR2012b(absb, 1, i1, &pb_emlrtBCI, emlrtRootTLSGlobal); } ndbl = r21->size[1]; i0 = sampleBig->size[0]; i1 = (int32_T)(1.0 + (real_T)j); i0 = emlrtDynamicBoundsCheckFastR2012b(i1, 1, i0, &k_emlrtBCI, emlrtRootTLSGlobal); i1 = r2->size[0] * r2->size[1]; r2->size[0] = 1; r2->size[1] = ndbl; emxEnsureCapacity((emxArray__common *)r2, i1, (int32_T)sizeof (real_T), &emlrtRTEI); for (i1 = 0; i1 < ndbl; i1++) { r2->data[r2->size[0] * i1] = sampleBig->data[(i0 + sampleBig->size[0] * (r21->data[i1] - 1)) - 1]; } b_exp(r2); i0 = r17->size[0] * r17->size[1]; r17->size[0] = 1; r17->size[1] = r1->size[1]; emxEnsureCapacity((emxArray__common *)r17, i0, (int32_T)sizeof (real_T), &emlrtRTEI); loop_ub = r1->size[0] * r1->size[1]; for (i0 = 0; i0 < loop_ub; i0++) { r17->data[i0] = r1->data[i0]; } mrdivide(r17, r2, r1); emlrtPopRtStackR2012b(&qb_emlrtRSI, emlrtRootTLSGlobal); i0 = r1->size[1]; emlrtSizeEqCheck1DFastR2012b(1, i0, &l_emlrtECI, emlrtRootTLSGlobal); i0 = scaleFac->size[0]; i1 = (int32_T)(1.0 + (real_T)j); scaleFac->data[emlrtDynamicBoundsCheckFastR2012b(i1, 1, i0, &qb_emlrtBCI, emlrtRootTLSGlobal) - 1] = r1->data[0]; } i0 = sampleBig->size[0]; i1 = (int32_T)(1.0 + (real_T)j); emlrtDynamicBoundsCheckFastR2012b(i1, 1, i0, &i_emlrtBCI, emlrtRootTLSGlobal); i0 = sampleBig->size[1]; i1 = sampleSmall->size[1]; emlrtDimSizeEqCheckFastR2012b(i1, i0, &k_emlrtECI, emlrtRootTLSGlobal); emlrtPushRtStackR2012b(&sb_emlrtRSI, emlrtRootTLSGlobal); i0 = scaleFac->size[0]; i1 = (int32_T)(1.0 + (real_T)j); b = scaleFac->data[emlrtDynamicBoundsCheckFastR2012b(i1, 1, i0, &sb_emlrtBCI, emlrtRootTLSGlobal) - 1]; b_log(&b); loop_ub = sampleBig->size[1] - 1; i0 = d_sampleSmall->size[0] * d_sampleSmall->size[1]; d_sampleSmall->size[0] = sampleSmall->size[0] + 1; d_sampleSmall->size[1] = sampleSmall->size[1]; emxEnsureCapacity((emxArray__common *)d_sampleSmall, i0, (int32_T) sizeof(real_T), &emlrtRTEI); b_loop_ub = sampleSmall->size[1]; for (i0 = 0; i0 < b_loop_ub; i0++) { ndbl = sampleSmall->size[0]; for (i1 = 0; i1 < ndbl; i1++) { d_sampleSmall->data[i1 + d_sampleSmall->size[0] * i0] = sampleSmall->data[i1 + sampleSmall->size[0] * i0]; } } for (i0 = 0; i0 <= loop_ub; i0++) { d_sampleSmall->data[sampleSmall->size[0] + d_sampleSmall->size[0] * i0] = sampleBig->data[((int32_T)(1.0 + (real_T)j) + sampleBig->size[0] * i0) - 1] + b; } i0 = sampleSmall->size[0] * sampleSmall->size[1]; sampleSmall->size[0] = d_sampleSmall->size[0]; sampleSmall->size[1] = d_sampleSmall->size[1]; emxEnsureCapacity((emxArray__common *)sampleSmall, i0, (int32_T) sizeof(real_T), &emlrtRTEI); loop_ub = d_sampleSmall->size[1]; for (i0 = 0; i0 < loop_ub; i0++) { b_loop_ub = d_sampleSmall->size[0]; for (i1 = 0; i1 < b_loop_ub; i1++) { sampleSmall->data[i1 + sampleSmall->size[0] * i0] = d_sampleSmall->data[i1 + d_sampleSmall->size[0] * i0]; } } emlrtPopRtStackR2012b(&sb_emlrtRSI, emlrtRootTLSGlobal); } else { i0 = sampleBig->size[0]; i1 = (int32_T)(1.0 + (real_T)j); emlrtDynamicBoundsCheckFastR2012b(i1, 1, i0, &h_emlrtBCI, emlrtRootTLSGlobal); i0 = sampleBig->size[1]; i1 = sampleSmall->size[1]; emlrtDimSizeEqCheckFastR2012b(i1, i0, &j_emlrtECI, emlrtRootTLSGlobal); loop_ub = sampleBig->size[1] - 1; i0 = c_sampleSmall->size[0] * c_sampleSmall->size[1]; c_sampleSmall->size[0] = sampleSmall->size[0] + 1; c_sampleSmall->size[1] = sampleSmall->size[1]; emxEnsureCapacity((emxArray__common *)c_sampleSmall, i0, (int32_T) sizeof(real_T), &emlrtRTEI); b_loop_ub = sampleSmall->size[1]; for (i0 = 0; i0 < b_loop_ub; i0++) { ndbl = sampleSmall->size[0]; for (i1 = 0; i1 < ndbl; i1++) { c_sampleSmall->data[i1 + c_sampleSmall->size[0] * i0] = sampleSmall->data[i1 + sampleSmall->size[0] * i0]; } } for (i0 = 0; i0 <= loop_ub; i0++) { c_sampleSmall->data[sampleSmall->size[0] + c_sampleSmall->size[0] * i0] = sampleBig->data[((int32_T)(1.0 + (real_T)j) + sampleBig->size[0] * i0) - 1]; } i0 = sampleSmall->size[0] * sampleSmall->size[1]; sampleSmall->size[0] = c_sampleSmall->size[0]; sampleSmall->size[1] = c_sampleSmall->size[1]; emxEnsureCapacity((emxArray__common *)sampleSmall, i0, (int32_T) sizeof(real_T), &emlrtRTEI); loop_ub = c_sampleSmall->size[1]; for (i0 = 0; i0 < loop_ub; i0++) { b_loop_ub = c_sampleSmall->size[0]; for (i1 = 0; i1 < b_loop_ub; i1++) { sampleSmall->data[i1 + sampleSmall->size[0] * i0] = c_sampleSmall->data[i1 + c_sampleSmall->size[0] * i0]; } } i0 = scaleFac->size[0]; i1 = (int32_T)(1.0 + (real_T)j); scaleFac->data[emlrtDynamicBoundsCheckFastR2012b(i1, 1, i0, &nb_emlrtBCI, emlrtRootTLSGlobal) - 1] = 1.0; } /* Compute deviations from target */ emlrtPushRtStackR2012b(&tb_emlrtRSI, emlrtRootTLSGlobal); mean(sampleSmall, r1); emlrtPopRtStackR2012b(&tb_emlrtRSI, emlrtRootTLSGlobal); for (i0 = 0; i0 < 2; i0++) { iv0[i0] = r1->size[i0]; } for (i0 = 0; i0 < 2; i0++) { b_rho[i0] = sa->size[i0]; } emlrtSizeEqCheck2DFastR2012b(iv0, b_rho, &i_emlrtECI, emlrtRootTLSGlobal); emlrtPushRtStackR2012b(&ub_emlrtRSI, emlrtRootTLSGlobal); skew(sampleSmall, f_sampleSmall); emlrtPopRtStackR2012b(&ub_emlrtRSI, emlrtRootTLSGlobal); emlrtPushRtStackR2012b(&vb_emlrtRSI, emlrtRootTLSGlobal); b_std(sampleSmall, r2); emlrtPopRtStackR2012b(&vb_emlrtRSI, emlrtRootTLSGlobal); emlrtPushRtStackR2012b(&vb_emlrtRSI, emlrtRootTLSGlobal); diag(covReq, r7); d_sqrt(r7); i0 = d_b->size[0] * d_b->size[1]; d_b->size[0] = r7->size[1]; d_b->size[1] = r7->size[0]; emxEnsureCapacity((emxArray__common *)d_b, i0, (int32_T)sizeof (real_T), &emlrtRTEI); loop_ub = r7->size[0]; for (i0 = 0; i0 < loop_ub; i0++) { b_loop_ub = r7->size[1]; for (i1 = 0; i1 < b_loop_ub; i1++) { d_b->data[i1 + d_b->size[0] * i0] = r7->data[i0 + r7->size[0] * i1]; } } emlrtPopRtStackR2012b(&vb_emlrtRSI, emlrtRootTLSGlobal); for (i0 = 0; i0 < 2; i0++) { iv0[i0] = r2->size[i0]; } for (i0 = 0; i0 < 2; i0++) { e_b[i0] = d_b->size[i0]; } emlrtSizeEqCheck2DFastR2012b(iv0, e_b, &h_emlrtECI, emlrtRootTLSGlobal); /* devTotal = weights(1) * sum(devMean.^2) + weights(2) * sum(devSig.^2)+ weights(3) * sum(devSkew.^2); */ emlrtPushRtStackR2012b(&wb_emlrtRSI, emlrtRootTLSGlobal); i0 = r16->size[0] * r16->size[1]; r16->size[0] = 1; r16->size[1] = r1->size[1]; emxEnsureCapacity((emxArray__common *)r16, i0, (int32_T)sizeof (real_T), &emlrtRTEI); loop_ub = r1->size[0] * r1->size[1]; for (i0 = 0; i0 < loop_ub; i0++) { r16->data[i0] = r1->data[i0] - sa->data[i0]; } b_power(r16, r1); b = b_sum(r1); i0 = r15->size[0] * r15->size[1]; r15->size[0] = 1; r15->size[1] = r2->size[1]; emxEnsureCapacity((emxArray__common *)r15, i0, (int32_T)sizeof (real_T), &emlrtRTEI); loop_ub = r2->size[0] * r2->size[1]; for (i0 = 0; i0 < loop_ub; i0++) { r15->data[i0] = r2->data[i0] - d_b->data[i0]; } power(r15, r7); c_sum(r7, devTotal_data, devTotal_size); devTotal_data[0] = weight_mean * b + weight_sd * devTotal_data[0]; emlrtPopRtStackR2012b(&wb_emlrtRSI, emlrtRootTLSGlobal); /* Penalize bad spectra (set penalty to zero if this is not required) */ absb = 0; while (absb <= sampleSmall->size[0] - 1) { emlrtPushRtStackR2012b(&xb_emlrtRSI, emlrtRootTLSGlobal); diag(covReq, r7); d_sqrt(r7); i0 = d_b->size[0] * d_b->size[1]; d_b->size[0] = r7->size[1]; d_b->size[1] = r7->size[0]; emxEnsureCapacity((emxArray__common *)d_b, i0, (int32_T)sizeof (real_T), &emlrtRTEI); loop_ub = r7->size[0]; for (i0 = 0; i0 < loop_ub; i0++) { b_loop_ub = r7->size[1]; for (i1 = 0; i1 < b_loop_ub; i1++) { d_b->data[i1 + d_b->size[0] * i0] = r7->data[i0 + r7->size[0] * i1]; } } i0 = d_b->size[0] * d_b->size[1]; emxEnsureCapacity((emxArray__common *)d_b, i0, (int32_T)sizeof (real_T), &emlrtRTEI); ndbl = d_b->size[0]; cdiff = d_b->size[1]; loop_ub = ndbl * cdiff; for (i0 = 0; i0 < loop_ub; i0++) { d_b->data[i0] *= 3.0; } emlrtPopRtStackR2012b(&xb_emlrtRSI, emlrtRootTLSGlobal); for (i0 = 0; i0 < 2; i0++) { b_rho[i0] = sa->size[i0]; } for (i0 = 0; i0 < 2; i0++) { e_b[i0] = d_b->size[i0]; } emlrtSizeEqCheck2DFastR2012b(b_rho, e_b, &g_emlrtECI, emlrtRootTLSGlobal); loop_ub = sampleSmall->size[1]; i0 = sampleSmall->size[0]; ndbl = emlrtDynamicBoundsCheckFastR2012b(absb + 1, 1, i0, &g_emlrtBCI, emlrtRootTLSGlobal); i0 = r1->size[0] * r1->size[1]; r1->size[0] = 1; r1->size[1] = loop_ub; emxEnsureCapacity((emxArray__common *)r1, i0, (int32_T)sizeof (real_T), &emlrtRTEI); for (i0 = 0; i0 < loop_ub; i0++) { r1->data[r1->size[0] * i0] = sampleSmall->data[(ndbl + sampleSmall->size[0] * i0) - 1]; } b_exp(r1); i0 = d_b->size[0] * d_b->size[1]; d_b->size[0] = 1; d_b->size[1] = sa->size[1]; emxEnsureCapacity((emxArray__common *)d_b, i0, (int32_T)sizeof (real_T), &emlrtRTEI); loop_ub = sa->size[0] * sa->size[1]; for (i0 = 0; i0 < loop_ub; i0++) { d_b->data[i0] += sa->data[i0]; } c_exp(d_b); i0 = r2->size[0] * r2->size[1]; r2->size[0] = d_b->size[0]; r2->size[1] = d_b->size[1]; emxEnsureCapacity((emxArray__common *)r2, i0, (int32_T)sizeof (real_T), &emlrtRTEI); loop_ub = d_b->size[0] * d_b->size[1]; for (i0 = 0; i0 < loop_ub; i0++) { r2->data[i0] = d_b->data[i0]; } for (i0 = 0; i0 < 2; i0++) { iv0[i0] = r1->size[i0]; } for (i0 = 0; i0 < 2; i0++) { iv17[i0] = r2->size[i0]; } emlrtSizeEqCheck2DFastR2012b(iv0, iv17, &f_emlrtECI, emlrtRootTLSGlobal); emlrtPushRtStackR2012b(&xb_emlrtRSI, emlrtRootTLSGlobal); i0 = r19->size[0] * r19->size[1]; r19->size[0] = 1; r19->size[1] = r1->size[1]; emxEnsureCapacity((emxArray__common *)r19, i0, (int32_T)sizeof (boolean_T), &emlrtRTEI); loop_ub = r1->size[0] * r1->size[1]; for (i0 = 0; i0 < loop_ub; i0++) { r19->data[i0] = (r1->data[i0] > r2->data[i0]); } e_abs(r19, r1); c_sum(r1, a_data, devTotal_size); emlrtPopRtStackR2012b(&xb_emlrtRSI, emlrtRootTLSGlobal); devTotal_data[0] += a_data[0] * penalty; absb++; emlrtBreakCheckFastR2012b(emlrtBreakCheckR2012bFlagVar, emlrtRootTLSGlobal); } i0 = scaleFac->size[0]; i1 = (int32_T)(1.0 + (real_T)j); b_guard2 = FALSE; if (scaleFac->data[emlrtDynamicBoundsCheckFastR2012b(i1, 1, i0, &tb_emlrtBCI, emlrtRootTLSGlobal) - 1] > maxScale) { b_guard2 = TRUE; } else { i0 = soil_Vs30->size[0]; i1 = (int32_T)(1.0 + (real_T)j); if (soil_Vs30->data[emlrtDynamicBoundsCheckFastR2012b(i1, 1, i0, &ub_emlrtBCI, emlrtRootTLSGlobal) - 1] == -1.0) { b_guard2 = TRUE; } } if (b_guard2 == TRUE) { devTotal_data[0] += 1.0E+6; } /* Should cause improvement and record should not be repeated */ emlrtPushRtStackR2012b(&yb_emlrtRSI, emlrtRootTLSGlobal); b_devTotal_size[0] = 1; b_devTotal_data[0] = (devTotal_data[0] < minDev); c_devTotal_data.data = (boolean_T *)&b_devTotal_data; c_devTotal_data.size = (int32_T *)&b_devTotal_size; c_devTotal_data.allocatedSize = 1; c_devTotal_data.numDimensions = 1; c_devTotal_data.canFreeData = FALSE; overflow = c_all(&c_devTotal_data); emlrtPopRtStackR2012b(&yb_emlrtRSI, emlrtRootTLSGlobal); if (overflow) { emlrtPushRtStackR2012b(&yb_emlrtRSI, emlrtRootTLSGlobal); i0 = d_recID->size[0]; d_recID->size[0] = recID->size[0]; emxEnsureCapacity((emxArray__common *)d_recID, i0, (int32_T)sizeof (boolean_T), &emlrtRTEI); loop_ub = recID->size[0]; for (i0 = 0; i0 < loop_ub; i0++) { d_recID->data[i0] = (recID->data[i0] == 1.0 + (real_T)j); } overflow = !c_any(d_recID); emlrtPopRtStackR2012b(&yb_emlrtRSI, emlrtRootTLSGlobal); if (overflow) { minID = 1.0 + (real_T)j; minDev = devTotal_data[0]; } } if (1 > sampleSmall->size[0] - 1) { loop_ub = 0; } else { i0 = sampleSmall->size[0]; i1 = sampleSmall->size[0] - 1; loop_ub = emlrtDynamicBoundsCheckFastR2012b(i1, 1, i0, &f_emlrtBCI, emlrtRootTLSGlobal); } cdiff = sampleSmall->size[1]; i0 = e_sampleSmall->size[0] * e_sampleSmall->size[1]; e_sampleSmall->size[0] = loop_ub; e_sampleSmall->size[1] = cdiff; emxEnsureCapacity((emxArray__common *)e_sampleSmall, i0, (int32_T) sizeof(real_T), &emlrtRTEI); for (i0 = 0; i0 < cdiff; i0++) { for (i1 = 0; i1 < loop_ub; i1++) { e_sampleSmall->data[i1 + e_sampleSmall->size[0] * i0] = sampleSmall->data[i1 + sampleSmall->size[0] * i0]; } } i0 = sampleSmall->size[0] * sampleSmall->size[1]; sampleSmall->size[0] = e_sampleSmall->size[0]; sampleSmall->size[1] = e_sampleSmall->size[1]; emxEnsureCapacity((emxArray__common *)sampleSmall, i0, (int32_T) sizeof(real_T), &emlrtRTEI); loop_ub = e_sampleSmall->size[1]; for (i0 = 0; i0 < loop_ub; i0++) { b_loop_ub = e_sampleSmall->size[0]; for (i1 = 0; i1 < b_loop_ub; i1++) { sampleSmall->data[i1 + sampleSmall->size[0] * i0] = e_sampleSmall->data[i1 + e_sampleSmall->size[0] * i0]; } } j++; emlrtBreakCheckFastR2012b(emlrtBreakCheckR2012bFlagVar, emlrtRootTLSGlobal); } if (!muDoubleScalarIsNaN(minID)) { /* Add new element in the right slot */ if (isScaled == 1.0) { i0 = finalScaleFactors->size[0]; i1 = (int32_T)(1.0 + (real_T)i); absb = scaleFac->size[0]; apnd = (int32_T)emlrtIntegerCheckFastR2012b(minID, &g_emlrtDCI, emlrtRootTLSGlobal); finalScaleFactors->data[emlrtDynamicBoundsCheckFastR2012b(i1, 1, i0, &kb_emlrtBCI, emlrtRootTLSGlobal) - 1] = scaleFac-> data[emlrtDynamicBoundsCheckFastR2012b(apnd, 1, absb, &lb_emlrtBCI, emlrtRootTLSGlobal) - 1]; } else { i0 = finalScaleFactors->size[0]; i1 = (int32_T)(1.0 + (real_T)i); finalScaleFactors->data[emlrtDynamicBoundsCheckFastR2012b(i1, 1, i0, &jb_emlrtBCI, emlrtRootTLSGlobal) - 1] = 1.0; } if (1.0 > (1.0 + (real_T)i) - 1.0) { loop_ub = 0; } else { i0 = sampleSmall->size[0]; emlrtDynamicBoundsCheckFastR2012b(1, 1, i0, &e_emlrtBCI, emlrtRootTLSGlobal); i0 = sampleSmall->size[0]; i1 = (int32_T)((1.0 + (real_T)i) - 1.0); loop_ub = emlrtDynamicBoundsCheckFastR2012b(i1, 1, i0, &e_emlrtBCI, emlrtRootTLSGlobal); } if (1.0 + (real_T)i > sampleSmall->size[0]) { i0 = 1; i1 = 0; } else { i0 = sampleSmall->size[0]; i1 = (int32_T)(1.0 + (real_T)i); i0 = emlrtDynamicBoundsCheckFastR2012b(i1, 1, i0, &c_emlrtBCI, emlrtRootTLSGlobal); i1 = sampleSmall->size[0]; absb = sampleSmall->size[0]; i1 = emlrtDynamicBoundsCheckFastR2012b(absb, 1, i1, &c_emlrtBCI, emlrtRootTLSGlobal); } absb = sampleBig->size[0]; apnd = (int32_T)emlrtIntegerCheckFastR2012b(minID, &emlrtDCI, emlrtRootTLSGlobal); emlrtDynamicBoundsCheckFastR2012b(apnd, 1, absb, &d_emlrtBCI, emlrtRootTLSGlobal); absb = sampleSmall->size[1]; apnd = sampleBig->size[1]; emlrtDimSizeEqCheckFastR2012b(absb, apnd, &e_emlrtECI, emlrtRootTLSGlobal); absb = sampleSmall->size[1]; apnd = sampleSmall->size[1]; emlrtDimSizeEqCheckFastR2012b(absb, apnd, &e_emlrtECI, emlrtRootTLSGlobal); emlrtPushRtStackR2012b(&ac_emlrtRSI, emlrtRootTLSGlobal); absb = scaleFac->size[0]; apnd = (int32_T)minID; b = scaleFac->data[emlrtDynamicBoundsCheckFastR2012b(apnd, 1, absb, &mb_emlrtBCI, emlrtRootTLSGlobal) - 1]; b_log(&b); cdiff = sampleSmall->size[1]; b_loop_ub = sampleBig->size[1] - 1; ndbl = sampleSmall->size[1] - 1; absb = b_sampleSmall->size[0] * b_sampleSmall->size[1]; b_sampleSmall->size[0] = ((loop_ub + i1) - i0) + 2; b_sampleSmall->size[1] = cdiff; emxEnsureCapacity((emxArray__common *)b_sampleSmall, absb, (int32_T) sizeof(real_T), &emlrtRTEI); for (absb = 0; absb < cdiff; absb++) { for (apnd = 0; apnd < loop_ub; apnd++) { b_sampleSmall->data[apnd + b_sampleSmall->size[0] * absb] = sampleSmall->data[apnd + sampleSmall->size[0] * absb]; } } for (absb = 0; absb <= b_loop_ub; absb++) { b_sampleSmall->data[loop_ub + b_sampleSmall->size[0] * absb] = sampleBig->data[((int32_T)minID + sampleBig->size[0] * absb) - 1] + b; } for (absb = 0; absb <= ndbl; absb++) { b_loop_ub = i1 - i0; for (apnd = 0; apnd <= b_loop_ub; apnd++) { b_sampleSmall->data[((apnd + loop_ub) + b_sampleSmall->size[0] * absb) + 1] = sampleSmall->data[((i0 + apnd) + sampleSmall->size[0] * absb) - 1]; } } i0 = sampleSmall->size[0] * sampleSmall->size[1]; sampleSmall->size[0] = b_sampleSmall->size[0]; sampleSmall->size[1] = b_sampleSmall->size[1]; emxEnsureCapacity((emxArray__common *)sampleSmall, i0, (int32_T) sizeof(real_T), &emlrtRTEI); loop_ub = b_sampleSmall->size[1]; for (i0 = 0; i0 < loop_ub; i0++) { b_loop_ub = b_sampleSmall->size[0]; for (i1 = 0; i1 < b_loop_ub; i1++) { sampleSmall->data[i1 + sampleSmall->size[0] * i0] = b_sampleSmall->data[i1 + b_sampleSmall->size[0] * i0]; } } emlrtPopRtStackR2012b(&ac_emlrtRSI, emlrtRootTLSGlobal); if (1.0 > (1.0 + (real_T)i) - 1.0) { loop_ub = 0; } else { i0 = recID->size[0]; emlrtDynamicBoundsCheckFastR2012b(1, 1, i0, &b_emlrtBCI, emlrtRootTLSGlobal); i0 = recID->size[0]; i1 = (int32_T)((1.0 + (real_T)i) - 1.0); loop_ub = emlrtDynamicBoundsCheckFastR2012b(i1, 1, i0, &b_emlrtBCI, emlrtRootTLSGlobal); } emlrtVectorVectorIndexCheckR2012b(recID->size[0], 1, 1, loop_ub, &d_emlrtECI, emlrtRootTLSGlobal); if (1.0 + (real_T)i > recID->size[0]) { i0 = 0; i1 = 0; } else { i0 = recID->size[0]; i1 = (int32_T)(1.0 + (real_T)i); i0 = emlrtDynamicBoundsCheckFastR2012b(i1, 1, i0, &emlrtBCI, emlrtRootTLSGlobal) - 1; i1 = recID->size[0]; absb = recID->size[0]; i1 = emlrtDynamicBoundsCheckFastR2012b(absb, 1, i1, &emlrtBCI, emlrtRootTLSGlobal); } emlrtVectorVectorIndexCheckR2012b(recID->size[0], 1, 1, i1 - i0, &c_emlrtECI, emlrtRootTLSGlobal); absb = e_recID->size[0]; e_recID->size[0] = ((loop_ub + i1) - i0) + 1; emxEnsureCapacity((emxArray__common *)e_recID, absb, (int32_T)sizeof (real_T), &emlrtRTEI); for (absb = 0; absb < loop_ub; absb++) { e_recID->data[absb] = recID->data[absb]; } e_recID->data[loop_ub] = minID; b_loop_ub = i1 - i0; for (i1 = 0; i1 < b_loop_ub; i1++) { e_recID->data[(i1 + loop_ub) + 1] = recID->data[i0 + i1]; } i0 = recID->size[0]; recID->size[0] = e_recID->size[0]; emxEnsureCapacity((emxArray__common *)recID, i0, (int32_T)sizeof (real_T), &emlrtRTEI); loop_ub = e_recID->size[0]; for (i0 = 0; i0 < loop_ub; i0++) { recID->data[i0] = e_recID->data[i0]; } } i++; emlrtBreakCheckFastR2012b(emlrtBreakCheckR2012bFlagVar, emlrtRootTLSGlobal); } k++; emlrtBreakCheckFastR2012b(emlrtBreakCheckR2012bFlagVar, emlrtRootTLSGlobal); } /* display('100% done'); */ /* compileReplace100Percent */ if (recID->size[0] == 0) { *errCode = 3391.0; /* 'Error: no match spectra found' */ i0 = finalRecords->size[0]; finalRecords->size[0] = 1; emxEnsureCapacity((emxArray__common *)finalRecords, i0, (int32_T)sizeof (real_T), &emlrtRTEI); finalRecords->data[0] = 0.0; i0 = finalScaleFactors->size[0]; finalScaleFactors->size[0] = 1; emxEnsureCapacity((emxArray__common *)finalScaleFactors, i0, (int32_T) sizeof(real_T), &emlrtRTEI); finalScaleFactors->data[0] = 0.0; i0 = F_x->size[0] * F_x->size[1]; F_x->size[0] = 1; F_x->size[1] = 1; emxEnsureCapacity((emxArray__common *)F_x, i0, (int32_T)sizeof(real_T), &emlrtRTEI); F_x->data[0] = 0.0; i0 = F1_y1->size[0] * F1_y1->size[1]; F1_y1->size[0] = 1; F1_y1->size[1] = 1; emxEnsureCapacity((emxArray__common *)F1_y1, i0, (int32_T)sizeof(real_T), &emlrtRTEI); F1_y1->data[0] = 0.0; i0 = F1_y2->size[0] * F1_y2->size[1]; F1_y2->size[0] = 1; F1_y2->size[1] = 1; emxEnsureCapacity((emxArray__common *)F1_y2, i0, (int32_T)sizeof(real_T), &emlrtRTEI); F1_y2->data[0] = 0.0; i0 = F1_y3->size[0] * F1_y3->size[1]; F1_y3->size[0] = 1; F1_y3->size[1] = 1; emxEnsureCapacity((emxArray__common *)F1_y3, i0, (int32_T)sizeof(real_T), &emlrtRTEI); F1_y3->data[0] = 0.0; i0 = F1_yn->size[0] * F1_yn->size[1]; F1_yn->size[0] = 1; F1_yn->size[1] = 1; emxEnsureCapacity((emxArray__common *)F1_yn, i0, (int32_T)sizeof(real_T), &emlrtRTEI); F1_yn->data[0] = 0.0; i0 = F2_y1->size[0] * F2_y1->size[1]; F2_y1->size[0] = 1; F2_y1->size[1] = 1; emxEnsureCapacity((emxArray__common *)F2_y1, i0, (int32_T)sizeof(real_T), &emlrtRTEI); F2_y1->data[0] = 0.0; i0 = F3_y1->size[0] * F3_y1->size[1]; F3_y1->size[0] = 1; F3_y1->size[1] = 1; emxEnsureCapacity((emxArray__common *)F3_y1, i0, (int32_T)sizeof(real_T), &emlrtRTEI); F3_y1->data[0] = 0.0; i0 = F3_y2->size[0] * F3_y2->size[1]; F3_y2->size[0] = 1; F3_y2->size[1] = 1; emxEnsureCapacity((emxArray__common *)F3_y2, i0, (int32_T)sizeof(real_T), &emlrtRTEI); F3_y2->data[0] = 0.0; i0 = F4_y1->size[0] * F4_y1->size[1]; F4_y1->size[0] = 1; F4_y1->size[1] = 1; emxEnsureCapacity((emxArray__common *)F4_y1, i0, (int32_T)sizeof(real_T), &emlrtRTEI); F4_y1->data[0] = 0.0; i0 = F5_y1->size[0] * F5_y1->size[1]; F5_y1->size[0] = 1; F5_y1->size[1] = 1; emxEnsureCapacity((emxArray__common *)F5_y1, i0, (int32_T)sizeof(real_T), &emlrtRTEI); F5_y1->data[0] = 0.0; i0 = F6_y1->size[0] * F6_y1->size[1]; F6_y1->size[0] = 1; F6_y1->size[1] = 1; emxEnsureCapacity((emxArray__common *)F6_y1, i0, (int32_T)sizeof(real_T), &emlrtRTEI); F6_y1->data[0] = 0.0; i0 = F7_y1->size[0] * F7_y1->size[1]; F7_y1->size[0] = 1; F7_y1->size[1] = 1; emxEnsureCapacity((emxArray__common *)F7_y1, i0, (int32_T)sizeof(real_T), &emlrtRTEI); F7_y1->data[0] = 0.0; } else { /* Output information */ loop_ub = recID->size[0]; for (i0 = 0; i0 < loop_ub; i0++) { i1 = RSN->size[0]; absb = (int32_T)recID->data[i0]; emlrtDynamicBoundsCheckFastR2012b(absb, 1, i1, &db_emlrtBCI, emlrtRootTLSGlobal); } loop_ub = recID->size[0]; for (i0 = 0; i0 < loop_ub; i0++) { i1 = idRef->size[0]; b = RSN->data[(int32_T)recID->data[i0] - 1]; absb = (int32_T)emlrtIntegerCheckFastR2012b(b, &f_emlrtDCI, emlrtRootTLSGlobal); emlrtDynamicBoundsCheckFastR2012b(absb, 1, i1, &eb_emlrtBCI, emlrtRootTLSGlobal); } i0 = finalDirectios->size[0]; finalDirectios->size[0] = recID->size[0]; emxEnsureCapacity((emxArray__common *)finalDirectios, i0, (int32_T) sizeof(real_T), &emlrtRTEI); loop_ub = recID->size[0]; for (i0 = 0; i0 < loop_ub; i0++) { finalDirectios->data[i0] = 1.0; } i = 1; while (i - 1 <= recID->size[0] - 1) { i0 = recID->size[0]; if ((int32_T)recID->data[emlrtDynamicBoundsCheckFastR2012b(i, 1, i0, &hb_emlrtBCI, emlrtRootTLSGlobal) - 1] > Sa_1->size[0]) { i0 = finalDirectios->size[0]; finalDirectios->data[emlrtDynamicBoundsCheckFastR2012b(i, 1, i0, &ib_emlrtBCI, emlrtRootTLSGlobal) - 1] = 2.0; } i++; emlrtBreakCheckFastR2012b(emlrtBreakCheckR2012bFlagVar, emlrtRootTLSGlobal); } i0 = finalRecords->size[0]; finalRecords->size[0] = recID->size[0]; emxEnsureCapacity((emxArray__common *)finalRecords, i0, (int32_T)sizeof (real_T), &emlrtRTEI); loop_ub = recID->size[0]; for (i0 = 0; i0 < loop_ub; i0++) { finalRecords->data[i0] = idRef->data[(int32_T)RSN->data[(int32_T) recID->data[i0] - 1] - 1]; } /* % Spectra Plots */ loop_ub = recID->size[0]; for (i0 = 0; i0 < loop_ub; i0++) { i1 = SaKnown->size[0]; absb = (int32_T)recID->data[i0]; emlrtDynamicBoundsCheckFastR2012b(absb, 1, i1, &fb_emlrtBCI, emlrtRootTLSGlobal); } emlrtPushRtStackR2012b(&bc_emlrtRSI, emlrtRootTLSGlobal); b_repmat(finalScaleFactors, SaKnown->size[1], r7); emlrtPopRtStackR2012b(&bc_emlrtRSI, emlrtRootTLSGlobal); loop_ub = SaKnown->size[1]; i0 = b_SaKnown->size[0] * b_SaKnown->size[1]; b_SaKnown->size[0] = recID->size[0]; b_SaKnown->size[1] = loop_ub; emxEnsureCapacity((emxArray__common *)b_SaKnown, i0, (int32_T)sizeof (real_T), &emlrtRTEI); for (i0 = 0; i0 < loop_ub; i0++) { b_loop_ub = recID->size[0]; for (i1 = 0; i1 < b_loop_ub; i1++) { b_SaKnown->data[i1 + b_SaKnown->size[0] * i0] = SaKnown->data [((int32_T)recID->data[i1] + SaKnown->size[0] * i0) - 1]; } } for (i0 = 0; i0 < 2; i0++) { b_rho[i0] = b_SaKnown->size[i0]; } for (i0 = 0; i0 < 2; i0++) { iv0[i0] = r7->size[i0]; } emlrtSizeEqCheck2DFastR2012b(b_rho, iv0, &b_emlrtECI, emlrtRootTLSGlobal); loop_ub = SaKnown->size[1]; i0 = F4_y1->size[0] * F4_y1->size[1]; F4_y1->size[0] = recID->size[0]; F4_y1->size[1] = loop_ub; emxEnsureCapacity((emxArray__common *)F4_y1, i0, (int32_T)sizeof(real_T), &emlrtRTEI); for (i0 = 0; i0 < loop_ub; i0++) { b_loop_ub = recID->size[0]; for (i1 = 0; i1 < b_loop_ub; i1++) { F4_y1->data[i1 + F4_y1->size[0] * i0] = SaKnown->data[((int32_T) recID->data[i1] + SaKnown->size[0] * i0) - 1] * r7->data[i1 + r7->size[0] * i0]; } } loop_ub = sampleBig->size[1]; i0 = F5_y1->size[0] * F5_y1->size[1]; F5_y1->size[0] = recID->size[0]; F5_y1->size[1] = loop_ub; emxEnsureCapacity((emxArray__common *)F5_y1, i0, (int32_T)sizeof(real_T), &emlrtRTEI); for (i0 = 0; i0 < loop_ub; i0++) { b_loop_ub = recID->size[0]; for (i1 = 0; i1 < b_loop_ub; i1++) { absb = sampleBig->size[0]; apnd = (int32_T)recID->data[i1]; F5_y1->data[i1 + F5_y1->size[0] * i0] = sampleBig->data [(emlrtDynamicBoundsCheckFastR2012b(apnd, 1, absb, &gb_emlrtBCI, emlrtRootTLSGlobal) + sampleBig->size[0] * i0) - 1]; } } c_exp(F5_y1); emlrtPushRtStackR2012b(&cc_emlrtRSI, emlrtRootTLSGlobal); b_repmat(finalScaleFactors, F_x->size[1], r7); emlrtPopRtStackR2012b(&cc_emlrtRSI, emlrtRootTLSGlobal); for (i0 = 0; i0 < 2; i0++) { b_rho[i0] = F5_y1->size[i0]; } for (i0 = 0; i0 < 2; i0++) { iv0[i0] = r7->size[i0]; } emlrtSizeEqCheck2DFastR2012b(b_rho, iv0, &emlrtECI, emlrtRootTLSGlobal); i0 = F5_y1->size[0] * F5_y1->size[1]; emxEnsureCapacity((emxArray__common *)F5_y1, i0, (int32_T)sizeof(real_T), &emlrtRTEI); ndbl = F5_y1->size[0]; cdiff = F5_y1->size[1]; loop_ub = ndbl * cdiff; for (i0 = 0; i0 < loop_ub; i0++) { F5_y1->data[i0] *= r7->data[i0]; } emlrtPushRtStackR2012b(&dc_emlrtRSI, emlrtRootTLSGlobal); mean(sampleSmall, F6_y1); b_exp(F6_y1); emlrtPopRtStackR2012b(&dc_emlrtRSI, emlrtRootTLSGlobal); emlrtPushRtStackR2012b(&ec_emlrtRSI, emlrtRootTLSGlobal); b_std(sampleSmall, F7_y1); emlrtPopRtStackR2012b(&ec_emlrtRSI, emlrtRootTLSGlobal); /* if (showPlots) */ /* */ /* % Variables used here */ /* */ /* % SaKnown : As before, it contains the response spectra of all the */ /* % available ground motions (N*P matrix) - N ground motions, */ /* % P periods */ /* % sampleBig : Same as SaKnown, but is only defined at PerTgt, the */ /* % periods at which the target response spectrum properties */ /* % are computed */ /* % sampleSmall: The response spectra of the selected ground motions, */ /* % defined at PerTgt */ /* % meanReq : Target mean for the (log) response spectrum */ /* % covReq : Target covariance for the (log) response spectrum */ /* % */ /* */ /* */ /* % Plot at all periods */ /* figure */ /* loglog(PerTgt, exp(meanReq), 'b', 'linewidth', 3) */ /* hold on */ /* loglog(PerTgt, exp(meanReq + 1.96*sqrt(diag(covReq))'), '--b', 'linewidth', 3) */ /* loglog(perKnown,SaKnown(finalRecords,:).*repmat(finalScaleFactors,1,size(SaKnown,2)),'k'); */ /* loglog(PerTgt, exp(meanReq - 1.96*sqrt(diag(covReq))'), '--b', 'linewidth', 3) */ /* axis([min(PerTgt) max(PerTgt) 1e-2 5]) */ /* xlabel('T (s)'); */ /* ylabel('S_a (g)'); */ /* legend('Median response spectrum','2.5 and 97.5 percentile response spectra','Response spectra of selected ground motions'); */ /* title ('Response spectra of selected ground motions'); */ /* */ /* % Plot spectra only at periods where error is minimized */ /* figure */ /* loglog(PerTgt, exp(meanReq), 'b', 'linewidth', 3) */ /* hold on */ /* loglog(PerTgt, exp(meanReq + 1.96*sqrt(diag(covReq))'), '--b', 'linewidth', 3) */ /* loglog(PerTgt,exp(sampleBig(finalRecords,:)).*repmat(finalScaleFactors,1,length(PerTgt)),'color',[0.5 0.5 0.5],'linewidth',1) */ /* loglog(PerTgt, exp(meanReq - 1.96*sqrt(diag(covReq))'), '--b', 'linewidth', 3) */ /* axis([min(PerTgt) max(PerTgt) 1e-2 5]) */ /* xlabel('T (s)'); */ /* ylabel('S_a (g)'); */ /* legend('Median response spectrum','2.5 and 97.5 percentile response spectra','Response spectra of selected ground motions'); */ /* title ('Response spectra of selected ground motions at periods where error is minimized'); */ /* */ /* % Sample and target means */ /* figure */ /* loglog(PerTgt,exp(meanReq),'k','linewidth',1) */ /* hold on */ /* loglog(PerTgt,exp(mean(sampleSmall)),'b--','linewidth',1) */ /* axis([min(PerTgt) max(PerTgt) 1e-2 5]) */ /* xlabel('T (s)') */ /* ylabel('Median S_a (g)') */ /* legend('exp(Target mean lnS_a)','exp(Mean of selected lnS_a)') */ /* title('Target and sample exponential logarithmic means (i.e., medians)') */ /* */ /* % Sample and target standard deviations */ /* figure */ /* semilogx(PerTgt,sqrt(diag(covReq))','k','linewidth',1) */ /* hold on */ /* semilogx(PerTgt,std(sampleSmall),'b--','linewidth',1) */ /* axis([min(PerTgt) max(PerTgt) 0 1]) */ /* xlabel('T (s)') */ /* ylabel('Standard deviation of lnS_a') */ /* legend('Target standard deviation of lnS_a','Standard deviation of selected lnS_a') */ /* title('Target and sample logarithmic standard deviations') */ /* */ /* end */ if (checkCorr != 0.0) { emlrtPushRtStackR2012b(&fc_emlrtRSI, emlrtRootTLSGlobal); i0 = b_idRef->size[0]; b_idRef->size[0] = recID->size[0]; emxEnsureCapacity((emxArray__common *)b_idRef, i0, (int32_T)sizeof (real_T), &emlrtRTEI); loop_ub = recID->size[0]; for (i0 = 0; i0 < loop_ub; i0++) { b_idRef->data[i0] = idRef->data[(int32_T)RSN->data[(int32_T) recID->data[i0] - 1] - 1]; } conditionalCovariance(F4_x1, T1, M_bar, R_bar, R_bar, Ztor, delta, lambda, Vs30, Zvs, arb, b_idRef, finalScaleFactors, SaKnown); emlrtPopRtStackR2012b(&fc_emlrtRSI, emlrtRootTLSGlobal); } } } emxFree_real_T(&f_sampleSmall); emxFree_real_T(&e_sampleSmall); emxFree_real_T(&d_sampleSmall); emxFree_real_T(&c_sampleSmall); emxFree_real_T(&e_recID); emxFree_real_T(&b_sampleSmall); emxFree_real_T(&b_SaKnown); emxFree_int32_T(&r21); emxFree_real_T(&r20); emxFree_boolean_T(&b_recPer); emxFree_boolean_T(&r19); emxFree_boolean_T(&r18); emxFree_boolean_T(&d_F_x); emxFree_real_T(&r17); emxFree_real_T(&r16); emxFree_real_T(&r15); emxFree_boolean_T(&d_recID); emxFree_real_T(&b_idRef); emxFree_real_T(&scaleFac); emxFree_real_T(&sampleSmall); emxFree_real_T(&sampleBig); } emxFree_real_T(&r2); emxFree_real_T(&r7); emxFree_int32_T(&ii); emxFree_real_T(&d_b); emxFree_int32_T(&r6); emxFree_real_T(&r1); emxFree_real_T(&recPer); emxFree_real_T(&tempf); emxFree_real_T(&covReq); emxFree_real_T(&lnSa1); emxFree_real_T(&sa); emxFree_real_T(&posT1); emxFree_real_T(&PerTgt_tmp); emxFree_real_T(&soil_Vs30); emxFree_real_T(&RSN); emxFree_real_T(&SaKnown); emxFree_real_T(&recID); /* % Output data to file (best viewed with textpad) */ /* fin = fopen(outputFile,'w'); */ /* fprintf(fin,'%s \t %s \t %s \t %s \n','Record Number','Scale Factor','File Name','URL'); % Title of relevant outputs */ /* for i = 1 : length(finalRecords) */ /* rec = finalRecords(i); */ /* url = ['http://peer.berkeley.edu/nga_files/ath/' Filename{rec}(1:end-3) 'AT2']; % URL of selected record */ /* fprintf(fin,'%d \t %6.2f \t %s \t %s \n',i,finalScaleFactors(i),Filename{rec},url); % Print relevant outputs */ /* end */ /* */ /* fclose(fin); */ emlrtHeapReferenceStackLeaveFcnR2012b(emlrtRootTLSGlobal); } void check_forloop_overflow_error(void) { const mxArray *y; static const int32_T iv18[2] = { 1, 34 }; const mxArray *m1; char_T cv10[34]; int32_T i; static const char_T cv11[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 iv19[2] = { 1, 23 }; char_T cv12[23]; static const char_T cv13[23] = { 'c', 'o', 'd', 'e', 'r', '.', 'i', 'n', 't', 'e', 'r', 'n', 'a', 'l', '.', 'i', 'n', 'd', 'e', 'x', 'I', 'n', 't' }; emlrtPushRtStackR2012b(&mc_emlrtRSI, emlrtRootTLSGlobal); y = NULL; m1 = mxCreateCharArray(2, iv18); for (i = 0; i < 34; i++) { cv10[i] = cv11[i]; } emlrtInitCharArrayR2013a(emlrtRootTLSGlobal, 34, m1, cv10); emlrtAssign(&y, m1); b_y = NULL; m1 = mxCreateCharArray(2, iv19); for (i = 0; i < 23; i++) { cv12[i] = cv13[i]; } emlrtInitCharArrayR2013a(emlrtRootTLSGlobal, 23, m1, cv12); emlrtAssign(&b_y, m1); error(b_message(y, b_y, &g_emlrtMCI), &h_emlrtMCI); emlrtPopRtStackR2012b(&mc_emlrtRSI, emlrtRootTLSGlobal); } /* End of code generation (Select_Ground_Motions.c) */