From f3c6328af6a056cdfc8ff1d4e44dcdb5984a83ba Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?St=C3=A9phane=20Adjemian=20=28Argos=29?= Date: Sun, 7 Jan 2024 17:22:23 +0100 Subject: [PATCH] Fix header doc. --- matlab/utilities/general/ispd.m | 36 ++++++++++----------------------- 1 file changed, 11 insertions(+), 25 deletions(-) diff --git a/matlab/utilities/general/ispd.m b/matlab/utilities/general/ispd.m index ff6ec1291..b9f6fb1f4 100644 --- a/matlab/utilities/general/ispd.m +++ b/matlab/utilities/general/ispd.m @@ -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 \ No newline at end of file +end