Mercurial > hg > octave-terminal
changeset 12798:6fdf4927fefc
codesprint: Write 6 tests for isdefinite
author | Sean Young <seannz@gmail.com> |
---|---|
date | Sat, 16 Jul 2011 12:31:48 -0500 |
parents | 71265f725b11 |
children | e0b174e99449 |
files | scripts/linear-algebra/isdefinite.m |
diffstat | 1 files changed, 19 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/scripts/linear-algebra/isdefinite.m +++ b/scripts/linear-algebra/isdefinite.m @@ -63,3 +63,22 @@ endif endfunction + +%!test +%! A = [-1 0; 0 -1]; +%! assert (isdefinite (A), -1) + +%!test +%! A = [1 0; 0 1]; +%! assert (isdefinite (A), 1) + +%!test +%! A = [2 -1 0; -1 2 -1; 0 -1 2]; +%! assert (isdefinite (A), 1) + +%!test +%! A = [1 0; 0 0]; +%! assert (isdefinite (A), 0) + +%!error isdefinite () +%!error isdefinite ([1 2; 3 4]) \ No newline at end of file