ispd.m: filter out Octave incompatibility https://savannah.gnu.org/bugs/?63082
parent
128eaa2da5
commit
9506e723c9
|
@ -24,7 +24,7 @@ function [test, penalty] = ispd(A)
|
||||||
%! @end deftypefn
|
%! @end deftypefn
|
||||||
%@eod:
|
%@eod:
|
||||||
|
|
||||||
% Copyright © 2007-2017 Dynare Team
|
% Copyright © 2007-2022 Dynare Team
|
||||||
%
|
%
|
||||||
% This file is part of Dynare.
|
% 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!'])
|
error(['ispd:: Input argument ' inputname(1) ' has to be a square matrix!'])
|
||||||
end
|
end
|
||||||
|
|
||||||
[cholA, info] = chol(A);
|
[~, info] = chol(A);
|
||||||
test = ~info;
|
test = ~info;
|
||||||
|
|
||||||
if nargout>1
|
if nargout>1
|
||||||
penalty = 0;
|
penalty = 0;
|
||||||
if info
|
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));
|
a = diag(eig(A));
|
||||||
k = find(a<0);
|
k = find(a<0);
|
||||||
if k > 0
|
if k > 0
|
||||||
|
@ -58,3 +61,4 @@ if nargout>1
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
end
|
Loading…
Reference in New Issue