0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012 function [vi,Xv,Rim,nabla_lv,muv,muv1,U1mq,U2m] = diagnostics_GHM_multi_d...
0013 (r_U,I,d_I,d_G,Am,Bm,Cov_ll,W_ll,Cov_xx,W_xx,vv)
0014
0015 [~,U] = size(Am);
0016
0017 delta_0=4.13;
0018
0019 if ~isempty(r_U)
0020
0021 r_C = r_U;
0022 r_D = setdiff(1:U,r_U);
0023
0024 Cm = Am(:,r_C);
0025 Dm = Am(:,r_D);
0026
0027 Cmr = Cm - Dm / W_xx(r_D,r_D) * W_xx(r_D,r_C);
0028 Cov_11 = Cov_xx(r_C,r_C);
0029 end
0030
0031 Rim = zeros(I,d_I^2);
0032 U1mq = zeros(I,d_I^2);
0033 U2m = zeros(I,d_I^2);
0034 vi = zeros(I,d_I);
0035 Xv = zeros(I,1);
0036 nabla_lv = zeros(I,1);
0037 muv = zeros(I,1);
0038 muv1 = zeros(I,1);
0039 for i=1:I
0040
0041 i_range = d_I*i-(d_I-1):d_I*i;
0042 g_range = d_G*i-(d_G-1):d_G*i;
0043 Am_i = Am(g_range,:)';
0044 Bm_i = Bm(i_range,g_range);
0045 Cov_ll_ii = reshape(Cov_ll(i,:),d_I,d_I);
0046 W_ll_ii = W_ll(i_range,i_range);
0047 W_gg_ii = Bm_i' * Cov_ll_ii * Bm_i;
0048
0049 Cov_vv_ii = Cov_ll_ii * Bm_i *...
0050 (eye(d_G) - W_gg_ii *Am_i'*Cov_xx*Am_i)*...
0051 W_gg_ii*Bm_i'*Cov_ll_ii;
0052 W_vv_ii = inv(Cov_vv_ii+eps);
0053 Rii = Cov_vv_ii*W_ll_ii;
0054 Rim(i,:) = Rii(:)';
0055 Rii_inv = full(inv(Rii));
0056 vi(i,:) = vv(i_range)';
0057 Xv(i) = vv(i_range)'*W_vv_ii* vv(i_range);
0058
0059 nabla_lv(i) = delta_0 * ...
0060 sqrt(real(max(eig(Rii_inv*Cov_ll_ii))));
0061
0062 muv(i) = sqrt(real(max(eig(Rii_inv-eye(d_I)))));
0063
0064
0065
0066 if ~isempty(r_U)
0067
0068 U1qc = Cmr(g_range,:) * Cov_11 * Cmr(g_range,:)' * W_gg_ii;
0069 U2c = Dm(g_range,:) / (W_xx(r_D,r_D)) * ...
0070 Dm(g_range,:)' * W_gg_ii;
0071
0072
0073
0074
0075 U1q = Cov_ll_ii*Bm_i*W_gg_ii * U1qc * Bm_i';
0076 U1mq(i,:) = U1q(:)';
0077 U2 = Cov_ll_ii*Bm_i*W_gg_ii * U2c * Bm_i';
0078 U2m(i,:) = U2(:)';
0079
0080
0081
0082 muv1(i) = sqrt(real(max(eig(U1q * Rii_inv))));
0083 end
0084 end