Mercurial > octave-nkf
diff src/DLD-FUNCTIONS/eig.cc @ 7814:87865ed7405f
Second set of single precision test code and fix of resulting bugs
author | David Bateman <dbateman@free.fr> |
---|---|
date | Mon, 02 Jun 2008 16:57:45 +0200 |
parents | 82be108cc558 |
children | 18c4ded8612a |
line wrap: on
line diff
--- a/src/DLD-FUNCTIONS/eig.cc Thu May 22 22:00:26 2008 +0200 +++ b/src/DLD-FUNCTIONS/eig.cc Mon Jun 02 16:57:45 2008 +0200 @@ -169,6 +169,30 @@ } /* + +%!assert(eig ([1, 2; 2, 1]), [-1; 3], sqrt (eps)); + +%!test +%! [v, d] = eig ([1, 2; 2, 1]); +%! x = 1 / sqrt (2); +%! assert(d, [-1, 0; 0, 3], sqrt (eps)); +%! assert(v, [-x, x; x, x], sqrt (eps)); + +%!assert(eig (single ([1, 2; 2, 1])), single([-1; 3]), sqrt (eps('single'))); + +%!test +%! [v, d] = eig (single([1, 2; 2, 1])); +%! x = single(1 / sqrt (2)); +%! assert(d, single([-1, 0; 0, 3]), sqrt (eps('single'))); +%! assert(v, [-x, x; x, x], sqrt (eps('single'))); + +%!error <Invalid call to eig.*> eig (); +%!error <Invalid call to eig.*> eig ([1, 2; 3, 4], 2); +%!error eig ([1, 2; 3, 4; 5, 6]); + + */ + +/* ;;; Local Variables: *** ;;; mode: C++ *** ;;; End: ***