Mercurial > octave-nkf
diff src/DLD-FUNCTIONS/det.cc @ 3808:885b296ef83a
[project @ 2001-03-27 19:12:58 by jwe]
author | jwe |
---|---|
date | Tue, 27 Mar 2001 19:12:59 +0000 |
parents | ab7fa5a8f23f |
children | 23994b10c8b7 |
line wrap: on
line diff
--- a/src/DLD-FUNCTIONS/det.cc Thu Mar 08 21:21:33 2001 +0000 +++ b/src/DLD-FUNCTIONS/det.cc Tue Mar 27 19:12:59 2001 +0000 @@ -33,10 +33,11 @@ #include "oct-obj.h" #include "utils.h" -DEFUN_DLD (det, args, , +DEFUN_DLD (det, args, nargout, "-*- texinfo -*-\n\ -@deftypefn {Loadable Function} {} det (@var{a})\n\ -Compute the determinant of @var{a} using @sc{Linpack}.\n\ +@deftypefn {Loadable Function} {[@var{d}, @var{rcond}] = } det (@var{a})\n\ +Compute the determinant of @var{a} using @sc{Linpack}. Return an estimate\n\ +of the reciprocal condition number if requested.\n\ @end deftypefn") { octave_value_list retval; @@ -83,15 +84,10 @@ DET det = m.determinant (info, rcond); - double d = 0.0; + if (nargout > 1) + retval(1) = rcond; - if (info == -1) - warning ("det: matrix singular to machine precision, rcond = %g", - rcond); - else - d = det.value (); - - retval = d; + retval(0) = (info == -1 ? 0.0 : det.value ()); } } else if (arg.is_complex_type ()) @@ -105,15 +101,10 @@ ComplexDET det = m.determinant (info, rcond); - Complex c = 0.0; + if (nargout > 1) + retval(1) = rcond; - if (info == -1) - warning ("det: matrix singular to machine precision, rcond = %g", - rcond); - else - c = det.value (); - - retval = c; + retval(0) = (info == -1 ? 0.0 : det.value ()); } } else