/* * cholcov_.c * * Code generation for function 'cholcov_' * * C source code generated on: Wed Aug 26 14:59:33 2015 * */ /* Include files */ #include "rt_nonfinite.h" #include "Select_Ground_Motions.h" #include "cholcov_.h" #include "SP_1996.h" #include "Select_Ground_Motions_emxutil.h" #include "isequal.h" #include "abs.h" #include "repmat.h" #include "eps.h" #include "diag.h" #include "eig.h" #include "issorted.h" #include "all.h" #include "Select_Ground_Motions_mexutil.h" #include "Select_Ground_Motions_data.h" /* Variable Definitions */ static emlrtRSInfo kc_emlrtRSI = { 401, "colon", "/usr/local/MATLAB/R2013a/toolbox/eml/lib/matlab/ops/colon.m" }; static emlrtRSInfo rc_emlrtRSI = { 11, "eml_li_find", "/usr/local/MATLAB/R2013a/toolbox/eml/lib/matlab/eml/eml_li_find.m" }; static emlrtRSInfo tc_emlrtRSI = { 26, "eml_li_find", "/usr/local/MATLAB/R2013a/toolbox/eml/lib/matlab/eml/eml_li_find.m" }; static emlrtRSInfo uc_emlrtRSI = { 39, "eml_li_find", "/usr/local/MATLAB/R2013a/toolbox/eml/lib/matlab/eml/eml_li_find.m" }; static emlrtRSInfo mf_emlrtRSI = { 40, "cholcov_", "/home/sebenik/Projects/Ground_Motion_Selection/GMS_con_cms_1gmc_dynamicInput_501_jure/cholcov_.m" }; static emlrtRSInfo nf_emlrtRSI = { 41, "cholcov_", "/home/sebenik/Projects/Ground_Motion_Selection/GMS_con_cms_1gmc_dynamicInput_501_jure/cholcov_.m" }; static emlrtRSInfo of_emlrtRSI = { 44, "cholcov_", "/home/sebenik/Projects/Ground_Motion_Selection/GMS_con_cms_1gmc_dynamicInput_501_jure/cholcov_.m" }; static emlrtRSInfo pf_emlrtRSI = { 52, "cholcov_", "/home/sebenik/Projects/Ground_Motion_Selection/GMS_con_cms_1gmc_dynamicInput_501_jure/cholcov_.m" }; static emlrtRSInfo qf_emlrtRSI = { 54, "cholcov_", "/home/sebenik/Projects/Ground_Motion_Selection/GMS_con_cms_1gmc_dynamicInput_501_jure/cholcov_.m" }; static emlrtRSInfo rf_emlrtRSI = { 55, "cholcov_", "/home/sebenik/Projects/Ground_Motion_Selection/GMS_con_cms_1gmc_dynamicInput_501_jure/cholcov_.m" }; static emlrtRSInfo sf_emlrtRSI = { 56, "cholcov_", "/home/sebenik/Projects/Ground_Motion_Selection/GMS_con_cms_1gmc_dynamicInput_501_jure/cholcov_.m" }; static emlrtRSInfo tf_emlrtRSI = { 58, "cholcov_", "/home/sebenik/Projects/Ground_Motion_Selection/GMS_con_cms_1gmc_dynamicInput_501_jure/cholcov_.m" }; static emlrtRSInfo uf_emlrtRSI = { 59, "cholcov_", "/home/sebenik/Projects/Ground_Motion_Selection/GMS_con_cms_1gmc_dynamicInput_501_jure/cholcov_.m" }; static emlrtRSInfo vf_emlrtRSI = { 64, "cholcov_", "/home/sebenik/Projects/Ground_Motion_Selection/GMS_con_cms_1gmc_dynamicInput_501_jure/cholcov_.m" }; static emlrtRSInfo wf_emlrtRSI = { 65, "cholcov_", "/home/sebenik/Projects/Ground_Motion_Selection/GMS_con_cms_1gmc_dynamicInput_501_jure/cholcov_.m" }; static emlrtRSInfo xf_emlrtRSI = { 66, "cholcov_", "/home/sebenik/Projects/Ground_Motion_Selection/GMS_con_cms_1gmc_dynamicInput_501_jure/cholcov_.m" }; static emlrtRSInfo yf_emlrtRSI = { 72, "cholcov_", "/home/sebenik/Projects/Ground_Motion_Selection/GMS_con_cms_1gmc_dynamicInput_501_jure/cholcov_.m" }; static emlrtRSInfo ag_emlrtRSI = { 74, "cholcov_", "/home/sebenik/Projects/Ground_Motion_Selection/GMS_con_cms_1gmc_dynamicInput_501_jure/cholcov_.m" }; static emlrtRSInfo bg_emlrtRSI = { 75, "cholcov_", "/home/sebenik/Projects/Ground_Motion_Selection/GMS_con_cms_1gmc_dynamicInput_501_jure/cholcov_.m" }; static emlrtRSInfo cg_emlrtRSI = { 78, "cholcov_", "/home/sebenik/Projects/Ground_Motion_Selection/GMS_con_cms_1gmc_dynamicInput_501_jure/cholcov_.m" }; static emlrtRSInfo ig_emlrtRSI = { 97, "eml_min_or_max", "/usr/local/MATLAB/R2013a/toolbox/eml/lib/matlab/eml/eml_min_or_max.m" }; static emlrtRSInfo jg_emlrtRSI = { 100, "eml_min_or_max", "/usr/local/MATLAB/R2013a/toolbox/eml/lib/matlab/eml/eml_min_or_max.m" }; static emlrtRSInfo og_emlrtRSI = { 32, "chol", "/usr/local/MATLAB/R2013a/toolbox/eml/lib/matlab/matfun/chol.m" }; static emlrtRSInfo pg_emlrtRSI = { 48, "chol", "/usr/local/MATLAB/R2013a/toolbox/eml/lib/matlab/matfun/chol.m" }; static emlrtRSInfo qg_emlrtRSI = { 68, "chol", "/usr/local/MATLAB/R2013a/toolbox/eml/lib/matlab/matfun/chol.m" }; static emlrtRSInfo rg_emlrtRSI = { 86, "chol", "/usr/local/MATLAB/R2013a/toolbox/eml/lib/matlab/matfun/chol.m" }; static emlrtRSInfo sg_emlrtRSI = { 87, "chol", "/usr/local/MATLAB/R2013a/toolbox/eml/lib/matlab/matfun/chol.m" }; static emlrtRSInfo tg_emlrtRSI = { 94, "chol", "/usr/local/MATLAB/R2013a/toolbox/eml/lib/matlab/matfun/chol.m" }; static emlrtRSInfo ug_emlrtRSI = { 31, "eml_xdotc", "/usr/local/MATLAB/R2013a/toolbox/eml/lib/matlab/eml/blas/eml_xdotc.m" }; static emlrtRSInfo vg_emlrtRSI = { 28, "eml_xdot", "/usr/local/MATLAB/R2013a/toolbox/eml/lib/matlab/eml/blas/eml_xdot.m" }; static emlrtRSInfo xg_emlrtRSI = { 28, "eml_blas_xdot", "/usr/local/MATLAB/R2013a/toolbox/eml/lib/matlab/eml/blas/external/eml_blas_xdot.m" }; static emlrtRSInfo bh_emlrtRSI = { 64, "eml_blas_xdot", "/usr/local/MATLAB/R2013a/toolbox/eml/lib/matlab/eml/blas/external/eml_blas_xdot.m" }; static emlrtRSInfo ch_emlrtRSI = { 65, "eml_blas_xdot", "/usr/local/MATLAB/R2013a/toolbox/eml/lib/matlab/eml/blas/external/eml_blas_xdot.m" }; static emlrtRSInfo dh_emlrtRSI = { 66, "eml_blas_xdot", "/usr/local/MATLAB/R2013a/toolbox/eml/lib/matlab/eml/blas/external/eml_blas_xdot.m" }; static emlrtRSInfo eh_emlrtRSI = { 70, "eml_blas_xdot", "/usr/local/MATLAB/R2013a/toolbox/eml/lib/matlab/eml/blas/external/eml_blas_xdot.m" }; static emlrtRSInfo fh_emlrtRSI = { 73, "eml_blas_xdot", "/usr/local/MATLAB/R2013a/toolbox/eml/lib/matlab/eml/blas/external/eml_blas_xdot.m" }; static emlrtRSInfo gh_emlrtRSI = { 8, "eml_xpotrf", "/usr/local/MATLAB/R2013a/toolbox/eml/lib/matlab/eml/lapack/eml_xpotrf.m" }; static emlrtRSInfo hh_emlrtRSI = { 8, "eml_lapack_xpotrf", "/usr/local/MATLAB/R2013a/toolbox/eml/lib/matlab/eml/lapack/internal/eml_lapack_xpotrf.m" }; static emlrtRSInfo ih_emlrtRSI = { 75, "eml_matlab_zpotrf", "/usr/local/MATLAB/R2013a/toolbox/eml/lib/matlab/eml/lapack/matlab/eml_matlab_zpotrf.m" }; static emlrtRSInfo jh_emlrtRSI = { 79, "eml_matlab_zpotrf", "/usr/local/MATLAB/R2013a/toolbox/eml/lib/matlab/eml/lapack/matlab/eml_matlab_zpotrf.m" }; static emlrtRSInfo kh_emlrtRSI = { 94, "eml_matlab_zpotrf", "/usr/local/MATLAB/R2013a/toolbox/eml/lib/matlab/eml/lapack/matlab/eml_matlab_zpotrf.m" }; static emlrtRSInfo lh_emlrtRSI = { 98, "eml_matlab_zpotrf", "/usr/local/MATLAB/R2013a/toolbox/eml/lib/matlab/eml/lapack/matlab/eml_matlab_zpotrf.m" }; static emlrtRSInfo mh_emlrtRSI = { 102, "eml_matlab_zpotrf", "/usr/local/MATLAB/R2013a/toolbox/eml/lib/matlab/eml/lapack/matlab/eml_matlab_zpotrf.m" }; static emlrtRSInfo nh_emlrtRSI = { 106, "eml_matlab_zpotrf", "/usr/local/MATLAB/R2013a/toolbox/eml/lib/matlab/eml/lapack/matlab/eml_matlab_zpotrf.m" }; static emlrtRSInfo oh_emlrtRSI = { 52, "eml_xgemv", "/usr/local/MATLAB/R2013a/toolbox/eml/lib/matlab/eml/blas/eml_xgemv.m" }; static emlrtRSInfo qh_emlrtRSI = { 29, "eml_blas_xgemv", "/usr/local/MATLAB/R2013a/toolbox/eml/lib/matlab/eml/blas/external/eml_blas_xgemv.m" }; static emlrtRSInfo th_emlrtRSI = { 95, "eml_blas_xgemv", "/usr/local/MATLAB/R2013a/toolbox/eml/lib/matlab/eml/blas/external/eml_blas_xgemv.m" }; static emlrtRSInfo uh_emlrtRSI = { 96, "eml_blas_xgemv", "/usr/local/MATLAB/R2013a/toolbox/eml/lib/matlab/eml/blas/external/eml_blas_xgemv.m" }; static emlrtRSInfo vh_emlrtRSI = { 97, "eml_blas_xgemv", "/usr/local/MATLAB/R2013a/toolbox/eml/lib/matlab/eml/blas/external/eml_blas_xgemv.m" }; static emlrtRSInfo wh_emlrtRSI = { 98, "eml_blas_xgemv", "/usr/local/MATLAB/R2013a/toolbox/eml/lib/matlab/eml/blas/external/eml_blas_xgemv.m" }; static emlrtRSInfo xh_emlrtRSI = { 99, "eml_blas_xgemv", "/usr/local/MATLAB/R2013a/toolbox/eml/lib/matlab/eml/blas/external/eml_blas_xgemv.m" }; static emlrtRSInfo yh_emlrtRSI = { 103, "eml_blas_xgemv", "/usr/local/MATLAB/R2013a/toolbox/eml/lib/matlab/eml/blas/external/eml_blas_xgemv.m" }; static emlrtRSInfo ai_emlrtRSI = { 106, "eml_blas_xgemv", "/usr/local/MATLAB/R2013a/toolbox/eml/lib/matlab/eml/blas/external/eml_blas_xgemv.m" }; static emlrtRSInfo bi_emlrtRSI = { 109, "eml_blas_xgemv", "/usr/local/MATLAB/R2013a/toolbox/eml/lib/matlab/eml/blas/external/eml_blas_xgemv.m" }; static emlrtRSInfo ci_emlrtRSI = { 115, "eml_blas_xgemv", "/usr/local/MATLAB/R2013a/toolbox/eml/lib/matlab/eml/blas/external/eml_blas_xgemv.m" }; static emlrtRSInfo di_emlrtRSI = { 118, "eml_blas_xgemv", "/usr/local/MATLAB/R2013a/toolbox/eml/lib/matlab/eml/blas/external/eml_blas_xgemv.m" }; static emlrtRSInfo ei_emlrtRSI = { 120, "eml_blas_xgemv", "/usr/local/MATLAB/R2013a/toolbox/eml/lib/matlab/eml/blas/external/eml_blas_xgemv.m" }; static emlrtRSInfo el_emlrtRSI = { 20, "sort", "/usr/local/MATLAB/R2013a/toolbox/eml/lib/matlab/datafun/sort.m" }; static emlrtRSInfo fl_emlrtRSI = { 78, "eml_sort", "/usr/local/MATLAB/R2013a/toolbox/eml/lib/matlab/eml/eml_sort.m" }; static emlrtRSInfo gl_emlrtRSI = { 69, "eml_sort", "/usr/local/MATLAB/R2013a/toolbox/eml/lib/matlab/eml/eml_sort.m" }; static emlrtRSInfo hl_emlrtRSI = { 66, "eml_sort", "/usr/local/MATLAB/R2013a/toolbox/eml/lib/matlab/eml/eml_sort.m" }; static emlrtRSInfo il_emlrtRSI = { 62, "eml_sort", "/usr/local/MATLAB/R2013a/toolbox/eml/lib/matlab/eml/eml_sort.m" }; static emlrtRSInfo jl_emlrtRSI = { 50, "eml_sort", "/usr/local/MATLAB/R2013a/toolbox/eml/lib/matlab/eml/eml_sort.m" }; static emlrtRSInfo ll_emlrtRSI = { 91, "eml_matrix_vstride", "/usr/local/MATLAB/R2013a/toolbox/eml/lib/matlab/eml/eml_matrix_vstride.m" }; static emlrtRSInfo ml_emlrtRSI = { 20, "eml_size_prod", "/usr/local/MATLAB/R2013a/toolbox/eml/lib/matlab/eml/eml_size_prod.m" }; static emlrtRSInfo nl_emlrtRSI = { 42, "eml_sort_idx", "/usr/local/MATLAB/R2013a/toolbox/eml/lib/matlab/eml/eml_sort_idx.m" }; static emlrtRSInfo ol_emlrtRSI = { 134, "eml_sort_idx", "/usr/local/MATLAB/R2013a/toolbox/eml/lib/matlab/eml/eml_sort_idx.m" }; static emlrtRSInfo pl_emlrtRSI = { 185, "eml_sort_idx", "/usr/local/MATLAB/R2013a/toolbox/eml/lib/matlab/eml/eml_sort_idx.m" }; static emlrtRSInfo ql_emlrtRSI = { 18, "max", "/usr/local/MATLAB/R2013a/toolbox/eml/lib/matlab/datafun/max.m" }; static emlrtMCInfo e_emlrtMCI = { 402, 5, "colon", "/usr/local/MATLAB/R2013a/toolbox/eml/lib/matlab/ops/colon.m" }; static emlrtMCInfo f_emlrtMCI = { 401, 15, "colon", "/usr/local/MATLAB/R2013a/toolbox/eml/lib/matlab/ops/colon.m" }; static emlrtMCInfo ob_emlrtMCI = { 49, 5, "chol", "/usr/local/MATLAB/R2013a/toolbox/eml/lib/matlab/matfun/chol.m" }; static emlrtMCInfo pb_emlrtMCI = { 48, 15, "chol", "/usr/local/MATLAB/R2013a/toolbox/eml/lib/matlab/matfun/chol.m" }; static emlrtMCInfo qb_emlrtMCI = { 94, 5, "chol", "/usr/local/MATLAB/R2013a/toolbox/eml/lib/matlab/matfun/chol.m" }; static emlrtRTEInfo y_emlrtRTEI = { 17, 9, "eml_li_find", "/usr/local/MATLAB/R2013a/toolbox/eml/lib/matlab/eml/eml_li_find.m" }; static emlrtRTEInfo kb_emlrtRTEI = { 1, 18, "cholcov_", "/home/sebenik/Projects/Ground_Motion_Selection/GMS_con_cms_1gmc_dynamicInput_501_jure/cholcov_.m" }; static emlrtRTEInfo mb_emlrtRTEI = { 65, 13, "cholcov_", "/home/sebenik/Projects/Ground_Motion_Selection/GMS_con_cms_1gmc_dynamicInput_501_jure/cholcov_.m" }; static emlrtRTEInfo nb_emlrtRTEI = { 73, 13, "cholcov_", "/home/sebenik/Projects/Ground_Motion_Selection/GMS_con_cms_1gmc_dynamicInput_501_jure/cholcov_.m" }; static emlrtRTEInfo ob_emlrtRTEI = { 52, 14, "cholcov_", "/home/sebenik/Projects/Ground_Motion_Selection/GMS_con_cms_1gmc_dynamicInput_501_jure/cholcov_.m" }; static emlrtRTEInfo pb_emlrtRTEI = { 52, 16, "cholcov_", "/home/sebenik/Projects/Ground_Motion_Selection/GMS_con_cms_1gmc_dynamicInput_501_jure/cholcov_.m" }; static emlrtRTEInfo qb_emlrtRTEI = { 56, 18, "cholcov_", "/home/sebenik/Projects/Ground_Motion_Selection/GMS_con_cms_1gmc_dynamicInput_501_jure/cholcov_.m" }; static emlrtRTEInfo rb_emlrtRTEI = { 40, 1, "cholcov_", "/home/sebenik/Projects/Ground_Motion_Selection/GMS_con_cms_1gmc_dynamicInput_501_jure/cholcov_.m" }; static emlrtRTEInfo cc_emlrtRTEI = { 52, 1, "eml_sort", "/usr/local/MATLAB/R2013a/toolbox/eml/lib/matlab/eml/eml_sort.m" }; static emlrtRTEInfo dc_emlrtRTEI = { 53, 1, "eml_sort", "/usr/local/MATLAB/R2013a/toolbox/eml/lib/matlab/eml/eml_sort.m" }; static emlrtRTEInfo ec_emlrtRTEI = { 61, 5, "eml_sort", "/usr/local/MATLAB/R2013a/toolbox/eml/lib/matlab/eml/eml_sort.m" }; static emlrtRTEInfo fc_emlrtRTEI = { 27, 5, "eml_sort_idx", "/usr/local/MATLAB/R2013a/toolbox/eml/lib/matlab/eml/eml_sort_idx.m" }; static emlrtRTEInfo gc_emlrtRTEI = { 1, 20, "eml_sort", "/usr/local/MATLAB/R2013a/toolbox/eml/lib/matlab/eml/eml_sort.m" }; static emlrtRTEInfo hc_emlrtRTEI = { 78, 13, "eml_sort", "/usr/local/MATLAB/R2013a/toolbox/eml/lib/matlab/eml/eml_sort.m" }; static emlrtRTEInfo ic_emlrtRTEI = { 145, 5, "eml_sort_idx", "/usr/local/MATLAB/R2013a/toolbox/eml/lib/matlab/eml/eml_sort_idx.m" }; static emlrtRTEInfo kc_emlrtRTEI = { 20, 9, "eml_li_find", "/usr/local/MATLAB/R2013a/toolbox/eml/lib/matlab/eml/eml_li_find.m" }; static emlrtECInfo eb_emlrtECI = { -1, 74, 17, "cholcov_", "/home/sebenik/Projects/Ground_Motion_Selection/GMS_con_cms_1gmc_dynamicInput_501_jure/cholcov_.m" }; static emlrtECInfo fb_emlrtECI = { 2, 73, 19, "cholcov_", "/home/sebenik/Projects/Ground_Motion_Selection/GMS_con_cms_1gmc_dynamicInput_501_jure/cholcov_.m" }; static emlrtECInfo gb_emlrtECI = { -1, 66, 13, "cholcov_", "/home/sebenik/Projects/Ground_Motion_Selection/GMS_con_cms_1gmc_dynamicInput_501_jure/cholcov_.m" }; static emlrtECInfo hb_emlrtECI = { -1, 65, 23, "cholcov_", "/home/sebenik/Projects/Ground_Motion_Selection/GMS_con_cms_1gmc_dynamicInput_501_jure/cholcov_.m" }; static emlrtECInfo ib_emlrtECI = { 2, 65, 25, "cholcov_", "/home/sebenik/Projects/Ground_Motion_Selection/GMS_con_cms_1gmc_dynamicInput_501_jure/cholcov_.m" }; static emlrtECInfo jb_emlrtECI = { 2, 56, 35, "cholcov_", "/home/sebenik/Projects/Ground_Motion_Selection/GMS_con_cms_1gmc_dynamicInput_501_jure/cholcov_.m" }; static emlrtBCInfo hd_emlrtBCI = { -1, -1, 55, 30, "D", "cholcov_", "/home/sebenik/Projects/Ground_Motion_Selection/GMS_con_cms_1gmc_dynamicInput_501_jure/cholcov_.m", 0 }; static emlrtECInfo kb_emlrtECI = { 2, 52, 31, "cholcov_", "/home/sebenik/Projects/Ground_Motion_Selection/GMS_con_cms_1gmc_dynamicInput_501_jure/cholcov_.m" }; static emlrtECInfo lb_emlrtECI = { 2, 41, 30, "cholcov_", "/home/sebenik/Projects/Ground_Motion_Selection/GMS_con_cms_1gmc_dynamicInput_501_jure/cholcov_.m" }; static emlrtBCInfo id_emlrtBCI = { -1, -1, 60, 26, "V", "cholcov_", "/home/sebenik/Projects/Ground_Motion_Selection/GMS_con_cms_1gmc_dynamicInput_501_jure/cholcov_.m", 0 }; static emlrtBCInfo jd_emlrtBCI = { -1, -1, 65, 23, "U", "cholcov_", "/home/sebenik/Projects/Ground_Motion_Selection/GMS_con_cms_1gmc_dynamicInput_501_jure/cholcov_.m", 0 }; static emlrtDCInfo h_emlrtDCI = { 65, 23, "cholcov_", "/home/sebenik/Projects/Ground_Motion_Selection/GMS_con_cms_1gmc_dynamicInput_501_jure/cholcov_.m", 1 }; static emlrtBCInfo kd_emlrtBCI = { -1, -1, 66, 17, "U", "cholcov_", "/home/sebenik/Projects/Ground_Motion_Selection/GMS_con_cms_1gmc_dynamicInput_501_jure/cholcov_.m", 0 }; static emlrtBCInfo ld_emlrtBCI = { -1, -1, 66, 32, "U", "cholcov_", "/home/sebenik/Projects/Ground_Motion_Selection/GMS_con_cms_1gmc_dynamicInput_501_jure/cholcov_.m", 0 }; static emlrtBCInfo md_emlrtBCI = { -1, -1, 74, 17, "D", "cholcov_", "/home/sebenik/Projects/Ground_Motion_Selection/GMS_con_cms_1gmc_dynamicInput_501_jure/cholcov_.m", 0 }; static emlrtBCInfo nd_emlrtBCI = { -1, -1, 78, 41, "U", "cholcov_", "/home/sebenik/Projects/Ground_Motion_Selection/GMS_con_cms_1gmc_dynamicInput_501_jure/cholcov_.m", 0 }; /* Function Declarations */ static void eml_sort(const emxArray_real_T *x, emxArray_real_T *y, emxArray_int32_T *idx); /* Function Definitions */ static void eml_sort(const emxArray_real_T *x, emxArray_real_T *y, emxArray_int32_T *idx) { int32_T dim; emxArray_real_T *vwork; uint32_T uv2[2]; int32_T i2; int32_T ix; int32_T vstride; int32_T k; int32_T vspread; int32_T npages; int32_T b_i2; boolean_T b10; int32_T i; emxArray_int32_T *iidx; emxArray_int32_T *idx0; int32_T i1; boolean_T b11; int32_T j; boolean_T overflow; int32_T b_j; int32_T pEnd; int32_T p; int32_T q; int32_T qEnd; int32_T kEnd; emlrtHeapReferenceStackEnterFcnR2012b(emlrtRootTLSGlobal); dim = 1; if (x->size[0] != 1) { dim = 0; } emxInit_real_T(&vwork, 1, &cc_emlrtRTEI, TRUE); emlrtPushRtStackR2012b(&jl_emlrtRSI, emlrtRootTLSGlobal); emlrtPopRtStackR2012b(&jl_emlrtRSI, emlrtRootTLSGlobal); uv2[0] = (uint32_T)x->size[dim]; i2 = vwork->size[0]; vwork->size[0] = (int32_T)uv2[0]; emxEnsureCapacity((emxArray__common *)vwork, i2, (int32_T)sizeof(real_T), &cc_emlrtRTEI); for (i2 = 0; i2 < 2; i2++) { ix = y->size[0] * y->size[1]; y->size[i2] = x->size[i2]; emxEnsureCapacity((emxArray__common *)y, ix, (int32_T)sizeof(real_T), &dc_emlrtRTEI); } for (i2 = 0; i2 < 2; i2++) { uv2[i2] = (uint32_T)x->size[i2]; } i2 = idx->size[0] * idx->size[1]; idx->size[0] = (int32_T)uv2[0]; idx->size[1] = (int32_T)uv2[1]; emxEnsureCapacity((emxArray__common *)idx, i2, (int32_T)sizeof(int32_T), &ec_emlrtRTEI); emlrtPushRtStackR2012b(&il_emlrtRSI, emlrtRootTLSGlobal); emlrtPushRtStackR2012b(&ll_emlrtRSI, emlrtRootTLSGlobal); vstride = 1; emlrtPushRtStackR2012b(&ml_emlrtRSI, emlrtRootTLSGlobal); emlrtPopRtStackR2012b(&ml_emlrtRSI, emlrtRootTLSGlobal); k = 1; while (k <= dim) { vstride *= x->size[0]; k = 2; } emlrtPopRtStackR2012b(&ll_emlrtRSI, emlrtRootTLSGlobal); emlrtPopRtStackR2012b(&il_emlrtRSI, emlrtRootTLSGlobal); vspread = (x->size[dim] - 1) * vstride; npages = 1; k = dim + 2; while (k < 3) { npages *= x->size[1]; k = 3; } b_i2 = 0; emlrtPushRtStackR2012b(&hl_emlrtRSI, emlrtRootTLSGlobal); if (1 > npages) { b10 = FALSE; } else { b10 = (npages > 2147483646); } if (b10) { emlrtPushRtStackR2012b(&lc_emlrtRSI, emlrtRootTLSGlobal); check_forloop_overflow_error(); emlrtPopRtStackR2012b(&lc_emlrtRSI, emlrtRootTLSGlobal); } emlrtPopRtStackR2012b(&hl_emlrtRSI, emlrtRootTLSGlobal); i = 1; emxInit_int32_T(&iidx, 1, &hc_emlrtRTEI, TRUE); emxInit_int32_T(&idx0, 1, &ic_emlrtRTEI, TRUE); while (i <= npages) { i1 = b_i2; b_i2 += vspread; emlrtPushRtStackR2012b(&gl_emlrtRSI, emlrtRootTLSGlobal); if (1 > vstride) { b11 = FALSE; } else { b11 = (vstride > 2147483646); } if (b11) { emlrtPushRtStackR2012b(&lc_emlrtRSI, emlrtRootTLSGlobal); check_forloop_overflow_error(); emlrtPopRtStackR2012b(&lc_emlrtRSI, emlrtRootTLSGlobal); } emlrtPopRtStackR2012b(&gl_emlrtRSI, emlrtRootTLSGlobal); for (j = 1; j <= vstride; j++) { i1++; b_i2++; ix = i1; for (k = 0; k < x->size[dim]; k++) { vwork->data[k] = x->data[ix - 1]; ix += vstride; } emlrtPushRtStackR2012b(&fl_emlrtRSI, emlrtRootTLSGlobal); uv2[0] = (uint32_T)vwork->size[0]; i2 = iidx->size[0]; iidx->size[0] = (int32_T)uv2[0]; emxEnsureCapacity((emxArray__common *)iidx, i2, (int32_T)sizeof(int32_T), &fc_emlrtRTEI); if (vwork->size[0] == 0) { emlrtPushRtStackR2012b(&nl_emlrtRSI, emlrtRootTLSGlobal); emlrtPopRtStackR2012b(&nl_emlrtRSI, emlrtRootTLSGlobal); } else { emlrtPushRtStackR2012b(&ol_emlrtRSI, emlrtRootTLSGlobal); overflow = (vwork->size[0] > 2147483646); if (overflow) { emlrtPushRtStackR2012b(&lc_emlrtRSI, emlrtRootTLSGlobal); check_forloop_overflow_error(); emlrtPopRtStackR2012b(&lc_emlrtRSI, emlrtRootTLSGlobal); } emlrtPopRtStackR2012b(&ol_emlrtRSI, emlrtRootTLSGlobal); for (k = 1; k <= vwork->size[0]; k++) { iidx->data[k - 1] = k; } for (k = 1; k <= vwork->size[0] - 1; k += 2) { if ((vwork->data[k - 1] <= vwork->data[k]) || muDoubleScalarIsNaN (vwork->data[k])) { overflow = TRUE; } else { overflow = FALSE; } if (overflow) { } else { iidx->data[k - 1] = k + 1; iidx->data[k] = k; } } i2 = idx0->size[0]; idx0->size[0] = vwork->size[0]; emxEnsureCapacity((emxArray__common *)idx0, i2, (int32_T)sizeof(int32_T), &gc_emlrtRTEI); ix = vwork->size[0]; for (i2 = 0; i2 < ix; i2++) { idx0->data[i2] = 1; } ix = 2; while (ix < vwork->size[0]) { i2 = ix << 1; b_j = 1; for (pEnd = 1 + ix; pEnd < vwork->size[0] + 1; pEnd = qEnd + ix) { p = b_j; q = pEnd - 1; qEnd = b_j + i2; if (qEnd > vwork->size[0] + 1) { qEnd = vwork->size[0] + 1; } k = 0; kEnd = qEnd - b_j; while (k + 1 <= kEnd) { if ((vwork->data[iidx->data[p - 1] - 1] <= vwork->data[iidx-> data[q] - 1]) || muDoubleScalarIsNaN(vwork->data[iidx->data[q] - 1])) { overflow = TRUE; } else { overflow = FALSE; } if (overflow) { idx0->data[k] = iidx->data[p - 1]; p++; if (p == pEnd) { while (q + 1 < qEnd) { k++; idx0->data[k] = iidx->data[q]; q++; } } } else { idx0->data[k] = iidx->data[q]; q++; if (q + 1 == qEnd) { while (p < pEnd) { k++; idx0->data[k] = iidx->data[p - 1]; p++; } } } k++; } emlrtPushRtStackR2012b(&pl_emlrtRSI, emlrtRootTLSGlobal); emlrtPopRtStackR2012b(&pl_emlrtRSI, emlrtRootTLSGlobal); for (k = 0; k + 1 <= kEnd; k++) { iidx->data[(b_j + k) - 1] = idx0->data[k]; } b_j = qEnd; } ix = i2; } } emlrtPopRtStackR2012b(&fl_emlrtRSI, emlrtRootTLSGlobal); ix = i1 - 1; for (k = 0; k < x->size[dim]; k++) { y->data[ix] = vwork->data[iidx->data[k] - 1]; idx->data[ix] = iidx->data[k]; ix += vstride; } } i++; } emxFree_int32_T(&idx0); emxFree_int32_T(&iidx); emxFree_real_T(&vwork); emlrtHeapReferenceStackLeaveFcnR2012b(emlrtRootTLSGlobal); } void b_eml_li_find(const emxArray_boolean_T *x, emxArray_int32_T *y) { int32_T n; int32_T k; boolean_T b13; int32_T i; const mxArray *b_y; const mxArray *m18; int32_T j; n = x->size[0] * x->size[1]; emlrtPushRtStackR2012b(&rc_emlrtRSI, emlrtRootTLSGlobal); k = 0; emlrtPushRtStackR2012b(&uc_emlrtRSI, emlrtRootTLSGlobal); if (1 > n) { b13 = FALSE; } else { b13 = (n > 2147483646); } if (b13) { emlrtPushRtStackR2012b(&lc_emlrtRSI, emlrtRootTLSGlobal); check_forloop_overflow_error(); emlrtPopRtStackR2012b(&lc_emlrtRSI, emlrtRootTLSGlobal); } emlrtPopRtStackR2012b(&uc_emlrtRSI, emlrtRootTLSGlobal); for (i = 1; i <= n; i++) { if (x->data[i - 1]) { k++; } } emlrtPopRtStackR2012b(&rc_emlrtRSI, emlrtRootTLSGlobal); if (k <= n) { } else { emlrtPushRtStackR2012b(&sc_emlrtRSI, emlrtRootTLSGlobal); b_y = NULL; m18 = mxCreateString("Assertion failed."); emlrtAssign(&b_y, m18); error(b_y, &m_emlrtMCI); emlrtPopRtStackR2012b(&sc_emlrtRSI, emlrtRootTLSGlobal); } j = y->size[0]; y->size[0] = k; emxEnsureCapacity((emxArray__common *)y, j, (int32_T)sizeof(int32_T), &kc_emlrtRTEI); j = 0; emlrtPushRtStackR2012b(&tc_emlrtRSI, emlrtRootTLSGlobal); emlrtPopRtStackR2012b(&tc_emlrtRSI, emlrtRootTLSGlobal); for (i = 1; i <= n; i++) { if (x->data[i - 1]) { y->data[j] = i; j++; } } } void cholcov_(const emxArray_real_T *Sigma, emxArray_real_T *T, real_T *p) { emxArray_real_T *V; emxArray_real_T *b_V; int32_T cindx; int32_T loop_ub; boolean_T overflow; const mxArray *y; static const int32_T iv36[2] = { 1, 36 }; const mxArray *m9; char_T cv42[36]; int32_T i; static const char_T cv43[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 *b_y; static const int32_T iv37[2] = { 1, 39 }; char_T cv44[39]; static const char_T cv45[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' }; uint32_T outsz[2]; real_T maxval_data[1]; int32_T ix; int32_T iy; int32_T colj; int32_T nmj; real_T ajj; boolean_T b_ix; int32_T info; boolean_T exitg4; boolean_T b_colj; int32_T b_Sigma[2]; int32_T c_V[2]; emxArray_real_T *c_Sigma; emxArray_boolean_T *negloc; real_T b_maxval_data[1]; int32_T maxval_size[2]; int32_T b_maxval_size[2]; boolean_T x_data[1]; int32_T x_size[2]; emxArray_boolean_T b_x_data; const mxArray *c_y; static const int32_T iv38[2] = { 1, 19 }; char_T cv46[19]; static const char_T cv47[19] = { 'C', 'o', 'd', 'e', 'r', ':', 'M', 'A', 'T', 'L', 'A', 'B', ':', 's', 'q', 'u', 'a', 'r', 'e' }; boolean_T exitg3; ptrdiff_t n_t; ptrdiff_t incx_t; ptrdiff_t incy_t; double * xix0_t; double * yiy0_t; boolean_T b1; real_T ndbl; real_T cdiff; char_T TRANSA; ptrdiff_t m_t; ptrdiff_t lda_t; double * alpha1_t; double * beta1_t; double * yix0_t; boolean_T b2; boolean_T b3; boolean_T b_loop_ub; const mxArray *d_y; emxArray_real_T *b_T; emxArray_real_T *d_Sigma; emxArray_creal_T *U; emxArray_creal_T *D; emxArray_real_T *b_U; emxArray_real_T *b_D; emxArray_real_T *c_D; emxArray_real_T *d_D; emxArray_real_T *tol; emxArray_real_T *e_Sigma; emxArray_real_T *e_D; emxArray_int32_T *iidx; emxArray_real_T *b_tol; const mxArray *e_y; static const int32_T iv39[2] = { 1, 39 }; emxArray_int32_T *iindx; boolean_T c_ix; boolean_T exitg2; boolean_T c_colj; emxArray_real_T *indx; real_T f_y; const mxArray *g_y; static const int32_T iv40[2] = { 1, 21 }; char_T cv48[21]; static const char_T cv49[21] = { 'C', 'o', 'd', 'e', 'r', ':', 'M', 'A', 'T', 'L', 'A', 'B', ':', 'p', 'm', 'a', 'x', 's', 'i', 'z', 'e' }; emxArray_real_T *r24; emxArray_int32_T *r25; emxArray_int32_T *r26; emxArray_int32_T *r27; emxArray_int32_T *r28; int32_T iv41[2]; const mxArray *h_y; static const int32_T iv42[2] = { 1, 36 }; const mxArray *i_y; static const int32_T iv43[2] = { 1, 39 }; boolean_T d_ix; boolean_T exitg1; boolean_T d_colj; int32_T c_maxval_size[2]; emxArray_real_T *maxval; emxArray_boolean_T *t_; emxArray_boolean_T *x; const mxArray *j_y; static const int32_T iv44[2] = { 1, 30 }; char_T cv50[30]; static const char_T cv51[30] = { 'C', 'o', 'd', 'e', 'r', ':', 't', 'o', 'o', 'l', 'b', 'o', 'x', ':', 's', 'u', 'm', '_', 's', 'p', 'e', 'c', 'i', 'a', 'l', 'E', 'm', 'p', 't', 'y' }; const mxArray *k_y; static const int32_T iv45[2] = { 1, 36 }; emxArray_real_T *b_x; emxArray_real_T *b; const mxArray *l_y; static const int32_T iv46[2] = { 1, 45 }; char_T cv52[45]; static const char_T cv53[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 *m_y; static const int32_T iv47[2] = { 1, 21 }; static const char_T cv54[21] = { 'C', 'o', 'd', 'e', 'r', ':', 'M', 'A', 'T', 'L', 'A', 'B', ':', 'i', 'n', 'n', 'e', 'r', 'd', 'i', 'm' }; emxArray_real_T *n_y; emxArray_real_T *r29; char_T TRANSB; ptrdiff_t ldc_t; emlrtHeapReferenceStackEnterFcnR2012b(emlrtRootTLSGlobal); b_emxInit_real_T(&V, 2, &qb_emlrtRTEI, TRUE); b_emxInit_real_T(&b_V, 2, &kb_emlrtRTEI, TRUE); /* CHOLCOV Cholesky-like decomposition for covariance matrix. */ /* T = CHOLCOV(SIGMA) computes T such that SIGMA = T'*T. SIGMA must be */ /* square, symmetric, and positive semi-definite. If SIGMA is positive */ /* definite, then T is the square, upper triangular Cholesky factor. */ /* */ /* If SIGMA is not positive definite, T is computed from an eigenvalue */ /* decomposition of SIGMA. T is not necessarily triangular or square in */ /* this case. Any eigenvectors whose corresponding eigenvalue is close to */ /* zero (within a small tolerance) are omitted. If any remaining */ /* eigenvalues are negative, T is empty. */ /* */ /* [T,P] = CHOLCOV(SIGMA) returns the number of negative eigenvalues of */ /* SIGMA, and T is empty if P>0. If P==0, SIGMA is positive semi-definite. */ /* */ /* If SIGMA is not square and symmetric, P is NaN and T is empty. */ /* */ /* [T,P] = CHOLCOV(SIGMA,0) returns P==0 if SIGMA is positive definite, and */ /* T is the Cholesky factor. If SIGMA is not positive definite, P is a */ /* positive integer and T is empty. [...] = CHOLCOV(SIGMA,1) is equivalent */ /* to [...] = CHOLCOV(SIGMA). */ /* */ /* Example: */ /* Factor a rank-deficient covariance matrix C. */ /* C = [2 1 1 2;1 2 1 2;1 1 2 2;2 2 2 3] */ /* T = cholcov(C) */ /* C2 = T'*T */ /* Generate data with this covariance (aside from random variation). */ /* C3 = cov(randn(10000,3)*T) */ /* */ /* See also CHOL. */ /* Copyright 1993-2009 The MathWorks, Inc. */ /* Test for square, symmetric */ emlrtPushRtStackR2012b(&mf_emlrtRSI, emlrtRootTLSGlobal); diag(Sigma, V); cindx = b_V->size[0] * b_V->size[1]; b_V->size[0] = V->size[0]; b_V->size[1] = V->size[1]; emxEnsureCapacity((emxArray__common *)b_V, cindx, (int32_T)sizeof(real_T), &kb_emlrtRTEI); loop_ub = V->size[0] * V->size[1]; for (cindx = 0; cindx < loop_ub; cindx++) { b_V->data[cindx] = V->data[cindx]; } b_abs(b_V, V); emlrtPushRtStackR2012b(&eg_emlrtRSI, emlrtRootTLSGlobal); emlrtPushRtStackR2012b(&fg_emlrtRSI, emlrtRootTLSGlobal); emxFree_real_T(&b_V); if (((V->size[0] == 1) && (V->size[1] == 1)) || (V->size[0] != 1)) { overflow = TRUE; } else { overflow = FALSE; } if (overflow) { } else { emlrtPushRtStackR2012b(&gg_emlrtRSI, emlrtRootTLSGlobal); y = NULL; m9 = mxCreateCharArray(2, iv36); for (i = 0; i < 36; i++) { cv42[i] = cv43[i]; } emlrtInitCharArrayR2013a(emlrtRootTLSGlobal, 36, m9, cv42); emlrtAssign(&y, m9); error(message(y, &kb_emlrtMCI), &lb_emlrtMCI); emlrtPopRtStackR2012b(&gg_emlrtRSI, emlrtRootTLSGlobal); } if (V->size[0] > 0) { } else { emlrtPushRtStackR2012b(&hg_emlrtRSI, emlrtRootTLSGlobal); b_y = NULL; m9 = mxCreateCharArray(2, iv37); for (i = 0; i < 39; i++) { cv44[i] = cv45[i]; } emlrtInitCharArrayR2013a(emlrtRootTLSGlobal, 39, m9, cv44); emlrtAssign(&b_y, m9); error(message(b_y, &mb_emlrtMCI), &nb_emlrtMCI); emlrtPopRtStackR2012b(&hg_emlrtRSI, emlrtRootTLSGlobal); } for (cindx = 0; cindx < 2; cindx++) { outsz[cindx] = (uint32_T)V->size[cindx]; } ix = 0; iy = -1; emlrtPushRtStackR2012b(&ig_emlrtRSI, emlrtRootTLSGlobal); if (1 > V->size[1]) { overflow = FALSE; } else { overflow = (V->size[1] > 2147483646); } if (overflow) { emlrtPushRtStackR2012b(&lc_emlrtRSI, emlrtRootTLSGlobal); check_forloop_overflow_error(); emlrtPopRtStackR2012b(&lc_emlrtRSI, emlrtRootTLSGlobal); } emlrtPopRtStackR2012b(&ig_emlrtRSI, emlrtRootTLSGlobal); for (i = 1; i <= V->size[1]; i++) { emlrtPushRtStackR2012b(&jg_emlrtRSI, emlrtRootTLSGlobal); colj = ix; nmj = ix + V->size[0]; ajj = V->data[ix]; if (V->size[0] > 1) { if (muDoubleScalarIsNaN(V->data[ix])) { emlrtPushRtStackR2012b(&lg_emlrtRSI, emlrtRootTLSGlobal); if (ix + 2 > nmj) { b_ix = FALSE; } else { b_ix = (nmj > 2147483646); } if (b_ix) { emlrtPushRtStackR2012b(&lc_emlrtRSI, emlrtRootTLSGlobal); check_forloop_overflow_error(); emlrtPopRtStackR2012b(&lc_emlrtRSI, emlrtRootTLSGlobal); } emlrtPopRtStackR2012b(&lg_emlrtRSI, emlrtRootTLSGlobal); info = ix + 1; exitg4 = FALSE; while ((exitg4 == FALSE) && (info + 1 <= nmj)) { colj = info; if (!muDoubleScalarIsNaN(V->data[info])) { ajj = V->data[info]; exitg4 = TRUE; } else { info++; } } } if (colj + 1 < nmj) { emlrtPushRtStackR2012b(&kg_emlrtRSI, emlrtRootTLSGlobal); if (colj + 2 > nmj) { b_colj = FALSE; } else { b_colj = (nmj > 2147483646); } if (b_colj) { emlrtPushRtStackR2012b(&lc_emlrtRSI, emlrtRootTLSGlobal); check_forloop_overflow_error(); emlrtPopRtStackR2012b(&lc_emlrtRSI, emlrtRootTLSGlobal); } emlrtPopRtStackR2012b(&kg_emlrtRSI, emlrtRootTLSGlobal); for (info = colj + 1; info + 1 <= nmj; info++) { if (V->data[info] > ajj) { ajj = V->data[info]; } } } } emlrtPopRtStackR2012b(&jg_emlrtRSI, emlrtRootTLSGlobal); iy++; maxval_data[iy] = ajj; ix += V->size[0]; } emlrtPopRtStackR2012b(&fg_emlrtRSI, emlrtRootTLSGlobal); emlrtPopRtStackR2012b(&eg_emlrtRSI, emlrtRootTLSGlobal); emlrtPopRtStackR2012b(&mf_emlrtRSI, emlrtRootTLSGlobal); cindx = V->size[0] * V->size[1]; V->size[0] = Sigma->size[1]; V->size[1] = Sigma->size[0]; emxEnsureCapacity((emxArray__common *)V, cindx, (int32_T)sizeof(real_T), &kb_emlrtRTEI); loop_ub = Sigma->size[0]; for (cindx = 0; cindx < loop_ub; cindx++) { nmj = Sigma->size[1]; for (info = 0; info < nmj; info++) { V->data[info + V->size[0] * cindx] = Sigma->data[cindx + Sigma->size[0] * info]; } } for (cindx = 0; cindx < 2; cindx++) { b_Sigma[cindx] = Sigma->size[cindx]; } for (cindx = 0; cindx < 2; cindx++) { c_V[cindx] = V->size[cindx]; } b_emxInit_real_T(&c_Sigma, 2, &kb_emlrtRTEI, TRUE); emlrtSizeEqCheck2DFastR2012b(b_Sigma, c_V, &lb_emlrtECI, emlrtRootTLSGlobal); emlrtPushRtStackR2012b(&nf_emlrtRSI, emlrtRootTLSGlobal); cindx = c_Sigma->size[0] * c_Sigma->size[1]; c_Sigma->size[0] = Sigma->size[0]; c_Sigma->size[1] = Sigma->size[1]; emxEnsureCapacity((emxArray__common *)c_Sigma, cindx, (int32_T)sizeof(real_T), &kb_emlrtRTEI); loop_ub = Sigma->size[0] * Sigma->size[1]; for (cindx = 0; cindx < loop_ub; cindx++) { c_Sigma->data[cindx] = Sigma->data[cindx] - V->data[cindx]; } emxInit_boolean_T(&negloc, 2, &mb_emlrtRTEI, TRUE); all(c_Sigma, negloc); overflow = b_all(negloc); maxval_size[0] = 1; maxval_size[1] = (int32_T)outsz[1]; loop_ub = (int32_T)outsz[1]; emxFree_real_T(&c_Sigma); for (cindx = 0; cindx < loop_ub; cindx++) { b_maxval_data[cindx] = maxval_data[cindx]; } eps(b_maxval_data, maxval_size, maxval_data, b_maxval_size); x_size[0] = 1; x_size[1] = b_maxval_size[1]; loop_ub = b_maxval_size[0] * b_maxval_size[1]; for (cindx = 0; cindx < loop_ub; cindx++) { x_data[cindx] = (overflow < 10.0 * maxval_data[cindx]); } b_x_data.data = (boolean_T *)&x_data; b_x_data.size = (int32_T *)&x_size; b_x_data.allocatedSize = 1; b_x_data.numDimensions = 2; b_x_data.canFreeData = FALSE; overflow = b_all(&b_x_data); emlrtPopRtStackR2012b(&nf_emlrtRSI, emlrtRootTLSGlobal); if (overflow == 1) { /* abs(all(all(Sigma - Sigma')))size[0] * T->size[1]; T->size[0] = Sigma->size[0]; T->size[1] = Sigma->size[1]; emxEnsureCapacity((emxArray__common *)T, cindx, (int32_T)sizeof(real_T), &kb_emlrtRTEI); loop_ub = Sigma->size[0] * Sigma->size[1]; for (cindx = 0; cindx < loop_ub; cindx++) { T->data[cindx] = Sigma->data[cindx]; } overflow = (Sigma->size[0] == Sigma->size[1]); if (overflow) { } else { emlrtPushRtStackR2012b(&pg_emlrtRSI, emlrtRootTLSGlobal); c_y = NULL; m9 = mxCreateCharArray(2, iv38); for (i = 0; i < 19; i++) { cv46[i] = cv47[i]; } emlrtInitCharArrayR2013a(emlrtRootTLSGlobal, 19, m9, cv46); emlrtAssign(&c_y, m9); error(message(c_y, &ob_emlrtMCI), &pb_emlrtMCI); emlrtPopRtStackR2012b(&pg_emlrtRSI, emlrtRootTLSGlobal); } colj = 0; if (Sigma->size[1] == 0) { } else { emlrtPushRtStackR2012b(&qg_emlrtRSI, emlrtRootTLSGlobal); emlrtPushRtStackR2012b(&gh_emlrtRSI, emlrtRootTLSGlobal); emlrtPushRtStackR2012b(&hh_emlrtRSI, emlrtRootTLSGlobal); info = -1; if ((Sigma->size[0] == 0) || (Sigma->size[1] == 0)) { } else { colj = 0; emlrtPushRtStackR2012b(&ih_emlrtRSI, emlrtRootTLSGlobal); overflow = (Sigma->size[0] > 2147483646); if (overflow) { emlrtPushRtStackR2012b(&lc_emlrtRSI, emlrtRootTLSGlobal); check_forloop_overflow_error(); emlrtPopRtStackR2012b(&lc_emlrtRSI, emlrtRootTLSGlobal); } emlrtPopRtStackR2012b(&ih_emlrtRSI, emlrtRootTLSGlobal); loop_ub = 0; exitg3 = FALSE; while ((exitg3 == FALSE) && (loop_ub + 1 <= Sigma->size[0])) { ix = colj + loop_ub; emlrtPushRtStackR2012b(&jh_emlrtRSI, emlrtRootTLSGlobal); emlrtPushRtStackR2012b(&ug_emlrtRSI, emlrtRootTLSGlobal); emlrtPushRtStackR2012b(&vg_emlrtRSI, emlrtRootTLSGlobal); if (loop_ub < 1) { ajj = 0.0; } else { emlrtPushRtStackR2012b(&xg_emlrtRSI, emlrtRootTLSGlobal); emlrtPushRtStackR2012b(&bh_emlrtRSI, emlrtRootTLSGlobal); emlrtPushRtStackR2012b(&af_emlrtRSI, emlrtRootTLSGlobal); n_t = (ptrdiff_t)(loop_ub); emlrtPopRtStackR2012b(&af_emlrtRSI, emlrtRootTLSGlobal); emlrtPopRtStackR2012b(&bh_emlrtRSI, emlrtRootTLSGlobal); emlrtPushRtStackR2012b(&ch_emlrtRSI, emlrtRootTLSGlobal); emlrtPushRtStackR2012b(&af_emlrtRSI, emlrtRootTLSGlobal); incx_t = (ptrdiff_t)(1); emlrtPopRtStackR2012b(&af_emlrtRSI, emlrtRootTLSGlobal); emlrtPopRtStackR2012b(&ch_emlrtRSI, emlrtRootTLSGlobal); emlrtPushRtStackR2012b(&dh_emlrtRSI, emlrtRootTLSGlobal); emlrtPushRtStackR2012b(&af_emlrtRSI, emlrtRootTLSGlobal); incy_t = (ptrdiff_t)(1); emlrtPopRtStackR2012b(&af_emlrtRSI, emlrtRootTLSGlobal); emlrtPopRtStackR2012b(&dh_emlrtRSI, emlrtRootTLSGlobal); emlrtPushRtStackR2012b(&eh_emlrtRSI, emlrtRootTLSGlobal); xix0_t = (double *)(&T->data[colj]); emlrtPopRtStackR2012b(&eh_emlrtRSI, emlrtRootTLSGlobal); emlrtPushRtStackR2012b(&fh_emlrtRSI, emlrtRootTLSGlobal); yiy0_t = (double *)(&T->data[colj]); emlrtPopRtStackR2012b(&fh_emlrtRSI, emlrtRootTLSGlobal); ajj = ddot(&n_t, xix0_t, &incx_t, yiy0_t, &incy_t); emlrtPopRtStackR2012b(&xg_emlrtRSI, emlrtRootTLSGlobal); } emlrtPopRtStackR2012b(&vg_emlrtRSI, emlrtRootTLSGlobal); emlrtPopRtStackR2012b(&ug_emlrtRSI, emlrtRootTLSGlobal); ajj = T->data[ix] - ajj; emlrtPopRtStackR2012b(&jh_emlrtRSI, emlrtRootTLSGlobal); if (ajj > 0.0) { ajj = muDoubleScalarSqrt(ajj); T->data[ix] = ajj; if (loop_ub + 1 < Sigma->size[0]) { nmj = (Sigma->size[0] - loop_ub) - 1; ix += Sigma->size[0]; iy = colj + Sigma->size[0]; emlrtPushRtStackR2012b(&kh_emlrtRSI, emlrtRootTLSGlobal); if (1 > loop_ub) { b1 = FALSE; } else { b1 = (loop_ub > 2147483646); } if (b1) { emlrtPushRtStackR2012b(&lc_emlrtRSI, emlrtRootTLSGlobal); check_forloop_overflow_error(); emlrtPopRtStackR2012b(&lc_emlrtRSI, emlrtRootTLSGlobal); } emlrtPopRtStackR2012b(&kh_emlrtRSI, emlrtRootTLSGlobal); emlrtPushRtStackR2012b(&lh_emlrtRSI, emlrtRootTLSGlobal); emlrtPushRtStackR2012b(&oh_emlrtRSI, emlrtRootTLSGlobal); if ((loop_ub < 1) || (nmj < 1)) { } else { emlrtPushRtStackR2012b(&qh_emlrtRSI, emlrtRootTLSGlobal); ndbl = -1.0; cdiff = 1.0; TRANSA = 'T'; emlrtPushRtStackR2012b(&th_emlrtRSI, emlrtRootTLSGlobal); emlrtPushRtStackR2012b(&af_emlrtRSI, emlrtRootTLSGlobal); m_t = (ptrdiff_t)(loop_ub); emlrtPopRtStackR2012b(&af_emlrtRSI, emlrtRootTLSGlobal); emlrtPopRtStackR2012b(&th_emlrtRSI, emlrtRootTLSGlobal); emlrtPushRtStackR2012b(&uh_emlrtRSI, emlrtRootTLSGlobal); emlrtPushRtStackR2012b(&af_emlrtRSI, emlrtRootTLSGlobal); n_t = (ptrdiff_t)(nmj); emlrtPopRtStackR2012b(&af_emlrtRSI, emlrtRootTLSGlobal); emlrtPopRtStackR2012b(&uh_emlrtRSI, emlrtRootTLSGlobal); emlrtPushRtStackR2012b(&vh_emlrtRSI, emlrtRootTLSGlobal); emlrtPushRtStackR2012b(&af_emlrtRSI, emlrtRootTLSGlobal); lda_t = (ptrdiff_t)(Sigma->size[1]); emlrtPopRtStackR2012b(&af_emlrtRSI, emlrtRootTLSGlobal); emlrtPopRtStackR2012b(&vh_emlrtRSI, emlrtRootTLSGlobal); emlrtPushRtStackR2012b(&wh_emlrtRSI, emlrtRootTLSGlobal); emlrtPushRtStackR2012b(&af_emlrtRSI, emlrtRootTLSGlobal); incx_t = (ptrdiff_t)(1); emlrtPopRtStackR2012b(&af_emlrtRSI, emlrtRootTLSGlobal); emlrtPopRtStackR2012b(&wh_emlrtRSI, emlrtRootTLSGlobal); emlrtPushRtStackR2012b(&xh_emlrtRSI, emlrtRootTLSGlobal); emlrtPushRtStackR2012b(&af_emlrtRSI, emlrtRootTLSGlobal); incy_t = (ptrdiff_t)(Sigma->size[1]); emlrtPopRtStackR2012b(&af_emlrtRSI, emlrtRootTLSGlobal); emlrtPopRtStackR2012b(&xh_emlrtRSI, emlrtRootTLSGlobal); emlrtPushRtStackR2012b(&yh_emlrtRSI, emlrtRootTLSGlobal); alpha1_t = (double *)(&ndbl); emlrtPopRtStackR2012b(&yh_emlrtRSI, emlrtRootTLSGlobal); emlrtPushRtStackR2012b(&ai_emlrtRSI, emlrtRootTLSGlobal); beta1_t = (double *)(&cdiff); emlrtPopRtStackR2012b(&ai_emlrtRSI, emlrtRootTLSGlobal); emlrtPushRtStackR2012b(&bi_emlrtRSI, emlrtRootTLSGlobal); yiy0_t = (double *)(&T->data[ix]); emlrtPopRtStackR2012b(&bi_emlrtRSI, emlrtRootTLSGlobal); emlrtPushRtStackR2012b(&ci_emlrtRSI, emlrtRootTLSGlobal); yix0_t = (double *)(&T->data[colj]); emlrtPopRtStackR2012b(&ci_emlrtRSI, emlrtRootTLSGlobal); emlrtPushRtStackR2012b(&di_emlrtRSI, emlrtRootTLSGlobal); xix0_t = (double *)(&T->data[iy]); emlrtPopRtStackR2012b(&di_emlrtRSI, emlrtRootTLSGlobal); emlrtPushRtStackR2012b(&ei_emlrtRSI, emlrtRootTLSGlobal); dgemv(&TRANSA, &m_t, &n_t, alpha1_t, xix0_t, &lda_t, yix0_t, &incx_t, beta1_t, yiy0_t, &incy_t); emlrtPopRtStackR2012b(&ei_emlrtRSI, emlrtRootTLSGlobal); emlrtPopRtStackR2012b(&qh_emlrtRSI, emlrtRootTLSGlobal); } emlrtPopRtStackR2012b(&oh_emlrtRSI, emlrtRootTLSGlobal); emlrtPopRtStackR2012b(&lh_emlrtRSI, emlrtRootTLSGlobal); emlrtPushRtStackR2012b(&mh_emlrtRSI, emlrtRootTLSGlobal); if (1 > loop_ub) { b2 = FALSE; } else { b2 = (loop_ub > 2147483646); } if (b2) { emlrtPushRtStackR2012b(&lc_emlrtRSI, emlrtRootTLSGlobal); check_forloop_overflow_error(); emlrtPopRtStackR2012b(&lc_emlrtRSI, emlrtRootTLSGlobal); } emlrtPopRtStackR2012b(&mh_emlrtRSI, emlrtRootTLSGlobal); emlrtPushRtStackR2012b(&nh_emlrtRSI, emlrtRootTLSGlobal); ajj = 1.0 / ajj; emlrtPushRtStackR2012b(&fi_emlrtRSI, emlrtRootTLSGlobal); if (nmj < 1) { } else { emlrtPushRtStackR2012b(&hi_emlrtRSI, emlrtRootTLSGlobal); emlrtPushRtStackR2012b(&ji_emlrtRSI, emlrtRootTLSGlobal); emlrtPushRtStackR2012b(&af_emlrtRSI, emlrtRootTLSGlobal); n_t = (ptrdiff_t)(nmj); emlrtPopRtStackR2012b(&af_emlrtRSI, emlrtRootTLSGlobal); emlrtPopRtStackR2012b(&ji_emlrtRSI, emlrtRootTLSGlobal); emlrtPushRtStackR2012b(&ki_emlrtRSI, emlrtRootTLSGlobal); emlrtPushRtStackR2012b(&af_emlrtRSI, emlrtRootTLSGlobal); incx_t = (ptrdiff_t)(Sigma->size[0]); emlrtPopRtStackR2012b(&af_emlrtRSI, emlrtRootTLSGlobal); emlrtPopRtStackR2012b(&ki_emlrtRSI, emlrtRootTLSGlobal); emlrtPushRtStackR2012b(&li_emlrtRSI, emlrtRootTLSGlobal); xix0_t = (double *)(&T->data[ix]); emlrtPopRtStackR2012b(&li_emlrtRSI, emlrtRootTLSGlobal); emlrtPushRtStackR2012b(&mi_emlrtRSI, emlrtRootTLSGlobal); yix0_t = (double *)(&ajj); emlrtPopRtStackR2012b(&mi_emlrtRSI, emlrtRootTLSGlobal); emlrtPushRtStackR2012b(&ni_emlrtRSI, emlrtRootTLSGlobal); dscal(&n_t, yix0_t, xix0_t, &incx_t); emlrtPopRtStackR2012b(&ni_emlrtRSI, emlrtRootTLSGlobal); emlrtPopRtStackR2012b(&hi_emlrtRSI, emlrtRootTLSGlobal); } emlrtPopRtStackR2012b(&fi_emlrtRSI, emlrtRootTLSGlobal); emlrtPopRtStackR2012b(&nh_emlrtRSI, emlrtRootTLSGlobal); colj = iy; } loop_ub++; } else { T->data[ix] = ajj; info = loop_ub; exitg3 = TRUE; } } } emlrtPopRtStackR2012b(&hh_emlrtRSI, emlrtRootTLSGlobal); emlrtPopRtStackR2012b(&gh_emlrtRSI, emlrtRootTLSGlobal); emlrtPopRtStackR2012b(&qg_emlrtRSI, emlrtRootTLSGlobal); colj = info + 1; if (info + 1 == 0) { iy = Sigma->size[1]; } else { iy = info; } emlrtPushRtStackR2012b(&rg_emlrtRSI, emlrtRootTLSGlobal); if (1 > iy) { b3 = FALSE; } else { b3 = (iy > 2147483646); } if (b3) { emlrtPushRtStackR2012b(&lc_emlrtRSI, emlrtRootTLSGlobal); check_forloop_overflow_error(); emlrtPopRtStackR2012b(&lc_emlrtRSI, emlrtRootTLSGlobal); } emlrtPopRtStackR2012b(&rg_emlrtRSI, emlrtRootTLSGlobal); for (loop_ub = 2; loop_ub - 1 <= iy; loop_ub++) { emlrtPushRtStackR2012b(&sg_emlrtRSI, emlrtRootTLSGlobal); if (loop_ub > iy) { b_loop_ub = FALSE; } else { b_loop_ub = (iy > 2147483646); } if (b_loop_ub) { emlrtPushRtStackR2012b(&lc_emlrtRSI, emlrtRootTLSGlobal); check_forloop_overflow_error(); emlrtPopRtStackR2012b(&lc_emlrtRSI, emlrtRootTLSGlobal); } emlrtPopRtStackR2012b(&sg_emlrtRSI, emlrtRootTLSGlobal); for (i = loop_ub; i <= iy; i++) { T->data[(i + T->size[0] * (loop_ub - 2)) - 1] = 0.0; } } if ((iy <= Sigma->size[0]) && (iy <= Sigma->size[1])) { overflow = TRUE; } else { overflow = FALSE; } if (overflow) { } else { emlrtPushRtStackR2012b(&tg_emlrtRSI, emlrtRootTLSGlobal); d_y = NULL; m9 = mxCreateString("Assertion failed."); emlrtAssign(&d_y, m9); error(d_y, &qb_emlrtMCI); emlrtPopRtStackR2012b(&tg_emlrtRSI, emlrtRootTLSGlobal); } if (1 > iy) { loop_ub = 0; } else { loop_ub = iy; } if (1 > iy) { nmj = 0; } else { nmj = iy; } b_emxInit_real_T(&b_T, 2, &kb_emlrtRTEI, TRUE); cindx = b_T->size[0] * b_T->size[1]; b_T->size[0] = loop_ub; b_T->size[1] = nmj; emxEnsureCapacity((emxArray__common *)b_T, cindx, (int32_T)sizeof(real_T), &kb_emlrtRTEI); for (cindx = 0; cindx < nmj; cindx++) { for (info = 0; info < loop_ub; info++) { b_T->data[info + b_T->size[0] * cindx] = T->data[info + T->size[0] * cindx]; } } cindx = T->size[0] * T->size[1]; T->size[0] = b_T->size[0]; T->size[1] = b_T->size[1]; emxEnsureCapacity((emxArray__common *)T, cindx, (int32_T)sizeof(real_T), &kb_emlrtRTEI); loop_ub = b_T->size[1]; for (cindx = 0; cindx < loop_ub; cindx++) { nmj = b_T->size[0]; for (info = 0; info < nmj; info++) { T->data[info + T->size[0] * cindx] = b_T->data[info + b_T->size[0] * cindx]; } } emxFree_real_T(&b_T); } emlrtPopRtStackR2012b(&og_emlrtRSI, emlrtRootTLSGlobal); emlrtPopRtStackR2012b(&of_emlrtRSI, emlrtRootTLSGlobal); *p = colj; if (colj > 0) { /* Test for positive definiteness */ /* Can get factors of the form Sigma==T'*T using the eigenvalue */ /* decomposition of a symmetric matrix, so long as the matrix */ /* is positive semi-definite. */ cindx = V->size[0] * V->size[1]; V->size[0] = Sigma->size[1]; V->size[1] = Sigma->size[0]; emxEnsureCapacity((emxArray__common *)V, cindx, (int32_T)sizeof(real_T), &kb_emlrtRTEI); loop_ub = Sigma->size[0]; for (cindx = 0; cindx < loop_ub; cindx++) { nmj = Sigma->size[1]; for (info = 0; info < nmj; info++) { V->data[info + V->size[0] * cindx] = Sigma->data[cindx + Sigma->size[0] * info]; } } for (cindx = 0; cindx < 2; cindx++) { b_Sigma[cindx] = Sigma->size[cindx]; } for (cindx = 0; cindx < 2; cindx++) { c_V[cindx] = V->size[cindx]; } b_emxInit_real_T(&d_Sigma, 2, &kb_emlrtRTEI, TRUE); emlrtSizeEqCheck2DFastR2012b(b_Sigma, c_V, &kb_emlrtECI, emlrtRootTLSGlobal); emlrtPushRtStackR2012b(&pf_emlrtRSI, emlrtRootTLSGlobal); cindx = d_Sigma->size[0] * d_Sigma->size[1]; d_Sigma->size[0] = Sigma->size[0]; d_Sigma->size[1] = Sigma->size[1]; emxEnsureCapacity((emxArray__common *)d_Sigma, cindx, (int32_T)sizeof (real_T), &kb_emlrtRTEI); loop_ub = Sigma->size[0] * Sigma->size[1]; for (cindx = 0; cindx < loop_ub; cindx++) { d_Sigma->data[cindx] = (Sigma->data[cindx] + V->data[cindx]) / 2.0; } emxInit_creal_T(&U, 2, &kb_emlrtRTEI, TRUE); emxInit_creal_T(&D, 2, &kb_emlrtRTEI, TRUE); b_emxInit_real_T(&b_U, 2, &ob_emlrtRTEI, TRUE); eig(d_Sigma, U, D); emlrtPopRtStackR2012b(&pf_emlrtRSI, emlrtRootTLSGlobal); cindx = b_U->size[0] * b_U->size[1]; b_U->size[0] = U->size[0]; b_U->size[1] = U->size[1]; emxEnsureCapacity((emxArray__common *)b_U, cindx, (int32_T)sizeof(real_T), &kb_emlrtRTEI); loop_ub = U->size[0] * U->size[1]; emxFree_real_T(&d_Sigma); for (cindx = 0; cindx < loop_ub; cindx++) { b_U->data[cindx] = U->data[cindx].re; } b_emxInit_real_T(&b_D, 2, &kb_emlrtRTEI, TRUE); emlrtPushRtStackR2012b(&qf_emlrtRSI, emlrtRootTLSGlobal); cindx = b_D->size[0] * b_D->size[1]; b_D->size[0] = D->size[0]; b_D->size[1] = D->size[1]; emxEnsureCapacity((emxArray__common *)b_D, cindx, (int32_T)sizeof(real_T), &kb_emlrtRTEI); loop_ub = D->size[0] * D->size[1]; for (cindx = 0; cindx < loop_ub; cindx++) { b_D->data[cindx] = D->data[cindx].re; } b_emxInit_real_T(&c_D, 2, &pb_emlrtRTEI, TRUE); emxInit_real_T(&d_D, 1, &kb_emlrtRTEI, TRUE); diag(b_D, c_D); emlrtPopRtStackR2012b(&qf_emlrtRSI, emlrtRootTLSGlobal); cindx = c_D->size[1]; emlrtDynamicBoundsCheckFastR2012b(1, 1, cindx, &hd_emlrtBCI, emlrtRootTLSGlobal); emlrtPushRtStackR2012b(&rf_emlrtRSI, emlrtRootTLSGlobal); loop_ub = c_D->size[0]; cindx = d_D->size[0]; d_D->size[0] = loop_ub; emxEnsureCapacity((emxArray__common *)d_D, cindx, (int32_T)sizeof(real_T), &kb_emlrtRTEI); emxFree_real_T(&b_D); for (cindx = 0; cindx < loop_ub; cindx++) { d_D->data[cindx] = c_D->data[cindx]; } overflow = !issorted(d_D); emlrtPopRtStackR2012b(&rf_emlrtRSI, emlrtRootTLSGlobal); emxFree_real_T(&d_D); b_emxInit_real_T(&tol, 2, &rb_emlrtRTEI, TRUE); if (overflow) { cindx = V->size[0] * V->size[1]; V->size[0] = Sigma->size[1]; V->size[1] = Sigma->size[0]; emxEnsureCapacity((emxArray__common *)V, cindx, (int32_T)sizeof(real_T), &kb_emlrtRTEI); loop_ub = Sigma->size[0]; for (cindx = 0; cindx < loop_ub; cindx++) { nmj = Sigma->size[1]; for (info = 0; info < nmj; info++) { V->data[info + V->size[0] * cindx] = Sigma->data[cindx + Sigma-> size[0] * info]; } } for (cindx = 0; cindx < 2; cindx++) { b_Sigma[cindx] = Sigma->size[cindx]; } for (cindx = 0; cindx < 2; cindx++) { c_V[cindx] = V->size[cindx]; } b_emxInit_real_T(&e_Sigma, 2, &kb_emlrtRTEI, TRUE); emlrtSizeEqCheck2DFastR2012b(b_Sigma, c_V, &jb_emlrtECI, emlrtRootTLSGlobal); emlrtPushRtStackR2012b(&sf_emlrtRSI, emlrtRootTLSGlobal); cindx = e_Sigma->size[0] * e_Sigma->size[1]; e_Sigma->size[0] = Sigma->size[0]; e_Sigma->size[1] = Sigma->size[1]; emxEnsureCapacity((emxArray__common *)e_Sigma, cindx, (int32_T)sizeof (real_T), &kb_emlrtRTEI); loop_ub = Sigma->size[0] * Sigma->size[1]; for (cindx = 0; cindx < loop_ub; cindx++) { e_Sigma->data[cindx] = (Sigma->data[cindx] + V->data[cindx]) / 2.0; } eig(e_Sigma, U, D); emlrtPopRtStackR2012b(&sf_emlrtRSI, emlrtRootTLSGlobal); cindx = V->size[0] * V->size[1]; V->size[0] = U->size[0]; V->size[1] = U->size[1]; emxEnsureCapacity((emxArray__common *)V, cindx, (int32_T)sizeof(real_T), &kb_emlrtRTEI); loop_ub = U->size[0] * U->size[1]; emxFree_real_T(&e_Sigma); for (cindx = 0; cindx < loop_ub; cindx++) { V->data[cindx] = U->data[cindx].re; } emlrtPushRtStackR2012b(&tf_emlrtRSI, emlrtRootTLSGlobal); b_diag(D, U); cindx = c_D->size[0] * c_D->size[1]; c_D->size[0] = U->size[0]; c_D->size[1] = U->size[1]; emxEnsureCapacity((emxArray__common *)c_D, cindx, (int32_T)sizeof(real_T), &kb_emlrtRTEI); loop_ub = U->size[0] * U->size[1]; for (cindx = 0; cindx < loop_ub; cindx++) { c_D->data[cindx] = U->data[cindx].re; } b_emxInit_real_T(&e_D, 2, &kb_emlrtRTEI, TRUE); emlrtPopRtStackR2012b(&tf_emlrtRSI, emlrtRootTLSGlobal); emlrtPushRtStackR2012b(&uf_emlrtRSI, emlrtRootTLSGlobal); emlrtPushRtStackR2012b(&el_emlrtRSI, emlrtRootTLSGlobal); cindx = e_D->size[0] * e_D->size[1]; e_D->size[0] = c_D->size[0]; e_D->size[1] = c_D->size[1]; emxEnsureCapacity((emxArray__common *)e_D, cindx, (int32_T)sizeof(real_T), &kb_emlrtRTEI); loop_ub = c_D->size[0] * c_D->size[1]; for (cindx = 0; cindx < loop_ub; cindx++) { e_D->data[cindx] = c_D->data[cindx]; } b_emxInit_int32_T(&iidx, 2, &kb_emlrtRTEI, TRUE); eml_sort(e_D, c_D, iidx); emlrtPopRtStackR2012b(&el_emlrtRSI, emlrtRootTLSGlobal); cindx = tol->size[0] * tol->size[1]; tol->size[0] = iidx->size[0]; tol->size[1] = iidx->size[1]; emxEnsureCapacity((emxArray__common *)tol, cindx, (int32_T)sizeof(real_T), &kb_emlrtRTEI); loop_ub = iidx->size[0] * iidx->size[1]; emxFree_real_T(&e_D); for (cindx = 0; cindx < loop_ub; cindx++) { tol->data[cindx] = iidx->data[cindx]; } emxFree_int32_T(&iidx); b_emxInit_real_T(&b_tol, 2, &kb_emlrtRTEI, TRUE); emlrtPopRtStackR2012b(&uf_emlrtRSI, emlrtRootTLSGlobal); loop_ub = V->size[0]; cindx = b_tol->size[0] * b_tol->size[1]; b_tol->size[0] = tol->size[0]; b_tol->size[1] = tol->size[1]; emxEnsureCapacity((emxArray__common *)b_tol, cindx, (int32_T)sizeof (real_T), &kb_emlrtRTEI); nmj = tol->size[1]; for (cindx = 0; cindx < nmj; cindx++) { ix = tol->size[0]; for (info = 0; info < ix; info++) { iy = V->size[1]; colj = (int32_T)tol->data[info + tol->size[0] * cindx]; b_tol->data[info + b_tol->size[0] * cindx] = emlrtDynamicBoundsCheckFastR2012b(colj, 1, iy, &id_emlrtBCI, emlrtRootTLSGlobal); } } ix = tol->size[0] * tol->size[1]; cindx = b_U->size[0] * b_U->size[1]; b_U->size[0] = loop_ub; b_U->size[1] = ix; emxEnsureCapacity((emxArray__common *)b_U, cindx, (int32_T)sizeof(real_T), &kb_emlrtRTEI); for (cindx = 0; cindx < ix; cindx++) { for (info = 0; info < loop_ub; info++) { b_U->data[info + b_U->size[0] * cindx] = V->data[info + V->size[0] * ((int32_T)b_tol->data[cindx] - 1)]; } } emxFree_real_T(&b_tol); } emxFree_creal_T(&D); emxFree_creal_T(&U); /* Pick eigenvector direction so max abs coordinate is positive */ emlrtPushRtStackR2012b(&vf_emlrtRSI, emlrtRootTLSGlobal); b_abs(b_U, V); emlrtPushRtStackR2012b(&ql_emlrtRSI, emlrtRootTLSGlobal); emlrtPushRtStackR2012b(&rl_emlrtRSI, emlrtRootTLSGlobal); if (V->size[0] > 0) { } else { emlrtPushRtStackR2012b(&hg_emlrtRSI, emlrtRootTLSGlobal); e_y = NULL; m9 = mxCreateCharArray(2, iv39); for (i = 0; i < 39; i++) { cv44[i] = cv45[i]; } emlrtInitCharArrayR2013a(emlrtRootTLSGlobal, 39, m9, cv44); emlrtAssign(&e_y, m9); error(message(e_y, &mb_emlrtMCI), &nb_emlrtMCI); emlrtPopRtStackR2012b(&hg_emlrtRSI, emlrtRootTLSGlobal); } for (cindx = 0; cindx < 2; cindx++) { outsz[cindx] = (uint32_T)V->size[cindx]; } b_emxInit_int32_T(&iindx, 2, &kb_emlrtRTEI, TRUE); cindx = iindx->size[0] * iindx->size[1]; iindx->size[0] = 1; emxEnsureCapacity((emxArray__common *)iindx, cindx, (int32_T)sizeof (int32_T), &kb_emlrtRTEI); cindx = iindx->size[0] * iindx->size[1]; iindx->size[1] = (int32_T)outsz[1]; emxEnsureCapacity((emxArray__common *)iindx, cindx, (int32_T)sizeof (int32_T), &kb_emlrtRTEI); loop_ub = (int32_T)outsz[1]; for (cindx = 0; cindx < loop_ub; cindx++) { iindx->data[cindx] = 1; } ix = 0; iy = -1; emlrtPushRtStackR2012b(&ig_emlrtRSI, emlrtRootTLSGlobal); if (1 > V->size[1]) { overflow = FALSE; } else { overflow = (V->size[1] > 2147483646); } if (overflow) { emlrtPushRtStackR2012b(&lc_emlrtRSI, emlrtRootTLSGlobal); check_forloop_overflow_error(); emlrtPopRtStackR2012b(&lc_emlrtRSI, emlrtRootTLSGlobal); } emlrtPopRtStackR2012b(&ig_emlrtRSI, emlrtRootTLSGlobal); for (i = 1; i <= V->size[1]; i++) { emlrtPushRtStackR2012b(&jg_emlrtRSI, emlrtRootTLSGlobal); colj = ix; nmj = ix + V->size[0]; ajj = V->data[ix]; loop_ub = 1; if (V->size[0] > 1) { cindx = 1; if (muDoubleScalarIsNaN(V->data[ix])) { emlrtPushRtStackR2012b(&lg_emlrtRSI, emlrtRootTLSGlobal); if (ix + 2 > nmj) { c_ix = FALSE; } else { c_ix = (nmj > 2147483646); } if (c_ix) { emlrtPushRtStackR2012b(&lc_emlrtRSI, emlrtRootTLSGlobal); check_forloop_overflow_error(); emlrtPopRtStackR2012b(&lc_emlrtRSI, emlrtRootTLSGlobal); } emlrtPopRtStackR2012b(&lg_emlrtRSI, emlrtRootTLSGlobal); info = ix + 1; exitg2 = FALSE; while ((exitg2 == FALSE) && (info + 1 <= nmj)) { cindx++; colj = info; if (!muDoubleScalarIsNaN(V->data[info])) { ajj = V->data[info]; loop_ub = cindx; exitg2 = TRUE; } else { info++; } } } if (colj + 1 < nmj) { emlrtPushRtStackR2012b(&kg_emlrtRSI, emlrtRootTLSGlobal); if (colj + 2 > nmj) { c_colj = FALSE; } else { c_colj = (nmj > 2147483646); } if (c_colj) { emlrtPushRtStackR2012b(&lc_emlrtRSI, emlrtRootTLSGlobal); check_forloop_overflow_error(); emlrtPopRtStackR2012b(&lc_emlrtRSI, emlrtRootTLSGlobal); } emlrtPopRtStackR2012b(&kg_emlrtRSI, emlrtRootTLSGlobal); for (info = colj + 1; info + 1 <= nmj; info++) { cindx++; if (V->data[info] > ajj) { ajj = V->data[info]; loop_ub = cindx; } } } } emlrtPopRtStackR2012b(&jg_emlrtRSI, emlrtRootTLSGlobal); iy++; iindx->data[iy] = loop_ub; ix += V->size[0]; } b_emxInit_real_T(&indx, 2, &kb_emlrtRTEI, TRUE); emlrtPopRtStackR2012b(&rl_emlrtRSI, emlrtRootTLSGlobal); cindx = indx->size[0] * indx->size[1]; indx->size[0] = 1; indx->size[1] = iindx->size[1]; emxEnsureCapacity((emxArray__common *)indx, cindx, (int32_T)sizeof(real_T), &kb_emlrtRTEI); loop_ub = iindx->size[0] * iindx->size[1]; for (cindx = 0; cindx < loop_ub; cindx++) { indx->data[cindx] = iindx->data[cindx]; } emlrtPopRtStackR2012b(&ql_emlrtRSI, emlrtRootTLSGlobal); emlrtPopRtStackR2012b(&vf_emlrtRSI, emlrtRootTLSGlobal); emlrtPushRtStackR2012b(&wf_emlrtRSI, emlrtRootTLSGlobal); ajj = ((real_T)Sigma->size[1] - 1.0) * (real_T)Sigma->size[0]; emlrtPushRtStackR2012b(&hc_emlrtRSI, emlrtRootTLSGlobal); if ((Sigma->size[0] == 0) || (ajj < 0.0)) { colj = -1; f_y = ajj; overflow = FALSE; } else { ndbl = muDoubleScalarFloor(ajj / (real_T)Sigma->size[0] + 0.5); f_y = ndbl * (real_T)Sigma->size[0]; cdiff = f_y - ajj; if (muDoubleScalarAbs(cdiff) < 4.4408920985006262E-16 * ajj) { ndbl++; f_y = ajj; } else if (cdiff > 0.0) { f_y = (ndbl - 1.0) * (real_T)Sigma->size[0]; } else { ndbl++; } overflow = (2.147483647E+9 < ndbl); colj = (int32_T)ndbl - 1; } emlrtPushRtStackR2012b(&ic_emlrtRSI, emlrtRootTLSGlobal); if (!overflow) { } else { emlrtPushRtStackR2012b(&kc_emlrtRSI, emlrtRootTLSGlobal); g_y = NULL; m9 = mxCreateCharArray(2, iv40); for (i = 0; i < 21; i++) { cv48[i] = cv49[i]; } emlrtInitCharArrayR2013a(emlrtRootTLSGlobal, 21, m9, cv48); emlrtAssign(&g_y, m9); error(message(g_y, &e_emlrtMCI), &f_emlrtMCI); emlrtPopRtStackR2012b(&kc_emlrtRSI, emlrtRootTLSGlobal); } b_emxInit_real_T(&r24, 2, &kb_emlrtRTEI, TRUE); emlrtPopRtStackR2012b(&ic_emlrtRSI, emlrtRootTLSGlobal); cindx = r24->size[0] * r24->size[1]; r24->size[0] = 1; r24->size[1] = colj + 1; emxEnsureCapacity((emxArray__common *)r24, cindx, (int32_T)sizeof(real_T), &b_emlrtRTEI); if (colj + 1 > 0) { r24->data[0] = 0.0; if (colj + 1 > 1) { r24->data[colj] = f_y; cindx = colj + (colj < 0); if (cindx >= 0) { ix = (int32_T)((uint32_T)cindx >> 1); } else { ix = ~(int32_T)((uint32_T)~cindx >> 1); } emlrtPushRtStackR2012b(&jc_emlrtRSI, emlrtRootTLSGlobal); emlrtPopRtStackR2012b(&jc_emlrtRSI, emlrtRootTLSGlobal); for (iy = 1; iy < ix; iy++) { ajj = (real_T)iy * (real_T)Sigma->size[0]; r24->data[iy] = ajj; r24->data[colj - iy] = f_y - ajj; } if (ix << 1 == colj) { r24->data[ix] = f_y / 2.0; } else { ajj = (real_T)ix * (real_T)Sigma->size[0]; r24->data[ix] = ajj; r24->data[ix + 1] = f_y - ajj; } } } emlrtPopRtStackR2012b(&hc_emlrtRSI, emlrtRootTLSGlobal); emlrtPopRtStackR2012b(&wf_emlrtRSI, emlrtRootTLSGlobal); for (cindx = 0; cindx < 2; cindx++) { b_Sigma[cindx] = indx->size[cindx]; } for (cindx = 0; cindx < 2; cindx++) { maxval_size[cindx] = r24->size[cindx]; } emlrtSizeEqCheck2DFastR2012b(b_Sigma, maxval_size, &ib_emlrtECI, emlrtRootTLSGlobal); emlrtMatrixMatrixIndexCheckR2012b(*(int32_T (*)[2])b_U->size, 2, *(int32_T (*)[2])indx->size, 2, &hb_emlrtECI, emlrtRootTLSGlobal); cindx = negloc->size[0] * negloc->size[1]; negloc->size[0] = 1; negloc->size[1] = indx->size[1]; emxEnsureCapacity((emxArray__common *)negloc, cindx, (int32_T)sizeof (boolean_T), &kb_emlrtRTEI); loop_ub = indx->size[0] * indx->size[1]; for (cindx = 0; cindx < loop_ub; cindx++) { info = b_U->size[0] * b_U->size[1]; ajj = indx->data[cindx] + r24->data[cindx]; iy = (int32_T)emlrtIntegerCheckFastR2012b(ajj, &h_emlrtDCI, emlrtRootTLSGlobal); negloc->data[cindx] = (b_U->data[emlrtDynamicBoundsCheckFastR2012b(iy, 1, info, &jd_emlrtBCI, emlrtRootTLSGlobal) - 1] < 0.0); } emxFree_real_T(&indx); emxFree_real_T(&r24); emxInit_int32_T(&r25, 1, &kb_emlrtRTEI, TRUE); loop_ub = b_U->size[0]; cindx = r25->size[0]; r25->size[0] = loop_ub; emxEnsureCapacity((emxArray__common *)r25, cindx, (int32_T)sizeof(int32_T), &kb_emlrtRTEI); for (cindx = 0; cindx < loop_ub; cindx++) { r25->data[cindx] = cindx; } b_emxInit_int32_T(&r26, 2, &kb_emlrtRTEI, TRUE); emlrtPushRtStackR2012b(&xf_emlrtRSI, emlrtRootTLSGlobal); eml_li_find(negloc, iindx); cindx = r26->size[0] * r26->size[1]; r26->size[0] = 1; r26->size[1] = iindx->size[1]; emxEnsureCapacity((emxArray__common *)r26, cindx, (int32_T)sizeof(int32_T), &kb_emlrtRTEI); loop_ub = iindx->size[0] * iindx->size[1]; for (cindx = 0; cindx < loop_ub; cindx++) { info = b_U->size[1]; iy = iindx->data[cindx]; r26->data[cindx] = emlrtDynamicBoundsCheckFastR2012b(iy, 1, info, &kd_emlrtBCI, emlrtRootTLSGlobal); } emxInit_int32_T(&r27, 1, &kb_emlrtRTEI, TRUE); cindx = r27->size[0]; r27->size[0] = r26->size[1]; emxEnsureCapacity((emxArray__common *)r27, cindx, (int32_T)sizeof(int32_T), &kb_emlrtRTEI); loop_ub = r26->size[1]; for (cindx = 0; cindx < loop_ub; cindx++) { r27->data[cindx] = r26->data[cindx] - 1; } emxFree_int32_T(&r26); b_emxInit_int32_T(&r28, 2, &kb_emlrtRTEI, TRUE); emlrtPopRtStackR2012b(&xf_emlrtRSI, emlrtRootTLSGlobal); emlrtPushRtStackR2012b(&xf_emlrtRSI, emlrtRootTLSGlobal); eml_li_find(negloc, iindx); cindx = r28->size[0] * r28->size[1]; r28->size[0] = 1; r28->size[1] = iindx->size[1]; emxEnsureCapacity((emxArray__common *)r28, cindx, (int32_T)sizeof(int32_T), &kb_emlrtRTEI); loop_ub = iindx->size[0] * iindx->size[1]; for (cindx = 0; cindx < loop_ub; cindx++) { info = b_U->size[1]; iy = iindx->data[cindx]; r28->data[cindx] = emlrtDynamicBoundsCheckFastR2012b(iy, 1, info, &ld_emlrtBCI, emlrtRootTLSGlobal); } emxFree_int32_T(&iindx); loop_ub = b_U->size[0]; iy = r28->size[1]; cindx = V->size[0] * V->size[1]; V->size[0] = loop_ub; V->size[1] = iy; emxEnsureCapacity((emxArray__common *)V, cindx, (int32_T)sizeof(real_T), &kb_emlrtRTEI); for (cindx = 0; cindx < iy; cindx++) { for (info = 0; info < loop_ub; info++) { V->data[info + V->size[0] * cindx] = -b_U->data[info + b_U->size[0] * (r28->data[cindx] - 1)]; } } emxFree_int32_T(&r28); emlrtPopRtStackR2012b(&xf_emlrtRSI, emlrtRootTLSGlobal); iv41[0] = r25->size[0]; iv41[1] = r27->size[0]; emlrtSubAssignSizeCheckR2012b(iv41, 2, *(int32_T (*)[2])V->size, 2, &gb_emlrtECI, emlrtRootTLSGlobal); loop_ub = V->size[1]; for (cindx = 0; cindx < loop_ub; cindx++) { nmj = V->size[0]; for (info = 0; info < nmj; info++) { b_U->data[r25->data[info] + b_U->size[0] * r27->data[cindx]] = V-> data[info + V->size[0] * cindx]; } } emxFree_int32_T(&r27); /* D = flipud(real(diag(D))); */ /* D = real(diag(D)); */ /* D = sort(real(diag(D))); */ emlrtPushRtStackR2012b(&yf_emlrtRSI, emlrtRootTLSGlobal); emlrtPushRtStackR2012b(&eg_emlrtRSI, emlrtRootTLSGlobal); emlrtPushRtStackR2012b(&fg_emlrtRSI, emlrtRootTLSGlobal); if (((c_D->size[0] == 1) && (c_D->size[1] == 1)) || (c_D->size[0] != 1)) { overflow = TRUE; } else { overflow = FALSE; } if (overflow) { } else { emlrtPushRtStackR2012b(&gg_emlrtRSI, emlrtRootTLSGlobal); h_y = NULL; m9 = mxCreateCharArray(2, iv42); for (i = 0; i < 36; i++) { cv42[i] = cv43[i]; } emlrtInitCharArrayR2013a(emlrtRootTLSGlobal, 36, m9, cv42); emlrtAssign(&h_y, m9); error(message(h_y, &kb_emlrtMCI), &lb_emlrtMCI); emlrtPopRtStackR2012b(&gg_emlrtRSI, emlrtRootTLSGlobal); } if (c_D->size[0] > 0) { } else { emlrtPushRtStackR2012b(&hg_emlrtRSI, emlrtRootTLSGlobal); i_y = NULL; m9 = mxCreateCharArray(2, iv43); for (i = 0; i < 39; i++) { cv44[i] = cv45[i]; } emlrtInitCharArrayR2013a(emlrtRootTLSGlobal, 39, m9, cv44); emlrtAssign(&i_y, m9); error(message(i_y, &mb_emlrtMCI), &nb_emlrtMCI); emlrtPopRtStackR2012b(&hg_emlrtRSI, emlrtRootTLSGlobal); } for (cindx = 0; cindx < 2; cindx++) { outsz[cindx] = (uint32_T)c_D->size[cindx]; } b_maxval_size[1] = (int32_T)outsz[1]; ix = 0; iy = -1; emlrtPushRtStackR2012b(&ig_emlrtRSI, emlrtRootTLSGlobal); if (1 > c_D->size[1]) { overflow = FALSE; } else { overflow = (c_D->size[1] > 2147483646); } if (overflow) { emlrtPushRtStackR2012b(&lc_emlrtRSI, emlrtRootTLSGlobal); check_forloop_overflow_error(); emlrtPopRtStackR2012b(&lc_emlrtRSI, emlrtRootTLSGlobal); } emlrtPopRtStackR2012b(&ig_emlrtRSI, emlrtRootTLSGlobal); for (i = 1; i <= c_D->size[1]; i++) { emlrtPushRtStackR2012b(&jg_emlrtRSI, emlrtRootTLSGlobal); colj = ix; nmj = ix + c_D->size[0]; ajj = c_D->data[ix]; if (c_D->size[0] > 1) { if (muDoubleScalarIsNaN(c_D->data[ix])) { emlrtPushRtStackR2012b(&lg_emlrtRSI, emlrtRootTLSGlobal); if (ix + 2 > nmj) { d_ix = FALSE; } else { d_ix = (nmj > 2147483646); } if (d_ix) { emlrtPushRtStackR2012b(&lc_emlrtRSI, emlrtRootTLSGlobal); check_forloop_overflow_error(); emlrtPopRtStackR2012b(&lc_emlrtRSI, emlrtRootTLSGlobal); } emlrtPopRtStackR2012b(&lg_emlrtRSI, emlrtRootTLSGlobal); info = ix + 1; exitg1 = FALSE; while ((exitg1 == FALSE) && (info + 1 <= nmj)) { colj = info; if (!muDoubleScalarIsNaN(c_D->data[info])) { ajj = c_D->data[info]; exitg1 = TRUE; } else { info++; } } } if (colj + 1 < nmj) { emlrtPushRtStackR2012b(&kg_emlrtRSI, emlrtRootTLSGlobal); if (colj + 2 > nmj) { d_colj = FALSE; } else { d_colj = (nmj > 2147483646); } if (d_colj) { emlrtPushRtStackR2012b(&lc_emlrtRSI, emlrtRootTLSGlobal); check_forloop_overflow_error(); emlrtPopRtStackR2012b(&lc_emlrtRSI, emlrtRootTLSGlobal); } emlrtPopRtStackR2012b(&kg_emlrtRSI, emlrtRootTLSGlobal); for (info = colj + 1; info + 1 <= nmj; info++) { if (c_D->data[info] > ajj) { ajj = c_D->data[info]; } } } } emlrtPopRtStackR2012b(&jg_emlrtRSI, emlrtRootTLSGlobal); iy++; maxval_data[iy] = ajj; ix += c_D->size[0]; } emlrtPopRtStackR2012b(&fg_emlrtRSI, emlrtRootTLSGlobal); emlrtPopRtStackR2012b(&eg_emlrtRSI, emlrtRootTLSGlobal); if ((0 == c_D->size[0]) || (0 == c_D->size[1])) { colj = 0; } else if (c_D->size[0] > c_D->size[1]) { colj = c_D->size[0]; } else { colj = c_D->size[1]; } for (cindx = 0; cindx < 2; cindx++) { outsz[cindx] = (uint32_T)c_D->size[cindx]; } ix = (int32_T)outsz[0]; if ((int32_T)outsz[1] > (int32_T)outsz[0]) { ix = (int32_T)outsz[1]; } c_maxval_size[0] = 1; c_maxval_size[1] = b_maxval_size[1]; loop_ub = b_maxval_size[1]; for (cindx = 0; cindx < loop_ub; cindx++) { b_maxval_data[cindx] = maxval_data[cindx]; } b_emxInit_real_T(&maxval, 2, &kb_emlrtRTEI, TRUE); eps(b_maxval_data, c_maxval_size, maxval_data, b_maxval_size); cindx = maxval->size[0] * maxval->size[1]; maxval->size[0] = 1; maxval->size[1] = b_maxval_size[1]; emxEnsureCapacity((emxArray__common *)maxval, cindx, (int32_T)sizeof (real_T), &kb_emlrtRTEI); loop_ub = b_maxval_size[0] * b_maxval_size[1]; for (cindx = 0; cindx < loop_ub; cindx++) { maxval->data[cindx] = maxval_data[cindx] * (real_T)colj; } repmat(maxval->data, maxval->size, ix, tol); emlrtPopRtStackR2012b(&yf_emlrtRSI, emlrtRootTLSGlobal); b_abs(c_D, V); emxFree_real_T(&maxval); for (cindx = 0; cindx < 2; cindx++) { c_V[cindx] = V->size[cindx]; } for (cindx = 0; cindx < 2; cindx++) { b_Sigma[cindx] = tol->size[cindx]; } emxInit_boolean_T(&t_, 2, &nb_emlrtRTEI, TRUE); emlrtSizeEqCheck2DFastR2012b(c_V, b_Sigma, &fb_emlrtECI, emlrtRootTLSGlobal); cindx = t_->size[0] * t_->size[1]; t_->size[0] = V->size[0]; t_->size[1] = V->size[1]; emxEnsureCapacity((emxArray__common *)t_, cindx, (int32_T)sizeof(boolean_T), &kb_emlrtRTEI); loop_ub = V->size[0] * V->size[1]; for (cindx = 0; cindx < loop_ub; cindx++) { t_->data[cindx] = (V->data[cindx] > tol->data[cindx]); } emxFree_real_T(&tol); emlrtPushRtStackR2012b(&ag_emlrtRSI, emlrtRootTLSGlobal); b_eml_li_find(t_, r25); emlrtPopRtStackR2012b(&ag_emlrtRSI, emlrtRootTLSGlobal); emlrtMatrixMatrixIndexCheckR2012b(*(int32_T (*)[2])c_D->size, 2, *(int32_T (*)[1])r25->size, 1, &eb_emlrtECI, emlrtRootTLSGlobal); loop_ub = r25->size[0]; for (cindx = 0; cindx < loop_ub; cindx++) { info = c_D->size[0] * c_D->size[1]; iy = r25->data[cindx]; emlrtDynamicBoundsCheckFastR2012b(iy, 1, info, &md_emlrtBCI, emlrtRootTLSGlobal); } b_emxInit_boolean_T(&x, 1, &kb_emlrtRTEI, TRUE); emlrtPushRtStackR2012b(&bg_emlrtRSI, emlrtRootTLSGlobal); cindx = x->size[0]; x->size[0] = r25->size[0]; emxEnsureCapacity((emxArray__common *)x, cindx, (int32_T)sizeof(boolean_T), &kb_emlrtRTEI); loop_ub = r25->size[0]; for (cindx = 0; cindx < loop_ub; cindx++) { x->data[cindx] = (c_D->data[r25->data[cindx] - 1] < 0.0); } overflow = !c_isequal(x); if (overflow) { } else { emlrtPushRtStackR2012b(&xl_emlrtRSI, emlrtRootTLSGlobal); j_y = NULL; m9 = mxCreateCharArray(2, iv44); for (i = 0; i < 30; i++) { cv50[i] = cv51[i]; } emlrtInitCharArrayR2013a(emlrtRootTLSGlobal, 30, m9, cv50); emlrtAssign(&j_y, m9); error(message(j_y, &ac_emlrtMCI), &bc_emlrtMCI); emlrtPopRtStackR2012b(&xl_emlrtRSI, emlrtRootTLSGlobal); } if ((x->size[0] == 1) || (x->size[0] != 1)) { overflow = TRUE; } else { overflow = FALSE; } if (overflow) { } else { emlrtPushRtStackR2012b(&yl_emlrtRSI, emlrtRootTLSGlobal); k_y = NULL; m9 = mxCreateCharArray(2, iv45); for (i = 0; i < 36; i++) { cv42[i] = cv43[i]; } emlrtInitCharArrayR2013a(emlrtRootTLSGlobal, 36, m9, cv42); emlrtAssign(&k_y, m9); error(message(k_y, &cc_emlrtMCI), &dc_emlrtMCI); emlrtPopRtStackR2012b(&yl_emlrtRSI, emlrtRootTLSGlobal); } if (x->size[0] == 0) { *p = 0.0; } else { *p = x->data[0]; emlrtPushRtStackR2012b(&am_emlrtRSI, emlrtRootTLSGlobal); if (2 > x->size[0]) { overflow = FALSE; } else { overflow = (x->size[0] > 2147483646); } if (overflow) { emlrtPushRtStackR2012b(&lc_emlrtRSI, emlrtRootTLSGlobal); check_forloop_overflow_error(); emlrtPopRtStackR2012b(&lc_emlrtRSI, emlrtRootTLSGlobal); } emlrtPopRtStackR2012b(&am_emlrtRSI, emlrtRootTLSGlobal); for (iy = 2; iy <= x->size[0]; iy++) { *p += (real_T)x->data[iy - 1]; } } emxFree_boolean_T(&x); emlrtPopRtStackR2012b(&bg_emlrtRSI, emlrtRootTLSGlobal); /* number of negative eigenvalues */ if (*p == 0.0) { emxInit_real_T(&b_x, 1, &kb_emlrtRTEI, TRUE); emlrtPushRtStackR2012b(&cg_emlrtRSI, emlrtRootTLSGlobal); cindx = b_x->size[0]; b_x->size[0] = r25->size[0]; emxEnsureCapacity((emxArray__common *)b_x, cindx, (int32_T)sizeof(real_T), &kb_emlrtRTEI); loop_ub = r25->size[0]; for (cindx = 0; cindx < loop_ub; cindx++) { b_x->data[cindx] = c_D->data[r25->data[cindx] - 1]; } for (iy = 0; iy < r25->size[0]; iy++) { if (c_D->data[r25->data[(int32_T)(1.0 + (real_T)iy) - 1] - 1] < 0.0) { emlrtPushRtStackR2012b(&md_emlrtRSI, emlrtRootTLSGlobal); e_eml_error(); emlrtPopRtStackR2012b(&md_emlrtRSI, emlrtRootTLSGlobal); } } for (iy = 0; iy < r25->size[0]; iy++) { b_x->data[(int32_T)(1.0 + (real_T)iy) - 1] = muDoubleScalarSqrt (b_x->data[(int32_T)(1.0 + (real_T)iy) - 1]); } iy = b_x->size[0]; ix = b_x->size[0]; cindx = V->size[0] * V->size[1]; V->size[0] = iy; emxEnsureCapacity((emxArray__common *)V, cindx, (int32_T)sizeof(real_T), &kb_emlrtRTEI); cindx = V->size[0] * V->size[1]; V->size[1] = ix; emxEnsureCapacity((emxArray__common *)V, cindx, (int32_T)sizeof(real_T), &kb_emlrtRTEI); loop_ub = iy * ix; for (cindx = 0; cindx < loop_ub; cindx++) { V->data[cindx] = 0.0; } emlrtPushRtStackR2012b(&cl_emlrtRSI, emlrtRootTLSGlobal); if (1 > b_x->size[0]) { overflow = FALSE; } else { overflow = (b_x->size[0] > 2147483646); } if (overflow) { emlrtPushRtStackR2012b(&lc_emlrtRSI, emlrtRootTLSGlobal); check_forloop_overflow_error(); emlrtPopRtStackR2012b(&lc_emlrtRSI, emlrtRootTLSGlobal); } emlrtPopRtStackR2012b(&cl_emlrtRSI, emlrtRootTLSGlobal); for (loop_ub = 0; loop_ub + 1 <= b_x->size[0]; loop_ub++) { V->data[loop_ub + V->size[0] * loop_ub] = b_x->data[loop_ub]; } emxFree_real_T(&b_x); b_emxInit_real_T(&b, 2, &kb_emlrtRTEI, TRUE); b_eml_li_find(t_, r25); loop_ub = b_U->size[0]; cindx = b->size[0] * b->size[1]; b->size[0] = r25->size[0]; b->size[1] = loop_ub; emxEnsureCapacity((emxArray__common *)b, cindx, (int32_T)sizeof(real_T), &kb_emlrtRTEI); for (cindx = 0; cindx < loop_ub; cindx++) { nmj = r25->size[0]; for (info = 0; info < nmj; info++) { iy = b_U->size[1]; colj = r25->data[info]; b->data[info + b->size[0] * cindx] = b_U->data[cindx + b_U->size[0] * (emlrtDynamicBoundsCheckFastR2012b(colj, 1, iy, &nd_emlrtBCI, emlrtRootTLSGlobal) - 1)]; } } emlrtPushRtStackR2012b(&ud_emlrtRSI, emlrtRootTLSGlobal); if (!(V->size[1] == b->size[0])) { if (((V->size[0] == 1) && (V->size[1] == 1)) || ((b->size[0] == 1) && (b->size[1] == 1))) { emlrtPushRtStackR2012b(&wd_emlrtRSI, emlrtRootTLSGlobal); l_y = NULL; m9 = mxCreateCharArray(2, iv46); for (i = 0; i < 45; i++) { cv52[i] = cv53[i]; } emlrtInitCharArrayR2013a(emlrtRootTLSGlobal, 45, m9, cv52); emlrtAssign(&l_y, m9); error(message(l_y, &r_emlrtMCI), &s_emlrtMCI); emlrtPopRtStackR2012b(&wd_emlrtRSI, emlrtRootTLSGlobal); } else { emlrtPushRtStackR2012b(&vd_emlrtRSI, emlrtRootTLSGlobal); m_y = NULL; m9 = mxCreateCharArray(2, iv47); for (i = 0; i < 21; i++) { cv48[i] = cv54[i]; } emlrtInitCharArrayR2013a(emlrtRootTLSGlobal, 21, m9, cv48); emlrtAssign(&m_y, m9); error(message(m_y, &t_emlrtMCI), &u_emlrtMCI); emlrtPopRtStackR2012b(&vd_emlrtRSI, emlrtRootTLSGlobal); } } emlrtPopRtStackR2012b(&ud_emlrtRSI, emlrtRootTLSGlobal); b_emxInit_real_T(&n_y, 2, &kb_emlrtRTEI, TRUE); b_emxInit_real_T(&r29, 2, &kb_emlrtRTEI, TRUE); if ((V->size[1] == 1) || (b->size[0] == 1)) { cindx = n_y->size[0] * n_y->size[1]; n_y->size[0] = V->size[0]; n_y->size[1] = b->size[1]; emxEnsureCapacity((emxArray__common *)n_y, cindx, (int32_T)sizeof (real_T), &kb_emlrtRTEI); loop_ub = V->size[0]; for (cindx = 0; cindx < loop_ub; cindx++) { nmj = b->size[1]; for (info = 0; info < nmj; info++) { n_y->data[cindx + n_y->size[0] * info] = 0.0; ix = V->size[1]; for (iy = 0; iy < ix; iy++) { n_y->data[cindx + n_y->size[0] * info] += V->data[cindx + V->size[0] * iy] * b->data[iy + b->size[0] * info]; } } } } else { outsz[0] = (uint32_T)V->size[0]; outsz[1] = (uint32_T)b->size[1]; cindx = r29->size[0] * r29->size[1]; r29->size[0] = (int32_T)outsz[0]; emxEnsureCapacity((emxArray__common *)r29, cindx, (int32_T)sizeof (real_T), &kb_emlrtRTEI); cindx = r29->size[0] * r29->size[1]; r29->size[1] = (int32_T)outsz[1]; emxEnsureCapacity((emxArray__common *)r29, cindx, (int32_T)sizeof (real_T), &kb_emlrtRTEI); loop_ub = (int32_T)outsz[0] * (int32_T)outsz[1]; for (cindx = 0; cindx < loop_ub; cindx++) { r29->data[cindx] = 0.0; } emlrtPushRtStackR2012b(&ge_emlrtRSI, emlrtRootTLSGlobal); emlrtPushRtStackR2012b(&he_emlrtRSI, emlrtRootTLSGlobal); cindx = n_y->size[0] * n_y->size[1]; n_y->size[0] = (int32_T)outsz[0]; emxEnsureCapacity((emxArray__common *)n_y, cindx, (int32_T)sizeof (real_T), &kb_emlrtRTEI); cindx = n_y->size[0] * n_y->size[1]; n_y->size[1] = (int32_T)outsz[1]; emxEnsureCapacity((emxArray__common *)n_y, cindx, (int32_T)sizeof (real_T), &kb_emlrtRTEI); loop_ub = (int32_T)outsz[0] * (int32_T)outsz[1]; for (cindx = 0; cindx < loop_ub; cindx++) { n_y->data[cindx] = 0.0; } if ((V->size[0] < 1) || (b->size[1] < 1) || (V->size[1] < 1)) { } else { emlrtPushRtStackR2012b(&je_emlrtRSI, emlrtRootTLSGlobal); ndbl = 1.0; cdiff = 0.0; TRANSB = 'N'; TRANSA = 'N'; emlrtPushRtStackR2012b(&ne_emlrtRSI, emlrtRootTLSGlobal); emlrtPushRtStackR2012b(&af_emlrtRSI, emlrtRootTLSGlobal); m_t = (ptrdiff_t)(V->size[0]); emlrtPopRtStackR2012b(&af_emlrtRSI, emlrtRootTLSGlobal); emlrtPopRtStackR2012b(&ne_emlrtRSI, emlrtRootTLSGlobal); emlrtPushRtStackR2012b(&oe_emlrtRSI, emlrtRootTLSGlobal); emlrtPushRtStackR2012b(&af_emlrtRSI, emlrtRootTLSGlobal); n_t = (ptrdiff_t)(b->size[1]); emlrtPopRtStackR2012b(&af_emlrtRSI, emlrtRootTLSGlobal); emlrtPopRtStackR2012b(&oe_emlrtRSI, emlrtRootTLSGlobal); emlrtPushRtStackR2012b(&pe_emlrtRSI, emlrtRootTLSGlobal); emlrtPushRtStackR2012b(&af_emlrtRSI, emlrtRootTLSGlobal); incx_t = (ptrdiff_t)(V->size[1]); emlrtPopRtStackR2012b(&af_emlrtRSI, emlrtRootTLSGlobal); emlrtPopRtStackR2012b(&pe_emlrtRSI, emlrtRootTLSGlobal); emlrtPushRtStackR2012b(&qe_emlrtRSI, emlrtRootTLSGlobal); emlrtPushRtStackR2012b(&af_emlrtRSI, emlrtRootTLSGlobal); lda_t = (ptrdiff_t)(V->size[0]); emlrtPopRtStackR2012b(&af_emlrtRSI, emlrtRootTLSGlobal); emlrtPopRtStackR2012b(&qe_emlrtRSI, emlrtRootTLSGlobal); emlrtPushRtStackR2012b(&re_emlrtRSI, emlrtRootTLSGlobal); emlrtPushRtStackR2012b(&af_emlrtRSI, emlrtRootTLSGlobal); incy_t = (ptrdiff_t)(V->size[1]); emlrtPopRtStackR2012b(&af_emlrtRSI, emlrtRootTLSGlobal); emlrtPopRtStackR2012b(&re_emlrtRSI, emlrtRootTLSGlobal); emlrtPushRtStackR2012b(&se_emlrtRSI, emlrtRootTLSGlobal); emlrtPushRtStackR2012b(&af_emlrtRSI, emlrtRootTLSGlobal); ldc_t = (ptrdiff_t)(V->size[0]); emlrtPopRtStackR2012b(&af_emlrtRSI, emlrtRootTLSGlobal); emlrtPopRtStackR2012b(&se_emlrtRSI, emlrtRootTLSGlobal); emlrtPushRtStackR2012b(&te_emlrtRSI, emlrtRootTLSGlobal); alpha1_t = (double *)(&ndbl); emlrtPopRtStackR2012b(&te_emlrtRSI, emlrtRootTLSGlobal); emlrtPushRtStackR2012b(&ue_emlrtRSI, emlrtRootTLSGlobal); xix0_t = (double *)(&V->data[0]); emlrtPopRtStackR2012b(&ue_emlrtRSI, emlrtRootTLSGlobal); emlrtPushRtStackR2012b(&ve_emlrtRSI, emlrtRootTLSGlobal); yix0_t = (double *)(&b->data[0]); emlrtPopRtStackR2012b(&ve_emlrtRSI, emlrtRootTLSGlobal); emlrtPushRtStackR2012b(&we_emlrtRSI, emlrtRootTLSGlobal); beta1_t = (double *)(&cdiff); emlrtPopRtStackR2012b(&we_emlrtRSI, emlrtRootTLSGlobal); emlrtPushRtStackR2012b(&xe_emlrtRSI, emlrtRootTLSGlobal); yiy0_t = (double *)(&n_y->data[0]); emlrtPopRtStackR2012b(&xe_emlrtRSI, emlrtRootTLSGlobal); emlrtPushRtStackR2012b(&ye_emlrtRSI, emlrtRootTLSGlobal); dgemm(&TRANSA, &TRANSB, &m_t, &n_t, &incx_t, alpha1_t, xix0_t, &lda_t, yix0_t, &incy_t, beta1_t, yiy0_t, &ldc_t); emlrtPopRtStackR2012b(&ye_emlrtRSI, emlrtRootTLSGlobal); emlrtPopRtStackR2012b(&je_emlrtRSI, emlrtRootTLSGlobal); } emlrtPopRtStackR2012b(&he_emlrtRSI, emlrtRootTLSGlobal); emlrtPopRtStackR2012b(&ge_emlrtRSI, emlrtRootTLSGlobal); } emxFree_real_T(&r29); emxFree_real_T(&b); cindx = T->size[0] * T->size[1]; T->size[0] = n_y->size[0]; T->size[1] = n_y->size[1]; emxEnsureCapacity((emxArray__common *)T, cindx, (int32_T)sizeof(real_T), &kb_emlrtRTEI); loop_ub = n_y->size[0] * n_y->size[1]; for (cindx = 0; cindx < loop_ub; cindx++) { T->data[cindx] = n_y->data[cindx]; } emxFree_real_T(&n_y); emlrtPopRtStackR2012b(&cg_emlrtRSI, emlrtRootTLSGlobal); } else { cindx = T->size[0] * T->size[1]; T->size[0] = 0; T->size[1] = 0; emxEnsureCapacity((emxArray__common *)T, cindx, (int32_T)sizeof(real_T), &kb_emlrtRTEI); } emxFree_int32_T(&r25); emxFree_real_T(&c_D); emxFree_real_T(&b_U); emxFree_boolean_T(&t_); } } else { cindx = T->size[0] * T->size[1]; T->size[0] = 0; T->size[1] = 0; emxEnsureCapacity((emxArray__common *)T, cindx, (int32_T)sizeof(real_T), &kb_emlrtRTEI); *p = rtNaN; } emxFree_real_T(&V); emxFree_boolean_T(&negloc); emlrtHeapReferenceStackLeaveFcnR2012b(emlrtRootTLSGlobal); } void eml_li_find(const emxArray_boolean_T *x, emxArray_int32_T *y) { int32_T k; boolean_T overflow; int32_T i; const mxArray *b_y; const mxArray *m3; int32_T j; emlrtPushRtStackR2012b(&rc_emlrtRSI, emlrtRootTLSGlobal); k = 0; emlrtPushRtStackR2012b(&uc_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(&uc_emlrtRSI, emlrtRootTLSGlobal); for (i = 1; i <= x->size[1]; i++) { if (x->data[i - 1]) { k++; } } emlrtPopRtStackR2012b(&rc_emlrtRSI, emlrtRootTLSGlobal); if (k <= x->size[1]) { } else { emlrtPushRtStackR2012b(&sc_emlrtRSI, emlrtRootTLSGlobal); b_y = NULL; m3 = mxCreateString("Assertion failed."); emlrtAssign(&b_y, m3); error(b_y, &m_emlrtMCI); emlrtPopRtStackR2012b(&sc_emlrtRSI, emlrtRootTLSGlobal); } j = y->size[0] * y->size[1]; y->size[0] = 1; y->size[1] = k; emxEnsureCapacity((emxArray__common *)y, j, (int32_T)sizeof(int32_T), &y_emlrtRTEI); j = 0; emlrtPushRtStackR2012b(&tc_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(&tc_emlrtRSI, emlrtRootTLSGlobal); for (i = 1; i <= x->size[1]; i++) { if (x->data[i - 1]) { y->data[j] = i; j++; } } } /* End of code generation (cholcov_.c) */