ispd.m: filter out Octave incompatibility https://savannah.gnu.org/bugs/?63082

bgp-dev
Johannes Pfeifer 2022-09-20 12:42:04 +02:00
parent 128eaa2da5
commit 9506e723c9
1 changed files with 10 additions and 6 deletions

View File

@ -24,7 +24,7 @@ function [test, penalty] = ispd(A)
%! @end deftypefn
%@eod:
% Copyright © 2007-2017 Dynare Team
% Copyright © 2007-2022 Dynare Team
%
% This file is part of Dynare.
%
@ -45,12 +45,15 @@ if ~isquare(A)
error(['ispd:: Input argument ' inputname(1) ' has to be a square matrix!'])
end
[cholA, info] = chol(A);
[~, info] = chol(A);
test = ~info;
if nargout>1
penalty = 0;
if info
if isoctave && any(any(~isfinite(A))) % workaround for https://savannah.gnu.org/bugs/index.php?63082
penalty = 1;
else
a = diag(eig(A));
k = find(a<0);
if k > 0
@ -58,3 +61,4 @@ if nargout>1
end
end
end
end