% Try to compute the cholesky decomposition of Q (possible iff Q is positive definite)
[CholQ,testQ]=chol(Q);
iftestQ
% The variance-covariance matrix of the structural innovations is not definite positive. We have to compute the eigenvalues of this matrix in order to build the endogenous penalty.
a=diag(eig(Q));
k=find(a<0);
ifk>0
fval=objective_function_penalty_base+sum(-a(k));
exit_flag=0;
info=43;
return
end
end
end
% Test if H is positive definite.
ifEstimatedParams.ncn
% Try to compute the cholesky decomposition of H (possible iff H is positive definite)
[CholH,testH]=chol(H);
iftestH
% The variance-covariance matrix of the measurement errors is not definite positive. We have to compute the eigenvalues of this matrix in order to build the endogenous penalty.