Mercurial > octave-nkf
diff src/DLD-FUNCTIONS/expm.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 | b2f212b51488 |
line wrap: on
line diff
--- a/src/DLD-FUNCTIONS/expm.cc Thu May 22 22:00:26 2008 +0200 +++ b/src/DLD-FUNCTIONS/expm.cc Mon Jun 02 16:57:45 2008 +0200 @@ -202,6 +202,43 @@ } /* + +%!assert(expm ([-49, 24; -64, 31]), [-0.735758758144742, 0.551819099658089; +%! -1.471517599088239, 1.103638240715556], 128*eps); + +%!assert(expm ([1, 1; 0, 1]), [2.718281828459045, 2.718281828459045; +%! 0.000000000000000, 2.718281828459045],4 * eps); + +%!test +%! arg = diag ([6, 6, 6], 1); +%! result = [1, 6, 18, 36; +%! 0, 1, 6, 18; +%! 0, 0, 1, 6; +%! 0, 0, 0, 1]; +%! assert(expm (arg), result); + +%!assert(expm (single([-49, 24; -64, 31])), single([-0.735758758144742, ... +%! 0.551819099658089; -1.471517599088239, 1.103638240715556]), ... +%! 512*eps('single')); + +%!assert(expm (single([1, 1; 0, 1])), single([2.718281828459045, ... +%! 2.718281828459045; 0.000000000000000, 2.718281828459045]), ... +%! 4 * eps('single')); + +%!test +%! arg = single(diag ([6, 6, 6], 1)); +%! result = single([1, 6, 18, 36; +%! 0, 1, 6, 18; +%! 0, 0, 1, 6; +%! 0, 0, 0, 1]); +%! assert(expm (arg), result); + +%!error <Invalid call to expm.*> expm(); +%!error <Invalid call to expm.*> expm(1,2); + +*/ + +/* ;;; Local Variables: *** ;;; mode: C++ *** ;;; End: ***