Skip to content

Instantly share code, notes, and snippets.

@mrfarhadir
Created February 7, 2021 09:07
Show Gist options
  • Save mrfarhadir/370148dc68cd7d253a6548de26599999 to your computer and use it in GitHub Desktop.
Save mrfarhadir/370148dc68cd7d253a6548de26599999 to your computer and use it in GitHub Desktop.
function [retval] = isPositiveDefinit(A)
FLAG = 1;
IS_SYMMETRIC = isequal(A,A.');
if (IS_SYMMETRIC == 0)
retval = 0;
else
d = eig(A);
for i=1:size(d)
if (d(i) < 0)
FLAG = 0;
end
end
retval = FLAG;
end
endfunction
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment