Fix header doc.

covariance-quadratic-approximation
Stéphane Adjemian (Argos) 2024-01-07 17:22:23 +01:00
parent f1d444e198
commit f3c6328af6
Signed by: stepan
GPG Key ID: 295C1FE89E17EB3C
1 changed files with 11 additions and 25 deletions

View File

@ -1,30 +1,15 @@
function [test, penalty] = ispd(A)
%@info:
%! @deftypefn {Function File} {[@var{test}, @var{penalty} =} ispd (@var{A})
%! @anchor{ispd}
%! @sp 1
%! Tests if the square matrix @var{A} is positive definite.
%! @sp 2
%! @strong{Inputs}
%! @sp 1
%! @table @ @var
%! @item A
%! A square matrix.
%! @end table
%! @sp 2
%! @strong{Outputs}
%! @sp 1
%! @table @ @var
%! @item test
%! Integer scalar equal to 1 if @var{A} is a positive definite sqquare matrix, 0 otherwise.
%! @item penalty
%! Absolute value of the uum of the negative eigenvalues of A. This output argument is optional.
%! @end table
%! @end deftypefn
%@eod:
% Test if the square matrix A is positive definite.
%
% INPUTS
% - A [double] n×n matrix.
%
% OUTPUTS
% - test [logical] scalar, true if and only if matrix A is positive definite (and symmetric...)
% - penalty [double] scalar, absolute value of the uum of the negative eigenvalues of A. This output argument is optional.
% Copyright © 2007-2022 Dynare Team
% Copyright © 2007-2024 Dynare Team
%
% This file is part of Dynare.
%
@ -54,6 +39,7 @@ if nargout>1
if isoctave && any(any(~isfinite(A))) % workaround for https://savannah.gnu.org/bugs/index.php?63082
penalty = 1;
else
% TODO: the penalty is only concerned with negative eigenvalues, we should also consider the case of non symmetric matrix A.
a = diag(eig(A));
k = find(a<0);
if k > 0
@ -61,4 +47,4 @@ if nargout>1
end
end
end
end
end